@waitcher/cli 0.2.21 → 0.2.22
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/dist/cli.mjs +203 -98
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -31389,15 +31389,15 @@ ${value2}`;
|
|
|
31389
31389
|
pos = 0;
|
|
31390
31390
|
}
|
|
31391
31391
|
}
|
|
31392
|
-
discardLeadingBytes(
|
|
31393
|
-
while (
|
|
31392
|
+
discardLeadingBytes(count2) {
|
|
31393
|
+
while (count2 > 0 && this.lineChunkIndex < this.chunks.length) {
|
|
31394
31394
|
const chunk = this.chunks[this.lineChunkIndex];
|
|
31395
31395
|
const remaining = chunk.length - this.linePos;
|
|
31396
|
-
if (
|
|
31397
|
-
this.linePos +=
|
|
31398
|
-
|
|
31396
|
+
if (count2 < remaining) {
|
|
31397
|
+
this.linePos += count2;
|
|
31398
|
+
count2 = 0;
|
|
31399
31399
|
} else {
|
|
31400
|
-
|
|
31400
|
+
count2 -= remaining;
|
|
31401
31401
|
this.lineChunkIndex++;
|
|
31402
31402
|
this.linePos = 0;
|
|
31403
31403
|
}
|
|
@@ -33329,14 +33329,14 @@ function codePointLength(str) {
|
|
|
33329
33329
|
const units = str.length;
|
|
33330
33330
|
if (!highSurrogate.test(str))
|
|
33331
33331
|
return units;
|
|
33332
|
-
let
|
|
33332
|
+
let count2 = units;
|
|
33333
33333
|
for (let i = 0; i < units - 1; i++) {
|
|
33334
33334
|
if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
33335
|
-
|
|
33335
|
+
count2--;
|
|
33336
33336
|
i++;
|
|
33337
33337
|
}
|
|
33338
33338
|
}
|
|
33339
|
-
return
|
|
33339
|
+
return count2;
|
|
33340
33340
|
}
|
|
33341
33341
|
function getLengthableOrigin(input2) {
|
|
33342
33342
|
if (Array.isArray(input2))
|
|
@@ -37719,8 +37719,8 @@ function az_default() {
|
|
|
37719
37719
|
}
|
|
37720
37720
|
|
|
37721
37721
|
// ../../node_modules/zod/v4/locales/be.js
|
|
37722
|
-
function getBelarusianPlural(
|
|
37723
|
-
const absCount = Math.abs(
|
|
37722
|
+
function getBelarusianPlural(count2, one, few, many) {
|
|
37723
|
+
const absCount = Math.abs(count2);
|
|
37724
37724
|
const lastDigit = absCount % 10;
|
|
37725
37725
|
const lastTwoDigits = absCount % 100;
|
|
37726
37726
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -40367,8 +40367,8 @@ function hu_default() {
|
|
|
40367
40367
|
}
|
|
40368
40368
|
|
|
40369
40369
|
// ../../node_modules/zod/v4/locales/hy.js
|
|
40370
|
-
function getArmenianPlural(
|
|
40371
|
-
return Math.abs(
|
|
40370
|
+
function getArmenianPlural(count2, one, many) {
|
|
40371
|
+
return Math.abs(count2) === 1 ? one : many;
|
|
40372
40372
|
}
|
|
40373
40373
|
function withDefiniteArticle(word) {
|
|
40374
40374
|
if (!word)
|
|
@@ -41452,8 +41452,8 @@ function ko_default() {
|
|
|
41452
41452
|
}
|
|
41453
41453
|
|
|
41454
41454
|
// ../../node_modules/zod/v4/locales/lt.js
|
|
41455
|
-
var capitalizeFirstCharacter = (
|
|
41456
|
-
return
|
|
41455
|
+
var capitalizeFirstCharacter = (text3) => {
|
|
41456
|
+
return text3.charAt(0).toUpperCase() + text3.slice(1);
|
|
41457
41457
|
};
|
|
41458
41458
|
function getUnitTypeFromNumber(number4) {
|
|
41459
41459
|
const abs = Math.abs(number4);
|
|
@@ -43106,8 +43106,8 @@ function ro_default() {
|
|
|
43106
43106
|
}
|
|
43107
43107
|
|
|
43108
43108
|
// ../../node_modules/zod/v4/locales/ru.js
|
|
43109
|
-
function getRussianPlural(
|
|
43110
|
-
const absCount = Math.abs(
|
|
43109
|
+
function getRussianPlural(count2, one, few, many) {
|
|
43110
|
+
const absCount = Math.abs(count2);
|
|
43111
43111
|
const lastDigit = absCount % 10;
|
|
43112
43112
|
const lastTwoDigits = absCount % 100;
|
|
43113
43113
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -52638,21 +52638,21 @@ function validateAiVariables(input2) {
|
|
|
52638
52638
|
return invalid();
|
|
52639
52639
|
return value2;
|
|
52640
52640
|
}
|
|
52641
|
-
function renderText(
|
|
52641
|
+
function renderText(text3, variables) {
|
|
52642
52642
|
let cursor = 0, result2 = "";
|
|
52643
52643
|
for (; ; ) {
|
|
52644
|
-
const open19 =
|
|
52644
|
+
const open19 = text3.indexOf("{{", cursor), close = text3.indexOf("}}", cursor);
|
|
52645
52645
|
if (close >= 0 && (open19 < 0 || close < open19)) return invalid();
|
|
52646
52646
|
if (open19 < 0) {
|
|
52647
|
-
result2 +=
|
|
52647
|
+
result2 += text3.slice(cursor);
|
|
52648
52648
|
break;
|
|
52649
52649
|
}
|
|
52650
|
-
const end =
|
|
52650
|
+
const end = text3.indexOf("}}", open19 + 2);
|
|
52651
52651
|
if (end < 0) return invalid();
|
|
52652
|
-
const key =
|
|
52652
|
+
const key = text3.slice(open19 + 2, end);
|
|
52653
52653
|
if (!name2.test(key)) return invalid();
|
|
52654
52654
|
if (!Object.hasOwn(variables, key)) throw new AiTemplateError(key);
|
|
52655
|
-
result2 +=
|
|
52655
|
+
result2 += text3.slice(cursor, open19) + variables[key];
|
|
52656
52656
|
if (result2.length > AI_TEMPLATE_LIMITS.fixtureBytes) return invalid();
|
|
52657
52657
|
cursor = end + 2;
|
|
52658
52658
|
}
|
|
@@ -53943,7 +53943,7 @@ async function boundedText(response, maxBytes = 8 * 1024 * 1024) {
|
|
|
53943
53943
|
const reader = response.body?.getReader();
|
|
53944
53944
|
if (!reader) return "";
|
|
53945
53945
|
const decoder = new TextDecoder();
|
|
53946
|
-
let total = 0,
|
|
53946
|
+
let total = 0, text3 = "";
|
|
53947
53947
|
try {
|
|
53948
53948
|
while (true) {
|
|
53949
53949
|
const part2 = await reader.read();
|
|
@@ -53951,9 +53951,9 @@ async function boundedText(response, maxBytes = 8 * 1024 * 1024) {
|
|
|
53951
53951
|
total += part2.value.byteLength;
|
|
53952
53952
|
if (total > maxBytes)
|
|
53953
53953
|
throw new Error("Response exceeds the 8 MiB text limit");
|
|
53954
|
-
|
|
53954
|
+
text3 += decoder.decode(part2.value, { stream: true });
|
|
53955
53955
|
}
|
|
53956
|
-
return
|
|
53956
|
+
return text3 + decoder.decode();
|
|
53957
53957
|
} finally {
|
|
53958
53958
|
await reader.cancel().catch(() => {
|
|
53959
53959
|
});
|
|
@@ -54093,7 +54093,7 @@ async function request(server, path2, {
|
|
|
54093
54093
|
const message = typeof (detail.message ?? data.error) === "string" ? (detail.message ?? data.error).replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g, " ").slice(0, 1e3) : `HTTP ${response.status}`;
|
|
54094
54094
|
const safe = [cookie, cookie?.split("=")[1], accessToken, ...secrets].filter(
|
|
54095
54095
|
(value2) => typeof value2 === "string" && value2.length > 0
|
|
54096
|
-
).reduce((
|
|
54096
|
+
).reduce((text3, secret) => text3.replaceAll(secret, "[redacted]"), message);
|
|
54097
54097
|
const failure3 = new ServiceError(
|
|
54098
54098
|
safe,
|
|
54099
54099
|
errorCode ?? (response.status === 401 ? "AUTH_REQUIRED" : response.status === 429 ? "RATE_LIMITED" : "SERVICE_ERROR"),
|
|
@@ -54103,7 +54103,7 @@ async function request(server, path2, {
|
|
|
54103
54103
|
const redacted = [cookie, cookie?.split("=")[1], accessToken, ...secrets].filter(
|
|
54104
54104
|
(value2) => typeof value2 === "string" && value2.length > 0
|
|
54105
54105
|
).reduce(
|
|
54106
|
-
(
|
|
54106
|
+
(text3, secret) => text3.replaceAll(secret, "[redacted]"),
|
|
54107
54107
|
JSON.stringify(detail.fields)
|
|
54108
54108
|
);
|
|
54109
54109
|
try {
|
|
@@ -55072,10 +55072,10 @@ var visualExample = {
|
|
|
55072
55072
|
}
|
|
55073
55073
|
}
|
|
55074
55074
|
};
|
|
55075
|
-
async function writeText(path2,
|
|
55075
|
+
async function writeText(path2, text3) {
|
|
55076
55076
|
const file2 = await open4(path2, "wx", 384);
|
|
55077
55077
|
try {
|
|
55078
|
-
await file2.writeFile(
|
|
55078
|
+
await file2.writeFile(text3);
|
|
55079
55079
|
} finally {
|
|
55080
55080
|
await file2.close();
|
|
55081
55081
|
}
|
|
@@ -55084,11 +55084,11 @@ var writeJson = (path2, data) => writeText(path2, JSON.stringify(data, null, 2)
|
|
|
55084
55084
|
async function readManifest(path2, { enable = false } = {}) {
|
|
55085
55085
|
if (!path2) throw new Error("Provide --file PATH to a monitor JSON file.");
|
|
55086
55086
|
let value2;
|
|
55087
|
-
const
|
|
55088
|
-
if (Buffer.byteLength(
|
|
55087
|
+
const text3 = await readFile(path2, "utf8");
|
|
55088
|
+
if (Buffer.byteLength(text3) > 96e3)
|
|
55089
55089
|
throw new Error("Monitor configuration exceeds 96 KB.");
|
|
55090
55090
|
try {
|
|
55091
|
-
value2 = JSON.parse(
|
|
55091
|
+
value2 = JSON.parse(text3);
|
|
55092
55092
|
} catch {
|
|
55093
55093
|
throw new Error("Monitor configuration must be valid JSON.");
|
|
55094
55094
|
}
|
|
@@ -55317,8 +55317,13 @@ async function localRunDiagnosis(directory) {
|
|
|
55317
55317
|
}
|
|
55318
55318
|
});
|
|
55319
55319
|
}
|
|
55320
|
-
function formatRunDiagnosis(value2) {
|
|
55321
|
-
const report = parseRunDiagnosis(value2),
|
|
55320
|
+
function formatRunDiagnosis(value2, agent) {
|
|
55321
|
+
const report = parseRunDiagnosis(value2), scenarios = formatScenarioReport(report.scenarios).trimEnd().split("\n");
|
|
55322
|
+
const lines = agent ? [
|
|
55323
|
+
scenarios[0],
|
|
55324
|
+
agent,
|
|
55325
|
+
...scenarios.slice(1).filter((l) => !l.startsWith("No scenarios were recorded"))
|
|
55326
|
+
] : [scenarios.join("\n")];
|
|
55322
55327
|
lines.push(`Verification policy: ${report.policy.hash ?? "unavailable"}`);
|
|
55323
55328
|
lines.push(
|
|
55324
55329
|
report.history.lastPassing ? `Last passing matching policy: ${report.history.lastPassing.runId}` : `Matching history: unavailable (${report.history.reason})`
|
|
@@ -55330,6 +55335,10 @@ function formatRunDiagnosis(value2) {
|
|
|
55330
55335
|
(a) => a.status !== "available"
|
|
55331
55336
|
))
|
|
55332
55337
|
lines.push(` ${JSON.stringify(artifact.path)}: ${artifact.status}`);
|
|
55338
|
+
if (agent && !report.requests.calls.length && !report.phaseRequests?.phases.length) {
|
|
55339
|
+
lines.push("Reproduction: an agent check runs only hosted.");
|
|
55340
|
+
return lines.join("\n") + "\n";
|
|
55341
|
+
}
|
|
55333
55342
|
lines.push(
|
|
55334
55343
|
`Protected requests: ${report.requests.source === "local" ? "local helper report (not controller accounting)" : report.requests.source}; ${report.requests.coverage}`
|
|
55335
55344
|
);
|
|
@@ -55348,6 +55357,10 @@ function formatRunDiagnosis(value2) {
|
|
|
55348
55357
|
lines.push(` ${kind}: ${link2.requestId} (${link2.match})`);
|
|
55349
55358
|
}
|
|
55350
55359
|
} else lines.push("Phase request associations: not recorded.");
|
|
55360
|
+
if (agent) {
|
|
55361
|
+
lines.push("Reproduction: an agent check runs only hosted.");
|
|
55362
|
+
return lines.join("\n") + "\n";
|
|
55363
|
+
}
|
|
55351
55364
|
lines.push(`Reproduction: ${report.reproduction.availability}`);
|
|
55352
55365
|
const requirementLabels = {
|
|
55353
55366
|
runtime: "pinned runtime project: --runtime PROJECT",
|
|
@@ -55651,6 +55664,77 @@ async function downloadArtifact(server, runId, path2, file2, expected, session,
|
|
|
55651
55664
|
);
|
|
55652
55665
|
return { event: "artifact_downloaded", runId, path: path2, ...saved };
|
|
55653
55666
|
}
|
|
55667
|
+
async function readVerifiedJson(server, runId, expected, session, signal) {
|
|
55668
|
+
if (!Number.isSafeInteger(expected.bytes) || expected.bytes > 1024 * 1024)
|
|
55669
|
+
throw new ServiceError("Evidence is too large to read.", "VALIDATION_ERROR");
|
|
55670
|
+
const response = await fetch(
|
|
55671
|
+
`${server}/api/v1/runs/${encodeURIComponent(runId)}/artifact?path=${encodeURIComponent(expected.path)}`,
|
|
55672
|
+
{
|
|
55673
|
+
redirect: "error",
|
|
55674
|
+
headers: {
|
|
55675
|
+
...session.cookie ? { Cookie: session.cookie } : {},
|
|
55676
|
+
...session.accessToken ? { Authorization: `Bearer ${session.accessToken}` } : {}
|
|
55677
|
+
},
|
|
55678
|
+
signal: AbortSignal.any([
|
|
55679
|
+
AbortSignal.timeout(15e3),
|
|
55680
|
+
...signal ? [signal] : []
|
|
55681
|
+
])
|
|
55682
|
+
}
|
|
55683
|
+
);
|
|
55684
|
+
const bytes2 = response.ok ? Buffer.from(await response.arrayBuffer()) : null;
|
|
55685
|
+
if (!bytes2 || bytes2.length !== expected.bytes || createHash4("sha256").update(bytes2).digest("hex") !== expected.sha256)
|
|
55686
|
+
throw new ServiceError(
|
|
55687
|
+
"Evidence is unavailable or failed its checksum.",
|
|
55688
|
+
"DOWNLOAD_FAILED"
|
|
55689
|
+
);
|
|
55690
|
+
return JSON.parse(bytes2.toString("utf8"));
|
|
55691
|
+
}
|
|
55692
|
+
|
|
55693
|
+
// src/agent-report.ts
|
|
55694
|
+
var text2 = (value2, max = 300) => typeof value2 === "string" ? value2.slice(0, max) : "";
|
|
55695
|
+
var count = (value2) => typeof value2 === "number" && Number.isSafeInteger(value2) ? String(value2) : "unavailable";
|
|
55696
|
+
function agentOutcome(outcome) {
|
|
55697
|
+
if (outcome === "success") return "exited normally";
|
|
55698
|
+
if (outcome === "timeout") return "stopped at its time limit";
|
|
55699
|
+
if (outcome === "error_max_turns") return "stopped at its turn limit";
|
|
55700
|
+
return outcome ? `stopped: ${outcome.replaceAll("_", " ")}` : "did not start";
|
|
55701
|
+
}
|
|
55702
|
+
function formatAgentReport(summary2, gate, runStatus) {
|
|
55703
|
+
const lines = ["Agent"];
|
|
55704
|
+
if (!summary2) {
|
|
55705
|
+
lines.push(" Summary unavailable; the transcript may still be in the evidence.");
|
|
55706
|
+
return lines.join("\n");
|
|
55707
|
+
}
|
|
55708
|
+
const commands2 = Array.isArray(summary2.commands) ? summary2.commands.filter(
|
|
55709
|
+
(c) => Boolean(c) && typeof c.command === "string"
|
|
55710
|
+
) : [];
|
|
55711
|
+
const failed = commands2.filter((c) => c.failed === true);
|
|
55712
|
+
lines.push(` Agent: ${agentOutcome(text2(summary2.outcome, 80))}`);
|
|
55713
|
+
lines.push(
|
|
55714
|
+
` Verifier: ${runStatus === "passed" ? "passed, the outcome is in the product" : runStatus === "failed" ? "failed, see the verifier's report" : runStatus}`
|
|
55715
|
+
);
|
|
55716
|
+
lines.push(` Model: ${text2(summary2.model, 120) || "unavailable"}`);
|
|
55717
|
+
lines.push(
|
|
55718
|
+
` Steps: ${count(summary2.steps)}${failed.length ? ` (${failed.length} failed)` : ""}; model requests: ${count(gate?.turns)}; tokens: ${count(gate?.tokens)}${text2(gate?.stopped, 80) ? `; stopped at its ${text2(gate?.stopped, 80)}` : ""}`
|
|
55719
|
+
);
|
|
55720
|
+
const pages = Array.isArray(summary2.pages) ? summary2.pages.filter((p) => typeof p === "string").slice(0, 100) : [];
|
|
55721
|
+
if (pages.length) {
|
|
55722
|
+
lines.push(" Pages it read:");
|
|
55723
|
+
for (const page of pages) lines.push(` ${page.slice(0, 500)}`);
|
|
55724
|
+
}
|
|
55725
|
+
if (failed.length) {
|
|
55726
|
+
lines.push(" Failed steps:");
|
|
55727
|
+
for (const c of failed.slice(0, 20)) lines.push(` ${c.command.replaceAll("\n", " ").slice(0, 200)}`);
|
|
55728
|
+
}
|
|
55729
|
+
const denied = Array.isArray(gate?.denied) ? gate.denied.filter((d) => typeof d === "string").slice(0, 20) : [];
|
|
55730
|
+
if (denied.length) lines.push(` Refused by the gateway: ${denied.join("; ")}`);
|
|
55731
|
+
const final = text2(summary2.final, 2e3);
|
|
55732
|
+
if (final) {
|
|
55733
|
+
lines.push(" Final message (what the agent claims; the verifier decides):");
|
|
55734
|
+
for (const line of final.split("\n")) lines.push(` ${line}`);
|
|
55735
|
+
}
|
|
55736
|
+
return lines.join("\n");
|
|
55737
|
+
}
|
|
55654
55738
|
|
|
55655
55739
|
// src/local-requests.ts
|
|
55656
55740
|
import { constants as constants6 } from "node:fs";
|
|
@@ -55705,8 +55789,8 @@ async function targetConfiguration(file2) {
|
|
|
55705
55789
|
await handle.close();
|
|
55706
55790
|
}
|
|
55707
55791
|
}
|
|
55708
|
-
function httpSecretInput(
|
|
55709
|
-
const value2 =
|
|
55792
|
+
function httpSecretInput(text3) {
|
|
55793
|
+
const value2 = text3.replace(/[\r\n]+$/, "");
|
|
55710
55794
|
if (!httpCredentialRotateSchema.shape.value.safeParse(value2).success)
|
|
55711
55795
|
throw new ServiceError(
|
|
55712
55796
|
"Use a single-line ASCII HTTP credential value of at most 4096 characters.",
|
|
@@ -56874,7 +56958,7 @@ HTTP ${response.status}
|
|
|
56874
56958
|
Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
56875
56959
|
};
|
|
56876
56960
|
}
|
|
56877
|
-
let
|
|
56961
|
+
let text3 = "", bytes2 = 0;
|
|
56878
56962
|
if (response.body) {
|
|
56879
56963
|
const reader = response.body.getReader();
|
|
56880
56964
|
const decoder = new TextDecoder();
|
|
@@ -56885,9 +56969,9 @@ Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
|
56885
56969
|
bytes2 += value2.byteLength;
|
|
56886
56970
|
if (bytes2 > 256e3)
|
|
56887
56971
|
throw new Error("Response exceeds the 256 KB check limit");
|
|
56888
|
-
|
|
56972
|
+
text3 += decoder.decode(value2, { stream: true });
|
|
56889
56973
|
}
|
|
56890
|
-
|
|
56974
|
+
text3 += decoder.decode();
|
|
56891
56975
|
} finally {
|
|
56892
56976
|
await reader.cancel().catch(() => {
|
|
56893
56977
|
});
|
|
@@ -56900,9 +56984,9 @@ Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
|
56900
56984
|
bytes: bytes2,
|
|
56901
56985
|
excerpt: omitted ? null : hidden.reduce(
|
|
56902
56986
|
(value2, secret) => value2.replaceAll(secret, "[redacted]"),
|
|
56903
|
-
|
|
56987
|
+
text3.slice(0, RUN_TRACE_LIMITS.bodyExcerpt)
|
|
56904
56988
|
),
|
|
56905
|
-
truncated: !omitted &&
|
|
56989
|
+
truncated: !omitted && text3.length > RUN_TRACE_LIMITS.bodyExcerpt,
|
|
56906
56990
|
omitted
|
|
56907
56991
|
};
|
|
56908
56992
|
const latency = Math.round(performance2.now() - start);
|
|
@@ -56911,11 +56995,11 @@ Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
|
56911
56995
|
failures.push(
|
|
56912
56996
|
`Expected HTTP ${m.settings.expectedStatus}, received ${response.status}`
|
|
56913
56997
|
);
|
|
56914
|
-
if (m.settings.contains && !
|
|
56998
|
+
if (m.settings.contains && !text3.includes(m.settings.contains))
|
|
56915
56999
|
failures.push("Expected text missing from response");
|
|
56916
57000
|
if (m.settings.jsonPath) {
|
|
56917
57001
|
try {
|
|
56918
|
-
let value2 = JSON.parse(
|
|
57002
|
+
let value2 = JSON.parse(text3);
|
|
56919
57003
|
for (const part2 of m.settings.jsonPath.split("."))
|
|
56920
57004
|
value2 = value2?.[part2];
|
|
56921
57005
|
let expected;
|
|
@@ -57322,23 +57406,23 @@ async function singleCheck(monitor, parentSignal, options = {}) {
|
|
|
57322
57406
|
passed2 = matchesType(found.value, assertion.value);
|
|
57323
57407
|
break;
|
|
57324
57408
|
default: {
|
|
57325
|
-
const
|
|
57326
|
-
if (typeof
|
|
57409
|
+
const text3 = found.value;
|
|
57410
|
+
if (typeof text3 === "string") {
|
|
57327
57411
|
switch (assertion.operator) {
|
|
57328
57412
|
case "contains":
|
|
57329
|
-
passed2 =
|
|
57413
|
+
passed2 = text3.includes(assertion.value);
|
|
57330
57414
|
break;
|
|
57331
57415
|
case "not-contains":
|
|
57332
|
-
passed2 = !
|
|
57416
|
+
passed2 = !text3.includes(assertion.value);
|
|
57333
57417
|
break;
|
|
57334
57418
|
case "contains-any":
|
|
57335
57419
|
passed2 = assertion.value.some(
|
|
57336
|
-
(value2) =>
|
|
57420
|
+
(value2) => text3.includes(value2)
|
|
57337
57421
|
);
|
|
57338
57422
|
break;
|
|
57339
57423
|
case "contains-all":
|
|
57340
57424
|
passed2 = assertion.value.every(
|
|
57341
|
-
(value2) =>
|
|
57425
|
+
(value2) => text3.includes(value2)
|
|
57342
57426
|
);
|
|
57343
57427
|
break;
|
|
57344
57428
|
}
|
|
@@ -58104,9 +58188,9 @@ async function collectArtifacts(dir, base2 = dir, tokens2 = [], excluded = /* @_
|
|
|
58104
58188
|
"AI evidence exceeds its byte limit"
|
|
58105
58189
|
);
|
|
58106
58190
|
const original = await handle.readFile("utf8");
|
|
58107
|
-
const redactText = (
|
|
58191
|
+
const redactText = (text3) => tokens2.reduce(
|
|
58108
58192
|
(value2, token) => value2.replaceAll(token, "[redacted attempt credential]"),
|
|
58109
|
-
|
|
58193
|
+
text3
|
|
58110
58194
|
);
|
|
58111
58195
|
let clean = redactText(original);
|
|
58112
58196
|
if (entry2.name.endsWith(".json")) {
|
|
@@ -58470,7 +58554,7 @@ try {
|
|
|
58470
58554
|
const requestCoverageError = requestEvidence.summary.technicalError;
|
|
58471
58555
|
const passed = !requestCoverageError && !dataCoverageError && !dataFailed && !scenarioCoverageError && !scenarioFailed && p.code === 0 && run2?.status === "passed" && results.length > 0 && results.every((r) => r.status === "passed");
|
|
58472
58556
|
const redact = (value2) => redactions.reduce(
|
|
58473
|
-
(
|
|
58557
|
+
(text3, token) => text3.replaceAll(token, "[redacted attempt credential]"),
|
|
58474
58558
|
value2
|
|
58475
58559
|
);
|
|
58476
58560
|
const artifacts = await collectArtifacts(
|
|
@@ -58690,10 +58774,10 @@ async function execute(monitor, runDir, {
|
|
|
58690
58774
|
}
|
|
58691
58775
|
async function withTrace(result2, runDir, trace) {
|
|
58692
58776
|
try {
|
|
58693
|
-
const
|
|
58694
|
-
if (Buffer.byteLength(
|
|
58777
|
+
const text3 = JSON.stringify(runTraceFileSchema.parse(trace));
|
|
58778
|
+
if (Buffer.byteLength(text3) > RUN_TRACE_LIMITS.fileBytes) return result2;
|
|
58695
58779
|
await mkdir3(join6(runDir, ".e2e"), { recursive: true, mode: 448 });
|
|
58696
|
-
await writeFile3(join6(runDir, RUN_TRACE_PATH),
|
|
58780
|
+
await writeFile3(join6(runDir, RUN_TRACE_PATH), text3, { mode: 384 });
|
|
58697
58781
|
return {
|
|
58698
58782
|
...result2,
|
|
58699
58783
|
artifacts: [...result2.artifacts ?? [], RUN_TRACE_PATH]
|
|
@@ -59087,7 +59171,7 @@ var projectConfigSchema = external_exports.object({
|
|
|
59087
59171
|
monitors: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).max(CONFIG_LIMITS.monitors)
|
|
59088
59172
|
}).strict();
|
|
59089
59173
|
var pathOf = (parts) => parts.reduce(
|
|
59090
|
-
(
|
|
59174
|
+
(text3, part2) => typeof part2 === "number" ? `${text3}[${part2}]` : `${text3}${text3 ? "." : ""}${String(part2)}`,
|
|
59091
59175
|
""
|
|
59092
59176
|
);
|
|
59093
59177
|
function resolveProjectConfig(input2, environment, scripts) {
|
|
@@ -59372,8 +59456,8 @@ async function readConnectionConfiguration(file2) {
|
|
|
59372
59456
|
2
|
|
59373
59457
|
);
|
|
59374
59458
|
}
|
|
59375
|
-
function providerCredential(
|
|
59376
|
-
const parsed = connectionSecretSchema.safeParse(
|
|
59459
|
+
function providerCredential(text3) {
|
|
59460
|
+
const parsed = connectionSecretSchema.safeParse(text3.trim());
|
|
59377
59461
|
if (!parsed.success)
|
|
59378
59462
|
throw new ServiceError(
|
|
59379
59463
|
"Provide a private provider key through --credential-file or --credential-stdin.",
|
|
@@ -59631,8 +59715,8 @@ function modelTransport(authority, options = {}) {
|
|
|
59631
59715
|
"Model provider did not accept the request"
|
|
59632
59716
|
);
|
|
59633
59717
|
}
|
|
59634
|
-
const
|
|
59635
|
-
if (
|
|
59718
|
+
const text3 = await boundedText(response2, MODEL_LIMITS.responseBytes);
|
|
59719
|
+
if (text3.includes(call.secret) || text3.includes(JSON.stringify(call.secret).slice(1, -1)))
|
|
59636
59720
|
throw new AppError(
|
|
59637
59721
|
502,
|
|
59638
59722
|
"AI_RESPONSE_REJECTED",
|
|
@@ -59640,7 +59724,7 @@ function modelTransport(authority, options = {}) {
|
|
|
59640
59724
|
);
|
|
59641
59725
|
let result2;
|
|
59642
59726
|
try {
|
|
59643
|
-
result2 = modelResponseSchema.safeParse(JSON.parse(
|
|
59727
|
+
result2 = modelResponseSchema.safeParse(JSON.parse(text3));
|
|
59644
59728
|
} catch {
|
|
59645
59729
|
}
|
|
59646
59730
|
if (!result2?.success || result2.data.model !== body2.model)
|
|
@@ -61043,9 +61127,9 @@ function pinPackageJson(existing, project) {
|
|
|
61043
61127
|
}
|
|
61044
61128
|
return { json: json3, changes };
|
|
61045
61129
|
}
|
|
61046
|
-
var missingIgnores = (
|
|
61130
|
+
var missingIgnores = (text3) => {
|
|
61047
61131
|
const lines = new Set(
|
|
61048
|
-
|
|
61132
|
+
text3.split(/\r?\n/).map((l) => l.trim().replace(/^\//, ""))
|
|
61049
61133
|
);
|
|
61050
61134
|
return RUNTIME_IGNORES.filter(
|
|
61051
61135
|
(entry2) => !lines.has(entry2) && !lines.has(entry2.slice(0, -1))
|
|
@@ -61075,11 +61159,11 @@ function run(command, args, cwd, signal) {
|
|
|
61075
61159
|
async function installRuntime(options) {
|
|
61076
61160
|
const { project, browser, yes, signal } = options;
|
|
61077
61161
|
const manifestPath = join11(project, "package.json");
|
|
61078
|
-
const
|
|
61162
|
+
const text3 = await readFile6(manifestPath, "utf8").catch(() => null);
|
|
61079
61163
|
let existing = null;
|
|
61080
|
-
if (
|
|
61164
|
+
if (text3 !== null)
|
|
61081
61165
|
try {
|
|
61082
|
-
existing = JSON.parse(
|
|
61166
|
+
existing = JSON.parse(text3);
|
|
61083
61167
|
} catch (cause) {
|
|
61084
61168
|
throw new ServiceError(
|
|
61085
61169
|
`${manifestPath} is not valid JSON: ${cause.message}`,
|
|
@@ -61332,9 +61416,9 @@ async function verifyLocally(options) {
|
|
|
61332
61416
|
var configPath = (file2) => resolve13(file2 ?? CONFIG_FILE);
|
|
61333
61417
|
async function readProjectConfig(file2) {
|
|
61334
61418
|
const path2 = configPath(file2);
|
|
61335
|
-
let
|
|
61419
|
+
let text3;
|
|
61336
61420
|
try {
|
|
61337
|
-
|
|
61421
|
+
text3 = await readFile7(path2, "utf8");
|
|
61338
61422
|
} catch {
|
|
61339
61423
|
throw new ServiceError(
|
|
61340
61424
|
`${path2} was not found. Run waitcher config init or pass --file.`,
|
|
@@ -61342,14 +61426,14 @@ async function readProjectConfig(file2) {
|
|
|
61342
61426
|
2
|
|
61343
61427
|
);
|
|
61344
61428
|
}
|
|
61345
|
-
if (Buffer.byteLength(
|
|
61429
|
+
if (Buffer.byteLength(text3) > CONFIG_LIMITS.bytes)
|
|
61346
61430
|
throw new ServiceError(
|
|
61347
61431
|
`waitcher.json exceeds ${CONFIG_LIMITS.bytes} bytes.`,
|
|
61348
61432
|
"VALIDATION_ERROR",
|
|
61349
61433
|
2
|
|
61350
61434
|
);
|
|
61351
61435
|
try {
|
|
61352
|
-
return { path: path2, config: JSON.parse(
|
|
61436
|
+
return { path: path2, config: JSON.parse(text3) };
|
|
61353
61437
|
} catch (cause) {
|
|
61354
61438
|
throw new ServiceError(
|
|
61355
61439
|
`waitcher.json is not valid JSON: ${cause.message}`,
|
|
@@ -61439,7 +61523,7 @@ var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors
|
|
|
61439
61523
|
var diagnosis_default = "# Diagnosing failures\n\nRead when a local, smoke or scheduled run failed or errored.\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";
|
|
61440
61524
|
|
|
61441
61525
|
// ../../skills/waitcher/references/optional-capabilities.md
|
|
61442
|
-
var optional_capabilities_default = '# Optional capabilities\n\nRead only when capabilities report the feature and the user needs it: visual baselines, signed-in browser identities, verified HTTP credentials and invocation budgets. AI endpoints, agent outcome checks, model steps and protected requests are in [ai-and-agents](ai-and-agents.md).\n\n## Optional visual checks\n\nDiscover `features.visual` for authoring and `features.visualReview` for baseline inspection; `features.isolatedVisual` says personal captures run in the hosted runner. A visual monitor counts as one of the plan\'s script monitors and each capture as a script run; `limits.visual.minInterval` is the shortest interval (2 hours on the free plan, 30 minutes otherwise). In a repository, add a `waitcher.json` entry such as `{ "key": "home-look", "type": "visual", "path": "/" }` with an optional `visual` block (page/element checkpoint, viewport, readiness, masks, thresholds) and deploy it like any other monitor; with `--smoke` the first capture is reported as `baseline_review` with the commands that show and approve it. For one monitor outside a repository, start with `monitor init --type visual --target https://product.example --file visual.json`, then `monitor validate --file visual.json` and `monitor apply --file visual.json --dry-run`. Apply paused; an authorized `run start --id ID --wait` is a separate action. User guide: https://waitcher.dev/docs/visual.md.\n\nFor a screen behind a sign-in or a few clicks, assert it inside a `browser` test instead: `await expect(screen).toHaveScreenshot(\'dashboard.png\')` (options `threshold`, `maxDiffPixels`, `maxDiffPixelRatio`, `mask`). Do not commit snapshot PNGs or pass `--update-snapshots`: Waitcher keeps the baselines. The first hosted run of each screenshot ends as `error` "First capture of NAME: approve it as the baseline"; inspect it with `visual list --monitor-id ID` and `visual image`, then `visual approve --id COMPARISON_ID --expected-revision 0`, one screenshot per run. Later runs fail with a comparison when a screenshot differs. Local runs (`run local`, `--verify`) compare against a capture from the same run, so a local pass says nothing about the look. Visual monitors accept no script, model binding, session identity or custom request credential. Fixed visual baseline execution is not supported by `run local`; local API/browser script evidence does not establish a visual baseline.\n\nA scheduled run never creates a baseline. Set the first one, or accept an intended change, with one run: `run start --id MONITOR_ID --update-baselines --wait` captures and approves it (write access); then inspect it with `visual list` and `visual image`. The alternative is to run normally and approve the capture. Until a baseline exists a run ends as `error` "First capture of NAME"; that is missing coverage, not a product failure. Every later run of a visual monitor keeps its comparison, passing runs included. Inspect `visual list`, `visual get --id COMPARISON_ID`, `visual heads --id MONITOR_ID`, `visual artifacts --id COMPARISON_ID` and `visual image --id COMPARISON_ID --role candidate|original|diff --file NEW_PRIVATE_PATH`. Review actual images and metrics before an authorized `visual approve --id COMPARISON_ID --expected-revision SELECTED_REVISION`; an initial selection uses 0. Restore only a reviewed retained baseline with `visual restore --id HEAD_ID --baseline-id BASELINE_ID --expected-revision CURRENT_HEAD_REVISION`. Stale decisions conflict: reload instead of retrying or changing revisions blindly. Approval preserves the historical result. Changed capture fingerprints need their own baseline. Foreign-owner/read-only refusals are boundaries, not reasons to switch credentials. Screenshots are private evidence; masks cover selected pixels only. Use actual `visual` and `run` help for current flags and capabilities.\n\n## Optional browser test-account identity\n\nFor a signed-in browser journey, discover hosted `features.browserIdentities` before configuring `identity create/rotate/enable/disable/delete`. Supply bounded cookies/localStorage through a private `--state-file`; metadata is scoped to one verified exact origin, project/environment and explicit expiry. State is write-only and cannot be exported. New identities default disabled; enable explicitly and bind the resulting current `{identityId, revision}` under `browserIdentity` in a version-2 browser manifest with explicit context. Rename, state replacement and enable/disable advance revisions; inspect current metadata and deliberately rebind rather than silently upgrading. After an uncertain write inspect metadata before retrying. No running Chrome profile is imported.\n\nRun the same manifest account-free with `run local --file MONITOR --runtime RUNTIME --browser-identities-file PRIVATE_MAP`. The map is `{schemaVersion:1,identities:[{identityId,revision,projectId,environmentId,origin,expiresAt,stateFile}]}`; state paths resolve relative to the map. Both map/state are private regular JSON files (chmod 600), no symlinks/hard links or inline state. Exact IDs/revision/scope/origin and bounded future expiry must match. Local mappings do not attest hosted target verification or revocation. The optional model map remains separate. Hosted identity-backed runs use the isolated lane for all owners; local code remains trusted. The selected script receives its own session and signed-in page content can reach private evidence or optional AI providers. Never promise pixel/encoded-secret masking. Use dedicated test accounts and inspect coverage errors after expiry/revocation before repeating a possibly completed action.\n\n## Verified HTTP credentials\n\nFor an authenticated HTTP or AI endpoint, use the user\'s owned verified HTTPS origin and an `httpAuth` reference (`targetId`, `credentialId`, `credentialRevision`). Check `features.httpTargets` before hosted configuration. Create/renew a target challenge with `target create` or `target challenge`, writing it to a new private `--output`; never print the token. The user publishes the supplied proof at `/.well-known/waitcher-verification.txt`, then `target verify` checks it without credentials. Verification expires after 24 hours and must be renewed. An origin excludes paths, query and fragments and is immutable.\n\nUse `target credential create/rotate` with non-secret metadata JSON plus `--credential-file` (mode 600) or `--credential-stdin`. Headers are limited to `Authorization` or `X-Api-Key`; values are complete single-line ASCII header values up to 4096 bytes. For Bearer auth, include the `Bearer ` prefix in the private value. Keys are write-only and encrypted on the server. The monitor and export retain references only. Rotation advances the credential revision; update the monitor binding explicitly. Disabled, expired, foreign or stale bindings fail without forwarding a request. Authenticated redirects are never followed.\n\nFor local execution without the app or account, pass `run local --file monitor.json --http-credentials-file private/http-map.json`. The private map is `{schemaVersion:1,credentials:[{targetId,credentialId,credentialRevision,origin,header,credentialFile}]}` and the referenced private file contains the raw header value. Paths resolve relative to the map. Never inline a key or reuse the CLI\'s own account cookie/token as a target credential. The local resolver requires exactly matching IDs, revision and canonical origin, and the shared runner enforces the single supported header and redirect policy. Local mapping does not prove that the hosted target is still verified or its key current. Keep the same manifest as the hosted monitor; only local key resolution differs. HTTP local checks need no E2E runtime. Use explicit user authorization for POST fixtures that change state.\n\n## Hosted endpoint invocation budgets\n\nBefore running dedicated AI endpoints or HTTP checks with `httpAuth`, read `account invocations` for the account/monitor UTC-day counters and limits. The manifest accepts `requestBudget: {dailyInvocations: N}` (default 50, maximum 1,000). Configure the owner cap with `account budget --daily-invocations N --expected-revision CURRENT_REVISION` only when authorized; personal accounts cap at 200, administrators at 5,000, and the controller also has a global 5,000 cap. Validate/apply/export do not charge calls.\n\n`INVOCATION_BUDGET_EXHAUSTED` is a coverage error: no request was dispatched and no product incident is created. Do not automatically retry or raise a limit to bypass it. Completed and uncertain dispatched calls consume budget, independent of product success or worker-reported usage. Local execution needs no account, preserves the setting and makes at most one endpoint call per fixture case, but does not enforce or consume the hosted daily ledger. After backup restore, `window.restoreHeld` blocks these checks until the next UTC reset because snapshot counters may be stale; do not bypass the hold by raising caps. These are request counts, separate from model-broker token/call caps and downstream provider spending. Inspect `account invocations` and the current `account` help for the hosted accounting contract.\n\n## Agent checks\n\nWhen `features.agentChecks` is true, an `api` entry may carry an `agent` block: Claude Code works on `task` in a sandbox, then the entry\'s script verifies the product\'s state ([guide](https://waitcher.dev/docs/agent-checks.md)). It needs an Anthropic connection in the entry\'s project environment (`connection create` with `"provider":"anthropic"`, the user\'s own Anthropic API key from a private file; models `haiku`, `sonnet`, `opus` or `fable` follow the latest model of that family, resolved at each run, or exact IDs like `claude-sonnet-5-5` stay fixed); an OpenRouter connection is refused for agent checks and serves only AI scripts and AI checks and fields `connectionId`, `configurationRevision`, `model`, `task`, optionally `seconds`, `turns`, `tokens`, `hosts` and `envNames` (a subset of `settings.envNames`). Read `limits.agentChecks` for the plan\'s count and bounds; the interval is at least 6 hours. Write the task as a user would say it and never put a secret in it. The verifier must reset the test account it checks. Ask before creating a connection: it stores the user\'s key and every run is billed to it.\n\n## Status pages\n\nWhen `features.statusPages` is true, the account can publish public pages at `https://waitcher.dev/status/SLUG` ([guide](https://waitcher.dev/docs/status-pages.md)); `limits.statusPages` is the plan\'s count. `waitcher status-page save --file page.json` takes `slug`, `title` and `components` (`monitorId`, a public `name`, optional `group`); `waitcher help status` has the full shape. A page is private until `"published": true` and asks search engines not to index it unless `"indexable": true`. Write public names the user\'s customers would recognise, never a target URL or an internal monitor name; ask before publishing, because the address is public. During an incident, `waitcher incident update --id INCIDENT_ID --kind identified --message TEXT` posts a note to every page that shows it. People can also open an incident no monitor has seen (`incident open --page-id ID --title TEXT --message TEXT [--impact down|degraded|none] [--services "A,B"]`), and change any incident with `incident edit` (title, impact, open or resolved, hidden; `--expected-revision` from `status-page incidents --id PAGE_ID`). On a monitor\'s incident those values win over the monitor until reset (`--state auto`). A page with `"automaticIncidents": false` shows only incidents people open. Visitors can subscribe to email updates unless `"subscriptions": false`; opening, updating, resolving or reopening an incident emails them, so treat every such command as a message to the user\'s customers. Everything on these pages is public: only post, open, resolve or hide what the user wrote or approved.\n';
|
|
61526
|
+
var optional_capabilities_default = '# Optional capabilities\n\nRead only when capabilities report the feature and the user needs it: visual baselines, signed-in browser identities, verified HTTP credentials and invocation budgets. AI endpoints, agent outcome checks, model steps and protected requests are in [ai-and-agents](ai-and-agents.md).\n\n## Optional visual checks\n\nDiscover `features.visual` for authoring and `features.visualReview` for baseline inspection; `features.isolatedVisual` says personal captures run in the hosted runner. A visual monitor counts as one of the plan\'s script monitors and each capture as a script run; `limits.visual.minInterval` is the shortest interval (2 hours on the free plan, 30 minutes otherwise). In a repository, add a `waitcher.json` entry such as `{ "key": "home-look", "type": "visual", "path": "/" }` with an optional `visual` block (page/element checkpoint, viewport, readiness, masks, thresholds) and deploy it like any other monitor; with `--smoke` the first capture is reported as `baseline_review` with the commands that show and approve it. For one monitor outside a repository, start with `monitor init --type visual --target https://product.example --file visual.json`, then `monitor validate --file visual.json` and `monitor apply --file visual.json --dry-run`. Apply paused; an authorized `run start --id ID --wait` is a separate action. User guide: https://waitcher.dev/docs/visual.md.\n\nFor a screen behind a sign-in or a few clicks, assert it inside a `browser` test instead: `await expect(screen).toHaveScreenshot(\'dashboard.png\')` (options `threshold`, `maxDiffPixels`, `maxDiffPixelRatio`, `mask`). Do not commit snapshot PNGs or pass `--update-snapshots`: Waitcher keeps the baselines. The first hosted run of each screenshot ends as `error` "First capture of NAME: approve it as the baseline"; inspect it with `visual list --monitor-id ID` and `visual image`, then `visual approve --id COMPARISON_ID --expected-revision 0`, one screenshot per run. Later runs fail with a comparison when a screenshot differs. Local runs (`run local`, `--verify`) compare against a capture from the same run, so a local pass says nothing about the look. Visual monitors accept no script, model binding, session identity or custom request credential. Fixed visual baseline execution is not supported by `run local`; local API/browser script evidence does not establish a visual baseline.\n\nA scheduled run never creates a baseline. Set the first one, or accept an intended change, with one run: `run start --id MONITOR_ID --update-baselines --wait` captures and approves it (write access); then inspect it with `visual list` and `visual image`. The alternative is to run normally and approve the capture. Until a baseline exists a run ends as `error` "First capture of NAME"; that is missing coverage, not a product failure. Every later run of a visual monitor keeps its comparison, passing runs included. Inspect `visual list`, `visual get --id COMPARISON_ID`, `visual heads --id MONITOR_ID`, `visual artifacts --id COMPARISON_ID` and `visual image --id COMPARISON_ID --role candidate|original|diff --file NEW_PRIVATE_PATH`. Review actual images and metrics before an authorized `visual approve --id COMPARISON_ID --expected-revision SELECTED_REVISION`; an initial selection uses 0. Restore only a reviewed retained baseline with `visual restore --id HEAD_ID --baseline-id BASELINE_ID --expected-revision CURRENT_HEAD_REVISION`. Stale decisions conflict: reload instead of retrying or changing revisions blindly. Approval preserves the historical result. Changed capture fingerprints need their own baseline. Foreign-owner/read-only refusals are boundaries, not reasons to switch credentials. Screenshots are private evidence; masks cover selected pixels only. Use actual `visual` and `run` help for current flags and capabilities.\n\n## Optional browser test-account identity\n\nFor a signed-in browser journey, discover hosted `features.browserIdentities` before configuring `identity create/rotate/enable/disable/delete`. Supply bounded cookies/localStorage through a private `--state-file`; metadata is scoped to one verified exact origin, project/environment and explicit expiry. State is write-only and cannot be exported. New identities default disabled; enable explicitly and bind the resulting current `{identityId, revision}` under `browserIdentity` in a version-2 browser manifest with explicit context. Rename, state replacement and enable/disable advance revisions; inspect current metadata and deliberately rebind rather than silently upgrading. After an uncertain write inspect metadata before retrying. No running Chrome profile is imported.\n\nRun the same manifest account-free with `run local --file MONITOR --runtime RUNTIME --browser-identities-file PRIVATE_MAP`. The map is `{schemaVersion:1,identities:[{identityId,revision,projectId,environmentId,origin,expiresAt,stateFile}]}`; state paths resolve relative to the map. Both map/state are private regular JSON files (chmod 600), no symlinks/hard links or inline state. Exact IDs/revision/scope/origin and bounded future expiry must match. Local mappings do not attest hosted target verification or revocation. The optional model map remains separate. Hosted identity-backed runs use the isolated lane for all owners; local code remains trusted. The selected script receives its own session and signed-in page content can reach private evidence or optional AI providers. Never promise pixel/encoded-secret masking. Use dedicated test accounts and inspect coverage errors after expiry/revocation before repeating a possibly completed action.\n\n## Verified HTTP credentials\n\nFor an authenticated HTTP or AI endpoint, use the user\'s owned verified HTTPS origin and an `httpAuth` reference (`targetId`, `credentialId`, `credentialRevision`). Check `features.httpTargets` before hosted configuration. Create/renew a target challenge with `target create` or `target challenge`, writing it to a new private `--output`; never print the token. The user publishes the supplied proof at `/.well-known/waitcher-verification.txt`, then `target verify` checks it without credentials. Verification expires after 24 hours and must be renewed. An origin excludes paths, query and fragments and is immutable.\n\nUse `target credential create/rotate` with non-secret metadata JSON plus `--credential-file` (mode 600) or `--credential-stdin`. Headers are limited to `Authorization` or `X-Api-Key`; values are complete single-line ASCII header values up to 4096 bytes. For Bearer auth, include the `Bearer ` prefix in the private value. Keys are write-only and encrypted on the server. The monitor and export retain references only. Rotation advances the credential revision; update the monitor binding explicitly. Disabled, expired, foreign or stale bindings fail without forwarding a request. Authenticated redirects are never followed.\n\nFor local execution without the app or account, pass `run local --file monitor.json --http-credentials-file private/http-map.json`. The private map is `{schemaVersion:1,credentials:[{targetId,credentialId,credentialRevision,origin,header,credentialFile}]}` and the referenced private file contains the raw header value. Paths resolve relative to the map. Never inline a key or reuse the CLI\'s own account cookie/token as a target credential. The local resolver requires exactly matching IDs, revision and canonical origin, and the shared runner enforces the single supported header and redirect policy. Local mapping does not prove that the hosted target is still verified or its key current. Keep the same manifest as the hosted monitor; only local key resolution differs. HTTP local checks need no E2E runtime. Use explicit user authorization for POST fixtures that change state.\n\n## Hosted endpoint invocation budgets\n\nBefore running dedicated AI endpoints or HTTP checks with `httpAuth`, read `account invocations` for the account/monitor UTC-day counters and limits. The manifest accepts `requestBudget: {dailyInvocations: N}` (default 50, maximum 1,000). Configure the owner cap with `account budget --daily-invocations N --expected-revision CURRENT_REVISION` only when authorized; personal accounts cap at 200, administrators at 5,000, and the controller also has a global 5,000 cap. Validate/apply/export do not charge calls.\n\n`INVOCATION_BUDGET_EXHAUSTED` is a coverage error: no request was dispatched and no product incident is created. Do not automatically retry or raise a limit to bypass it. Completed and uncertain dispatched calls consume budget, independent of product success or worker-reported usage. Local execution needs no account, preserves the setting and makes at most one endpoint call per fixture case, but does not enforce or consume the hosted daily ledger. After backup restore, `window.restoreHeld` blocks these checks until the next UTC reset because snapshot counters may be stale; do not bypass the hold by raising caps. These are request counts, separate from model-broker token/call caps and downstream provider spending. Inspect `account invocations` and the current `account` help for the hosted accounting contract.\n\n## Agent checks\n\nWhen `features.agentChecks` is true, an `api` entry may carry an `agent` block: Claude Code works on `task` in a sandbox, then the entry\'s script verifies the product\'s state ([guide](https://waitcher.dev/docs/agent-checks.md)). It needs an Anthropic connection in the entry\'s project environment (`connection create` with `"provider":"anthropic"`, the user\'s own Anthropic API key from a private file; models `haiku`, `sonnet`, `opus` or `fable` follow the latest model of that family, resolved at each run, or exact IDs like `claude-sonnet-5-5` stay fixed); an OpenRouter connection is refused for agent checks and serves only AI scripts and AI checks and fields `connectionId`, `configurationRevision`, `model`, `task`, optionally `seconds`, `turns`, `tokens`, `hosts` and `envNames` (a subset of `settings.envNames`). Read `limits.agentChecks` for the plan\'s count and bounds; the interval is at least 6 hours. Write the task as a user would say it and never put a secret in it. The verifier must reset the test account it checks; a project token lets it list that project\'s monitors, and monitors it finds there that a deploy created are removed by a deploy with `--prune`, not `monitor delete`. Read a run with `run diagnose --id RUN_ID`, which leads with the agent\'s outcome, model, pages read, failed steps, gateway refusals and final message, apart from the verifier\'s verdict. Ask before creating a connection: it stores the user\'s key and every run is billed to it.\n\n## Status pages\n\nWhen `features.statusPages` is true, the account can publish public pages at `https://waitcher.dev/status/SLUG` ([guide](https://waitcher.dev/docs/status-pages.md)); `limits.statusPages` is the plan\'s count. `waitcher status-page save --file page.json` takes `slug`, `title` and `components` (`monitorId`, a public `name`, optional `group`); `waitcher help status` has the full shape. A page is private until `"published": true` and asks search engines not to index it unless `"indexable": true`. Write public names the user\'s customers would recognise, never a target URL or an internal monitor name; ask before publishing, because the address is public. During an incident, `waitcher incident update --id INCIDENT_ID --kind identified --message TEXT` posts a note to every page that shows it. People can also open an incident no monitor has seen (`incident open --page-id ID --title TEXT --message TEXT [--impact down|degraded|none] [--services "A,B"]`), and change any incident with `incident edit` (title, impact, open or resolved, hidden; `--expected-revision` from `status-page incidents --id PAGE_ID`). On a monitor\'s incident those values win over the monitor until reset (`--state auto`). A page with `"automaticIncidents": false` shows only incidents people open. Visitors can subscribe to email updates unless `"subscriptions": false`; opening, updating, resolving or reopening an incident emails them, so treat every such command as a message to the user\'s customers. Everything on these pages is public: only post, open, resolve or hide what the user wrote or approved.\n';
|
|
61443
61527
|
|
|
61444
61528
|
// ../../skills/waitcher/agents/openai.yaml
|
|
61445
61529
|
var openai_default = 'interface:\n display_name: "Waitcher"\n short_description: "Deploy monitoring from a repository and inspect evidence"\n default_prompt: "Use $waitcher to set up monitoring for this repository: pick the critical journeys, verify them locally and deploy them paused through a reviewed plan."\n';
|
|
@@ -61479,8 +61563,8 @@ async function installSkill(options) {
|
|
|
61479
61563
|
await mkdir8(join13(directory, "references"), { recursive: true });
|
|
61480
61564
|
await mkdir8(join13(directory, "agents"), { recursive: true });
|
|
61481
61565
|
await writeFile9(join13(directory, "SKILL.md"), SKILL_default);
|
|
61482
|
-
for (const [name5,
|
|
61483
|
-
await writeFile9(join13(directory, "references", name5),
|
|
61566
|
+
for (const [name5, text3] of Object.entries(references))
|
|
61567
|
+
await writeFile9(join13(directory, "references", name5), text3);
|
|
61484
61568
|
await writeFile9(join13(directory, "agents/openai.yaml"), openai_default);
|
|
61485
61569
|
await writeFile9(
|
|
61486
61570
|
join13(directory, MARKER),
|
|
@@ -61604,7 +61688,7 @@ async function doctor(options) {
|
|
|
61604
61688
|
for (const home of skillHomes) {
|
|
61605
61689
|
if (!await exists(join14(home, "SKILL.md"))) continue;
|
|
61606
61690
|
installed.push(home);
|
|
61607
|
-
const marker2 = await readFile9(join14(home, ".waitcher-skill.json"), "utf8").then((
|
|
61691
|
+
const marker2 = await readFile9(join14(home, ".waitcher-skill.json"), "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
|
|
61608
61692
|
if (marker2 && marker2.version !== options.version) stale.push(home);
|
|
61609
61693
|
}
|
|
61610
61694
|
const install = root === process.cwd() ? "waitcher skill install" : `waitcher skill install --path ${join14(root, ".claude", "skills")}`;
|
|
@@ -62025,8 +62109,8 @@ var incidentEditSchema = external_exports.object({
|
|
|
62025
62109
|
// src/access.ts
|
|
62026
62110
|
import { lstat as lstat10, open as open16, unlink as unlink3 } from "node:fs/promises";
|
|
62027
62111
|
import { dirname as dirname15, resolve as resolve16 } from "node:path";
|
|
62028
|
-
function accessTokenInput(
|
|
62029
|
-
let token =
|
|
62112
|
+
function accessTokenInput(text3) {
|
|
62113
|
+
let token = text3.trim();
|
|
62030
62114
|
if (token.startsWith("{")) {
|
|
62031
62115
|
try {
|
|
62032
62116
|
token = JSON.parse(token).token;
|
|
@@ -62132,10 +62216,10 @@ async function readPrivate(path2) {
|
|
|
62132
62216
|
}
|
|
62133
62217
|
async function loadSession(server) {
|
|
62134
62218
|
const path2 = sessionPath(server);
|
|
62135
|
-
let
|
|
62219
|
+
let text3;
|
|
62136
62220
|
try {
|
|
62137
62221
|
await privatePath(dirname16(path2), true);
|
|
62138
|
-
|
|
62222
|
+
text3 = await readPrivate(path2);
|
|
62139
62223
|
} catch (cause) {
|
|
62140
62224
|
const error62 = asError(cause);
|
|
62141
62225
|
if (error62.code === "ENOENT")
|
|
@@ -62146,7 +62230,7 @@ async function loadSession(server) {
|
|
|
62146
62230
|
}
|
|
62147
62231
|
let session;
|
|
62148
62232
|
try {
|
|
62149
|
-
session = JSON.parse(
|
|
62233
|
+
session = JSON.parse(text3);
|
|
62150
62234
|
} catch {
|
|
62151
62235
|
throw new Error("Saved session is unreadable. Run auth login again.");
|
|
62152
62236
|
}
|
|
@@ -62620,6 +62704,7 @@ Monitor configuration
|
|
|
62620
62704
|
Agent checks: an api definition or waitcher.json entry with an "agent" block runs Claude
|
|
62621
62705
|
Code on its task first, then the script verifies the outcome, on an anthropic
|
|
62622
62706
|
connection (features.agentChecks; https://waitcher.dev/docs/agent-checks.md).
|
|
62707
|
+
A verifier may sign in with a project token: it lists and reads that project's monitors.
|
|
62623
62708
|
monitor validate --file PATH Validate locally, including scriptFile
|
|
62624
62709
|
monitor build --file PATH --output NEW_DIR [--project PROJECT]
|
|
62625
62710
|
Bundle project helpers into one portable monitor script
|
|
@@ -62637,7 +62722,7 @@ Monitor configuration
|
|
|
62637
62722
|
Executions and reports
|
|
62638
62723
|
run scenarios --id RUN_ID [--json]
|
|
62639
62724
|
run scenarios --directory PRIVATE_RUN_DIR [--json]
|
|
62640
|
-
run diagnose --id RUN_ID [--json]
|
|
62725
|
+
run diagnose --id RUN_ID [--json] An agent check leads with what the agent did
|
|
62641
62726
|
run diagnose --directory PRIVATE_RUN_DIR [--json]
|
|
62642
62727
|
run reproduce --id RUN_ID --output NEW_DIRECTORY
|
|
62643
62728
|
run local --file MONITOR.json [--runtime PROJECT] [--output DIR] [--video]
|
|
@@ -62647,7 +62732,8 @@ Executions and reports
|
|
|
62647
62732
|
JSON/report/logs/traces; video opt-in, fresh output per run
|
|
62648
62733
|
Project output must stay inside the E2E project
|
|
62649
62734
|
run start --id MONITOR_ID [--wait [--brief]] [--timeout 60] [--update-baselines]
|
|
62650
|
-
A finished run prints status, duration and
|
|
62735
|
+
A finished run prints status, duration, message and a
|
|
62736
|
+
report link (SERVER/app#run/RUN_ID) first;
|
|
62651
62737
|
--brief leaves out the execution record
|
|
62652
62738
|
--update-baselines (visual checks, browser tests; write
|
|
62653
62739
|
access): the run adopts what it captures as the approved
|
|
@@ -63000,7 +63086,7 @@ ${exitCodes}
|
|
|
63000
63086
|
// package.json
|
|
63001
63087
|
var package_default = {
|
|
63002
63088
|
name: "@waitcher/cli",
|
|
63003
|
-
version: "0.2.
|
|
63089
|
+
version: "0.2.22",
|
|
63004
63090
|
description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API, browser and visual monitors from waitcher.json.",
|
|
63005
63091
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
63006
63092
|
author: "S\u0142awomir Radzymi\u0144ski",
|
|
@@ -63045,7 +63131,7 @@ var package_default = {
|
|
|
63045
63131
|
};
|
|
63046
63132
|
|
|
63047
63133
|
// src/main.ts
|
|
63048
|
-
var list = (
|
|
63134
|
+
var list = (text3) => (text3 ?? "").split(",").map((x) => x.trim()).filter(Boolean);
|
|
63049
63135
|
var issues = (all) => all.map((i) => `${i.path.join(".")}: ${i.message}`).join("\n");
|
|
63050
63136
|
var controller = new AbortController();
|
|
63051
63137
|
process.once("SIGINT", () => controller.abort());
|
|
@@ -63116,16 +63202,16 @@ async function passwordFromStdin(maxBytes = 2048) {
|
|
|
63116
63202
|
usage2(
|
|
63117
63203
|
"Pipe the password to stdin, or use --password-file PATH. Passwords are not accepted as command arguments."
|
|
63118
63204
|
);
|
|
63119
|
-
let
|
|
63205
|
+
let text3 = "";
|
|
63120
63206
|
const cancel = () => process.stdin.destroy(new Error("Interrupted."));
|
|
63121
63207
|
controller.signal.addEventListener("abort", cancel, { once: true });
|
|
63122
63208
|
try {
|
|
63123
63209
|
for await (const chunk of process.stdin) {
|
|
63124
|
-
|
|
63125
|
-
if (Buffer.byteLength(
|
|
63210
|
+
text3 += chunk;
|
|
63211
|
+
if (Buffer.byteLength(text3) > maxBytes)
|
|
63126
63212
|
usage2("Password input is too long.");
|
|
63127
63213
|
}
|
|
63128
|
-
return
|
|
63214
|
+
return text3.replace(/[\r\n]+$/, "");
|
|
63129
63215
|
} finally {
|
|
63130
63216
|
controller.signal.removeEventListener("abort", cancel);
|
|
63131
63217
|
}
|
|
@@ -64867,12 +64953,12 @@ async function main() {
|
|
|
64867
64953
|
usage2(
|
|
64868
64954
|
"Provide --file PATH with the complete configuration and expectedRevision for edits."
|
|
64869
64955
|
);
|
|
64870
|
-
const
|
|
64871
|
-
if (Buffer.byteLength(
|
|
64956
|
+
const text3 = await readFile11(v.file, "utf8");
|
|
64957
|
+
if (Buffer.byteLength(text3) > 16e3)
|
|
64872
64958
|
usage2("Project configuration exceeds 16 KB");
|
|
64873
64959
|
let body2;
|
|
64874
64960
|
try {
|
|
64875
|
-
body2 = JSON.parse(
|
|
64961
|
+
body2 = JSON.parse(text3);
|
|
64876
64962
|
} catch {
|
|
64877
64963
|
usage2("Configuration must be JSON");
|
|
64878
64964
|
}
|
|
@@ -65117,10 +65203,10 @@ async function main() {
|
|
|
65117
65203
|
if (!v.file) usage2("Provide --file PATH for the configuration.");
|
|
65118
65204
|
let input2;
|
|
65119
65205
|
try {
|
|
65120
|
-
const
|
|
65121
|
-
if (Buffer.byteLength(
|
|
65206
|
+
const text3 = await readFile11(v.file, "utf8");
|
|
65207
|
+
if (Buffer.byteLength(text3) > 96e3)
|
|
65122
65208
|
usage2("Configuration exceeds 96 KB.");
|
|
65123
|
-
input2 = JSON.parse(
|
|
65209
|
+
input2 = JSON.parse(text3);
|
|
65124
65210
|
} catch {
|
|
65125
65211
|
usage2("Could not read valid JSON configuration.");
|
|
65126
65212
|
}
|
|
@@ -65378,7 +65464,24 @@ async function main() {
|
|
|
65378
65464
|
requestedId
|
|
65379
65465
|
);
|
|
65380
65466
|
if (!v.json) {
|
|
65381
|
-
|
|
65467
|
+
const run2 = await api(`runs/${id3(v.id)}`);
|
|
65468
|
+
let agent;
|
|
65469
|
+
if (run2.definition?.agent) {
|
|
65470
|
+
const read = async (path2) => {
|
|
65471
|
+
const file2 = run2.artifactManifest?.find(
|
|
65472
|
+
(a) => a.path === path2 && a.status === "available"
|
|
65473
|
+
);
|
|
65474
|
+
return file2 ? await readVerifiedJson(server, requestedId, file2, session, signal).catch(
|
|
65475
|
+
() => null
|
|
65476
|
+
) : null;
|
|
65477
|
+
};
|
|
65478
|
+
agent = formatAgentReport(
|
|
65479
|
+
await read(".e2e/agent-summary.json"),
|
|
65480
|
+
await read(".e2e/agent-gate.json"),
|
|
65481
|
+
run2.status
|
|
65482
|
+
);
|
|
65483
|
+
}
|
|
65484
|
+
process.stdout.write(formatRunDiagnosis(result2, agent));
|
|
65382
65485
|
return;
|
|
65383
65486
|
}
|
|
65384
65487
|
} else if (command === "run reproduce") {
|
|
@@ -65449,6 +65552,8 @@ async function main() {
|
|
|
65449
65552
|
status: run2.status,
|
|
65450
65553
|
duration: run2.duration,
|
|
65451
65554
|
message: run2.message,
|
|
65555
|
+
// The run's report in the web app, to open or share.
|
|
65556
|
+
report: `${server}/app#run/${run2.id}`,
|
|
65452
65557
|
...v.brief ? {} : { execution: run2 }
|
|
65453
65558
|
};
|
|
65454
65559
|
exitCode = run2.status === "passed" ? 0 : 4;
|
|
@@ -65552,10 +65657,10 @@ async function main() {
|
|
|
65552
65657
|
if (!v.file) usage2("Provide --file PATH for the status page.");
|
|
65553
65658
|
let input2;
|
|
65554
65659
|
try {
|
|
65555
|
-
const
|
|
65556
|
-
if (Buffer.byteLength(
|
|
65660
|
+
const text3 = await readFile11(v.file, "utf8");
|
|
65661
|
+
if (Buffer.byteLength(text3) > 96e3)
|
|
65557
65662
|
usage2("Configuration exceeds 96 KB.");
|
|
65558
|
-
input2 = JSON.parse(
|
|
65663
|
+
input2 = JSON.parse(text3);
|
|
65559
65664
|
} catch {
|
|
65560
65665
|
usage2("Could not read valid JSON configuration.");
|
|
65561
65666
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waitcher/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"description": "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API, browser and visual monitors from waitcher.json.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Sławomir Radzymiński",
|