@waitcher/cli 0.2.20 → 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 +212 -99
- package/dist/model-client.mjs +6 -0
- 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) {
|
|
@@ -52385,6 +52385,12 @@ var MODEL_LIMITS = {
|
|
|
52385
52385
|
maxRunTokens: 1e6
|
|
52386
52386
|
};
|
|
52387
52387
|
var MODEL_PROVIDERS = ["openrouter", "anthropic"];
|
|
52388
|
+
var ANTHROPIC_MODEL_ALIASES = Object.freeze({
|
|
52389
|
+
haiku: "claude-haiku-5-5",
|
|
52390
|
+
sonnet: "claude-sonnet-5-5",
|
|
52391
|
+
opus: "claude-opus-5-5",
|
|
52392
|
+
fable: "claude-fable-5-2"
|
|
52393
|
+
});
|
|
52388
52394
|
var modelNameSchema = external_exports.string().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9_./:-]*$/).refine((s) => !s.includes("://") && !s.includes(".."));
|
|
52389
52395
|
var connectionSchema = external_exports.object({
|
|
52390
52396
|
name: external_exports.string().trim().min(1).max(80).regex(/^[^\x00-\x1f\x7f]+$/),
|
|
@@ -52632,21 +52638,21 @@ function validateAiVariables(input2) {
|
|
|
52632
52638
|
return invalid();
|
|
52633
52639
|
return value2;
|
|
52634
52640
|
}
|
|
52635
|
-
function renderText(
|
|
52641
|
+
function renderText(text3, variables) {
|
|
52636
52642
|
let cursor = 0, result2 = "";
|
|
52637
52643
|
for (; ; ) {
|
|
52638
|
-
const open19 =
|
|
52644
|
+
const open19 = text3.indexOf("{{", cursor), close = text3.indexOf("}}", cursor);
|
|
52639
52645
|
if (close >= 0 && (open19 < 0 || close < open19)) return invalid();
|
|
52640
52646
|
if (open19 < 0) {
|
|
52641
|
-
result2 +=
|
|
52647
|
+
result2 += text3.slice(cursor);
|
|
52642
52648
|
break;
|
|
52643
52649
|
}
|
|
52644
|
-
const end =
|
|
52650
|
+
const end = text3.indexOf("}}", open19 + 2);
|
|
52645
52651
|
if (end < 0) return invalid();
|
|
52646
|
-
const key =
|
|
52652
|
+
const key = text3.slice(open19 + 2, end);
|
|
52647
52653
|
if (!name2.test(key)) return invalid();
|
|
52648
52654
|
if (!Object.hasOwn(variables, key)) throw new AiTemplateError(key);
|
|
52649
|
-
result2 +=
|
|
52655
|
+
result2 += text3.slice(cursor, open19) + variables[key];
|
|
52650
52656
|
if (result2.length > AI_TEMPLATE_LIMITS.fixtureBytes) return invalid();
|
|
52651
52657
|
cursor = end + 2;
|
|
52652
52658
|
}
|
|
@@ -53937,7 +53943,7 @@ async function boundedText(response, maxBytes = 8 * 1024 * 1024) {
|
|
|
53937
53943
|
const reader = response.body?.getReader();
|
|
53938
53944
|
if (!reader) return "";
|
|
53939
53945
|
const decoder = new TextDecoder();
|
|
53940
|
-
let total = 0,
|
|
53946
|
+
let total = 0, text3 = "";
|
|
53941
53947
|
try {
|
|
53942
53948
|
while (true) {
|
|
53943
53949
|
const part2 = await reader.read();
|
|
@@ -53945,9 +53951,9 @@ async function boundedText(response, maxBytes = 8 * 1024 * 1024) {
|
|
|
53945
53951
|
total += part2.value.byteLength;
|
|
53946
53952
|
if (total > maxBytes)
|
|
53947
53953
|
throw new Error("Response exceeds the 8 MiB text limit");
|
|
53948
|
-
|
|
53954
|
+
text3 += decoder.decode(part2.value, { stream: true });
|
|
53949
53955
|
}
|
|
53950
|
-
return
|
|
53956
|
+
return text3 + decoder.decode();
|
|
53951
53957
|
} finally {
|
|
53952
53958
|
await reader.cancel().catch(() => {
|
|
53953
53959
|
});
|
|
@@ -54087,7 +54093,7 @@ async function request(server, path2, {
|
|
|
54087
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}`;
|
|
54088
54094
|
const safe = [cookie, cookie?.split("=")[1], accessToken, ...secrets].filter(
|
|
54089
54095
|
(value2) => typeof value2 === "string" && value2.length > 0
|
|
54090
|
-
).reduce((
|
|
54096
|
+
).reduce((text3, secret) => text3.replaceAll(secret, "[redacted]"), message);
|
|
54091
54097
|
const failure3 = new ServiceError(
|
|
54092
54098
|
safe,
|
|
54093
54099
|
errorCode ?? (response.status === 401 ? "AUTH_REQUIRED" : response.status === 429 ? "RATE_LIMITED" : "SERVICE_ERROR"),
|
|
@@ -54097,7 +54103,7 @@ async function request(server, path2, {
|
|
|
54097
54103
|
const redacted = [cookie, cookie?.split("=")[1], accessToken, ...secrets].filter(
|
|
54098
54104
|
(value2) => typeof value2 === "string" && value2.length > 0
|
|
54099
54105
|
).reduce(
|
|
54100
|
-
(
|
|
54106
|
+
(text3, secret) => text3.replaceAll(secret, "[redacted]"),
|
|
54101
54107
|
JSON.stringify(detail.fields)
|
|
54102
54108
|
);
|
|
54103
54109
|
try {
|
|
@@ -55066,10 +55072,10 @@ var visualExample = {
|
|
|
55066
55072
|
}
|
|
55067
55073
|
}
|
|
55068
55074
|
};
|
|
55069
|
-
async function writeText(path2,
|
|
55075
|
+
async function writeText(path2, text3) {
|
|
55070
55076
|
const file2 = await open4(path2, "wx", 384);
|
|
55071
55077
|
try {
|
|
55072
|
-
await file2.writeFile(
|
|
55078
|
+
await file2.writeFile(text3);
|
|
55073
55079
|
} finally {
|
|
55074
55080
|
await file2.close();
|
|
55075
55081
|
}
|
|
@@ -55078,11 +55084,11 @@ var writeJson = (path2, data) => writeText(path2, JSON.stringify(data, null, 2)
|
|
|
55078
55084
|
async function readManifest(path2, { enable = false } = {}) {
|
|
55079
55085
|
if (!path2) throw new Error("Provide --file PATH to a monitor JSON file.");
|
|
55080
55086
|
let value2;
|
|
55081
|
-
const
|
|
55082
|
-
if (Buffer.byteLength(
|
|
55087
|
+
const text3 = await readFile(path2, "utf8");
|
|
55088
|
+
if (Buffer.byteLength(text3) > 96e3)
|
|
55083
55089
|
throw new Error("Monitor configuration exceeds 96 KB.");
|
|
55084
55090
|
try {
|
|
55085
|
-
value2 = JSON.parse(
|
|
55091
|
+
value2 = JSON.parse(text3);
|
|
55086
55092
|
} catch {
|
|
55087
55093
|
throw new Error("Monitor configuration must be valid JSON.");
|
|
55088
55094
|
}
|
|
@@ -55311,8 +55317,13 @@ async function localRunDiagnosis(directory) {
|
|
|
55311
55317
|
}
|
|
55312
55318
|
});
|
|
55313
55319
|
}
|
|
55314
|
-
function formatRunDiagnosis(value2) {
|
|
55315
|
-
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")];
|
|
55316
55327
|
lines.push(`Verification policy: ${report.policy.hash ?? "unavailable"}`);
|
|
55317
55328
|
lines.push(
|
|
55318
55329
|
report.history.lastPassing ? `Last passing matching policy: ${report.history.lastPassing.runId}` : `Matching history: unavailable (${report.history.reason})`
|
|
@@ -55324,6 +55335,10 @@ function formatRunDiagnosis(value2) {
|
|
|
55324
55335
|
(a) => a.status !== "available"
|
|
55325
55336
|
))
|
|
55326
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
|
+
}
|
|
55327
55342
|
lines.push(
|
|
55328
55343
|
`Protected requests: ${report.requests.source === "local" ? "local helper report (not controller accounting)" : report.requests.source}; ${report.requests.coverage}`
|
|
55329
55344
|
);
|
|
@@ -55342,6 +55357,10 @@ function formatRunDiagnosis(value2) {
|
|
|
55342
55357
|
lines.push(` ${kind}: ${link2.requestId} (${link2.match})`);
|
|
55343
55358
|
}
|
|
55344
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
|
+
}
|
|
55345
55364
|
lines.push(`Reproduction: ${report.reproduction.availability}`);
|
|
55346
55365
|
const requirementLabels = {
|
|
55347
55366
|
runtime: "pinned runtime project: --runtime PROJECT",
|
|
@@ -55645,6 +55664,77 @@ async function downloadArtifact(server, runId, path2, file2, expected, session,
|
|
|
55645
55664
|
);
|
|
55646
55665
|
return { event: "artifact_downloaded", runId, path: path2, ...saved };
|
|
55647
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
|
+
}
|
|
55648
55738
|
|
|
55649
55739
|
// src/local-requests.ts
|
|
55650
55740
|
import { constants as constants6 } from "node:fs";
|
|
@@ -55699,8 +55789,8 @@ async function targetConfiguration(file2) {
|
|
|
55699
55789
|
await handle.close();
|
|
55700
55790
|
}
|
|
55701
55791
|
}
|
|
55702
|
-
function httpSecretInput(
|
|
55703
|
-
const value2 =
|
|
55792
|
+
function httpSecretInput(text3) {
|
|
55793
|
+
const value2 = text3.replace(/[\r\n]+$/, "");
|
|
55704
55794
|
if (!httpCredentialRotateSchema.shape.value.safeParse(value2).success)
|
|
55705
55795
|
throw new ServiceError(
|
|
55706
55796
|
"Use a single-line ASCII HTTP credential value of at most 4096 characters.",
|
|
@@ -56868,7 +56958,7 @@ HTTP ${response.status}
|
|
|
56868
56958
|
Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
56869
56959
|
};
|
|
56870
56960
|
}
|
|
56871
|
-
let
|
|
56961
|
+
let text3 = "", bytes2 = 0;
|
|
56872
56962
|
if (response.body) {
|
|
56873
56963
|
const reader = response.body.getReader();
|
|
56874
56964
|
const decoder = new TextDecoder();
|
|
@@ -56879,9 +56969,9 @@ Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
|
56879
56969
|
bytes2 += value2.byteLength;
|
|
56880
56970
|
if (bytes2 > 256e3)
|
|
56881
56971
|
throw new Error("Response exceeds the 256 KB check limit");
|
|
56882
|
-
|
|
56972
|
+
text3 += decoder.decode(value2, { stream: true });
|
|
56883
56973
|
}
|
|
56884
|
-
|
|
56974
|
+
text3 += decoder.decode();
|
|
56885
56975
|
} finally {
|
|
56886
56976
|
await reader.cancel().catch(() => {
|
|
56887
56977
|
});
|
|
@@ -56894,9 +56984,9 @@ Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
|
56894
56984
|
bytes: bytes2,
|
|
56895
56985
|
excerpt: omitted ? null : hidden.reduce(
|
|
56896
56986
|
(value2, secret) => value2.replaceAll(secret, "[redacted]"),
|
|
56897
|
-
|
|
56987
|
+
text3.slice(0, RUN_TRACE_LIMITS.bodyExcerpt)
|
|
56898
56988
|
),
|
|
56899
|
-
truncated: !omitted &&
|
|
56989
|
+
truncated: !omitted && text3.length > RUN_TRACE_LIMITS.bodyExcerpt,
|
|
56900
56990
|
omitted
|
|
56901
56991
|
};
|
|
56902
56992
|
const latency = Math.round(performance2.now() - start);
|
|
@@ -56905,11 +56995,11 @@ Cloudflare challenge blocked the probe. No challenge was bypassed.`
|
|
|
56905
56995
|
failures.push(
|
|
56906
56996
|
`Expected HTTP ${m.settings.expectedStatus}, received ${response.status}`
|
|
56907
56997
|
);
|
|
56908
|
-
if (m.settings.contains && !
|
|
56998
|
+
if (m.settings.contains && !text3.includes(m.settings.contains))
|
|
56909
56999
|
failures.push("Expected text missing from response");
|
|
56910
57000
|
if (m.settings.jsonPath) {
|
|
56911
57001
|
try {
|
|
56912
|
-
let value2 = JSON.parse(
|
|
57002
|
+
let value2 = JSON.parse(text3);
|
|
56913
57003
|
for (const part2 of m.settings.jsonPath.split("."))
|
|
56914
57004
|
value2 = value2?.[part2];
|
|
56915
57005
|
let expected;
|
|
@@ -57316,23 +57406,23 @@ async function singleCheck(monitor, parentSignal, options = {}) {
|
|
|
57316
57406
|
passed2 = matchesType(found.value, assertion.value);
|
|
57317
57407
|
break;
|
|
57318
57408
|
default: {
|
|
57319
|
-
const
|
|
57320
|
-
if (typeof
|
|
57409
|
+
const text3 = found.value;
|
|
57410
|
+
if (typeof text3 === "string") {
|
|
57321
57411
|
switch (assertion.operator) {
|
|
57322
57412
|
case "contains":
|
|
57323
|
-
passed2 =
|
|
57413
|
+
passed2 = text3.includes(assertion.value);
|
|
57324
57414
|
break;
|
|
57325
57415
|
case "not-contains":
|
|
57326
|
-
passed2 = !
|
|
57416
|
+
passed2 = !text3.includes(assertion.value);
|
|
57327
57417
|
break;
|
|
57328
57418
|
case "contains-any":
|
|
57329
57419
|
passed2 = assertion.value.some(
|
|
57330
|
-
(value2) =>
|
|
57420
|
+
(value2) => text3.includes(value2)
|
|
57331
57421
|
);
|
|
57332
57422
|
break;
|
|
57333
57423
|
case "contains-all":
|
|
57334
57424
|
passed2 = assertion.value.every(
|
|
57335
|
-
(value2) =>
|
|
57425
|
+
(value2) => text3.includes(value2)
|
|
57336
57426
|
);
|
|
57337
57427
|
break;
|
|
57338
57428
|
}
|
|
@@ -58098,9 +58188,9 @@ async function collectArtifacts(dir, base2 = dir, tokens2 = [], excluded = /* @_
|
|
|
58098
58188
|
"AI evidence exceeds its byte limit"
|
|
58099
58189
|
);
|
|
58100
58190
|
const original = await handle.readFile("utf8");
|
|
58101
|
-
const redactText = (
|
|
58191
|
+
const redactText = (text3) => tokens2.reduce(
|
|
58102
58192
|
(value2, token) => value2.replaceAll(token, "[redacted attempt credential]"),
|
|
58103
|
-
|
|
58193
|
+
text3
|
|
58104
58194
|
);
|
|
58105
58195
|
let clean = redactText(original);
|
|
58106
58196
|
if (entry2.name.endsWith(".json")) {
|
|
@@ -58464,7 +58554,7 @@ try {
|
|
|
58464
58554
|
const requestCoverageError = requestEvidence.summary.technicalError;
|
|
58465
58555
|
const passed = !requestCoverageError && !dataCoverageError && !dataFailed && !scenarioCoverageError && !scenarioFailed && p.code === 0 && run2?.status === "passed" && results.length > 0 && results.every((r) => r.status === "passed");
|
|
58466
58556
|
const redact = (value2) => redactions.reduce(
|
|
58467
|
-
(
|
|
58557
|
+
(text3, token) => text3.replaceAll(token, "[redacted attempt credential]"),
|
|
58468
58558
|
value2
|
|
58469
58559
|
);
|
|
58470
58560
|
const artifacts = await collectArtifacts(
|
|
@@ -58684,10 +58774,10 @@ async function execute(monitor, runDir, {
|
|
|
58684
58774
|
}
|
|
58685
58775
|
async function withTrace(result2, runDir, trace) {
|
|
58686
58776
|
try {
|
|
58687
|
-
const
|
|
58688
|
-
if (Buffer.byteLength(
|
|
58777
|
+
const text3 = JSON.stringify(runTraceFileSchema.parse(trace));
|
|
58778
|
+
if (Buffer.byteLength(text3) > RUN_TRACE_LIMITS.fileBytes) return result2;
|
|
58689
58779
|
await mkdir3(join6(runDir, ".e2e"), { recursive: true, mode: 448 });
|
|
58690
|
-
await writeFile3(join6(runDir, RUN_TRACE_PATH),
|
|
58780
|
+
await writeFile3(join6(runDir, RUN_TRACE_PATH), text3, { mode: 384 });
|
|
58691
58781
|
return {
|
|
58692
58782
|
...result2,
|
|
58693
58783
|
artifacts: [...result2.artifacts ?? [], RUN_TRACE_PATH]
|
|
@@ -59081,7 +59171,7 @@ var projectConfigSchema = external_exports.object({
|
|
|
59081
59171
|
monitors: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).max(CONFIG_LIMITS.monitors)
|
|
59082
59172
|
}).strict();
|
|
59083
59173
|
var pathOf = (parts) => parts.reduce(
|
|
59084
|
-
(
|
|
59174
|
+
(text3, part2) => typeof part2 === "number" ? `${text3}[${part2}]` : `${text3}${text3 ? "." : ""}${String(part2)}`,
|
|
59085
59175
|
""
|
|
59086
59176
|
);
|
|
59087
59177
|
function resolveProjectConfig(input2, environment, scripts) {
|
|
@@ -59366,8 +59456,8 @@ async function readConnectionConfiguration(file2) {
|
|
|
59366
59456
|
2
|
|
59367
59457
|
);
|
|
59368
59458
|
}
|
|
59369
|
-
function providerCredential(
|
|
59370
|
-
const parsed = connectionSecretSchema.safeParse(
|
|
59459
|
+
function providerCredential(text3) {
|
|
59460
|
+
const parsed = connectionSecretSchema.safeParse(text3.trim());
|
|
59371
59461
|
if (!parsed.success)
|
|
59372
59462
|
throw new ServiceError(
|
|
59373
59463
|
"Provide a private provider key through --credential-file or --credential-stdin.",
|
|
@@ -59625,8 +59715,8 @@ function modelTransport(authority, options = {}) {
|
|
|
59625
59715
|
"Model provider did not accept the request"
|
|
59626
59716
|
);
|
|
59627
59717
|
}
|
|
59628
|
-
const
|
|
59629
|
-
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)))
|
|
59630
59720
|
throw new AppError(
|
|
59631
59721
|
502,
|
|
59632
59722
|
"AI_RESPONSE_REJECTED",
|
|
@@ -59634,7 +59724,7 @@ function modelTransport(authority, options = {}) {
|
|
|
59634
59724
|
);
|
|
59635
59725
|
let result2;
|
|
59636
59726
|
try {
|
|
59637
|
-
result2 = modelResponseSchema.safeParse(JSON.parse(
|
|
59727
|
+
result2 = modelResponseSchema.safeParse(JSON.parse(text3));
|
|
59638
59728
|
} catch {
|
|
59639
59729
|
}
|
|
59640
59730
|
if (!result2?.success || result2.data.model !== body2.model)
|
|
@@ -61037,9 +61127,9 @@ function pinPackageJson(existing, project) {
|
|
|
61037
61127
|
}
|
|
61038
61128
|
return { json: json3, changes };
|
|
61039
61129
|
}
|
|
61040
|
-
var missingIgnores = (
|
|
61130
|
+
var missingIgnores = (text3) => {
|
|
61041
61131
|
const lines = new Set(
|
|
61042
|
-
|
|
61132
|
+
text3.split(/\r?\n/).map((l) => l.trim().replace(/^\//, ""))
|
|
61043
61133
|
);
|
|
61044
61134
|
return RUNTIME_IGNORES.filter(
|
|
61045
61135
|
(entry2) => !lines.has(entry2) && !lines.has(entry2.slice(0, -1))
|
|
@@ -61069,11 +61159,11 @@ function run(command, args, cwd, signal) {
|
|
|
61069
61159
|
async function installRuntime(options) {
|
|
61070
61160
|
const { project, browser, yes, signal } = options;
|
|
61071
61161
|
const manifestPath = join11(project, "package.json");
|
|
61072
|
-
const
|
|
61162
|
+
const text3 = await readFile6(manifestPath, "utf8").catch(() => null);
|
|
61073
61163
|
let existing = null;
|
|
61074
|
-
if (
|
|
61164
|
+
if (text3 !== null)
|
|
61075
61165
|
try {
|
|
61076
|
-
existing = JSON.parse(
|
|
61166
|
+
existing = JSON.parse(text3);
|
|
61077
61167
|
} catch (cause) {
|
|
61078
61168
|
throw new ServiceError(
|
|
61079
61169
|
`${manifestPath} is not valid JSON: ${cause.message}`,
|
|
@@ -61326,9 +61416,9 @@ async function verifyLocally(options) {
|
|
|
61326
61416
|
var configPath = (file2) => resolve13(file2 ?? CONFIG_FILE);
|
|
61327
61417
|
async function readProjectConfig(file2) {
|
|
61328
61418
|
const path2 = configPath(file2);
|
|
61329
|
-
let
|
|
61419
|
+
let text3;
|
|
61330
61420
|
try {
|
|
61331
|
-
|
|
61421
|
+
text3 = await readFile7(path2, "utf8");
|
|
61332
61422
|
} catch {
|
|
61333
61423
|
throw new ServiceError(
|
|
61334
61424
|
`${path2} was not found. Run waitcher config init or pass --file.`,
|
|
@@ -61336,14 +61426,14 @@ async function readProjectConfig(file2) {
|
|
|
61336
61426
|
2
|
|
61337
61427
|
);
|
|
61338
61428
|
}
|
|
61339
|
-
if (Buffer.byteLength(
|
|
61429
|
+
if (Buffer.byteLength(text3) > CONFIG_LIMITS.bytes)
|
|
61340
61430
|
throw new ServiceError(
|
|
61341
61431
|
`waitcher.json exceeds ${CONFIG_LIMITS.bytes} bytes.`,
|
|
61342
61432
|
"VALIDATION_ERROR",
|
|
61343
61433
|
2
|
|
61344
61434
|
);
|
|
61345
61435
|
try {
|
|
61346
|
-
return { path: path2, config: JSON.parse(
|
|
61436
|
+
return { path: path2, config: JSON.parse(text3) };
|
|
61347
61437
|
} catch (cause) {
|
|
61348
61438
|
throw new ServiceError(
|
|
61349
61439
|
`waitcher.json is not valid JSON: ${cause.message}`,
|
|
@@ -61433,7 +61523,7 @@ var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors
|
|
|
61433
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";
|
|
61434
61524
|
|
|
61435
61525
|
// ../../skills/waitcher/references/optional-capabilities.md
|
|
61436
|
-
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 like `claude-sonnet-5-5`); 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';
|
|
61437
61527
|
|
|
61438
61528
|
// ../../skills/waitcher/agents/openai.yaml
|
|
61439
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';
|
|
@@ -61473,8 +61563,8 @@ async function installSkill(options) {
|
|
|
61473
61563
|
await mkdir8(join13(directory, "references"), { recursive: true });
|
|
61474
61564
|
await mkdir8(join13(directory, "agents"), { recursive: true });
|
|
61475
61565
|
await writeFile9(join13(directory, "SKILL.md"), SKILL_default);
|
|
61476
|
-
for (const [name5,
|
|
61477
|
-
await writeFile9(join13(directory, "references", name5),
|
|
61566
|
+
for (const [name5, text3] of Object.entries(references))
|
|
61567
|
+
await writeFile9(join13(directory, "references", name5), text3);
|
|
61478
61568
|
await writeFile9(join13(directory, "agents/openai.yaml"), openai_default);
|
|
61479
61569
|
await writeFile9(
|
|
61480
61570
|
join13(directory, MARKER),
|
|
@@ -61598,7 +61688,7 @@ async function doctor(options) {
|
|
|
61598
61688
|
for (const home of skillHomes) {
|
|
61599
61689
|
if (!await exists(join14(home, "SKILL.md"))) continue;
|
|
61600
61690
|
installed.push(home);
|
|
61601
|
-
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);
|
|
61602
61692
|
if (marker2 && marker2.version !== options.version) stale.push(home);
|
|
61603
61693
|
}
|
|
61604
61694
|
const install = root === process.cwd() ? "waitcher skill install" : `waitcher skill install --path ${join14(root, ".claude", "skills")}`;
|
|
@@ -62019,8 +62109,8 @@ var incidentEditSchema = external_exports.object({
|
|
|
62019
62109
|
// src/access.ts
|
|
62020
62110
|
import { lstat as lstat10, open as open16, unlink as unlink3 } from "node:fs/promises";
|
|
62021
62111
|
import { dirname as dirname15, resolve as resolve16 } from "node:path";
|
|
62022
|
-
function accessTokenInput(
|
|
62023
|
-
let token =
|
|
62112
|
+
function accessTokenInput(text3) {
|
|
62113
|
+
let token = text3.trim();
|
|
62024
62114
|
if (token.startsWith("{")) {
|
|
62025
62115
|
try {
|
|
62026
62116
|
token = JSON.parse(token).token;
|
|
@@ -62126,10 +62216,10 @@ async function readPrivate(path2) {
|
|
|
62126
62216
|
}
|
|
62127
62217
|
async function loadSession(server) {
|
|
62128
62218
|
const path2 = sessionPath(server);
|
|
62129
|
-
let
|
|
62219
|
+
let text3;
|
|
62130
62220
|
try {
|
|
62131
62221
|
await privatePath(dirname16(path2), true);
|
|
62132
|
-
|
|
62222
|
+
text3 = await readPrivate(path2);
|
|
62133
62223
|
} catch (cause) {
|
|
62134
62224
|
const error62 = asError(cause);
|
|
62135
62225
|
if (error62.code === "ENOENT")
|
|
@@ -62140,7 +62230,7 @@ async function loadSession(server) {
|
|
|
62140
62230
|
}
|
|
62141
62231
|
let session;
|
|
62142
62232
|
try {
|
|
62143
|
-
session = JSON.parse(
|
|
62233
|
+
session = JSON.parse(text3);
|
|
62144
62234
|
} catch {
|
|
62145
62235
|
throw new Error("Saved session is unreadable. Run auth login again.");
|
|
62146
62236
|
}
|
|
@@ -62614,6 +62704,7 @@ Monitor configuration
|
|
|
62614
62704
|
Agent checks: an api definition or waitcher.json entry with an "agent" block runs Claude
|
|
62615
62705
|
Code on its task first, then the script verifies the outcome, on an anthropic
|
|
62616
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.
|
|
62617
62708
|
monitor validate --file PATH Validate locally, including scriptFile
|
|
62618
62709
|
monitor build --file PATH --output NEW_DIR [--project PROJECT]
|
|
62619
62710
|
Bundle project helpers into one portable monitor script
|
|
@@ -62631,7 +62722,7 @@ Monitor configuration
|
|
|
62631
62722
|
Executions and reports
|
|
62632
62723
|
run scenarios --id RUN_ID [--json]
|
|
62633
62724
|
run scenarios --directory PRIVATE_RUN_DIR [--json]
|
|
62634
|
-
run diagnose --id RUN_ID [--json]
|
|
62725
|
+
run diagnose --id RUN_ID [--json] An agent check leads with what the agent did
|
|
62635
62726
|
run diagnose --directory PRIVATE_RUN_DIR [--json]
|
|
62636
62727
|
run reproduce --id RUN_ID --output NEW_DIRECTORY
|
|
62637
62728
|
run local --file MONITOR.json [--runtime PROJECT] [--output DIR] [--video]
|
|
@@ -62641,7 +62732,8 @@ Executions and reports
|
|
|
62641
62732
|
JSON/report/logs/traces; video opt-in, fresh output per run
|
|
62642
62733
|
Project output must stay inside the E2E project
|
|
62643
62734
|
run start --id MONITOR_ID [--wait [--brief]] [--timeout 60] [--update-baselines]
|
|
62644
|
-
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;
|
|
62645
62737
|
--brief leaves out the execution record
|
|
62646
62738
|
--update-baselines (visual checks, browser tests; write
|
|
62647
62739
|
access): the run adopts what it captures as the approved
|
|
@@ -62756,7 +62848,9 @@ AI connections (when connection settings are enabled; AI execution is separate)
|
|
|
62756
62848
|
JSON: {"name":"Browser checks","provider":"openrouter","projectId":"UUID",
|
|
62757
62849
|
"environmentId":"UUID","models":["provider/model"],"enabled":false}
|
|
62758
62850
|
provider: openrouter (an OpenRouter key) for AI scripts and AI checks;
|
|
62759
|
-
anthropic (your Anthropic API key
|
|
62851
|
+
anthropic (your Anthropic API key) for agent checks; its models may be
|
|
62852
|
+
haiku, sonnet, opus or fable (the latest of that family, resolved at each run)
|
|
62853
|
+
or exact IDs such as claude-sonnet-5-5.
|
|
62760
62854
|
Connections default disabled. Scope cannot be moved; create a separate connection.
|
|
62761
62855
|
Saving or enabling a connection sends no provider request and starts no monitor.
|
|
62762
62856
|
Keys are write-only. Keep them out of JSON, command arguments and Git.
|
|
@@ -62992,7 +63086,7 @@ ${exitCodes}
|
|
|
62992
63086
|
// package.json
|
|
62993
63087
|
var package_default = {
|
|
62994
63088
|
name: "@waitcher/cli",
|
|
62995
|
-
version: "0.2.
|
|
63089
|
+
version: "0.2.22",
|
|
62996
63090
|
description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API, browser and visual monitors from waitcher.json.",
|
|
62997
63091
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
62998
63092
|
author: "S\u0142awomir Radzymi\u0144ski",
|
|
@@ -63037,7 +63131,7 @@ var package_default = {
|
|
|
63037
63131
|
};
|
|
63038
63132
|
|
|
63039
63133
|
// src/main.ts
|
|
63040
|
-
var list = (
|
|
63134
|
+
var list = (text3) => (text3 ?? "").split(",").map((x) => x.trim()).filter(Boolean);
|
|
63041
63135
|
var issues = (all) => all.map((i) => `${i.path.join(".")}: ${i.message}`).join("\n");
|
|
63042
63136
|
var controller = new AbortController();
|
|
63043
63137
|
process.once("SIGINT", () => controller.abort());
|
|
@@ -63108,16 +63202,16 @@ async function passwordFromStdin(maxBytes = 2048) {
|
|
|
63108
63202
|
usage2(
|
|
63109
63203
|
"Pipe the password to stdin, or use --password-file PATH. Passwords are not accepted as command arguments."
|
|
63110
63204
|
);
|
|
63111
|
-
let
|
|
63205
|
+
let text3 = "";
|
|
63112
63206
|
const cancel = () => process.stdin.destroy(new Error("Interrupted."));
|
|
63113
63207
|
controller.signal.addEventListener("abort", cancel, { once: true });
|
|
63114
63208
|
try {
|
|
63115
63209
|
for await (const chunk of process.stdin) {
|
|
63116
|
-
|
|
63117
|
-
if (Buffer.byteLength(
|
|
63210
|
+
text3 += chunk;
|
|
63211
|
+
if (Buffer.byteLength(text3) > maxBytes)
|
|
63118
63212
|
usage2("Password input is too long.");
|
|
63119
63213
|
}
|
|
63120
|
-
return
|
|
63214
|
+
return text3.replace(/[\r\n]+$/, "");
|
|
63121
63215
|
} finally {
|
|
63122
63216
|
controller.signal.removeEventListener("abort", cancel);
|
|
63123
63217
|
}
|
|
@@ -64859,12 +64953,12 @@ async function main() {
|
|
|
64859
64953
|
usage2(
|
|
64860
64954
|
"Provide --file PATH with the complete configuration and expectedRevision for edits."
|
|
64861
64955
|
);
|
|
64862
|
-
const
|
|
64863
|
-
if (Buffer.byteLength(
|
|
64956
|
+
const text3 = await readFile11(v.file, "utf8");
|
|
64957
|
+
if (Buffer.byteLength(text3) > 16e3)
|
|
64864
64958
|
usage2("Project configuration exceeds 16 KB");
|
|
64865
64959
|
let body2;
|
|
64866
64960
|
try {
|
|
64867
|
-
body2 = JSON.parse(
|
|
64961
|
+
body2 = JSON.parse(text3);
|
|
64868
64962
|
} catch {
|
|
64869
64963
|
usage2("Configuration must be JSON");
|
|
64870
64964
|
}
|
|
@@ -65109,10 +65203,10 @@ async function main() {
|
|
|
65109
65203
|
if (!v.file) usage2("Provide --file PATH for the configuration.");
|
|
65110
65204
|
let input2;
|
|
65111
65205
|
try {
|
|
65112
|
-
const
|
|
65113
|
-
if (Buffer.byteLength(
|
|
65206
|
+
const text3 = await readFile11(v.file, "utf8");
|
|
65207
|
+
if (Buffer.byteLength(text3) > 96e3)
|
|
65114
65208
|
usage2("Configuration exceeds 96 KB.");
|
|
65115
|
-
input2 = JSON.parse(
|
|
65209
|
+
input2 = JSON.parse(text3);
|
|
65116
65210
|
} catch {
|
|
65117
65211
|
usage2("Could not read valid JSON configuration.");
|
|
65118
65212
|
}
|
|
@@ -65370,7 +65464,24 @@ async function main() {
|
|
|
65370
65464
|
requestedId
|
|
65371
65465
|
);
|
|
65372
65466
|
if (!v.json) {
|
|
65373
|
-
|
|
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));
|
|
65374
65485
|
return;
|
|
65375
65486
|
}
|
|
65376
65487
|
} else if (command === "run reproduce") {
|
|
@@ -65441,6 +65552,8 @@ async function main() {
|
|
|
65441
65552
|
status: run2.status,
|
|
65442
65553
|
duration: run2.duration,
|
|
65443
65554
|
message: run2.message,
|
|
65555
|
+
// The run's report in the web app, to open or share.
|
|
65556
|
+
report: `${server}/app#run/${run2.id}`,
|
|
65444
65557
|
...v.brief ? {} : { execution: run2 }
|
|
65445
65558
|
};
|
|
65446
65559
|
exitCode = run2.status === "passed" ? 0 : 4;
|
|
@@ -65544,10 +65657,10 @@ async function main() {
|
|
|
65544
65657
|
if (!v.file) usage2("Provide --file PATH for the status page.");
|
|
65545
65658
|
let input2;
|
|
65546
65659
|
try {
|
|
65547
|
-
const
|
|
65548
|
-
if (Buffer.byteLength(
|
|
65660
|
+
const text3 = await readFile11(v.file, "utf8");
|
|
65661
|
+
if (Buffer.byteLength(text3) > 96e3)
|
|
65549
65662
|
usage2("Configuration exceeds 96 KB.");
|
|
65550
|
-
input2 = JSON.parse(
|
|
65663
|
+
input2 = JSON.parse(text3);
|
|
65551
65664
|
} catch {
|
|
65552
65665
|
usage2("Could not read valid JSON configuration.");
|
|
65553
65666
|
}
|
package/dist/model-client.mjs
CHANGED
|
@@ -53052,6 +53052,12 @@ var MODEL_LIMITS = {
|
|
|
53052
53052
|
maxRunTokens: 1e6
|
|
53053
53053
|
};
|
|
53054
53054
|
var MODEL_PROVIDERS = ["openrouter", "anthropic"];
|
|
53055
|
+
var ANTHROPIC_MODEL_ALIASES = Object.freeze({
|
|
53056
|
+
haiku: "claude-haiku-5-5",
|
|
53057
|
+
sonnet: "claude-sonnet-5-5",
|
|
53058
|
+
opus: "claude-opus-5-5",
|
|
53059
|
+
fable: "claude-fable-5-2"
|
|
53060
|
+
});
|
|
53055
53061
|
var modelNameSchema = external_exports.string().min(1).max(120).regex(/^[a-zA-Z0-9][a-zA-Z0-9_./:-]*$/).refine((s) => !s.includes("://") && !s.includes(".."));
|
|
53056
53062
|
var connectionSchema = external_exports.object({
|
|
53057
53063
|
name: external_exports.string().trim().min(1).max(80).regex(/^[^\x00-\x1f\x7f]+$/),
|
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",
|