@waitcher/cli 0.2.29 → 0.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -2236,7 +2236,7 @@ var require_util = __commonJS({
2236
2236
  function isBuffer(buffer) {
2237
2237
  return buffer instanceof Uint8Array || Buffer.isBuffer(buffer);
2238
2238
  }
2239
- function assertRequestHandler(handler, method, upgrade) {
2239
+ function assertRequestHandler(handler, method, upgrade2) {
2240
2240
  if (!handler || typeof handler !== "object") {
2241
2241
  throw new InvalidArgumentError("handler must be an object");
2242
2242
  }
@@ -2252,7 +2252,7 @@ var require_util = __commonJS({
2252
2252
  if (typeof handler.onRequestSent !== "function" && handler.onRequestSent !== void 0) {
2253
2253
  throw new InvalidArgumentError("invalid onRequestSent method");
2254
2254
  }
2255
- if (upgrade || method === "CONNECT") {
2255
+ if (upgrade2 || method === "CONNECT") {
2256
2256
  if (typeof handler.onRequestUpgrade !== "function") {
2257
2257
  throw new InvalidArgumentError("invalid onRequestUpgrade method");
2258
2258
  }
@@ -5384,7 +5384,7 @@ var require_request = __commonJS({
5384
5384
  query,
5385
5385
  idempotent,
5386
5386
  blocking,
5387
- upgrade,
5387
+ upgrade: upgrade2,
5388
5388
  headersTimeout,
5389
5389
  bodyTimeout,
5390
5390
  reset,
@@ -5406,10 +5406,10 @@ var require_request = __commonJS({
5406
5406
  } else if (normalizedMethodRecords[method] === void 0 && !isValidHTTPToken(method)) {
5407
5407
  throw new InvalidArgumentError("invalid request method");
5408
5408
  }
5409
- if (upgrade && typeof upgrade !== "string") {
5409
+ if (upgrade2 && typeof upgrade2 !== "string") {
5410
5410
  throw new InvalidArgumentError("upgrade must be a string");
5411
5411
  }
5412
- if (upgrade && !isValidHeaderValue(upgrade)) {
5412
+ if (upgrade2 && !isValidHeaderValue(upgrade2)) {
5413
5413
  throw new InvalidArgumentError("invalid upgrade header");
5414
5414
  }
5415
5415
  if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) {
@@ -5477,7 +5477,7 @@ var require_request = __commonJS({
5477
5477
  }
5478
5478
  this.completed = false;
5479
5479
  this.aborted = false;
5480
- this.upgrade = upgrade || null;
5480
+ this.upgrade = upgrade2 || null;
5481
5481
  this.path = query ? serializePathWithQuery(path2, query) : path2;
5482
5482
  this.origin = origin;
5483
5483
  this.protocol = getProtocolFromUrlString(origin);
@@ -5513,7 +5513,7 @@ var require_request = __commonJS({
5513
5513
  } else if (headers != null) {
5514
5514
  throw new InvalidArgumentError("headers must be an object or an array");
5515
5515
  }
5516
- assertRequestHandler(handler, method, upgrade);
5516
+ assertRequestHandler(handler, method, upgrade2);
5517
5517
  this.servername = servername || getServerName(this.host) || null;
5518
5518
  this[kHandler] = handler;
5519
5519
  if (channels.create.hasSubscribers) {
@@ -9127,7 +9127,7 @@ var require_parser_h1 = __commonJS({
9127
9127
  client: client2,
9128
9128
  socket: socket2,
9129
9129
  statusCode,
9130
- upgrade,
9130
+ upgrade: upgrade2,
9131
9131
  trailers,
9132
9132
  contentLength,
9133
9133
  bytesRead,
@@ -9137,7 +9137,7 @@ var require_parser_h1 = __commonJS({
9137
9137
  if (socket2.destroyed && (!statusCode || shouldKeepAlive)) {
9138
9138
  return this.fail(milo.ERROR_CALLBACK_ERROR, "Other side closed");
9139
9139
  }
9140
- if (upgrade) {
9140
+ if (upgrade2) {
9141
9141
  this.pauseParser();
9142
9142
  return;
9143
9143
  }
@@ -9410,8 +9410,8 @@ var require_parser_h1 = __commonJS({
9410
9410
  this.errored = true;
9411
9411
  }
9412
9412
  onUpgrade(head) {
9413
- const { upgrade, client, socket, headers, statusCode } = this;
9414
- assert2(upgrade);
9413
+ const { upgrade: upgrade2, client, socket, headers, statusCode } = this;
9414
+ assert2(upgrade2);
9415
9415
  assert2(client[kSocket] === socket);
9416
9416
  assert2(!socket.destroyed);
9417
9417
  assert2(!this.paused);
@@ -10307,9 +10307,9 @@ var require_client_h1 = __commonJS({
10307
10307
  * @param {0|1} shouldKeepAlive
10308
10308
  * @returns {number}
10309
10309
  */
10310
- wasm_on_headers_complete: (p, statusCode, upgrade, shouldKeepAlive) => {
10310
+ wasm_on_headers_complete: (p, statusCode, upgrade2, shouldKeepAlive) => {
10311
10311
  assert2(currentParser.ptr === p);
10312
- return currentParser.onHeadersComplete(statusCode, upgrade === 1, shouldKeepAlive === 1);
10312
+ return currentParser.onHeadersComplete(statusCode, upgrade2 === 1, shouldKeepAlive === 1);
10313
10313
  },
10314
10314
  /**
10315
10315
  * @param {number} p
@@ -10612,8 +10612,8 @@ var require_client_h1 = __commonJS({
10612
10612
  * @param {Buffer} head
10613
10613
  */
10614
10614
  onUpgrade(head) {
10615
- const { upgrade, client, socket, headers, statusCode, statusText } = this;
10616
- assert2(upgrade);
10615
+ const { upgrade: upgrade2, client, socket, headers, statusCode, statusText } = this;
10616
+ assert2(upgrade2);
10617
10617
  assert2(client[kSocket] === socket);
10618
10618
  assert2(!socket.destroyed);
10619
10619
  assert2(!this.paused);
@@ -10650,7 +10650,7 @@ var require_client_h1 = __commonJS({
10650
10650
  * @param {boolean} shouldKeepAlive
10651
10651
  * @returns {number}
10652
10652
  */
10653
- onHeadersComplete(statusCode, upgrade, shouldKeepAlive) {
10653
+ onHeadersComplete(statusCode, upgrade2, shouldKeepAlive) {
10654
10654
  const { client, socket, headers, statusText } = this;
10655
10655
  if (socket.destroyed) {
10656
10656
  return -1;
@@ -10669,7 +10669,7 @@ var require_client_h1 = __commonJS({
10669
10669
  util.destroy(socket, new SocketError("bad response", util.getSocketInfo(socket)));
10670
10670
  return -1;
10671
10671
  }
10672
- if (upgrade && !request2.upgrade) {
10672
+ if (upgrade2 && !request2.upgrade) {
10673
10673
  util.destroy(socket, new SocketError("bad upgrade", util.getSocketInfo(socket)));
10674
10674
  return -1;
10675
10675
  }
@@ -10696,7 +10696,7 @@ var require_client_h1 = __commonJS({
10696
10696
  this.upgrade = true;
10697
10697
  return 2;
10698
10698
  }
10699
- if (upgrade) {
10699
+ if (upgrade2) {
10700
10700
  assert2(client[kRunning] === 1);
10701
10701
  this.upgrade = true;
10702
10702
  return 2;
@@ -10767,11 +10767,11 @@ var require_client_h1 = __commonJS({
10767
10767
  * @returns {number}
10768
10768
  */
10769
10769
  onMessageComplete() {
10770
- const { client, socket, statusCode, upgrade, headers, contentLength, bytesRead, shouldKeepAlive } = this;
10770
+ const { client, socket, statusCode, upgrade: upgrade2, headers, contentLength, bytesRead, shouldKeepAlive } = this;
10771
10771
  if (socket.destroyed && (!statusCode || shouldKeepAlive)) {
10772
10772
  return -1;
10773
10773
  }
10774
- if (upgrade) {
10774
+ if (upgrade2) {
10775
10775
  return 0;
10776
10776
  }
10777
10777
  assert2(statusCode >= 100);
@@ -11058,7 +11058,7 @@ var require_client_h1 = __commonJS({
11058
11058
  }
11059
11059
  }
11060
11060
  function writeH1(client, request2) {
11061
- const { method, path: path2, host, upgrade, blocking, reset } = request2;
11061
+ const { method, path: path2, host, upgrade: upgrade2, blocking, reset } = request2;
11062
11062
  let { body: body2, headers, contentLength } = request2;
11063
11063
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
11064
11064
  if (util.isFormDataLike(body2)) {
@@ -11121,7 +11121,7 @@ var require_client_h1 = __commonJS({
11121
11121
  if (method === "HEAD") {
11122
11122
  socket[kReset] = true;
11123
11123
  }
11124
- if (upgrade || method === "CONNECT") {
11124
+ if (upgrade2 || method === "CONNECT") {
11125
11125
  socket[kReset] = true;
11126
11126
  }
11127
11127
  if (reset != null) {
@@ -11142,9 +11142,9 @@ var require_client_h1 = __commonJS({
11142
11142
  } else {
11143
11143
  header += client[kHostHeader];
11144
11144
  }
11145
- if (upgrade) {
11145
+ if (upgrade2) {
11146
11146
  header += `connection: upgrade\r
11147
- upgrade: ${upgrade}\r
11147
+ upgrade: ${upgrade2}\r
11148
11148
  `;
11149
11149
  } else if (client[kPipelining] && !socket[kReset]) {
11150
11150
  header += "connection: keep-alive\r\n";
@@ -12296,9 +12296,9 @@ var require_client_h2 = __commonJS({
12296
12296
  const headersTimeout = request2.headersTimeout ?? client[kHeadersTimeout];
12297
12297
  const bodyTimeout = request2.bodyTimeout ?? client[kBodyTimeout];
12298
12298
  const session = client[kHTTP2Session];
12299
- const { method, path: path2, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request2;
12300
- if (upgrade != null && upgrade !== "websocket") {
12301
- util.errorRequest(client, request2, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
12299
+ const { method, path: path2, host, upgrade: upgrade2, expectContinue, signal, protocol, headers: reqHeaders } = request2;
12300
+ if (upgrade2 != null && upgrade2 !== "websocket") {
12301
+ util.errorRequest(client, request2, new InvalidArgumentError(`Custom upgrade "${upgrade2}" not supported over HTTP/2`));
12302
12302
  return false;
12303
12303
  }
12304
12304
  const headers = buildRequestHeaders(reqHeaders);
@@ -12352,9 +12352,9 @@ var require_client_h2 = __commonJS({
12352
12352
  if (request2.aborted) {
12353
12353
  return false;
12354
12354
  }
12355
- if (upgrade || method === "CONNECT") {
12355
+ if (upgrade2 || method === "CONNECT") {
12356
12356
  refH2Session(session);
12357
- if (upgrade === "websocket") {
12357
+ if (upgrade2 === "websocket") {
12358
12358
  if (session[kEnableConnectProtocol] === false) {
12359
12359
  util.errorRequest(client, request2, new InformationalError("HTTP/2: Extended CONNECT protocol not supported by server"));
12360
12360
  unrefH2Session(session);
@@ -17519,10 +17519,10 @@ var require_api_upgrade = __commonJS({
17519
17519
  }
17520
17520
  }
17521
17521
  };
17522
- function upgrade(opts, callback) {
17522
+ function upgrade2(opts, callback) {
17523
17523
  if (callback === void 0) {
17524
17524
  return new Promise((resolve18, reject) => {
17525
- upgrade.call(this, opts, (err, data) => {
17525
+ upgrade2.call(this, opts, (err, data) => {
17526
17526
  return err ? reject(err) : resolve18(data);
17527
17527
  });
17528
17528
  });
@@ -17543,7 +17543,7 @@ var require_api_upgrade = __commonJS({
17543
17543
  queueMicrotask(() => callback(err, { opaque }));
17544
17544
  }
17545
17545
  }
17546
- module.exports = upgrade;
17546
+ module.exports = upgrade2;
17547
17547
  }
17548
17548
  });
17549
17549
 
@@ -19103,8 +19103,8 @@ var require_snapshot_utils = __commonJS({
19103
19103
  var require_snapshot_recorder = __commonJS({
19104
19104
  "../../node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
19105
19105
  "use strict";
19106
- var { writeFile: writeFile10, readFile: readFile12, mkdir: mkdir11 } = __require("node:fs/promises");
19107
- var { dirname: dirname18, resolve: resolve18 } = __require("node:path");
19106
+ var { writeFile: writeFile10, readFile: readFile13, mkdir: mkdir11 } = __require("node:fs/promises");
19107
+ var { dirname: dirname19, resolve: resolve18 } = __require("node:path");
19108
19108
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
19109
19109
  var { InvalidArgumentError, UndiciError } = require_errors();
19110
19110
  var { setHeader } = require_util();
@@ -19321,7 +19321,7 @@ var require_snapshot_recorder = __commonJS({
19321
19321
  throw new InvalidArgumentError("Snapshot path is required");
19322
19322
  }
19323
19323
  try {
19324
- const data = await readFile12(resolve18(path2), "utf8");
19324
+ const data = await readFile13(resolve18(path2), "utf8");
19325
19325
  const parsed = JSON.parse(data);
19326
19326
  if (Array.isArray(parsed)) {
19327
19327
  this.#snapshots.clear();
@@ -19351,7 +19351,7 @@ var require_snapshot_recorder = __commonJS({
19351
19351
  throw new InvalidArgumentError("Snapshot path is required");
19352
19352
  }
19353
19353
  const resolvedPath = resolve18(path2);
19354
- await mkdir11(dirname18(resolvedPath), { recursive: true });
19354
+ await mkdir11(dirname19(resolvedPath), { recursive: true });
19355
19355
  const data = Array.from(this.#snapshots.entries()).map(([hash4, snapshot]) => ({
19356
19356
  hash: hash4,
19357
19357
  snapshot
@@ -32254,13 +32254,13 @@ async function scanWork(dir, limits = STORAGE_LIMITS) {
32254
32254
  "ARTIFACT_LIMIT",
32255
32255
  "Execution directory nesting limit exceeded"
32256
32256
  );
32257
- const stat = await lstat6(path2).catch((e) => {
32257
+ const stat2 = await lstat6(path2).catch((e) => {
32258
32258
  if (e.code === "ENOENT") return null;
32259
32259
  throw e;
32260
32260
  });
32261
- if (!stat) return;
32262
- if (stat.isSymbolicLink()) return;
32263
- if (!stat.isDirectory())
32261
+ if (!stat2) return;
32262
+ if (stat2.isSymbolicLink()) return;
32263
+ if (!stat2.isDirectory())
32264
32264
  throw new StorageError(
32265
32265
  "UNSAFE_STORAGE",
32266
32266
  "Execution directory is not a regular directory"
@@ -54302,8 +54302,8 @@ async function readProtectedPolicyFile(file2) {
54302
54302
  constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK
54303
54303
  );
54304
54304
  try {
54305
- const stat = await handle.stat();
54306
- if (!stat.isFile() || stat.size < 1 || stat.size > 32768)
54305
+ const stat2 = await handle.stat();
54306
+ if (!stat2.isFile() || stat2.size < 1 || stat2.size > 32768)
54307
54307
  throw Error("Use a bounded regular policy file");
54308
54308
  const bytes2 = Buffer.alloc(32769);
54309
54309
  let offset = 0;
@@ -54317,7 +54317,7 @@ async function readProtectedPolicyFile(file2) {
54317
54317
  if (!part2.bytesRead) break;
54318
54318
  offset += part2.bytesRead;
54319
54319
  }
54320
- if (offset !== stat.size || offset > 32768)
54320
+ if (offset !== stat2.size || offset > 32768)
54321
54321
  throw Error("Policy changed or exceeds its bound");
54322
54322
  return productRequestsPolicySchema.parse(
54323
54323
  JSON.parse(
@@ -54753,8 +54753,8 @@ async function localRunMetadata(directory) {
54753
54753
  const root = resolve(directory);
54754
54754
  let recorded;
54755
54755
  try {
54756
- const stat = await lstat(root);
54757
- if (!stat.isDirectory() || stat.isSymbolicLink()) throw Error();
54756
+ const stat2 = await lstat(root);
54757
+ if (!stat2.isDirectory() || stat2.isSymbolicLink()) throw Error();
54758
54758
  recorded = localRunMetadataSchema.parse(
54759
54759
  decodeLocalJson(
54760
54760
  await boundedLocalFile(join(root, "local-run.json"), 1048576)
@@ -54778,8 +54778,8 @@ async function indexedLocalFile(directory, artifact, limit) {
54778
54778
  let parent = resolve(directory);
54779
54779
  for (const part2 of parts.slice(0, -1)) {
54780
54780
  parent = join(parent, part2);
54781
- const stat = await lstat(parent);
54782
- if (!stat.isDirectory() || stat.isSymbolicLink())
54781
+ const stat2 = await lstat(parent);
54782
+ if (!stat2.isDirectory() || stat2.isSymbolicLink())
54783
54783
  throw Error("Unsafe indexed evidence");
54784
54784
  }
54785
54785
  const bytes2 = await boundedLocalFile(
@@ -54815,8 +54815,8 @@ async function localScenarioReport(directory) {
54815
54815
  const parent = join(
54816
54816
  root,
54817
54817
  artifact.path.startsWith(".e2e/") ? ".e2e" : "evidence"
54818
- ), stat = await lstat(parent);
54819
- if (!stat.isDirectory() || stat.isSymbolicLink()) throw Error();
54818
+ ), stat2 = await lstat(parent);
54819
+ if (!stat2.isDirectory() || stat2.isSymbolicLink()) throw Error();
54820
54820
  const bytes2 = await boundedLocalFile(
54821
54821
  join(parent, "waitcher-scenarios.json"),
54822
54822
  SCENARIO_LIMITS.maxSummaryBytes
@@ -56168,8 +56168,8 @@ async function prepareRunReproduction(runId, snapshot, output2) {
56168
56168
  2
56169
56169
  );
56170
56170
  const directory = resolve3(output2), parent = dirname2(directory);
56171
- const stat = await lstat2(parent);
56172
- if (!stat.isDirectory() || stat.isSymbolicLink())
56171
+ const stat2 = await lstat2(parent);
56172
+ if (!stat2.isDirectory() || stat2.isSymbolicLink())
56173
56173
  throw new ServiceError(
56174
56174
  "Use an existing regular parent directory.",
56175
56175
  "USAGE_ERROR",
@@ -56762,14 +56762,14 @@ async function localRequestCredentials(file2, policy) {
56762
56762
  return entries2;
56763
56763
  }
56764
56764
  async function localRequestRuntimeSource() {
56765
- for (const relative4 of [
56765
+ for (const relative5 of [
56766
56766
  "./request-runtime.mjs",
56767
56767
  "../dist/request-runtime.mjs"
56768
56768
  ]) {
56769
56769
  let handle;
56770
56770
  try {
56771
56771
  handle = await open9(
56772
- new URL(relative4, import.meta.url),
56772
+ new URL(relative5, import.meta.url),
56773
56773
  constants6.O_RDONLY | constants6.O_NOFOLLOW | constants6.O_NONBLOCK
56774
56774
  );
56775
56775
  const info = await handle.stat();
@@ -57534,14 +57534,14 @@ async function localProductRequestBroker(input2, options = {}) {
57534
57534
  import { constants as constants7 } from "node:fs";
57535
57535
  import { open as open10 } from "node:fs/promises";
57536
57536
  async function localScenarioRuntimeSource() {
57537
- for (const relative4 of [
57537
+ for (const relative5 of [
57538
57538
  "./scenario-runtime.mjs",
57539
57539
  "../dist/scenario-runtime.mjs"
57540
57540
  ]) {
57541
57541
  let handle;
57542
57542
  try {
57543
57543
  handle = await open10(
57544
- new URL(relative4, import.meta.url),
57544
+ new URL(relative5, import.meta.url),
57545
57545
  constants7.O_RDONLY | constants7.O_NOFOLLOW | constants7.O_NONBLOCK
57546
57546
  );
57547
57547
  const info = await handle.stat();
@@ -58611,11 +58611,14 @@ import { performance as performance4 } from "node:perf_hooks";
58611
58611
  // package.json
58612
58612
  var package_default = {
58613
58613
  name: "@waitcher/cli",
58614
- version: "0.2.29",
58615
- description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API, browser and visual monitors from waitcher.json.",
58614
+ version: "0.2.31",
58615
+ description: "Synthetic monitoring from your repository: deploy HTTP, certificate, TCP, DNS, heartbeat, API, browser, visual, MCP server and coding agent checks from waitcher.json, with AI checks and status pages.",
58616
58616
  license: "SEE LICENSE IN LICENSE.txt",
58617
58617
  author: "S\u0142awomir Radzymi\u0144ski",
58618
58618
  homepage: "https://waitcher.dev/docs/",
58619
+ bugs: {
58620
+ email: "hello@waitcher.dev"
58621
+ },
58619
58622
  repository: {
58620
58623
  type: "git",
58621
58624
  url: "git+https://github.com/slawekradzyminski/synthetic-watch.git",
@@ -58624,8 +58627,25 @@ var package_default = {
58624
58627
  keywords: [
58625
58628
  "monitoring",
58626
58629
  "synthetic-monitoring",
58630
+ "monitoring-as-code",
58627
58631
  "uptime",
58632
+ "uptime-monitoring",
58633
+ "api-monitoring",
58634
+ "browser-testing",
58628
58635
  "e2e",
58636
+ "playwright",
58637
+ "visual-regression",
58638
+ "ssl-certificate",
58639
+ "heartbeat",
58640
+ "cron-monitoring",
58641
+ "tcp",
58642
+ "dns",
58643
+ "mcp",
58644
+ "ai-agents",
58645
+ "agent-checks",
58646
+ "claude-code",
58647
+ "codex",
58648
+ "status-page",
58629
58649
  "ci",
58630
58650
  "cli"
58631
58651
  ],
@@ -59296,8 +59316,8 @@ async function productRequestEvidence(directory) {
59296
59316
  constants8.O_RDONLY | constants8.O_NOFOLLOW | constants8.O_NONBLOCK
59297
59317
  );
59298
59318
  try {
59299
- const stat = await file2.stat();
59300
- if (!stat.isFile() || stat.nlink !== 1 || stat.size > PRODUCT_REQUEST_SUMMARY_BYTES)
59319
+ const stat2 = await file2.stat();
59320
+ if (!stat2.isFile() || stat2.nlink !== 1 || stat2.size > PRODUCT_REQUEST_SUMMARY_BYTES)
59301
59321
  throw Error();
59302
59322
  const bytes2 = Buffer.alloc(PRODUCT_REQUEST_SUMMARY_BYTES + 1);
59303
59323
  let offset = 0;
@@ -59307,7 +59327,7 @@ async function productRequestEvidence(directory) {
59307
59327
  offset += p.bytesRead;
59308
59328
  }
59309
59329
  const after = await file2.stat();
59310
- if (offset !== stat.size || after.size !== stat.size || after.mtimeMs !== stat.mtimeMs)
59330
+ if (offset !== stat2.size || after.size !== stat2.size || after.mtimeMs !== stat2.mtimeMs)
59311
59331
  throw Error();
59312
59332
  summary2 = productRequestSummarySchema.parse(
59313
59333
  JSON.parse(
@@ -60316,14 +60336,14 @@ var entries = {
60316
60336
  fix: "A built monitor script must fit 50,000 characters. Split the journey into smaller monitors or remove unused helpers."
60317
60337
  },
60318
60338
  RUNTIME_VERSION_MISMATCH: {
60319
- title: "Project runtime differs from the hosted runtime",
60320
- meaning: "Local builds and runs must use the exact framework versions the server runs.",
60321
- fix: "Run waitcher runtime install --file PATH_TO_waitcher.json. It shows the package.json change and npm commands; after the user agrees, rerun it with --yes. If the server runs other versions than this CLI, install the CLI the server offers first."
60339
+ title: "Project runtime is not a supported generation",
60340
+ meaning: "The project's installed e2e, @e2e-dev/web and esbuild versions are not one supported runtime generation, so local runs and hosted checks could differ.",
60341
+ fix: "Run waitcher runtime upgrade --file PATH_TO_waitcher.json and follow its steps: it installs a supported generation after the user agrees (--yes). If the server names a generation this CLI does not know, install the CLI the server offers first."
60322
60342
  },
60323
- RUNTIME_VERSION_OUTDATED: {
60324
- title: "Project runtime is one generation behind",
60325
- meaning: "The project has the previous hosted framework versions. They still build and deploy until the date in the message, but local runs no longer match the server exactly.",
60326
- fix: "Run waitcher runtime install --file PATH_TO_waitcher.json, then waitcher deploy plan --verify. After the user agrees to the npm install, rerun it with --yes."
60343
+ RUNTIME_VERSION_ENDING: {
60344
+ title: "Project runtime generation ends soon",
60345
+ meaning: "The project's runtime generation stops being supported on the date in the message. Until then it builds, deploys and runs as before.",
60346
+ fix: "Run waitcher runtime upgrade --file PATH_TO_waitcher.json and follow its steps, or hand the prompt in the runtime docs to a coding agent."
60327
60347
  },
60328
60348
  SECRET_MISSING: {
60329
60349
  title: "Secret not set for this environment",
@@ -60601,10 +60621,73 @@ var RUNTIME_ENGINE = Object.freeze({
60601
60621
  chromiumRevision: "1255",
60602
60622
  chromiumVersion: "159.0.8154.6"
60603
60623
  });
60604
- var RUNTIME_PREVIOUS = Object.freeze({ e2e: "0.21.1", "@e2e-dev/web": "0.15.1" });
60605
- var RUNTIME_PREVIOUS_UNTIL = "2026-12-20";
60624
+ var RUNTIME_SUPPORT_DAYS = 90;
60625
+ var RUNTIME_GENERATIONS = Object.freeze([
60626
+ {
60627
+ id: "2026.11",
60628
+ e2e: RUNTIME_PINS.e2e,
60629
+ web: RUNTIME_PINS["@e2e-dev/web"],
60630
+ esbuild: RUNTIME_PINS.esbuild,
60631
+ playwright: RUNTIME_ENGINE.playwright,
60632
+ chromiumVersion: RUNTIME_ENGINE.chromiumVersion,
60633
+ released: "2026-11-20"
60634
+ }
60635
+ ]);
60636
+ var RUNTIME_GENERATION = RUNTIME_GENERATIONS[0].id;
60637
+ var DAY = 864e5;
60638
+ function generationEnds(id4, catalog = RUNTIME_GENERATIONS) {
60639
+ const index = catalog.findIndex((g) => g.id === id4);
60640
+ if (index < 0) return null;
60641
+ if (catalog[index].endsAt) return catalog[index].endsAt;
60642
+ if (index === 0) return null;
60643
+ return new Date(Date.parse(`${catalog[index - 1].released}T00:00:00Z`) + RUNTIME_SUPPORT_DAYS * DAY).toISOString().slice(0, 10);
60644
+ }
60645
+ var RUNTIME_ENDING_DAYS = 30;
60646
+ function generationStatus(id4, now = Date.now(), catalog = RUNTIME_GENERATIONS) {
60647
+ if (!id4 || !catalog.some((g) => g.id === id4)) return "unsupported";
60648
+ const ends = generationEnds(id4, catalog);
60649
+ if (!ends) return catalog[0].id === id4 ? "newest" : "supported";
60650
+ const end = Date.parse(`${ends}T00:00:00Z`);
60651
+ if (now >= end) return "unsupported";
60652
+ if (now >= end - RUNTIME_ENDING_DAYS * DAY) return "ending";
60653
+ return catalog[0].id === id4 ? "newest" : "supported";
60654
+ }
60655
+ var supportedGenerations = (now = Date.now(), catalog = RUNTIME_GENERATIONS) => catalog.filter((g) => generationStatus(g.id, now, catalog) !== "unsupported").map((g) => ({ ...g, endsAt: generationEnds(g.id, catalog) }));
60656
+ var generationPins = (g) => ({
60657
+ e2e: g.e2e,
60658
+ "@e2e-dev/web": g.web,
60659
+ esbuild: g.esbuild
60660
+ });
60661
+ function installedGeneration(installed, browser, now = Date.now(), catalog = RUNTIME_GENERATIONS) {
60662
+ return supportedGenerations(now, catalog).find(
60663
+ (g) => installed.e2e === g.e2e && installed.esbuild === g.esbuild && (!browser || installed["@e2e-dev/web"] === g.web)
60664
+ ) ?? null;
60665
+ }
60666
+ var RUNTIME_CHANGES = Object.freeze({
60667
+ "2026.11": [
60668
+ {
60669
+ package: "e2e",
60670
+ since: "0.23.0",
60671
+ change: "inputValue() and isChecked() throw on elements that have no value",
60672
+ find: "\\.(inputValue|isChecked)\\(",
60673
+ fix: "Call them only on input, textarea, select or checkbox locators; read other elements with textContent() or getAttribute()."
60674
+ },
60675
+ {
60676
+ package: "e2e",
60677
+ since: "0.24.0",
60678
+ change: "Fixtures are set up only when a test uses them",
60679
+ fix: "A test that relies on a fixture's side effect names that fixture in its arguments."
60680
+ },
60681
+ {
60682
+ package: "@e2e-dev/web",
60683
+ since: "0.16.0",
60684
+ change: "Configured headers and basicAuth apply only to the app's own origin",
60685
+ find: "\\b(headers|basicAuth)\\s*:",
60686
+ fix: "Pass headers for another origin with that request instead of the app configuration."
60687
+ }
60688
+ ]
60689
+ });
60606
60690
  var RUNTIME_OVERRIDES = Object.freeze({ e2e: { zod: "4.6.7" } });
60607
- var runtimePinStatus = (name5, found, previous = RUNTIME_PREVIOUS, until = RUNTIME_PREVIOUS_UNTIL, now = Date.now()) => found === RUNTIME_PINS[name5] ? "current" : found !== null && found === previous[name5] && until !== null && now < Date.parse(`${until}T00:00:00Z`) ? "previous" : "mismatch";
60608
60691
  var runtimePackages = (browser) => browser ? ["e2e", "@e2e-dev/web", "esbuild"] : ["e2e", "esbuild"];
60609
60692
  var CONFIG_FILE = "waitcher.json";
60610
60693
  var PROJECT_SCHEMA_PATH = "/schema/project-v1.json";
@@ -60844,6 +60927,9 @@ var deployRequestSchema = external_exports.object({
60844
60927
  activateNew: external_exports.boolean().default(false),
60845
60928
  version: external_exports.string().trim().min(1).max(100).optional(),
60846
60929
  basedOn: external_exports.string().uuid().nullable().optional(),
60930
+ // The runtime generation the project's installed pins match; its checks
60931
+ // run on it. Without it new checks get the newest and others keep theirs.
60932
+ runtime: external_exports.string().regex(/^\d{4}\.\d{2}$/).optional(),
60847
60933
  adopt: external_exports.record(external_exports.string().regex(MONITOR_KEY), external_exports.string().uuid()).refine(
60848
60934
  (a) => Object.keys(a).length <= CONFIG_LIMITS.monitors,
60849
60935
  "Too many adoptions"
@@ -60972,8 +61058,8 @@ async function readConnectionConfiguration(file2) {
60972
61058
  );
60973
61059
  const handle = await open13(file2, "r");
60974
61060
  try {
60975
- const stat = await handle.stat();
60976
- if (!stat.isFile() || stat.size > 8192) throw Error();
61061
+ const stat2 = await handle.stat();
61062
+ if (!stat2.isFile() || stat2.size > 8192) throw Error();
60977
61063
  const parsed = connectionSchema.safeParse(
60978
61064
  JSON.parse(await handle.readFile("utf8"))
60979
61065
  );
@@ -61018,8 +61104,8 @@ async function providerCredentialFile(file2) {
61018
61104
  file2,
61019
61105
  constants10.O_RDONLY | constants10.O_NOFOLLOW | constants10.O_NONBLOCK
61020
61106
  );
61021
- const stat = await handle.stat();
61022
- if (!stat.isFile() || stat.size > 1024 || process.platform !== "win32" && stat.mode & 63)
61107
+ const stat2 = await handle.stat();
61108
+ if (!stat2.isFile() || stat2.size > 1024 || process.platform !== "win32" && stat2.mode & 63)
61023
61109
  throw Error();
61024
61110
  const bytes2 = Buffer.alloc(1025);
61025
61111
  const { bytesRead } = await handle.read(bytes2, 0, bytes2.length, 0);
@@ -61058,8 +61144,8 @@ async function readLocalModelConnection(file2, monitor, binding = monitor.ai) {
61058
61144
  file2,
61059
61145
  constants11.O_RDONLY | constants11.O_NOFOLLOW | constants11.O_NONBLOCK
61060
61146
  );
61061
- const stat = await handle.stat();
61062
- if (!stat.isFile() || stat.size > 32768 || process.platform !== "win32" && stat.mode & 63)
61147
+ const stat2 = await handle.stat();
61148
+ if (!stat2.isFile() || stat2.size > 32768 || process.platform !== "win32" && stat2.mode & 63)
61063
61149
  throw Error();
61064
61150
  const bytes2 = Buffer.alloc(32769), { bytesRead } = await handle.read(bytes2, 0, bytes2.length, 0);
61065
61151
  if (bytesRead > 32768) throw Error();
@@ -61107,9 +61193,9 @@ async function readLocalModelConnection(file2, monitor, binding = monitor.ai) {
61107
61193
  };
61108
61194
  }
61109
61195
  async function localModelClientSource() {
61110
- for (const relative4 of ["./model-client.mjs", "../dist/model-client.mjs"]) {
61196
+ for (const relative5 of ["./model-client.mjs", "../dist/model-client.mjs"]) {
61111
61197
  try {
61112
- return await readFile3(new URL(relative4, import.meta.url), "utf8");
61198
+ return await readFile3(new URL(relative5, import.meta.url), "utf8");
61113
61199
  } catch {
61114
61200
  }
61115
61201
  }
@@ -61546,29 +61632,37 @@ var invalid2 = (message) => {
61546
61632
  };
61547
61633
  async function runtime(project, browser, ai = false) {
61548
61634
  const require2 = createRequire(join8(project, "package.json"));
61549
- async function locate(name5, version2) {
61635
+ async function locate(name5) {
61550
61636
  let entry2;
61551
61637
  try {
61552
61638
  entry2 = require2.resolve(name5);
61553
61639
  } catch {
61554
61640
  return invalid2(
61555
- `Install ${name5}@${version2} in ${project} before running locally (waitcher runtime install).`
61641
+ `Install ${name5} in ${project} before running locally (waitcher runtime install).`
61556
61642
  );
61557
61643
  }
61558
- const root2 = dirname8(dirname8(entry2));
61644
+ const root = dirname8(dirname8(entry2));
61559
61645
  const metadata2 = JSON.parse(
61560
- await readFile4(join8(root2, "package.json"), "utf8")
61646
+ await readFile4(join8(root, "package.json"), "utf8")
61561
61647
  );
61562
- if (metadata2.name !== name5 || (name5 in RUNTIME_PINS ? runtimePinStatus(name5, metadata2.version) === "mismatch" : metadata2.version !== version2))
61563
- invalid2(
61564
- `Local execution requires ${name5}@${version2}; found ${metadata2.version}. Run waitcher runtime install in ${project}.`
61565
- );
61566
- return root2;
61648
+ if (metadata2.name !== name5)
61649
+ invalid2(`${name5} in ${project} is not the ${name5} package.`);
61650
+ return { root, version: String(metadata2.version) };
61651
+ }
61652
+ const e2e = await locate("e2e");
61653
+ const web = browser ? await locate("@e2e-dev/web") : null;
61654
+ if (!supportedGenerations().some(
61655
+ (g) => g.e2e === e2e.version && (!web || g.web === web.version)
61656
+ ))
61657
+ invalid2(
61658
+ `e2e@${e2e.version}${web ? ` and @e2e-dev/web@${web.version}` : ""} in ${project} are no supported runtime generation. Run waitcher runtime install in ${project}.`
61659
+ );
61660
+ if (ai) {
61661
+ const model = await locate("ai");
61662
+ if (model.version !== "7.0.177")
61663
+ invalid2(`Local execution requires ai@7.0.177; found ${model.version}.`);
61567
61664
  }
61568
- const root = await locate("e2e", RUNTIME_PINS.e2e);
61569
- if (browser) await locate("@e2e-dev/web", RUNTIME_PINS["@e2e-dev/web"]);
61570
- if (ai) await locate("ai", "7.0.177");
61571
- return join8(root, "dist/cli/bin.js");
61665
+ return join8(e2e.root, "dist/cli/bin.js");
61572
61666
  }
61573
61667
  async function inventory(root) {
61574
61668
  const files = [];
@@ -62454,7 +62548,7 @@ async function buildScript({
62454
62548
  const toolMetadata = JSON.parse(
62455
62549
  await readFile5(join10(dirname10(dirname10(tool)), "package.json"), "utf8")
62456
62550
  );
62457
- if (toolMetadata.name !== "esbuild" || runtimePinStatus("esbuild", toolMetadata.version) === "mismatch")
62551
+ if (toolMetadata.name !== "esbuild" || !supportedGenerations().some((g) => g.esbuild === toolMetadata.version))
62458
62552
  invalid4(
62459
62553
  `The portable build requires esbuild@${RUNTIME_PINS.esbuild} in the project (waitcher runtime install).`
62460
62554
  );
@@ -62641,13 +62735,13 @@ async function chromiumInstalled(project) {
62641
62735
  return false;
62642
62736
  }
62643
62737
  }
62644
- function pinPackageJson(existing, project) {
62738
+ function pinPackageJson(existing, project, pins = RUNTIME_PINS) {
62645
62739
  const json3 = existing ? structuredClone(existing) : {
62646
62740
  name: basename2(project).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[._-]+/, "") || "waitcher-monitors",
62647
62741
  private: true
62648
62742
  };
62649
62743
  const changes = [];
62650
- for (const [name5, to] of Object.entries(RUNTIME_PINS)) {
62744
+ for (const [name5, to] of Object.entries(pins)) {
62651
62745
  const field = json3.dependencies?.[name5] !== void 0 ? "dependencies" : "devDependencies";
62652
62746
  const from = json3[field]?.[name5] ?? null;
62653
62747
  if (from === to) continue;
@@ -62711,13 +62805,15 @@ async function installRuntime(options) {
62711
62805
  2
62712
62806
  );
62713
62807
  }
62714
- const { json: json3, changes } = pinPackageJson(existing, project);
62715
62808
  const needed = runtimePackages(browser);
62716
62809
  const installed = {};
62717
62810
  for (const name5 of Object.keys(RUNTIME_PINS))
62718
62811
  installed[name5] = await installedVersion(project, name5);
62719
- const stale = Object.keys(RUNTIME_PINS).filter(
62720
- (name5) => runtimePinStatus(name5, installed[name5], {}) !== "current"
62812
+ const generation = options.generation ?? installedGeneration(installed, browser) ?? RUNTIME_GENERATIONS[0];
62813
+ const pins = generationPins(generation);
62814
+ const { json: json3, changes } = pinPackageJson(existing, project, pins);
62815
+ const stale = Object.keys(pins).filter(
62816
+ (name5) => installed[name5] !== pins[name5]
62721
62817
  );
62722
62818
  const ignorePath = join11(project, ".gitignore");
62723
62819
  const ignoreText = await readFile6(ignorePath, "utf8").catch(() => "");
@@ -62734,7 +62830,8 @@ async function installRuntime(options) {
62734
62830
  ];
62735
62831
  const base2 = {
62736
62832
  project,
62737
- runtime: RUNTIME_PINS,
62833
+ generation: generation.id,
62834
+ runtime: pins,
62738
62835
  packages: needed,
62739
62836
  browser,
62740
62837
  installed,
@@ -62768,9 +62865,9 @@ async function installRuntime(options) {
62768
62865
  await run("npx", ["--no-install", "e2e-web", "install", "chromium"], project, signal);
62769
62866
  for (const name5 of needed) {
62770
62867
  const found = await installedVersion(project, name5);
62771
- if (found !== RUNTIME_PINS[name5])
62868
+ if (found !== pins[name5])
62772
62869
  throw new ServiceError(
62773
- `${name5}@${RUNTIME_PINS[name5]} is still not resolvable from ${project} (found ${found ?? "nothing"}). A parent workspace or lockfile may override it.`,
62870
+ `${name5}@${pins[name5]} is still not resolvable from ${project} (found ${found ?? "nothing"}). A parent workspace or lockfile may override it.`,
62774
62871
  "RUNTIME_VERSION_MISMATCH",
62775
62872
  2
62776
62873
  );
@@ -62780,7 +62877,7 @@ async function installRuntime(options) {
62780
62877
  ok: true,
62781
62878
  applied: true,
62782
62879
  ...base2,
62783
- installed: Object.fromEntries(needed.map((n) => [n, RUNTIME_PINS[n]])),
62880
+ installed: Object.fromEntries(needed.map((n) => [n, pins[n]])),
62784
62881
  steps,
62785
62882
  next: [
62786
62883
  `waitcher config validate --file ${join11(project, "waitcher.json")}`,
@@ -62827,31 +62924,32 @@ async function buildEntries(path2, config2) {
62827
62924
  const scripts = {};
62828
62925
  const builds = [];
62829
62926
  const issues2 = [];
62830
- if (!entries2.length) return { scripts, builds, issues: issues2 };
62927
+ if (!entries2.length) return { scripts, builds, issues: issues2, runtime: null };
62831
62928
  const project = await realpath3(dirname12(path2));
62832
62929
  const browser = entries2.some((e) => e.type === "browser");
62833
- for (const name5 of runtimePackages(browser)) {
62834
- const version2 = RUNTIME_PINS[name5];
62835
- const found = await installedVersion(project, name5);
62836
- const status2 = runtimePinStatus(name5, found);
62837
- if (status2 === "previous")
62838
- issues2.push({
62839
- ...problem({
62840
- code: "RUNTIME_VERSION_OUTDATED",
62841
- path: "(project)",
62842
- message: `Hosted monitors run ${name5}@${version2}; ${project} still has the previous ${found}, accepted until ${RUNTIME_PREVIOUS_UNTIL}`
62843
- }),
62844
- severity: "warning"
62845
- });
62846
- else if (status2 === "mismatch")
62847
- issues2.push(
62848
- problem({
62849
- code: "RUNTIME_VERSION_MISMATCH",
62850
- path: "(project)",
62851
- message: `Hosted monitors run ${name5}@${version2}; ${found ? `found ${found}` : "it is not installed"} in ${project}`
62852
- })
62853
- );
62854
- }
62930
+ const installed = Object.fromEntries(
62931
+ await Promise.all(
62932
+ runtimePackages(browser).map(async (name5) => [name5, await installedVersion(project, name5)])
62933
+ )
62934
+ );
62935
+ const generation = installedGeneration(installed, browser);
62936
+ if (!generation)
62937
+ issues2.push(
62938
+ problem({
62939
+ code: "RUNTIME_VERSION_MISMATCH",
62940
+ path: "(project)",
62941
+ message: `${project} has ${Object.entries(installed).map(([name5, version2]) => `${name5}@${version2 ?? "(none)"}`).join(", ")}, which is no supported runtime generation (${supportedGenerations().map((g) => g.id).join(", ")})`
62942
+ })
62943
+ );
62944
+ else if (generationStatus(generation.id) === "ending")
62945
+ issues2.push({
62946
+ ...problem({
62947
+ code: "RUNTIME_VERSION_ENDING",
62948
+ path: "(project)",
62949
+ message: `Runtime ${generation.id} is supported until ${generationEnds(generation.id)}`
62950
+ }),
62951
+ severity: "warning"
62952
+ });
62855
62953
  for (const { key, entry: entry2, index } of entries2) {
62856
62954
  const at = `monitors[${index}].entry`;
62857
62955
  try {
@@ -62891,7 +62989,7 @@ async function buildEntries(path2, config2) {
62891
62989
  );
62892
62990
  }
62893
62991
  }
62894
- return { scripts, builds, issues: issues2 };
62992
+ return { scripts, builds, issues: issues2, runtime: generation?.id ?? null };
62895
62993
  }
62896
62994
  async function verifyLocally(options) {
62897
62995
  const project = await realpath3(dirname12(options.path));
@@ -63047,8 +63145,150 @@ function deployNextSteps(result2, {
63047
63145
  return steps;
63048
63146
  }
63049
63147
 
63148
+ // src/upgrade.ts
63149
+ import { readdir as readdir2, readFile as readFile8, stat } from "node:fs/promises";
63150
+ import { dirname as dirname13, join as join13, relative as relative3 } from "node:path";
63151
+ var SCAN = { files: 2e3, bytes: 1024 * 1024, matches: 20 };
63152
+ var SOURCE = /\.(m|c)?(j|t)sx?$/;
63153
+ var SKIP = /* @__PURE__ */ new Set(["node_modules", ".git", ".waitcher", ".e2e", "dist"]);
63154
+ async function findChanges(project, changes) {
63155
+ const files = [];
63156
+ async function walk(dir) {
63157
+ for (const item of await readdir2(dir, { withFileTypes: true }).catch(() => [])) {
63158
+ if (files.length >= SCAN.files) return;
63159
+ if (SKIP.has(item.name)) continue;
63160
+ const path2 = join13(dir, item.name);
63161
+ if (item.isDirectory()) await walk(path2);
63162
+ else if (item.isFile() && SOURCE.test(item.name)) files.push(path2);
63163
+ }
63164
+ }
63165
+ if (changes.some((c) => c.find)) await walk(project);
63166
+ const texts = /* @__PURE__ */ new Map();
63167
+ for (const file2 of files)
63168
+ if ((await stat(file2)).size <= SCAN.bytes)
63169
+ texts.set(file2, (await readFile8(file2, "utf8")).split(/\r?\n/));
63170
+ return changes.map((change) => {
63171
+ const matches2 = [];
63172
+ if (change.find) {
63173
+ const pattern = new RegExp(change.find);
63174
+ for (const [file2, lines] of texts)
63175
+ lines.forEach((text4, index) => {
63176
+ if (matches2.length < SCAN.matches && pattern.test(text4))
63177
+ matches2.push({ file: relative3(project, file2), line: index + 1, text: text4.trim().slice(0, 200) });
63178
+ });
63179
+ }
63180
+ return { ...change, matches: matches2 };
63181
+ });
63182
+ }
63183
+ async function upgrade(options) {
63184
+ const { summary: summary2, yes, signal } = options;
63185
+ const path2 = configPath(options.file);
63186
+ const { config: config2 } = await readProjectConfig(options.file);
63187
+ const project = dirname13(path2);
63188
+ const entries2 = scriptEntries(config2);
63189
+ const browser = entries2.some((e) => e.type === "browser");
63190
+ const resolved = resolveProjectConfig(config2, "");
63191
+ const name5 = resolved.project ?? null;
63192
+ const env = options.env ?? (resolved.environments.length === 1 ? resolved.environments[0] : void 0);
63193
+ const flags = `--file ${path2}${env ? ` --env ${env}` : ""}`;
63194
+ const again = `waitcher runtime upgrade --file ${path2}${options.to ? ` --to ${options.to}` : ""}`;
63195
+ const targetId = options.to ?? summary2.generation;
63196
+ const supported = summary2.generations.map((g) => g.id);
63197
+ if (!supported.includes(targetId))
63198
+ throw new ServiceError(
63199
+ `Runtime ${targetId} is not supported; supported: ${supported.join(", ")}.`,
63200
+ "USAGE_ERROR",
63201
+ 2
63202
+ );
63203
+ const installed = Object.fromEntries(
63204
+ await Promise.all(
63205
+ runtimePackages(browser).map(async (pkg) => [pkg, await installedVersion(project, pkg)])
63206
+ )
63207
+ );
63208
+ const from = entries2.length ? installedGeneration(installed, browser)?.id ?? null : null;
63209
+ const mine = (source) => Boolean(source) && name5 !== null && source.project.toLowerCase() === name5.toLowerCase();
63210
+ const hosted = (summary2.checks ?? []).filter((c) => mine(c));
63211
+ const base2 = {
63212
+ event: "upgrade",
63213
+ newest: summary2.generation,
63214
+ generations: summary2.generations,
63215
+ project: { file: path2, name: name5, environment: env ?? null, generation: from, installed },
63216
+ target: targetId,
63217
+ hosted: hosted.map(({ key, environment, generation }) => ({ key, environment, generation }))
63218
+ };
63219
+ const target = RUNTIME_GENERATIONS.find((g) => g.id === targetId);
63220
+ if (!target)
63221
+ return {
63222
+ ...base2,
63223
+ stage: "cli",
63224
+ steps: [
63225
+ `This CLI does not know runtime ${targetId} yet. Install the CLI the server offers: npm install -g @waitcher/cli@VERSION with the version from ${options.origin}/downloads/cli.json.`,
63226
+ `Then run ${again}`
63227
+ ]
63228
+ };
63229
+ if (!entries2.length)
63230
+ return {
63231
+ ...base2,
63232
+ stage: "current",
63233
+ steps: ["Nothing to do: this project has no api or browser entries, so it pins no runtime."]
63234
+ };
63235
+ if (from !== targetId) {
63236
+ const between = summary2.generations.map((g) => g.id).filter((id4) => (from === null || id4 > from) && id4 <= targetId);
63237
+ const changes = await findChanges(
63238
+ project,
63239
+ between.flatMap((id4) => summary2.changes[id4] ?? [])
63240
+ );
63241
+ const previews = summary2.preview?.generation === targetId ? summary2.trials.filter((t) => mine(t.source)).map((t) => ({
63242
+ key: t.source.key,
63243
+ entry: entries2.find((e) => e.key === t.source.key)?.entry ?? null,
63244
+ status: t.status,
63245
+ message: t.message
63246
+ })) : [];
63247
+ const install = await installRuntime({ project, browser, yes, signal, generation: target });
63248
+ const failed = previews.filter((p) => ["failed", "error"].includes(p.status));
63249
+ return {
63250
+ ...base2,
63251
+ stage: "upgrade",
63252
+ changes,
63253
+ previews,
63254
+ install,
63255
+ steps: yes ? [
63256
+ `The project now pins runtime ${targetId}. Change the scripts as changes[] says${failed.length ? `; previews[] shows ${failed.map((p) => p.key).join(", ")} failed on ${targetId}` : ""}.`,
63257
+ `waitcher config validate ${flags} --verify runs every script locally on ${targetId}; fix failures and repeat.`,
63258
+ "Show the user the diff and commit package.json, package-lock.json and the script changes.",
63259
+ `Then run ${again}; it lists the environments to deploy.`
63260
+ ] : [
63261
+ `Moving this project from runtime ${from ?? "(none installed)"} to ${targetId}. changes[] lists what changed, the lines of this project each may affect (matches) and a fix${previews.length ? `; previews[] shows how each hosted check did when Waitcher ran it on ${targetId}` : ""}.`,
63262
+ `Show the user install.steps (npm install runs package install scripts${browser ? "; Chromium is downloaded" : ""}). After the user agrees, run ${again} --yes.`
63263
+ ]
63264
+ };
63265
+ }
63266
+ const behind = hosted.filter((c) => c.generation !== targetId);
63267
+ if (behind.length) {
63268
+ const environments = [...new Set(behind.map((c) => c.environment))];
63269
+ return {
63270
+ ...base2,
63271
+ stage: "deploy",
63272
+ steps: [
63273
+ `The project pins runtime ${targetId}; hosted checks still run another generation in ${environments.join(", ")}: ${behind.map((c) => `${c.key} (${c.generation})`).join(", ")}.`,
63274
+ ...environments.map(
63275
+ (e) => `waitcher deploy plan --file ${path2} --env ${e} --verify, show the user the plan (changes with field runtime), then waitcher deploy apply --file ${path2} --env ${e} --based-on BASED_ON`
63276
+ ),
63277
+ `Then run ${again}`
63278
+ ]
63279
+ };
63280
+ }
63281
+ return {
63282
+ ...base2,
63283
+ stage: "current",
63284
+ steps: [
63285
+ targetId === summary2.generation ? `Nothing to do: this project and its hosted checks run the newest runtime, ${targetId}.` : `Nothing to do: this project and its hosted checks run runtime ${targetId}. The newest is ${summary2.generation}.`
63286
+ ]
63287
+ };
63288
+ }
63289
+
63050
63290
  // ../../skills/waitcher/SKILL.md
63051
- var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, TCP, DNS, heartbeat, API, browser, visual or MCP monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time. Commands print JSON on stdout (`run diagnose` and `run scenarios` need `--json` for it); failures print `{error:{code,message}}` on stderr. Read the exit code, every `issues` entry and every `next` step.\n\nThis skill says what to do and in which order. For exact syntax use the installed CLI, never memory: `waitcher help TOPIC` (for example `help deploy`, `help secret`, `help run`) prints only that part of the help for this CLI version, and `waitcher explain CODE` explains an issue or error code. The user guide at https://waitcher.dev/docs/ explains the same product for people; link the user to a page (CLI install and updates, alerts, access tokens, account) instead of retelling it.\n\n## Rules\n\n- Never put secrets in files, arguments or output. Pipe values to `--value-stdin`.\n- Keep new monitors paused. Pass `--activate-new`, `--prune`, `--adopt` or `--smoke` only when the user agreed to that effect.\n- Show the user the plan's `changes` before `deploy apply`, and apply with `--based-on` from that plan.\n- A local pass is not hosted permission. If capabilities or limits refuse something, report it; never switch accounts or workspaces, raise limits or remove assertions to get a green result.\n- Work in the workspace the user chose. `waitcher auth status` names the active one (personal or a team) and your role; ask before `workspace use`, `--workspace` or any `member` command.\n- An agent's own success claim is not evidence. Verify outcomes through the product's state or real run evidence.\n- Do not turn a whole regression suite into monitors. Pick two to five journeys whose failure the user would act on.\n\n## Workflow\n\n1. **Check the setup.** Run `waitcher doctor` in the repository. Fix `error` checks first; its `next` lists exact commands. Without a session, ask the user to run `waitcher auth login` (CI uses a token).\n2. **Understand the product.** Read the repository: base URLs per environment, existing E2E tests, critical journeys, test accounts and jobs. Ask the user which failures should alert them.\n3. **Start the file.** `waitcher config init --project-name NAME --target https://BASE` when there is no `waitcher.json`. Give each monitor a stable lowercase `key`; changing a key later replaces the monitor and its history.\n4. **Choose types.** `http` for status and content, `certificate` for TLS expiry, `tcp` for a database, mail or SSH port, `dns` for records that must keep their values, `heartbeat` for jobs that report in, `api` for a multi-request invariant, `browser` for a user journey, `mcp` when the product ships a remote MCP server. `waitcher monitor init --type TYPE --file x.json` prints a complete example of any type. Script monitors name their test with `entry`; read [authoring](references/authoring.md) before writing one. They need the pinned runtime next to `waitcher.json`: run `waitcher runtime install`, show the user the steps it lists (npm install runs package install scripts; browser projects download Chromium), and after they agree rerun it with `--yes`. It writes exact pins into `package.json`, updates `.gitignore` and is safe to repeat. The same command upgrades the project after a CLI update (`RUNTIME_VERSION_OUTDATED`).\n5. **Validate offline.** `waitcher config validate` resolves every environment and builds every entry. Fix each issue at its `path`. Add `--env NAME --verify` (optionally `--key KEY`) to run the api/browser entries locally without an account; read the run directory it names when one fails.\n6. **Plan.** `waitcher deploy plan --env NAME --verify` runs script monitors locally against that environment, then asks the server. Resolve errors (`SECRET_MISSING`: ask the user for the value and run `waitcher secret set`; `ADOPTION_CANDIDATE`: ask whether the existing monitor is the same check).\n7. **Apply.** After the user accepts the plan: `waitcher deploy apply --env NAME --based-on BASED_ON`, where BASED_ON is the plan's `basedOn` or `none` when it is null (first deploy); the plan's `next` prints the exact command. Add `--smoke` for one hosted run per changed monitor. New monitors stay paused.\n8. **Report.** Give the user the monitor IDs, what each checks, local and hosted results, evidence paths and anything still pending (paused schedules, heartbeat credentials, secrets for other environments). If `waitcher alert policy list` shows no routing, failures will alert nobody: point the user to https://waitcher.dev/docs/alerts.\n\nFor CI, `waitcher ci init` writes a workflow that plans on pull requests and applies on the main branch. Details of secrets, adoption, rollback and CI are in [deploy](references/deploy.md).\n\n## When something fails\n\n- `waitcher --help` prints a short overview of topics; `waitcher help TOPIC` (or `waitcher GROUP --help`) prints one part with the exit codes; `waitcher help all` is long, avoid it.\n- Exit 2: fix the file or input; exit 3: sign in; exit 4: a check failed (inspect evidence); exit 6: quota, rate or queue limit; exit 7: not permitted; exit 8: conflict or managed by `waitcher.json`; exit 9: not found; exit 10: service unavailable.\n- For a failed run, read [diagnosis](references/diagnosis.md): `waitcher run diagnose --id RUN_ID`, then reproduce locally before changing the test.\n- Never retry a write automatically after an uncertain result; read the current state first.\n\n## References\n\n- [authoring](references/authoring.md): choosing a type, writing API and browser tests, local runs and evidence, single-monitor apply.\n- [deploy](references/deploy.md): waitcher.json details, secrets, adoption, rollback, CI.\n- [diagnosis](references/diagnosis.md): run diagnosis and reproduction.\n- [optional capabilities](references/optional-capabilities.md): visual baselines, browser identities, verified HTTP credentials, invocation budgets, agent checks, public status pages, team workspaces.\n- [AI and agents](references/ai-and-agents.md): agent outcome checks, scenario evidence, AI endpoints and suites, calibration, AI steps in scripts, protected requests.\n- Read the last two only when `waitcher system capabilities` reports the feature and the user needs it.\n";
63291
+ var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, TCP, DNS, heartbeat, API, browser, visual or MCP monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time. Commands print JSON on stdout (`run diagnose` and `run scenarios` need `--json` for it); failures print `{error:{code,message}}` on stderr. Read the exit code, every `issues` entry and every `next` step.\n\nThis skill says what to do and in which order. For exact syntax use the installed CLI, never memory: `waitcher help TOPIC` (for example `help deploy`, `help secret`, `help run`) prints only that part of the help for this CLI version, and `waitcher explain CODE` explains an issue or error code. The user guide at https://waitcher.dev/docs/ explains the same product for people; link the user to a page (CLI install and updates, alerts, access tokens, account) instead of retelling it.\n\n## Rules\n\n- Never put secrets in files, arguments or output. Pipe values to `--value-stdin`.\n- Keep new monitors paused. Pass `--activate-new`, `--prune`, `--adopt` or `--smoke` only when the user agreed to that effect.\n- Show the user the plan's `changes` before `deploy apply`, and apply with `--based-on` from that plan.\n- A local pass is not hosted permission. If capabilities or limits refuse something, report it; never switch accounts or workspaces, raise limits or remove assertions to get a green result.\n- Work in the workspace the user chose. `waitcher auth status` names the active one (personal or a team) and your role; ask before `workspace use`, `--workspace` or any `member` command.\n- An agent's own success claim is not evidence. Verify outcomes through the product's state or real run evidence.\n- Do not turn a whole regression suite into monitors. Pick two to five journeys whose failure the user would act on.\n\n## Workflow\n\n1. **Check the setup.** Run `waitcher doctor` in the repository. Fix `error` checks first; its `next` lists exact commands. Without a session, ask the user to run `waitcher auth login` (CI uses a token).\n2. **Understand the product.** Read the repository: base URLs per environment, existing E2E tests, critical journeys, test accounts and jobs. Ask the user which failures should alert them.\n3. **Start the file.** `waitcher config init --project-name NAME --target https://BASE` when there is no `waitcher.json`. Give each monitor a stable lowercase `key`; changing a key later replaces the monitor and its history.\n4. **Choose types.** `http` for status and content, `certificate` for TLS expiry, `tcp` for a database, mail or SSH port, `dns` for records that must keep their values, `heartbeat` for jobs that report in, `api` for a multi-request invariant, `browser` for a user journey, `mcp` when the product ships a remote MCP server. `waitcher monitor init --type TYPE --file x.json` prints a complete example of any type. Script monitors name their test with `entry`; read [authoring](references/authoring.md) before writing one. They need the pinned runtime next to `waitcher.json`: run `waitcher runtime install`, show the user the steps it lists (npm install runs package install scripts; browser projects download Chromium), and after they agree rerun it with `--yes`. It writes exact pins into `package.json`, updates `.gitignore` and is safe to repeat.\n5. **Validate offline.** `waitcher config validate` resolves every environment and builds every entry. Fix each issue at its `path`. Add `--env NAME --verify` (optionally `--key KEY`) to run the api/browser entries locally without an account; read the run directory it names when one fails.\n6. **Plan.** `waitcher deploy plan --env NAME --verify` runs script monitors locally against that environment, then asks the server. Resolve errors (`SECRET_MISSING`: ask the user for the value and run `waitcher secret set`; `ADOPTION_CANDIDATE`: ask whether the existing monitor is the same check).\n7. **Apply.** After the user accepts the plan: `waitcher deploy apply --env NAME --based-on BASED_ON`, where BASED_ON is the plan's `basedOn` or `none` when it is null (first deploy); the plan's `next` prints the exact command. Add `--smoke` for one hosted run per changed monitor. New monitors stay paused.\n8. **Report.** Give the user the monitor IDs, what each checks, local and hosted results, evidence paths and anything still pending (paused schedules, heartbeat credentials, secrets for other environments). If `waitcher alert policy list` shows no routing, failures will alert nobody: point the user to https://waitcher.dev/docs/alerts.\n\n## Runtime upgrades\n\nChecks run on the runtime generation the project pins; nothing moves them but a deploy. When the user asks to upgrade Waitcher or its runtime, doctor names a newer generation, or you see `RUNTIME_VERSION_ENDING` or `RUNTIME_VERSION_MISMATCH`: run `waitcher runtime upgrade` in the repository and repeat it until `stage` is `current` (`--to ID` targets another supported generation). Each call reports one stage with its `steps`; do them in order. In the `upgrade` stage, `changes[]` names what changed, the lines of this project it may affect (`matches`) and a `fix`, and `previews[]` shows how each hosted check did when Waitcher ran it on the target. Before `--yes` (it installs packages and Chromium) show the user `install.steps` and wait for agreement. Then fix the scripts, run `config validate --env NAME --verify`, show the diff for a commit, and in the `deploy` stage plan and apply each environment it lists. Never upgrade unasked: a supported generation is the user's choice.\n\nFor CI, `waitcher ci init` writes a workflow that plans on pull requests and applies on the main branch. Details of secrets, adoption, rollback and CI are in [deploy](references/deploy.md).\n\n## When something fails\n\n- `waitcher --help` prints a short overview of topics; `waitcher help TOPIC` (or `waitcher GROUP --help`) prints one part with the exit codes; `waitcher help all` is long, avoid it.\n- Exit 2: fix the file or input; exit 3: sign in; exit 4: a check failed (inspect evidence); exit 6: quota, rate or queue limit; exit 7: not permitted; exit 8: conflict or managed by `waitcher.json`; exit 9: not found; exit 10: service unavailable.\n- For a failed run, read [diagnosis](references/diagnosis.md): `waitcher run diagnose --id RUN_ID`, then reproduce locally before changing the test.\n- Never retry a write automatically after an uncertain result; read the current state first.\n\n## References\n\n- [authoring](references/authoring.md): choosing a type, writing API and browser tests, local runs and evidence, single-monitor apply.\n- [deploy](references/deploy.md): waitcher.json details, secrets, adoption, rollback, CI.\n- [diagnosis](references/diagnosis.md): run diagnosis and reproduction.\n- [optional capabilities](references/optional-capabilities.md): visual baselines, browser identities, verified HTTP credentials, invocation budgets, agent checks, public status pages, team workspaces.\n- [AI and agents](references/ai-and-agents.md): agent outcome checks, scenario evidence, AI endpoints and suites, calibration, AI steps in scripts, protected requests.\n- Read the last two only when `waitcher system capabilities` reports the feature and the user needs it.\n";
63052
63292
 
63053
63293
  // ../../skills/waitcher/references/authoring.md
63054
63294
  var authoring_default = '# Authoring and running monitors\n\nRead when writing or changing a test, choosing a monitor type, or running it locally. For exact syntax run `waitcher help monitor` or `waitcher help run`. AI endpoints, agent outcome checks and model steps are in [ai-and-agents](ai-and-agents.md).\n\n## Choose the type\n\n- `http`: status, body text, a JSON value or latency of one request. No script.\n- `certificate`: TLS expiry and chain. No script.\n- `heartbeat`: a job reports start and success; Waitcher alerts when it does not.\n- `tcp`: a public `HOST:PORT` accepts connections (database, mail, SSH); optional `tcp.banner` the server must send first. No script.\n- `dns`: a name\'s `A`, `AAAA`, `CNAME`, `MX` or `TXT` records hold `dns.expected` (`match`: `includes` or `exact`), asked of public resolvers. In `waitcher.json` a `dns` entry without `target` checks the `baseUrl` host. Details: https://waitcher.dev/docs/network.md.\n- `mcp`: a remote MCP server (Streamable HTTP). Lists tools and checks `mcp.expectTools`; an optional `mcp.toolCall` calls one side-effect-free tool with fixed arguments and JSON-pointer `assertions` on its result. No script. `run local --file mcp.json` runs it without an account; its `mcp-report.json` lists the tool names and `mcp-tool-result.json` holds the called tool\'s answer, so read both before writing `expectTools` and assertions. Personal tool calls need verified `httpAuth` and a 30-minute interval; listing tools needs neither. Never pick a tool that writes data. Details: https://waitcher.dev/docs/mcp.md.\n- `api`: a script with several requests and an invariant between them.\n- `browser`: a script that walks a user journey in Chromium.\n- `visual`: a screenshot of one public page or element compared with a baseline the user approved. No script; see [optional capabilities](optional-capabilities.md#optional-visual-checks).\n\n`waitcher monitor init --type TYPE --file x.json` writes a paused example of every type; `api` and `browser` also write `x.e2e.ts`. Keep scripts focused on the requested behavior and use controlled test identities for actions that change state.\n\n## Scripts in waitcher.json\n\nIn a repository, a script monitor is an entry with `entry` pointing at its test file; one test serves every environment because it reads the base URL at run time.\n\n```json\n{ "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 }\n```\n\nRun the entries of one environment locally, without an account:\n\n```sh\nwaitcher config validate --env production --verify\nwaitcher config validate --env production --verify --key checkout\n```\n\nExit 4 with `VERIFY_FAILED` names the failing assertion and the run directory to read. `run local --file` takes a single monitor manifest, not `waitcher.json`.\n\n## Browser journey\n\n```ts\nimport { test } from "@e2e-dev/web";\nimport { expect } from "e2e";\n\ntest("visitor can start a game", async ({ app, browser, screen }) => {\n await app.open("/games/klondike/");\n await expect(browser.locator("main h1")).toContainText("Solitaire");\n await expect(screen.getByRole("button", "New game")).toBeVisible();\n await app.screenshot("game");\n});\n```\n\n- `app.open(path)` resolves against the environment\'s base URL. Browser base URLs have no query or fragment; navigate to those URLs inside the script.\n- Find elements the way a visitor does with the `screen` fixture: `screen.getByRole("button", "New game")`, `screen.getByLabel("Email")`, `screen.getByText("Welcome")`, `screen.getByPlaceholder(...)`, `screen.getByTestId(...)`. Prefer these over CSS selectors.\n- The `browser` fixture navigates and offers CSS `browser.locator("main h1")` plus `expect(browser).toHaveURL(...)`; it has no `getBy*` methods.\n- Assertions come from `e2e`: `toBeVisible()`, `toContainText(...)`, `toHaveText(...)`.\n\n## API script\n\n```ts\nimport { test, expect } from "e2e";\n\ntest("orders API keeps totals consistent", async () => {\n const target = new URL(process.env.TARGET_URL!);\n const response = await fetch(new URL("/api/orders?limit=1", target));\n expect(response.status).toBe(200);\n});\n```\n\nAPI scripts import `test, expect` from `e2e` and read `process.env.TARGET_URL`. Secrets reach them only as `CHECK_*` names listed in `settings.envNames` (see [deploy](deploy.md)). The test runs as trusted local code, not in a sandbox.\n\n## Standalone manifest\n\nWithout `waitcher.json`, a monitor is one JSON file. `monitor init --type browser --file monitor.json` writes it with `scriptFile` next to the test:\n\n```json\n{\n "schemaVersion": 1,\n "name": "Product / key journey",\n "type": "browser",\n "target": "https://example.com/",\n "enabled": false,\n "interval": 1800,\n "timeout": 30,\n "scriptFile": "journey.e2e.ts"\n}\n```\n\n`scriptFile` resolves relative to the manifest; `monitor validate --file monitor.json` checks the actual contract. The platform receives one script per monitor, not the project directory. When the test imports shared helpers, run `monitor build --file monitors/checkout.json --project . --output build/checkout`: it needs installed `esbuild`, bundles code and JSON helpers, keeps only supported framework and Node imports, and writes `monitor.js`, `monitor.json` and `build.json` into a new directory. Unsupported dependencies and module-relative file access fail the build. Verify and apply the built `monitor.json`. The script limit is 50,000 characters and hosted dependencies are fixed.\n\n## Run locally and inspect evidence\n\nThe runtime project needs `e2e` and, for browser tests, `@e2e-dev/web` and Chromium, at the exact versions `waitcher runtime install` prints. `waitcher runtime install --file DIR/waitcher.json [--browser]` lists the npm install and Chromium download; run it with `--yes` once the user agrees. Chromium goes to the Playwright browser cache (`PLAYWRIGHT_BROWSERS_PATH` when set), not the runtime directory.\n\n```sh\nwaitcher run local --file monitor.json --runtime /path/to/runtime\nwaitcher run local --file monitor.json --runtime /path/to/runtime --video\nwaitcher run local --project /path/to/e2e-project --timeout 60\n```\n\n- `--project` runs an existing E2E project with its own config and imports; its `--output` must stay inside that project.\n- Runs are serial, never retried or replayed, and get a fresh directory under `.waitcher/runs/` (`--output DIR` chooses the parent). Traces are always requested; video is opt-in, and tests can override recording, so inspect the returned files.\n- On failure read `.e2e/summary.md` and `.e2e/results/*/trace.md` in the run directory first, then `execution.log` and `report.json`. The `waitcher-*.mjs` files there are runtime support, not your test. Traces are Markdown, not Playwright ZIPs; there is no HAR option, and app logs hold selected console and request failures only.\n- Exit codes: 0 passed, 4 failed or error, 130 interrupted. After an interruption, inspect partial evidence before repeating a possibly completed action.\n- Fix test mistakes while preserving the user\'s assertions; never weaken an assertion just to get green.\n- Evidence can contain private content: keep `.waitcher/`, `.e2e/`, keys and reports out of Git. Local results are not uploaded and are not hosted health evidence.\n\n## Apply one monitor through the API\n\nWhen hosted scripts are allowed and applying configuration is in scope:\n\n```sh\nwaitcher monitor apply --file monitor.json --dry-run\nwaitcher monitor apply --file monitor.json\nwaitcher monitor get --id MONITOR_ID\n```\n\nKeep the monitor paused unless the user requested scheduled execution; applying does not run it. For an authorized single hosted run use `run start --id MONITOR_ID --wait`, then `run status`, `run trace --id RUN_ID` (steps, failed assertion, screenshots, fetch calls) and `artifact get` for evidence. Hosted scripts run under the server\'s execution policy and can differ from a local run.\n\nEdits are complete replacements: `monitor export`, change the file, then `monitor apply --file FILE --id ID --expected-revision N` with the revision from get or export. Use a stable `--request-key` to recover one uncertain create or run; never change the payload under that key or repeat a possibly executed action. Report the exact monitor and run IDs, local evidence path, observed outcome and any difference between local and hosted results.\n';
@@ -63057,7 +63297,7 @@ var authoring_default = '# Authoring and running monitors\n\nRead when writing o
63057
63297
  var ai_and_agents_default = "# AI endpoints, agent outcomes and model steps\n\nRead only when `waitcher system capabilities` reports the feature and the user needs it. Deterministic HTTP, API and browser monitors need none of this; see [authoring](authoring.md).\n\n## Agent outcome checks\n\nFor hosted scripts using `#waitcher/scenario`, first confirm `features.scenarioEvidence` through `system capabilities`, alongside script admission. Older servers may not provide this helper. Do not silently remove required scenario checks to make an unsupported run pass. Capability discovery is separate from native security, capacity and production release acceptance.\n\nFor an agent that changes application state, start with `monitor init --template agent-outcome --file outcome.json --target https://product.example/api/`. It creates a paused ordinary API script, with no model binding or paid-provider requirement. Adapt its fixed `agent/tasks` submission and `notes/{runId}` resource paths, disposable test namespace and exact expected fields. It submits one action, ignores claims of success and response-provided URLs, then independently reads the known resource at most three times. A fresh per-run random `id` and `correlationId` must both match, alongside the expected result. Action transport errors are never automatically retried. Cleanup runs in `finally` only after an independent read proves the resource belongs to this run; cleanup failures fail the test. If ownership or the action result is uncertain, it records cleanup as unverified and leaves state untouched. Reconcile possible late actions before repeating a mutating test. This pattern verifies the chosen outcome, not the agent's overall quality or the correctness of its explanation.\n\nThe starter uses the optional `#waitcher/scenario` helper with required submit/action, observe, verify and cleanup phases. `createScenario({id, phases})` returns `phase(id, callback)`, `assert(boolean)` and `incomplete(reason)`. Call signals only inside an active phase. Every scenario needs a required verify phase, and an executed verify phase must call `scenario.assert` at least once; an empty verification cannot establish pass. `assert(false)` records a business failure even if caught; ordinary callback exceptions and `incomplete(\"CLEANUP_UNVERIFIED\")` record coverage errors. Inspect `.e2e/waitcher-scenarios.json` in the private evidence: required phases that never ran or remain in flight also prevent a pass. Coverage error takes precedence while retaining failed verification facts. A false agent claim can therefore produce a failed verify phase and an overall error when cleanup remains uncertain. The helper does not automatically classify arbitrary E2E assertions or infer agent/tool traces. Use stable non-secret scenario/phase IDs, avoid raw response values in assertions, and do not use report labels as secret storage.\n\nUse the unchanged file with `monitor validate`, account-free `run local --file outcome.json --runtime YOUR_PINNED_RUNTIME`, and the existing API-script editor or `monitor apply --file outcome.json --dry-run`. Keep it paused after applying. Project authors can extract the script into `scriptFile`, keep helper imports and use `monitor build` to create one portable script; `#waitcher/scenario` stays external and is supplied by the manifest runner. The complete CLI includes `scenario-runtime.mjs`; keep package companions together. Standalone `--project` needs its own helper integration. The starter's default is credential-free. Optional local/trusted-administrator bearer tokens use `CHECK_AGENT_ACTION_TOKEN`, `CHECK_RESOURCE_READ_TOKEN` and `CHECK_RESOURCE_CLEANUP_TOKEN`, explicitly listed in `settings.envNames` and supplied outside the manifest. Hosted personal scripts receive `CHECK_*` values only from their project environment's secrets (`waitcher secret set`), never from the server's environment; do not work around that boundary. Do not log credentials or response bodies, and do not promise complete trace masking for arbitrary custom environment values. Local success does not establish hosted admission or isolation.\n\n## Scenario evidence\n\nInspect readable scenario evidence with `waitcher run scenarios --id RUN_ID`, or use `waitcher run scenarios --directory PRIVATE_RUN_DIR` for account-free local inspection without a server/runtime. Add `--json` for the exact shared report DTO. Do not combine selectors or pass `--server` for local inspection. Inspection of failed/error runs succeeds; execution exit codes remain unchanged. Keep authoritative run status separate from evidence availability: empty valid reports verify no business outcome, and pending/not-recorded/expired/invalid reports cannot establish a pass. Local evidence is checked against its recorded inventory and checksum; never edit it to manufacture a successful outcome.\n\n## AI product endpoints\n\nFor a single AI product endpoint, prefer a declarative `type: \"ai\"` fixture over an E2E script. Run `monitor init --type ai --target https://product.example/ai --file ai.json`, replace the sample request and response checks with the product contract, then `monitor validate --file ai.json`. JSON-pointer assertions support exact equality, type, existence and literal case-sensitive contains/not-contains/contains-any/contains-all checks; an optional bounded response schema checks structure. `run local --file ai.json` uses the same one-POST adapter without an account, model connection, provider key or E2E runtime. It only reaches public HTTPS endpoints and supports optional verified `httpAuth` references as described below; arbitrary custom headers and account-session inheritance are forbidden. Inspect the structured per-assertion report and distinguish transport coverage errors from product assertion failures. Applying the same file to hosted monitoring requires `features.aiEndpoints`; personal admission also requires a currently verified `httpAuth` binding; keep it paused unless scheduling is authorized. This verifies a chosen fixture, not general agent quality or a calibrated semantic judge.\n\nFor a small set of representative prompts against the same endpoint, use `aiEndpoint.adapter: \"json-http-suite-v1\"` and `cases` with 1\u20135 objects containing a stable unique `id`, readable `name`, positive `revision` (default 1), literal JSON-object `fixture`, and assertions and/or response schema. The suite `invocationBudget` equals its case count and is filled in when omitted. Validate offline and run the unchanged manifest locally before applying it; hosted capability `features.aiEndpointSuites` must be available. Cases run serially under one total monitor timeout. Assertion failures permit later cases; a transport/deadline error stops them as `not-run`. Inspect every case and coverage summary, not only the overall status. The controller reserves the full case count before any hosted request, and partial/uncertain runs retain that conservative allowance. Reported attempted requests can therefore be fewer than charged units. Deterministic suites do not provide semantic grading; do not describe text matching as semantic correctness. Single fixtures and each suite case can opt into literal variables with variables:{name:\"string\"} and exact {{name}} placeholders inside fixture string values. Without variables, braces remain literal. Use at most 16 names, ASCII letter followed by letters/digits/underscores (64 characters); prototype-related names are refused. Each value fits 4 KiB UTF-8, maps and rendered fixtures 16 KiB and complete configurations 64 KiB. No expressions, environment lookup, key/URL/assertion/rubric interpolation, matrix expansion or recursive replacement is supported. Missing/malformed placeholders reject before requests. Use non-secret data. Validate locally and preview before applying: exports keep authored maps while enqueue freezes rendered literal requests. Release comparisons use effective rendered bodies, so a changed variable value can be a changed policy even with the same case revision.\n\nFor optional semantic endpoint grading, use `json-http-graded-suite-v1`, portable schemaVersion 2 and explicit context (even the default project/environment). Set the top-level `judge` connectionId/configurationRevision/model/budget and add a rubric to each selected case: stable id/revision, criteria, outputPath, threshold and optional reference examples. Keep target credentials separate from judge keys. Hosted use requires `features.endpointJudges`; local use accepts the same private `--connections-file` map without an account, UI or E2E runtime. Only the selected output and rubric criteria/examples reach the judge. Known echoed managed product keys are refused before grading. Inspect score, verdict, rubric hash and private model-usage.json: malformed/unavailable/unknown/over-budget grading is inconclusive coverage and cannot pass or recover a product incident. There are no retries or fallback models. Every report currently marks calibration unverified; labelled reference examples do not prove accuracy. Keep calibration, pricing and release acceptance distinct from a controlled protocol pass.\n\nTo measure a rubric against labelled examples, use `monitor calibrate --id ID --file REQUEST_JSON` for a saved hosted monitor, then `monitor calibrations --id ID` or `monitor calibration --id ID --calibration-id ID` to inspect retained measurements. The request contains `caseId`, `dataset` and optional `repeats`. For account-free local measurement, use `run calibrate --file MONITOR --case-id CASE --dataset DATASET --connections-file PRIVATE_MAP`; `--dataset` is the dataset object alone. Use 2\u20134 fictional labelled outputs and 1\u20133 repeats, within the saved judge call/token budget and a total 30-second ceiling. Calibration calls only the judge, not the product endpoint, and creates no health runs, incidents or recovery. Keep known keys out of dataset/rubric identifiers, object keys and content as well as prompts. Inspect agreement over valid evaluated decisions, disagreement, repeat instability and technical coverage errors separately. A valid expected inconclusive can agree; a provider error cannot. Inspect private model usage for actual reservations. Exit 4 means disagreement, instability or coverage failure; never erase those results to obtain a green check. A small successful sample applies only to its exact dataset/rubric/model identity and does not establish general accuracy or automatically change the monitor\u2019s unverified calibration label.\n\nFor release regressions, use `project compare --id PROJECT_ID --deployment-id DEPLOYMENT_ID` and follow the opaque `next` cursor with `--before`. AI rows include case-level comparisons from frozen queued definitions and retained structured reports. Inspect each case classification and compatibility reasons. A different fixture, assertion, rubric, judge model or policy identity cannot establish a product regression; do not compare numeric scores across changed policies. Missing/invalid reports and unexecuted cases are coverage gaps. Follow the owned run references for evidence. Last passing and first failure are useful only for the matching case policy; a pass from another case or rubric is not a reproduction baseline. Display-name changes and JSON object key order do not change the evaluation policy. Comparison is read-only and never schedules another paid request.\n\n## AI steps in browser and API scripts\n\nFor personal AI-assisted browser journeys, require both `features.ai` and `features.isolatedAi` alongside script admission. Keep the `ai` model connection binding optional; deterministic scripts need no model or provider key. Hosted personal runs always use server-owned isolated policy and an explicitly model-capable isolated worker. An older worker, withdrawn capability or missing connection is a coverage failure, never a reason to switch accounts or execute through a trusted lane. Use the same version-2 manifest locally with a private connection map before applying it paused. Only attempt-scoped broker authority enters the disposable runtime; upstream keys stay controller-side. Screenshots, page content and prompts used by AI steps reach the selected provider. Inspect native assertions plus authoritative model usage/error evidence; catching an SDK error does not make a run healthy. No browser login-state import or stored application credentials are supported by this capability. API scripts have no built-in screen observation engine: do not call screen-based agent.assert/waitFor/extract on API data. In manifest mode, import {assertGrade, grade} from \"#waitcher/ai\" and pass {data: selectedJsonOrText, rubric: criteria, threshold: 0.8}. The optional judgeModel grades the selected data, otherwise model is used. Keep expected facts in versioned fixtures; send no credentials or unnecessary response fields. Selected JSON is limited to 8 KiB and rubric to 2 KiB. grade returns {verdict,score}; assertGrade throws on non-pass. Any failure, valid inconclusive or technical grading error remains authoritative even when caught or ignored. Inspect private waitcher-data-grades.json alongside model usage and the native report. No retries/fallbacks occur. The alias survives monitor build and is supplied by run local --file and hosted script execution; standalone --project needs its own integration. Deterministic scripts need no binding; fixed endpoint fixtures can use the declarative graded adapter instead.\n\nFor an existing project's custom model setup, use `--project`. A schemaVersion 2 manifest with an `ai` binding can also run unchanged locally using `--connections-file /private/connections.json`, without login. The private map has schemaVersion 1 and a connections array; each record contains id, configurationRevision, provider openrouter (the only provider for AI scripts; anthropic connections serve hosted agent checks only), projectId, environmentId, allowed models and credentialFile. Credential paths resolve relative to the map. IDs/revisions/models and explicit manifest scope must match. Keep both map and key files private (chmod 600); inline keys, provider URLs and symlinks are refused. The selected runtime also needs ai@7.0.177. The complete CLI package ships model-client.mjs and notices; copying only cli.mjs is insufficient for bound AI execution.\n\nThe local manifest runner keeps the provider key in its parent and passes a temporary loopback grant to the test. It uses the hosted transport and per-run budget/outcome rules, but no hosted account/day ledger. Read model-usage.json as well as the native report: caught provider/budget failures may leave a native passed test while Waitcher correctly records error. Unknown usage stays reserved, SDK retries count separately, and local success does not verify hosted enablement or key freshness. Provider keys are not forwarded to the child, and literal temporary broker tokens are redacted from normal text evidence; trusted local code can read its filesystem and is not a sandbox. Traces default on, video stays opt-in.\n\nIn the project's `e2e.config.ts`, construct the chosen provider's AI SDK model under `agents.default.model`, following the installed framework's types. The provider reads its local key; a key alone does not configure a model. Never copy a user's provider key into a monitor manifest or use an operator's account key.\n\nMix exact assertions with selected `agent.act`, `agent.assert`, `agent.waitFor` and schema-bound `agent.extract` calls. AI operations may transmit screen content to the provider and incur cost; preserve the user's provider/call authorization. Step-level `maxModelCalls` is not a whole-run spending limit. Hosted connection/broker/budget support is separate and must be discovered from actual capabilities rather than assumed from a local run.\n\n## Protected product requests\n\nFor protected product operations, use monitor init --template protected-agent-outcome --request-policy-file POLICY.json --project-id UUID --environment-id UUID --file monitor.json. The public policy contains connections with id, canonical HTTPS origin and httpAuth references (targetId, credentialId, credentialRevision); operations with id, connection, method, path, optional static body, responsePointers and maxCalls; and budget.calls. Paths are fixed absolute paths with at most one whole {resourceId} UUID segment. Static JSON bodies may use only exact string leaves {{resourceId}}. Callers cannot choose URLs, methods, headers, bodies, query parameters or UUIDs. GET permits at most three calls, POST and DELETE one; DELETE requires the UUID path and POST must use the run identity. Limits are four connections, eight operations and eight total calls.\n\nThe protected starter requires submit POST, observe GET (three reads), cleanup DELETE, a five-call budget and response pointers /id, /correlationId, /title, /completed. Configure the static submission body to create a note with the parent-generated UUID in both id and correlationId, title Waitcher outcome check, and completed true. The optional #waitcher/requests SDK exposes requestOperation and requestResourceId. Responses contain status and a data map keyed by configured JSON pointers. The script never trusts the agent reply as proof of resulting state, never retries the action, and only cleans up independently proven run-owned state.\n\nLocal execution uses the existing --http-credentials-file private map: schemaVersion 1 and credentials entries with targetId, credentialId, credentialRevision, origin, header and credentialFile. Header is the credential header name (for example Authorization or X-Api-Key); its raw value stays in a separate private regular file. Map and key files require mode600 and exact reference/revision/origin matches. Keys stay in the CLI parent, never script, manifest, CLI arguments or custom environment. No account, app or AI provider is required locally. Keep request-runtime.mjs with the complete CLI package. For source projects use scriptFile, monitor build, then run local --file; standalone project mode does not inject the protected helper. Hosted use requires explicit capability and isolated execution even for administrators. Combined AI or browser-state bindings need their independent authority. Inspect request-usage.json, scenario and native reports. Caught budget errors, uncertain dispatch and unfinished calls cannot establish a healthy result; never replay mutations automatically.\n\nScenario request associations are optional recorded evidence. The request helper automatically records each issued request UUID on its originating phase. In a verify phase, call `scenario.referenceRequest(response.requestId)` for a request from an earlier completed observe phase in the same scenario; use the validated response envelope UUID, never an ID from response data. The protected starter references its last independent observation before asserting the business state. Read associations with `run scenarios`; `run diagnose` joins them to this run's request records and labels each ID `matched`, `not-found` or `unavailable`. These are script-reported phase associations. A matching controller row proves accounting correspondence, not the correctness of a phase or business outcome. Local matches remain local helper reports. Older evidence without association fields is not recorded, rather than an empty verified list. UNKNOWN requests remain charged and incomplete; no association authorizes mutation replay.\n";
63058
63298
 
63059
63299
  // ../../skills/waitcher/references/deploy.md
63060
- var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts follow their plan: checks every 30 minutes on starter, 5 on pro and 1 on business at the shortest; script monitors have a count, a shortest interval and runs a day that the running schedules must fit together (starter: one, every 2 hours or slower). Read `limits.minInterval` and `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e`, `@e2e-dev/web` (browser) and `esbuild` installed at the exact versions `waitcher runtime install` prints; `waitcher runtime install` sets them up and later upgrades them (ask before `--yes`). Before a runtime switch Waitcher tries every hosted check once on the next generation: `waitcher runtime trials` lists failed ones; fix their scripts before the switch date ([runtime updates](https://waitcher.dev/docs/runtime)). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `config validate --env NAME --verify [--key KEY]` runs that environment\'s script entries locally without an account. `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`. On a personal account only the first monitor\'s smoke starts (one manual run per 10 minutes); the rest are `skipped`, which is not a failure.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so export the same `CHECK_*` variables locally (never in files) or skip `--verify` for that monitor and rely on `--smoke`.\n\nListed values of at least 6 characters appear as `<secret:CHECK_NAME>` in reports, traces and logs; screenshots, video and transformed values are not masked. For a password or token typed into a page, prefer `fill(secrets.get("CHECK_NAME"))` (`import { secrets } from "e2e"`) over `process.env`: the value stays out of the test code and the run refuses `app.screenshot()` after that fill, so take screenshots before it or drop them. Read `process.env.CHECK_NAME` for values the script sends itself, such as API headers. Never log a value or assert on it.\n\n## Adopting existing monitors\n\nWhen a plan warns `ADOPTION_CANDIDATE`, an existing unmanaged monitor looks like the entry. Show it to the user (`waitcher monitor get --id ID`). If it is the same check, plan and apply with `--adopt KEY=MONITOR_ID`: it keeps its ID, history and pause state and takes the file\'s definition. Otherwise ignore the warning; apply creates a separate monitor.\n\n## Rollback\n\n`waitcher deploy list --project-id ID` shows deploys; `restorable:true` marks the latest 10 per environment. `waitcher deploy rollback --id DEPLOY_ID --dry-run` shows the plan, then run it with `--based-on`. Secrets are not rolled back. Tell the user to revert the repository too, or the next apply reintroduces the change.\n\n## CI\n\n`waitcher ci init [--env production] [--file waitcher.json]` writes `.github/workflows/waitcher.yml`: plan on pull requests, apply on pushes to the main branch. It installs the CLI from the server with a checksum and signs in with the `WAITCHER_TOKEN` repository secret. Create that token with read and write permissions (add run for `--smoke`) and `"projectId"` set to the project\'s ID (from `deploy plan`\'s `project.id`) using `waitcher token create`, so CI cannot touch other projects, and let the user store it with `gh secret set WAITCHER_TOKEN`. Signed in with a project token, read `authorization.projectName` from `waitcher auth status` and use it as `waitcher.json`\'s `project` (`config init --project-name NAME`); such a token changes monitors only through `deploy apply`, so do not try `monitor apply`. Set the `WAITCHER_SERVER` repository variable for a non-default server.\n';
63300
+ var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors in a repository with `waitcher.json`. The core workflow is in SKILL.md; this file holds the details. `waitcher doctor` confirms that the server supports deploys.\n\n## The file\n\n```json\n{\n "schemaVersion": 1,\n "project": "Shop",\n "environments": {\n "production": { "baseUrl": "https://shop.example" },\n "staging": { "baseUrl": "https://staging.shop.example" }\n },\n "defaults": { "interval": 1800, "timeout": 15 },\n "monitors": [\n { "key": "home", "type": "http", "path": "/", "settings": { "contains": "Shop" } },\n { "key": "tls", "type": "certificate" },\n { "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 },\n { "key": "orders-api", "type": "api", "entry": "monitoring/orders.e2e.ts",\n "settings": { "envNames": ["CHECK_ORDERS_TOKEN"] } },\n { "key": "nightly-export", "type": "heartbeat", "environments": ["production"],\n "heartbeat": { "graceSeconds": 300, "completionSeconds": 900 } }\n ]\n}\n```\n\n- `config init` starts with two example monitors (`home`: HTTP 200 on `/`; `tls`: certificate expiry). Keep, change or remove them.\n- Environment names match case-insensitively: `production` in the file is the project\'s default `Production` environment.\n- HTTP `settings`: `method`, `expectedStatus`, `contains`, `jsonPath` with `jsonValue`, `maxLatency` (ms), `headers`, `body`; certificates: `certificateMinDays` (default 14). `waitcher monitor init --type TYPE --file x.json` writes a complete example of any type.\n- A 30-minute interval suits HTTP, certificate and browser checks alike; certificates rarely need more often. Personal accounts follow their plan: checks every 30 minutes on starter, 5 on pro and 1 on business at the shortest; script monitors have a count, a shortest interval and runs a day that the running schedules must fit together (starter: one, every 2 hours or slower). Read `limits.minInterval` and `limits.isolatedScripts` in `system capabilities` before planning.\n- Entries are ordinary monitor definitions plus `key`, optional `environments` and optional `path` (resolved against `baseUrl`). Script and certificate targets default to `baseUrl`; heartbeats use the key as their label.\n- Never set `enabled`, `script`, `scriptFile`, `schemaVersion`, `context` or `demo` in entries.\n- Script tests read `process.env.TARGET_URL` (API) or call `app.open("/")` (browser), so one test serves every environment.\n- The directory holding `waitcher.json` must have `e2e`, `@e2e-dev/web` (browser) and `esbuild` installed at the exact versions `waitcher runtime install` prints; `waitcher runtime install` sets them up and keeps the project\'s generation (ask before `--yes`); `waitcher runtime upgrade` moves the project and, through its deploys, its checks to another generation (see Runtime upgrades in the skill, [runtime updates](https://waitcher.dev/docs/runtime)). Do not let dependency bots move these three packages. Tests may import project files and JSON; other packages fail with `BUILD_FAILED` naming the import. Replace them with project code, `fetch` or JSON data; do not vendor a dependency to get past the limit. A built script must fit 50,000 characters.\n\n## Plan and apply\n\n- `config validate --env NAME --verify [--key KEY]` runs that environment\'s script entries locally without an account. `deploy plan --env NAME [--verify]` changes nothing. `changes` lists `create`, `adopt`, `update` (with `fields`), `unchanged`, `delete`, `orphaned` and `invalid` per key.\n- `deploy apply --env NAME --based-on BASED_ON` applies the whole environment or nothing. `ok:false` exits 2 and writes nothing. A stale `--based-on` is `CONFLICT`: plan again and show the new plan.\n- The repository owns definitions; the server owns pause and resume. Managed monitors refuse edits through `monitor apply` or the web (`MANAGED_BY_CONFIG`); change the file instead.\n- Undeclared monitors stay as `orphaned` warnings. `--prune` deletes them and their history; use it only with the user\'s consent.\n- Deploy versions come from the Git commit (`-dirty` when `waitcher.json` has uncommitted changes). A configuration deploy is not a product release: runs show `context.deployment` only for markers recorded with `waitcher deployment record`.\n- `--smoke` runs each created, adopted or updated monitor once on the server after apply. A failed smoke leaves the deploy applied and exits 4; follow `next` to `run diagnose`. On a personal account only the first monitor\'s smoke starts (one manual run per 10 minutes); the rest are `skipped`, which is not a failure.\n\n## Secrets\n\nScripts list `CHECK_*` names in `settings.envNames`. Values live per project environment on the server:\n\n```sh\nprintf %s "$VALUE" | waitcher secret set --env staging --name CHECK_ORDERS_TOKEN --value-stdin\nwaitcher secret list --env staging\n```\n\nAsk the user for each value, or tell them the command to run themselves. Never echo, log or commit it. A plan reports `SECRET_MISSING` with the missing names. `--verify` runs with your local environment, so 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';
63061
63301
 
63062
63302
  // ../../skills/waitcher/references/diagnosis.md
63063
63303
  var diagnosis_default = '# Diagnosing failures\n\nRead when a local, smoke or scheduled run failed or errored.\n\nFor "since when" or "how often" questions, `waitcher monitor history --id ID` gives 13 months of daily runs, failures, availability and p50/p95 for one monitor, and `waitcher report history` sums the account by month and monitor; individual runs and evidence only go back as far as the plan keeps them.\n\n## Diagnose and reproduce a retained run\n\nConfirm `features.runDiagnosis` for hosted support. Use `run diagnose --id RUN_ID` for a readable hosted packet, or add `--json` for the shared structured report. Use `run diagnose --directory PRIVATE_RUN_DIRECTORY` without an account to inspect indexed local evidence. Hosted request states come from the controller ledger; local helper observations are explicitly local and do not attest hosted accounting. A known response does not prove task success, and an unknown action may have taken effect. Do not automatically repeat a mutation because its result is unknown.\n\nA historical pass is useful only when the frozen verification policy matches. Changed scripts, targets, deadlines or protected-operation policies cannot supply a matching reference. History searches are bounded; unavailable or truncated history is not proof that the product never passed. Stored artifact checksums are metadata; inspect the actual artifact when needed. Scenario evidence is checked against its recorded checksum before display.\n\nFor a completed supported hosted script, `run reproduce --id RUN_ID --output NEW_DIRECTORY` prepares its frozen configuration in a new private folder. It never executes the test or retrieves the current edited monitor. Inspect `monitor.json` and `provenance.json`, then deliberately run `run local --file NEW_DIRECTORY/monitor.json --output FRESH_RUN_DIRECTORY` with the matching installed runtime, optionally `--runtime PROJECT`. Reproduction is a fresh run with separate provenance and does not replace the original evidence.\n\nManaged product credentials, AI keys and browser sessions are not exported. Supply existing private local mappings with `--http-credentials-file`, `--connections-file` and `--browser-identities-file` where required. Authored scripts and literal configuration can themselves be sensitive, so keep the reproduction private. Operator-injected headers, bodies or environment state make this initial portable preparation unavailable rather than silently changing the test. Older local runs without an indexed frozen manifest remain inspectable but cannot establish a captured reproduction policy.\n';
@@ -63069,9 +63309,9 @@ var optional_capabilities_default = '# Optional capabilities\n\nRead only when c
63069
63309
  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';
63070
63310
 
63071
63311
  // src/skill.ts
63072
- import { lstat as lstat9, mkdir as mkdir8, readFile as readFile8, rm as rm6, writeFile as writeFile9 } from "node:fs/promises";
63312
+ import { lstat as lstat9, mkdir as mkdir8, readFile as readFile9, rm as rm6, writeFile as writeFile9 } from "node:fs/promises";
63073
63313
  import { homedir } from "node:os";
63074
- import { join as join13, resolve as resolve14 } from "node:path";
63314
+ import { join as join14, resolve as resolve14 } from "node:path";
63075
63315
  var references = {
63076
63316
  "authoring.md": authoring_default,
63077
63317
  "ai-and-agents.md": ai_and_agents_default,
@@ -63085,29 +63325,29 @@ var SkillInstallError = class extends Error {
63085
63325
  };
63086
63326
  async function installSkill(options) {
63087
63327
  const parent = resolve14(
63088
- options.path ?? (options.global ? join13(homedir(), ".claude", "skills") : join13(process.cwd(), ".claude", "skills"))
63328
+ options.path ?? (options.global ? join14(homedir(), ".claude", "skills") : join14(process.cwd(), ".claude", "skills"))
63089
63329
  );
63090
- const directory = join13(parent, "waitcher");
63330
+ const directory = join14(parent, "waitcher");
63091
63331
  const existing = await lstat9(directory).catch(() => null);
63092
63332
  let previousVersion = null;
63093
63333
  if (existing) {
63094
- const marker2 = existing.isDirectory() ? await readFile8(join13(directory, MARKER), "utf8").catch(() => null) : null;
63334
+ const marker2 = existing.isDirectory() ? await readFile9(join14(directory, MARKER), "utf8").catch(() => null) : null;
63095
63335
  if (marker2 === null)
63096
63336
  throw new SkillInstallError(
63097
63337
  `${directory} exists and was not installed by waitcher. Remove it or choose another --path.`
63098
63338
  );
63099
63339
  previousVersion = String(JSON.parse(marker2).version ?? "unknown");
63100
63340
  for (const owned of ["SKILL.md", "references", "agents", MARKER])
63101
- await rm6(join13(directory, owned), { recursive: true, force: true });
63341
+ await rm6(join14(directory, owned), { recursive: true, force: true });
63102
63342
  }
63103
- await mkdir8(join13(directory, "references"), { recursive: true });
63104
- await mkdir8(join13(directory, "agents"), { recursive: true });
63105
- await writeFile9(join13(directory, "SKILL.md"), SKILL_default);
63343
+ await mkdir8(join14(directory, "references"), { recursive: true });
63344
+ await mkdir8(join14(directory, "agents"), { recursive: true });
63345
+ await writeFile9(join14(directory, "SKILL.md"), SKILL_default);
63106
63346
  for (const [name5, text4] of Object.entries(references))
63107
- await writeFile9(join13(directory, "references", name5), text4);
63108
- await writeFile9(join13(directory, "agents/openai.yaml"), openai_default);
63347
+ await writeFile9(join14(directory, "references", name5), text4);
63348
+ await writeFile9(join14(directory, "agents/openai.yaml"), openai_default);
63109
63349
  await writeFile9(
63110
- join13(directory, MARKER),
63350
+ join14(directory, MARKER),
63111
63351
  JSON.stringify({ name: "waitcher", version: options.version }) + "\n"
63112
63352
  );
63113
63353
  return {
@@ -63122,16 +63362,16 @@ async function installSkill(options) {
63122
63362
  "agents/openai.yaml"
63123
63363
  ],
63124
63364
  next: options.path || options.global ? ["Run waitcher skill install again after upgrading the CLI."] : [
63125
- `Commit ${join13(".claude", "skills", "waitcher")} so every agent working in this repository finds it.`,
63365
+ `Commit ${join14(".claude", "skills", "waitcher")} so every agent working in this repository finds it.`,
63126
63366
  "Run waitcher skill install again after upgrading the CLI."
63127
63367
  ]
63128
63368
  };
63129
63369
  }
63130
63370
 
63131
63371
  // src/doctor.ts
63132
- import { access as access2, readFile as readFile9 } from "node:fs/promises";
63372
+ import { access as access2, readFile as readFile10 } from "node:fs/promises";
63133
63373
  import { homedir as homedir2 } from "node:os";
63134
- import { dirname as dirname13, join as join14 } from "node:path";
63374
+ import { dirname as dirname14, join as join15 } from "node:path";
63135
63375
  var exists = (path2) => access2(path2).then(
63136
63376
  () => true,
63137
63377
  () => false
@@ -63194,7 +63434,7 @@ async function doctor(options) {
63194
63434
  status: errors.length ? "error" : "warning",
63195
63435
  message: built.issues.map((i) => `${i.code}${i.monitor ? ` (${i.monitor})` : ""}: ${i.message}`).join("; "),
63196
63436
  next: [
63197
- ...runtime2 ? [`waitcher runtime install --file ${path2} (lists the steps; --yes after the user agrees)`] : [],
63437
+ ...runtime2 ? [`waitcher runtime upgrade --file ${path2} (lists the steps; --yes after the user agrees)`] : [],
63198
63438
  ...new Set(
63199
63439
  built.issues.filter((i) => !i.code.startsWith("RUNTIME_")).map((i) => i.hint).filter(Boolean)
63200
63440
  )
@@ -63207,31 +63447,31 @@ async function doctor(options) {
63207
63447
  );
63208
63448
  }
63209
63449
  }
63210
- const root = path2 ? dirname13(path2) : process.cwd();
63450
+ const root = path2 ? dirname14(path2) : process.cwd();
63211
63451
  const folders = [root];
63212
- for (let dir = root; !await exists(join14(dir, ".git")); ) {
63213
- const parent = dirname13(dir);
63452
+ for (let dir = root; !await exists(join15(dir, ".git")); ) {
63453
+ const parent = dirname14(dir);
63214
63454
  if (parent === dir) break;
63215
63455
  folders.push(dir = parent);
63216
63456
  }
63217
63457
  const skillHomes = [
63218
- join14(root, ".claude", "skills", "waitcher"),
63219
- join14(homedir2(), ".claude", "skills", "waitcher"),
63220
- join14(root, ".agents", "skills", "waitcher"),
63221
- join14(process.env.CODEX_HOME ?? join14(homedir2(), ".codex"), "skills", "waitcher"),
63458
+ join15(root, ".claude", "skills", "waitcher"),
63459
+ join15(homedir2(), ".claude", "skills", "waitcher"),
63460
+ join15(root, ".agents", "skills", "waitcher"),
63461
+ join15(process.env.CODEX_HOME ?? join15(homedir2(), ".codex"), "skills", "waitcher"),
63222
63462
  ...folders.slice(1).flatMap((dir) => [
63223
- join14(dir, ".claude", "skills", "waitcher"),
63224
- join14(dir, ".agents", "skills", "waitcher")
63463
+ join15(dir, ".claude", "skills", "waitcher"),
63464
+ join15(dir, ".agents", "skills", "waitcher")
63225
63465
  ])
63226
63466
  ];
63227
63467
  const installed = [], stale = [];
63228
63468
  for (const home of skillHomes) {
63229
- if (!await exists(join14(home, "SKILL.md"))) continue;
63469
+ if (!await exists(join15(home, "SKILL.md"))) continue;
63230
63470
  installed.push(home);
63231
- const marker2 = await readFile9(join14(home, ".waitcher-skill.json"), "utf8").then((text4) => JSON.parse(text4)).catch(() => null);
63471
+ const marker2 = await readFile10(join15(home, ".waitcher-skill.json"), "utf8").then((text4) => JSON.parse(text4)).catch(() => null);
63232
63472
  if (marker2 && marker2.version !== options.version) stale.push(home);
63233
63473
  }
63234
- const install = root === process.cwd() ? "waitcher skill install" : `waitcher skill install --path ${join14(root, ".claude", "skills")}`;
63474
+ const install = root === process.cwd() ? "waitcher skill install" : `waitcher skill install --path ${join15(root, ".claude", "skills")}`;
63235
63475
  add(
63236
63476
  !installed.length ? {
63237
63477
  id: "skill",
@@ -63243,7 +63483,7 @@ async function doctor(options) {
63243
63483
  status: "warning",
63244
63484
  message: `Agent skill at ${stale.join(", ")} comes from another CLI version than ${options.version}`,
63245
63485
  next: stale.map(
63246
- (home) => home === skillHomes[0] ? install : home === skillHomes[1] ? "waitcher skill install --global" : `waitcher skill install --path ${dirname13(home)}`
63486
+ (home) => home === skillHomes[0] ? install : home === skillHomes[1] ? "waitcher skill install --global" : `waitcher skill install --path ${dirname14(home)}`
63247
63487
  )
63248
63488
  } : { id: "skill", status: "ok", message: `Agent skill at ${installed.join(", ")}` }
63249
63489
  );
@@ -63276,22 +63516,18 @@ async function doctor(options) {
63276
63516
  "Install the CLI the server offers (GET /downloads/cli.json, as the CI workflow does), then waitcher runtime install"
63277
63517
  ]
63278
63518
  });
63279
- const upcoming = capabilities.runtimeGeneration?.next;
63280
- if (upcoming) {
63281
- const trials = await api("runtime").then((data) => data.trials ?? []).catch(() => []);
63282
- const failed = trials.filter((t) => t.status === "failed");
63283
- add(
63284
- failed.length ? {
63285
- id: "runtime-trial",
63286
- status: "warning",
63287
- message: `Hosted checks move to runtime ${upcoming.id} on ${upcoming.switchAt}; ${failed.map((t) => t.name).join(", ")} failed on it`,
63288
- next: ["waitcher runtime trials (the errors), fix and apply the scripts before the switch"]
63289
- } : {
63290
- id: "runtime-trial",
63291
- status: "ok",
63292
- message: `Hosted checks move to runtime ${upcoming.id} on ${upcoming.switchAt}; ${trials.filter((t) => t.status === "passed").length} of ${trials.length} checks passed on it so far`
63293
- }
63294
- );
63519
+ const newest = capabilities.runtimeGeneration?.id;
63520
+ const projectRuntime = built?.runtime;
63521
+ if (newest && projectRuntime && projectRuntime !== newest) {
63522
+ const ends = (capabilities.runtimeGeneration?.supported ?? []).find(
63523
+ (g) => g.id === projectRuntime
63524
+ )?.endsAt;
63525
+ add({
63526
+ id: "runtime-generation",
63527
+ status: "ok",
63528
+ message: `This project runs runtime ${projectRuntime}${ends ? `, supported until ${ends}` : ""}; ${newest} is available`,
63529
+ next: [`waitcher runtime upgrade --file ${path2} (what changed, how your checks did on ${newest} and the steps)`]
63530
+ });
63295
63531
  }
63296
63532
  const features = capabilities.features ?? {};
63297
63533
  const scripts = path2 ? scriptEntries(config2) : [];
@@ -63319,7 +63555,8 @@ async function doctor(options) {
63319
63555
  config: config2,
63320
63556
  environment,
63321
63557
  dryRun: true,
63322
- ...built && Object.keys(built.scripts).length ? { scripts: built.scripts } : {}
63558
+ ...built && Object.keys(built.scripts).length ? { scripts: built.scripts } : {},
63559
+ ...built?.runtime ? { runtime: built.runtime } : {}
63323
63560
  }
63324
63561
  });
63325
63562
  const errors = plan.issues.filter((i) => i.severity === "error");
@@ -63354,7 +63591,7 @@ function olderVersion(a, b) {
63354
63591
  // src/ci.ts
63355
63592
  import { execFile as execFile2 } from "node:child_process";
63356
63593
  import { mkdir as mkdir9 } from "node:fs/promises";
63357
- import { dirname as dirname14, relative as relative3, resolve as resolve15 } from "node:path";
63594
+ import { dirname as dirname15, relative as relative4, resolve as resolve15 } from "node:path";
63358
63595
  import { promisify as promisify2 } from "node:util";
63359
63596
  async function defaultBranch(cwd) {
63360
63597
  try {
@@ -63371,10 +63608,10 @@ async function defaultBranch(cwd) {
63371
63608
  async function initWorkflow(options) {
63372
63609
  const root = process.cwd();
63373
63610
  const output2 = resolve15(options.output ?? ".github/workflows/waitcher.yml");
63374
- const config2 = relative3(root, options.config) || "waitcher.json";
63611
+ const config2 = relative4(root, options.config) || "waitcher.json";
63375
63612
  if (config2.startsWith(".."))
63376
63613
  throw new Error("Run ci init from the repository root that contains waitcher.json.");
63377
- const project = dirname14(config2);
63614
+ const project = dirname15(config2);
63378
63615
  const branch = options.branch ?? await defaultBranch(root);
63379
63616
  const env = options.env;
63380
63617
  const yaml = `# Generated by waitcher ci init. Plans on pull requests, applies on ${branch}.
@@ -63426,7 +63663,7 @@ jobs:
63426
63663
  if: github.event_name == 'push'
63427
63664
  run: waitcher deploy apply --file ${JSON.stringify(config2)} --env ${JSON.stringify(env)}
63428
63665
  `;
63429
- await mkdir9(dirname14(output2), { recursive: true });
63666
+ await mkdir9(dirname15(output2), { recursive: true });
63430
63667
  await writeText(output2, yaml);
63431
63668
  return {
63432
63669
  event: "workflow_initialized",
@@ -63442,8 +63679,8 @@ jobs:
63442
63679
  }
63443
63680
 
63444
63681
  // src/main.ts
63445
- import { readFile as readFile11, open as open18, lstat as lstat12, unlink as unlink5 } from "node:fs/promises";
63446
- import { basename as basename3, dirname as dirname17, join as join16, resolve as resolve17 } from "node:path";
63682
+ import { readFile as readFile12, open as open18, lstat as lstat12, unlink as unlink5 } from "node:fs/promises";
63683
+ import { basename as basename3, dirname as dirname18, join as join17, resolve as resolve17 } from "node:path";
63447
63684
  import { constants as constants13 } from "node:fs";
63448
63685
 
63449
63686
  // ../../src/contracts/account-deletion.ts
@@ -63717,7 +63954,7 @@ var incidentEditSchema = external_exports.object({
63717
63954
 
63718
63955
  // src/access.ts
63719
63956
  import { lstat as lstat10, open as open16, unlink as unlink3 } from "node:fs/promises";
63720
- import { dirname as dirname15, resolve as resolve16 } from "node:path";
63957
+ import { dirname as dirname16, resolve as resolve16 } from "node:path";
63721
63958
  function accessTokenInput(text4) {
63722
63959
  let token = text4.trim();
63723
63960
  if (token.startsWith("{")) {
@@ -63742,7 +63979,7 @@ async function issueToFile(path2, issue3) {
63742
63979
  "VALIDATION_ERROR",
63743
63980
  2
63744
63981
  );
63745
- const file2 = resolve16(path2), directory = await lstat10(dirname15(file2));
63982
+ const file2 = resolve16(path2), directory = await lstat10(dirname16(file2));
63746
63983
  if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
63747
63984
  throw new ServiceError(
63748
63985
  "Token output requires an existing private directory (chmod 700).",
@@ -63787,8 +64024,8 @@ import { spawn as spawn3 } from "node:child_process";
63787
64024
  // src/session.ts
63788
64025
  import { createHash as createHash11, randomUUID as randomUUID7 } from "node:crypto";
63789
64026
  import { homedir as homedir3 } from "node:os";
63790
- import { dirname as dirname16, join as join15 } from "node:path";
63791
- import { mkdir as mkdir10, lstat as lstat11, open as open17, readFile as readFile10, rename, unlink as unlink4 } from "node:fs/promises";
64027
+ import { dirname as dirname17, join as join16 } from "node:path";
64028
+ import { mkdir as mkdir10, lstat as lstat11, open as open17, readFile as readFile11, rename, unlink as unlink4 } from "node:fs/promises";
63792
64029
  function serverUrl(value2) {
63793
64030
  let url3;
63794
64031
  try {
@@ -63805,8 +64042,8 @@ function serverUrl(value2) {
63805
64042
  return url3.origin;
63806
64043
  }
63807
64044
  function sessionPath(server) {
63808
- return join15(
63809
- process.env.WAITCHER_CONFIG_DIR || join15(homedir3(), ".config", "waitcher"),
64045
+ return join16(
64046
+ process.env.WAITCHER_CONFIG_DIR || join16(homedir3(), ".config", "waitcher"),
63810
64047
  createHash11("sha256").update(server).digest("hex").slice(0, 24) + ".json"
63811
64048
  );
63812
64049
  }
@@ -63821,13 +64058,13 @@ async function privatePath(path2, directory = false) {
63821
64058
  }
63822
64059
  async function readPrivate(path2) {
63823
64060
  await privatePath(path2);
63824
- return readFile10(path2, "utf8");
64061
+ return readFile11(path2, "utf8");
63825
64062
  }
63826
64063
  async function loadSession(server) {
63827
64064
  const path2 = sessionPath(server);
63828
64065
  let text4;
63829
64066
  try {
63830
- await privatePath(dirname16(path2), true);
64067
+ await privatePath(dirname17(path2), true);
63831
64068
  text4 = await readPrivate(path2);
63832
64069
  } catch (cause) {
63833
64070
  const error62 = asError(cause);
@@ -63890,7 +64127,7 @@ async function writeSession(server, value2) {
63890
64127
  const { expiresAt: expiresAt2 } = value2;
63891
64128
  if (Buffer.byteLength(JSON.stringify(value2)) > 8192)
63892
64129
  throw new Error("Session is too large.");
63893
- const path2 = sessionPath(server), directory = dirname16(path2);
64130
+ const path2 = sessionPath(server), directory = dirname17(path2);
63894
64131
  await mkdir10(directory, { recursive: true, mode: 448 });
63895
64132
  await privatePath(directory, true);
63896
64133
  try {
@@ -63899,7 +64136,7 @@ async function writeSession(server, value2) {
63899
64136
  const error62 = asError(cause);
63900
64137
  if (error62.code !== "ENOENT") throw error62;
63901
64138
  }
63902
- const temp = join15(directory, `.session-${randomUUID7()}.tmp`);
64139
+ const temp = join16(directory, `.session-${randomUUID7()}.tmp`);
63903
64140
  try {
63904
64141
  const file2 = await open17(temp, "wx", 384);
63905
64142
  try {
@@ -63918,7 +64155,7 @@ async function writeSession(server, value2) {
63918
64155
  }
63919
64156
  async function forgetSession(server) {
63920
64157
  try {
63921
- await privatePath(dirname16(sessionPath(server)), true);
64158
+ await privatePath(dirname17(sessionPath(server)), true);
63922
64159
  await privatePath(sessionPath(server));
63923
64160
  await unlink4(sessionPath(server));
63924
64161
  } catch (cause) {
@@ -63943,10 +64180,10 @@ async function saveWorkspace(server, workspace) {
63943
64180
  });
63944
64181
  return;
63945
64182
  }
63946
- const directory = dirname16(path2);
64183
+ const directory = dirname17(path2);
63947
64184
  await mkdir10(directory, { recursive: true, mode: 448 });
63948
64185
  await privatePath(directory, true);
63949
- const temp = join15(directory, `.workspace-${randomUUID7()}.tmp`);
64186
+ const temp = join16(directory, `.workspace-${randomUUID7()}.tmp`);
63950
64187
  try {
63951
64188
  const file2 = await open17(temp, "wx", 384);
63952
64189
  try {
@@ -64323,10 +64560,11 @@ Repository deploys (waitcher.json)
64323
64560
  Write a starter file; never overwrite
64324
64561
  config schema Print the JSON Schema of waitcher.json (offline)
64325
64562
  runtime install [--file waitcher.json] [--browser] [--yes]
64326
- Pin the project to the hosted runtime: package.json, npm
64327
- install, Chromium for browser entries. Without --yes it only
64328
- lists the steps. Rerun after a CLI update to upgrade
64329
- runtime trials [--retry MONITOR_ID] Checks that fail on the next runtime, before its switch
64563
+ Pin package.json, npm install, Chromium; without --yes
64564
+ it only lists the steps
64565
+ runtime upgrade [--to GENERATION] [--yes]
64566
+ Move to another runtime when you choose; repeat until current
64567
+ runtime trials [--retry MONITOR_ID] How your checks did on the newest runtime
64330
64568
  config validate [--file PATH] [--env NAME]
64331
64569
  Resolve every environment offline; exit 2 on errors
64332
64570
  config validate --env NAME --verify [--key KEY]...
@@ -64979,6 +65217,7 @@ async function main() {
64979
65217
  enable: { type: "boolean" },
64980
65218
  "dry-run": { type: "boolean" },
64981
65219
  yes: { type: "boolean" },
65220
+ to: { type: "string" },
64982
65221
  yearly: { type: "boolean" },
64983
65222
  trial: { type: "boolean" },
64984
65223
  browser: { type: "boolean" },
@@ -65151,6 +65390,7 @@ async function main() {
65151
65390
  "config schema": [],
65152
65391
  "runtime install": ["file", "browser", "yes"],
65153
65392
  "runtime trials": ["retry"],
65393
+ "runtime upgrade": ["file", "env", "to", "yes"],
65154
65394
  "deploy plan": ["file", "env", "prune", "activate-new", "verify", "adopt"],
65155
65395
  "deploy rollback": ["id", "dry-run", "prune", "based-on"],
65156
65396
  "secret list": ["file", "env"],
@@ -65347,7 +65587,7 @@ async function main() {
65347
65587
  await writeJson(
65348
65588
  file2,
65349
65589
  configExample(
65350
- v["project-name"] ?? basename3(dirname17(file2)),
65590
+ v["project-name"] ?? basename3(dirname18(file2)),
65351
65591
  v.target ? new URL(v.target).origin : "https://example.com"
65352
65592
  )
65353
65593
  );
@@ -65375,7 +65615,7 @@ async function main() {
65375
65615
  if (cause.code !== "FILE_NOT_FOUND") throw cause;
65376
65616
  }
65377
65617
  const result3 = await installRuntime({
65378
- project: dirname17(file2),
65618
+ project: dirname18(file2),
65379
65619
  browser,
65380
65620
  yes: Boolean(v.yes),
65381
65621
  signal: controller.signal
@@ -65684,7 +65924,7 @@ async function main() {
65684
65924
  if (!v.template && (v.type === "browser" || v.type === "api")) {
65685
65925
  const scriptFile = basename3(v.file).replace(/(\.monitor)?\.json$/, "") + ".e2e.ts";
65686
65926
  await writeText(
65687
- join16(dirname17(v.file), scriptFile),
65927
+ join17(dirname18(v.file), scriptFile),
65688
65928
  v.type === "api" ? apiScriptExample : browserScriptExample
65689
65929
  );
65690
65930
  await writeJson(v.file, {
@@ -66182,7 +66422,7 @@ async function main() {
66182
66422
  usage2(
66183
66423
  "Provide --output with a new private receipt file before confirming deletion."
66184
66424
  );
66185
- const file2 = resolve17(v.output), directory = await lstat12(dirname17(file2));
66425
+ const file2 = resolve17(v.output), directory = await lstat12(dirname18(file2));
66186
66426
  if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
66187
66427
  usage2(
66188
66428
  "Receipt output needs an existing private directory (chmod 700)."
@@ -66209,7 +66449,7 @@ async function main() {
66209
66449
  }) + "\n"
66210
66450
  );
66211
66451
  await handle.sync();
66212
- const parentDirectory = await open18(dirname17(file2), constants13.O_RDONLY);
66452
+ const parentDirectory = await open18(dirname18(file2), constants13.O_RDONLY);
66213
66453
  try {
66214
66454
  await parentDirectory.sync();
66215
66455
  } finally {
@@ -66317,7 +66557,7 @@ async function main() {
66317
66557
  if (!v.file) usage2("Provide --file with a new private tar output path.");
66318
66558
  const seconds = integer2(v.timeout ?? "90", "timeout", 1, 180);
66319
66559
  const destination = resolve17(v.file);
66320
- const directory = await lstat12(dirname17(destination));
66560
+ const directory = await lstat12(dirname18(destination));
66321
66561
  if (!directory.isDirectory() || directory.isSymbolicLink() || process.platform !== "win32" && directory.mode & 63)
66322
66562
  usage2(
66323
66563
  "Account exports need an existing private output directory (chmod 700)."
@@ -66466,8 +66706,8 @@ async function main() {
66466
66706
  constants13.O_RDONLY | constants13.O_NONBLOCK
66467
66707
  );
66468
66708
  try {
66469
- const stat = await file2.stat();
66470
- if (!stat.isFile() || stat.size > 4096)
66709
+ const stat2 = await file2.stat();
66710
+ if (!stat2.isFile() || stat2.size > 4096)
66471
66711
  usage2(
66472
66712
  "Account settings must be a regular JSON file of at most 4 KiB."
66473
66713
  );
@@ -66778,7 +67018,7 @@ async function main() {
66778
67018
  usage2(
66779
67019
  "Provide --file PATH with the complete configuration and expectedRevision for edits."
66780
67020
  );
66781
- const text4 = await readFile11(v.file, "utf8");
67021
+ const text4 = await readFile12(v.file, "utf8");
66782
67022
  if (Buffer.byteLength(text4) > 16e3)
66783
67023
  usage2("Project configuration exceeds 16 KB");
66784
67024
  let body2;
@@ -66856,6 +67096,8 @@ async function main() {
66856
67096
  ...version2 ? { version: version2 } : {},
66857
67097
  ...v["based-on"] === void 0 ? {} : { basedOn: v["based-on"] === "none" ? null : v["based-on"] },
66858
67098
  ...Object.keys(built.scripts).length ? { scripts: built.scripts } : {},
67099
+ // The generation the installed pins match: its checks run on it.
67100
+ ...built.runtime ? { runtime: built.runtime } : {},
66859
67101
  ...Object.keys(adopt).length ? { adopt } : {}
66860
67102
  }
66861
67103
  });
@@ -66911,14 +67153,14 @@ async function main() {
66911
67153
  event: apply ? deployed.applied ? "deployed" : "rejected" : "planned",
66912
67154
  file: path2,
66913
67155
  ...deployed,
66914
- // Local warnings (RUNTIME_VERSION_OUTDATED) travel with the server's issues.
67156
+ // Local warnings (RUNTIME_VERSION_ENDING) travel with the server's issues.
66915
67157
  issues: [...built.issues, ...deployed.issues],
66916
67158
  builds: built.builds,
66917
67159
  ...v.verify ? { verify: local.runs } : {},
66918
67160
  ...v.smoke ? { smoke } : {},
66919
67161
  next: [
66920
67162
  ...built.issues.length ? [
66921
- `waitcher runtime install --file ${path2} upgrades the project runtime before the previous pins stop working`
67163
+ `waitcher runtime upgrade --file ${path2} walks through the runtime change before the previous pins stop working`
66922
67164
  ] : [],
66923
67165
  ...deployNextSteps(deployed, {
66924
67166
  file: path2,
@@ -67028,7 +67270,7 @@ async function main() {
67028
67270
  if (!v.file) usage2("Provide --file PATH for the configuration.");
67029
67271
  let input2;
67030
67272
  try {
67031
- const text4 = await readFile11(v.file, "utf8");
67273
+ const text4 = await readFile12(v.file, "utf8");
67032
67274
  if (Buffer.byteLength(text4) > 96e3)
67033
67275
  usage2("Configuration exceeds 96 KB.");
67034
67276
  input2 = JSON.parse(text4);
@@ -67238,6 +67480,16 @@ async function main() {
67238
67480
  result2 = await api(
67239
67481
  `monitors/${id3(v.id)}/calibrations/${id3(v["calibration-id"])}`
67240
67482
  );
67483
+ } else if (command === "runtime upgrade") {
67484
+ result2 = await upgrade({
67485
+ file: v.file,
67486
+ env: v.env,
67487
+ to: v.to,
67488
+ yes: Boolean(v.yes),
67489
+ summary: await api("runtime"),
67490
+ origin: new URL(String(server)).origin,
67491
+ signal
67492
+ });
67241
67493
  } else if (command === "runtime trials") {
67242
67494
  if (v.retry)
67243
67495
  await api(`runtime/trials/${id3(v.retry)}/retry`, { method: "POST", body: {} });
@@ -67245,11 +67497,11 @@ async function main() {
67245
67497
  result2 = {
67246
67498
  event: "runtime_trials",
67247
67499
  generation: data.generation,
67248
- upcoming: data.next,
67500
+ generations: data.generations,
67249
67501
  trials: data.trials,
67250
- next: data.trials.some((t) => t.status === "failed") ? [
67251
- "Fix each failed check's script before next.switchAt and apply it; the trial runs again by itself",
67252
- "waitcher runtime trials --retry MONITOR_ID tries an unchanged check again"
67502
+ next: data.trials.length ? [
67503
+ "In the repository with waitcher.json: waitcher runtime upgrade shows what changed, these results and the steps to move",
67504
+ "waitcher runtime trials --retry MONITOR_ID previews an unchanged check again"
67253
67505
  ] : []
67254
67506
  };
67255
67507
  } else if (command === "monitor list") {
@@ -67521,7 +67773,7 @@ async function main() {
67521
67773
  if (!v.file) usage2("Provide --file PATH for the status page.");
67522
67774
  let input2;
67523
67775
  try {
67524
- const text4 = await readFile11(v.file, "utf8");
67776
+ const text4 = await readFile12(v.file, "utf8");
67525
67777
  if (Buffer.byteLength(text4) > 96e3)
67526
67778
  usage2("Configuration exceeds 96 KB.");
67527
67779
  input2 = JSON.parse(text4);