repoburg 1.3.297 → 1.3.300
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-pane/backend/dist/index.js +480 -317
- package/agent-pane/backend/dist/server.js +480 -317
- package/agent-pane/frontend/dist/assets/{TerminalView-BLFbzxTg.js → TerminalView-40Tn0_xY.js} +1 -1
- package/agent-pane/frontend/dist/assets/{index-Yp5flUxQ.js → index-B2ViX6qy.js} +140 -135
- package/agent-pane/frontend/dist/assets/index-BkJYM4TG.css +1 -0
- package/agent-pane/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/tabtape/extension/dist/build-info.json +4 -4
- package/tabtape/extension/dist/manifest.json +1 -1
- package/tabtape/extension/dist/recorder.js +24 -24
- package/tabtape/extension/dist/recorder.js.map +1 -1
- package/tabtape/ui/dist/app/assets/{index-B7yWGVQ_.js → index-BLc-m0WB.js} +10 -10
- package/tabtape/ui/dist/app/index.html +1 -1
- package/tabtape/ui/dist/build-info.json +4 -4
- package/tabtape/ui/dist/export/viewer.js +6 -6
- package/agent-pane/frontend/dist/assets/index-CTJaAKW9.css +0 -1
|
@@ -6128,8 +6128,8 @@ var require_req = __commonJS({
|
|
|
6128
6128
|
if (req.originalUrl) {
|
|
6129
6129
|
_req.url = req.originalUrl;
|
|
6130
6130
|
} else {
|
|
6131
|
-
const
|
|
6132
|
-
_req.url = typeof
|
|
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(
|
|
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 <
|
|
6304
|
-
const char =
|
|
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
|
|
6436
|
-
const parts = parsePath(
|
|
6435
|
+
for (const path13 of paths) {
|
|
6436
|
+
const parts = parsePath(path13);
|
|
6437
6437
|
if (parts.includes("*")) {
|
|
6438
|
-
redactWildcardPath(obj, parts, censor,
|
|
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,
|
|
6524
|
-
const fullPath = [...pathArray.slice(0, pathLength), ...
|
|
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
|
|
6560
|
-
const parts = parsePath(
|
|
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(
|
|
6613
|
-
if (typeof
|
|
6612
|
+
function validatePath(path13) {
|
|
6613
|
+
if (typeof path13 !== "string") {
|
|
6614
6614
|
throw new Error("Paths must be (non-empty) strings");
|
|
6615
6615
|
}
|
|
6616
|
-
if (
|
|
6616
|
+
if (path13 === "") {
|
|
6617
6617
|
throw new Error("Invalid redaction path ()");
|
|
6618
6618
|
}
|
|
6619
|
-
if (
|
|
6620
|
-
throw new Error(`Invalid redaction path (${
|
|
6619
|
+
if (path13.includes("..")) {
|
|
6620
|
+
throw new Error(`Invalid redaction path (${path13})`);
|
|
6621
6621
|
}
|
|
6622
|
-
if (
|
|
6623
|
-
throw new Error(`Invalid redaction path (${
|
|
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 <
|
|
6629
|
-
const char =
|
|
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 (${
|
|
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 (${
|
|
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
|
|
6656
|
-
validatePath(
|
|
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,
|
|
6825
|
-
return censor(value, [k, ...
|
|
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
|
|
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(
|
|
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(
|
|
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
|
|
8441
|
-
if (
|
|
8440
|
+
let path13 = unquoted;
|
|
8441
|
+
if (path13.startsWith("file://")) {
|
|
8442
8442
|
try {
|
|
8443
|
-
|
|
8443
|
+
path13 = fileURLToPath3(path13);
|
|
8444
8444
|
} catch {
|
|
8445
8445
|
return false;
|
|
8446
8446
|
}
|
|
8447
8447
|
}
|
|
8448
|
-
return isAbsolute(
|
|
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(
|
|
17125
|
-
let input =
|
|
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 [
|
|
17378
|
-
wsComponent.path =
|
|
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(
|
|
22316
|
-
let input =
|
|
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 [
|
|
22662
|
-
wsComponent.path =
|
|
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(
|
|
24147
|
-
let input =
|
|
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 [
|
|
24493
|
-
wsComponent.path =
|
|
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(
|
|
32011
|
-
const charCode =
|
|
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(
|
|
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(
|
|
32025
|
-
if (
|
|
32024
|
+
getStaticChild(path13, pathIndex = 0) {
|
|
32025
|
+
if (path13.length === pathIndex) {
|
|
32026
32026
|
return this;
|
|
32027
32027
|
}
|
|
32028
|
-
const staticChild = this.findStaticMatchingChild(
|
|
32028
|
+
const staticChild = this.findStaticMatchingChild(path13, pathIndex);
|
|
32029
32029
|
if (staticChild) {
|
|
32030
|
-
return staticChild.getStaticChild(
|
|
32030
|
+
return staticChild.getStaticChild(path13, pathIndex + staticChild.prefix.length);
|
|
32031
32031
|
}
|
|
32032
32032
|
return null;
|
|
32033
32033
|
}
|
|
32034
|
-
createStaticChild(
|
|
32035
|
-
if (
|
|
32034
|
+
createStaticChild(path13) {
|
|
32035
|
+
if (path13.length === 0) {
|
|
32036
32036
|
return this;
|
|
32037
32037
|
}
|
|
32038
|
-
const childIndex = this.staticChildrenCharCodes.indexOf(
|
|
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 (
|
|
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(
|
|
32048
|
+
return staticChild.createStaticChild(path13.slice(i));
|
|
32049
32049
|
}
|
|
32050
|
-
const node = new StaticNode(
|
|
32051
|
-
this.setStaticChild(
|
|
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(
|
|
32112
|
-
let node = this.findStaticMatchingChild(
|
|
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(
|
|
32160
|
-
return this.findStaticMatchingChild(
|
|
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(
|
|
32517
|
-
if (
|
|
32518
|
-
return safeDecodeURINativeScan(
|
|
32516
|
+
function safeDecodeURI(path13, useSemicolonDelimiter) {
|
|
32517
|
+
if (path13.length >= MIN_NATIVE_SCAN_LENGTH) {
|
|
32518
|
+
return safeDecodeURINativeScan(path13, useSemicolonDelimiter);
|
|
32519
32519
|
}
|
|
32520
|
-
return safeDecodeURICharScan(
|
|
32520
|
+
return safeDecodeURICharScan(path13, useSemicolonDelimiter, 1);
|
|
32521
32521
|
}
|
|
32522
|
-
function safeDecodeURINativeScan(
|
|
32523
|
-
const percentIndex =
|
|
32524
|
-
let delimIndex =
|
|
32525
|
-
const hashIndex =
|
|
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 =
|
|
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:
|
|
32537
|
+
return { path: path13, querystring: "", shouldDecodeParam: false };
|
|
32538
32538
|
}
|
|
32539
32539
|
return {
|
|
32540
|
-
path:
|
|
32541
|
-
querystring:
|
|
32540
|
+
path: path13.slice(0, delimIndex),
|
|
32541
|
+
querystring: path13.slice(delimIndex + 1),
|
|
32542
32542
|
shouldDecodeParam: false
|
|
32543
32543
|
};
|
|
32544
32544
|
}
|
|
32545
|
-
return safeDecodeURIPercentScan(
|
|
32545
|
+
return safeDecodeURIPercentScan(path13, useSemicolonDelimiter, percentIndex);
|
|
32546
32546
|
}
|
|
32547
|
-
function safeDecodeURICharScan(
|
|
32548
|
-
for (let i = startIndex; i <
|
|
32549
|
-
const charCode =
|
|
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(
|
|
32551
|
+
return safeDecodeURIPercentScan(path13, useSemicolonDelimiter, i);
|
|
32552
32552
|
} else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
|
|
32553
32553
|
return {
|
|
32554
|
-
path:
|
|
32555
|
-
querystring:
|
|
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:
|
|
32560
|
+
return { path: path13, querystring: "", shouldDecodeParam: false };
|
|
32561
32561
|
}
|
|
32562
|
-
function reencodePercentChar(
|
|
32563
|
-
return
|
|
32562
|
+
function reencodePercentChar(path13, index) {
|
|
32563
|
+
return path13.slice(0, index + 1) + "25" + path13.slice(index + 1);
|
|
32564
32564
|
}
|
|
32565
|
-
function safeDecodeURIPercentScan(
|
|
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 <
|
|
32570
|
-
const charCode =
|
|
32569
|
+
for (let i = startIndex; i < path13.length; i++) {
|
|
32570
|
+
const charCode = path13.charCodeAt(i);
|
|
32571
32571
|
if (charCode === 37) {
|
|
32572
|
-
const componentCharCode = decodeComponentCharCode(
|
|
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
|
-
|
|
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 =
|
|
32586
|
-
|
|
32585
|
+
querystring = path13.slice(i + 1);
|
|
32586
|
+
path13 = path13.slice(0, i);
|
|
32587
32587
|
break;
|
|
32588
32588
|
}
|
|
32589
32589
|
}
|
|
32590
|
-
const decodedPath = shouldDecode ? decodeURI(
|
|
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,
|
|
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
|
|
32694
|
-
assert2(
|
|
32695
|
-
assert2(
|
|
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 =
|
|
32697
|
+
const optionalParamMatch = path13.match(OPTIONAL_PARAM_REGEXP);
|
|
32698
32698
|
if (optionalParamMatch) {
|
|
32699
|
-
assert2(
|
|
32700
|
-
const pathFull =
|
|
32701
|
-
const pathOptional =
|
|
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 =
|
|
32706
|
+
const route = path13;
|
|
32707
32707
|
if (this.ignoreDuplicateSlashes) {
|
|
32708
|
-
|
|
32708
|
+
path13 = removeDuplicateSlashes(path13);
|
|
32709
32709
|
}
|
|
32710
32710
|
if (this.ignoreTrailingSlash) {
|
|
32711
|
-
|
|
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,
|
|
32717
|
+
this._on(method2, path13, opts, handler, store, route);
|
|
32718
32718
|
}
|
|
32719
32719
|
};
|
|
32720
|
-
Router.prototype._on = function _on(method,
|
|
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 =
|
|
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:
|
|
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,
|
|
32846
|
-
const route = this.findRoute(method,
|
|
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,
|
|
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 =
|
|
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,
|
|
32975
|
-
assert2(typeof
|
|
32976
|
-
assert2(
|
|
32977
|
-
assert2(
|
|
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 =
|
|
32982
|
+
const optionalParamMatch = path13.match(OPTIONAL_PARAM_REGEXP);
|
|
32983
32983
|
if (optionalParamMatch) {
|
|
32984
|
-
assert2(
|
|
32985
|
-
const pathFull =
|
|
32986
|
-
const pathOptional =
|
|
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
|
-
|
|
32992
|
+
path13 = removeDuplicateSlashes(path13);
|
|
32993
32993
|
}
|
|
32994
32994
|
if (this.ignoreTrailingSlash) {
|
|
32995
|
-
|
|
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,
|
|
32999
|
+
this._off(method2, path13, constraints);
|
|
33000
33000
|
}
|
|
33001
33001
|
};
|
|
33002
|
-
Router.prototype._off = function _off(method,
|
|
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 ||
|
|
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,
|
|
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 (
|
|
33047
|
-
|
|
33046
|
+
if (path13.charCodeAt(0) !== 47) {
|
|
33047
|
+
path13 = path13.replace(FULL_PATH_REGEXP, "/");
|
|
33048
33048
|
}
|
|
33049
33049
|
if (this.ignoreDuplicateSlashes) {
|
|
33050
|
-
|
|
33050
|
+
path13 = removeDuplicateSlashes(path13);
|
|
33051
33051
|
}
|
|
33052
33052
|
let sanitizedUrl;
|
|
33053
33053
|
let querystring2;
|
|
33054
33054
|
let shouldDecodeParam;
|
|
33055
33055
|
try {
|
|
33056
|
-
sanitizedUrl =
|
|
33057
|
-
|
|
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(
|
|
33061
|
+
return this._onBadUrl(path13);
|
|
33062
33062
|
}
|
|
33063
33063
|
if (this.ignoreTrailingSlash) {
|
|
33064
|
-
|
|
33064
|
+
path13 = trimLastSlash(path13);
|
|
33065
33065
|
}
|
|
33066
|
-
const originPath =
|
|
33066
|
+
const originPath = path13;
|
|
33067
33067
|
if (this.caseSensitive === false) {
|
|
33068
|
-
|
|
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 =
|
|
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(
|
|
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:
|
|
33190
|
-
this._on(method,
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
33251
|
-
return this.on(m,
|
|
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(
|
|
33255
|
-
this.on(httpMethods,
|
|
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(
|
|
33271
|
-
return
|
|
33270
|
+
function removeDuplicateSlashes(path13) {
|
|
33271
|
+
return path13.indexOf("//") !== -1 ? path13.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, "/") : path13;
|
|
33272
33272
|
}
|
|
33273
|
-
function trimLastSlash(
|
|
33274
|
-
if (
|
|
33275
|
-
return
|
|
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
|
|
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(
|
|
33288
|
+
function getClosingParenthensePosition(path13, idx) {
|
|
33289
33289
|
let parentheses = 1;
|
|
33290
|
-
while (idx <
|
|
33290
|
+
while (idx < path13.length) {
|
|
33291
33291
|
idx++;
|
|
33292
|
-
if (
|
|
33292
|
+
if (path13.charCodeAt(idx) === 92) {
|
|
33293
33293
|
idx++;
|
|
33294
33294
|
continue;
|
|
33295
33295
|
}
|
|
33296
|
-
if (
|
|
33296
|
+
if (path13.charCodeAt(idx) === 41) {
|
|
33297
33297
|
parentheses--;
|
|
33298
|
-
} else if (
|
|
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 "' +
|
|
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
|
|
33536
|
+
const path13 = opts.url || opts.path || "";
|
|
33537
33537
|
if (!opts.handler) {
|
|
33538
|
-
throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method,
|
|
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,
|
|
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],
|
|
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,
|
|
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 (
|
|
33563
|
+
if (path13 === "/" && prefix.length > 0 && opts.method !== "HEAD") {
|
|
33564
33564
|
switch (opts.prefixTrailingSlash) {
|
|
33565
33565
|
case "slash":
|
|
33566
|
-
addNewRoute.call(this, { path:
|
|
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:
|
|
33575
|
+
addNewRoute.call(this, { path: path13, prefixing: true, isFastify });
|
|
33576
33576
|
}
|
|
33577
33577
|
}
|
|
33578
|
-
} else if (
|
|
33579
|
-
addNewRoute.call(this, { path:
|
|
33578
|
+
} else if (path13[0] === "/" && prefix.endsWith("/")) {
|
|
33579
|
+
addNewRoute.call(this, { path: path13.slice(1), isFastify });
|
|
33580
33580
|
} else {
|
|
33581
|
-
addNewRoute.call(this, { path:
|
|
33581
|
+
addNewRoute.call(this, { path: path13, isFastify });
|
|
33582
33582
|
}
|
|
33583
33583
|
return this;
|
|
33584
|
-
function addNewRoute({ path:
|
|
33585
|
-
const url2 = prefix +
|
|
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 =
|
|
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:
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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(
|
|
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(
|
|
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(
|
|
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: `'${
|
|
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(
|
|
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(
|
|
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: `'${
|
|
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(
|
|
41009
|
-
db = new Database(
|
|
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);
|
|
@@ -43265,9 +43265,9 @@ async function browseFolder(input, opts = {}) {
|
|
|
43265
43265
|
const atHome = dir === nodePath.resolve(home);
|
|
43266
43266
|
const folders = await Promise.all(
|
|
43267
43267
|
names.slice(0, limit).map(async (name) => {
|
|
43268
|
-
const
|
|
43268
|
+
const path13 = nodePath.join(dir, name);
|
|
43269
43269
|
const skipProbe = atHome && HOME_STANDARD_FOLDERS.has(name) || dir === "/Volumes";
|
|
43270
|
-
return { name, path:
|
|
43270
|
+
return { name, path: path13, git: !skipProbe && await exists(nodePath.join(path13, ".git")) };
|
|
43271
43271
|
})
|
|
43272
43272
|
);
|
|
43273
43273
|
const parent = nodePath.dirname(dir);
|
|
@@ -43305,11 +43305,11 @@ async function registerWorkspaceRoutes(fastify) {
|
|
|
43305
43305
|
}
|
|
43306
43306
|
}
|
|
43307
43307
|
}, async (request, reply) => {
|
|
43308
|
-
const { path:
|
|
43309
|
-
if (!
|
|
43308
|
+
const { path: path13, label = null } = request.body || {};
|
|
43309
|
+
if (!path13 || !path13.trim()) {
|
|
43310
43310
|
return reply.code(400).send({ error: "Path is required" });
|
|
43311
43311
|
}
|
|
43312
|
-
const resolved = await resolveWorkspacePath(
|
|
43312
|
+
const resolved = await resolveWorkspacePath(path13);
|
|
43313
43313
|
if ("error" in resolved) {
|
|
43314
43314
|
return reply.code(400).send({ error: resolved.error });
|
|
43315
43315
|
}
|
|
@@ -43351,8 +43351,8 @@ async function registerWorkspaceRoutes(fastify) {
|
|
|
43351
43351
|
"-e",
|
|
43352
43352
|
'POSIX path of (choose folder with prompt "Select a workspace directory")'
|
|
43353
43353
|
]);
|
|
43354
|
-
const
|
|
43355
|
-
return { path:
|
|
43354
|
+
const path13 = stdout.trim().replace(/\/$/, "");
|
|
43355
|
+
return { path: path13 };
|
|
43356
43356
|
} catch {
|
|
43357
43357
|
return reply.code(204).send({ cancelled: true });
|
|
43358
43358
|
}
|
|
@@ -43368,11 +43368,11 @@ async function registerWorkspaceRoutes(fastify) {
|
|
|
43368
43368
|
}
|
|
43369
43369
|
}
|
|
43370
43370
|
}, async (request, reply) => {
|
|
43371
|
-
const { path:
|
|
43372
|
-
if (!
|
|
43371
|
+
const { path: path13 } = request.body || {};
|
|
43372
|
+
if (!path13 || !path13.trim()) {
|
|
43373
43373
|
return reply.code(400).send({ error: "Path is required" });
|
|
43374
43374
|
}
|
|
43375
|
-
const trimmedPath =
|
|
43375
|
+
const trimmedPath = path13.trim();
|
|
43376
43376
|
const db2 = getDb();
|
|
43377
43377
|
const existing = db2.prepare("SELECT * FROM workspaces WHERE path = ?").get(trimmedPath);
|
|
43378
43378
|
if (existing) {
|
|
@@ -44057,17 +44057,17 @@ async function registerPerfLogRoutes(fastify) {
|
|
|
44057
44057
|
if (entries.length === 0) {
|
|
44058
44058
|
return reply.send({ written: 0 });
|
|
44059
44059
|
}
|
|
44060
|
-
const
|
|
44060
|
+
const path13 = perfLogPath();
|
|
44061
44061
|
try {
|
|
44062
|
-
mkdirSync(dirname(
|
|
44062
|
+
mkdirSync(dirname(path13), { recursive: true });
|
|
44063
44063
|
try {
|
|
44064
|
-
if (statSync(
|
|
44065
|
-
renameSync(
|
|
44064
|
+
if (statSync(path13).size > MAX_BYTES) {
|
|
44065
|
+
renameSync(path13, `${path13}.1`);
|
|
44066
44066
|
}
|
|
44067
44067
|
} catch {
|
|
44068
44068
|
}
|
|
44069
44069
|
const lines = entries.map((e) => `${new Date(e.t).toISOString()} [${oneLine(e.cat)}] ${oneLine(e.msg)}`).join("\n");
|
|
44070
|
-
appendFileSync(
|
|
44070
|
+
appendFileSync(path13, `${lines}
|
|
44071
44071
|
`, "utf-8");
|
|
44072
44072
|
return reply.send({ written: entries.length });
|
|
44073
44073
|
} catch (err) {
|
|
@@ -44692,7 +44692,7 @@ function proxyHandler(request, reply) {
|
|
|
44692
44692
|
|
|
44693
44693
|
// src/routes/apps.ts
|
|
44694
44694
|
import fs6 from "node:fs";
|
|
44695
|
-
import
|
|
44695
|
+
import path9 from "node:path";
|
|
44696
44696
|
|
|
44697
44697
|
// src/apps/instances.ts
|
|
44698
44698
|
import fs3 from "node:fs";
|
|
@@ -99031,8 +99031,10 @@ Icons come from ONE library: Lucide (https://lucide.dev/icons, ISC).
|
|
|
99031
99031
|
- getState() / setState(data, { ifVersion }?) - persistent JSON state, survives page reload; getState reads the stored copy on every call (see "Shared state" below)
|
|
99032
99032
|
- onStateChanged(callback) - callback({ version }) when somebody else (an agent, another tab) wrote the state; not fired for this tab's own setState
|
|
99033
99033
|
- 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
|
|
99034
|
-
- submitTurn(sessionId, prompt, { attachments }?) - send a prompt to
|
|
99034
|
+
- 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)
|
|
99035
99035
|
- 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'
|
|
99036
|
+
- 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
|
|
99037
|
+
- 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
|
|
99036
99038
|
- 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
|
|
99037
99039
|
- setSessionLifecycle(sessionId, 'finished' | 'working') - finish or reopen one of this app's sessions, as the sidebar does; rejects for any other session
|
|
99038
99040
|
- 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
|
|
@@ -99110,6 +99112,9 @@ Headless contract for apps that declare tools:
|
|
|
99110
99112
|
call with "Unknown workspace", and no state is read or written
|
|
99111
99113
|
- openSession/openUrl are not available in the headless runtime;
|
|
99112
99114
|
createSession/submitTurn only with "headlessSessions" (see below)
|
|
99115
|
+
- getSession, listSessions and getSessionInfo work headless, with or without
|
|
99116
|
+
"headlessSessions"; listSessions sees the sessions of the instance's
|
|
99117
|
+
workspace
|
|
99113
99118
|
- stored files are: getFile(ref)/fileUrl(ref)/uploadFile({ name, type, data })
|
|
99114
99119
|
work headless (url is root-relative there); return file.path to the agent
|
|
99115
99120
|
so it can open the image
|
|
@@ -99147,6 +99152,9 @@ runtime and events go to the open tab only.
|
|
|
99147
99152
|
from a tool handler or an event callback. All but createSession reach only
|
|
99148
99153
|
sessions this app opened; attachments are stored files or inline
|
|
99149
99154
|
{ name, type, data } (no Blobs in the sandbox)
|
|
99155
|
+
- to work on a session the app did not open (the user's), read it with
|
|
99156
|
+
getSessionInfo (cwd, runtime_type, model, external_thread_id,
|
|
99157
|
+
transcript_path) and open a session of the app's own in its cwd
|
|
99150
99158
|
- onTurnCompleted and onBackgroundTasks fire in the headless runtime, for every
|
|
99151
99159
|
session of the app, also the ones its tab opened. They go to the instance
|
|
99152
99160
|
that opened the session, and it loads again when it has to
|
|
@@ -99344,6 +99352,89 @@ function deleteAppInstances(appId) {
|
|
|
99344
99352
|
// src/apps/mcp-tools.ts
|
|
99345
99353
|
import fs5 from "node:fs";
|
|
99346
99354
|
|
|
99355
|
+
// src/apps/app-sessions.ts
|
|
99356
|
+
import path7 from "node:path";
|
|
99357
|
+
|
|
99358
|
+
// src/sidecar/transcript-locator.ts
|
|
99359
|
+
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
99360
|
+
import { homedir as homedir3 } from "node:os";
|
|
99361
|
+
import { join as join2 } from "node:path";
|
|
99362
|
+
function claudeConfigDir() {
|
|
99363
|
+
return process.env.CLAUDE_CONFIG_DIR || join2(homedir3(), ".claude");
|
|
99364
|
+
}
|
|
99365
|
+
function codexHome() {
|
|
99366
|
+
return process.env.CODEX_HOME || join2(homedir3(), ".codex");
|
|
99367
|
+
}
|
|
99368
|
+
function encodeClaudeProjectDir(cwd) {
|
|
99369
|
+
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
99370
|
+
}
|
|
99371
|
+
function listDir(dir) {
|
|
99372
|
+
try {
|
|
99373
|
+
return readdirSync(dir);
|
|
99374
|
+
} catch {
|
|
99375
|
+
return [];
|
|
99376
|
+
}
|
|
99377
|
+
}
|
|
99378
|
+
function findClaudeTranscript(externalId, cwd) {
|
|
99379
|
+
const projects = join2(claudeConfigDir(), "projects");
|
|
99380
|
+
const fileName = `${externalId}.jsonl`;
|
|
99381
|
+
if (cwd) {
|
|
99382
|
+
const direct = join2(projects, encodeClaudeProjectDir(cwd), fileName);
|
|
99383
|
+
if (existsSync2(direct)) return direct;
|
|
99384
|
+
}
|
|
99385
|
+
for (const dir of listDir(projects)) {
|
|
99386
|
+
const candidate = join2(projects, dir, fileName);
|
|
99387
|
+
if (existsSync2(candidate)) return candidate;
|
|
99388
|
+
}
|
|
99389
|
+
return null;
|
|
99390
|
+
}
|
|
99391
|
+
function findCodexTranscript(externalId) {
|
|
99392
|
+
const root = join2(codexHome(), "sessions");
|
|
99393
|
+
const suffix = `-${externalId}.jsonl`;
|
|
99394
|
+
const desc = (dir) => listDir(dir).sort().reverse();
|
|
99395
|
+
for (const year of desc(root)) {
|
|
99396
|
+
for (const month of desc(join2(root, year))) {
|
|
99397
|
+
for (const day of desc(join2(root, year, month))) {
|
|
99398
|
+
const dayDir = join2(root, year, month, day);
|
|
99399
|
+
const match = listDir(dayDir).find((f) => f.endsWith(suffix));
|
|
99400
|
+
if (match) return join2(dayDir, match);
|
|
99401
|
+
}
|
|
99402
|
+
}
|
|
99403
|
+
}
|
|
99404
|
+
return null;
|
|
99405
|
+
}
|
|
99406
|
+
function locateTranscript(session) {
|
|
99407
|
+
const externalId = session.external_thread_id;
|
|
99408
|
+
if (!externalId) return null;
|
|
99409
|
+
switch (session.runtime_type) {
|
|
99410
|
+
case "claude":
|
|
99411
|
+
return findClaudeTranscript(externalId, session.cwd);
|
|
99412
|
+
case "codex":
|
|
99413
|
+
return findCodexTranscript(externalId);
|
|
99414
|
+
default:
|
|
99415
|
+
return null;
|
|
99416
|
+
}
|
|
99417
|
+
}
|
|
99418
|
+
var foundTranscripts = /* @__PURE__ */ new Map();
|
|
99419
|
+
var missedTranscripts = /* @__PURE__ */ new Map();
|
|
99420
|
+
var MISS_TTL_MS = 15e3;
|
|
99421
|
+
function locateTranscriptCached(session) {
|
|
99422
|
+
const externalId = session.external_thread_id;
|
|
99423
|
+
const home = session.runtime_type === "claude" ? claudeConfigDir() : session.runtime_type === "codex" ? codexHome() : null;
|
|
99424
|
+
if (!externalId || !home) return null;
|
|
99425
|
+
const key = `${session.runtime_type}\0${home}\0${externalId}`;
|
|
99426
|
+
const known = foundTranscripts.get(key);
|
|
99427
|
+
if (known && existsSync2(known)) return known;
|
|
99428
|
+
foundTranscripts.delete(key);
|
|
99429
|
+
const missUntil = missedTranscripts.get(key);
|
|
99430
|
+
if (missUntil !== void 0 && missUntil > Date.now()) return null;
|
|
99431
|
+
missedTranscripts.delete(key);
|
|
99432
|
+
const found = locateTranscript(session);
|
|
99433
|
+
if (found) foundTranscripts.set(key, found);
|
|
99434
|
+
else missedTranscripts.set(key, Date.now() + MISS_TTL_MS);
|
|
99435
|
+
return found;
|
|
99436
|
+
}
|
|
99437
|
+
|
|
99347
99438
|
// src/apps/app-files.ts
|
|
99348
99439
|
import crypto2 from "node:crypto";
|
|
99349
99440
|
import fs4 from "node:fs";
|
|
@@ -99589,6 +99680,60 @@ function appSessionInfo(appId, sessionId) {
|
|
|
99589
99680
|
} : null
|
|
99590
99681
|
};
|
|
99591
99682
|
}
|
|
99683
|
+
function sessionVisibleTo(session, appId, workspace) {
|
|
99684
|
+
if (!workspace) return true;
|
|
99685
|
+
const cwd = session.cwd;
|
|
99686
|
+
if (cwd && (cwd === workspace || cwd.startsWith(workspace.endsWith(path7.sep) ? workspace : workspace + path7.sep))) {
|
|
99687
|
+
return true;
|
|
99688
|
+
}
|
|
99689
|
+
return session.origin_app_workspace === workspace && openedByApp(session, appId);
|
|
99690
|
+
}
|
|
99691
|
+
function sessionSummary(session, appId) {
|
|
99692
|
+
return {
|
|
99693
|
+
id: session.id,
|
|
99694
|
+
title: session.title,
|
|
99695
|
+
cwd: session.cwd,
|
|
99696
|
+
runtime_type: session.runtime_type,
|
|
99697
|
+
model: session.model,
|
|
99698
|
+
model_reasoning_effort: session.model_reasoning_effort,
|
|
99699
|
+
status: session.status,
|
|
99700
|
+
lifecycle: session.lifecycle,
|
|
99701
|
+
running: !!session.is_running,
|
|
99702
|
+
external_thread_id: session.external_thread_id,
|
|
99703
|
+
transcript_path: locateTranscriptCached(session),
|
|
99704
|
+
origin_app_id: session.origin_app_id,
|
|
99705
|
+
app_owned: openedByApp(session, appId),
|
|
99706
|
+
created_at: session.created_at,
|
|
99707
|
+
updated_at: session.updated_at
|
|
99708
|
+
};
|
|
99709
|
+
}
|
|
99710
|
+
function listFilters(opts) {
|
|
99711
|
+
const o = opts && typeof opts === "object" ? opts : {};
|
|
99712
|
+
const filters = {};
|
|
99713
|
+
if (o.lifecycle === "working" || o.lifecycle === "finished") filters.lifecycle = o.lifecycle;
|
|
99714
|
+
if (typeof o.running === "boolean") filters.running = o.running;
|
|
99715
|
+
return filters;
|
|
99716
|
+
}
|
|
99717
|
+
function listAppVisibleSessions(appId, workspace, opts) {
|
|
99718
|
+
const { lifecycle, running } = listFilters(opts);
|
|
99719
|
+
const where = [];
|
|
99720
|
+
const params = [];
|
|
99721
|
+
if (lifecycle) {
|
|
99722
|
+
where.push("lifecycle = ?");
|
|
99723
|
+
params.push(lifecycle);
|
|
99724
|
+
}
|
|
99725
|
+
if (running !== void 0) where.push(running ? "is_running = 1" : "is_running = 0");
|
|
99726
|
+
const rows = getDb().prepare(
|
|
99727
|
+
`SELECT * FROM sessions ${where.length ? `WHERE ${where.join(" AND ")}` : ""}
|
|
99728
|
+
ORDER BY created_at DESC, rowid DESC`
|
|
99729
|
+
).all(...params);
|
|
99730
|
+
return rows.filter((row) => sessionVisibleTo(row, appId, workspace)).map((row) => sessionSummary(row, appId));
|
|
99731
|
+
}
|
|
99732
|
+
function appSessionSummary(appId, workspace, sessionId) {
|
|
99733
|
+
const session = getDb().prepare("SELECT * FROM sessions WHERE id = ?").get(String(sessionId));
|
|
99734
|
+
if (!session || !sessionVisibleTo(session, appId, workspace)) return null;
|
|
99735
|
+
return sessionSummary(session, appId);
|
|
99736
|
+
}
|
|
99592
99737
|
function ownSession(appId, sessionId, api) {
|
|
99593
99738
|
const session = getDb().prepare("SELECT * FROM sessions WHERE id = ?").get(String(sessionId));
|
|
99594
99739
|
if (!session || !openedByApp(session, appId)) {
|
|
@@ -99633,7 +99778,7 @@ import vm2 from "node:vm";
|
|
|
99633
99778
|
|
|
99634
99779
|
// src/apps/app-compile.ts
|
|
99635
99780
|
import vm from "node:vm";
|
|
99636
|
-
import
|
|
99781
|
+
import path8 from "node:path";
|
|
99637
99782
|
import ts from "typescript";
|
|
99638
99783
|
|
|
99639
99784
|
// src/apps/app-lint.ts
|
|
@@ -99784,6 +99929,40 @@ interface AgentPaneSessionState {
|
|
|
99784
99929
|
resumeState: string | null;
|
|
99785
99930
|
} | null;
|
|
99786
99931
|
}
|
|
99932
|
+
/** A session the app can read (listSessions, getSessionInfo): any session of
|
|
99933
|
+
* this instance's workspace and below, every session for the global
|
|
99934
|
+
* instance, plus the ones this app opened. Read only unless app_owned. */
|
|
99935
|
+
interface AgentPaneSessionSummary {
|
|
99936
|
+
id: string;
|
|
99937
|
+
title: string | null;
|
|
99938
|
+
cwd: string | null;
|
|
99939
|
+
/** "claude" | "codex" | "repoburg" | ... */
|
|
99940
|
+
runtime_type: string;
|
|
99941
|
+
model: string | null;
|
|
99942
|
+
model_reasoning_effort: string | null;
|
|
99943
|
+
status: string;
|
|
99944
|
+
/** "working" | "finished": the user's open/done mark in the sidebar. */
|
|
99945
|
+
lifecycle: string;
|
|
99946
|
+
/** A turn is live, also one waiting to continue after an interruption. */
|
|
99947
|
+
running: boolean;
|
|
99948
|
+
/** The runtime's own session id (Claude Code session id, Codex thread id);
|
|
99949
|
+
* null before the first turn. */
|
|
99950
|
+
external_thread_id: string | null;
|
|
99951
|
+
/** Absolute path of the runtime's JSONL transcript; null when there is none
|
|
99952
|
+
* (repoburg, no turn yet, file missing). */
|
|
99953
|
+
transcript_path: string | null;
|
|
99954
|
+
/** Mini app that opened the session; null = the user. */
|
|
99955
|
+
origin_app_id: string | null;
|
|
99956
|
+
/** This app opened it with createSession: submitTurn, cancelTurn and
|
|
99957
|
+
* setSessionLifecycle work on it, and on no other session. */
|
|
99958
|
+
app_owned: boolean;
|
|
99959
|
+
created_at: string;
|
|
99960
|
+
updated_at: string;
|
|
99961
|
+
}
|
|
99962
|
+
interface AgentPaneListSessionsOptions {
|
|
99963
|
+
lifecycle?: 'working' | 'finished';
|
|
99964
|
+
running?: boolean;
|
|
99965
|
+
}
|
|
99787
99966
|
/** A file the app stored with uploadFile (PNG, JPEG, GIF or WebP, max 5 MB). */
|
|
99788
99967
|
interface AgentPaneFile {
|
|
99789
99968
|
/** Content id "<sha256>.<ext>": the same bytes always get the same id. */
|
|
@@ -99819,10 +99998,17 @@ declare const AgentPane: {
|
|
|
99819
99998
|
* overwriting a newer copy. */
|
|
99820
99999
|
setState(data: Record<string, unknown> | null, opts?: AgentPaneSetStateOptions): Promise<AgentPaneState>;
|
|
99821
100000
|
createSession(opts?: AgentPaneCreateSessionOptions): Promise<AgentPaneSessionInfo>;
|
|
99822
|
-
/** Send a prompt to
|
|
100001
|
+
/** Send a prompt to one of this app's sessions; opts.attachments go with it
|
|
100002
|
+
* (the agent sees images). Rejects for any other session. */
|
|
99823
100003
|
submitTurn(sessionId: string, prompt: string, opts?: AgentPaneSubmitTurnOptions): Promise<unknown>;
|
|
99824
100004
|
/** One of this app's sessions, null for any other id. Works headless too. */
|
|
99825
100005
|
getSession(sessionId: string): Promise<AgentPaneSessionState | null>;
|
|
100006
|
+
/** Sessions this instance can see, newest first: its workspace and below
|
|
100007
|
+
* (every session for the global instance), plus the ones this app opened.
|
|
100008
|
+
* Read only; works headless too. */
|
|
100009
|
+
listSessions(opts?: AgentPaneListSessionsOptions): Promise<AgentPaneSessionSummary[]>;
|
|
100010
|
+
/** One session listSessions would show, null for any other id. */
|
|
100011
|
+
getSessionInfo(sessionId: string): Promise<AgentPaneSessionSummary | null>;
|
|
99826
100012
|
/** Stop the running main turn of one of this app's sessions; cancelled is
|
|
99827
100013
|
* false when none runs. Rejects for any other session. */
|
|
99828
100014
|
cancelTurn(sessionId: string): Promise<{ cancelled: boolean }>;
|
|
@@ -99989,15 +100175,15 @@ function typeCheckModules(appId, modules) {
|
|
|
99989
100175
|
};
|
|
99990
100176
|
const host = ts.createCompilerHost(options);
|
|
99991
100177
|
const origReadFile = host.readFile.bind(host);
|
|
99992
|
-
host.readFile = (fname) =>
|
|
100178
|
+
host.readFile = (fname) => path8.basename(fname) === BRIDGE_DTS_FILE ? BRIDGE_DTS : origReadFile(fname);
|
|
99993
100179
|
host.writeFile = () => {
|
|
99994
100180
|
};
|
|
99995
|
-
const bridgePath =
|
|
99996
|
-
const rootNames = [...modules.map((m) =>
|
|
100181
|
+
const bridgePath = path8.join(dir, BRIDGE_DTS_FILE);
|
|
100182
|
+
const rootNames = [...modules.map((m) => path8.join(dir, m.file)), bridgePath];
|
|
99997
100183
|
const program = ts.createProgram(rootNames, options, host);
|
|
99998
100184
|
const out = [];
|
|
99999
100185
|
for (const mod of modules) {
|
|
100000
|
-
const sf = program.getSourceFile(
|
|
100186
|
+
const sf = program.getSourceFile(path8.join(dir, mod.file));
|
|
100001
100187
|
if (!sf) continue;
|
|
100002
100188
|
out.push(
|
|
100003
100189
|
...[...program.getSyntacticDiagnostics(sf), ...program.getSemanticDiagnostics(sf)].map((d) => tsDiagnosticToFile(mod.file, d)).filter((d) => d !== null)
|
|
@@ -100192,6 +100378,10 @@ function loadRuntime(appId, workspace) {
|
|
|
100192
100378
|
}
|
|
100193
100379
|
}),
|
|
100194
100380
|
getSession: (sessionId) => answer(() => appSessionInfo(appId, sessionId)),
|
|
100381
|
+
// Read only, so no headlessSessions needed: any session of the instance's
|
|
100382
|
+
// workspace, not just the app's own.
|
|
100383
|
+
listSessions: (opts) => answer(() => listAppVisibleSessions(appId, workspace, opts)),
|
|
100384
|
+
getSessionInfo: (sessionId) => answer(() => appSessionSummary(appId, workspace, sessionId)),
|
|
100195
100385
|
createSession: (opts) => answer(() => {
|
|
100196
100386
|
requireHeadlessSessions("createSession");
|
|
100197
100387
|
return createAppSession(appId, workspace, opts);
|
|
@@ -100513,7 +100703,7 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
100513
100703
|
try {
|
|
100514
100704
|
for (const entry of fs6.readdirSync(exRoot, { withFileTypes: true })) {
|
|
100515
100705
|
if (!entry.isDirectory() || !APP_ID_RE.test(entry.name)) continue;
|
|
100516
|
-
const manifest = readManifestIn(
|
|
100706
|
+
const manifest = readManifestIn(path9.join(exRoot, entry.name));
|
|
100517
100707
|
if (!manifest) continue;
|
|
100518
100708
|
out.push({
|
|
100519
100709
|
id: entry.name,
|
|
@@ -100534,7 +100724,7 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
100534
100724
|
if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
|
|
100535
100725
|
const exRoot = examplesRoot();
|
|
100536
100726
|
if (!exRoot) return reply.code(404).send({ error: "Examples catalog not available" });
|
|
100537
|
-
const src =
|
|
100727
|
+
const src = path9.join(exRoot, id);
|
|
100538
100728
|
if (!readManifestIn(src)) return reply.code(404).send({ error: "Example not found" });
|
|
100539
100729
|
if (readManifest(id)) return reply.code(409).send({ error: "App already installed" });
|
|
100540
100730
|
ensureAppsRoot();
|
|
@@ -100573,7 +100763,7 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
100573
100763
|
fs6.mkdirSync(dir, { recursive: true });
|
|
100574
100764
|
const cleanTitle2 = title.trim();
|
|
100575
100765
|
fs6.writeFileSync(
|
|
100576
|
-
|
|
100766
|
+
path9.join(dir, "manifest.json"),
|
|
100577
100767
|
JSON.stringify(
|
|
100578
100768
|
{
|
|
100579
100769
|
title: cleanTitle2,
|
|
@@ -100584,8 +100774,8 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
100584
100774
|
2
|
|
100585
100775
|
)
|
|
100586
100776
|
);
|
|
100587
|
-
fs6.writeFileSync(
|
|
100588
|
-
fs6.writeFileSync(
|
|
100777
|
+
fs6.writeFileSync(path9.join(dir, "index.html"), SKELETON_HTML.replaceAll("__TITLE__", cleanTitle2));
|
|
100778
|
+
fs6.writeFileSync(path9.join(dir, "app.ts"), SKELETON_TS);
|
|
100589
100779
|
return { ok: true, id };
|
|
100590
100780
|
}
|
|
100591
100781
|
);
|
|
@@ -100622,9 +100812,9 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
100622
100812
|
const dir = appDir(id);
|
|
100623
100813
|
fs6.mkdirSync(dir, { recursive: true });
|
|
100624
100814
|
if (!Object.hasOwn(files ?? {}, "manifest.json")) {
|
|
100625
|
-
fs6.writeFileSync(
|
|
100815
|
+
fs6.writeFileSync(path9.join(dir, "manifest.json"), JSON.stringify({ title: id }, null, 2));
|
|
100626
100816
|
}
|
|
100627
|
-
for (const [name, content] of entries) fs6.writeFileSync(
|
|
100817
|
+
for (const [name, content] of entries) fs6.writeFileSync(path9.join(dir, name), content);
|
|
100628
100818
|
return { ok: true, id };
|
|
100629
100819
|
}
|
|
100630
100820
|
);
|
|
@@ -100811,6 +101001,40 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
100811
101001
|
return session;
|
|
100812
101002
|
}
|
|
100813
101003
|
);
|
|
101004
|
+
fastify.get(
|
|
101005
|
+
"/api/apps/:id/workspace-sessions",
|
|
101006
|
+
{
|
|
101007
|
+
schema: {
|
|
101008
|
+
querystring: {
|
|
101009
|
+
type: "object",
|
|
101010
|
+
properties: {
|
|
101011
|
+
workspace: { type: "string" },
|
|
101012
|
+
lifecycle: { type: "string", enum: ["working", "finished"] },
|
|
101013
|
+
running: { type: "boolean" }
|
|
101014
|
+
}
|
|
101015
|
+
}
|
|
101016
|
+
}
|
|
101017
|
+
},
|
|
101018
|
+
async (request, reply) => {
|
|
101019
|
+
const { id } = request.params;
|
|
101020
|
+
if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
|
|
101021
|
+
if (!readManifest(id)) return reply.code(404).send({ error: "App not found" });
|
|
101022
|
+
const { workspace = "", lifecycle, running } = request.query ?? {};
|
|
101023
|
+
return listAppVisibleSessions(id, workspace, { lifecycle, running });
|
|
101024
|
+
}
|
|
101025
|
+
);
|
|
101026
|
+
fastify.get(
|
|
101027
|
+
"/api/apps/:id/workspace-sessions/:sessionId",
|
|
101028
|
+
{ schema: { querystring: { type: "object", properties: { workspace: { type: "string" } } } } },
|
|
101029
|
+
async (request, reply) => {
|
|
101030
|
+
const { id, sessionId } = request.params;
|
|
101031
|
+
if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
|
|
101032
|
+
if (!readManifest(id)) return reply.code(404).send({ error: "App not found" });
|
|
101033
|
+
const session = appSessionSummary(id, request.query?.workspace ?? "", sessionId);
|
|
101034
|
+
if (!session) return reply.code(404).send({ error: "Session not found" });
|
|
101035
|
+
return session;
|
|
101036
|
+
}
|
|
101037
|
+
);
|
|
100814
101038
|
fastify.post(
|
|
100815
101039
|
"/api/apps/:id/sessions/:sessionId/cancel",
|
|
100816
101040
|
async (request, reply) => {
|
|
@@ -100891,67 +101115,6 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
100891
101115
|
);
|
|
100892
101116
|
}
|
|
100893
101117
|
|
|
100894
|
-
// src/sidecar/transcript-locator.ts
|
|
100895
|
-
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
100896
|
-
import { homedir as homedir3 } from "node:os";
|
|
100897
|
-
import { join as join2 } from "node:path";
|
|
100898
|
-
function claudeConfigDir() {
|
|
100899
|
-
return process.env.CLAUDE_CONFIG_DIR || join2(homedir3(), ".claude");
|
|
100900
|
-
}
|
|
100901
|
-
function codexHome() {
|
|
100902
|
-
return process.env.CODEX_HOME || join2(homedir3(), ".codex");
|
|
100903
|
-
}
|
|
100904
|
-
function encodeClaudeProjectDir(cwd) {
|
|
100905
|
-
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
100906
|
-
}
|
|
100907
|
-
function listDir(dir) {
|
|
100908
|
-
try {
|
|
100909
|
-
return readdirSync(dir);
|
|
100910
|
-
} catch {
|
|
100911
|
-
return [];
|
|
100912
|
-
}
|
|
100913
|
-
}
|
|
100914
|
-
function findClaudeTranscript(externalId, cwd) {
|
|
100915
|
-
const projects = join2(claudeConfigDir(), "projects");
|
|
100916
|
-
const fileName = `${externalId}.jsonl`;
|
|
100917
|
-
if (cwd) {
|
|
100918
|
-
const direct = join2(projects, encodeClaudeProjectDir(cwd), fileName);
|
|
100919
|
-
if (existsSync2(direct)) return direct;
|
|
100920
|
-
}
|
|
100921
|
-
for (const dir of listDir(projects)) {
|
|
100922
|
-
const candidate = join2(projects, dir, fileName);
|
|
100923
|
-
if (existsSync2(candidate)) return candidate;
|
|
100924
|
-
}
|
|
100925
|
-
return null;
|
|
100926
|
-
}
|
|
100927
|
-
function findCodexTranscript(externalId) {
|
|
100928
|
-
const root = join2(codexHome(), "sessions");
|
|
100929
|
-
const suffix = `-${externalId}.jsonl`;
|
|
100930
|
-
const desc = (dir) => listDir(dir).sort().reverse();
|
|
100931
|
-
for (const year of desc(root)) {
|
|
100932
|
-
for (const month of desc(join2(root, year))) {
|
|
100933
|
-
for (const day of desc(join2(root, year, month))) {
|
|
100934
|
-
const dayDir = join2(root, year, month, day);
|
|
100935
|
-
const match = listDir(dayDir).find((f) => f.endsWith(suffix));
|
|
100936
|
-
if (match) return join2(dayDir, match);
|
|
100937
|
-
}
|
|
100938
|
-
}
|
|
100939
|
-
}
|
|
100940
|
-
return null;
|
|
100941
|
-
}
|
|
100942
|
-
function locateTranscript(session) {
|
|
100943
|
-
const externalId = session.external_thread_id;
|
|
100944
|
-
if (!externalId) return null;
|
|
100945
|
-
switch (session.runtime_type) {
|
|
100946
|
-
case "claude":
|
|
100947
|
-
return findClaudeTranscript(externalId, session.cwd);
|
|
100948
|
-
case "codex":
|
|
100949
|
-
return findCodexTranscript(externalId);
|
|
100950
|
-
default:
|
|
100951
|
-
return null;
|
|
100952
|
-
}
|
|
100953
|
-
}
|
|
100954
|
-
|
|
100955
101118
|
// src/sidecar/prompt.ts
|
|
100956
101119
|
var SIDECAR_QUESTION_MARKER = "Understand the user's question below, read the session file given above, and answer.";
|
|
100957
101120
|
function buildSidecarPrompt(externalSessionId, transcriptPath, question) {
|
|
@@ -101345,7 +101508,7 @@ async function registerUsageRoutes(fastify) {
|
|
|
101345
101508
|
|
|
101346
101509
|
// src/claude/session-import.ts
|
|
101347
101510
|
import { readFile as readFile2, realpath } from "node:fs/promises";
|
|
101348
|
-
import
|
|
101511
|
+
import path10 from "node:path";
|
|
101349
101512
|
import { getSessionInfo, listSessions } from "@anthropic-ai/claude-agent-sdk";
|
|
101350
101513
|
|
|
101351
101514
|
// src/claude/widget-tool.ts
|
|
@@ -102117,10 +102280,10 @@ function mergeDefs(...defs) {
|
|
|
102117
102280
|
function cloneDef(schema) {
|
|
102118
102281
|
return mergeDefs(schema._zod.def);
|
|
102119
102282
|
}
|
|
102120
|
-
function getElementAtPath(obj,
|
|
102121
|
-
if (!
|
|
102283
|
+
function getElementAtPath(obj, path13) {
|
|
102284
|
+
if (!path13)
|
|
102122
102285
|
return obj;
|
|
102123
|
-
return
|
|
102286
|
+
return path13.reduce((acc, key) => acc?.[key], obj);
|
|
102124
102287
|
}
|
|
102125
102288
|
function promiseAllObject(promisesObj) {
|
|
102126
102289
|
const keys = Object.keys(promisesObj);
|
|
@@ -102529,11 +102692,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
102529
102692
|
}
|
|
102530
102693
|
return false;
|
|
102531
102694
|
}
|
|
102532
|
-
function prefixIssues(
|
|
102695
|
+
function prefixIssues(path13, issues) {
|
|
102533
102696
|
return issues.map((iss) => {
|
|
102534
102697
|
var _a3;
|
|
102535
102698
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
102536
|
-
iss.path.unshift(
|
|
102699
|
+
iss.path.unshift(path13);
|
|
102537
102700
|
return iss;
|
|
102538
102701
|
});
|
|
102539
102702
|
}
|
|
@@ -102680,16 +102843,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
102680
102843
|
}
|
|
102681
102844
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
102682
102845
|
const fieldErrors = { _errors: [] };
|
|
102683
|
-
const processError = (error52,
|
|
102846
|
+
const processError = (error52, path13 = []) => {
|
|
102684
102847
|
for (const issue2 of error52.issues) {
|
|
102685
102848
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
102686
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
102849
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
102687
102850
|
} else if (issue2.code === "invalid_key") {
|
|
102688
|
-
processError({ issues: issue2.issues }, [...
|
|
102851
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
102689
102852
|
} else if (issue2.code === "invalid_element") {
|
|
102690
|
-
processError({ issues: issue2.issues }, [...
|
|
102853
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
102691
102854
|
} else {
|
|
102692
|
-
const fullpath = [...
|
|
102855
|
+
const fullpath = [...path13, ...issue2.path];
|
|
102693
102856
|
if (fullpath.length === 0) {
|
|
102694
102857
|
fieldErrors._errors.push(mapper(issue2));
|
|
102695
102858
|
} else {
|
|
@@ -102716,17 +102879,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
102716
102879
|
}
|
|
102717
102880
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
102718
102881
|
const result = { errors: [] };
|
|
102719
|
-
const processError = (error52,
|
|
102882
|
+
const processError = (error52, path13 = []) => {
|
|
102720
102883
|
var _a3, _b;
|
|
102721
102884
|
for (const issue2 of error52.issues) {
|
|
102722
102885
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
102723
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
102886
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
102724
102887
|
} else if (issue2.code === "invalid_key") {
|
|
102725
|
-
processError({ issues: issue2.issues }, [...
|
|
102888
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
102726
102889
|
} else if (issue2.code === "invalid_element") {
|
|
102727
|
-
processError({ issues: issue2.issues }, [...
|
|
102890
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
102728
102891
|
} else {
|
|
102729
|
-
const fullpath = [...
|
|
102892
|
+
const fullpath = [...path13, ...issue2.path];
|
|
102730
102893
|
if (fullpath.length === 0) {
|
|
102731
102894
|
result.errors.push(mapper(issue2));
|
|
102732
102895
|
continue;
|
|
@@ -102758,8 +102921,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
102758
102921
|
}
|
|
102759
102922
|
function toDotPath(_path) {
|
|
102760
102923
|
const segs = [];
|
|
102761
|
-
const
|
|
102762
|
-
for (const seg of
|
|
102924
|
+
const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
102925
|
+
for (const seg of path13) {
|
|
102763
102926
|
if (typeof seg === "number")
|
|
102764
102927
|
segs.push(`[${seg}]`);
|
|
102765
102928
|
else if (typeof seg === "symbol")
|
|
@@ -115451,13 +115614,13 @@ function resolveRef(ref, ctx) {
|
|
|
115451
115614
|
if (!ref.startsWith("#")) {
|
|
115452
115615
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
115453
115616
|
}
|
|
115454
|
-
const
|
|
115455
|
-
if (
|
|
115617
|
+
const path13 = ref.slice(1).split("/").filter(Boolean);
|
|
115618
|
+
if (path13.length === 0) {
|
|
115456
115619
|
return ctx.rootSchema;
|
|
115457
115620
|
}
|
|
115458
115621
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
115459
|
-
if (
|
|
115460
|
-
const key =
|
|
115622
|
+
if (path13[0] === defsKey) {
|
|
115623
|
+
const key = path13[1];
|
|
115461
115624
|
if (!key || !ctx.defs[key]) {
|
|
115462
115625
|
throw new Error(`Reference not found: ${ref}`);
|
|
115463
115626
|
}
|
|
@@ -116003,9 +116166,9 @@ function mapToolUse(block) {
|
|
|
116003
116166
|
};
|
|
116004
116167
|
}
|
|
116005
116168
|
function deriveFileChangeData(input, toolName) {
|
|
116006
|
-
const
|
|
116169
|
+
const path13 = input.file_path ?? input.notebook_path ?? "";
|
|
116007
116170
|
const kind = toolName === "Write" ? "add" : "modify";
|
|
116008
|
-
return { changes: [{ path:
|
|
116171
|
+
return { changes: [{ path: path13, kind }], status: "in_progress" };
|
|
116009
116172
|
}
|
|
116010
116173
|
function extractToolResultText(content) {
|
|
116011
116174
|
if (!content) return "";
|
|
@@ -116370,7 +116533,7 @@ async function realDir(dir) {
|
|
|
116370
116533
|
}
|
|
116371
116534
|
}
|
|
116372
116535
|
async function sameDir(a, realB) {
|
|
116373
|
-
const realA = await realDir(a) ??
|
|
116536
|
+
const realA = await realDir(a) ?? path10.resolve(a);
|
|
116374
116537
|
return realA === realB;
|
|
116375
116538
|
}
|
|
116376
116539
|
function knownClaudeSessionIds(db2) {
|
|
@@ -116606,18 +116769,18 @@ function mapTokenUsage(data) {
|
|
|
116606
116769
|
|
|
116607
116770
|
// src/apps/register-mcp.ts
|
|
116608
116771
|
import fs7 from "node:fs";
|
|
116609
|
-
import
|
|
116772
|
+
import path11 from "node:path";
|
|
116610
116773
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
116611
116774
|
var MCP_SERVER_NAME = "agentpane-miniapps";
|
|
116612
116775
|
function panePublicUrl() {
|
|
116613
116776
|
return (process.env.AGENT_PANE_PUBLIC_URL || process.env.REPOBURG_DAEMON_URL || "http://localhost:9998").replace(/\/+$/, "");
|
|
116614
116777
|
}
|
|
116615
116778
|
function stdioScriptPath() {
|
|
116616
|
-
const here =
|
|
116779
|
+
const here = path11.dirname(fileURLToPath2(import.meta.url));
|
|
116617
116780
|
const candidates = [
|
|
116618
|
-
|
|
116781
|
+
path11.resolve(here, "../../scripts/miniapp-mcp-stdio.mjs"),
|
|
116619
116782
|
// src/apps/ → backend/scripts
|
|
116620
|
-
|
|
116783
|
+
path11.resolve(here, "../scripts/miniapp-mcp-stdio.mjs")
|
|
116621
116784
|
// dist bundle → backend/scripts
|
|
116622
116785
|
];
|
|
116623
116786
|
for (const candidate of candidates) {
|
|
@@ -119341,8 +119504,8 @@ var RepoburgHttpClient = class {
|
|
|
119341
119504
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
119342
119505
|
}
|
|
119343
119506
|
/** Perform a JSON request. Throws a concise error on non-OK/non-JSON responses. */
|
|
119344
|
-
async request(method,
|
|
119345
|
-
const response = await fetch(`${this.baseUrl}${
|
|
119507
|
+
async request(method, path13, body) {
|
|
119508
|
+
const response = await fetch(`${this.baseUrl}${path13}`, {
|
|
119346
119509
|
method,
|
|
119347
119510
|
headers: { "Content-Type": "application/json" },
|
|
119348
119511
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
@@ -119351,17 +119514,17 @@ var RepoburgHttpClient = class {
|
|
|
119351
119514
|
if (!response.ok) {
|
|
119352
119515
|
if (isHtml(text2)) {
|
|
119353
119516
|
throw new Error(
|
|
119354
|
-
`${method} ${
|
|
119517
|
+
`${method} ${path13} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
|
|
119355
119518
|
);
|
|
119356
119519
|
}
|
|
119357
|
-
throw new Error(`${method} ${
|
|
119520
|
+
throw new Error(`${method} ${path13} failed: ${response.status} ${text2}`);
|
|
119358
119521
|
}
|
|
119359
119522
|
if (text2.length === 0) return void 0;
|
|
119360
119523
|
try {
|
|
119361
119524
|
return JSON.parse(text2);
|
|
119362
119525
|
} catch {
|
|
119363
119526
|
throw new Error(
|
|
119364
|
-
`${method} ${
|
|
119527
|
+
`${method} ${path13} failed: non-JSON response from ${this.baseUrl} \u2014 the URL points to the wrong server`
|
|
119365
119528
|
);
|
|
119366
119529
|
}
|
|
119367
119530
|
}
|
|
@@ -119416,7 +119579,7 @@ var RepoburgHttpClient = class {
|
|
|
119416
119579
|
};
|
|
119417
119580
|
|
|
119418
119581
|
// src/repoburg/backend-resolver.ts
|
|
119419
|
-
import
|
|
119582
|
+
import path12 from "node:path";
|
|
119420
119583
|
var HEALTH_POLL_INTERVAL_MS = 1e3;
|
|
119421
119584
|
var HEALTH_TIMEOUT_MS = 3e4;
|
|
119422
119585
|
function daemonBaseUrl() {
|
|
@@ -119471,7 +119634,7 @@ async function backendHealthy(baseUrl, expectedPath) {
|
|
|
119471
119634
|
const health = await fetchJson(`${baseUrl}/health`, void 0, 2e3);
|
|
119472
119635
|
if (health.status !== "ok") return false;
|
|
119473
119636
|
if (expectedPath && health.projectPath) {
|
|
119474
|
-
return
|
|
119637
|
+
return path12.resolve(health.projectPath) === path12.resolve(expectedPath);
|
|
119475
119638
|
}
|
|
119476
119639
|
return true;
|
|
119477
119640
|
} catch {
|
|
@@ -119492,7 +119655,7 @@ function serviceBaseUrl(service) {
|
|
|
119492
119655
|
return `http://localhost:${service.port}`;
|
|
119493
119656
|
}
|
|
119494
119657
|
function coveringService(services, absPath) {
|
|
119495
|
-
return services.filter((s) => absPath === s.path || absPath.startsWith(s.path +
|
|
119658
|
+
return services.filter((s) => absPath === s.path || absPath.startsWith(s.path + path12.sep)).sort((a, b) => b.path.length - a.path.length)[0];
|
|
119496
119659
|
}
|
|
119497
119660
|
async function restartService(daemon, name) {
|
|
119498
119661
|
try {
|
|
@@ -119528,7 +119691,7 @@ async function resolveBackendUrl(projectPath, opts = {}) {
|
|
|
119528
119691
|
if (envUrl) {
|
|
119529
119692
|
return { baseUrl: envUrl.replace(/\/+$/, ""), port: 0, name: "REPOBURG_BACKEND_URL" };
|
|
119530
119693
|
}
|
|
119531
|
-
const absPath =
|
|
119694
|
+
const absPath = path12.resolve(projectPath);
|
|
119532
119695
|
const daemon = daemonBaseUrl();
|
|
119533
119696
|
const cached2 = resolvedCache.get(absPath);
|
|
119534
119697
|
if (cached2 && await backendHealthy(cached2.baseUrl, cached2.servesPath ?? absPath)) {
|