@debugbundle/cli 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +18 -0
  2. package/dist/main.cjs +667 -289
  3. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -1198,8 +1198,8 @@ var require_util = __commonJS({
1198
1198
  if (body == null) {
1199
1199
  return 0;
1200
1200
  } else if (isStream(body)) {
1201
- const state = body._readableState;
1202
- return state && state.objectMode === false && state.ended === true && Number.isFinite(state.length) ? state.length : null;
1201
+ const state2 = body._readableState;
1202
+ return state2 && state2.objectMode === false && state2.ended === true && Number.isFinite(state2.length) ? state2.length : null;
1203
1203
  } else if (isBlobLike(body)) {
1204
1204
  return body.size != null ? body.size : null;
1205
1205
  } else if (isBuffer(body)) {
@@ -5814,7 +5814,7 @@ var require_formdata = __commonJS({
5814
5814
  }
5815
5815
  }
5816
5816
  [nodeUtil.inspect.custom](depth, options) {
5817
- const state = this.#state.reduce((a, b) => {
5817
+ const state2 = this.#state.reduce((a, b) => {
5818
5818
  if (a[b.name]) {
5819
5819
  if (Array.isArray(a[b.name])) {
5820
5820
  a[b.name].push(b.value);
@@ -5828,7 +5828,7 @@ var require_formdata = __commonJS({
5828
5828
  }, { __proto__: null });
5829
5829
  options.depth ??= depth;
5830
5830
  options.colors ??= true;
5831
- const output2 = nodeUtil.formatWithOptions(options, state);
5831
+ const output2 = nodeUtil.formatWithOptions(options, state2);
5832
5832
  return `FormData ${output2.slice(output2.indexOf("]") + 2)}`;
5833
5833
  }
5834
5834
  static {
@@ -7989,8 +7989,8 @@ var require_client_h2 = __commonJS({
7989
7989
  return body == null || util4.isBuffer(body) || util4.isBlobLike(body);
7990
7990
  }
7991
7991
  function hasResponseStarted(request) {
7992
- const state = request[kRequestStream]?.[kRequestStreamState];
7993
- return state?.responseReceived === true;
7992
+ const state2 = request[kRequestStream]?.[kRequestStreamState];
7993
+ return state2?.responseReceived === true;
7994
7994
  }
7995
7995
  function registerGoAwayRefusal(request) {
7996
7996
  const attempts = (request[kGoAwayReplayAttempts] ?? 0) + 1;
@@ -8131,16 +8131,16 @@ var require_client_h2 = __commonJS({
8131
8131
  };
8132
8132
  }
8133
8133
  function refH2Session(session) {
8134
- const state = session[kHTTP2SessionState];
8135
- if (state.refed === false) {
8136
- state.refed = true;
8134
+ const state2 = session[kHTTP2SessionState];
8135
+ if (state2.refed === false) {
8136
+ state2.refed = true;
8137
8137
  session.ref();
8138
8138
  }
8139
8139
  }
8140
8140
  function unrefH2Session(session) {
8141
- const state = session[kHTTP2SessionState];
8142
- if (state.refed === true) {
8143
- state.refed = false;
8141
+ const state2 = session[kHTTP2SessionState];
8142
+ if (state2.refed === true) {
8143
+ state2.refed = false;
8144
8144
  session.unref();
8145
8145
  }
8146
8146
  }
@@ -8166,25 +8166,25 @@ var require_client_h2 = __commonJS({
8166
8166
  }
8167
8167
  }
8168
8168
  function clearNoStreamsTimeout(session) {
8169
- const state = session[kHTTP2SessionState];
8170
- if (state?.noStreamsTimeout != null) {
8171
- clearTimeout(state.noStreamsTimeout);
8172
- state.noStreamsTimeout = null;
8169
+ const state2 = session[kHTTP2SessionState];
8170
+ if (state2?.noStreamsTimeout != null) {
8171
+ clearTimeout(state2.noStreamsTimeout);
8172
+ state2.noStreamsTimeout = null;
8173
8173
  }
8174
8174
  }
8175
8175
  function setNoStreamsTimeout(session) {
8176
8176
  const client = session[kClient];
8177
- const state = session[kHTTP2SessionState];
8177
+ const state2 = session[kHTTP2SessionState];
8178
8178
  const timeout = client[kHeadersTimeout];
8179
- if (!timeout || state.noStreamsTimeout != null) {
8179
+ if (!timeout || state2.noStreamsTimeout != null) {
8180
8180
  return;
8181
8181
  }
8182
- state.noStreamsTimeout = setTimeout(onNoStreamsTimeout, timeout, session).unref();
8182
+ state2.noStreamsTimeout = setTimeout(onNoStreamsTimeout, timeout, session).unref();
8183
8183
  }
8184
8184
  function onNoStreamsTimeout(session) {
8185
8185
  const client = session[kClient];
8186
- const state = session[kHTTP2SessionState];
8187
- state.noStreamsTimeout = null;
8186
+ const state2 = session[kHTTP2SessionState];
8187
+ state2.noStreamsTimeout = null;
8188
8188
  if (client[kHTTP2Session] !== session || client[kMaxConcurrentStreams] !== 0 || client[kRunning] !== 0 || client[kPending] === 0) {
8189
8189
  return;
8190
8190
  }
@@ -8201,10 +8201,10 @@ var require_client_h2 = __commonJS({
8201
8201
  resetHttp2Session(session, err);
8202
8202
  }
8203
8203
  function clearHttp2IdleTimeout(session) {
8204
- const state = session[kHTTP2SessionState];
8205
- if (state?.idleTimeout != null) {
8206
- clearTimeout(state.idleTimeout);
8207
- state.idleTimeout = null;
8204
+ const state2 = session[kHTTP2SessionState];
8205
+ if (state2?.idleTimeout != null) {
8206
+ clearTimeout(state2.idleTimeout);
8207
+ state2.idleTimeout = null;
8208
8208
  }
8209
8209
  }
8210
8210
  function setHttp2IdleTimeout(session) {
@@ -8216,16 +8216,16 @@ var require_client_h2 = __commonJS({
8216
8216
  clearHttp2IdleTimeout(session);
8217
8217
  return;
8218
8218
  }
8219
- const state = session[kHTTP2SessionState];
8220
- if (state.idleTimeout == null) {
8221
- state.idleTimeout = setTimeout(onHttp2SessionIdleTimeout, client[kKeepAliveDefaultTimeout], session).unref();
8219
+ const state2 = session[kHTTP2SessionState];
8220
+ if (state2.idleTimeout == null) {
8221
+ state2.idleTimeout = setTimeout(onHttp2SessionIdleTimeout, client[kKeepAliveDefaultTimeout], session).unref();
8222
8222
  }
8223
8223
  }
8224
8224
  function onHttp2SessionIdleTimeout(session) {
8225
8225
  const client = session[kClient];
8226
8226
  const socket = session[kSocket];
8227
- const state = session[kHTTP2SessionState];
8228
- state.idleTimeout = null;
8227
+ const state2 = session[kHTTP2SessionState];
8228
+ state2.idleTimeout = null;
8229
8229
  if (client[kHTTP2Session] !== session || session[kOpenStreams] !== 0 || client[kSize] !== 0 || session.closed || session.destroyed) {
8230
8230
  return;
8231
8231
  }
@@ -8254,10 +8254,10 @@ var require_client_h2 = __commonJS({
8254
8254
  this[kClient][kResume]();
8255
8255
  }
8256
8256
  function onHttp2SendPing(session) {
8257
- const state = session[kHTTP2SessionState];
8258
- if ((session.closed || session.destroyed) && state.ping.interval != null) {
8259
- clearInterval(state.ping.interval);
8260
- state.ping.interval = null;
8257
+ const state2 = session[kHTTP2SessionState];
8258
+ if ((session.closed || session.destroyed) && state2.ping.interval != null) {
8259
+ clearInterval(state2.ping.interval);
8260
+ state2.ping.interval = null;
8261
8261
  return;
8262
8262
  }
8263
8263
  session.ping(onPing.bind(session));
@@ -8337,7 +8337,7 @@ var require_client_h2 = __commonJS({
8337
8337
  client[kResume]();
8338
8338
  }
8339
8339
  function onHttp2SessionClose() {
8340
- const { [kClient]: client, [kHTTP2SessionState]: state, [kSocket]: socket } = this;
8340
+ const { [kClient]: client, [kHTTP2SessionState]: state2, [kSocket]: socket } = this;
8341
8341
  const err = socket[kError] || this[kError] || new SocketError("closed", util4.getSocketInfo(socket));
8342
8342
  if (client[kHTTP2Session] === this) {
8343
8343
  client[kSocket] = null;
@@ -8346,9 +8346,9 @@ var require_client_h2 = __commonJS({
8346
8346
  }
8347
8347
  clearHttp2IdleTimeout(this);
8348
8348
  clearNoStreamsTimeout(this);
8349
- if (state.ping.interval != null) {
8350
- clearInterval(state.ping.interval);
8351
- state.ping.interval = null;
8349
+ if (state2.ping.interval != null) {
8350
+ clearInterval(state2.ping.interval);
8351
+ state2.ping.interval = null;
8352
8352
  }
8353
8353
  if (client.destroyed) {
8354
8354
  assert6(client[kPending] === 0);
@@ -8409,27 +8409,27 @@ var require_client_h2 = __commonJS({
8409
8409
  }
8410
8410
  function onUpgradeStreamClose() {
8411
8411
  this.off("error", noop);
8412
- const state = this[kRequestStreamState];
8412
+ const state2 = this[kRequestStreamState];
8413
8413
  this[kRequestStreamState] = null;
8414
- failUpgradeStream(state, new InformationalError("HTTP/2: stream closed before response headers"));
8414
+ failUpgradeStream(state2, new InformationalError("HTTP/2: stream closed before response headers"));
8415
8415
  closeStreamSession(this);
8416
8416
  }
8417
8417
  function completeRequestStream() {
8418
- const state = this[kRequestStreamState];
8419
- if (state == null) {
8418
+ const state2 = this[kRequestStreamState];
8419
+ if (state2 == null) {
8420
8420
  return;
8421
8421
  }
8422
8422
  releaseRequestStream(this);
8423
- if (state.pendingEnd && !state.request.aborted && !state.request.completed) {
8424
- state.request.onResponseEnd(state.trailers || {});
8425
- } else if (!state.request.aborted && !state.request.completed) {
8423
+ if (state2.pendingEnd && !state2.request.aborted && !state2.request.completed) {
8424
+ state2.request.onResponseEnd(state2.trailers || {});
8425
+ } else if (!state2.request.aborted && !state2.request.completed) {
8426
8426
  util4.errorRequest(
8427
- state.client,
8428
- state.request,
8427
+ state2.client,
8428
+ state2.request,
8429
8429
  new InformationalError("HTTP/2: stream closed before the response was complete")
8430
8430
  );
8431
8431
  }
8432
- finalizeRequest(state);
8432
+ finalizeRequest(state2);
8433
8433
  closeStreamSession(this);
8434
8434
  this[kRequestStreamState] = null;
8435
8435
  }
@@ -8471,11 +8471,11 @@ var require_client_h2 = __commonJS({
8471
8471
  if (stream == null) {
8472
8472
  return;
8473
8473
  }
8474
- const state = stream[kRequestStreamState];
8475
- if (state == null) {
8474
+ const state2 = stream[kRequestStreamState];
8475
+ if (state2 == null) {
8476
8476
  return;
8477
8477
  }
8478
- const { request } = state;
8478
+ const { request } = state2;
8479
8479
  if (request[kRequestStream] === stream) {
8480
8480
  detachRequestFromStream(request);
8481
8481
  }
@@ -8484,43 +8484,43 @@ var require_client_h2 = __commonJS({
8484
8484
  stream.once("error", noop);
8485
8485
  }
8486
8486
  }
8487
- function failUpgradeStream(state, err) {
8488
- if (state == null) {
8487
+ function failUpgradeStream(state2, err) {
8488
+ if (state2 == null) {
8489
8489
  return;
8490
8490
  }
8491
- const { request } = state;
8492
- if (state.responseReceived || request.aborted || request.completed) {
8491
+ const { request } = state2;
8492
+ if (state2.responseReceived || request.aborted || request.completed) {
8493
8493
  return;
8494
8494
  }
8495
- releaseUpgradeStream(state.stream);
8496
- state.abort(err, true);
8495
+ releaseUpgradeStream(state2.stream);
8496
+ state2.abort(err, true);
8497
8497
  }
8498
8498
  function onUpgradeStreamError() {
8499
- const state = this[kRequestStreamState];
8499
+ const state2 = this[kRequestStreamState];
8500
8500
  if (typeof this.rstCode === "number" && this.rstCode !== 0) {
8501
- failUpgradeStream(state, new InformationalError(`HTTP/2: "stream error" received - code ${this.rstCode}`));
8501
+ failUpgradeStream(state2, new InformationalError(`HTTP/2: "stream error" received - code ${this.rstCode}`));
8502
8502
  } else {
8503
- failUpgradeStream(state, new InformationalError("HTTP/2: stream errored before response headers"));
8503
+ failUpgradeStream(state2, new InformationalError("HTTP/2: stream errored before response headers"));
8504
8504
  }
8505
8505
  }
8506
8506
  function onUpgradeStreamEnd() {
8507
8507
  failUpgradeStream(this[kRequestStreamState], new InformationalError("HTTP/2: stream half-closed (remote)"));
8508
8508
  }
8509
8509
  function onUpgradeStreamTimeout() {
8510
- const state = this[kRequestStreamState];
8511
- failUpgradeStream(state, new InformationalError(`HTTP/2: "stream timeout after ${state.headersTimeout}"`));
8510
+ const state2 = this[kRequestStreamState];
8511
+ failUpgradeStream(state2, new InformationalError(`HTTP/2: "stream timeout after ${state2.headersTimeout}"`));
8512
8512
  }
8513
8513
  function onUpgradeResponse(headers, _flags) {
8514
8514
  const stream = this;
8515
- const state = stream[kRequestStreamState];
8516
- const { request } = state;
8517
- state.responseReceived = true;
8515
+ const state2 = stream[kRequestStreamState];
8516
+ const { request } = state2;
8517
+ state2.responseReceived = true;
8518
8518
  const statusCode = headers[HTTP2_HEADER_STATUS];
8519
8519
  delete headers[HTTP2_HEADER_STATUS];
8520
8520
  try {
8521
8521
  request.onRequestUpgrade(statusCode, headers, stream);
8522
8522
  } catch (err) {
8523
- state.abort(err);
8523
+ state2.abort(err);
8524
8524
  return;
8525
8525
  }
8526
8526
  if (request.aborted) {
@@ -8528,14 +8528,14 @@ var require_client_h2 = __commonJS({
8528
8528
  }
8529
8529
  removeUpgradeStreamListeners(stream);
8530
8530
  detachRequestFromStream(request);
8531
- finalizeRequest(state);
8531
+ finalizeRequest(state2);
8532
8532
  }
8533
- function setupUpgradeStream(stream, state) {
8534
- const { request, headersTimeout, session } = state;
8533
+ function setupUpgradeStream(stream, state2) {
8534
+ const { request, headersTimeout, session } = state2;
8535
8535
  stream[kHTTP2Stream] = true;
8536
8536
  stream[kHTTP2Session] = session;
8537
- stream[kRequestStreamState] = state;
8538
- state.stream = stream;
8537
+ stream[kRequestStreamState] = state2;
8538
+ state2.stream = stream;
8539
8539
  bindRequestToStream(request, stream, releaseUpgradeStream);
8540
8540
  stream.once("response", onUpgradeResponse);
8541
8541
  stream.on("error", onUpgradeStreamError);
@@ -8546,13 +8546,13 @@ var require_client_h2 = __commonJS({
8546
8546
  ++session[kOpenStreams];
8547
8547
  stream.setTimeout(headersTimeout);
8548
8548
  }
8549
- function finalizeRequest(state, resetPendingIdx = false) {
8550
- if (state.requestFinalized) {
8549
+ function finalizeRequest(state2, resetPendingIdx = false) {
8550
+ if (state2.requestFinalized) {
8551
8551
  return;
8552
8552
  }
8553
- state.requestFinalized = true;
8554
- completeRequest(state.client, state.request, resetPendingIdx);
8555
- state.client[kResume]();
8553
+ state2.requestFinalized = true;
8554
+ completeRequest(state2.client, state2.request, resetPendingIdx);
8555
+ state2.client[kResume]();
8556
8556
  }
8557
8557
  function openStream(client, request, session, abort, headers, options) {
8558
8558
  try {
@@ -8587,7 +8587,7 @@ var require_client_h2 = __commonJS({
8587
8587
  const headers = buildRequestHeaders(reqHeaders);
8588
8588
  headers[HTTP2_HEADER_AUTHORITY] = host || client[kHostAuthority];
8589
8589
  headers[HTTP2_HEADER_METHOD] = method;
8590
- const state = {
8590
+ const state2 = {
8591
8591
  abort: null,
8592
8592
  body: request.body,
8593
8593
  bytesRead: 0,
@@ -8613,19 +8613,19 @@ var require_client_h2 = __commonJS({
8613
8613
  }
8614
8614
  err = err || new RequestAbortedError();
8615
8615
  util4.errorRequest(client, request, err);
8616
- if (state.stream != null) {
8616
+ if (state2.stream != null) {
8617
8617
  clearRequestStream(request);
8618
- const stream2 = state.stream;
8618
+ const stream2 = state2.stream;
8619
8619
  stream2.close();
8620
8620
  if (!stream2.destroyed) {
8621
8621
  util4.destroy(stream2);
8622
8622
  }
8623
8623
  client[kOnError](err);
8624
- finalizeRequest(state, resetPendingIdx);
8624
+ finalizeRequest(state2, resetPendingIdx);
8625
8625
  }
8626
- util4.destroy(state.body, err);
8626
+ util4.destroy(state2.body, err);
8627
8627
  };
8628
- state.abort = abort;
8628
+ state2.abort = abort;
8629
8629
  let stream = null;
8630
8630
  try {
8631
8631
  request.onRequestStart(abort, null);
@@ -8656,7 +8656,7 @@ var require_client_h2 = __commonJS({
8656
8656
  unrefH2Session(session);
8657
8657
  return false;
8658
8658
  }
8659
- setupUpgradeStream(stream, state);
8659
+ setupUpgradeStream(stream, state2);
8660
8660
  return true;
8661
8661
  }
8662
8662
  stream = openStream(client, request, session, abort, headers, { endStream: false, signal });
@@ -8664,13 +8664,13 @@ var require_client_h2 = __commonJS({
8664
8664
  unrefH2Session(session);
8665
8665
  return false;
8666
8666
  }
8667
- setupUpgradeStream(stream, state);
8667
+ setupUpgradeStream(stream, state2);
8668
8668
  return true;
8669
8669
  }
8670
8670
  headers[HTTP2_HEADER_PATH] = path;
8671
8671
  headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
8672
8672
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
8673
- let body = state.body;
8673
+ let body = state2.body;
8674
8674
  if (body && typeof body.read === "function") {
8675
8675
  body.read(0);
8676
8676
  }
@@ -8709,9 +8709,9 @@ var require_client_h2 = __commonJS({
8709
8709
  channels.sendHeaders.publish({ request, headers: header2, socket: session[kSocket] });
8710
8710
  }
8711
8711
  const shouldEndStream = body === null || contentLength === 0;
8712
- state.body = body;
8713
- state.contentLength = contentLength;
8714
- state.expectsPayload = expectsPayload;
8712
+ state2.body = body;
8713
+ state2.contentLength = contentLength;
8714
+ state2.expectsPayload = expectsPayload;
8715
8715
  if (expectContinue) {
8716
8716
  headers[HTTP2_HEADER_EXPECT] = "100-continue";
8717
8717
  }
@@ -8720,8 +8720,8 @@ var require_client_h2 = __commonJS({
8720
8720
  return false;
8721
8721
  }
8722
8722
  stream[kHTTP2Stream] = true;
8723
- stream[kRequestStreamState] = state;
8724
- state.stream = stream;
8723
+ stream[kRequestStreamState] = state2;
8724
+ state2.stream = stream;
8725
8725
  clearHttp2IdleTimeout(session);
8726
8726
  ++session[kOpenStreams];
8727
8727
  if (headersTimeout) {
@@ -8765,11 +8765,11 @@ var require_client_h2 = __commonJS({
8765
8765
  if (stream == null) {
8766
8766
  return;
8767
8767
  }
8768
- const state = stream[kRequestStreamState];
8769
- if (state == null) {
8768
+ const state2 = stream[kRequestStreamState];
8769
+ if (state2 == null) {
8770
8770
  return;
8771
8771
  }
8772
- const { request } = state;
8772
+ const { request } = state2;
8773
8773
  if (request[kRequestStream] === stream) {
8774
8774
  detachRequestFromStream(request);
8775
8775
  }
@@ -8780,34 +8780,34 @@ var require_client_h2 = __commonJS({
8780
8780
  }
8781
8781
  function onData(chunk) {
8782
8782
  const stream = this;
8783
- const state = stream[kRequestStreamState];
8784
- if (state == null) {
8783
+ const state2 = stream[kRequestStreamState];
8784
+ if (state2 == null) {
8785
8785
  return;
8786
8786
  }
8787
- const { request, maxResponseSize, responseContentLength } = state;
8787
+ const { request, maxResponseSize, responseContentLength } = state2;
8788
8788
  if (request.aborted || request.completed) {
8789
8789
  return;
8790
8790
  }
8791
- if (responseContentLength != null && state.bytesRead + chunk.length > responseContentLength) {
8792
- state.abort(new ResponseContentLengthMismatchError());
8791
+ if (responseContentLength != null && state2.bytesRead + chunk.length > responseContentLength) {
8792
+ state2.abort(new ResponseContentLengthMismatchError());
8793
8793
  return;
8794
8794
  }
8795
- if (maxResponseSize > -1 && state.bytesRead + chunk.length > maxResponseSize) {
8796
- state.abort(new ResponseExceededMaxSizeError());
8795
+ if (maxResponseSize > -1 && state2.bytesRead + chunk.length > maxResponseSize) {
8796
+ state2.abort(new ResponseExceededMaxSizeError());
8797
8797
  return;
8798
8798
  }
8799
- state.bytesRead += chunk.length;
8799
+ state2.bytesRead += chunk.length;
8800
8800
  if (request.onResponseData(chunk) === false) {
8801
8801
  stream.pause();
8802
8802
  }
8803
8803
  }
8804
8804
  function onInterimResponse(headers) {
8805
8805
  const stream = this;
8806
- const state = stream[kRequestStreamState];
8807
- if (state == null) {
8806
+ const state2 = stream[kRequestStreamState];
8807
+ if (state2 == null) {
8808
8808
  return;
8809
8809
  }
8810
- const { request } = state;
8810
+ const { request } = state2;
8811
8811
  if (request.aborted || request.completed) {
8812
8812
  return;
8813
8813
  }
@@ -8817,26 +8817,26 @@ var require_client_h2 = __commonJS({
8817
8817
  }
8818
8818
  function onResponse(headers) {
8819
8819
  const stream = this;
8820
- const state = stream[kRequestStreamState];
8821
- if (state == null) {
8820
+ const state2 = stream[kRequestStreamState];
8821
+ if (state2 == null) {
8822
8822
  return;
8823
8823
  }
8824
- const { request } = state;
8824
+ const { request } = state2;
8825
8825
  stream.off("response", onResponse);
8826
- if (state.body != null && !state.bodySent && !stream.writableEnded) {
8826
+ if (state2.body != null && !state2.bodySent && !stream.writableEnded) {
8827
8827
  stream.removeListener("continue", writeBodyH2);
8828
8828
  stream.end();
8829
8829
  }
8830
8830
  const statusCode = Number(headers[HTTP2_HEADER_STATUS]);
8831
8831
  delete headers[HTTP2_HEADER_STATUS];
8832
8832
  request.onResponseStarted();
8833
- state.responseReceived = true;
8833
+ state2.responseReceived = true;
8834
8834
  if (request.method !== "HEAD" && statusCode !== 304) {
8835
8835
  const contentLength = headers[HTTP2_HEADER_CONTENT_LENGTH];
8836
- state.responseContentLength = contentLength == null ? null : Number(contentLength);
8836
+ state2.responseContentLength = contentLength == null ? null : Number(contentLength);
8837
8837
  }
8838
- if (state.headersTimeout || state.bodyTimeout) {
8839
- stream.setTimeout(state.bodyTimeout);
8838
+ if (state2.headersTimeout || state2.bodyTimeout) {
8839
+ stream.setTimeout(state2.bodyTimeout);
8840
8840
  }
8841
8841
  if (request.aborted || request.completed) {
8842
8842
  releaseRequestStream(stream);
@@ -8849,34 +8849,34 @@ var require_client_h2 = __commonJS({
8849
8849
  }
8850
8850
  function onEnd() {
8851
8851
  const stream = this;
8852
- const state = stream[kRequestStreamState];
8853
- if (state == null) {
8852
+ const state2 = stream[kRequestStreamState];
8853
+ if (state2 == null) {
8854
8854
  return;
8855
8855
  }
8856
- const { request } = state;
8856
+ const { request } = state2;
8857
8857
  stream.off("end", onEnd);
8858
- if (state.responseReceived) {
8858
+ if (state2.responseReceived) {
8859
8859
  if (!request.aborted && !request.completed) {
8860
- if (state.responseContentLength != null && state.bytesRead !== state.responseContentLength) {
8861
- state.abort(new ResponseContentLengthMismatchError());
8860
+ if (state2.responseContentLength != null && state2.bytesRead !== state2.responseContentLength) {
8861
+ state2.abort(new ResponseContentLengthMismatchError());
8862
8862
  return;
8863
8863
  }
8864
- state.pendingEnd = true;
8864
+ state2.pendingEnd = true;
8865
8865
  completeRequestStream.call(stream);
8866
8866
  }
8867
8867
  } else {
8868
- state.abort(new InformationalError("HTTP/2: stream half-closed (remote)"), true);
8868
+ state2.abort(new InformationalError("HTTP/2: stream half-closed (remote)"), true);
8869
8869
  }
8870
8870
  }
8871
- function retryRefusedStream(stream, state) {
8872
- const { client, request } = state;
8873
- if (state.responseReceived || request.aborted || request.completed || request[kRefusedStreamRetry] || !canReplayRequest(request)) {
8871
+ function retryRefusedStream(stream, state2) {
8872
+ const { client, request } = state2;
8873
+ if (state2.responseReceived || request.aborted || request.completed || request[kRefusedStreamRetry] || !canReplayRequest(request)) {
8874
8874
  return false;
8875
8875
  }
8876
8876
  request[kRefusedStreamRetry] = true;
8877
8877
  detachRequestStreamForClose(request);
8878
- state.stream = null;
8879
- state.requestFinalized = true;
8878
+ state2.stream = null;
8879
+ state2.requestFinalized = true;
8880
8880
  completeRequest(client, request);
8881
8881
  client[kQueue].splice(client[kPendingIdx], 0, request);
8882
8882
  client[kResume]();
@@ -8884,63 +8884,63 @@ var require_client_h2 = __commonJS({
8884
8884
  }
8885
8885
  function onError(err) {
8886
8886
  const stream = this;
8887
- const state = stream[kRequestStreamState];
8888
- if (state == null) {
8887
+ const state2 = stream[kRequestStreamState];
8888
+ if (state2 == null) {
8889
8889
  return;
8890
8890
  }
8891
8891
  stream.off("error", onError);
8892
- if (state.responseContentLength != null && state.bytesRead !== state.responseContentLength) {
8892
+ if (state2.responseContentLength != null && state2.bytesRead !== state2.responseContentLength) {
8893
8893
  err = new ResponseContentLengthMismatchError();
8894
8894
  }
8895
8895
  if (typeof stream.rstCode === "number" && stream.rstCode !== NGHTTP2_NO_ERROR) {
8896
8896
  err.http2ErrorCode = stream.rstCode;
8897
8897
  }
8898
- if (stream.rstCode === NGHTTP2_REFUSED_STREAM && retryRefusedStream(stream, state)) {
8898
+ if (stream.rstCode === NGHTTP2_REFUSED_STREAM && retryRefusedStream(stream, state2)) {
8899
8899
  return;
8900
8900
  }
8901
- state.abort(err);
8901
+ state2.abort(err);
8902
8902
  }
8903
8903
  function onFrameError(type, code) {
8904
8904
  const stream = this;
8905
- const state = stream[kRequestStreamState];
8906
- if (state == null) {
8905
+ const state2 = stream[kRequestStreamState];
8906
+ if (state2 == null) {
8907
8907
  return;
8908
8908
  }
8909
8909
  stream.off("frameError", onFrameError);
8910
- state.abort(new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`));
8910
+ state2.abort(new InformationalError(`HTTP/2: "frameError" received - type ${type}, code ${code}`));
8911
8911
  }
8912
8912
  function onAborted() {
8913
8913
  this.off("data", onData);
8914
8914
  }
8915
8915
  function onTimeout() {
8916
8916
  const stream = this;
8917
- const state = stream[kRequestStreamState];
8918
- if (state == null) {
8917
+ const state2 = stream[kRequestStreamState];
8918
+ if (state2 == null) {
8919
8919
  return;
8920
8920
  }
8921
8921
  stream.off("timeout", onTimeout);
8922
- const err = state.responseReceived ? new BodyTimeoutError(`HTTP/2: "stream timeout after ${state.bodyTimeout}"`) : new HeadersTimeoutError(`HTTP/2: "headers timeout after ${state.headersTimeout}"`);
8923
- state.abort(err);
8922
+ const err = state2.responseReceived ? new BodyTimeoutError(`HTTP/2: "stream timeout after ${state2.bodyTimeout}"`) : new HeadersTimeoutError(`HTTP/2: "headers timeout after ${state2.headersTimeout}"`);
8923
+ state2.abort(err);
8924
8924
  }
8925
8925
  function onTrailers(trailers) {
8926
8926
  const stream = this;
8927
- const state = stream[kRequestStreamState];
8928
- if (state == null) {
8927
+ const state2 = stream[kRequestStreamState];
8928
+ if (state2 == null) {
8929
8929
  return;
8930
8930
  }
8931
- const { request } = state;
8931
+ const { request } = state2;
8932
8932
  stream.off("trailers", onTrailers);
8933
8933
  stream.off("data", onData);
8934
8934
  if (request.aborted || request.completed) {
8935
8935
  return;
8936
8936
  }
8937
- state.trailers = trailers;
8937
+ state2.trailers = trailers;
8938
8938
  }
8939
8939
  function writeBodyH2() {
8940
8940
  const stream = this;
8941
- const state = stream[kRequestStreamState];
8942
- state.bodySent = true;
8943
- const { abort, body, client, contentLength, expectsPayload, request } = state;
8941
+ const state2 = stream[kRequestStreamState];
8942
+ state2.bodySent = true;
8943
+ const { abort, body, client, contentLength, expectsPayload, request } = state2;
8944
8944
  if (!body || contentLength === 0) {
8945
8945
  writeBuffer(
8946
8946
  abort,
@@ -12185,7 +12185,7 @@ var require_retry_handler = __commonJS({
12185
12185
  onRequestUpgrade(_controller, statusCode, headers, socket) {
12186
12186
  this.handler.onRequestUpgrade?.(this.controllerProxy, statusCode, headers, socket);
12187
12187
  }
12188
- static [kRetryHandlerDefaultRetry](err, { state, opts }, cb) {
12188
+ static [kRetryHandlerDefaultRetry](err, { state: state2, opts }, cb) {
12189
12189
  const { statusCode, code, headers } = err;
12190
12190
  const { method, retryOptions } = opts;
12191
12191
  const {
@@ -12198,7 +12198,7 @@ var require_retry_handler = __commonJS({
12198
12198
  methods,
12199
12199
  retryAfter
12200
12200
  } = retryOptions;
12201
- const { counter } = state;
12201
+ const { counter } = state2;
12202
12202
  if (code && code !== "UND_ERR_REQ_RETRY" && !errorCodes.includes(code)) {
12203
12203
  cb(err);
12204
12204
  return;
@@ -12816,24 +12816,24 @@ var require_readable = __commonJS({
12816
12816
  if (consume2.body === null) {
12817
12817
  return;
12818
12818
  }
12819
- const { _readableState: state } = consume2.stream;
12820
- if (state.bufferIndex) {
12821
- const start = state.bufferIndex;
12822
- const end = state.buffer.length;
12819
+ const { _readableState: state2 } = consume2.stream;
12820
+ if (state2.bufferIndex) {
12821
+ const start = state2.bufferIndex;
12822
+ const end = state2.buffer.length;
12823
12823
  for (let n = start; n < end; n++) {
12824
- consumePush(consume2, state.buffer[n]);
12824
+ consumePush(consume2, state2.buffer[n]);
12825
12825
  }
12826
12826
  } else {
12827
- for (const chunk of state.buffer) {
12827
+ for (const chunk of state2.buffer) {
12828
12828
  consumePush(consume2, chunk);
12829
12829
  }
12830
12830
  }
12831
- const decoder2 = state.decoder;
12831
+ const decoder2 = state2.decoder;
12832
12832
  if (decoder2 != null && decoder2.lastNeed > 0) {
12833
12833
  consumePush(consume2, Buffer.from(decoder2.lastChar.subarray(0, decoder2.lastTotal - decoder2.lastNeed)));
12834
12834
  }
12835
- if (state.endEmitted) {
12836
- consumeEnd(consume2, state.encoding);
12835
+ if (state2.endEmitted) {
12836
+ consumeEnd(consume2, state2.encoding);
12837
12837
  return;
12838
12838
  }
12839
12839
  consume2.stream.on("end", function() {
@@ -16736,12 +16736,12 @@ var require_dns = __commonJS({
16736
16736
  #controller = null;
16737
16737
  #newOrigin = null;
16738
16738
  #firstTry = true;
16739
- constructor(state, { origin, handler: handler7, dispatch, newOrigin }, opts) {
16739
+ constructor(state2, { origin, handler: handler7, dispatch, newOrigin }, opts) {
16740
16740
  super(handler7);
16741
16741
  this.#origin = origin;
16742
16742
  this.#newOrigin = newOrigin;
16743
16743
  this.#opts = { ...opts };
16744
- this.#state = state;
16744
+ this.#state = state2;
16745
16745
  this.#dispatch = dispatch;
16746
16746
  }
16747
16747
  onResponseError(controller, err) {
@@ -19941,19 +19941,19 @@ var require_deduplication_handler = __commonJS({
19941
19941
  pendingTrailers: null,
19942
19942
  done: false
19943
19943
  };
19944
- const state = {
19944
+ const state2 = {
19945
19945
  aborted: false,
19946
19946
  paused: false,
19947
19947
  reason: null
19948
19948
  };
19949
19949
  waitingHandler.controller = {
19950
19950
  resume: () => {
19951
- if (state.aborted) {
19951
+ if (state2.aborted) {
19952
19952
  return;
19953
19953
  }
19954
- state.paused = false;
19954
+ state2.paused = false;
19955
19955
  this.#flushWaitingHandler(waitingHandler);
19956
- if (this.#completed && waitingHandler.pendingTrailers && waitingHandler.bufferedChunks.length === 0 && !state.paused && !state.aborted) {
19956
+ if (this.#completed && waitingHandler.pendingTrailers && waitingHandler.bufferedChunks.length === 0 && !state2.paused && !state2.aborted) {
19957
19957
  try {
19958
19958
  waitingHandler.handler.onResponseEnd?.(waitingHandler.controller, waitingHandler.pendingTrailers);
19959
19959
  } catch (err) {
@@ -19965,31 +19965,31 @@ var require_deduplication_handler = __commonJS({
19965
19965
  this.#pruneDoneWaitingHandlers();
19966
19966
  },
19967
19967
  pause: () => {
19968
- if (!state.aborted) {
19969
- state.paused = true;
19968
+ if (!state2.aborted) {
19969
+ state2.paused = true;
19970
19970
  }
19971
19971
  },
19972
19972
  get paused() {
19973
- return state.paused;
19973
+ return state2.paused;
19974
19974
  },
19975
19975
  get aborted() {
19976
- return state.aborted;
19976
+ return state2.aborted;
19977
19977
  },
19978
19978
  get reason() {
19979
- return state.reason;
19979
+ return state2.reason;
19980
19980
  },
19981
19981
  abort: (reason) => {
19982
- if (state.aborted) {
19982
+ if (state2.aborted) {
19983
19983
  return;
19984
19984
  }
19985
- state.aborted = true;
19986
- state.reason = reason ?? null;
19985
+ state2.aborted = true;
19986
+ state2.reason = reason ?? null;
19987
19987
  waitingHandler.done = true;
19988
19988
  waitingHandler.pendingTrailers = null;
19989
19989
  waitingHandler.bufferedChunks = [];
19990
19990
  waitingHandler.bufferedBytes = 0;
19991
19991
  try {
19992
- handler7.onResponseError?.(waitingHandler.controller, state.reason ?? new RequestAbortedError());
19992
+ handler7.onResponseError?.(waitingHandler.controller, state2.reason ?? new RequestAbortedError());
19993
19993
  } catch {
19994
19994
  }
19995
19995
  }
@@ -21225,17 +21225,17 @@ var require_response = __commonJS({
21225
21225
  response.status === 0
21226
21226
  );
21227
21227
  }
21228
- function makeFilteredResponse(response, state) {
21229
- state = {
21228
+ function makeFilteredResponse(response, state2) {
21229
+ state2 = {
21230
21230
  internalResponse: response,
21231
- ...state
21231
+ ...state2
21232
21232
  };
21233
21233
  return new Proxy(response, {
21234
21234
  get(target, p) {
21235
- return p in state ? state[p] : target[p];
21235
+ return p in state2 ? state2[p] : target[p];
21236
21236
  },
21237
21237
  set(target, p, value) {
21238
- assert6(!(p in state));
21238
+ assert6(!(p in state2));
21239
21239
  target[p] = value;
21240
21240
  return true;
21241
21241
  }
@@ -66182,18 +66182,18 @@ var require_cluster = __commonJS({
66182
66182
  if (typeof res !== "string") {
66183
66183
  return callback();
66184
66184
  }
66185
- let state;
66185
+ let state2;
66186
66186
  const lines = res.split("\r\n");
66187
66187
  for (let i = 0; i < lines.length; ++i) {
66188
66188
  const parts = lines[i].split(":");
66189
66189
  if (parts[0] === "cluster_state") {
66190
- state = parts[1];
66190
+ state2 = parts[1];
66191
66191
  break;
66192
66192
  }
66193
66193
  }
66194
- if (state === "fail") {
66195
- debug3("cluster state not ok (%s)", state);
66196
- callback(null, state);
66194
+ if (state2 === "fail") {
66195
+ debug3("cluster state not ok (%s)", state2);
66196
+ callback(null, state2);
66197
66197
  } else {
66198
66198
  callback();
66199
66199
  }
@@ -74592,6 +74592,136 @@ var CaptureRulesFileSchema = external_exports.object({
74592
74592
  rules: external_exports.array(CaptureRuleSchema)
74593
74593
  });
74594
74594
 
74595
+ // ../../packages/shared-types/src/browser-resource-providers.ts
74596
+ var PROVIDERS = [
74597
+ {
74598
+ name: "Google Tag Manager",
74599
+ role: "tag_manager",
74600
+ hosts: ["www.googletagmanager.com"],
74601
+ paths: ["/gtm.js"]
74602
+ },
74603
+ {
74604
+ name: "Google tag (Analytics / Ads)",
74605
+ role: "analytics",
74606
+ hosts: ["www.googletagmanager.com"],
74607
+ paths: ["/gtag/js"]
74608
+ },
74609
+ {
74610
+ name: "Google Analytics",
74611
+ role: "analytics",
74612
+ hosts: ["www.google-analytics.com", "ssl.google-analytics.com"],
74613
+ paths: ["/analytics.js", "/ga.js"]
74614
+ },
74615
+ {
74616
+ name: "Meta Pixel",
74617
+ role: "advertising",
74618
+ hosts: ["connect.facebook.net"],
74619
+ paths: [/^\/[a-z]{2}_[A-Z]{2}\/fbevents\.js$/]
74620
+ },
74621
+ {
74622
+ name: "Microsoft Clarity",
74623
+ role: "analytics",
74624
+ hosts: ["www.clarity.ms"],
74625
+ paths: [/^\/tag\/[A-Za-z0-9]+$/]
74626
+ },
74627
+ {
74628
+ name: "Hotjar",
74629
+ role: "analytics",
74630
+ hosts: ["static.hotjar.com"],
74631
+ paths: [/^\/c\/hotjar-[0-9]+\.js$/]
74632
+ },
74633
+ {
74634
+ name: "Cloudflare Web Analytics",
74635
+ role: "analytics",
74636
+ hosts: ["static.cloudflareinsights.com"],
74637
+ paths: ["/beacon.min.js"]
74638
+ },
74639
+ {
74640
+ name: "Yandex Metrica",
74641
+ role: "analytics",
74642
+ hosts: ["mc.yandex.ru", "mc.yandex.com"],
74643
+ paths: ["/metrika/tag.js"]
74644
+ },
74645
+ {
74646
+ name: "WordPress.com / Jetpack Stats",
74647
+ role: "analytics",
74648
+ hosts: ["stats.wp.com"],
74649
+ paths: [/^\/e-[0-9]{6}\.js$/]
74650
+ },
74651
+ {
74652
+ name: "Microsoft Advertising UET",
74653
+ role: "advertising",
74654
+ hosts: ["bat.bing.com"],
74655
+ paths: ["/bat.js"]
74656
+ },
74657
+ {
74658
+ name: "LinkedIn Insight",
74659
+ role: "advertising",
74660
+ hosts: ["snap.licdn.com"],
74661
+ paths: ["/li.lms-analytics/insight.min.js"]
74662
+ },
74663
+ {
74664
+ name: "TikTok Pixel",
74665
+ role: "advertising",
74666
+ hosts: ["analytics.tiktok.com"],
74667
+ paths: ["/i18n/pixel/events.js"]
74668
+ },
74669
+ { name: "Pinterest Tag", role: "advertising", hosts: ["s.pinimg.com"], paths: ["/ct/core.js"] },
74670
+ {
74671
+ name: "X Pixel",
74672
+ role: "advertising",
74673
+ hosts: ["static.ads-twitter.com", "platform.twitter.com"],
74674
+ paths: ["/uwt.js", "/oct.js"]
74675
+ },
74676
+ {
74677
+ name: "Segment",
74678
+ role: "analytics",
74679
+ hosts: ["cdn.segment.com"],
74680
+ paths: [/^\/analytics\.js\/v1\/[A-Za-z0-9_-]+\/analytics\.min\.js$/]
74681
+ },
74682
+ {
74683
+ name: "Mixpanel",
74684
+ role: "analytics",
74685
+ hosts: ["cdn.mxpnl.com"],
74686
+ paths: ["/libs/mixpanel-2-latest.min.js", "/libs/mixpanel-js/dist/mixpanel.module.js"]
74687
+ },
74688
+ {
74689
+ name: "Amplitude",
74690
+ role: "analytics",
74691
+ hosts: ["cdn.amplitude.com"],
74692
+ paths: [
74693
+ /^\/libs\/analytics-browser-[0-9]+\.[0-9]+\.[0-9]+-min\.js(?:\.gz)?$/,
74694
+ /^\/script\/[A-Za-z0-9_-]+\.js$/
74695
+ ]
74696
+ },
74697
+ {
74698
+ name: "PostHog",
74699
+ role: "analytics",
74700
+ hosts: ["us-assets.i.posthog.com", "eu-assets.i.posthog.com", "app.posthog.com"],
74701
+ paths: ["/static/array.js"]
74702
+ },
74703
+ {
74704
+ name: "Plausible",
74705
+ role: "analytics",
74706
+ hosts: ["plausible.io"],
74707
+ paths: [/^\/js\/pa-[A-Za-z0-9_-]+\.js$/, /^\/js\/script(?:\.[a-z-]+)*\.js$/]
74708
+ },
74709
+ {
74710
+ name: "Google sign-in",
74711
+ role: "authentication",
74712
+ hosts: ["accounts.google.com"],
74713
+ paths: ["/gsi/client"]
74714
+ }
74715
+ ];
74716
+ function identifyBrowserResourceProvider(host, path) {
74717
+ if (host === null) return null;
74718
+ return PROVIDERS.find(
74719
+ (provider) => provider.hosts.includes(host) && provider.paths.some(
74720
+ (pattern) => typeof pattern === "string" ? path === pattern : pattern.test(path)
74721
+ )
74722
+ ) ?? null;
74723
+ }
74724
+
74595
74725
  // ../../packages/shared-types/src/browser-resource.ts
74596
74726
  function record(value) {
74597
74727
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -74650,18 +74780,10 @@ function describeBrowserResource(value) {
74650
74780
  let role = location.first_party === true ? "application_asset" : "unknown";
74651
74781
  let provider = null;
74652
74782
  if (type === "script") {
74653
- if (location.host === "www.googletagmanager.com" && location.path === "/gtm.js") {
74654
- provider = "Google Tag Manager";
74655
- role = "tag_manager";
74656
- } else if (location.host === "connect.facebook.net" && /^\/[a-z]{2}_[A-Z]{2}\/fbevents\.js$/.test(location.path)) {
74657
- provider = "Meta Pixel";
74658
- role = "advertising";
74659
- } else if (location.host === "www.clarity.ms" && /^\/tag\/[A-Za-z0-9]+$/.test(location.path)) {
74660
- provider = "Microsoft Clarity";
74661
- role = "analytics";
74662
- } else if (location.host === "accounts.google.com" && location.path === "/gsi/client") {
74663
- provider = "Google sign-in";
74664
- role = "authentication";
74783
+ const recognized = identifyBrowserResourceProvider(location.host, location.path);
74784
+ if (recognized !== null) {
74785
+ provider = recognized.name;
74786
+ role = recognized.role;
74665
74787
  }
74666
74788
  }
74667
74789
  const file = location.path.split("/").filter(Boolean).at(-1) ?? location.path;
@@ -74685,7 +74807,8 @@ function describeBrowserResourceInterruption(value) {
74685
74807
  const readyState = page?.["ready_state"];
74686
74808
  const tag2 = typeof target?.["tag_name"] === "string" ? target["tag_name"].toLowerCase() : null;
74687
74809
  const rel = typeof attributes?.["rel"] === "string" ? attributes["rel"].trim().toLowerCase() : null;
74688
- if (visibility !== "hidden" && visibility !== "prerender" && visibility !== "unloaded" || readyState !== "loading" && readyState !== "interactive" || tag2 !== "link" || rel !== "preload" && rel !== "modulepreload" && rel !== "prefetch") return null;
74810
+ if (visibility !== "hidden" && visibility !== "prerender" && visibility !== "unloaded" || readyState !== "loading" && readyState !== "interactive" || tag2 !== "link" || rel !== "preload" && rel !== "modulepreload" && rel !== "prefetch")
74811
+ return null;
74689
74812
  return {
74690
74813
  visibility_state: visibility,
74691
74814
  ready_state: readyState,
@@ -75746,6 +75869,71 @@ var AnalyticsMetricsQuerySchema = external_exports.object({
75746
75869
  limit: external_exports.coerce.number().int().min(1).max(100).optional().default(10)
75747
75870
  }).strict();
75748
75871
 
75872
+ // ../../packages/shared-types/src/public-status.ts
75873
+ var PublicStatusIdSchema = external_exports.string().regex(/^[a-f0-9]{24}$/);
75874
+ var selection = external_exports.object({ project_id: external_exports.string().uuid(), check_ids: external_exports.array(external_exports.string().uuid()).max(50) }).strict();
75875
+ var PublicStatusSettingsSchema = external_exports.object({
75876
+ title: external_exports.string().trim().min(1).max(120),
75877
+ enabled: external_exports.boolean(),
75878
+ projects: external_exports.array(selection).min(1).max(50)
75879
+ }).strict().superRefine((value, context) => {
75880
+ if (new Set(value.projects.map((p) => p.project_id)).size !== value.projects.length || new Set(value.projects.flatMap((p) => p.check_ids)).size !== value.projects.reduce((n, p) => n + p.check_ids.length, 0) || value.projects.reduce((count, p) => count + p.check_ids.length, 0) > 500) {
75881
+ context.addIssue({
75882
+ code: external_exports.ZodIssueCode.custom,
75883
+ message: "Choose distinct projects and checks within the publication limits."
75884
+ });
75885
+ }
75886
+ });
75887
+ var state = external_exports.enum(["unknown", "operational", "degraded", "down", "paused"]);
75888
+ var percentage = external_exports.number().min(0).max(100).nullable();
75889
+ var verifiedAt = external_exports.string().datetime({ offset: true }).nullable();
75890
+ var PublicStatusDaySchema = external_exports.object({
75891
+ day: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/),
75892
+ state,
75893
+ impact: external_exports.enum(["none", "minor", "elevated", "outage"]),
75894
+ total_checks: external_exports.number().int().nonnegative(),
75895
+ successful_checks: external_exports.number().int().nonnegative(),
75896
+ failed_checks: external_exports.number().int().nonnegative(),
75897
+ degraded_checks: external_exports.number().int().nonnegative(),
75898
+ downtime_seconds: external_exports.number().nonnegative()
75899
+ }).strict();
75900
+ var checkView = external_exports.object({
75901
+ key: external_exports.string().max(40),
75902
+ name: external_exports.string().max(120),
75903
+ current_state: state,
75904
+ uptime_percentage: percentage,
75905
+ last_verified_at: verifiedAt,
75906
+ days: external_exports.array(PublicStatusDaySchema).length(30)
75907
+ }).strict();
75908
+ var PublicStatusProjectSchema = checkView.extend({ checks: external_exports.array(checkView).max(50) }).strict();
75909
+ var PublicStatusPageSchema = external_exports.object({ title: external_exports.string().max(120), projects: external_exports.array(PublicStatusProjectSchema).max(50) }).strict();
75910
+ var PublicStatusManagementSchema = external_exports.object({
75911
+ settings: PublicStatusSettingsSchema,
75912
+ public_id: PublicStatusIdSchema.nullable(),
75913
+ public_url: external_exports.string().url().nullable(),
75914
+ access_mode: external_exports.enum(["manage", "preview"])
75915
+ }).strict();
75916
+ var PublicStatusOptionsQueryObjectSchema = external_exports.object({
75917
+ cursor: external_exports.string().uuid().optional(),
75918
+ check_project_id: external_exports.string().uuid().optional(),
75919
+ check_cursor: external_exports.string().uuid().optional()
75920
+ }).strict();
75921
+ var PublicStatusOptionsQuerySchema = PublicStatusOptionsQueryObjectSchema.refine(
75922
+ (v) => !v.check_cursor || !!v.check_project_id,
75923
+ "A check cursor requires a project."
75924
+ ).refine((v) => !v.cursor || !v.check_project_id, "Project and check pagination are separate.");
75925
+ var PublicStatusOptionsSchema = external_exports.object({
75926
+ projects: external_exports.array(
75927
+ external_exports.object({
75928
+ project_id: external_exports.string().uuid(),
75929
+ name: external_exports.string(),
75930
+ checks: external_exports.array(external_exports.object({ check_id: external_exports.string().uuid(), name: external_exports.string() }).strict()).max(50),
75931
+ next_check_cursor: external_exports.string().uuid().nullable()
75932
+ }).strict()
75933
+ ).max(50),
75934
+ next_cursor: external_exports.string().uuid().nullable()
75935
+ }).strict();
75936
+
75749
75937
  // ../../packages/shared-types/src/index.ts
75750
75938
  var SeveritySchema = external_exports.enum(["low", "medium", "high", "critical"]);
75751
75939
  var BundleSdkSchema = external_exports.object({
@@ -76210,7 +76398,7 @@ function buildSkill() {
76210
76398
  "",
76211
76399
  "- Inspect the primary failure and routes: one resource can span pages, route coverage may be incomplete, and historical incidents stay separate. Related tracker evidence does not explain an application exception.",
76212
76400
  '- If the cause is unknown, say "possibly blocked by privacy tools." Network/CSP/provider failures remain possible; provider recognition proves neither Pi-hole blocking nor optionality.',
76213
- "- Review exact host/path, service, environment and opaque resource-error scope; never widen to a whole host. Google sign-in, app assets and unknown dependencies have no automatic resource noise recommendation.",
76401
+ "- Review exact resource host/path/type, service, environment and opacity, or the returned exact fingerprint when evidence is incomplete; never widen to a whole host. All resource incidents can offer explicit controls. Provider recognition does not establish that a dependency is optional; do not suppress authentication, app assets or unknown dependencies automatically.",
76214
76402
  "- For confirmed optional dependencies, context (demote) retains diagnostics without new incidents/alerts/automation and may remain billable. Drop discards future matches; choose it only when evidence has no diagnostic value. Explain the tradeoff; neither deletes history. Use the returned suggestion ID.",
76215
76403
  "- Check existing/disabled rules. Empty suggestions or pending/failed bundles do not justify broader rules. Applying requires user authorization and owner/admin access; preview is read-only. Verify subsequent matching and protected captures before claiming improvement; live tests need authorization.",
76216
76404
  "- The official OpenAI connection cannot suggest or apply rules. When it is the only connection, review returned evidence and hand off through a returned safe dashboard URL; never invent tools or switch credentials.",
@@ -77311,76 +77499,76 @@ var BudgetExceeded = class extends Error {
77311
77499
  function byteLength(value) {
77312
77500
  return new TextEncoder().encode(value).length;
77313
77501
  }
77314
- function mask(state) {
77315
- state.redactionCount += 1;
77502
+ function mask(state2) {
77503
+ state2.redactionCount += 1;
77316
77504
  return REDACTED2;
77317
77505
  }
77318
- function sanitizeString(value, state, allowStructured) {
77319
- if (value.length > MAX_STRING_BYTES) return mask(state);
77506
+ function sanitizeString(value, state2, allowStructured) {
77507
+ if (value.length > MAX_STRING_BYTES) return mask(state2);
77320
77508
  const length = byteLength(value);
77321
- if (length > MAX_STRING_BYTES) return mask(state);
77322
- state.textBytes += length;
77323
- if (state.textBytes > state.maxTotalBytes) throw new BudgetExceeded();
77509
+ if (length > MAX_STRING_BYTES) return mask(state2);
77510
+ state2.textBytes += length;
77511
+ if (state2.textBytes > state2.maxTotalBytes) throw new BudgetExceeded();
77324
77512
  if (allowStructured && (value.startsWith("{") || value.startsWith("["))) {
77325
77513
  try {
77326
77514
  const parsed = JSON.parse(value);
77327
77515
  if (typeof parsed === "object" && parsed !== null) {
77328
- const nested = sanitizeValue(parsed, state, 0, false);
77516
+ const nested = sanitizeValue(parsed, state2, 0, false);
77329
77517
  const encoded = JSON.stringify(nested);
77330
- if (encoded !== value) state.redactionCount += 1;
77518
+ if (encoded !== value) state2.redactionCount += 1;
77331
77519
  return encoded;
77332
77520
  }
77333
77521
  } catch (error2) {
77334
77522
  if (error2 instanceof BudgetExceeded) throw error2;
77335
77523
  }
77336
77524
  }
77337
- const result = scrubCredentialText(value, state.extra);
77338
- if (result !== value) state.redactionCount += 1;
77525
+ const result = scrubCredentialText(value, state2.extra);
77526
+ if (result !== value) state2.redactionCount += 1;
77339
77527
  if ((value.startsWith("{") || value.startsWith("[")) && result === value && /(?:password|token|secret|authorization|cookie)["']?\s*[:=]/i.test(value)) {
77340
- return mask(state);
77528
+ return mask(state2);
77341
77529
  }
77342
77530
  return result;
77343
77531
  }
77344
- function sanitizeValue(value, state, depth, allowStructured) {
77345
- state.nodes += 1;
77346
- if (state.nodes > MAX_NODES) throw new BudgetExceeded();
77347
- if (depth > MAX_DEPTH) return mask(state);
77348
- if (typeof value === "string") return sanitizeString(value, state, allowStructured);
77532
+ function sanitizeValue(value, state2, depth, allowStructured) {
77533
+ state2.nodes += 1;
77534
+ if (state2.nodes > MAX_NODES) throw new BudgetExceeded();
77535
+ if (depth > MAX_DEPTH) return mask(state2);
77536
+ if (typeof value === "string") return sanitizeString(value, state2, allowStructured);
77349
77537
  if (value === null || typeof value === "boolean") return value;
77350
77538
  if (typeof value === "number" && Number.isFinite(value)) return value;
77351
77539
  if (typeof value !== "object") throw new TypeError("unsafe_input");
77352
- if (state.seen.has(value)) return "[Circular]";
77353
- state.seen.add(value);
77540
+ if (state2.seen.has(value)) return "[Circular]";
77541
+ state2.seen.add(value);
77354
77542
  try {
77355
77543
  if (Array.isArray(value)) {
77356
- if (value.length > MAX_ENTRIES) return mask(state);
77544
+ if (value.length > MAX_ENTRIES) return mask(state2);
77357
77545
  return Array.from({ length: value.length }, (_, index) => {
77358
77546
  const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
77359
77547
  if (descriptor === void 0 || !("value" in descriptor)) throw new TypeError("unsafe_input");
77360
- return sanitizeValue(descriptor.value, state, depth + 1, allowStructured);
77548
+ return sanitizeValue(descriptor.value, state2, depth + 1, allowStructured);
77361
77549
  });
77362
77550
  }
77363
77551
  if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
77364
77552
  throw new TypeError("unsafe_input");
77365
77553
  }
77366
77554
  const keys2 = Object.keys(value);
77367
- if (keys2.length > MAX_ENTRIES) return mask(state);
77555
+ if (keys2.length > MAX_ENTRIES) return mask(state2);
77368
77556
  const result = {};
77369
77557
  for (const key of keys2) {
77370
77558
  if (key.length > 128) {
77371
- state.redactionCount += 1;
77559
+ state2.redactionCount += 1;
77372
77560
  continue;
77373
77561
  }
77374
- state.textBytes += byteLength(key);
77375
- if (state.textBytes > state.maxTotalBytes) throw new BudgetExceeded();
77376
- const safeKey = scrubCredentialText(key, state.extra);
77562
+ state2.textBytes += byteLength(key);
77563
+ if (state2.textBytes > state2.maxTotalBytes) throw new BudgetExceeded();
77564
+ const safeKey = scrubCredentialText(key, state2.extra);
77377
77565
  if (safeKey !== key) {
77378
- state.redactionCount += 1;
77566
+ state2.redactionCount += 1;
77379
77567
  continue;
77380
77568
  }
77381
77569
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
77382
77570
  if (descriptor === void 0 || !("value" in descriptor)) throw new TypeError("unsafe_input");
77383
- const safeValue = isSensitiveKey(key, state.keys) ? mask(state) : sanitizeValue(descriptor.value, state, depth + 1, allowStructured);
77571
+ const safeValue = isSensitiveKey(key, state2.keys) ? mask(state2) : sanitizeValue(descriptor.value, state2, depth + 1, allowStructured);
77384
77572
  Object.defineProperty(result, key, {
77385
77573
  value: safeValue,
77386
77574
  enumerable: true,
@@ -77390,7 +77578,7 @@ function sanitizeValue(value, state, depth, allowStructured) {
77390
77578
  }
77391
77579
  return result;
77392
77580
  } finally {
77393
- state.seen.delete(value);
77581
+ state2.seen.delete(value);
77394
77582
  }
77395
77583
  }
77396
77584
  function sanitizeTelemetry(value, options = {}) {
@@ -77403,7 +77591,7 @@ function sanitizeTelemetry(value, options = {}) {
77403
77591
  if (!Number.isInteger(maxTotalBytes) || maxTotalBytes < 1 || maxTotalBytes > 512 * 1024) {
77404
77592
  return { ok: false, reason: "unsafe_input" };
77405
77593
  }
77406
- const state = {
77594
+ const state2 = {
77407
77595
  nodes: 0,
77408
77596
  textBytes: 0,
77409
77597
  redactionCount: 0,
@@ -77412,11 +77600,11 @@ function sanitizeTelemetry(value, options = {}) {
77412
77600
  extra,
77413
77601
  maxTotalBytes
77414
77602
  };
77415
- const sanitized = sanitizeValue(value, state, 0, true);
77603
+ const sanitized = sanitizeValue(value, state2, 0, true);
77416
77604
  if (byteLength(JSON.stringify(sanitized)) > maxTotalBytes) {
77417
77605
  return { ok: false, reason: "budget_exceeded" };
77418
77606
  }
77419
- return { ok: true, value: sanitized, redactionCount: state.redactionCount };
77607
+ return { ok: true, value: sanitized, redactionCount: state2.redactionCount };
77420
77608
  } catch (error2) {
77421
77609
  return { ok: false, reason: error2 instanceof BudgetExceeded ? "budget_exceeded" : "unsafe_input" };
77422
77610
  }
@@ -84630,8 +84818,8 @@ async function readAgentAuthState(filePath = agentAuthFilePath()) {
84630
84818
  throw new Error("agent_auth_unavailable");
84631
84819
  }
84632
84820
  }
84633
- async function persistAgentAuthState(state, filePath = agentAuthFilePath()) {
84634
- const parsed = AgentAuthSchema.parse(state);
84821
+ async function persistAgentAuthState(state2, filePath = agentAuthFilePath()) {
84822
+ const parsed = AgentAuthSchema.parse(state2);
84635
84823
  await (0, import_promises7.mkdir)((0, import_node_path7.dirname)(filePath), { recursive: true, mode: 448 });
84636
84824
  const tmp = `${filePath}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
84637
84825
  const file = await (0, import_promises7.open)(tmp, "wx", 384);
@@ -93219,19 +93407,19 @@ var err_out_default = ({
93219
93407
  message: message3,
93220
93408
  error_description: description,
93221
93409
  scope
93222
- }, state) => {
93410
+ }, state2) => {
93223
93411
  if (expose) {
93224
93412
  return {
93225
93413
  error: message3,
93226
93414
  ...description !== void 0 ? { error_description: description } : void 0,
93227
93415
  ...scope !== void 0 ? { scope } : void 0,
93228
- ...state !== void 0 ? { state } : void 0
93416
+ ...state2 !== void 0 ? { state: state2 } : void 0
93229
93417
  };
93230
93418
  }
93231
93419
  return {
93232
93420
  error: "server_error",
93233
93421
  error_description: "oops! something went wrong",
93234
- ...state ? { state } : void 0
93422
+ ...state2 ? { state: state2 } : void 0
93235
93423
  };
93236
93424
  };
93237
93425
 
@@ -93345,8 +93533,8 @@ var authorization_error_handler_default = (provider) => {
93345
93533
  recovery: oneRedirectUriClients
93346
93534
  }
93347
93535
  });
93348
- function getOutAndEmit(ctx, err, state) {
93349
- const out = { ...err_out_default(err, state), iss: ctx.oidc.provider.issuer };
93536
+ function getOutAndEmit(ctx, err, state2) {
93537
+ const out = { ...err_out_default(err, state2), iss: ctx.oidc.provider.issuer };
93350
93538
  if (err.expose) {
93351
93539
  provider.emit("authorization.error", ctx, err);
93352
93540
  debugError2("%o", out);
@@ -97157,7 +97345,7 @@ var confirm2 = [
97157
97345
  checkXsrf("could not find logout details"),
97158
97346
  async function endSession(ctx) {
97159
97347
  const { oidc: { session, params } } = ctx;
97160
- const { state } = session;
97348
+ const { state: state2 } = session;
97161
97349
  const {
97162
97350
  features: { backchannelLogout },
97163
97351
  cookies: { long: opts }
@@ -97166,7 +97354,7 @@ var confirm2 = [
97166
97354
  const clientIds = Object.keys(session.authorizations || {});
97167
97355
  const back = [];
97168
97356
  for (const clientId of clientIds) {
97169
- if (params.logout || clientId === state.clientId) {
97357
+ if (params.logout || clientId === state2.clientId) {
97170
97358
  const client = await clientForLogout(ctx, clientId);
97171
97359
  if (client) {
97172
97360
  const sid = session.sidFor(client.clientId);
@@ -97183,8 +97371,8 @@ var confirm2 = [
97183
97371
  }
97184
97372
  await Promise.all(back);
97185
97373
  }
97186
- if (state.clientId) {
97187
- ctx.oidc.entity("Client", await clientForLogout(ctx, state.clientId));
97374
+ if (state2.clientId) {
97375
+ ctx.oidc.entity("Client", await clientForLogout(ctx, state2.clientId));
97188
97376
  }
97189
97377
  if (params.logout) {
97190
97378
  if (session.authorizations) {
@@ -97202,24 +97390,24 @@ var confirm2 = [
97202
97390
  null,
97203
97391
  opts
97204
97392
  );
97205
- } else if (state.clientId) {
97206
- const grantId = session.grantIdFor(state.clientId);
97207
- if (grantId && !session.authorizationFor(state.clientId).persistsLogout) {
97393
+ } else if (state2.clientId) {
97394
+ const grantId = session.grantIdFor(state2.clientId);
97395
+ if (grantId && !session.authorizationFor(state2.clientId).persistsLogout) {
97208
97396
  await revoke(ctx, grantId);
97209
97397
  }
97210
97398
  session.state = void 0;
97211
97399
  if (session.authorizations) {
97212
- delete session.authorizations[state.clientId];
97400
+ delete session.authorizations[state2.clientId];
97213
97401
  }
97214
97402
  session.resetIdentifier();
97215
97403
  }
97216
- const usePostLogoutUri = state.postLogoutRedirectUri;
97217
- const forwardClientId = !usePostLogoutUri && !params.logout && state.clientId;
97404
+ const usePostLogoutUri = state2.postLogoutRedirectUri;
97405
+ const forwardClientId = !usePostLogoutUri && !params.logout && state2.clientId;
97218
97406
  const uri = redirectUri(
97219
- usePostLogoutUri ? state.postLogoutRedirectUri : ctx.oidc.urlFor("end_session_success"),
97407
+ usePostLogoutUri ? state2.postLogoutRedirectUri : ctx.oidc.urlFor("end_session_success"),
97220
97408
  {
97221
- ...usePostLogoutUri && state.state != null ? { state: state.state } : void 0,
97222
- ...forwardClientId ? { client_id: state.clientId } : void 0
97409
+ ...usePostLogoutUri && state2.state != null ? { state: state2.state } : void 0,
97410
+ ...forwardClientId ? { client_id: state2.clientId } : void 0
97223
97411
  }
97224
97412
  );
97225
97413
  ctx.oidc.provider.emit("end_session.success", ctx);
@@ -98839,8 +99027,8 @@ function getBaseModel(provider) {
98839
99027
  }
98840
99028
  ttlPercentagePassed() {
98841
99029
  const now = epoch_time_default();
98842
- const percentage = Math.floor(100 * ((now - this.iat) / (this.exp - this.iat)));
98843
- return Math.max(Math.min(100, percentage), 0);
99030
+ const percentage2 = Math.floor(100 * ((now - this.iat) / (this.exp - this.iat)));
99031
+ return Math.max(Math.min(100, percentage2), 0);
98844
99032
  }
98845
99033
  get isValid() {
98846
99034
  return !this.isExpired;
@@ -101907,9 +102095,10 @@ function buildEligibilityCtes(organizationPredicate) {
101907
102095
  )
101908
102096
  `;
101909
102097
  }
101910
- var LIST_AVAILABILITY_CHECKS_QUERY = `
102098
+ function buildAvailabilityChecksListQuery(organizationPredicate, checkPredicate, limitSql = "$3", cursorSql = "$4") {
102099
+ return `
101911
102100
  WITH
101912
- ${buildEligibilityCtes("AND p.organization_id = $2::uuid")},
102101
+ ${buildEligibilityCtes(`AND ${organizationPredicate}`)},
101913
102102
  ranked AS (
101914
102103
  SELECT
101915
102104
  c.id::text AS check_id,
@@ -101956,8 +102145,8 @@ var LIST_AVAILABILITY_CHECKS_QUERY = `
101956
102145
  LEFT JOIN monitored_project_ranks monitored_ranks
101957
102146
  ON monitored_ranks.organization_id = p.organization_id
101958
102147
  AND monitored_ranks.project_id = c.project_id
101959
- WHERE c.project_id = $1::uuid
101960
- AND p.organization_id = $2::uuid
102148
+ WHERE ${checkPredicate}
102149
+ AND ${organizationPredicate}
101961
102150
  AND c.deleted_at IS NULL
101962
102151
  )
101963
102152
  SELECT
@@ -101968,10 +102157,15 @@ var LIST_AVAILABILITY_CHECKS_QUERY = `
101968
102157
  NOT ranked.enabled OR ranked.organization_check_rank <= ranked.plan_organization_check_limit
101969
102158
  AS within_organization_active_limit
101970
102159
  FROM ranked
101971
- WHERE ($4::text IS NULL OR ranked.check_id = $4)
102160
+ WHERE (${cursorSql}::text IS NULL OR ranked.check_id = ${cursorSql})
101972
102161
  ORDER BY ranked.created_at DESC
101973
- LIMIT $3
102162
+ LIMIT ${limitSql}
101974
102163
  `;
102164
+ }
102165
+ var LIST_AVAILABILITY_CHECKS_QUERY = buildAvailabilityChecksListQuery(
102166
+ "p.organization_id = $2::uuid",
102167
+ "c.project_id = $1::uuid"
102168
+ );
101975
102169
  var CLAIM_DUE_AVAILABILITY_CHECKS_QUERY = `
101976
102170
  WITH due_organizations AS (
101977
102171
  SELECT DISTINCT p.organization_id
@@ -103280,8 +103474,41 @@ function defineStorageSchemaMigration(input3) {
103280
103474
  };
103281
103475
  }
103282
103476
 
103283
- // ../../packages/storage/src/analytics-flow-schema.ts
103477
+ // ../../packages/storage/src/public-status-schema.ts
103284
103478
  var statements = [
103479
+ `CREATE TABLE IF NOT EXISTS public_status_pages (
103480
+ id uuid PRIMARY KEY, anchor_project_id uuid NOT NULL UNIQUE REFERENCES projects(id) ON DELETE CASCADE,
103481
+ owner_user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
103482
+ organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
103483
+ public_id text NOT NULL UNIQUE CHECK (public_id ~ '^[a-f0-9]{24}$'),
103484
+ title text NOT NULL CHECK (length(title) BETWEEN 1 AND 120), enabled boolean NOT NULL DEFAULT false,
103485
+ created_at timestamptz NOT NULL DEFAULT now(), updated_at timestamptz NOT NULL DEFAULT now()
103486
+ )`,
103487
+ `CREATE TABLE IF NOT EXISTS public_status_page_projects (
103488
+ page_id uuid NOT NULL REFERENCES public_status_pages(id) ON DELETE CASCADE,
103489
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
103490
+ position integer NOT NULL CHECK (position BETWEEN 0 AND 49), PRIMARY KEY(page_id, project_id)
103491
+ )`,
103492
+ `CREATE TABLE IF NOT EXISTS public_status_page_checks (
103493
+ page_id uuid NOT NULL, project_id uuid NOT NULL, check_id uuid NOT NULL REFERENCES availability_checks(id) ON DELETE CASCADE,
103494
+ PRIMARY KEY(page_id, check_id), FOREIGN KEY(page_id, project_id) REFERENCES public_status_page_projects(page_id, project_id) ON DELETE CASCADE
103495
+ )`,
103496
+ "CREATE INDEX IF NOT EXISTS public_status_page_projects_project_idx ON public_status_page_projects(project_id)",
103497
+ "CREATE INDEX IF NOT EXISTS public_status_page_checks_check_idx ON public_status_page_checks(check_id)"
103498
+ ];
103499
+ var PUBLIC_STATUS_BOOTSTRAP_STATEMENTS = statements.map(
103500
+ (s) => s.replaceAll(" IF NOT EXISTS", "")
103501
+ );
103502
+ var PUBLIC_STATUS_SCHEMA_MIGRATIONS = [
103503
+ defineStorageSchemaMigration({
103504
+ id: "202610080001_add_public_status_pages",
103505
+ description: "Add opt-in, explicitly selected public availability pages.",
103506
+ statements
103507
+ })
103508
+ ];
103509
+
103510
+ // ../../packages/storage/src/analytics-flow-schema.ts
103511
+ var statements2 = [
103285
103512
  `CREATE TABLE IF NOT EXISTS analytics_flow_definitions (
103286
103513
  id uuid PRIMARY KEY, project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
103287
103514
  flow_key text NOT NULL, version integer NOT NULL DEFAULT 1, definition jsonb NOT NULL,
@@ -103314,18 +103541,18 @@ var statements = [
103314
103541
  )`,
103315
103542
  `CREATE INDEX IF NOT EXISTS analytics_flow_rollups_expiry_idx ON analytics_flow_rollups(cohort_date, flow_id)`
103316
103543
  ];
103317
- var ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS = statements.map(
103544
+ var ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS = statements2.map(
103318
103545
  (statement) => statement.replaceAll(" IF NOT EXISTS", "")
103319
103546
  );
103320
103547
  var migration = {
103321
103548
  id: "202610030001_add_public_analytics_flows",
103322
103549
  description: "Add customer project flow definitions, bounded continuity and aggregate reports.",
103323
- statements
103550
+ statements: statements2
103324
103551
  };
103325
103552
  var ANALYTICS_FLOW_SCHEMA_MIGRATIONS = [defineStorageSchemaMigration(migration)];
103326
103553
 
103327
103554
  // ../../packages/storage/src/browser-recovery-schema.ts
103328
- var statements2 = [
103555
+ var statements3 = [
103329
103556
  `ALTER TABLE alert_deliveries ADD COLUMN IF NOT EXISTS coalescing_key text`,
103330
103557
  `CREATE INDEX IF NOT EXISTS alert_deliveries_coalescing_idx ON alert_deliveries (alert_id, coalescing_key, created_at) WHERE coalescing_key IS NOT NULL`,
103331
103558
  `CREATE TABLE IF NOT EXISTS browser_recovery_events (
@@ -103347,10 +103574,10 @@ var BROWSER_RECOVERY_MIGRATIONS = [
103347
103574
  defineStorageSchemaMigration({
103348
103575
  id: "202609220001_add_browser_recovery_context",
103349
103576
  description: "Index browser recovery context and separate burst suppression from alert cooldown identity",
103350
- statements: statements2
103577
+ statements: statements3
103351
103578
  })
103352
103579
  ];
103353
- var BROWSER_RECOVERY_BOOTSTRAP_STATEMENTS = statements2.filter((statement) => !statement.startsWith("ALTER TABLE")).map((statement) => statement.replaceAll(" IF NOT EXISTS", ""));
103580
+ var BROWSER_RECOVERY_BOOTSTRAP_STATEMENTS = statements3.filter((statement) => !statement.startsWith("ALTER TABLE")).map((statement) => statement.replaceAll(" IF NOT EXISTS", ""));
103354
103581
 
103355
103582
  // ../../packages/storage/src/availability-check-bootstrap-statements.ts
103356
103583
  var AVAILABILITY_CHECK_BOOTSTRAP_STATEMENTS = [
@@ -105326,7 +105553,8 @@ var STORAGE_BOOTSTRAP_STATEMENTS2 = [
105326
105553
  ...AVAILABILITY_CHECK_BOOTSTRAP_STATEMENTS,
105327
105554
  ...ANALYTICS_BOOTSTRAP_STATEMENTS,
105328
105555
  ...WORKER_JOB_BOOTSTRAP_STATEMENTS,
105329
- ...ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS
105556
+ ...ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS,
105557
+ ...PUBLIC_STATUS_BOOTSTRAP_STATEMENTS
105330
105558
  ];
105331
105559
 
105332
105560
  // ../../packages/storage/src/migrations.ts
@@ -107541,9 +107769,18 @@ var STORAGE_SCHEMA_MIGRATIONS2 = [
107541
107769
  ...ANALYTICS_STORAGE_SCHEMA_MIGRATIONS,
107542
107770
  ...OPENAI_OAUTH_STORAGE_SCHEMA_MIGRATIONS,
107543
107771
  ...WORKER_JOB_SCHEMA_MIGRATIONS,
107544
- ...ANALYTICS_FLOW_SCHEMA_MIGRATIONS
107772
+ ...ANALYTICS_FLOW_SCHEMA_MIGRATIONS,
107773
+ ...PUBLIC_STATUS_SCHEMA_MIGRATIONS
107545
107774
  ].sort((left, right) => left.id.localeCompare(right.id));
107546
107775
 
107776
+ // ../../packages/storage/src/public-status-store.ts
107777
+ var eligibleQuery = buildAvailabilityChecksListQuery(
107778
+ "p.organization_id IN (SELECT organization_id FROM page)",
107779
+ "c.project_id IN (SELECT project_id FROM public_status_page_projects WHERE page_id IN (SELECT id FROM page)) AND c.id IN (SELECT check_id FROM public_status_page_checks WHERE page_id IN (SELECT id FROM page))",
107780
+ "500",
107781
+ "NULL"
107782
+ );
107783
+
107547
107784
  // src/local-retrieval-store.ts
107548
107785
  var CONNECTION_FILE_PATH2 = ".debugbundle/local/connection.json";
107549
107786
  var STATE_FILE_PATH = ".debugbundle/local/state.json";
@@ -107743,15 +107980,15 @@ async function readLocalState(dependencies) {
107743
107980
  throw error2;
107744
107981
  }
107745
107982
  }
107746
- async function writeLocalState(state, dependencies) {
107983
+ async function writeLocalState(state2, dependencies) {
107747
107984
  const rootDirectory = getWorkspaceRoot(dependencies);
107748
107985
  const writeFile = dependencies?.writeFile ?? import_promises9.writeFile;
107749
- await writeFile(getStateFilePath(rootDirectory), `${JSON.stringify(state, null, 2)}
107986
+ await writeFile(getStateFilePath(rootDirectory), `${JSON.stringify(state2, null, 2)}
107750
107987
  `, "utf8");
107751
107988
  }
107752
107989
  async function updateLocalIncidentStatus(input3, dependencies) {
107753
- const state = await readLocalState(dependencies);
107754
- const incident = state.incidents[input3.incidentId];
107990
+ const state2 = await readLocalState(dependencies);
107991
+ const incident = state2.incidents[input3.incidentId];
107755
107992
  if (incident === void 0) {
107756
107993
  throw createReadError(404, "incident_not_found");
107757
107994
  }
@@ -107760,8 +107997,8 @@ async function updateLocalIncidentStatus(input3, dependencies) {
107760
107997
  status: input3.status,
107761
107998
  ...input3.status === "resolved" ? { resolved_at: (/* @__PURE__ */ new Date()).toISOString() } : { resolved_at: null }
107762
107999
  };
107763
- state.incidents[input3.incidentId] = nextIncident;
107764
- await writeLocalState(state, dependencies);
108000
+ state2.incidents[input3.incidentId] = nextIncident;
108001
+ await writeLocalState(state2, dependencies);
107765
108002
  return projectLocalEvidence(nextIncident);
107766
108003
  }
107767
108004
  async function listLocalIncidents(input3, dependencies) {
@@ -108094,8 +108331,8 @@ async function cleanProcessedEventFiles(input3, dependencies) {
108094
108331
  const stat = dependencies.stat ?? import_promises11.stat;
108095
108332
  const rootDirectory = (dependencies.cwd ?? process.cwd)();
108096
108333
  const eventsDirectoryPath = (0, import_node_path11.join)(rootDirectory, LOCAL_EVENTS_DIRECTORY_PATH);
108097
- const state = await readLocalState(dependencies);
108098
- const lastProcessedEventFile = state.last_processed_event_file;
108334
+ const state2 = await readLocalState(dependencies);
108335
+ const lastProcessedEventFile = state2.last_processed_event_file;
108099
108336
  let eventFileNames;
108100
108337
  try {
108101
108338
  eventFileNames = (await readdir(eventsDirectoryPath)).filter((fileName) => fileName.endsWith(".events.json")).sort();
@@ -108181,8 +108418,8 @@ function sortLocalIncidentRemovalPriority(left, right) {
108181
108418
  async function applyLocalIncidentRetention(dependencies) {
108182
108419
  const rm = dependencies.rm ?? import_promises11.rm;
108183
108420
  const rootDirectory = (dependencies.cwd ?? process.cwd)();
108184
- const state = await readLocalState(dependencies);
108185
- const incidents = Object.values(state.incidents);
108421
+ const state2 = await readLocalState(dependencies);
108422
+ const incidents = Object.values(state2.incidents);
108186
108423
  if (incidents.length <= LOCAL_INCIDENT_RETENTION_LIMIT) {
108187
108424
  return {
108188
108425
  removed: 0,
@@ -108190,7 +108427,7 @@ async function applyLocalIncidentRetention(dependencies) {
108190
108427
  };
108191
108428
  }
108192
108429
  const incidentsToRemove = incidents.slice().sort(sortLocalIncidentRemovalPriority).slice(0, incidents.length - LOCAL_INCIDENT_RETENTION_LIMIT);
108193
- const nextIncidents = { ...state.incidents };
108430
+ const nextIncidents = { ...state2.incidents };
108194
108431
  for (const incident of incidentsToRemove) {
108195
108432
  delete nextIncidents[incident.incident_id];
108196
108433
  await rm(resolveWorkspacePath(rootDirectory, incident.bundle_path), { force: true });
@@ -108198,7 +108435,7 @@ async function applyLocalIncidentRetention(dependencies) {
108198
108435
  }
108199
108436
  await writeLocalState(
108200
108437
  {
108201
- ...state,
108438
+ ...state2,
108202
108439
  incidents: nextIncidents
108203
108440
  },
108204
108441
  dependencies
@@ -110403,14 +110640,14 @@ async function promptForInteractiveLoginSelection() {
110403
110640
  ].join("\n") + "\n"
110404
110641
  );
110405
110642
  for (; ; ) {
110406
- const selection = (await readlineInterface.question("Selection [1-4]: ")).trim();
110407
- if (selection === "1") {
110643
+ const selection2 = (await readlineInterface.question("Selection [1-4]: ")).trim();
110644
+ if (selection2 === "1") {
110408
110645
  return { kind: "github" };
110409
110646
  }
110410
- if (selection === "2") {
110647
+ if (selection2 === "2") {
110411
110648
  return { kind: "github-device" };
110412
110649
  }
110413
- if (selection === "3") {
110650
+ if (selection2 === "3") {
110414
110651
  const bearerToken = (await readlineInterface.question("Paste your member token: ")).trim();
110415
110652
  if (bearerToken.length > 0) {
110416
110653
  return {
@@ -110421,7 +110658,7 @@ async function promptForInteractiveLoginSelection() {
110421
110658
  import_node_process.stdout.write("Member token cannot be empty.\n");
110422
110659
  continue;
110423
110660
  }
110424
- if (selection === "4") {
110661
+ if (selection2 === "4") {
110425
110662
  return { kind: "cancel" };
110426
110663
  }
110427
110664
  import_node_process.stdout.write("Enter 1, 2, 3, or 4.\n");
@@ -110551,20 +110788,20 @@ async function maybePromptForLoginInput(input3, dependencies) {
110551
110788
  if (!interactive) {
110552
110789
  return input3;
110553
110790
  }
110554
- const selection = await (dependencies?.promptForInteractiveLogin ?? promptForInteractiveLoginSelection)();
110555
- if (selection.kind === "cancel") {
110791
+ const selection2 = await (dependencies?.promptForInteractiveLogin ?? promptForInteractiveLoginSelection)();
110792
+ if (selection2.kind === "cancel") {
110556
110793
  return {
110557
110794
  exitCode: 4,
110558
110795
  output: "Authentication cancelled."
110559
110796
  };
110560
110797
  }
110561
- if (selection.kind === "member-token") {
110798
+ if (selection2.kind === "member-token") {
110562
110799
  return {
110563
110800
  ...input3,
110564
- bearerToken: selection.bearerToken
110801
+ bearerToken: selection2.bearerToken
110565
110802
  };
110566
110803
  }
110567
- if (selection.kind === "github-device") {
110804
+ if (selection2.kind === "github-device") {
110568
110805
  return {
110569
110806
  ...input3,
110570
110807
  githubDevice: true
@@ -114057,13 +114294,13 @@ function sortIncidentRecord(incident) {
114057
114294
  source_events: [...incident.source_events].sort(compareEventEnvelopes)
114058
114295
  };
114059
114296
  }
114060
- function serializeState(state) {
114297
+ function serializeState(state2) {
114061
114298
  const incidents = Object.fromEntries(
114062
- Object.entries(state.incidents).sort(([left], [right]) => left.localeCompare(right)).map(([incidentId, incident]) => [incidentId, sortIncidentRecord(incident)])
114299
+ Object.entries(state2.incidents).sort(([left], [right]) => left.localeCompare(right)).map(([incidentId, incident]) => [incidentId, sortIncidentRecord(incident)])
114063
114300
  );
114064
114301
  return `${JSON.stringify({
114065
114302
  version: 1,
114066
- last_processed_event_file: state.last_processed_event_file,
114303
+ last_processed_event_file: state2.last_processed_event_file,
114067
114304
  incidents
114068
114305
  }, null, 2)}
114069
114306
  `;
@@ -117910,6 +118147,10 @@ var CLI_USAGE_LINES = [
117910
118147
  " debugbundle probe activate <project-id> --label-pattern <pattern> [--service <name>] [--environment <name>] [--ttl-seconds <n>] [--trigger-ttl-seconds <n>] [--auth-file <path>] [--json]",
117911
118148
  " debugbundle probe list <project-id> [--auth-file <path>] [--json]",
117912
118149
  " debugbundle probe deactivate <project-id> <activation-id> [--auth-file <path>] [--json]",
118150
+ " debugbundle health status get --project-id <id> [--auth-file <path>] [--json]",
118151
+ " debugbundle health status save --project-id <id> --settings-json <json> [--auth-file <path>] [--json]",
118152
+ " debugbundle health status options --project-id <id> [--cursor <project-id> | --check-project-id <project-id> [--check-cursor <check-id>]] [--auth-file <path>] [--json]",
118153
+ " debugbundle health status preview --project-id <id> [--auth-file <path>] [--json]",
117913
118154
  " debugbundle health checks list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
117914
118155
  " debugbundle health checks get <check-id> --project-id <id> [--auth-file <path>] [--json]",
117915
118156
  " debugbundle health checks create --project-id <id> --name <name> --url <url> --interval-seconds <n> [--method <GET|HEAD>] [--expected-status-min <code>] [--expected-status-max <code>] [--timeout-ms <n>] [--failure-threshold <n>] [--recovery-threshold <n>] [--environment <name>] [--service <name|null>] [--enabled <true|false>] [--auth-file <path>] [--json]",
@@ -118091,7 +118332,7 @@ async function runValidateCommand(input3, dependencies = {}) {
118091
118332
  }
118092
118333
  }
118093
118334
  checks.push(...agentChecks(report).filter((check5) => check5.name !== "canonical-skill"));
118094
- autoFixAvailable ||= report.agents.some((agent) => [agent.instruction, agent.discovery].some((state) => state === "missing" || state === "stale"));
118335
+ autoFixAvailable ||= report.agents.some((agent) => [agent.instruction, agent.discovery].some((state2) => state2 === "missing" || state2 === "stale"));
118095
118336
  const ignore = await ensureGitignore(rootDirectory, buildManagedGitignoreSection(), input3.fix === true);
118096
118337
  const gitignoreCheck = { name: "gitignore", status: ignore.present ? "ok" : "missing", message: ignore.changed ? `Updated ${GITIGNORE_FILE_PATH}` : `${ignore.present ? "Found" : "Missing"} managed ${GITIGNORE_FILE_PATH} entries` };
118097
118338
  if (gitignoreCheck.status === "missing") {
@@ -123238,6 +123479,142 @@ async function handleTokenCommand(parsedArgv, dependencies) {
123238
123479
  throw new CliInputError("Unknown token command.");
123239
123480
  }
123240
123481
 
123482
+ // src/public-status-commands.ts
123483
+ var PublicStatusApiError = class extends Error {
123484
+ constructor(status, message3) {
123485
+ super(message3);
123486
+ this.status = status;
123487
+ }
123488
+ };
123489
+ function createPublicStatusApi(http) {
123490
+ const path = (scope) => `/v1/projects/${encodeURIComponent(external_exports.string().uuid().parse(scope.projectId))}/status-page`;
123491
+ async function request(input3, schema) {
123492
+ const result = await http.request(input3);
123493
+ if (result.status !== 200) {
123494
+ const error2 = external_exports.object({ error: external_exports.string() }).safeParse(result.body);
123495
+ throw new PublicStatusApiError(
123496
+ result.status,
123497
+ error2.success ? error2.data.error : "Status request failed."
123498
+ );
123499
+ }
123500
+ return schema.parse(result.body);
123501
+ }
123502
+ return {
123503
+ get: (scope) => request(
123504
+ { method: "GET", path: path(scope), bearerToken: scope.bearerToken },
123505
+ PublicStatusManagementSchema
123506
+ ),
123507
+ save: (scope) => request(
123508
+ {
123509
+ method: "PUT",
123510
+ path: path(scope),
123511
+ bearerToken: scope.bearerToken,
123512
+ body: PublicStatusSettingsSchema.parse(scope.settings)
123513
+ },
123514
+ PublicStatusManagementSchema
123515
+ ),
123516
+ options: (scope) => {
123517
+ const query = PublicStatusOptionsQuerySchema.parse({
123518
+ ...scope.cursor ? { cursor: scope.cursor } : {},
123519
+ ...scope.check_project_id ? { check_project_id: scope.check_project_id } : {},
123520
+ ...scope.check_cursor ? { check_cursor: scope.check_cursor } : {}
123521
+ });
123522
+ const params = new URLSearchParams(
123523
+ Object.entries(query).filter(
123524
+ (entry) => typeof entry[1] === "string"
123525
+ )
123526
+ ).toString();
123527
+ return request(
123528
+ {
123529
+ method: "GET",
123530
+ path: `${path(scope)}/options${params ? `?${params}` : ""}`,
123531
+ bearerToken: scope.bearerToken
123532
+ },
123533
+ PublicStatusOptionsSchema
123534
+ );
123535
+ },
123536
+ preview: (scope) => request(
123537
+ { method: "GET", path: `${path(scope)}/preview`, bearerToken: scope.bearerToken },
123538
+ PublicStatusPageSchema
123539
+ )
123540
+ };
123541
+ }
123542
+ async function publicStatusWithAuthCommand(input3, dependencies) {
123543
+ return runAuthenticatedCliCommand(input3, {
123544
+ dependencies,
123545
+ async createApi(authInput, deps) {
123546
+ const authState = await (deps?.readAuthState ?? readCliAuthState)(authInput);
123547
+ return {
123548
+ authState,
123549
+ api: createPublicStatusApi(
123550
+ (deps?.createHttpClient ?? createCliHttpClient)({ baseUrl: authState.base_url })
123551
+ )
123552
+ };
123553
+ },
123554
+ async runCommand(auth, api) {
123555
+ try {
123556
+ const scope = { projectId: input3.projectId, bearerToken: auth.bearer_token };
123557
+ const result = input3.action === "save" ? await api.save({
123558
+ ...scope,
123559
+ settings: PublicStatusSettingsSchema.parse(input3.settings)
123560
+ }) : input3.action === "options" ? await api.options({
123561
+ ...scope,
123562
+ ...input3.cursor ? { cursor: input3.cursor } : {},
123563
+ ...input3.check_project_id ? { check_project_id: input3.check_project_id } : {},
123564
+ ...input3.check_cursor ? { check_cursor: input3.check_cursor } : {}
123565
+ }) : input3.action === "preview" ? await api.preview(scope) : await api.get(scope);
123566
+ return { exitCode: 0, output: JSON.stringify(result, null, input3.json ? void 0 : 2) };
123567
+ } catch (error2) {
123568
+ return {
123569
+ exitCode: error2 instanceof PublicStatusApiError ? error2.status === 401 ? 2 : error2.status === 404 ? 3 : [400, 403, 409].includes(error2.status) ? 4 : 1 : error2 instanceof external_exports.ZodError ? 4 : 1,
123570
+ output: error2 instanceof Error ? error2.message : "Status request failed."
123571
+ };
123572
+ }
123573
+ }
123574
+ });
123575
+ }
123576
+
123577
+ // src/management-status-command-handler.ts
123578
+ async function handleStatusCommand(parsed, dependencies) {
123579
+ const action = requirePositional(parsed, 2, "action");
123580
+ if (!["get", "save", "options", "preview"].includes(action))
123581
+ throw new CliInputError("Unknown health status command.");
123582
+ expectNoUnknownOptions(parsed, [
123583
+ "project-id",
123584
+ "auth-file",
123585
+ "json",
123586
+ ...action === "save" ? ["settings-json"] : action === "options" ? ["cursor", "check-project-id", "check-cursor"] : []
123587
+ ]);
123588
+ ensureNoExtraPositionals(parsed, 3);
123589
+ const projectId = readStringOption(parsed, "project-id");
123590
+ if (!projectId) throw new CliInputError("Missing required option --project-id.");
123591
+ let settings;
123592
+ if (action === "save") {
123593
+ try {
123594
+ settings = PublicStatusSettingsSchema.parse(
123595
+ JSON.parse(readStringOption(parsed, "settings-json") ?? "null")
123596
+ );
123597
+ } catch {
123598
+ throw new CliInputError(
123599
+ "--settings-json must contain a title, enabled flag and explicit project/check selections."
123600
+ );
123601
+ }
123602
+ }
123603
+ const cursor = readStringOption(parsed, "cursor");
123604
+ const checkProjectId = readStringOption(parsed, "check-project-id");
123605
+ const checkCursor = readStringOption(parsed, "check-cursor");
123606
+ return (dependencies.publicStatusCommand ?? publicStatusWithAuthCommand)(
123607
+ appendCommonAuthOptions(parsed, {
123608
+ action,
123609
+ projectId,
123610
+ ...settings === void 0 ? {} : { settings },
123611
+ ...cursor === void 0 ? {} : { cursor },
123612
+ ...checkProjectId === void 0 ? {} : { check_project_id: checkProjectId },
123613
+ ...checkCursor === void 0 ? {} : { check_cursor: checkCursor }
123614
+ })
123615
+ );
123616
+ }
123617
+
123241
123618
  // src/health-check-commands.ts
123242
123619
  var HealthCheckApiError = class extends Error {
123243
123620
  status;
@@ -123825,6 +124202,7 @@ function readRequiredName(parsedArgv) {
123825
124202
  }
123826
124203
  async function handleHealthCommand(parsedArgv, dependencies) {
123827
124204
  const resource = requirePositional(parsedArgv, 1, "resource");
124205
+ if (resource === "status") return handleStatusCommand(parsedArgv, dependencies);
123828
124206
  if (resource !== "checks") {
123829
124207
  throw new CliInputError("Unknown health command.");
123830
124208
  }
@@ -126953,7 +127331,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
126953
127331
  // package.json
126954
127332
  var package_default = {
126955
127333
  name: "@debugbundle/cli",
126956
- version: "1.14.0",
127334
+ version: "1.16.0",
126957
127335
  private: false,
126958
127336
  description: "Command-line interface for DebugBundle",
126959
127337
  license: "Apache-2.0",