@debugbundle/cli 1.14.0 → 1.15.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 +530 -275
  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
  }
@@ -75746,6 +75746,71 @@ var AnalyticsMetricsQuerySchema = external_exports.object({
75746
75746
  limit: external_exports.coerce.number().int().min(1).max(100).optional().default(10)
75747
75747
  }).strict();
75748
75748
 
75749
+ // ../../packages/shared-types/src/public-status.ts
75750
+ var PublicStatusIdSchema = external_exports.string().regex(/^[a-f0-9]{24}$/);
75751
+ var selection = external_exports.object({ project_id: external_exports.string().uuid(), check_ids: external_exports.array(external_exports.string().uuid()).max(50) }).strict();
75752
+ var PublicStatusSettingsSchema = external_exports.object({
75753
+ title: external_exports.string().trim().min(1).max(120),
75754
+ enabled: external_exports.boolean(),
75755
+ projects: external_exports.array(selection).min(1).max(50)
75756
+ }).strict().superRefine((value, context) => {
75757
+ 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) {
75758
+ context.addIssue({
75759
+ code: external_exports.ZodIssueCode.custom,
75760
+ message: "Choose distinct projects and checks within the publication limits."
75761
+ });
75762
+ }
75763
+ });
75764
+ var state = external_exports.enum(["unknown", "operational", "degraded", "down", "paused"]);
75765
+ var percentage = external_exports.number().min(0).max(100).nullable();
75766
+ var verifiedAt = external_exports.string().datetime({ offset: true }).nullable();
75767
+ var PublicStatusDaySchema = external_exports.object({
75768
+ day: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/),
75769
+ state,
75770
+ impact: external_exports.enum(["none", "minor", "elevated", "outage"]),
75771
+ total_checks: external_exports.number().int().nonnegative(),
75772
+ successful_checks: external_exports.number().int().nonnegative(),
75773
+ failed_checks: external_exports.number().int().nonnegative(),
75774
+ degraded_checks: external_exports.number().int().nonnegative(),
75775
+ downtime_seconds: external_exports.number().nonnegative()
75776
+ }).strict();
75777
+ var checkView = external_exports.object({
75778
+ key: external_exports.string().max(40),
75779
+ name: external_exports.string().max(120),
75780
+ current_state: state,
75781
+ uptime_percentage: percentage,
75782
+ last_verified_at: verifiedAt,
75783
+ days: external_exports.array(PublicStatusDaySchema).length(30)
75784
+ }).strict();
75785
+ var PublicStatusProjectSchema = checkView.extend({ checks: external_exports.array(checkView).max(50) }).strict();
75786
+ var PublicStatusPageSchema = external_exports.object({ title: external_exports.string().max(120), projects: external_exports.array(PublicStatusProjectSchema).max(50) }).strict();
75787
+ var PublicStatusManagementSchema = external_exports.object({
75788
+ settings: PublicStatusSettingsSchema,
75789
+ public_id: PublicStatusIdSchema.nullable(),
75790
+ public_url: external_exports.string().url().nullable(),
75791
+ access_mode: external_exports.enum(["manage", "preview"])
75792
+ }).strict();
75793
+ var PublicStatusOptionsQueryObjectSchema = external_exports.object({
75794
+ cursor: external_exports.string().uuid().optional(),
75795
+ check_project_id: external_exports.string().uuid().optional(),
75796
+ check_cursor: external_exports.string().uuid().optional()
75797
+ }).strict();
75798
+ var PublicStatusOptionsQuerySchema = PublicStatusOptionsQueryObjectSchema.refine(
75799
+ (v) => !v.check_cursor || !!v.check_project_id,
75800
+ "A check cursor requires a project."
75801
+ ).refine((v) => !v.cursor || !v.check_project_id, "Project and check pagination are separate.");
75802
+ var PublicStatusOptionsSchema = external_exports.object({
75803
+ projects: external_exports.array(
75804
+ external_exports.object({
75805
+ project_id: external_exports.string().uuid(),
75806
+ name: external_exports.string(),
75807
+ checks: external_exports.array(external_exports.object({ check_id: external_exports.string().uuid(), name: external_exports.string() }).strict()).max(50),
75808
+ next_check_cursor: external_exports.string().uuid().nullable()
75809
+ }).strict()
75810
+ ).max(50),
75811
+ next_cursor: external_exports.string().uuid().nullable()
75812
+ }).strict();
75813
+
75749
75814
  // ../../packages/shared-types/src/index.ts
75750
75815
  var SeveritySchema = external_exports.enum(["low", "medium", "high", "critical"]);
75751
75816
  var BundleSdkSchema = external_exports.object({
@@ -77311,76 +77376,76 @@ var BudgetExceeded = class extends Error {
77311
77376
  function byteLength(value) {
77312
77377
  return new TextEncoder().encode(value).length;
77313
77378
  }
77314
- function mask(state) {
77315
- state.redactionCount += 1;
77379
+ function mask(state2) {
77380
+ state2.redactionCount += 1;
77316
77381
  return REDACTED2;
77317
77382
  }
77318
- function sanitizeString(value, state, allowStructured) {
77319
- if (value.length > MAX_STRING_BYTES) return mask(state);
77383
+ function sanitizeString(value, state2, allowStructured) {
77384
+ if (value.length > MAX_STRING_BYTES) return mask(state2);
77320
77385
  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();
77386
+ if (length > MAX_STRING_BYTES) return mask(state2);
77387
+ state2.textBytes += length;
77388
+ if (state2.textBytes > state2.maxTotalBytes) throw new BudgetExceeded();
77324
77389
  if (allowStructured && (value.startsWith("{") || value.startsWith("["))) {
77325
77390
  try {
77326
77391
  const parsed = JSON.parse(value);
77327
77392
  if (typeof parsed === "object" && parsed !== null) {
77328
- const nested = sanitizeValue(parsed, state, 0, false);
77393
+ const nested = sanitizeValue(parsed, state2, 0, false);
77329
77394
  const encoded = JSON.stringify(nested);
77330
- if (encoded !== value) state.redactionCount += 1;
77395
+ if (encoded !== value) state2.redactionCount += 1;
77331
77396
  return encoded;
77332
77397
  }
77333
77398
  } catch (error2) {
77334
77399
  if (error2 instanceof BudgetExceeded) throw error2;
77335
77400
  }
77336
77401
  }
77337
- const result = scrubCredentialText(value, state.extra);
77338
- if (result !== value) state.redactionCount += 1;
77402
+ const result = scrubCredentialText(value, state2.extra);
77403
+ if (result !== value) state2.redactionCount += 1;
77339
77404
  if ((value.startsWith("{") || value.startsWith("[")) && result === value && /(?:password|token|secret|authorization|cookie)["']?\s*[:=]/i.test(value)) {
77340
- return mask(state);
77405
+ return mask(state2);
77341
77406
  }
77342
77407
  return result;
77343
77408
  }
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);
77409
+ function sanitizeValue(value, state2, depth, allowStructured) {
77410
+ state2.nodes += 1;
77411
+ if (state2.nodes > MAX_NODES) throw new BudgetExceeded();
77412
+ if (depth > MAX_DEPTH) return mask(state2);
77413
+ if (typeof value === "string") return sanitizeString(value, state2, allowStructured);
77349
77414
  if (value === null || typeof value === "boolean") return value;
77350
77415
  if (typeof value === "number" && Number.isFinite(value)) return value;
77351
77416
  if (typeof value !== "object") throw new TypeError("unsafe_input");
77352
- if (state.seen.has(value)) return "[Circular]";
77353
- state.seen.add(value);
77417
+ if (state2.seen.has(value)) return "[Circular]";
77418
+ state2.seen.add(value);
77354
77419
  try {
77355
77420
  if (Array.isArray(value)) {
77356
- if (value.length > MAX_ENTRIES) return mask(state);
77421
+ if (value.length > MAX_ENTRIES) return mask(state2);
77357
77422
  return Array.from({ length: value.length }, (_, index) => {
77358
77423
  const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
77359
77424
  if (descriptor === void 0 || !("value" in descriptor)) throw new TypeError("unsafe_input");
77360
- return sanitizeValue(descriptor.value, state, depth + 1, allowStructured);
77425
+ return sanitizeValue(descriptor.value, state2, depth + 1, allowStructured);
77361
77426
  });
77362
77427
  }
77363
77428
  if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {
77364
77429
  throw new TypeError("unsafe_input");
77365
77430
  }
77366
77431
  const keys2 = Object.keys(value);
77367
- if (keys2.length > MAX_ENTRIES) return mask(state);
77432
+ if (keys2.length > MAX_ENTRIES) return mask(state2);
77368
77433
  const result = {};
77369
77434
  for (const key of keys2) {
77370
77435
  if (key.length > 128) {
77371
- state.redactionCount += 1;
77436
+ state2.redactionCount += 1;
77372
77437
  continue;
77373
77438
  }
77374
- state.textBytes += byteLength(key);
77375
- if (state.textBytes > state.maxTotalBytes) throw new BudgetExceeded();
77376
- const safeKey = scrubCredentialText(key, state.extra);
77439
+ state2.textBytes += byteLength(key);
77440
+ if (state2.textBytes > state2.maxTotalBytes) throw new BudgetExceeded();
77441
+ const safeKey = scrubCredentialText(key, state2.extra);
77377
77442
  if (safeKey !== key) {
77378
- state.redactionCount += 1;
77443
+ state2.redactionCount += 1;
77379
77444
  continue;
77380
77445
  }
77381
77446
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
77382
77447
  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);
77448
+ const safeValue = isSensitiveKey(key, state2.keys) ? mask(state2) : sanitizeValue(descriptor.value, state2, depth + 1, allowStructured);
77384
77449
  Object.defineProperty(result, key, {
77385
77450
  value: safeValue,
77386
77451
  enumerable: true,
@@ -77390,7 +77455,7 @@ function sanitizeValue(value, state, depth, allowStructured) {
77390
77455
  }
77391
77456
  return result;
77392
77457
  } finally {
77393
- state.seen.delete(value);
77458
+ state2.seen.delete(value);
77394
77459
  }
77395
77460
  }
77396
77461
  function sanitizeTelemetry(value, options = {}) {
@@ -77403,7 +77468,7 @@ function sanitizeTelemetry(value, options = {}) {
77403
77468
  if (!Number.isInteger(maxTotalBytes) || maxTotalBytes < 1 || maxTotalBytes > 512 * 1024) {
77404
77469
  return { ok: false, reason: "unsafe_input" };
77405
77470
  }
77406
- const state = {
77471
+ const state2 = {
77407
77472
  nodes: 0,
77408
77473
  textBytes: 0,
77409
77474
  redactionCount: 0,
@@ -77412,11 +77477,11 @@ function sanitizeTelemetry(value, options = {}) {
77412
77477
  extra,
77413
77478
  maxTotalBytes
77414
77479
  };
77415
- const sanitized = sanitizeValue(value, state, 0, true);
77480
+ const sanitized = sanitizeValue(value, state2, 0, true);
77416
77481
  if (byteLength(JSON.stringify(sanitized)) > maxTotalBytes) {
77417
77482
  return { ok: false, reason: "budget_exceeded" };
77418
77483
  }
77419
- return { ok: true, value: sanitized, redactionCount: state.redactionCount };
77484
+ return { ok: true, value: sanitized, redactionCount: state2.redactionCount };
77420
77485
  } catch (error2) {
77421
77486
  return { ok: false, reason: error2 instanceof BudgetExceeded ? "budget_exceeded" : "unsafe_input" };
77422
77487
  }
@@ -84630,8 +84695,8 @@ async function readAgentAuthState(filePath = agentAuthFilePath()) {
84630
84695
  throw new Error("agent_auth_unavailable");
84631
84696
  }
84632
84697
  }
84633
- async function persistAgentAuthState(state, filePath = agentAuthFilePath()) {
84634
- const parsed = AgentAuthSchema.parse(state);
84698
+ async function persistAgentAuthState(state2, filePath = agentAuthFilePath()) {
84699
+ const parsed = AgentAuthSchema.parse(state2);
84635
84700
  await (0, import_promises7.mkdir)((0, import_node_path7.dirname)(filePath), { recursive: true, mode: 448 });
84636
84701
  const tmp = `${filePath}.${(0, import_node_crypto2.randomUUID)()}.tmp`;
84637
84702
  const file = await (0, import_promises7.open)(tmp, "wx", 384);
@@ -93219,19 +93284,19 @@ var err_out_default = ({
93219
93284
  message: message3,
93220
93285
  error_description: description,
93221
93286
  scope
93222
- }, state) => {
93287
+ }, state2) => {
93223
93288
  if (expose) {
93224
93289
  return {
93225
93290
  error: message3,
93226
93291
  ...description !== void 0 ? { error_description: description } : void 0,
93227
93292
  ...scope !== void 0 ? { scope } : void 0,
93228
- ...state !== void 0 ? { state } : void 0
93293
+ ...state2 !== void 0 ? { state: state2 } : void 0
93229
93294
  };
93230
93295
  }
93231
93296
  return {
93232
93297
  error: "server_error",
93233
93298
  error_description: "oops! something went wrong",
93234
- ...state ? { state } : void 0
93299
+ ...state2 ? { state: state2 } : void 0
93235
93300
  };
93236
93301
  };
93237
93302
 
@@ -93345,8 +93410,8 @@ var authorization_error_handler_default = (provider) => {
93345
93410
  recovery: oneRedirectUriClients
93346
93411
  }
93347
93412
  });
93348
- function getOutAndEmit(ctx, err, state) {
93349
- const out = { ...err_out_default(err, state), iss: ctx.oidc.provider.issuer };
93413
+ function getOutAndEmit(ctx, err, state2) {
93414
+ const out = { ...err_out_default(err, state2), iss: ctx.oidc.provider.issuer };
93350
93415
  if (err.expose) {
93351
93416
  provider.emit("authorization.error", ctx, err);
93352
93417
  debugError2("%o", out);
@@ -97157,7 +97222,7 @@ var confirm2 = [
97157
97222
  checkXsrf("could not find logout details"),
97158
97223
  async function endSession(ctx) {
97159
97224
  const { oidc: { session, params } } = ctx;
97160
- const { state } = session;
97225
+ const { state: state2 } = session;
97161
97226
  const {
97162
97227
  features: { backchannelLogout },
97163
97228
  cookies: { long: opts }
@@ -97166,7 +97231,7 @@ var confirm2 = [
97166
97231
  const clientIds = Object.keys(session.authorizations || {});
97167
97232
  const back = [];
97168
97233
  for (const clientId of clientIds) {
97169
- if (params.logout || clientId === state.clientId) {
97234
+ if (params.logout || clientId === state2.clientId) {
97170
97235
  const client = await clientForLogout(ctx, clientId);
97171
97236
  if (client) {
97172
97237
  const sid = session.sidFor(client.clientId);
@@ -97183,8 +97248,8 @@ var confirm2 = [
97183
97248
  }
97184
97249
  await Promise.all(back);
97185
97250
  }
97186
- if (state.clientId) {
97187
- ctx.oidc.entity("Client", await clientForLogout(ctx, state.clientId));
97251
+ if (state2.clientId) {
97252
+ ctx.oidc.entity("Client", await clientForLogout(ctx, state2.clientId));
97188
97253
  }
97189
97254
  if (params.logout) {
97190
97255
  if (session.authorizations) {
@@ -97202,24 +97267,24 @@ var confirm2 = [
97202
97267
  null,
97203
97268
  opts
97204
97269
  );
97205
- } else if (state.clientId) {
97206
- const grantId = session.grantIdFor(state.clientId);
97207
- if (grantId && !session.authorizationFor(state.clientId).persistsLogout) {
97270
+ } else if (state2.clientId) {
97271
+ const grantId = session.grantIdFor(state2.clientId);
97272
+ if (grantId && !session.authorizationFor(state2.clientId).persistsLogout) {
97208
97273
  await revoke(ctx, grantId);
97209
97274
  }
97210
97275
  session.state = void 0;
97211
97276
  if (session.authorizations) {
97212
- delete session.authorizations[state.clientId];
97277
+ delete session.authorizations[state2.clientId];
97213
97278
  }
97214
97279
  session.resetIdentifier();
97215
97280
  }
97216
- const usePostLogoutUri = state.postLogoutRedirectUri;
97217
- const forwardClientId = !usePostLogoutUri && !params.logout && state.clientId;
97281
+ const usePostLogoutUri = state2.postLogoutRedirectUri;
97282
+ const forwardClientId = !usePostLogoutUri && !params.logout && state2.clientId;
97218
97283
  const uri = redirectUri(
97219
- usePostLogoutUri ? state.postLogoutRedirectUri : ctx.oidc.urlFor("end_session_success"),
97284
+ usePostLogoutUri ? state2.postLogoutRedirectUri : ctx.oidc.urlFor("end_session_success"),
97220
97285
  {
97221
- ...usePostLogoutUri && state.state != null ? { state: state.state } : void 0,
97222
- ...forwardClientId ? { client_id: state.clientId } : void 0
97286
+ ...usePostLogoutUri && state2.state != null ? { state: state2.state } : void 0,
97287
+ ...forwardClientId ? { client_id: state2.clientId } : void 0
97223
97288
  }
97224
97289
  );
97225
97290
  ctx.oidc.provider.emit("end_session.success", ctx);
@@ -98839,8 +98904,8 @@ function getBaseModel(provider) {
98839
98904
  }
98840
98905
  ttlPercentagePassed() {
98841
98906
  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);
98907
+ const percentage2 = Math.floor(100 * ((now - this.iat) / (this.exp - this.iat)));
98908
+ return Math.max(Math.min(100, percentage2), 0);
98844
98909
  }
98845
98910
  get isValid() {
98846
98911
  return !this.isExpired;
@@ -101907,9 +101972,10 @@ function buildEligibilityCtes(organizationPredicate) {
101907
101972
  )
101908
101973
  `;
101909
101974
  }
101910
- var LIST_AVAILABILITY_CHECKS_QUERY = `
101975
+ function buildAvailabilityChecksListQuery(organizationPredicate, checkPredicate, limitSql = "$3", cursorSql = "$4") {
101976
+ return `
101911
101977
  WITH
101912
- ${buildEligibilityCtes("AND p.organization_id = $2::uuid")},
101978
+ ${buildEligibilityCtes(`AND ${organizationPredicate}`)},
101913
101979
  ranked AS (
101914
101980
  SELECT
101915
101981
  c.id::text AS check_id,
@@ -101956,8 +102022,8 @@ var LIST_AVAILABILITY_CHECKS_QUERY = `
101956
102022
  LEFT JOIN monitored_project_ranks monitored_ranks
101957
102023
  ON monitored_ranks.organization_id = p.organization_id
101958
102024
  AND monitored_ranks.project_id = c.project_id
101959
- WHERE c.project_id = $1::uuid
101960
- AND p.organization_id = $2::uuid
102025
+ WHERE ${checkPredicate}
102026
+ AND ${organizationPredicate}
101961
102027
  AND c.deleted_at IS NULL
101962
102028
  )
101963
102029
  SELECT
@@ -101968,10 +102034,15 @@ var LIST_AVAILABILITY_CHECKS_QUERY = `
101968
102034
  NOT ranked.enabled OR ranked.organization_check_rank <= ranked.plan_organization_check_limit
101969
102035
  AS within_organization_active_limit
101970
102036
  FROM ranked
101971
- WHERE ($4::text IS NULL OR ranked.check_id = $4)
102037
+ WHERE (${cursorSql}::text IS NULL OR ranked.check_id = ${cursorSql})
101972
102038
  ORDER BY ranked.created_at DESC
101973
- LIMIT $3
102039
+ LIMIT ${limitSql}
101974
102040
  `;
102041
+ }
102042
+ var LIST_AVAILABILITY_CHECKS_QUERY = buildAvailabilityChecksListQuery(
102043
+ "p.organization_id = $2::uuid",
102044
+ "c.project_id = $1::uuid"
102045
+ );
101975
102046
  var CLAIM_DUE_AVAILABILITY_CHECKS_QUERY = `
101976
102047
  WITH due_organizations AS (
101977
102048
  SELECT DISTINCT p.organization_id
@@ -103280,8 +103351,41 @@ function defineStorageSchemaMigration(input3) {
103280
103351
  };
103281
103352
  }
103282
103353
 
103283
- // ../../packages/storage/src/analytics-flow-schema.ts
103354
+ // ../../packages/storage/src/public-status-schema.ts
103284
103355
  var statements = [
103356
+ `CREATE TABLE IF NOT EXISTS public_status_pages (
103357
+ id uuid PRIMARY KEY, anchor_project_id uuid NOT NULL UNIQUE REFERENCES projects(id) ON DELETE CASCADE,
103358
+ owner_user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
103359
+ organization_id uuid NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
103360
+ public_id text NOT NULL UNIQUE CHECK (public_id ~ '^[a-f0-9]{24}$'),
103361
+ title text NOT NULL CHECK (length(title) BETWEEN 1 AND 120), enabled boolean NOT NULL DEFAULT false,
103362
+ created_at timestamptz NOT NULL DEFAULT now(), updated_at timestamptz NOT NULL DEFAULT now()
103363
+ )`,
103364
+ `CREATE TABLE IF NOT EXISTS public_status_page_projects (
103365
+ page_id uuid NOT NULL REFERENCES public_status_pages(id) ON DELETE CASCADE,
103366
+ project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
103367
+ position integer NOT NULL CHECK (position BETWEEN 0 AND 49), PRIMARY KEY(page_id, project_id)
103368
+ )`,
103369
+ `CREATE TABLE IF NOT EXISTS public_status_page_checks (
103370
+ page_id uuid NOT NULL, project_id uuid NOT NULL, check_id uuid NOT NULL REFERENCES availability_checks(id) ON DELETE CASCADE,
103371
+ PRIMARY KEY(page_id, check_id), FOREIGN KEY(page_id, project_id) REFERENCES public_status_page_projects(page_id, project_id) ON DELETE CASCADE
103372
+ )`,
103373
+ "CREATE INDEX IF NOT EXISTS public_status_page_projects_project_idx ON public_status_page_projects(project_id)",
103374
+ "CREATE INDEX IF NOT EXISTS public_status_page_checks_check_idx ON public_status_page_checks(check_id)"
103375
+ ];
103376
+ var PUBLIC_STATUS_BOOTSTRAP_STATEMENTS = statements.map(
103377
+ (s) => s.replaceAll(" IF NOT EXISTS", "")
103378
+ );
103379
+ var PUBLIC_STATUS_SCHEMA_MIGRATIONS = [
103380
+ defineStorageSchemaMigration({
103381
+ id: "202610080001_add_public_status_pages",
103382
+ description: "Add opt-in, explicitly selected public availability pages.",
103383
+ statements
103384
+ })
103385
+ ];
103386
+
103387
+ // ../../packages/storage/src/analytics-flow-schema.ts
103388
+ var statements2 = [
103285
103389
  `CREATE TABLE IF NOT EXISTS analytics_flow_definitions (
103286
103390
  id uuid PRIMARY KEY, project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
103287
103391
  flow_key text NOT NULL, version integer NOT NULL DEFAULT 1, definition jsonb NOT NULL,
@@ -103314,18 +103418,18 @@ var statements = [
103314
103418
  )`,
103315
103419
  `CREATE INDEX IF NOT EXISTS analytics_flow_rollups_expiry_idx ON analytics_flow_rollups(cohort_date, flow_id)`
103316
103420
  ];
103317
- var ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS = statements.map(
103421
+ var ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS = statements2.map(
103318
103422
  (statement) => statement.replaceAll(" IF NOT EXISTS", "")
103319
103423
  );
103320
103424
  var migration = {
103321
103425
  id: "202610030001_add_public_analytics_flows",
103322
103426
  description: "Add customer project flow definitions, bounded continuity and aggregate reports.",
103323
- statements
103427
+ statements: statements2
103324
103428
  };
103325
103429
  var ANALYTICS_FLOW_SCHEMA_MIGRATIONS = [defineStorageSchemaMigration(migration)];
103326
103430
 
103327
103431
  // ../../packages/storage/src/browser-recovery-schema.ts
103328
- var statements2 = [
103432
+ var statements3 = [
103329
103433
  `ALTER TABLE alert_deliveries ADD COLUMN IF NOT EXISTS coalescing_key text`,
103330
103434
  `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
103435
  `CREATE TABLE IF NOT EXISTS browser_recovery_events (
@@ -103347,10 +103451,10 @@ var BROWSER_RECOVERY_MIGRATIONS = [
103347
103451
  defineStorageSchemaMigration({
103348
103452
  id: "202609220001_add_browser_recovery_context",
103349
103453
  description: "Index browser recovery context and separate burst suppression from alert cooldown identity",
103350
- statements: statements2
103454
+ statements: statements3
103351
103455
  })
103352
103456
  ];
103353
- var BROWSER_RECOVERY_BOOTSTRAP_STATEMENTS = statements2.filter((statement) => !statement.startsWith("ALTER TABLE")).map((statement) => statement.replaceAll(" IF NOT EXISTS", ""));
103457
+ var BROWSER_RECOVERY_BOOTSTRAP_STATEMENTS = statements3.filter((statement) => !statement.startsWith("ALTER TABLE")).map((statement) => statement.replaceAll(" IF NOT EXISTS", ""));
103354
103458
 
103355
103459
  // ../../packages/storage/src/availability-check-bootstrap-statements.ts
103356
103460
  var AVAILABILITY_CHECK_BOOTSTRAP_STATEMENTS = [
@@ -105326,7 +105430,8 @@ var STORAGE_BOOTSTRAP_STATEMENTS2 = [
105326
105430
  ...AVAILABILITY_CHECK_BOOTSTRAP_STATEMENTS,
105327
105431
  ...ANALYTICS_BOOTSTRAP_STATEMENTS,
105328
105432
  ...WORKER_JOB_BOOTSTRAP_STATEMENTS,
105329
- ...ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS
105433
+ ...ANALYTICS_FLOW_BOOTSTRAP_STATEMENTS,
105434
+ ...PUBLIC_STATUS_BOOTSTRAP_STATEMENTS
105330
105435
  ];
105331
105436
 
105332
105437
  // ../../packages/storage/src/migrations.ts
@@ -107541,9 +107646,18 @@ var STORAGE_SCHEMA_MIGRATIONS2 = [
107541
107646
  ...ANALYTICS_STORAGE_SCHEMA_MIGRATIONS,
107542
107647
  ...OPENAI_OAUTH_STORAGE_SCHEMA_MIGRATIONS,
107543
107648
  ...WORKER_JOB_SCHEMA_MIGRATIONS,
107544
- ...ANALYTICS_FLOW_SCHEMA_MIGRATIONS
107649
+ ...ANALYTICS_FLOW_SCHEMA_MIGRATIONS,
107650
+ ...PUBLIC_STATUS_SCHEMA_MIGRATIONS
107545
107651
  ].sort((left, right) => left.id.localeCompare(right.id));
107546
107652
 
107653
+ // ../../packages/storage/src/public-status-store.ts
107654
+ var eligibleQuery = buildAvailabilityChecksListQuery(
107655
+ "p.organization_id IN (SELECT organization_id FROM page)",
107656
+ "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))",
107657
+ "500",
107658
+ "NULL"
107659
+ );
107660
+
107547
107661
  // src/local-retrieval-store.ts
107548
107662
  var CONNECTION_FILE_PATH2 = ".debugbundle/local/connection.json";
107549
107663
  var STATE_FILE_PATH = ".debugbundle/local/state.json";
@@ -107743,15 +107857,15 @@ async function readLocalState(dependencies) {
107743
107857
  throw error2;
107744
107858
  }
107745
107859
  }
107746
- async function writeLocalState(state, dependencies) {
107860
+ async function writeLocalState(state2, dependencies) {
107747
107861
  const rootDirectory = getWorkspaceRoot(dependencies);
107748
107862
  const writeFile = dependencies?.writeFile ?? import_promises9.writeFile;
107749
- await writeFile(getStateFilePath(rootDirectory), `${JSON.stringify(state, null, 2)}
107863
+ await writeFile(getStateFilePath(rootDirectory), `${JSON.stringify(state2, null, 2)}
107750
107864
  `, "utf8");
107751
107865
  }
107752
107866
  async function updateLocalIncidentStatus(input3, dependencies) {
107753
- const state = await readLocalState(dependencies);
107754
- const incident = state.incidents[input3.incidentId];
107867
+ const state2 = await readLocalState(dependencies);
107868
+ const incident = state2.incidents[input3.incidentId];
107755
107869
  if (incident === void 0) {
107756
107870
  throw createReadError(404, "incident_not_found");
107757
107871
  }
@@ -107760,8 +107874,8 @@ async function updateLocalIncidentStatus(input3, dependencies) {
107760
107874
  status: input3.status,
107761
107875
  ...input3.status === "resolved" ? { resolved_at: (/* @__PURE__ */ new Date()).toISOString() } : { resolved_at: null }
107762
107876
  };
107763
- state.incidents[input3.incidentId] = nextIncident;
107764
- await writeLocalState(state, dependencies);
107877
+ state2.incidents[input3.incidentId] = nextIncident;
107878
+ await writeLocalState(state2, dependencies);
107765
107879
  return projectLocalEvidence(nextIncident);
107766
107880
  }
107767
107881
  async function listLocalIncidents(input3, dependencies) {
@@ -108094,8 +108208,8 @@ async function cleanProcessedEventFiles(input3, dependencies) {
108094
108208
  const stat = dependencies.stat ?? import_promises11.stat;
108095
108209
  const rootDirectory = (dependencies.cwd ?? process.cwd)();
108096
108210
  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;
108211
+ const state2 = await readLocalState(dependencies);
108212
+ const lastProcessedEventFile = state2.last_processed_event_file;
108099
108213
  let eventFileNames;
108100
108214
  try {
108101
108215
  eventFileNames = (await readdir(eventsDirectoryPath)).filter((fileName) => fileName.endsWith(".events.json")).sort();
@@ -108181,8 +108295,8 @@ function sortLocalIncidentRemovalPriority(left, right) {
108181
108295
  async function applyLocalIncidentRetention(dependencies) {
108182
108296
  const rm = dependencies.rm ?? import_promises11.rm;
108183
108297
  const rootDirectory = (dependencies.cwd ?? process.cwd)();
108184
- const state = await readLocalState(dependencies);
108185
- const incidents = Object.values(state.incidents);
108298
+ const state2 = await readLocalState(dependencies);
108299
+ const incidents = Object.values(state2.incidents);
108186
108300
  if (incidents.length <= LOCAL_INCIDENT_RETENTION_LIMIT) {
108187
108301
  return {
108188
108302
  removed: 0,
@@ -108190,7 +108304,7 @@ async function applyLocalIncidentRetention(dependencies) {
108190
108304
  };
108191
108305
  }
108192
108306
  const incidentsToRemove = incidents.slice().sort(sortLocalIncidentRemovalPriority).slice(0, incidents.length - LOCAL_INCIDENT_RETENTION_LIMIT);
108193
- const nextIncidents = { ...state.incidents };
108307
+ const nextIncidents = { ...state2.incidents };
108194
108308
  for (const incident of incidentsToRemove) {
108195
108309
  delete nextIncidents[incident.incident_id];
108196
108310
  await rm(resolveWorkspacePath(rootDirectory, incident.bundle_path), { force: true });
@@ -108198,7 +108312,7 @@ async function applyLocalIncidentRetention(dependencies) {
108198
108312
  }
108199
108313
  await writeLocalState(
108200
108314
  {
108201
- ...state,
108315
+ ...state2,
108202
108316
  incidents: nextIncidents
108203
108317
  },
108204
108318
  dependencies
@@ -110403,14 +110517,14 @@ async function promptForInteractiveLoginSelection() {
110403
110517
  ].join("\n") + "\n"
110404
110518
  );
110405
110519
  for (; ; ) {
110406
- const selection = (await readlineInterface.question("Selection [1-4]: ")).trim();
110407
- if (selection === "1") {
110520
+ const selection2 = (await readlineInterface.question("Selection [1-4]: ")).trim();
110521
+ if (selection2 === "1") {
110408
110522
  return { kind: "github" };
110409
110523
  }
110410
- if (selection === "2") {
110524
+ if (selection2 === "2") {
110411
110525
  return { kind: "github-device" };
110412
110526
  }
110413
- if (selection === "3") {
110527
+ if (selection2 === "3") {
110414
110528
  const bearerToken = (await readlineInterface.question("Paste your member token: ")).trim();
110415
110529
  if (bearerToken.length > 0) {
110416
110530
  return {
@@ -110421,7 +110535,7 @@ async function promptForInteractiveLoginSelection() {
110421
110535
  import_node_process.stdout.write("Member token cannot be empty.\n");
110422
110536
  continue;
110423
110537
  }
110424
- if (selection === "4") {
110538
+ if (selection2 === "4") {
110425
110539
  return { kind: "cancel" };
110426
110540
  }
110427
110541
  import_node_process.stdout.write("Enter 1, 2, 3, or 4.\n");
@@ -110551,20 +110665,20 @@ async function maybePromptForLoginInput(input3, dependencies) {
110551
110665
  if (!interactive) {
110552
110666
  return input3;
110553
110667
  }
110554
- const selection = await (dependencies?.promptForInteractiveLogin ?? promptForInteractiveLoginSelection)();
110555
- if (selection.kind === "cancel") {
110668
+ const selection2 = await (dependencies?.promptForInteractiveLogin ?? promptForInteractiveLoginSelection)();
110669
+ if (selection2.kind === "cancel") {
110556
110670
  return {
110557
110671
  exitCode: 4,
110558
110672
  output: "Authentication cancelled."
110559
110673
  };
110560
110674
  }
110561
- if (selection.kind === "member-token") {
110675
+ if (selection2.kind === "member-token") {
110562
110676
  return {
110563
110677
  ...input3,
110564
- bearerToken: selection.bearerToken
110678
+ bearerToken: selection2.bearerToken
110565
110679
  };
110566
110680
  }
110567
- if (selection.kind === "github-device") {
110681
+ if (selection2.kind === "github-device") {
110568
110682
  return {
110569
110683
  ...input3,
110570
110684
  githubDevice: true
@@ -114057,13 +114171,13 @@ function sortIncidentRecord(incident) {
114057
114171
  source_events: [...incident.source_events].sort(compareEventEnvelopes)
114058
114172
  };
114059
114173
  }
114060
- function serializeState(state) {
114174
+ function serializeState(state2) {
114061
114175
  const incidents = Object.fromEntries(
114062
- Object.entries(state.incidents).sort(([left], [right]) => left.localeCompare(right)).map(([incidentId, incident]) => [incidentId, sortIncidentRecord(incident)])
114176
+ Object.entries(state2.incidents).sort(([left], [right]) => left.localeCompare(right)).map(([incidentId, incident]) => [incidentId, sortIncidentRecord(incident)])
114063
114177
  );
114064
114178
  return `${JSON.stringify({
114065
114179
  version: 1,
114066
- last_processed_event_file: state.last_processed_event_file,
114180
+ last_processed_event_file: state2.last_processed_event_file,
114067
114181
  incidents
114068
114182
  }, null, 2)}
114069
114183
  `;
@@ -117910,6 +118024,10 @@ var CLI_USAGE_LINES = [
117910
118024
  " debugbundle probe activate <project-id> --label-pattern <pattern> [--service <name>] [--environment <name>] [--ttl-seconds <n>] [--trigger-ttl-seconds <n>] [--auth-file <path>] [--json]",
117911
118025
  " debugbundle probe list <project-id> [--auth-file <path>] [--json]",
117912
118026
  " debugbundle probe deactivate <project-id> <activation-id> [--auth-file <path>] [--json]",
118027
+ " debugbundle health status get --project-id <id> [--auth-file <path>] [--json]",
118028
+ " debugbundle health status save --project-id <id> --settings-json <json> [--auth-file <path>] [--json]",
118029
+ " debugbundle health status options --project-id <id> [--cursor <project-id> | --check-project-id <project-id> [--check-cursor <check-id>]] [--auth-file <path>] [--json]",
118030
+ " debugbundle health status preview --project-id <id> [--auth-file <path>] [--json]",
117913
118031
  " debugbundle health checks list --project-id <id> [--limit <n>] [--auth-file <path>] [--json]",
117914
118032
  " debugbundle health checks get <check-id> --project-id <id> [--auth-file <path>] [--json]",
117915
118033
  " 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 +118209,7 @@ async function runValidateCommand(input3, dependencies = {}) {
118091
118209
  }
118092
118210
  }
118093
118211
  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"));
118212
+ autoFixAvailable ||= report.agents.some((agent) => [agent.instruction, agent.discovery].some((state2) => state2 === "missing" || state2 === "stale"));
118095
118213
  const ignore = await ensureGitignore(rootDirectory, buildManagedGitignoreSection(), input3.fix === true);
118096
118214
  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
118215
  if (gitignoreCheck.status === "missing") {
@@ -123238,6 +123356,142 @@ async function handleTokenCommand(parsedArgv, dependencies) {
123238
123356
  throw new CliInputError("Unknown token command.");
123239
123357
  }
123240
123358
 
123359
+ // src/public-status-commands.ts
123360
+ var PublicStatusApiError = class extends Error {
123361
+ constructor(status, message3) {
123362
+ super(message3);
123363
+ this.status = status;
123364
+ }
123365
+ };
123366
+ function createPublicStatusApi(http) {
123367
+ const path = (scope) => `/v1/projects/${encodeURIComponent(external_exports.string().uuid().parse(scope.projectId))}/status-page`;
123368
+ async function request(input3, schema) {
123369
+ const result = await http.request(input3);
123370
+ if (result.status !== 200) {
123371
+ const error2 = external_exports.object({ error: external_exports.string() }).safeParse(result.body);
123372
+ throw new PublicStatusApiError(
123373
+ result.status,
123374
+ error2.success ? error2.data.error : "Status request failed."
123375
+ );
123376
+ }
123377
+ return schema.parse(result.body);
123378
+ }
123379
+ return {
123380
+ get: (scope) => request(
123381
+ { method: "GET", path: path(scope), bearerToken: scope.bearerToken },
123382
+ PublicStatusManagementSchema
123383
+ ),
123384
+ save: (scope) => request(
123385
+ {
123386
+ method: "PUT",
123387
+ path: path(scope),
123388
+ bearerToken: scope.bearerToken,
123389
+ body: PublicStatusSettingsSchema.parse(scope.settings)
123390
+ },
123391
+ PublicStatusManagementSchema
123392
+ ),
123393
+ options: (scope) => {
123394
+ const query = PublicStatusOptionsQuerySchema.parse({
123395
+ ...scope.cursor ? { cursor: scope.cursor } : {},
123396
+ ...scope.check_project_id ? { check_project_id: scope.check_project_id } : {},
123397
+ ...scope.check_cursor ? { check_cursor: scope.check_cursor } : {}
123398
+ });
123399
+ const params = new URLSearchParams(
123400
+ Object.entries(query).filter(
123401
+ (entry) => typeof entry[1] === "string"
123402
+ )
123403
+ ).toString();
123404
+ return request(
123405
+ {
123406
+ method: "GET",
123407
+ path: `${path(scope)}/options${params ? `?${params}` : ""}`,
123408
+ bearerToken: scope.bearerToken
123409
+ },
123410
+ PublicStatusOptionsSchema
123411
+ );
123412
+ },
123413
+ preview: (scope) => request(
123414
+ { method: "GET", path: `${path(scope)}/preview`, bearerToken: scope.bearerToken },
123415
+ PublicStatusPageSchema
123416
+ )
123417
+ };
123418
+ }
123419
+ async function publicStatusWithAuthCommand(input3, dependencies) {
123420
+ return runAuthenticatedCliCommand(input3, {
123421
+ dependencies,
123422
+ async createApi(authInput, deps) {
123423
+ const authState = await (deps?.readAuthState ?? readCliAuthState)(authInput);
123424
+ return {
123425
+ authState,
123426
+ api: createPublicStatusApi(
123427
+ (deps?.createHttpClient ?? createCliHttpClient)({ baseUrl: authState.base_url })
123428
+ )
123429
+ };
123430
+ },
123431
+ async runCommand(auth, api) {
123432
+ try {
123433
+ const scope = { projectId: input3.projectId, bearerToken: auth.bearer_token };
123434
+ const result = input3.action === "save" ? await api.save({
123435
+ ...scope,
123436
+ settings: PublicStatusSettingsSchema.parse(input3.settings)
123437
+ }) : input3.action === "options" ? await api.options({
123438
+ ...scope,
123439
+ ...input3.cursor ? { cursor: input3.cursor } : {},
123440
+ ...input3.check_project_id ? { check_project_id: input3.check_project_id } : {},
123441
+ ...input3.check_cursor ? { check_cursor: input3.check_cursor } : {}
123442
+ }) : input3.action === "preview" ? await api.preview(scope) : await api.get(scope);
123443
+ return { exitCode: 0, output: JSON.stringify(result, null, input3.json ? void 0 : 2) };
123444
+ } catch (error2) {
123445
+ return {
123446
+ 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,
123447
+ output: error2 instanceof Error ? error2.message : "Status request failed."
123448
+ };
123449
+ }
123450
+ }
123451
+ });
123452
+ }
123453
+
123454
+ // src/management-status-command-handler.ts
123455
+ async function handleStatusCommand(parsed, dependencies) {
123456
+ const action = requirePositional(parsed, 2, "action");
123457
+ if (!["get", "save", "options", "preview"].includes(action))
123458
+ throw new CliInputError("Unknown health status command.");
123459
+ expectNoUnknownOptions(parsed, [
123460
+ "project-id",
123461
+ "auth-file",
123462
+ "json",
123463
+ ...action === "save" ? ["settings-json"] : action === "options" ? ["cursor", "check-project-id", "check-cursor"] : []
123464
+ ]);
123465
+ ensureNoExtraPositionals(parsed, 3);
123466
+ const projectId = readStringOption(parsed, "project-id");
123467
+ if (!projectId) throw new CliInputError("Missing required option --project-id.");
123468
+ let settings;
123469
+ if (action === "save") {
123470
+ try {
123471
+ settings = PublicStatusSettingsSchema.parse(
123472
+ JSON.parse(readStringOption(parsed, "settings-json") ?? "null")
123473
+ );
123474
+ } catch {
123475
+ throw new CliInputError(
123476
+ "--settings-json must contain a title, enabled flag and explicit project/check selections."
123477
+ );
123478
+ }
123479
+ }
123480
+ const cursor = readStringOption(parsed, "cursor");
123481
+ const checkProjectId = readStringOption(parsed, "check-project-id");
123482
+ const checkCursor = readStringOption(parsed, "check-cursor");
123483
+ return (dependencies.publicStatusCommand ?? publicStatusWithAuthCommand)(
123484
+ appendCommonAuthOptions(parsed, {
123485
+ action,
123486
+ projectId,
123487
+ ...settings === void 0 ? {} : { settings },
123488
+ ...cursor === void 0 ? {} : { cursor },
123489
+ ...checkProjectId === void 0 ? {} : { check_project_id: checkProjectId },
123490
+ ...checkCursor === void 0 ? {} : { check_cursor: checkCursor }
123491
+ })
123492
+ );
123493
+ }
123494
+
123241
123495
  // src/health-check-commands.ts
123242
123496
  var HealthCheckApiError = class extends Error {
123243
123497
  status;
@@ -123825,6 +124079,7 @@ function readRequiredName(parsedArgv) {
123825
124079
  }
123826
124080
  async function handleHealthCommand(parsedArgv, dependencies) {
123827
124081
  const resource = requirePositional(parsedArgv, 1, "resource");
124082
+ if (resource === "status") return handleStatusCommand(parsedArgv, dependencies);
123828
124083
  if (resource !== "checks") {
123829
124084
  throw new CliInputError("Unknown health command.");
123830
124085
  }
@@ -126953,7 +127208,7 @@ async function handleCaptureRuleCommand2(parsedArgv, dependencies) {
126953
127208
  // package.json
126954
127209
  var package_default = {
126955
127210
  name: "@debugbundle/cli",
126956
- version: "1.14.0",
127211
+ version: "1.15.0",
126957
127212
  private: false,
126958
127213
  description: "Command-line interface for DebugBundle",
126959
127214
  license: "Apache-2.0",