repoburg 1.3.297 → 1.3.298

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.
@@ -6128,8 +6128,8 @@ var require_req = __commonJS({
6128
6128
  if (req.originalUrl) {
6129
6129
  _req.url = req.originalUrl;
6130
6130
  } else {
6131
- const path12 = req.path;
6132
- _req.url = typeof path12 === "string" ? path12 : req.url ? req.url.path || req.url : void 0;
6131
+ const path13 = req.path;
6132
+ _req.url = typeof path13 === "string" ? path13 : req.url ? req.url.path || req.url : void 0;
6133
6133
  }
6134
6134
  if (req.query) {
6135
6135
  _req.query = req.query;
@@ -6294,14 +6294,14 @@ var require_redact = __commonJS({
6294
6294
  }
6295
6295
  return obj;
6296
6296
  }
6297
- function parsePath(path12) {
6297
+ function parsePath(path13) {
6298
6298
  const parts = [];
6299
6299
  let current = "";
6300
6300
  let inBrackets = false;
6301
6301
  let inQuotes = false;
6302
6302
  let quoteChar = "";
6303
- for (let i = 0; i < path12.length; i++) {
6304
- const char = path12[i];
6303
+ for (let i = 0; i < path13.length; i++) {
6304
+ const char = path13[i];
6305
6305
  if (!inBrackets && char === ".") {
6306
6306
  if (current) {
6307
6307
  parts.push(current);
@@ -6432,10 +6432,10 @@ var require_redact = __commonJS({
6432
6432
  return current;
6433
6433
  }
6434
6434
  function redactPaths(obj, paths, censor, remove = false) {
6435
- for (const path12 of paths) {
6436
- const parts = parsePath(path12);
6435
+ for (const path13 of paths) {
6436
+ const parts = parsePath(path13);
6437
6437
  if (parts.includes("*")) {
6438
- redactWildcardPath(obj, parts, censor, path12, remove);
6438
+ redactWildcardPath(obj, parts, censor, path13, remove);
6439
6439
  } else {
6440
6440
  if (remove) {
6441
6441
  removeKey(obj, parts);
@@ -6520,8 +6520,8 @@ var require_redact = __commonJS({
6520
6520
  }
6521
6521
  } else {
6522
6522
  if (afterWildcard.includes("*")) {
6523
- const wrappedCensor = typeof censor === "function" ? (value, path12) => {
6524
- const fullPath = [...pathArray.slice(0, pathLength), ...path12];
6523
+ const wrappedCensor = typeof censor === "function" ? (value, path13) => {
6524
+ const fullPath = [...pathArray.slice(0, pathLength), ...path13];
6525
6525
  return censor(value, fullPath);
6526
6526
  } : censor;
6527
6527
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -6556,8 +6556,8 @@ var require_redact = __commonJS({
6556
6556
  return null;
6557
6557
  }
6558
6558
  const pathStructure = /* @__PURE__ */ new Map();
6559
- for (const path12 of pathsToClone) {
6560
- const parts = parsePath(path12);
6559
+ for (const path13 of pathsToClone) {
6560
+ const parts = parsePath(path13);
6561
6561
  let current = pathStructure;
6562
6562
  for (let i = 0; i < parts.length; i++) {
6563
6563
  const part = parts[i];
@@ -6609,24 +6609,24 @@ var require_redact = __commonJS({
6609
6609
  }
6610
6610
  return cloneSelectively(obj, pathStructure);
6611
6611
  }
6612
- function validatePath(path12) {
6613
- if (typeof path12 !== "string") {
6612
+ function validatePath(path13) {
6613
+ if (typeof path13 !== "string") {
6614
6614
  throw new Error("Paths must be (non-empty) strings");
6615
6615
  }
6616
- if (path12 === "") {
6616
+ if (path13 === "") {
6617
6617
  throw new Error("Invalid redaction path ()");
6618
6618
  }
6619
- if (path12.includes("..")) {
6620
- throw new Error(`Invalid redaction path (${path12})`);
6619
+ if (path13.includes("..")) {
6620
+ throw new Error(`Invalid redaction path (${path13})`);
6621
6621
  }
6622
- if (path12.includes(",")) {
6623
- throw new Error(`Invalid redaction path (${path12})`);
6622
+ if (path13.includes(",")) {
6623
+ throw new Error(`Invalid redaction path (${path13})`);
6624
6624
  }
6625
6625
  let bracketCount = 0;
6626
6626
  let inQuotes = false;
6627
6627
  let quoteChar = "";
6628
- for (let i = 0; i < path12.length; i++) {
6629
- const char = path12[i];
6628
+ for (let i = 0; i < path13.length; i++) {
6629
+ const char = path13[i];
6630
6630
  if ((char === '"' || char === "'") && bracketCount > 0) {
6631
6631
  if (!inQuotes) {
6632
6632
  inQuotes = true;
@@ -6640,20 +6640,20 @@ var require_redact = __commonJS({
6640
6640
  } else if (char === "]" && !inQuotes) {
6641
6641
  bracketCount--;
6642
6642
  if (bracketCount < 0) {
6643
- throw new Error(`Invalid redaction path (${path12})`);
6643
+ throw new Error(`Invalid redaction path (${path13})`);
6644
6644
  }
6645
6645
  }
6646
6646
  }
6647
6647
  if (bracketCount !== 0) {
6648
- throw new Error(`Invalid redaction path (${path12})`);
6648
+ throw new Error(`Invalid redaction path (${path13})`);
6649
6649
  }
6650
6650
  }
6651
6651
  function validatePaths(paths) {
6652
6652
  if (!Array.isArray(paths)) {
6653
6653
  throw new TypeError("paths must be an array");
6654
6654
  }
6655
- for (const path12 of paths) {
6656
- validatePath(path12);
6655
+ for (const path13 of paths) {
6656
+ validatePath(path13);
6657
6657
  }
6658
6658
  }
6659
6659
  function slowRedact(options = {}) {
@@ -6821,8 +6821,8 @@ var require_redaction = __commonJS({
6821
6821
  if (shape[k] === null) {
6822
6822
  o[k] = (value) => topCensor(value, [k]);
6823
6823
  } else {
6824
- const wrappedCensor = typeof censor === "function" ? (value, path12) => {
6825
- return censor(value, [k, ...path12]);
6824
+ const wrappedCensor = typeof censor === "function" ? (value, path13) => {
6825
+ return censor(value, [k, ...path13]);
6826
6826
  } : censor;
6827
6827
  o[k] = Redact({
6828
6828
  paths: shape[k],
@@ -7043,7 +7043,7 @@ var require_sonic_boom = __commonJS({
7043
7043
  var fs8 = __require("fs");
7044
7044
  var EventEmitter2 = __require("events");
7045
7045
  var inherits = __require("util").inherits;
7046
- var path12 = __require("path");
7046
+ var path13 = __require("path");
7047
7047
  var sleep = require_atomic_sleep();
7048
7048
  var assert2 = __require("assert");
7049
7049
  var BUSY_WRITE_TIMEOUT = 100;
@@ -7097,7 +7097,7 @@ var require_sonic_boom = __commonJS({
7097
7097
  const mode = sonic.mode;
7098
7098
  if (sonic.sync) {
7099
7099
  try {
7100
- if (sonic.mkdir) fs8.mkdirSync(path12.dirname(file2), { recursive: true });
7100
+ if (sonic.mkdir) fs8.mkdirSync(path13.dirname(file2), { recursive: true });
7101
7101
  const fd = fs8.openSync(file2, flags, mode);
7102
7102
  fileOpened(null, fd);
7103
7103
  } catch (err) {
@@ -7105,7 +7105,7 @@ var require_sonic_boom = __commonJS({
7105
7105
  throw err;
7106
7106
  }
7107
7107
  } else if (sonic.mkdir) {
7108
- fs8.mkdir(path12.dirname(file2), { recursive: true }, (err) => {
7108
+ fs8.mkdir(path13.dirname(file2), { recursive: true }, (err) => {
7109
7109
  if (err) return fileOpened(err);
7110
7110
  fs8.open(file2, flags, mode, fileOpened);
7111
7111
  });
@@ -8437,15 +8437,15 @@ var require_transport = __commonJS({
8437
8437
  if (!unquoted) {
8438
8438
  return false;
8439
8439
  }
8440
- let path12 = unquoted;
8441
- if (path12.startsWith("file://")) {
8440
+ let path13 = unquoted;
8441
+ if (path13.startsWith("file://")) {
8442
8442
  try {
8443
- path12 = fileURLToPath3(path12);
8443
+ path13 = fileURLToPath3(path13);
8444
8444
  } catch {
8445
8445
  return false;
8446
8446
  }
8447
8447
  }
8448
- return isAbsolute(path12) && !existsSync3(path12);
8448
+ return isAbsolute(path13) && !existsSync3(path13);
8449
8449
  }
8450
8450
  function stripQuotes(value) {
8451
8451
  const first = value[0];
@@ -17121,8 +17121,8 @@ var require_utils = __commonJS({
17121
17121
  }
17122
17122
  return ind;
17123
17123
  }
17124
- function removeDotSegments(path12) {
17125
- let input = path12;
17124
+ function removeDotSegments(path13) {
17125
+ let input = path13;
17126
17126
  const output = [];
17127
17127
  let nextSlash = -1;
17128
17128
  let len = 0;
@@ -17374,8 +17374,8 @@ var require_schemes = __commonJS({
17374
17374
  wsComponent.secure = void 0;
17375
17375
  }
17376
17376
  if (wsComponent.resourceName) {
17377
- const [path12, query2] = wsComponent.resourceName.split("?");
17378
- wsComponent.path = path12 && path12 !== "/" ? path12 : void 0;
17377
+ const [path13, query2] = wsComponent.resourceName.split("?");
17378
+ wsComponent.path = path13 && path13 !== "/" ? path13 : void 0;
17379
17379
  wsComponent.query = query2;
17380
17380
  wsComponent.resourceName = void 0;
17381
17381
  }
@@ -22312,8 +22312,8 @@ var require_utils2 = __commonJS({
22312
22312
  }
22313
22313
  return ind;
22314
22314
  }
22315
- function removeDotSegments(path12) {
22316
- let input = path12;
22315
+ function removeDotSegments(path13) {
22316
+ let input = path13;
22317
22317
  const output = [];
22318
22318
  let nextSlash = -1;
22319
22319
  let len = 0;
@@ -22658,8 +22658,8 @@ var require_schemes2 = __commonJS({
22658
22658
  wsComponent.secure = void 0;
22659
22659
  }
22660
22660
  if (wsComponent.resourceName) {
22661
- const [path12, query2] = wsComponent.resourceName.split("?");
22662
- wsComponent.path = path12 && path12 !== "/" ? path12 : void 0;
22661
+ const [path13, query2] = wsComponent.resourceName.split("?");
22662
+ wsComponent.path = path13 && path13 !== "/" ? path13 : void 0;
22663
22663
  wsComponent.query = query2;
22664
22664
  wsComponent.resourceName = void 0;
22665
22665
  }
@@ -24143,8 +24143,8 @@ var require_utils3 = __commonJS({
24143
24143
  }
24144
24144
  return ind;
24145
24145
  }
24146
- function removeDotSegments(path12) {
24147
- let input = path12;
24146
+ function removeDotSegments(path13) {
24147
+ let input = path13;
24148
24148
  const output = [];
24149
24149
  let nextSlash = -1;
24150
24150
  let len = 0;
@@ -24489,8 +24489,8 @@ var require_schemes3 = __commonJS({
24489
24489
  wsComponent.secure = void 0;
24490
24490
  }
24491
24491
  if (wsComponent.resourceName) {
24492
- const [path12, query2] = wsComponent.resourceName.split("?");
24493
- wsComponent.path = path12 && path12 !== "/" ? path12 : void 0;
24492
+ const [path13, query2] = wsComponent.resourceName.split("?");
24493
+ wsComponent.path = path13 && path13 !== "/" ? path13 : void 0;
24494
24494
  wsComponent.query = query2;
24495
24495
  wsComponent.resourceName = void 0;
24496
24496
  }
@@ -32007,13 +32007,13 @@ var require_node = __commonJS({
32007
32007
  this.staticChildrenNodes[index] = node;
32008
32008
  }
32009
32009
  }
32010
- findStaticMatchingChild(path12, pathIndex) {
32011
- const charCode = path12.charCodeAt(pathIndex);
32010
+ findStaticMatchingChild(path13, pathIndex) {
32011
+ const charCode = path13.charCodeAt(pathIndex);
32012
32012
  const charCodes = this.staticChildrenCharCodes;
32013
32013
  for (let i = 0; i < charCodes.length; i++) {
32014
32014
  if (charCodes[i] === charCode) {
32015
32015
  const staticChild = this.staticChildrenNodes[i];
32016
- if (staticChild.matchPrefix(path12, pathIndex)) {
32016
+ if (staticChild.matchPrefix(path13, pathIndex)) {
32017
32017
  return staticChild;
32018
32018
  }
32019
32019
  return null;
@@ -32021,34 +32021,34 @@ var require_node = __commonJS({
32021
32021
  }
32022
32022
  return null;
32023
32023
  }
32024
- getStaticChild(path12, pathIndex = 0) {
32025
- if (path12.length === pathIndex) {
32024
+ getStaticChild(path13, pathIndex = 0) {
32025
+ if (path13.length === pathIndex) {
32026
32026
  return this;
32027
32027
  }
32028
- const staticChild = this.findStaticMatchingChild(path12, pathIndex);
32028
+ const staticChild = this.findStaticMatchingChild(path13, pathIndex);
32029
32029
  if (staticChild) {
32030
- return staticChild.getStaticChild(path12, pathIndex + staticChild.prefix.length);
32030
+ return staticChild.getStaticChild(path13, pathIndex + staticChild.prefix.length);
32031
32031
  }
32032
32032
  return null;
32033
32033
  }
32034
- createStaticChild(path12) {
32035
- if (path12.length === 0) {
32034
+ createStaticChild(path13) {
32035
+ if (path13.length === 0) {
32036
32036
  return this;
32037
32037
  }
32038
- const childIndex = this.staticChildrenCharCodes.indexOf(path12.charCodeAt(0));
32038
+ const childIndex = this.staticChildrenCharCodes.indexOf(path13.charCodeAt(0));
32039
32039
  let staticChild = childIndex === -1 ? void 0 : this.staticChildrenNodes[childIndex];
32040
32040
  if (staticChild) {
32041
32041
  let i = 1;
32042
32042
  for (; i < staticChild.prefix.length; i++) {
32043
- if (path12.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
32043
+ if (path13.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
32044
32044
  staticChild = staticChild.split(this, i);
32045
32045
  break;
32046
32046
  }
32047
32047
  }
32048
- return staticChild.createStaticChild(path12.slice(i));
32048
+ return staticChild.createStaticChild(path13.slice(i));
32049
32049
  }
32050
- const node = new StaticNode(path12);
32051
- this.setStaticChild(path12.charAt(0), node);
32050
+ const node = new StaticNode(path13);
32051
+ this.setStaticChild(path13.charAt(0), node);
32052
32052
  return node;
32053
32053
  }
32054
32054
  };
@@ -32108,8 +32108,8 @@ var require_node = __commonJS({
32108
32108
  parentNode.setStaticChild(parentPrefix.charAt(0), staticNode);
32109
32109
  return staticNode;
32110
32110
  }
32111
- getNextNode(path12, pathIndex, nodeStack, paramsCount) {
32112
- let node = this.findStaticMatchingChild(path12, pathIndex);
32111
+ getNextNode(path13, pathIndex, nodeStack, paramsCount) {
32112
+ let node = this.findStaticMatchingChild(path13, pathIndex);
32113
32113
  let parametricBrotherNodeIndex = 0;
32114
32114
  if (node === null) {
32115
32115
  if (this.parametricChildren.length === 0) {
@@ -32156,8 +32156,8 @@ var require_node = __commonJS({
32156
32156
  this.kind = NODE_TYPES.PARAMETRIC;
32157
32157
  this.nodePaths = /* @__PURE__ */ new Set([nodePath2]);
32158
32158
  }
32159
- getNextNode(path12, pathIndex) {
32160
- return this.findStaticMatchingChild(path12, pathIndex);
32159
+ getNextNode(path13, pathIndex) {
32160
+ return this.findStaticMatchingChild(path13, pathIndex);
32161
32161
  }
32162
32162
  };
32163
32163
  var WildcardNode = class extends Node {
@@ -32513,81 +32513,81 @@ var require_url_sanitizer = __commonJS({
32513
32513
  return String.fromCharCode(charCode);
32514
32514
  }
32515
32515
  var MIN_NATIVE_SCAN_LENGTH = 12;
32516
- function safeDecodeURI(path12, useSemicolonDelimiter) {
32517
- if (path12.length >= MIN_NATIVE_SCAN_LENGTH) {
32518
- return safeDecodeURINativeScan(path12, useSemicolonDelimiter);
32516
+ function safeDecodeURI(path13, useSemicolonDelimiter) {
32517
+ if (path13.length >= MIN_NATIVE_SCAN_LENGTH) {
32518
+ return safeDecodeURINativeScan(path13, useSemicolonDelimiter);
32519
32519
  }
32520
- return safeDecodeURICharScan(path12, useSemicolonDelimiter, 1);
32520
+ return safeDecodeURICharScan(path13, useSemicolonDelimiter, 1);
32521
32521
  }
32522
- function safeDecodeURINativeScan(path12, useSemicolonDelimiter) {
32523
- const percentIndex = path12.indexOf("%", 1);
32524
- let delimIndex = path12.indexOf("?", 1);
32525
- const hashIndex = path12.indexOf("#", 1);
32522
+ function safeDecodeURINativeScan(path13, useSemicolonDelimiter) {
32523
+ const percentIndex = path13.indexOf("%", 1);
32524
+ let delimIndex = path13.indexOf("?", 1);
32525
+ const hashIndex = path13.indexOf("#", 1);
32526
32526
  if (hashIndex !== -1 && (delimIndex === -1 || hashIndex < delimIndex)) {
32527
32527
  delimIndex = hashIndex;
32528
32528
  }
32529
32529
  if (useSemicolonDelimiter) {
32530
- const semicolonIndex = path12.indexOf(";", 1);
32530
+ const semicolonIndex = path13.indexOf(";", 1);
32531
32531
  if (semicolonIndex !== -1 && (delimIndex === -1 || semicolonIndex < delimIndex)) {
32532
32532
  delimIndex = semicolonIndex;
32533
32533
  }
32534
32534
  }
32535
32535
  if (percentIndex === -1 || delimIndex !== -1 && percentIndex > delimIndex) {
32536
32536
  if (delimIndex === -1) {
32537
- return { path: path12, querystring: "", shouldDecodeParam: false };
32537
+ return { path: path13, querystring: "", shouldDecodeParam: false };
32538
32538
  }
32539
32539
  return {
32540
- path: path12.slice(0, delimIndex),
32541
- querystring: path12.slice(delimIndex + 1),
32540
+ path: path13.slice(0, delimIndex),
32541
+ querystring: path13.slice(delimIndex + 1),
32542
32542
  shouldDecodeParam: false
32543
32543
  };
32544
32544
  }
32545
- return safeDecodeURIPercentScan(path12, useSemicolonDelimiter, percentIndex);
32545
+ return safeDecodeURIPercentScan(path13, useSemicolonDelimiter, percentIndex);
32546
32546
  }
32547
- function safeDecodeURICharScan(path12, useSemicolonDelimiter, startIndex) {
32548
- for (let i = startIndex; i < path12.length; i++) {
32549
- const charCode = path12.charCodeAt(i);
32547
+ function safeDecodeURICharScan(path13, useSemicolonDelimiter, startIndex) {
32548
+ for (let i = startIndex; i < path13.length; i++) {
32549
+ const charCode = path13.charCodeAt(i);
32550
32550
  if (charCode === 37) {
32551
- return safeDecodeURIPercentScan(path12, useSemicolonDelimiter, i);
32551
+ return safeDecodeURIPercentScan(path13, useSemicolonDelimiter, i);
32552
32552
  } else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
32553
32553
  return {
32554
- path: path12.slice(0, i),
32555
- querystring: path12.slice(i + 1),
32554
+ path: path13.slice(0, i),
32555
+ querystring: path13.slice(i + 1),
32556
32556
  shouldDecodeParam: false
32557
32557
  };
32558
32558
  }
32559
32559
  }
32560
- return { path: path12, querystring: "", shouldDecodeParam: false };
32560
+ return { path: path13, querystring: "", shouldDecodeParam: false };
32561
32561
  }
32562
- function reencodePercentChar(path12, index) {
32563
- return path12.slice(0, index + 1) + "25" + path12.slice(index + 1);
32562
+ function reencodePercentChar(path13, index) {
32563
+ return path13.slice(0, index + 1) + "25" + path13.slice(index + 1);
32564
32564
  }
32565
- function safeDecodeURIPercentScan(path12, useSemicolonDelimiter, startIndex) {
32565
+ function safeDecodeURIPercentScan(path13, useSemicolonDelimiter, startIndex) {
32566
32566
  let shouldDecode = false;
32567
32567
  let shouldDecodeParam = false;
32568
32568
  let querystring = "";
32569
- for (let i = startIndex; i < path12.length; i++) {
32570
- const charCode = path12.charCodeAt(i);
32569
+ for (let i = startIndex; i < path13.length; i++) {
32570
+ const charCode = path13.charCodeAt(i);
32571
32571
  if (charCode === 37) {
32572
- const componentCharCode = decodeComponentCharCode(path12.charCodeAt(i + 1), path12.charCodeAt(i + 2));
32572
+ const componentCharCode = decodeComponentCharCode(path13.charCodeAt(i + 1), path13.charCodeAt(i + 2));
32573
32573
  if (componentCharCode === 0) {
32574
32574
  shouldDecode = true;
32575
32575
  } else {
32576
32576
  shouldDecodeParam = true;
32577
32577
  if (componentCharCode === 37) {
32578
32578
  shouldDecode = true;
32579
- path12 = reencodePercentChar(path12, i);
32579
+ path13 = reencodePercentChar(path13, i);
32580
32580
  i += 2;
32581
32581
  }
32582
32582
  i += 2;
32583
32583
  }
32584
32584
  } else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
32585
- querystring = path12.slice(i + 1);
32586
- path12 = path12.slice(0, i);
32585
+ querystring = path13.slice(i + 1);
32586
+ path13 = path13.slice(0, i);
32587
32587
  break;
32588
32588
  }
32589
32589
  }
32590
- const decodedPath = shouldDecode ? decodeURI(path12) : path12;
32590
+ const decodedPath = shouldDecode ? decodeURI(path13) : path13;
32591
32591
  return { path: decodedPath, querystring, shouldDecodeParam };
32592
32592
  }
32593
32593
  function safeDecodeURIComponent(uriComponent) {
@@ -32682,7 +32682,7 @@ var require_find_my_way = __commonJS({
32682
32682
  this.trees = /* @__PURE__ */ Object.create(null);
32683
32683
  this._treeGET = null;
32684
32684
  }
32685
- Router.prototype.on = function on(method, path12, opts, handler, store) {
32685
+ Router.prototype.on = function on(method, path13, opts, handler, store) {
32686
32686
  if (typeof opts === "function") {
32687
32687
  if (handler !== void 0) {
32688
32688
  store = handler;
@@ -32690,34 +32690,34 @@ var require_find_my_way = __commonJS({
32690
32690
  handler = opts;
32691
32691
  opts = {};
32692
32692
  }
32693
- assert2(typeof path12 === "string", "Path should be a string");
32694
- assert2(path12.length > 0, "The path could not be empty");
32695
- assert2(path12[0] === "/" || path12[0] === "*", "The first character of a path should be `/` or `*`");
32693
+ assert2(typeof path13 === "string", "Path should be a string");
32694
+ assert2(path13.length > 0, "The path could not be empty");
32695
+ assert2(path13[0] === "/" || path13[0] === "*", "The first character of a path should be `/` or `*`");
32696
32696
  assert2(typeof handler === "function", "Handler should be a function");
32697
- const optionalParamMatch = path12.match(OPTIONAL_PARAM_REGEXP);
32697
+ const optionalParamMatch = path13.match(OPTIONAL_PARAM_REGEXP);
32698
32698
  if (optionalParamMatch) {
32699
- assert2(path12.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32700
- const pathFull = path12.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32701
- const pathOptional = path12.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32699
+ assert2(path13.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32700
+ const pathFull = path13.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32701
+ const pathOptional = path13.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32702
32702
  this.on(method, pathFull, opts, handler, store);
32703
32703
  this.on(method, pathOptional, opts, handler, store);
32704
32704
  return;
32705
32705
  }
32706
- const route = path12;
32706
+ const route = path13;
32707
32707
  if (this.ignoreDuplicateSlashes) {
32708
- path12 = removeDuplicateSlashes(path12);
32708
+ path13 = removeDuplicateSlashes(path13);
32709
32709
  }
32710
32710
  if (this.ignoreTrailingSlash) {
32711
- path12 = trimLastSlash(path12);
32711
+ path13 = trimLastSlash(path13);
32712
32712
  }
32713
32713
  const methods = Array.isArray(method) ? method : [method];
32714
32714
  for (const method2 of methods) {
32715
32715
  assert2(typeof method2 === "string", "Method should be a string");
32716
32716
  assert2(httpMethods.includes(method2), `Method '${method2}' is not an http method.`);
32717
- this._on(method2, path12, opts, handler, store, route);
32717
+ this._on(method2, path13, opts, handler, store, route);
32718
32718
  }
32719
32719
  };
32720
- Router.prototype._on = function _on(method, path12, opts, handler, store) {
32720
+ Router.prototype._on = function _on(method, path13, opts, handler, store) {
32721
32721
  let constraints = {};
32722
32722
  if (opts.constraints !== void 0) {
32723
32723
  assert2(typeof opts.constraints === "object" && opts.constraints !== null, "Constraints should be an object");
@@ -32730,7 +32730,7 @@ var require_find_my_way = __commonJS({
32730
32730
  if (this.trees[method] === void 0) {
32731
32731
  this.trees[method] = new StaticNode("/");
32732
32732
  }
32733
- let pattern = path12;
32733
+ let pattern = path13;
32734
32734
  if (pattern === "*" && this.trees[method].prefix.length !== 0) {
32735
32735
  const currentRoot = this.trees[method];
32736
32736
  this.trees[method] = new StaticNode("");
@@ -32838,19 +32838,19 @@ var require_find_my_way = __commonJS({
32838
32838
  throw new Error(`Method '${method}' already declared for route '${pattern}' with constraints '${JSON.stringify(constraints)}'`);
32839
32839
  }
32840
32840
  }
32841
- const route = { method, path: path12, pattern, params, opts, handler, store };
32841
+ const route = { method, path: path13, pattern, params, opts, handler, store };
32842
32842
  this.routes.push(route);
32843
32843
  currentNode.addRoute(route, this.constrainer);
32844
32844
  };
32845
- Router.prototype.hasRoute = function hasRoute(method, path12, constraints) {
32846
- const route = this.findRoute(method, path12, constraints);
32845
+ Router.prototype.hasRoute = function hasRoute(method, path13, constraints) {
32846
+ const route = this.findRoute(method, path13, constraints);
32847
32847
  return route !== null;
32848
32848
  };
32849
- Router.prototype.findRoute = function findNode(method, path12, constraints = {}) {
32849
+ Router.prototype.findRoute = function findNode(method, path13, constraints = {}) {
32850
32850
  if (this.trees[method] === void 0) {
32851
32851
  return null;
32852
32852
  }
32853
- let pattern = path12;
32853
+ let pattern = path13;
32854
32854
  let currentNode = this.trees[method];
32855
32855
  let parentNodePathIndex = currentNode.prefix.length;
32856
32856
  const params = [];
@@ -32971,39 +32971,39 @@ var require_find_my_way = __commonJS({
32971
32971
  this._treeGET = null;
32972
32972
  this.routes = [];
32973
32973
  };
32974
- Router.prototype.off = function off(method, path12, constraints) {
32975
- assert2(typeof path12 === "string", "Path should be a string");
32976
- assert2(path12.length > 0, "The path could not be empty");
32977
- assert2(path12[0] === "/" || path12[0] === "*", "The first character of a path should be `/` or `*`");
32974
+ Router.prototype.off = function off(method, path13, constraints) {
32975
+ assert2(typeof path13 === "string", "Path should be a string");
32976
+ assert2(path13.length > 0, "The path could not be empty");
32977
+ assert2(path13[0] === "/" || path13[0] === "*", "The first character of a path should be `/` or `*`");
32978
32978
  assert2(
32979
32979
  typeof constraints === "undefined" || typeof constraints === "object" && !Array.isArray(constraints) && constraints !== null,
32980
32980
  "Constraints should be an object or undefined."
32981
32981
  );
32982
- const optionalParamMatch = path12.match(OPTIONAL_PARAM_REGEXP);
32982
+ const optionalParamMatch = path13.match(OPTIONAL_PARAM_REGEXP);
32983
32983
  if (optionalParamMatch) {
32984
- assert2(path12.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32985
- const pathFull = path12.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32986
- const pathOptional = path12.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32984
+ assert2(path13.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
32985
+ const pathFull = path13.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
32986
+ const pathOptional = path13.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
32987
32987
  this.off(method, pathFull, constraints);
32988
32988
  this.off(method, pathOptional, constraints);
32989
32989
  return;
32990
32990
  }
32991
32991
  if (this.ignoreDuplicateSlashes) {
32992
- path12 = removeDuplicateSlashes(path12);
32992
+ path13 = removeDuplicateSlashes(path13);
32993
32993
  }
32994
32994
  if (this.ignoreTrailingSlash) {
32995
- path12 = trimLastSlash(path12);
32995
+ path13 = trimLastSlash(path13);
32996
32996
  }
32997
32997
  const methods = Array.isArray(method) ? method : [method];
32998
32998
  for (const method2 of methods) {
32999
- this._off(method2, path12, constraints);
32999
+ this._off(method2, path13, constraints);
33000
33000
  }
33001
33001
  };
33002
- Router.prototype._off = function _off(method, path12, constraints) {
33002
+ Router.prototype._off = function _off(method, path13, constraints) {
33003
33003
  assert2(typeof method === "string", "Method should be a string");
33004
33004
  assert2(httpMethods.includes(method), `Method '${method}' is not an http method.`);
33005
33005
  function matcherWithoutConstraints(route) {
33006
- return method !== route.method || path12 !== route.path;
33006
+ return method !== route.method || path13 !== route.path;
33007
33007
  }
33008
33008
  function matcherWithConstraints(route) {
33009
33009
  return matcherWithoutConstraints(route) || !deepEqual(constraints, route.opts.constraints || {});
@@ -33040,37 +33040,37 @@ var require_find_my_way = __commonJS({
33040
33040
  if (handle === null) return this._defaultRoute(req, res, ctx);
33041
33041
  return ctx === void 0 ? handle.handler(req, res, handle.params, handle.store, handle.searchParams) : handle.handler.call(ctx, req, res, handle.params, handle.store, handle.searchParams);
33042
33042
  };
33043
- Router.prototype.find = function find(method, path12, derivedConstraints) {
33043
+ Router.prototype.find = function find(method, path13, derivedConstraints) {
33044
33044
  let currentNode = method === "GET" ? this._treeGET : this.trees[method];
33045
33045
  if (currentNode == null) return null;
33046
- if (path12.charCodeAt(0) !== 47) {
33047
- path12 = path12.replace(FULL_PATH_REGEXP, "/");
33046
+ if (path13.charCodeAt(0) !== 47) {
33047
+ path13 = path13.replace(FULL_PATH_REGEXP, "/");
33048
33048
  }
33049
33049
  if (this.ignoreDuplicateSlashes) {
33050
- path12 = removeDuplicateSlashes(path12);
33050
+ path13 = removeDuplicateSlashes(path13);
33051
33051
  }
33052
33052
  let sanitizedUrl;
33053
33053
  let querystring2;
33054
33054
  let shouldDecodeParam;
33055
33055
  try {
33056
- sanitizedUrl = path12.length >= MIN_NATIVE_SCAN_LENGTH ? safeDecodeURINativeScan(path12, this.useSemicolonDelimiter) : safeDecodeURICharScan(path12, this.useSemicolonDelimiter, 1);
33057
- path12 = sanitizedUrl.path;
33056
+ sanitizedUrl = path13.length >= MIN_NATIVE_SCAN_LENGTH ? safeDecodeURINativeScan(path13, this.useSemicolonDelimiter) : safeDecodeURICharScan(path13, this.useSemicolonDelimiter, 1);
33057
+ path13 = sanitizedUrl.path;
33058
33058
  querystring2 = sanitizedUrl.querystring;
33059
33059
  shouldDecodeParam = sanitizedUrl.shouldDecodeParam;
33060
33060
  } catch (error51) {
33061
- return this._onBadUrl(path12);
33061
+ return this._onBadUrl(path13);
33062
33062
  }
33063
33063
  if (this.ignoreTrailingSlash) {
33064
- path12 = trimLastSlash(path12);
33064
+ path13 = trimLastSlash(path13);
33065
33065
  }
33066
- const originPath = path12;
33066
+ const originPath = path13;
33067
33067
  if (this.caseSensitive === false) {
33068
- path12 = path12.toLowerCase();
33068
+ path13 = path13.toLowerCase();
33069
33069
  }
33070
33070
  const maxParamLength = this.maxParamLength;
33071
33071
  let pathIndex = currentNode.prefix.length;
33072
33072
  const params = [];
33073
- const pathLen = path12.length;
33073
+ const pathLen = path13.length;
33074
33074
  const brothersNodesStack = [];
33075
33075
  let maxParamLengthExceeded = false;
33076
33076
  while (true) {
@@ -33085,7 +33085,7 @@ var require_find_my_way = __commonJS({
33085
33085
  };
33086
33086
  }
33087
33087
  }
33088
- let node = currentNode.getNextNode(path12, pathIndex, brothersNodesStack, params.length);
33088
+ let node = currentNode.getNextNode(path13, pathIndex, brothersNodesStack, params.length);
33089
33089
  if (node === null) {
33090
33090
  if (brothersNodesStack.length === 0) {
33091
33091
  if (maxParamLengthExceeded && this.onMaxParamLength) {
@@ -33186,8 +33186,8 @@ var require_find_my_way = __commonJS({
33186
33186
  Router.prototype._rebuild = function(routes) {
33187
33187
  this.reset();
33188
33188
  for (const route of routes) {
33189
- const { method, path: path12, opts, handler, store } = route;
33190
- this._on(method, path12, opts, handler, store);
33189
+ const { method, path: path13, opts, handler, store } = route;
33190
+ this._on(method, path13, opts, handler, store);
33191
33191
  }
33192
33192
  };
33193
33193
  Router.prototype._defaultRoute = function(req, res, ctx) {
@@ -33198,24 +33198,24 @@ var require_find_my_way = __commonJS({
33198
33198
  res.end();
33199
33199
  }
33200
33200
  };
33201
- Router.prototype._onBadUrl = function(path12) {
33201
+ Router.prototype._onBadUrl = function(path13) {
33202
33202
  if (this.onBadUrl === null) {
33203
33203
  return null;
33204
33204
  }
33205
33205
  const onBadUrl = this.onBadUrl;
33206
33206
  return {
33207
- handler: (req, res, ctx) => onBadUrl(path12, req, res),
33207
+ handler: (req, res, ctx) => onBadUrl(path13, req, res),
33208
33208
  params: {},
33209
33209
  store: null
33210
33210
  };
33211
33211
  };
33212
- Router.prototype._onMaxParamLength = function(path12) {
33212
+ Router.prototype._onMaxParamLength = function(path13) {
33213
33213
  if (this.onMaxParamLength === null) {
33214
33214
  return null;
33215
33215
  }
33216
33216
  const onMaxParamLength = this.onMaxParamLength;
33217
33217
  return {
33218
- handler: (req, res, ctx) => onMaxParamLength(path12, req, res),
33218
+ handler: (req, res, ctx) => onMaxParamLength(path13, req, res),
33219
33219
  params: {},
33220
33220
  store: null
33221
33221
  };
@@ -33247,12 +33247,12 @@ var require_find_my_way = __commonJS({
33247
33247
  if (!httpMethods.hasOwnProperty(i)) continue;
33248
33248
  const m = httpMethods[i];
33249
33249
  const methodName = m.toLowerCase();
33250
- Router.prototype[methodName] = function(path12, handler, store) {
33251
- return this.on(m, path12, handler, store);
33250
+ Router.prototype[methodName] = function(path13, handler, store) {
33251
+ return this.on(m, path13, handler, store);
33252
33252
  };
33253
33253
  }
33254
- Router.prototype.all = function(path12, handler, store) {
33255
- this.on(httpMethods, path12, handler, store);
33254
+ Router.prototype.all = function(path13, handler, store) {
33255
+ this.on(httpMethods, path13, handler, store);
33256
33256
  };
33257
33257
  Router.sanitizeUrlPath = function sanitizeUrlPath(url2, useSemicolonDelimiter) {
33258
33258
  const decoded = safeDecodeURI(url2, useSemicolonDelimiter);
@@ -33267,14 +33267,14 @@ var require_find_my_way = __commonJS({
33267
33267
  function escapeRegExp(string4) {
33268
33268
  return string4.replace(ESCAPE_REGEXP, "\\$&");
33269
33269
  }
33270
- function removeDuplicateSlashes(path12) {
33271
- return path12.indexOf("//") !== -1 ? path12.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, "/") : path12;
33270
+ function removeDuplicateSlashes(path13) {
33271
+ return path13.indexOf("//") !== -1 ? path13.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, "/") : path13;
33272
33272
  }
33273
- function trimLastSlash(path12) {
33274
- if (path12.length > 1 && path12.charCodeAt(path12.length - 1) === 47) {
33275
- return path12.slice(0, -1);
33273
+ function trimLastSlash(path13) {
33274
+ if (path13.length > 1 && path13.charCodeAt(path13.length - 1) === 47) {
33275
+ return path13.slice(0, -1);
33276
33276
  }
33277
- return path12;
33277
+ return path13;
33278
33278
  }
33279
33279
  function trimRegExpStartAndEnd(regexString) {
33280
33280
  if (regexString.charCodeAt(1) === 94) {
@@ -33285,22 +33285,22 @@ var require_find_my_way = __commonJS({
33285
33285
  }
33286
33286
  return regexString;
33287
33287
  }
33288
- function getClosingParenthensePosition(path12, idx) {
33288
+ function getClosingParenthensePosition(path13, idx) {
33289
33289
  let parentheses = 1;
33290
- while (idx < path12.length) {
33290
+ while (idx < path13.length) {
33291
33291
  idx++;
33292
- if (path12.charCodeAt(idx) === 92) {
33292
+ if (path13.charCodeAt(idx) === 92) {
33293
33293
  idx++;
33294
33294
  continue;
33295
33295
  }
33296
- if (path12.charCodeAt(idx) === 41) {
33296
+ if (path13.charCodeAt(idx) === 41) {
33297
33297
  parentheses--;
33298
- } else if (path12.charCodeAt(idx) === 40) {
33298
+ } else if (path13.charCodeAt(idx) === 40) {
33299
33299
  parentheses++;
33300
33300
  }
33301
33301
  if (!parentheses) return idx;
33302
33302
  }
33303
- throw new TypeError('Invalid regexp expression in "' + path12 + '"');
33303
+ throw new TypeError('Invalid regexp expression in "' + path13 + '"');
33304
33304
  }
33305
33305
  function defaultBuildPrettyMeta(route) {
33306
33306
  if (!route) return {};
@@ -33533,12 +33533,12 @@ var require_route = __commonJS({
33533
33533
  function route({ options: options2, isFastify }) {
33534
33534
  throwIfAlreadyStarted("Cannot add route!");
33535
33535
  const opts = { ...options2 };
33536
- const path12 = opts.url || opts.path || "";
33536
+ const path13 = opts.url || opts.path || "";
33537
33537
  if (!opts.handler) {
33538
- throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method, path12);
33538
+ throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method, path13);
33539
33539
  }
33540
33540
  if (opts.errorHandler !== void 0 && typeof opts.errorHandler !== "function") {
33541
- throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method, path12);
33541
+ throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method, path13);
33542
33542
  }
33543
33543
  validateBodyLimitOption(opts.bodyLimit);
33544
33544
  validateHandlerTimeoutOption(opts.handlerTimeout);
@@ -33548,22 +33548,22 @@ var require_route = __commonJS({
33548
33548
  if (Array.isArray(opts.method)) {
33549
33549
  for (let i = 0; i < opts.method.length; ++i) {
33550
33550
  opts.method[i] = normalizeAndValidateMethod.call(this, opts.method[i]);
33551
- validateSchemaBodyOption.call(this, opts.method[i], path12, opts.schema);
33551
+ validateSchemaBodyOption.call(this, opts.method[i], path13, opts.schema);
33552
33552
  isGetRoute = opts.method.includes("GET");
33553
33553
  isHeadRoute = opts.method.includes("HEAD");
33554
33554
  }
33555
33555
  } else {
33556
33556
  opts.method = normalizeAndValidateMethod.call(this, opts.method);
33557
- validateSchemaBodyOption.call(this, opts.method, path12, opts.schema);
33557
+ validateSchemaBodyOption.call(this, opts.method, path13, opts.schema);
33558
33558
  isGetRoute = opts.method === "GET";
33559
33559
  isHeadRoute = opts.method === "HEAD";
33560
33560
  }
33561
33561
  const headOpts = shouldExposeHead && isGetRoute ? { ...options2 } : null;
33562
33562
  const prefix = this[kRoutePrefix];
33563
- if (path12 === "/" && prefix.length > 0 && opts.method !== "HEAD") {
33563
+ if (path13 === "/" && prefix.length > 0 && opts.method !== "HEAD") {
33564
33564
  switch (opts.prefixTrailingSlash) {
33565
33565
  case "slash":
33566
- addNewRoute.call(this, { path: path12, isFastify });
33566
+ addNewRoute.call(this, { path: path13, isFastify });
33567
33567
  break;
33568
33568
  case "no-slash":
33569
33569
  addNewRoute.call(this, { path: "", isFastify });
@@ -33572,20 +33572,20 @@ var require_route = __commonJS({
33572
33572
  default:
33573
33573
  addNewRoute.call(this, { path: "", isFastify });
33574
33574
  if (ignoreTrailingSlash !== true && (ignoreDuplicateSlashes !== true || !prefix.endsWith("/"))) {
33575
- addNewRoute.call(this, { path: path12, prefixing: true, isFastify });
33575
+ addNewRoute.call(this, { path: path13, prefixing: true, isFastify });
33576
33576
  }
33577
33577
  }
33578
- } else if (path12[0] === "/" && prefix.endsWith("/")) {
33579
- addNewRoute.call(this, { path: path12.slice(1), isFastify });
33578
+ } else if (path13[0] === "/" && prefix.endsWith("/")) {
33579
+ addNewRoute.call(this, { path: path13.slice(1), isFastify });
33580
33580
  } else {
33581
- addNewRoute.call(this, { path: path12, isFastify });
33581
+ addNewRoute.call(this, { path: path13, isFastify });
33582
33582
  }
33583
33583
  return this;
33584
- function addNewRoute({ path: path13, prefixing = false, isFastify: isFastify2 = false }) {
33585
- const url2 = prefix + path13;
33584
+ function addNewRoute({ path: path14, prefixing = false, isFastify: isFastify2 = false }) {
33585
+ const url2 = prefix + path14;
33586
33586
  opts.url = url2;
33587
33587
  opts.path = url2;
33588
- opts.routePath = path13;
33588
+ opts.routePath = path14;
33589
33589
  opts.prefix = prefix;
33590
33590
  opts.logLevel = opts.logLevel || this[kLogLevel];
33591
33591
  validateLogLevelOption(opts.logLevel, opts.method, opts.url, logger);
@@ -33717,7 +33717,7 @@ var require_route = __commonJS({
33717
33717
  });
33718
33718
  if (shouldExposeHead && isGetRoute && !isHeadRoute && !hasHEADHandler) {
33719
33719
  const onSendHandlers = parseHeadOnSendHandlers(headOpts.onSend);
33720
- prepareRoute.call(this, { method: "HEAD", url: path13, options: { ...headOpts, onSend: onSendHandlers }, isFastify: true });
33720
+ prepareRoute.call(this, { method: "HEAD", url: path14, options: { ...headOpts, onSend: onSendHandlers }, isFastify: true });
33721
33721
  }
33722
33722
  }
33723
33723
  }
@@ -33841,9 +33841,9 @@ var require_route = __commonJS({
33841
33841
  }
33842
33842
  return method;
33843
33843
  }
33844
- function validateSchemaBodyOption(method, path12, schema) {
33844
+ function validateSchemaBodyOption(method, path13, schema) {
33845
33845
  if (this[kSupportedHTTPMethods].bodyless.has(method) && schema?.body) {
33846
- throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method, path12);
33846
+ throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method, path13);
33847
33847
  }
33848
33848
  }
33849
33849
  function validateBodyLimitOption(bodyLimit) {
@@ -33858,11 +33858,11 @@ var require_route = __commonJS({
33858
33858
  throw new FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT(handlerTimeout);
33859
33859
  }
33860
33860
  }
33861
- function validateLogLevelOption(logLevel, method, path12, logger) {
33861
+ function validateLogLevelOption(logLevel, method, path13, logger) {
33862
33862
  if (logLevel == null || logLevel === "") return;
33863
33863
  if (logger?.levels?.values == null) return;
33864
33864
  if (typeof logLevel !== "string" || logger.levels.values[logLevel] === void 0) {
33865
- throw new FST_ERR_ROUTE_LOG_LEVEL_INVALID(method, path12, logLevel);
33865
+ throw new FST_ERR_ROUTE_LOG_LEVEL_INVALID(method, path13, logLevel);
33866
33866
  }
33867
33867
  }
33868
33868
  function runPreParsing(err, request, reply) {
@@ -33951,7 +33951,7 @@ var require_four_oh_four = __commonJS({
33951
33951
  });
33952
33952
  }
33953
33953
  function createRouteEventHandler() {
33954
- return function onRouteEvent(path12, req, res) {
33954
+ return function onRouteEvent(path13, req, res) {
33955
33955
  const fourOhFourContext = this[kFourOhFourLevelInstance][kFourOhFourContext];
33956
33956
  const id = getGenReqId(fourOhFourContext.server, req);
33957
33957
  const childLogger = createChildLogger(fourOhFourContext, logger, req, id);
@@ -36622,19 +36622,19 @@ var require_fastify = __commonJS({
36622
36622
  }
36623
36623
  fourOhFour.router.lookup(req, res);
36624
36624
  }
36625
- function onBadUrl(path12, req, res) {
36625
+ function onBadUrl(path13, req, res) {
36626
36626
  if (options.frameworkErrors) {
36627
36627
  const id = getGenReqId(routeEventContext.server, req);
36628
36628
  const childLogger = createChildLogger(routeEventContext, options.logger, req, id);
36629
36629
  const request = new Request(id, null, req, null, childLogger, routeEventContext);
36630
36630
  const reply = new Reply(res, request, childLogger);
36631
36631
  routeEventContext.server[kLogController].incomingRequest(request, reply);
36632
- return options.frameworkErrors(new FST_ERR_BAD_URL(path12), request, reply);
36632
+ return options.frameworkErrors(new FST_ERR_BAD_URL(path13), request, reply);
36633
36633
  }
36634
36634
  const body = JSON.stringify({
36635
36635
  error: "Bad Request",
36636
36636
  code: "FST_ERR_BAD_URL",
36637
- message: `'${path12}' is not a valid url component`,
36637
+ message: `'${path13}' is not a valid url component`,
36638
36638
  statusCode: 400
36639
36639
  });
36640
36640
  res.writeHead(400, {
@@ -36643,19 +36643,19 @@ var require_fastify = __commonJS({
36643
36643
  });
36644
36644
  res.end(body);
36645
36645
  }
36646
- function onMaxParamLength(path12, req, res) {
36646
+ function onMaxParamLength(path13, req, res) {
36647
36647
  if (options.frameworkErrors) {
36648
36648
  const id = getGenReqId(routeEventContext.server, req);
36649
36649
  const childLogger = createChildLogger(routeEventContext, options.logger, req, id);
36650
36650
  const request = new Request(id, null, req, null, childLogger, routeEventContext);
36651
36651
  const reply = new Reply(res, request, childLogger);
36652
36652
  routeEventContext.server[kLogController].incomingRequest(request, reply);
36653
- return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path12), request, reply);
36653
+ return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path13), request, reply);
36654
36654
  }
36655
36655
  const body = JSON.stringify({
36656
36656
  error: "Bad Request",
36657
36657
  code: "FST_ERR_MAX_PARAM_LENGTH",
36658
- message: `'${path12}' is exceeding the max param length`,
36658
+ message: `'${path13}' is exceeding the max param length`,
36659
36659
  statusCode: 414
36660
36660
  });
36661
36661
  res.writeHead(414, {
@@ -41005,8 +41005,8 @@ var import_cors = __toESM(require_cors(), 1);
41005
41005
  // src/db/index.ts
41006
41006
  import Database from "better-sqlite3";
41007
41007
  var db;
41008
- function initDb(path12 = "data.db") {
41009
- db = new Database(path12);
41008
+ function initDb(path13 = "data.db") {
41009
+ db = new Database(path13);
41010
41010
  db.pragma("journal_mode = WAL");
41011
41011
  db.pragma("foreign_keys = ON");
41012
41012
  createTables(db);
@@ -43282,9 +43282,9 @@ async function browseFolder(input, opts = {}) {
43282
43282
  const atHome = dir === nodePath.resolve(home);
43283
43283
  const folders = await Promise.all(
43284
43284
  names.slice(0, limit).map(async (name) => {
43285
- const path12 = nodePath.join(dir, name);
43285
+ const path13 = nodePath.join(dir, name);
43286
43286
  const skipProbe = atHome && HOME_STANDARD_FOLDERS.has(name) || dir === "/Volumes";
43287
- return { name, path: path12, git: !skipProbe && await exists(nodePath.join(path12, ".git")) };
43287
+ return { name, path: path13, git: !skipProbe && await exists(nodePath.join(path13, ".git")) };
43288
43288
  })
43289
43289
  );
43290
43290
  const parent = nodePath.dirname(dir);
@@ -43322,11 +43322,11 @@ async function registerWorkspaceRoutes(fastify) {
43322
43322
  }
43323
43323
  }
43324
43324
  }, async (request, reply) => {
43325
- const { path: path12, label = null } = request.body || {};
43326
- if (!path12 || !path12.trim()) {
43325
+ const { path: path13, label = null } = request.body || {};
43326
+ if (!path13 || !path13.trim()) {
43327
43327
  return reply.code(400).send({ error: "Path is required" });
43328
43328
  }
43329
- const resolved = await resolveWorkspacePath(path12);
43329
+ const resolved = await resolveWorkspacePath(path13);
43330
43330
  if ("error" in resolved) {
43331
43331
  return reply.code(400).send({ error: resolved.error });
43332
43332
  }
@@ -43368,8 +43368,8 @@ async function registerWorkspaceRoutes(fastify) {
43368
43368
  "-e",
43369
43369
  'POSIX path of (choose folder with prompt "Select a workspace directory")'
43370
43370
  ]);
43371
- const path12 = stdout.trim().replace(/\/$/, "");
43372
- return { path: path12 };
43371
+ const path13 = stdout.trim().replace(/\/$/, "");
43372
+ return { path: path13 };
43373
43373
  } catch {
43374
43374
  return reply.code(204).send({ cancelled: true });
43375
43375
  }
@@ -43385,11 +43385,11 @@ async function registerWorkspaceRoutes(fastify) {
43385
43385
  }
43386
43386
  }
43387
43387
  }, async (request, reply) => {
43388
- const { path: path12 } = request.body || {};
43389
- if (!path12 || !path12.trim()) {
43388
+ const { path: path13 } = request.body || {};
43389
+ if (!path13 || !path13.trim()) {
43390
43390
  return reply.code(400).send({ error: "Path is required" });
43391
43391
  }
43392
- const trimmedPath = path12.trim();
43392
+ const trimmedPath = path13.trim();
43393
43393
  const db2 = getDb();
43394
43394
  const existing = db2.prepare("SELECT * FROM workspaces WHERE path = ?").get(trimmedPath);
43395
43395
  if (existing) {
@@ -44074,17 +44074,17 @@ async function registerPerfLogRoutes(fastify) {
44074
44074
  if (entries.length === 0) {
44075
44075
  return reply.send({ written: 0 });
44076
44076
  }
44077
- const path12 = perfLogPath();
44077
+ const path13 = perfLogPath();
44078
44078
  try {
44079
- mkdirSync(dirname(path12), { recursive: true });
44079
+ mkdirSync(dirname(path13), { recursive: true });
44080
44080
  try {
44081
- if (statSync(path12).size > MAX_BYTES) {
44082
- renameSync(path12, `${path12}.1`);
44081
+ if (statSync(path13).size > MAX_BYTES) {
44082
+ renameSync(path13, `${path13}.1`);
44083
44083
  }
44084
44084
  } catch {
44085
44085
  }
44086
44086
  const lines = entries.map((e) => `${new Date(e.t).toISOString()} [${oneLine(e.cat)}] ${oneLine(e.msg)}`).join("\n");
44087
- appendFileSync(path12, `${lines}
44087
+ appendFileSync(path13, `${lines}
44088
44088
  `, "utf-8");
44089
44089
  return reply.send({ written: entries.length });
44090
44090
  } catch (err) {
@@ -44709,7 +44709,7 @@ function proxyHandler(request, reply) {
44709
44709
 
44710
44710
  // src/routes/apps.ts
44711
44711
  import fs6 from "node:fs";
44712
- import path8 from "node:path";
44712
+ import path9 from "node:path";
44713
44713
 
44714
44714
  // src/apps/instances.ts
44715
44715
  import fs3 from "node:fs";
@@ -99048,8 +99048,10 @@ Icons come from ONE library: Lucide (https://lucide.dev/icons, ISC).
99048
99048
  - getState() / setState(data, { ifVersion }?) - persistent JSON state, survives page reload; getState reads the stored copy on every call (see "Shared state" below)
99049
99049
  - onStateChanged(callback) - callback({ version }) when somebody else (an agent, another tab) wrote the state; not fired for this tab's own setState
99050
99050
  - createSession({ cwd, runtime_type, model, model_reasoning_effort, title }) - agent session owned by this app; model_reasoning_effort is the effort for its turns ("low" | "medium" | "high" | "xhigh" | "max" | "ultra", the levels the model supports), omitted = the runtime's default
99051
- - submitTurn(sessionId, prompt, { attachments }?) - send a prompt to a session; attachments (optional) are stored files (id, url or the uploadFile result) or inline Blobs / { name, type, data } sent with that turn only; the agent sees attached images (Claude and Codex)
99051
+ - submitTurn(sessionId, prompt, { attachments }?) - send a prompt to one of this app's sessions (rejects for any other, also in the tab); attachments (optional) are stored files (id, url or the uploadFile result) or inline Blobs / { name, type, data } sent with that turn only; the agent sees attached images (Claude and Codex)
99052
99052
  - getSession(sessionId) - one of this app's sessions, also read headless: { id, title, status, running, backgroundTasks, lastTurn: { id, status, response, error, resumeState } | null }, null for any other id. A turn waiting to continue after an interruption has running true and resumeState 'waiting'
99053
+ - listSessions({ lifecycle, running }?) - sessions this instance can see, newest first, also read headless: every session in its workspace folder and below (nested workspaces included), the sessions this app opened, and for the global instance ('') every session. Each is { id, title, cwd, runtime_type, model, model_reasoning_effort, status, lifecycle, running, external_thread_id, transcript_path, origin_app_id, app_owned, created_at, updated_at }. running = a turn is live (also one waiting to continue); lifecycle = 'working' | 'finished', the user's open/done mark in the sidebar. external_thread_id is the runtime's own session id (Claude Code session, Codex thread), transcript_path its JSONL transcript (null for repoburg, before the first turn, or when the file is missing). Filters: lifecycle, running. No event announces changes: poll
99054
+ - getSessionInfo(sessionId) - one session listSessions would show, null for any other id. Read only: submitTurn, cancelTurn and setSessionLifecycle still reject every session that is not app_owned
99053
99055
  - cancelTurn(sessionId) - stop the running main turn of one of this app's sessions: { cancelled }, false when none runs; a discussion thread keeps running; rejects for any other session
99054
99056
  - setSessionLifecycle(sessionId, 'finished' | 'working') - finish or reopen one of this app's sessions, as the sidebar does; rejects for any other session
99055
99057
  - callTool(tool, args) - tab only: run one of this app's manifest tools, by its bare name; it is answered like an agent's call, with caller null. The app's frame has an opaque origin and cannot fetch the pane's API, so this is how a tab gets the headless runtime to do something
@@ -99127,6 +99129,9 @@ Headless contract for apps that declare tools:
99127
99129
  call with "Unknown workspace", and no state is read or written
99128
99130
  - openSession/openUrl are not available in the headless runtime;
99129
99131
  createSession/submitTurn only with "headlessSessions" (see below)
99132
+ - getSession, listSessions and getSessionInfo work headless, with or without
99133
+ "headlessSessions"; listSessions sees the sessions of the instance's
99134
+ workspace
99130
99135
  - stored files are: getFile(ref)/fileUrl(ref)/uploadFile({ name, type, data })
99131
99136
  work headless (url is root-relative there); return file.path to the agent
99132
99137
  so it can open the image
@@ -99164,6 +99169,9 @@ runtime and events go to the open tab only.
99164
99169
  from a tool handler or an event callback. All but createSession reach only
99165
99170
  sessions this app opened; attachments are stored files or inline
99166
99171
  { name, type, data } (no Blobs in the sandbox)
99172
+ - to work on a session the app did not open (the user's), read it with
99173
+ getSessionInfo (cwd, runtime_type, model, external_thread_id,
99174
+ transcript_path) and open a session of the app's own in its cwd
99167
99175
  - onTurnCompleted and onBackgroundTasks fire in the headless runtime, for every
99168
99176
  session of the app, also the ones its tab opened. They go to the instance
99169
99177
  that opened the session, and it loads again when it has to
@@ -99361,6 +99369,89 @@ function deleteAppInstances(appId) {
99361
99369
  // src/apps/mcp-tools.ts
99362
99370
  import fs5 from "node:fs";
99363
99371
 
99372
+ // src/apps/app-sessions.ts
99373
+ import path7 from "node:path";
99374
+
99375
+ // src/sidecar/transcript-locator.ts
99376
+ import { existsSync as existsSync2, readdirSync } from "node:fs";
99377
+ import { homedir as homedir3 } from "node:os";
99378
+ import { join as join2 } from "node:path";
99379
+ function claudeConfigDir() {
99380
+ return process.env.CLAUDE_CONFIG_DIR || join2(homedir3(), ".claude");
99381
+ }
99382
+ function codexHome() {
99383
+ return process.env.CODEX_HOME || join2(homedir3(), ".codex");
99384
+ }
99385
+ function encodeClaudeProjectDir(cwd) {
99386
+ return cwd.replace(/[^a-zA-Z0-9]/g, "-");
99387
+ }
99388
+ function listDir(dir) {
99389
+ try {
99390
+ return readdirSync(dir);
99391
+ } catch {
99392
+ return [];
99393
+ }
99394
+ }
99395
+ function findClaudeTranscript(externalId, cwd) {
99396
+ const projects = join2(claudeConfigDir(), "projects");
99397
+ const fileName = `${externalId}.jsonl`;
99398
+ if (cwd) {
99399
+ const direct = join2(projects, encodeClaudeProjectDir(cwd), fileName);
99400
+ if (existsSync2(direct)) return direct;
99401
+ }
99402
+ for (const dir of listDir(projects)) {
99403
+ const candidate = join2(projects, dir, fileName);
99404
+ if (existsSync2(candidate)) return candidate;
99405
+ }
99406
+ return null;
99407
+ }
99408
+ function findCodexTranscript(externalId) {
99409
+ const root = join2(codexHome(), "sessions");
99410
+ const suffix = `-${externalId}.jsonl`;
99411
+ const desc = (dir) => listDir(dir).sort().reverse();
99412
+ for (const year of desc(root)) {
99413
+ for (const month of desc(join2(root, year))) {
99414
+ for (const day of desc(join2(root, year, month))) {
99415
+ const dayDir = join2(root, year, month, day);
99416
+ const match = listDir(dayDir).find((f) => f.endsWith(suffix));
99417
+ if (match) return join2(dayDir, match);
99418
+ }
99419
+ }
99420
+ }
99421
+ return null;
99422
+ }
99423
+ function locateTranscript(session) {
99424
+ const externalId = session.external_thread_id;
99425
+ if (!externalId) return null;
99426
+ switch (session.runtime_type) {
99427
+ case "claude":
99428
+ return findClaudeTranscript(externalId, session.cwd);
99429
+ case "codex":
99430
+ return findCodexTranscript(externalId);
99431
+ default:
99432
+ return null;
99433
+ }
99434
+ }
99435
+ var foundTranscripts = /* @__PURE__ */ new Map();
99436
+ var missedTranscripts = /* @__PURE__ */ new Map();
99437
+ var MISS_TTL_MS = 15e3;
99438
+ function locateTranscriptCached(session) {
99439
+ const externalId = session.external_thread_id;
99440
+ const home = session.runtime_type === "claude" ? claudeConfigDir() : session.runtime_type === "codex" ? codexHome() : null;
99441
+ if (!externalId || !home) return null;
99442
+ const key = `${session.runtime_type}\0${home}\0${externalId}`;
99443
+ const known = foundTranscripts.get(key);
99444
+ if (known && existsSync2(known)) return known;
99445
+ foundTranscripts.delete(key);
99446
+ const missUntil = missedTranscripts.get(key);
99447
+ if (missUntil !== void 0 && missUntil > Date.now()) return null;
99448
+ missedTranscripts.delete(key);
99449
+ const found = locateTranscript(session);
99450
+ if (found) foundTranscripts.set(key, found);
99451
+ else missedTranscripts.set(key, Date.now() + MISS_TTL_MS);
99452
+ return found;
99453
+ }
99454
+
99364
99455
  // src/apps/app-files.ts
99365
99456
  import crypto2 from "node:crypto";
99366
99457
  import fs4 from "node:fs";
@@ -99606,6 +99697,60 @@ function appSessionInfo(appId, sessionId) {
99606
99697
  } : null
99607
99698
  };
99608
99699
  }
99700
+ function sessionVisibleTo(session, appId, workspace) {
99701
+ if (!workspace) return true;
99702
+ const cwd = session.cwd;
99703
+ if (cwd && (cwd === workspace || cwd.startsWith(workspace.endsWith(path7.sep) ? workspace : workspace + path7.sep))) {
99704
+ return true;
99705
+ }
99706
+ return session.origin_app_workspace === workspace && openedByApp(session, appId);
99707
+ }
99708
+ function sessionSummary(session, appId) {
99709
+ return {
99710
+ id: session.id,
99711
+ title: session.title,
99712
+ cwd: session.cwd,
99713
+ runtime_type: session.runtime_type,
99714
+ model: session.model,
99715
+ model_reasoning_effort: session.model_reasoning_effort,
99716
+ status: session.status,
99717
+ lifecycle: session.lifecycle,
99718
+ running: !!session.is_running,
99719
+ external_thread_id: session.external_thread_id,
99720
+ transcript_path: locateTranscriptCached(session),
99721
+ origin_app_id: session.origin_app_id,
99722
+ app_owned: openedByApp(session, appId),
99723
+ created_at: session.created_at,
99724
+ updated_at: session.updated_at
99725
+ };
99726
+ }
99727
+ function listFilters(opts) {
99728
+ const o = opts && typeof opts === "object" ? opts : {};
99729
+ const filters = {};
99730
+ if (o.lifecycle === "working" || o.lifecycle === "finished") filters.lifecycle = o.lifecycle;
99731
+ if (typeof o.running === "boolean") filters.running = o.running;
99732
+ return filters;
99733
+ }
99734
+ function listAppVisibleSessions(appId, workspace, opts) {
99735
+ const { lifecycle, running } = listFilters(opts);
99736
+ const where = [];
99737
+ const params = [];
99738
+ if (lifecycle) {
99739
+ where.push("lifecycle = ?");
99740
+ params.push(lifecycle);
99741
+ }
99742
+ if (running !== void 0) where.push(running ? "is_running = 1" : "is_running = 0");
99743
+ const rows = getDb().prepare(
99744
+ `SELECT * FROM sessions ${where.length ? `WHERE ${where.join(" AND ")}` : ""}
99745
+ ORDER BY created_at DESC, rowid DESC`
99746
+ ).all(...params);
99747
+ return rows.filter((row) => sessionVisibleTo(row, appId, workspace)).map((row) => sessionSummary(row, appId));
99748
+ }
99749
+ function appSessionSummary(appId, workspace, sessionId) {
99750
+ const session = getDb().prepare("SELECT * FROM sessions WHERE id = ?").get(String(sessionId));
99751
+ if (!session || !sessionVisibleTo(session, appId, workspace)) return null;
99752
+ return sessionSummary(session, appId);
99753
+ }
99609
99754
  function ownSession(appId, sessionId, api) {
99610
99755
  const session = getDb().prepare("SELECT * FROM sessions WHERE id = ?").get(String(sessionId));
99611
99756
  if (!session || !openedByApp(session, appId)) {
@@ -99650,7 +99795,7 @@ import vm2 from "node:vm";
99650
99795
 
99651
99796
  // src/apps/app-compile.ts
99652
99797
  import vm from "node:vm";
99653
- import path7 from "node:path";
99798
+ import path8 from "node:path";
99654
99799
  import ts from "typescript";
99655
99800
 
99656
99801
  // src/apps/app-lint.ts
@@ -99801,6 +99946,40 @@ interface AgentPaneSessionState {
99801
99946
  resumeState: string | null;
99802
99947
  } | null;
99803
99948
  }
99949
+ /** A session the app can read (listSessions, getSessionInfo): any session of
99950
+ * this instance's workspace and below, every session for the global
99951
+ * instance, plus the ones this app opened. Read only unless app_owned. */
99952
+ interface AgentPaneSessionSummary {
99953
+ id: string;
99954
+ title: string | null;
99955
+ cwd: string | null;
99956
+ /** "claude" | "codex" | "repoburg" | ... */
99957
+ runtime_type: string;
99958
+ model: string | null;
99959
+ model_reasoning_effort: string | null;
99960
+ status: string;
99961
+ /** "working" | "finished": the user's open/done mark in the sidebar. */
99962
+ lifecycle: string;
99963
+ /** A turn is live, also one waiting to continue after an interruption. */
99964
+ running: boolean;
99965
+ /** The runtime's own session id (Claude Code session id, Codex thread id);
99966
+ * null before the first turn. */
99967
+ external_thread_id: string | null;
99968
+ /** Absolute path of the runtime's JSONL transcript; null when there is none
99969
+ * (repoburg, no turn yet, file missing). */
99970
+ transcript_path: string | null;
99971
+ /** Mini app that opened the session; null = the user. */
99972
+ origin_app_id: string | null;
99973
+ /** This app opened it with createSession: submitTurn, cancelTurn and
99974
+ * setSessionLifecycle work on it, and on no other session. */
99975
+ app_owned: boolean;
99976
+ created_at: string;
99977
+ updated_at: string;
99978
+ }
99979
+ interface AgentPaneListSessionsOptions {
99980
+ lifecycle?: 'working' | 'finished';
99981
+ running?: boolean;
99982
+ }
99804
99983
  /** A file the app stored with uploadFile (PNG, JPEG, GIF or WebP, max 5 MB). */
99805
99984
  interface AgentPaneFile {
99806
99985
  /** Content id "<sha256>.<ext>": the same bytes always get the same id. */
@@ -99836,10 +100015,17 @@ declare const AgentPane: {
99836
100015
  * overwriting a newer copy. */
99837
100016
  setState(data: Record<string, unknown> | null, opts?: AgentPaneSetStateOptions): Promise<AgentPaneState>;
99838
100017
  createSession(opts?: AgentPaneCreateSessionOptions): Promise<AgentPaneSessionInfo>;
99839
- /** Send a prompt to a session; opts.attachments go with it (the agent sees images). */
100018
+ /** Send a prompt to one of this app's sessions; opts.attachments go with it
100019
+ * (the agent sees images). Rejects for any other session. */
99840
100020
  submitTurn(sessionId: string, prompt: string, opts?: AgentPaneSubmitTurnOptions): Promise<unknown>;
99841
100021
  /** One of this app's sessions, null for any other id. Works headless too. */
99842
100022
  getSession(sessionId: string): Promise<AgentPaneSessionState | null>;
100023
+ /** Sessions this instance can see, newest first: its workspace and below
100024
+ * (every session for the global instance), plus the ones this app opened.
100025
+ * Read only; works headless too. */
100026
+ listSessions(opts?: AgentPaneListSessionsOptions): Promise<AgentPaneSessionSummary[]>;
100027
+ /** One session listSessions would show, null for any other id. */
100028
+ getSessionInfo(sessionId: string): Promise<AgentPaneSessionSummary | null>;
99843
100029
  /** Stop the running main turn of one of this app's sessions; cancelled is
99844
100030
  * false when none runs. Rejects for any other session. */
99845
100031
  cancelTurn(sessionId: string): Promise<{ cancelled: boolean }>;
@@ -100006,15 +100192,15 @@ function typeCheckModules(appId, modules) {
100006
100192
  };
100007
100193
  const host = ts.createCompilerHost(options);
100008
100194
  const origReadFile = host.readFile.bind(host);
100009
- host.readFile = (fname) => path7.basename(fname) === BRIDGE_DTS_FILE ? BRIDGE_DTS : origReadFile(fname);
100195
+ host.readFile = (fname) => path8.basename(fname) === BRIDGE_DTS_FILE ? BRIDGE_DTS : origReadFile(fname);
100010
100196
  host.writeFile = () => {
100011
100197
  };
100012
- const bridgePath = path7.join(dir, BRIDGE_DTS_FILE);
100013
- const rootNames = [...modules.map((m) => path7.join(dir, m.file)), bridgePath];
100198
+ const bridgePath = path8.join(dir, BRIDGE_DTS_FILE);
100199
+ const rootNames = [...modules.map((m) => path8.join(dir, m.file)), bridgePath];
100014
100200
  const program = ts.createProgram(rootNames, options, host);
100015
100201
  const out = [];
100016
100202
  for (const mod of modules) {
100017
- const sf = program.getSourceFile(path7.join(dir, mod.file));
100203
+ const sf = program.getSourceFile(path8.join(dir, mod.file));
100018
100204
  if (!sf) continue;
100019
100205
  out.push(
100020
100206
  ...[...program.getSyntacticDiagnostics(sf), ...program.getSemanticDiagnostics(sf)].map((d) => tsDiagnosticToFile(mod.file, d)).filter((d) => d !== null)
@@ -100209,6 +100395,10 @@ function loadRuntime(appId, workspace) {
100209
100395
  }
100210
100396
  }),
100211
100397
  getSession: (sessionId) => answer(() => appSessionInfo(appId, sessionId)),
100398
+ // Read only, so no headlessSessions needed: any session of the instance's
100399
+ // workspace, not just the app's own.
100400
+ listSessions: (opts) => answer(() => listAppVisibleSessions(appId, workspace, opts)),
100401
+ getSessionInfo: (sessionId) => answer(() => appSessionSummary(appId, workspace, sessionId)),
100212
100402
  createSession: (opts) => answer(() => {
100213
100403
  requireHeadlessSessions("createSession");
100214
100404
  return createAppSession(appId, workspace, opts);
@@ -100530,7 +100720,7 @@ async function registerAppRoutes(fastify, opts) {
100530
100720
  try {
100531
100721
  for (const entry of fs6.readdirSync(exRoot, { withFileTypes: true })) {
100532
100722
  if (!entry.isDirectory() || !APP_ID_RE.test(entry.name)) continue;
100533
- const manifest = readManifestIn(path8.join(exRoot, entry.name));
100723
+ const manifest = readManifestIn(path9.join(exRoot, entry.name));
100534
100724
  if (!manifest) continue;
100535
100725
  out.push({
100536
100726
  id: entry.name,
@@ -100551,7 +100741,7 @@ async function registerAppRoutes(fastify, opts) {
100551
100741
  if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
100552
100742
  const exRoot = examplesRoot();
100553
100743
  if (!exRoot) return reply.code(404).send({ error: "Examples catalog not available" });
100554
- const src = path8.join(exRoot, id);
100744
+ const src = path9.join(exRoot, id);
100555
100745
  if (!readManifestIn(src)) return reply.code(404).send({ error: "Example not found" });
100556
100746
  if (readManifest(id)) return reply.code(409).send({ error: "App already installed" });
100557
100747
  ensureAppsRoot();
@@ -100590,7 +100780,7 @@ async function registerAppRoutes(fastify, opts) {
100590
100780
  fs6.mkdirSync(dir, { recursive: true });
100591
100781
  const cleanTitle2 = title.trim();
100592
100782
  fs6.writeFileSync(
100593
- path8.join(dir, "manifest.json"),
100783
+ path9.join(dir, "manifest.json"),
100594
100784
  JSON.stringify(
100595
100785
  {
100596
100786
  title: cleanTitle2,
@@ -100601,8 +100791,8 @@ async function registerAppRoutes(fastify, opts) {
100601
100791
  2
100602
100792
  )
100603
100793
  );
100604
- fs6.writeFileSync(path8.join(dir, "index.html"), SKELETON_HTML.replaceAll("__TITLE__", cleanTitle2));
100605
- fs6.writeFileSync(path8.join(dir, "app.ts"), SKELETON_TS);
100794
+ fs6.writeFileSync(path9.join(dir, "index.html"), SKELETON_HTML.replaceAll("__TITLE__", cleanTitle2));
100795
+ fs6.writeFileSync(path9.join(dir, "app.ts"), SKELETON_TS);
100606
100796
  return { ok: true, id };
100607
100797
  }
100608
100798
  );
@@ -100639,9 +100829,9 @@ async function registerAppRoutes(fastify, opts) {
100639
100829
  const dir = appDir(id);
100640
100830
  fs6.mkdirSync(dir, { recursive: true });
100641
100831
  if (!Object.hasOwn(files ?? {}, "manifest.json")) {
100642
- fs6.writeFileSync(path8.join(dir, "manifest.json"), JSON.stringify({ title: id }, null, 2));
100832
+ fs6.writeFileSync(path9.join(dir, "manifest.json"), JSON.stringify({ title: id }, null, 2));
100643
100833
  }
100644
- for (const [name, content] of entries) fs6.writeFileSync(path8.join(dir, name), content);
100834
+ for (const [name, content] of entries) fs6.writeFileSync(path9.join(dir, name), content);
100645
100835
  return { ok: true, id };
100646
100836
  }
100647
100837
  );
@@ -100828,6 +101018,40 @@ async function registerAppRoutes(fastify, opts) {
100828
101018
  return session;
100829
101019
  }
100830
101020
  );
101021
+ fastify.get(
101022
+ "/api/apps/:id/workspace-sessions",
101023
+ {
101024
+ schema: {
101025
+ querystring: {
101026
+ type: "object",
101027
+ properties: {
101028
+ workspace: { type: "string" },
101029
+ lifecycle: { type: "string", enum: ["working", "finished"] },
101030
+ running: { type: "boolean" }
101031
+ }
101032
+ }
101033
+ }
101034
+ },
101035
+ async (request, reply) => {
101036
+ const { id } = request.params;
101037
+ if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
101038
+ if (!readManifest(id)) return reply.code(404).send({ error: "App not found" });
101039
+ const { workspace = "", lifecycle, running } = request.query ?? {};
101040
+ return listAppVisibleSessions(id, workspace, { lifecycle, running });
101041
+ }
101042
+ );
101043
+ fastify.get(
101044
+ "/api/apps/:id/workspace-sessions/:sessionId",
101045
+ { schema: { querystring: { type: "object", properties: { workspace: { type: "string" } } } } },
101046
+ async (request, reply) => {
101047
+ const { id, sessionId } = request.params;
101048
+ if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
101049
+ if (!readManifest(id)) return reply.code(404).send({ error: "App not found" });
101050
+ const session = appSessionSummary(id, request.query?.workspace ?? "", sessionId);
101051
+ if (!session) return reply.code(404).send({ error: "Session not found" });
101052
+ return session;
101053
+ }
101054
+ );
100831
101055
  fastify.post(
100832
101056
  "/api/apps/:id/sessions/:sessionId/cancel",
100833
101057
  async (request, reply) => {
@@ -100908,67 +101132,6 @@ async function registerAppRoutes(fastify, opts) {
100908
101132
  );
100909
101133
  }
100910
101134
 
100911
- // src/sidecar/transcript-locator.ts
100912
- import { existsSync as existsSync2, readdirSync } from "node:fs";
100913
- import { homedir as homedir3 } from "node:os";
100914
- import { join as join2 } from "node:path";
100915
- function claudeConfigDir() {
100916
- return process.env.CLAUDE_CONFIG_DIR || join2(homedir3(), ".claude");
100917
- }
100918
- function codexHome() {
100919
- return process.env.CODEX_HOME || join2(homedir3(), ".codex");
100920
- }
100921
- function encodeClaudeProjectDir(cwd) {
100922
- return cwd.replace(/[^a-zA-Z0-9]/g, "-");
100923
- }
100924
- function listDir(dir) {
100925
- try {
100926
- return readdirSync(dir);
100927
- } catch {
100928
- return [];
100929
- }
100930
- }
100931
- function findClaudeTranscript(externalId, cwd) {
100932
- const projects = join2(claudeConfigDir(), "projects");
100933
- const fileName = `${externalId}.jsonl`;
100934
- if (cwd) {
100935
- const direct = join2(projects, encodeClaudeProjectDir(cwd), fileName);
100936
- if (existsSync2(direct)) return direct;
100937
- }
100938
- for (const dir of listDir(projects)) {
100939
- const candidate = join2(projects, dir, fileName);
100940
- if (existsSync2(candidate)) return candidate;
100941
- }
100942
- return null;
100943
- }
100944
- function findCodexTranscript(externalId) {
100945
- const root = join2(codexHome(), "sessions");
100946
- const suffix = `-${externalId}.jsonl`;
100947
- const desc = (dir) => listDir(dir).sort().reverse();
100948
- for (const year of desc(root)) {
100949
- for (const month of desc(join2(root, year))) {
100950
- for (const day of desc(join2(root, year, month))) {
100951
- const dayDir = join2(root, year, month, day);
100952
- const match = listDir(dayDir).find((f) => f.endsWith(suffix));
100953
- if (match) return join2(dayDir, match);
100954
- }
100955
- }
100956
- }
100957
- return null;
100958
- }
100959
- function locateTranscript(session) {
100960
- const externalId = session.external_thread_id;
100961
- if (!externalId) return null;
100962
- switch (session.runtime_type) {
100963
- case "claude":
100964
- return findClaudeTranscript(externalId, session.cwd);
100965
- case "codex":
100966
- return findCodexTranscript(externalId);
100967
- default:
100968
- return null;
100969
- }
100970
- }
100971
-
100972
101135
  // src/sidecar/prompt.ts
100973
101136
  var SIDECAR_QUESTION_MARKER = "Understand the user's question below, read the session file given above, and answer.";
100974
101137
  function buildSidecarPrompt(externalSessionId, transcriptPath, question) {
@@ -101362,7 +101525,7 @@ async function registerUsageRoutes(fastify) {
101362
101525
 
101363
101526
  // src/claude/session-import.ts
101364
101527
  import { readFile as readFile2, realpath } from "node:fs/promises";
101365
- import path9 from "node:path";
101528
+ import path10 from "node:path";
101366
101529
  import { getSessionInfo, listSessions } from "@anthropic-ai/claude-agent-sdk";
101367
101530
 
101368
101531
  // src/claude/widget-tool.ts
@@ -102134,10 +102297,10 @@ function mergeDefs(...defs) {
102134
102297
  function cloneDef(schema) {
102135
102298
  return mergeDefs(schema._zod.def);
102136
102299
  }
102137
- function getElementAtPath(obj, path12) {
102138
- if (!path12)
102300
+ function getElementAtPath(obj, path13) {
102301
+ if (!path13)
102139
102302
  return obj;
102140
- return path12.reduce((acc, key) => acc?.[key], obj);
102303
+ return path13.reduce((acc, key) => acc?.[key], obj);
102141
102304
  }
102142
102305
  function promiseAllObject(promisesObj) {
102143
102306
  const keys = Object.keys(promisesObj);
@@ -102546,11 +102709,11 @@ function explicitlyAborted(x, startIndex = 0) {
102546
102709
  }
102547
102710
  return false;
102548
102711
  }
102549
- function prefixIssues(path12, issues) {
102712
+ function prefixIssues(path13, issues) {
102550
102713
  return issues.map((iss) => {
102551
102714
  var _a3;
102552
102715
  (_a3 = iss).path ?? (_a3.path = []);
102553
- iss.path.unshift(path12);
102716
+ iss.path.unshift(path13);
102554
102717
  return iss;
102555
102718
  });
102556
102719
  }
@@ -102697,16 +102860,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
102697
102860
  }
102698
102861
  function formatError(error51, mapper = (issue2) => issue2.message) {
102699
102862
  const fieldErrors = { _errors: [] };
102700
- const processError = (error52, path12 = []) => {
102863
+ const processError = (error52, path13 = []) => {
102701
102864
  for (const issue2 of error52.issues) {
102702
102865
  if (issue2.code === "invalid_union" && issue2.errors.length) {
102703
- issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
102866
+ issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
102704
102867
  } else if (issue2.code === "invalid_key") {
102705
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
102868
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
102706
102869
  } else if (issue2.code === "invalid_element") {
102707
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
102870
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
102708
102871
  } else {
102709
- const fullpath = [...path12, ...issue2.path];
102872
+ const fullpath = [...path13, ...issue2.path];
102710
102873
  if (fullpath.length === 0) {
102711
102874
  fieldErrors._errors.push(mapper(issue2));
102712
102875
  } else {
@@ -102733,17 +102896,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
102733
102896
  }
102734
102897
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
102735
102898
  const result = { errors: [] };
102736
- const processError = (error52, path12 = []) => {
102899
+ const processError = (error52, path13 = []) => {
102737
102900
  var _a3, _b;
102738
102901
  for (const issue2 of error52.issues) {
102739
102902
  if (issue2.code === "invalid_union" && issue2.errors.length) {
102740
- issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
102903
+ issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
102741
102904
  } else if (issue2.code === "invalid_key") {
102742
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
102905
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
102743
102906
  } else if (issue2.code === "invalid_element") {
102744
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
102907
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
102745
102908
  } else {
102746
- const fullpath = [...path12, ...issue2.path];
102909
+ const fullpath = [...path13, ...issue2.path];
102747
102910
  if (fullpath.length === 0) {
102748
102911
  result.errors.push(mapper(issue2));
102749
102912
  continue;
@@ -102775,8 +102938,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
102775
102938
  }
102776
102939
  function toDotPath(_path) {
102777
102940
  const segs = [];
102778
- const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
102779
- for (const seg of path12) {
102941
+ const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
102942
+ for (const seg of path13) {
102780
102943
  if (typeof seg === "number")
102781
102944
  segs.push(`[${seg}]`);
102782
102945
  else if (typeof seg === "symbol")
@@ -115468,13 +115631,13 @@ function resolveRef(ref, ctx) {
115468
115631
  if (!ref.startsWith("#")) {
115469
115632
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
115470
115633
  }
115471
- const path12 = ref.slice(1).split("/").filter(Boolean);
115472
- if (path12.length === 0) {
115634
+ const path13 = ref.slice(1).split("/").filter(Boolean);
115635
+ if (path13.length === 0) {
115473
115636
  return ctx.rootSchema;
115474
115637
  }
115475
115638
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
115476
- if (path12[0] === defsKey) {
115477
- const key = path12[1];
115639
+ if (path13[0] === defsKey) {
115640
+ const key = path13[1];
115478
115641
  if (!key || !ctx.defs[key]) {
115479
115642
  throw new Error(`Reference not found: ${ref}`);
115480
115643
  }
@@ -116020,9 +116183,9 @@ function mapToolUse(block) {
116020
116183
  };
116021
116184
  }
116022
116185
  function deriveFileChangeData(input, toolName) {
116023
- const path12 = input.file_path ?? input.notebook_path ?? "";
116186
+ const path13 = input.file_path ?? input.notebook_path ?? "";
116024
116187
  const kind = toolName === "Write" ? "add" : "modify";
116025
- return { changes: [{ path: path12, kind }], status: "in_progress" };
116188
+ return { changes: [{ path: path13, kind }], status: "in_progress" };
116026
116189
  }
116027
116190
  function extractToolResultText(content) {
116028
116191
  if (!content) return "";
@@ -116387,7 +116550,7 @@ async function realDir(dir) {
116387
116550
  }
116388
116551
  }
116389
116552
  async function sameDir(a, realB) {
116390
- const realA = await realDir(a) ?? path9.resolve(a);
116553
+ const realA = await realDir(a) ?? path10.resolve(a);
116391
116554
  return realA === realB;
116392
116555
  }
116393
116556
  function knownClaudeSessionIds(db2) {
@@ -116623,18 +116786,18 @@ function mapTokenUsage(data) {
116623
116786
 
116624
116787
  // src/apps/register-mcp.ts
116625
116788
  import fs7 from "node:fs";
116626
- import path10 from "node:path";
116789
+ import path11 from "node:path";
116627
116790
  import { fileURLToPath as fileURLToPath2 } from "node:url";
116628
116791
  var MCP_SERVER_NAME = "agentpane-miniapps";
116629
116792
  function panePublicUrl() {
116630
116793
  return (process.env.AGENT_PANE_PUBLIC_URL || process.env.REPOBURG_DAEMON_URL || "http://localhost:9998").replace(/\/+$/, "");
116631
116794
  }
116632
116795
  function stdioScriptPath() {
116633
- const here = path10.dirname(fileURLToPath2(import.meta.url));
116796
+ const here = path11.dirname(fileURLToPath2(import.meta.url));
116634
116797
  const candidates = [
116635
- path10.resolve(here, "../../scripts/miniapp-mcp-stdio.mjs"),
116798
+ path11.resolve(here, "../../scripts/miniapp-mcp-stdio.mjs"),
116636
116799
  // src/apps/ → backend/scripts
116637
- path10.resolve(here, "../scripts/miniapp-mcp-stdio.mjs")
116800
+ path11.resolve(here, "../scripts/miniapp-mcp-stdio.mjs")
116638
116801
  // dist bundle → backend/scripts
116639
116802
  ];
116640
116803
  for (const candidate of candidates) {
@@ -119358,8 +119521,8 @@ var RepoburgHttpClient = class {
119358
119521
  this.baseUrl = baseUrl.replace(/\/+$/, "");
119359
119522
  }
119360
119523
  /** Perform a JSON request. Throws a concise error on non-OK/non-JSON responses. */
119361
- async request(method, path12, body) {
119362
- const response = await fetch(`${this.baseUrl}${path12}`, {
119524
+ async request(method, path13, body) {
119525
+ const response = await fetch(`${this.baseUrl}${path13}`, {
119363
119526
  method,
119364
119527
  headers: { "Content-Type": "application/json" },
119365
119528
  body: body === void 0 ? void 0 : JSON.stringify(body)
@@ -119368,17 +119531,17 @@ var RepoburgHttpClient = class {
119368
119531
  if (!response.ok) {
119369
119532
  if (isHtml(text2)) {
119370
119533
  throw new Error(
119371
- `${method} ${path12} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
119534
+ `${method} ${path13} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
119372
119535
  );
119373
119536
  }
119374
- throw new Error(`${method} ${path12} failed: ${response.status} ${text2}`);
119537
+ throw new Error(`${method} ${path13} failed: ${response.status} ${text2}`);
119375
119538
  }
119376
119539
  if (text2.length === 0) return void 0;
119377
119540
  try {
119378
119541
  return JSON.parse(text2);
119379
119542
  } catch {
119380
119543
  throw new Error(
119381
- `${method} ${path12} failed: non-JSON response from ${this.baseUrl} \u2014 the URL points to the wrong server`
119544
+ `${method} ${path13} failed: non-JSON response from ${this.baseUrl} \u2014 the URL points to the wrong server`
119382
119545
  );
119383
119546
  }
119384
119547
  }
@@ -119433,7 +119596,7 @@ var RepoburgHttpClient = class {
119433
119596
  };
119434
119597
 
119435
119598
  // src/repoburg/backend-resolver.ts
119436
- import path11 from "node:path";
119599
+ import path12 from "node:path";
119437
119600
  var HEALTH_POLL_INTERVAL_MS = 1e3;
119438
119601
  var HEALTH_TIMEOUT_MS = 3e4;
119439
119602
  function daemonBaseUrl() {
@@ -119488,7 +119651,7 @@ async function backendHealthy(baseUrl, expectedPath) {
119488
119651
  const health = await fetchJson(`${baseUrl}/health`, void 0, 2e3);
119489
119652
  if (health.status !== "ok") return false;
119490
119653
  if (expectedPath && health.projectPath) {
119491
- return path11.resolve(health.projectPath) === path11.resolve(expectedPath);
119654
+ return path12.resolve(health.projectPath) === path12.resolve(expectedPath);
119492
119655
  }
119493
119656
  return true;
119494
119657
  } catch {
@@ -119509,7 +119672,7 @@ function serviceBaseUrl(service) {
119509
119672
  return `http://localhost:${service.port}`;
119510
119673
  }
119511
119674
  function coveringService(services, absPath) {
119512
- return services.filter((s) => absPath === s.path || absPath.startsWith(s.path + path11.sep)).sort((a, b) => b.path.length - a.path.length)[0];
119675
+ return services.filter((s) => absPath === s.path || absPath.startsWith(s.path + path12.sep)).sort((a, b) => b.path.length - a.path.length)[0];
119513
119676
  }
119514
119677
  async function restartService(daemon, name) {
119515
119678
  try {
@@ -119545,7 +119708,7 @@ async function resolveBackendUrl(projectPath, opts = {}) {
119545
119708
  if (envUrl) {
119546
119709
  return { baseUrl: envUrl.replace(/\/+$/, ""), port: 0, name: "REPOBURG_BACKEND_URL" };
119547
119710
  }
119548
- const absPath = path11.resolve(projectPath);
119711
+ const absPath = path12.resolve(projectPath);
119549
119712
  const daemon = daemonBaseUrl();
119550
119713
  const cached2 = resolvedCache.get(absPath);
119551
119714
  if (cached2 && await backendHealthy(cached2.baseUrl, cached2.servesPath ?? absPath)) {