@waitcher/cli 0.2.21 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +206 -100
  2. 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(count) {
31393
- while (count > 0 && this.lineChunkIndex < this.chunks.length) {
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 (count < remaining) {
31397
- this.linePos += count;
31398
- count = 0;
31396
+ if (count2 < remaining) {
31397
+ this.linePos += count2;
31398
+ count2 = 0;
31399
31399
  } else {
31400
- count -= remaining;
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 count = units;
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
- count--;
33335
+ count2--;
33336
33336
  i++;
33337
33337
  }
33338
33338
  }
33339
- return count;
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(count, one, few, many) {
37723
- const absCount = Math.abs(count);
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(count, one, many) {
40371
- return Math.abs(count) === 1 ? one : many;
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 = (text2) => {
41456
- return text2.charAt(0).toUpperCase() + text2.slice(1);
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(count, one, few, many) {
43110
- const absCount = Math.abs(count);
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(text2, variables) {
52641
+ function renderText(text3, variables) {
52642
52642
  let cursor = 0, result2 = "";
52643
52643
  for (; ; ) {
52644
- const open19 = text2.indexOf("{{", cursor), close = text2.indexOf("}}", cursor);
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 += text2.slice(cursor);
52647
+ result2 += text3.slice(cursor);
52648
52648
  break;
52649
52649
  }
52650
- const end = text2.indexOf("}}", open19 + 2);
52650
+ const end = text3.indexOf("}}", open19 + 2);
52651
52651
  if (end < 0) return invalid();
52652
- const key = text2.slice(open19 + 2, end);
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 += text2.slice(cursor, open19) + variables[key];
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, text2 = "";
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
- text2 += decoder.decode(part2.value, { stream: true });
53954
+ text3 += decoder.decode(part2.value, { stream: true });
53955
53955
  }
53956
- return text2 + decoder.decode();
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((text2, secret) => text2.replaceAll(secret, "[redacted]"), message);
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
- (text2, secret) => text2.replaceAll(secret, "[redacted]"),
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, text2) {
55075
+ async function writeText(path2, text3) {
55076
55076
  const file2 = await open4(path2, "wx", 384);
55077
55077
  try {
55078
- await file2.writeFile(text2);
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 text2 = await readFile(path2, "utf8");
55088
- if (Buffer.byteLength(text2) > 96e3)
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(text2);
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), lines = [formatScenarioReport(report.scenarios).trimEnd()];
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(text2) {
55709
- const value2 = text2.replace(/[\r\n]+$/, "");
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 text2 = "", bytes2 = 0;
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
- text2 += decoder.decode(value2, { stream: true });
56972
+ text3 += decoder.decode(value2, { stream: true });
56889
56973
  }
56890
- text2 += decoder.decode();
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
- text2.slice(0, RUN_TRACE_LIMITS.bodyExcerpt)
56987
+ text3.slice(0, RUN_TRACE_LIMITS.bodyExcerpt)
56904
56988
  ),
56905
- truncated: !omitted && text2.length > RUN_TRACE_LIMITS.bodyExcerpt,
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 && !text2.includes(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(text2);
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 text2 = found.value;
57326
- if (typeof text2 === "string") {
57409
+ const text3 = found.value;
57410
+ if (typeof text3 === "string") {
57327
57411
  switch (assertion.operator) {
57328
57412
  case "contains":
57329
- passed2 = text2.includes(assertion.value);
57413
+ passed2 = text3.includes(assertion.value);
57330
57414
  break;
57331
57415
  case "not-contains":
57332
- passed2 = !text2.includes(assertion.value);
57416
+ passed2 = !text3.includes(assertion.value);
57333
57417
  break;
57334
57418
  case "contains-any":
57335
57419
  passed2 = assertion.value.some(
57336
- (value2) => text2.includes(value2)
57420
+ (value2) => text3.includes(value2)
57337
57421
  );
57338
57422
  break;
57339
57423
  case "contains-all":
57340
57424
  passed2 = assertion.value.every(
57341
- (value2) => text2.includes(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 = (text2) => tokens2.reduce(
58191
+ const redactText = (text3) => tokens2.reduce(
58108
58192
  (value2, token) => value2.replaceAll(token, "[redacted attempt credential]"),
58109
- text2
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
- (text2, token) => text2.replaceAll(token, "[redacted attempt credential]"),
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 text2 = JSON.stringify(runTraceFileSchema.parse(trace));
58694
- if (Buffer.byteLength(text2) > RUN_TRACE_LIMITS.fileBytes) return result2;
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), text2, { mode: 384 });
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
- (text2, part2) => typeof part2 === "number" ? `${text2}[${part2}]` : `${text2}${text2 ? "." : ""}${String(part2)}`,
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(text2) {
59376
- const parsed = connectionSecretSchema.safeParse(text2.trim());
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 text2 = await boundedText(response2, MODEL_LIMITS.responseBytes);
59635
- if (text2.includes(call.secret) || text2.includes(JSON.stringify(call.secret).slice(1, -1)))
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(text2));
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 = (text2) => {
61130
+ var missingIgnores = (text3) => {
61047
61131
  const lines = new Set(
61048
- text2.split(/\r?\n/).map((l) => l.trim().replace(/^\//, ""))
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 text2 = await readFile6(manifestPath, "utf8").catch(() => null);
61162
+ const text3 = await readFile6(manifestPath, "utf8").catch(() => null);
61079
61163
  let existing = null;
61080
- if (text2 !== null)
61164
+ if (text3 !== null)
61081
61165
  try {
61082
- existing = JSON.parse(text2);
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 text2;
61419
+ let text3;
61336
61420
  try {
61337
- text2 = await readFile7(path2, "utf8");
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(text2) > CONFIG_LIMITS.bytes)
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(text2) };
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}`,
@@ -61433,13 +61517,13 @@ var authoring_default = '# Authoring and running monitors\n\nRead when writing o
61433
61517
  var ai_and_agents_default = "# AI endpoints, agent outcomes and model steps\n\nRead only when `waitcher system capabilities` reports the feature and the user needs it. Deterministic HTTP, API and browser monitors need none of this; see [authoring](authoring.md).\n\n## Agent outcome checks\n\nFor hosted scripts using `#waitcher/scenario`, first confirm `features.scenarioEvidence` through `system capabilities`, alongside script admission. Older servers may not provide this helper. Do not silently remove required scenario checks to make an unsupported run pass. Capability discovery is separate from native security, capacity and production release acceptance.\n\nFor an agent that changes application state, start with `monitor init --template agent-outcome --file outcome.json --target https://product.example/api/`. It creates a paused ordinary API script, with no model binding or paid-provider requirement. Adapt its fixed `agent/tasks` submission and `notes/{runId}` resource paths, disposable test namespace and exact expected fields. It submits one action, ignores claims of success and response-provided URLs, then independently reads the known resource at most three times. A fresh per-run random `id` and `correlationId` must both match, alongside the expected result. Action transport errors are never automatically retried. Cleanup runs in `finally` only after an independent read proves the resource belongs to this run; cleanup failures fail the test. If ownership or the action result is uncertain, it records cleanup as unverified and leaves state untouched. Reconcile possible late actions before repeating a mutating test. This pattern verifies the chosen outcome, not the agent's overall quality or the correctness of its explanation.\n\nThe starter uses the optional `#waitcher/scenario` helper with required submit/action, observe, verify and cleanup phases. `createScenario({id, phases})` returns `phase(id, callback)`, `assert(boolean)` and `incomplete(reason)`. Call signals only inside an active phase. Every scenario needs a required verify phase, and an executed verify phase must call `scenario.assert` at least once; an empty verification cannot establish pass. `assert(false)` records a business failure even if caught; ordinary callback exceptions and `incomplete(\"CLEANUP_UNVERIFIED\")` record coverage errors. Inspect `.e2e/waitcher-scenarios.json` in the private evidence: required phases that never ran or remain in flight also prevent a pass. Coverage error takes precedence while retaining failed verification facts. A false agent claim can therefore produce a failed verify phase and an overall error when cleanup remains uncertain. The helper does not automatically classify arbitrary E2E assertions or infer agent/tool traces. Use stable non-secret scenario/phase IDs, avoid raw response values in assertions, and do not use report labels as secret storage.\n\nUse the unchanged file with `monitor validate`, account-free `run local --file outcome.json --runtime YOUR_PINNED_RUNTIME`, and the existing API-script editor or `monitor apply --file outcome.json --dry-run`. Keep it paused after applying. Project authors can extract the script into `scriptFile`, keep helper imports and use `monitor build` to create one portable script; `#waitcher/scenario` stays external and is supplied by the manifest runner. The complete CLI includes `scenario-runtime.mjs`; keep package companions together. Standalone `--project` needs its own helper integration. The starter's default is credential-free. Optional local/trusted-administrator bearer tokens use `CHECK_AGENT_ACTION_TOKEN`, `CHECK_RESOURCE_READ_TOKEN` and `CHECK_RESOURCE_CLEANUP_TOKEN`, explicitly listed in `settings.envNames` and supplied outside the manifest. Hosted personal scripts receive `CHECK_*` values only from their project environment's secrets (`waitcher secret set`), never from the server's environment; do not work around that boundary. Do not log credentials or response bodies, and do not promise complete trace masking for arbitrary custom environment values. Local success does not establish hosted admission or isolation.\n\n## Scenario evidence\n\nInspect readable scenario evidence with `waitcher run scenarios --id RUN_ID`, or use `waitcher run scenarios --directory PRIVATE_RUN_DIR` for account-free local inspection without a server/runtime. Add `--json` for the exact shared report DTO. Do not combine selectors or pass `--server` for local inspection. Inspection of failed/error runs succeeds; execution exit codes remain unchanged. Keep authoritative run status separate from evidence availability: empty valid reports verify no business outcome, and pending/not-recorded/expired/invalid reports cannot establish a pass. Local evidence is checked against its recorded inventory and checksum; never edit it to manufacture a successful outcome.\n\n## AI product endpoints\n\nFor a single AI product endpoint, prefer a declarative `type: \"ai\"` fixture over an E2E script. Run `monitor init --type ai --target https://product.example/ai --file ai.json`, replace the sample request and response checks with the product contract, then `monitor validate --file ai.json`. JSON-pointer assertions support exact equality, type, existence and literal case-sensitive contains/not-contains/contains-any/contains-all checks; an optional bounded response schema checks structure. `run local --file ai.json` uses the same one-POST adapter without an account, model connection, provider key or E2E runtime. It only reaches public HTTPS endpoints and supports optional verified `httpAuth` references as described below; arbitrary custom headers and account-session inheritance are forbidden. Inspect the structured per-assertion report and distinguish transport coverage errors from product assertion failures. Applying the same file to hosted monitoring requires `features.aiEndpoints`; personal admission also requires a currently verified `httpAuth` binding; keep it paused unless scheduling is authorized. This verifies a chosen fixture, not general agent quality or a calibrated semantic judge.\n\nFor a small set of representative prompts against the same endpoint, use `aiEndpoint.adapter: \"json-http-suite-v1\"` and `cases` with 1\u20135 objects containing a stable unique `id`, readable `name`, positive `revision` (default 1), literal JSON-object `fixture`, and assertions and/or response schema. The suite `invocationBudget` equals its case count and is filled in when omitted. Validate offline and run the unchanged manifest locally before applying it; hosted capability `features.aiEndpointSuites` must be available. Cases run serially under one total monitor timeout. Assertion failures permit later cases; a transport/deadline error stops them as `not-run`. Inspect every case and coverage summary, not only the overall status. The controller reserves the full case count before any hosted request, and partial/uncertain runs retain that conservative allowance. Reported attempted requests can therefore be fewer than charged units. Deterministic suites do not provide semantic grading; do not describe text matching as semantic correctness. Single fixtures and each suite case can opt into literal variables with variables:{name:\"string\"} and exact {{name}} placeholders inside fixture string values. Without variables, braces remain literal. Use at most 16 names, ASCII letter followed by letters/digits/underscores (64 characters); prototype-related names are refused. Each value fits 4 KiB UTF-8, maps and rendered fixtures 16 KiB and complete configurations 64 KiB. No expressions, environment lookup, key/URL/assertion/rubric interpolation, matrix expansion or recursive replacement is supported. Missing/malformed placeholders reject before requests. Use non-secret data. Validate locally and preview before applying: exports keep authored maps while enqueue freezes rendered literal requests. Release comparisons use effective rendered bodies, so a changed variable value can be a changed policy even with the same case revision.\n\nFor optional semantic endpoint grading, use `json-http-graded-suite-v1`, portable schemaVersion 2 and explicit context (even the default project/environment). Set the top-level `judge` connectionId/configurationRevision/model/budget and add a rubric to each selected case: stable id/revision, criteria, outputPath, threshold and optional reference examples. Keep target credentials separate from judge keys. Hosted use requires `features.endpointJudges`; local use accepts the same private `--connections-file` map without an account, UI or E2E runtime. Only the selected output and rubric criteria/examples reach the judge. Known echoed managed product keys are refused before grading. Inspect score, verdict, rubric hash and private model-usage.json: malformed/unavailable/unknown/over-budget grading is inconclusive coverage and cannot pass or recover a product incident. There are no retries or fallback models. Every report currently marks calibration unverified; labelled reference examples do not prove accuracy. Keep calibration, pricing and release acceptance distinct from a controlled protocol pass.\n\nTo measure a rubric against labelled examples, use `monitor calibrate --id ID --file REQUEST_JSON` for a saved hosted monitor, then `monitor calibrations --id ID` or `monitor calibration --id ID --calibration-id ID` to inspect retained measurements. The request contains `caseId`, `dataset` and optional `repeats`. For account-free local measurement, use `run calibrate --file MONITOR --case-id CASE --dataset DATASET --connections-file PRIVATE_MAP`; `--dataset` is the dataset object alone. Use 2\u20134 fictional labelled outputs and 1\u20133 repeats, within the saved judge call/token budget and a total 30-second ceiling. Calibration calls only the judge, not the product endpoint, and creates no health runs, incidents or recovery. Keep known keys out of dataset/rubric identifiers, object keys and content as well as prompts. Inspect agreement over valid evaluated decisions, disagreement, repeat instability and technical coverage errors separately. A valid expected inconclusive can agree; a provider error cannot. Inspect private model usage for actual reservations. Exit 4 means disagreement, instability or coverage failure; never erase those results to obtain a green check. A small successful sample applies only to its exact dataset/rubric/model identity and does not establish general accuracy or automatically change the monitor\u2019s unverified calibration label.\n\nFor release regressions, use `project compare --id PROJECT_ID --deployment-id DEPLOYMENT_ID` and follow the opaque `next` cursor with `--before`. AI rows include case-level comparisons from frozen queued definitions and retained structured reports. Inspect each case classification and compatibility reasons. A different fixture, assertion, rubric, judge model or policy identity cannot establish a product regression; do not compare numeric scores across changed policies. Missing/invalid reports and unexecuted cases are coverage gaps. Follow the owned run references for evidence. Last passing and first failure are useful only for the matching case policy; a pass from another case or rubric is not a reproduction baseline. Display-name changes and JSON object key order do not change the evaluation policy. Comparison is read-only and never schedules another paid request.\n\n## AI steps in browser and API scripts\n\nFor personal AI-assisted browser journeys, require both `features.ai` and `features.isolatedAi` alongside script admission. Keep the `ai` model connection binding optional; deterministic scripts need no model or provider key. Hosted personal runs always use server-owned isolated policy and an explicitly model-capable isolated worker. An older worker, withdrawn capability or missing connection is a coverage failure, never a reason to switch accounts or execute through a trusted lane. Use the same version-2 manifest locally with a private connection map before applying it paused. Only attempt-scoped broker authority enters the disposable runtime; upstream keys stay controller-side. Screenshots, page content and prompts used by AI steps reach the selected provider. Inspect native assertions plus authoritative model usage/error evidence; catching an SDK error does not make a run healthy. No browser login-state import or stored application credentials are supported by this capability. API scripts have no built-in screen observation engine: do not call screen-based agent.assert/waitFor/extract on API data. In manifest mode, import {assertGrade, grade} from \"#waitcher/ai\" and pass {data: selectedJsonOrText, rubric: criteria, threshold: 0.8}. The optional judgeModel grades the selected data, otherwise model is used. Keep expected facts in versioned fixtures; send no credentials or unnecessary response fields. Selected JSON is limited to 8 KiB and rubric to 2 KiB. grade returns {verdict,score}; assertGrade throws on non-pass. Any failure, valid inconclusive or technical grading error remains authoritative even when caught or ignored. Inspect private waitcher-data-grades.json alongside model usage and the native report. No retries/fallbacks occur. The alias survives monitor build and is supplied by run local --file and hosted script execution; standalone --project needs its own integration. Deterministic scripts need no binding; fixed endpoint fixtures can use the declarative graded adapter instead.\n\nFor an existing project's custom model setup, use `--project`. A schemaVersion 2 manifest with an `ai` binding can also run unchanged locally using `--connections-file /private/connections.json`, without login. The private map has schemaVersion 1 and a connections array; each record contains id, configurationRevision, provider openrouter (the only provider for AI scripts; anthropic connections serve hosted agent checks only), projectId, environmentId, allowed models and credentialFile. Credential paths resolve relative to the map. IDs/revisions/models and explicit manifest scope must match. Keep both map and key files private (chmod 600); inline keys, provider URLs and symlinks are refused. The selected runtime also needs ai@7.0.107. The complete CLI package ships model-client.mjs and notices; copying only cli.mjs is insufficient for bound AI execution.\n\nThe local manifest runner keeps the provider key in its parent and passes a temporary loopback grant to the test. It uses the hosted transport and per-run budget/outcome rules, but no hosted account/day ledger. Read model-usage.json as well as the native report: caught provider/budget failures may leave a native passed test while Waitcher correctly records error. Unknown usage stays reserved, SDK retries count separately, and local success does not verify hosted enablement or key freshness. Provider keys are not forwarded to the child, and literal temporary broker tokens are redacted from normal text evidence; trusted local code can read its filesystem and is not a sandbox. Traces default on, video stays opt-in.\n\nIn the project's `e2e.config.ts`, construct the chosen provider's AI SDK model under `agents.default.model`, following the installed framework's types. The provider reads its local key; a key alone does not configure a model. Never copy a user's provider key into a monitor manifest or use an operator's account key.\n\nMix exact assertions with selected `agent.act`, `agent.assert`, `agent.waitFor` and schema-bound `agent.extract` calls. AI operations may transmit screen content to the provider and incur cost; preserve the user's provider/call authorization. Step-level `maxModelCalls` is not a whole-run spending limit. Hosted connection/broker/budget support is separate and must be discovered from actual capabilities rather than assumed from a local run.\n\n## Protected product requests\n\nFor protected product operations, use monitor init --template protected-agent-outcome --request-policy-file POLICY.json --project-id UUID --environment-id UUID --file monitor.json. The public policy contains connections with id, canonical HTTPS origin and httpAuth references (targetId, credentialId, credentialRevision); operations with id, connection, method, path, optional static body, responsePointers and maxCalls; and budget.calls. Paths are fixed absolute paths with at most one whole {resourceId} UUID segment. Static JSON bodies may use only exact string leaves {{resourceId}}. Callers cannot choose URLs, methods, headers, bodies, query parameters or UUIDs. GET permits at most three calls, POST and DELETE one; DELETE requires the UUID path and POST must use the run identity. Limits are four connections, eight operations and eight total calls.\n\nThe protected starter requires submit POST, observe GET (three reads), cleanup DELETE, a five-call budget and response pointers /id, /correlationId, /title, /completed. Configure the static submission body to create a note with the parent-generated UUID in both id and correlationId, title Waitcher outcome check, and completed true. The optional #waitcher/requests SDK exposes requestOperation and requestResourceId. Responses contain status and a data map keyed by configured JSON pointers. The script never trusts the agent reply as proof of resulting state, never retries the action, and only cleans up independently proven run-owned state.\n\nLocal execution uses the existing --http-credentials-file private map: schemaVersion 1 and credentials entries with targetId, credentialId, credentialRevision, origin, header and credentialFile. Header is Authorization or X-Api-Key; its raw value stays in a separate private regular file. Map and key files require mode600 and exact reference/revision/origin matches. Keys stay in the CLI parent, never script, manifest, CLI arguments or custom environment. No account, app or AI provider is required locally. Keep request-runtime.mjs with the complete CLI package. For source projects use scriptFile, monitor build, then run local --file; standalone project mode does not inject the protected helper. Hosted use requires explicit capability and isolated execution even for administrators. Combined AI or browser-state bindings need their independent authority. Inspect request-usage.json, scenario and native reports. Caught budget errors, uncertain dispatch and unfinished calls cannot establish a healthy result; never replay mutations automatically.\n\nScenario request associations are optional recorded evidence. The request helper automatically records each issued request UUID on its originating phase. In a verify phase, call `scenario.referenceRequest(response.requestId)` for a request from an earlier completed observe phase in the same scenario; use the validated response envelope UUID, never an ID from response data. The protected starter references its last independent observation before asserting the business state. Read associations with `run scenarios`; `run diagnose` joins them to this run's request records and labels each ID `matched`, `not-found` or `unavailable`. These are script-reported phase associations. A matching controller row proves accounting correspondence, not the correctness of a phase or business outcome. Local matches remain local helper reports. Older evidence without association fields is not recorded, rather than an empty verified list. UNKNOWN requests remain charged and incomplete; no association authorizes mutation replay.\n";
61434
61518
 
61435
61519
  // ../../skills/waitcher/references/deploy.md
61436
- var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts follow their plan: checks every 30 minutes on starter, 5 on pro and 1 on business at the shortest; script monitors have a count, a shortest interval and runs a day that the running schedules must fit together (starter: one, every 2 hours or slower). Read `limits.minInterval` and `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e@0.21.1`, `@e2e-dev/web@0.15.1` (browser) and `esbuild@0.28.2` installed exactly; `waitcher runtime install` sets them up and later upgrades them (ask before `--yes`). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `config validate --env NAME --verify [--key KEY]` runs that environment\'s script entries locally without an account. `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`. On a personal account only the first monitor\'s smoke starts (one manual run per 10 minutes); the rest are `skipped`, which is not a failure.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so export the same `CHECK_*` variables locally (never in files) or skip `--verify` for that monitor and rely on `--smoke`.\n\nListed values of at least 6 characters appear as `<secret:CHECK_NAME>` in reports, traces and logs; screenshots, video and transformed values are not masked. For a password or token typed into a page, prefer `fill(secrets.get("CHECK_NAME"))` (`import { secrets } from "e2e"`) over `process.env`: the value stays out of the test code and the run refuses `app.screenshot()` after that fill, so take screenshots before it or drop them. Read `process.env.CHECK_NAME` for values the script sends itself, such as API headers. Never log a value or assert on it.\n\n## Adopting existing monitors\n\nWhen a plan warns `ADOPTION_CANDIDATE`, an existing unmanaged monitor looks like the entry. Show it to the user (`waitcher monitor get --id ID`). If it is the same check, plan and apply with `--adopt KEY=MONITOR_ID`: it keeps its ID, history and pause state and takes the file\'s definition. Otherwise ignore the warning; apply creates a separate monitor.\n\n## Rollback\n\n`waitcher deploy list --project-id ID` shows deploys; `restorable:true` marks the latest 10 per environment. `waitcher deploy rollback --id DEPLOY_ID --dry-run` shows the plan, then run it with `--based-on`. Secrets are not rolled back. Tell the user to revert the repository too, or the next apply reintroduces the change.\n\n## CI\n\n`waitcher ci init [--env production] [--file waitcher.json]` writes `.github/workflows/waitcher.yml`: plan on pull requests, apply on pushes to the main branch. It installs the CLI from the server with a checksum and signs in with the `WAITCHER_TOKEN` repository secret. Create that token with read and write permissions (add run for `--smoke`) and `"projectId"` set to the project\'s ID (from `deploy plan`\'s `project.id`) using `waitcher token create`, so CI cannot touch other projects, and let the user store it with `gh secret set WAITCHER_TOKEN`. Set the `WAITCHER_SERVER` repository variable for a non-default server.\n';
61520
+ var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts follow their plan: checks every 30 minutes on starter, 5 on pro and 1 on business at the shortest; script monitors have a count, a shortest interval and runs a day that the running schedules must fit together (starter: one, every 2 hours or slower). Read `limits.minInterval` and `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e@0.21.1`, `@e2e-dev/web@0.15.1` (browser) and `esbuild@0.28.2` installed exactly; `waitcher runtime install` sets them up and later upgrades them (ask before `--yes`). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `config validate --env NAME --verify [--key KEY]` runs that environment\'s script entries locally without an account. `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`. On a personal account only the first monitor\'s smoke starts (one manual run per 10 minutes); the rest are `skipped`, which is not a failure.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so export the same `CHECK_*` variables locally (never in files) or skip `--verify` for that monitor and rely on `--smoke`.\n\nListed values of at least 6 characters appear as `<secret:CHECK_NAME>` in reports, traces and logs; screenshots, video and transformed values are not masked. For a password or token typed into a page, prefer `fill(secrets.get("CHECK_NAME"))` (`import { secrets } from "e2e"`) over `process.env`: the value stays out of the test code and the run refuses `app.screenshot()` after that fill, so take screenshots before it or drop them. Read `process.env.CHECK_NAME` for values the script sends itself, such as API headers. Never log a value or assert on it.\n\n## Adopting existing monitors\n\nWhen a plan warns `ADOPTION_CANDIDATE`, an existing unmanaged monitor looks like the entry. Show it to the user (`waitcher monitor get --id ID`). If it is the same check, plan and apply with `--adopt KEY=MONITOR_ID`: it keeps its ID, history and pause state and takes the file\'s definition. Otherwise ignore the warning; apply creates a separate monitor.\n\n## Rollback\n\n`waitcher deploy list --project-id ID` shows deploys; `restorable:true` marks the latest 10 per environment. `waitcher deploy rollback --id DEPLOY_ID --dry-run` shows the plan, then run it with `--based-on`. Secrets are not rolled back. Tell the user to revert the repository too, or the next apply reintroduces the change.\n\n## CI\n\n`waitcher ci init [--env production] [--file waitcher.json]` writes `.github/workflows/waitcher.yml`: plan on pull requests, apply on pushes to the main branch. It installs the CLI from the server with a checksum and signs in with the `WAITCHER_TOKEN` repository secret. Create that token with read and write permissions (add run for `--smoke`) and `"projectId"` set to the project\'s ID (from `deploy plan`\'s `project.id`) using `waitcher token create`, so CI cannot touch other projects, and let the user store it with `gh secret set WAITCHER_TOKEN`. Signed in with a project token, read `authorization.projectName` from `waitcher auth status` and use it as `waitcher.json`\'s `project` (`config init --project-name NAME`); such a token changes monitors only through `deploy apply`, so do not try `monitor apply`. Set the `WAITCHER_SERVER` repository variable for a non-default server.\n';
61437
61521
 
61438
61522
  // ../../skills/waitcher/references/diagnosis.md
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, text2] of Object.entries(references))
61483
- await writeFile9(join13(directory, "references", name5), text2);
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((text2) => JSON.parse(text2)).catch(() => null);
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(text2) {
62029
- let token = text2.trim();
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 text2;
62219
+ let text3;
62136
62220
  try {
62137
62221
  await privatePath(dirname16(path2), true);
62138
- text2 = await readPrivate(path2);
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(text2);
62233
+ session = JSON.parse(text3);
62150
62234
  } catch {
62151
62235
  throw new Error("Saved session is unreadable. Run auth login again.");
62152
62236
  }
@@ -62469,7 +62553,8 @@ Authentication
62469
62553
  auth login [--timeout 180] Browser OAuth with Clerk and PKCE
62470
62554
  auth login --password-stdin Read the admin password from stdin
62471
62555
  auth login --password-file PATH Read a private file (chmod 600)
62472
- auth status Verify the current saved session
62556
+ auth status Verify the current saved session; a project token
62557
+ shows authorization.projectName for waitcher.json
62473
62558
  auth logout Revoke OAuth/automation token and remove local session
62474
62559
  auth login --token-file PATH Use a private automation-token file without a browser
62475
62560
  auth login --token-stdin Read an automation token from stdin
@@ -62620,6 +62705,7 @@ Monitor configuration
62620
62705
  Agent checks: an api definition or waitcher.json entry with an "agent" block runs Claude
62621
62706
  Code on its task first, then the script verifies the outcome, on an anthropic
62622
62707
  connection (features.agentChecks; https://waitcher.dev/docs/agent-checks.md).
62708
+ A verifier may sign in with a project token: it lists and reads that project's monitors.
62623
62709
  monitor validate --file PATH Validate locally, including scriptFile
62624
62710
  monitor build --file PATH --output NEW_DIR [--project PROJECT]
62625
62711
  Bundle project helpers into one portable monitor script
@@ -62637,7 +62723,7 @@ Monitor configuration
62637
62723
  Executions and reports
62638
62724
  run scenarios --id RUN_ID [--json]
62639
62725
  run scenarios --directory PRIVATE_RUN_DIR [--json]
62640
- run diagnose --id RUN_ID [--json]
62726
+ run diagnose --id RUN_ID [--json] An agent check leads with what the agent did
62641
62727
  run diagnose --directory PRIVATE_RUN_DIR [--json]
62642
62728
  run reproduce --id RUN_ID --output NEW_DIRECTORY
62643
62729
  run local --file MONITOR.json [--runtime PROJECT] [--output DIR] [--video]
@@ -62647,7 +62733,8 @@ Executions and reports
62647
62733
  JSON/report/logs/traces; video opt-in, fresh output per run
62648
62734
  Project output must stay inside the E2E project
62649
62735
  run start --id MONITOR_ID [--wait [--brief]] [--timeout 60] [--update-baselines]
62650
- A finished run prints status, duration and message first;
62736
+ A finished run prints status, duration, message and a
62737
+ report link (SERVER/app#run/RUN_ID) first;
62651
62738
  --brief leaves out the execution record
62652
62739
  --update-baselines (visual checks, browser tests; write
62653
62740
  access): the run adopts what it captures as the approved
@@ -63000,7 +63087,7 @@ ${exitCodes}
63000
63087
  // package.json
63001
63088
  var package_default = {
63002
63089
  name: "@waitcher/cli",
63003
- version: "0.2.21",
63090
+ version: "0.2.23",
63004
63091
  description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API, browser and visual monitors from waitcher.json.",
63005
63092
  license: "SEE LICENSE IN LICENSE.txt",
63006
63093
  author: "S\u0142awomir Radzymi\u0144ski",
@@ -63045,7 +63132,7 @@ var package_default = {
63045
63132
  };
63046
63133
 
63047
63134
  // src/main.ts
63048
- var list = (text2) => (text2 ?? "").split(",").map((x) => x.trim()).filter(Boolean);
63135
+ var list = (text3) => (text3 ?? "").split(",").map((x) => x.trim()).filter(Boolean);
63049
63136
  var issues = (all) => all.map((i) => `${i.path.join(".")}: ${i.message}`).join("\n");
63050
63137
  var controller = new AbortController();
63051
63138
  process.once("SIGINT", () => controller.abort());
@@ -63116,16 +63203,16 @@ async function passwordFromStdin(maxBytes = 2048) {
63116
63203
  usage2(
63117
63204
  "Pipe the password to stdin, or use --password-file PATH. Passwords are not accepted as command arguments."
63118
63205
  );
63119
- let text2 = "";
63206
+ let text3 = "";
63120
63207
  const cancel = () => process.stdin.destroy(new Error("Interrupted."));
63121
63208
  controller.signal.addEventListener("abort", cancel, { once: true });
63122
63209
  try {
63123
63210
  for await (const chunk of process.stdin) {
63124
- text2 += chunk;
63125
- if (Buffer.byteLength(text2) > maxBytes)
63211
+ text3 += chunk;
63212
+ if (Buffer.byteLength(text3) > maxBytes)
63126
63213
  usage2("Password input is too long.");
63127
63214
  }
63128
- return text2.replace(/[\r\n]+$/, "");
63215
+ return text3.replace(/[\r\n]+$/, "");
63129
63216
  } finally {
63130
63217
  controller.signal.removeEventListener("abort", cancel);
63131
63218
  }
@@ -64867,12 +64954,12 @@ async function main() {
64867
64954
  usage2(
64868
64955
  "Provide --file PATH with the complete configuration and expectedRevision for edits."
64869
64956
  );
64870
- const text2 = await readFile11(v.file, "utf8");
64871
- if (Buffer.byteLength(text2) > 16e3)
64957
+ const text3 = await readFile11(v.file, "utf8");
64958
+ if (Buffer.byteLength(text3) > 16e3)
64872
64959
  usage2("Project configuration exceeds 16 KB");
64873
64960
  let body2;
64874
64961
  try {
64875
- body2 = JSON.parse(text2);
64962
+ body2 = JSON.parse(text3);
64876
64963
  } catch {
64877
64964
  usage2("Configuration must be JSON");
64878
64965
  }
@@ -65117,10 +65204,10 @@ async function main() {
65117
65204
  if (!v.file) usage2("Provide --file PATH for the configuration.");
65118
65205
  let input2;
65119
65206
  try {
65120
- const text2 = await readFile11(v.file, "utf8");
65121
- if (Buffer.byteLength(text2) > 96e3)
65207
+ const text3 = await readFile11(v.file, "utf8");
65208
+ if (Buffer.byteLength(text3) > 96e3)
65122
65209
  usage2("Configuration exceeds 96 KB.");
65123
- input2 = JSON.parse(text2);
65210
+ input2 = JSON.parse(text3);
65124
65211
  } catch {
65125
65212
  usage2("Could not read valid JSON configuration.");
65126
65213
  }
@@ -65378,7 +65465,24 @@ async function main() {
65378
65465
  requestedId
65379
65466
  );
65380
65467
  if (!v.json) {
65381
- process.stdout.write(formatRunDiagnosis(result2));
65468
+ const run2 = await api(`runs/${id3(v.id)}`);
65469
+ let agent;
65470
+ if (run2.definition?.agent) {
65471
+ const read = async (path2) => {
65472
+ const file2 = run2.artifactManifest?.find(
65473
+ (a) => a.path === path2 && a.status === "available"
65474
+ );
65475
+ return file2 ? await readVerifiedJson(server, requestedId, file2, session, signal).catch(
65476
+ () => null
65477
+ ) : null;
65478
+ };
65479
+ agent = formatAgentReport(
65480
+ await read(".e2e/agent-summary.json"),
65481
+ await read(".e2e/agent-gate.json"),
65482
+ run2.status
65483
+ );
65484
+ }
65485
+ process.stdout.write(formatRunDiagnosis(result2, agent));
65382
65486
  return;
65383
65487
  }
65384
65488
  } else if (command === "run reproduce") {
@@ -65449,6 +65553,8 @@ async function main() {
65449
65553
  status: run2.status,
65450
65554
  duration: run2.duration,
65451
65555
  message: run2.message,
65556
+ // The run's report in the web app, to open or share.
65557
+ report: `${server}/app#run/${run2.id}`,
65452
65558
  ...v.brief ? {} : { execution: run2 }
65453
65559
  };
65454
65560
  exitCode = run2.status === "passed" ? 0 : 4;
@@ -65552,10 +65658,10 @@ async function main() {
65552
65658
  if (!v.file) usage2("Provide --file PATH for the status page.");
65553
65659
  let input2;
65554
65660
  try {
65555
- const text2 = await readFile11(v.file, "utf8");
65556
- if (Buffer.byteLength(text2) > 96e3)
65661
+ const text3 = await readFile11(v.file, "utf8");
65662
+ if (Buffer.byteLength(text3) > 96e3)
65557
65663
  usage2("Configuration exceeds 96 KB.");
65558
- input2 = JSON.parse(text2);
65664
+ input2 = JSON.parse(text3);
65559
65665
  } catch {
65560
65666
  usage2("Could not read valid JSON configuration.");
65561
65667
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waitcher/cli",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
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",