repoburg 1.3.243 → 1.3.245
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 +368 -256
- package/agent-pane/backend/dist/server.js +368 -256
- package/agent-pane/frontend/dist/assets/{index-KcwodzRz.js → index-CBTsbWig.js} +42 -42
- package/agent-pane/frontend/dist/assets/{index-DUnfaPeK.css → index-DNe6bagG.css} +1 -1
- package/agent-pane/frontend/dist/index.html +2 -2
- package/backend/.env +1 -0
- package/backend/section-modified.txt +1 -0
- package/daemon/dist/index.js +0 -0
- package/deleted.txt +1 -0
- package/miniapp-catalog-modal.png +0 -0
- package/miniapp-daemon-e2e-green.png +0 -0
- package/miniapp-faz31-codex-green.png +0 -0
- package/miniapp-pr-review-green.png +0 -0
- package/miniapp-typesafe-verified.png +0 -0
- package/miniapp-workspace-scoped.png +0 -0
- package/modified.txt +1 -0
- package/package.json +1 -1
- package/test-modified.txt +1 -0
- package/visual-editor-proxy/client/dist/main.js +89 -0
- package/visual-editor-proxy/dist/client/src/inspector.d.ts +9 -0
- package/visual-editor-proxy/dist/client/src/inspector.js +96 -0
- package/visual-editor-proxy/dist/client/src/inspector.js.map +1 -0
- package/visual-editor-proxy/dist/client/src/main.d.ts +6 -0
- package/visual-editor-proxy/dist/client/src/main.js +108 -0
- package/visual-editor-proxy/dist/client/src/main.js.map +1 -0
- package/visual-editor-proxy/dist/client/src/ui.d.ts +6 -0
- package/visual-editor-proxy/dist/client/src/ui.js +153 -0
- package/visual-editor-proxy/dist/client/src/ui.js.map +1 -0
- package/visual-editor-proxy/dist/src/main.d.ts +1 -0
- package/visual-editor-proxy/dist/src/main.js +61 -0
- package/visual-editor-proxy/dist/src/main.js.map +1 -0
- package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +1 -0
- package/vscode-serve-web-test.png +0 -0
|
@@ -6124,8 +6124,8 @@ var require_req = __commonJS({
|
|
|
6124
6124
|
if (req.originalUrl) {
|
|
6125
6125
|
_req.url = req.originalUrl;
|
|
6126
6126
|
} else {
|
|
6127
|
-
const
|
|
6128
|
-
_req.url = typeof
|
|
6127
|
+
const path9 = req.path;
|
|
6128
|
+
_req.url = typeof path9 === "string" ? path9 : req.url ? req.url.path || req.url : void 0;
|
|
6129
6129
|
}
|
|
6130
6130
|
if (req.query) {
|
|
6131
6131
|
_req.query = req.query;
|
|
@@ -6290,14 +6290,14 @@ var require_redact = __commonJS({
|
|
|
6290
6290
|
}
|
|
6291
6291
|
return obj;
|
|
6292
6292
|
}
|
|
6293
|
-
function parsePath(
|
|
6293
|
+
function parsePath(path9) {
|
|
6294
6294
|
const parts = [];
|
|
6295
6295
|
let current = "";
|
|
6296
6296
|
let inBrackets = false;
|
|
6297
6297
|
let inQuotes = false;
|
|
6298
6298
|
let quoteChar = "";
|
|
6299
|
-
for (let i = 0; i <
|
|
6300
|
-
const char =
|
|
6299
|
+
for (let i = 0; i < path9.length; i++) {
|
|
6300
|
+
const char = path9[i];
|
|
6301
6301
|
if (!inBrackets && char === ".") {
|
|
6302
6302
|
if (current) {
|
|
6303
6303
|
parts.push(current);
|
|
@@ -6428,10 +6428,10 @@ var require_redact = __commonJS({
|
|
|
6428
6428
|
return current;
|
|
6429
6429
|
}
|
|
6430
6430
|
function redactPaths(obj, paths, censor, remove = false) {
|
|
6431
|
-
for (const
|
|
6432
|
-
const parts = parsePath(
|
|
6431
|
+
for (const path9 of paths) {
|
|
6432
|
+
const parts = parsePath(path9);
|
|
6433
6433
|
if (parts.includes("*")) {
|
|
6434
|
-
redactWildcardPath(obj, parts, censor,
|
|
6434
|
+
redactWildcardPath(obj, parts, censor, path9, remove);
|
|
6435
6435
|
} else {
|
|
6436
6436
|
if (remove) {
|
|
6437
6437
|
removeKey(obj, parts);
|
|
@@ -6516,8 +6516,8 @@ var require_redact = __commonJS({
|
|
|
6516
6516
|
}
|
|
6517
6517
|
} else {
|
|
6518
6518
|
if (afterWildcard.includes("*")) {
|
|
6519
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
6520
|
-
const fullPath = [...pathArray.slice(0, pathLength), ...
|
|
6519
|
+
const wrappedCensor = typeof censor === "function" ? (value, path9) => {
|
|
6520
|
+
const fullPath = [...pathArray.slice(0, pathLength), ...path9];
|
|
6521
6521
|
return censor(value, fullPath);
|
|
6522
6522
|
} : censor;
|
|
6523
6523
|
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
@@ -6552,8 +6552,8 @@ var require_redact = __commonJS({
|
|
|
6552
6552
|
return null;
|
|
6553
6553
|
}
|
|
6554
6554
|
const pathStructure = /* @__PURE__ */ new Map();
|
|
6555
|
-
for (const
|
|
6556
|
-
const parts = parsePath(
|
|
6555
|
+
for (const path9 of pathsToClone) {
|
|
6556
|
+
const parts = parsePath(path9);
|
|
6557
6557
|
let current = pathStructure;
|
|
6558
6558
|
for (let i = 0; i < parts.length; i++) {
|
|
6559
6559
|
const part = parts[i];
|
|
@@ -6605,24 +6605,24 @@ var require_redact = __commonJS({
|
|
|
6605
6605
|
}
|
|
6606
6606
|
return cloneSelectively(obj, pathStructure);
|
|
6607
6607
|
}
|
|
6608
|
-
function validatePath(
|
|
6609
|
-
if (typeof
|
|
6608
|
+
function validatePath(path9) {
|
|
6609
|
+
if (typeof path9 !== "string") {
|
|
6610
6610
|
throw new Error("Paths must be (non-empty) strings");
|
|
6611
6611
|
}
|
|
6612
|
-
if (
|
|
6612
|
+
if (path9 === "") {
|
|
6613
6613
|
throw new Error("Invalid redaction path ()");
|
|
6614
6614
|
}
|
|
6615
|
-
if (
|
|
6616
|
-
throw new Error(`Invalid redaction path (${
|
|
6615
|
+
if (path9.includes("..")) {
|
|
6616
|
+
throw new Error(`Invalid redaction path (${path9})`);
|
|
6617
6617
|
}
|
|
6618
|
-
if (
|
|
6619
|
-
throw new Error(`Invalid redaction path (${
|
|
6618
|
+
if (path9.includes(",")) {
|
|
6619
|
+
throw new Error(`Invalid redaction path (${path9})`);
|
|
6620
6620
|
}
|
|
6621
6621
|
let bracketCount = 0;
|
|
6622
6622
|
let inQuotes = false;
|
|
6623
6623
|
let quoteChar = "";
|
|
6624
|
-
for (let i = 0; i <
|
|
6625
|
-
const char =
|
|
6624
|
+
for (let i = 0; i < path9.length; i++) {
|
|
6625
|
+
const char = path9[i];
|
|
6626
6626
|
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
6627
6627
|
if (!inQuotes) {
|
|
6628
6628
|
inQuotes = true;
|
|
@@ -6636,20 +6636,20 @@ var require_redact = __commonJS({
|
|
|
6636
6636
|
} else if (char === "]" && !inQuotes) {
|
|
6637
6637
|
bracketCount--;
|
|
6638
6638
|
if (bracketCount < 0) {
|
|
6639
|
-
throw new Error(`Invalid redaction path (${
|
|
6639
|
+
throw new Error(`Invalid redaction path (${path9})`);
|
|
6640
6640
|
}
|
|
6641
6641
|
}
|
|
6642
6642
|
}
|
|
6643
6643
|
if (bracketCount !== 0) {
|
|
6644
|
-
throw new Error(`Invalid redaction path (${
|
|
6644
|
+
throw new Error(`Invalid redaction path (${path9})`);
|
|
6645
6645
|
}
|
|
6646
6646
|
}
|
|
6647
6647
|
function validatePaths(paths) {
|
|
6648
6648
|
if (!Array.isArray(paths)) {
|
|
6649
6649
|
throw new TypeError("paths must be an array");
|
|
6650
6650
|
}
|
|
6651
|
-
for (const
|
|
6652
|
-
validatePath(
|
|
6651
|
+
for (const path9 of paths) {
|
|
6652
|
+
validatePath(path9);
|
|
6653
6653
|
}
|
|
6654
6654
|
}
|
|
6655
6655
|
function slowRedact(options = {}) {
|
|
@@ -6817,8 +6817,8 @@ var require_redaction = __commonJS({
|
|
|
6817
6817
|
if (shape[k] === null) {
|
|
6818
6818
|
o[k] = (value) => topCensor(value, [k]);
|
|
6819
6819
|
} else {
|
|
6820
|
-
const wrappedCensor = typeof censor === "function" ? (value,
|
|
6821
|
-
return censor(value, [k, ...
|
|
6820
|
+
const wrappedCensor = typeof censor === "function" ? (value, path9) => {
|
|
6821
|
+
return censor(value, [k, ...path9]);
|
|
6822
6822
|
} : censor;
|
|
6823
6823
|
o[k] = Redact({
|
|
6824
6824
|
paths: shape[k],
|
|
@@ -7039,7 +7039,7 @@ var require_sonic_boom = __commonJS({
|
|
|
7039
7039
|
var fs6 = __require("fs");
|
|
7040
7040
|
var EventEmitter2 = __require("events");
|
|
7041
7041
|
var inherits = __require("util").inherits;
|
|
7042
|
-
var
|
|
7042
|
+
var path9 = __require("path");
|
|
7043
7043
|
var sleep = require_atomic_sleep();
|
|
7044
7044
|
var assert = __require("assert");
|
|
7045
7045
|
var BUSY_WRITE_TIMEOUT = 100;
|
|
@@ -7093,7 +7093,7 @@ var require_sonic_boom = __commonJS({
|
|
|
7093
7093
|
const mode = sonic.mode;
|
|
7094
7094
|
if (sonic.sync) {
|
|
7095
7095
|
try {
|
|
7096
|
-
if (sonic.mkdir) fs6.mkdirSync(
|
|
7096
|
+
if (sonic.mkdir) fs6.mkdirSync(path9.dirname(file), { recursive: true });
|
|
7097
7097
|
const fd = fs6.openSync(file, flags, mode);
|
|
7098
7098
|
fileOpened(null, fd);
|
|
7099
7099
|
} catch (err) {
|
|
@@ -7101,7 +7101,7 @@ var require_sonic_boom = __commonJS({
|
|
|
7101
7101
|
throw err;
|
|
7102
7102
|
}
|
|
7103
7103
|
} else if (sonic.mkdir) {
|
|
7104
|
-
fs6.mkdir(
|
|
7104
|
+
fs6.mkdir(path9.dirname(file), { recursive: true }, (err) => {
|
|
7105
7105
|
if (err) return fileOpened(err);
|
|
7106
7106
|
fs6.open(file, flags, mode, fileOpened);
|
|
7107
7107
|
});
|
|
@@ -8433,15 +8433,15 @@ var require_transport = __commonJS({
|
|
|
8433
8433
|
if (!unquoted) {
|
|
8434
8434
|
return false;
|
|
8435
8435
|
}
|
|
8436
|
-
let
|
|
8437
|
-
if (
|
|
8436
|
+
let path9 = unquoted;
|
|
8437
|
+
if (path9.startsWith("file://")) {
|
|
8438
8438
|
try {
|
|
8439
|
-
|
|
8439
|
+
path9 = fileURLToPath3(path9);
|
|
8440
8440
|
} catch {
|
|
8441
8441
|
return false;
|
|
8442
8442
|
}
|
|
8443
8443
|
}
|
|
8444
|
-
return isAbsolute(
|
|
8444
|
+
return isAbsolute(path9) && !existsSync2(path9);
|
|
8445
8445
|
}
|
|
8446
8446
|
function stripQuotes(value) {
|
|
8447
8447
|
const first = value[0];
|
|
@@ -17117,8 +17117,8 @@ var require_utils = __commonJS({
|
|
|
17117
17117
|
}
|
|
17118
17118
|
return ind;
|
|
17119
17119
|
}
|
|
17120
|
-
function removeDotSegments(
|
|
17121
|
-
let input =
|
|
17120
|
+
function removeDotSegments(path9) {
|
|
17121
|
+
let input = path9;
|
|
17122
17122
|
const output = [];
|
|
17123
17123
|
let nextSlash = -1;
|
|
17124
17124
|
let len = 0;
|
|
@@ -17370,8 +17370,8 @@ var require_schemes = __commonJS({
|
|
|
17370
17370
|
wsComponent.secure = void 0;
|
|
17371
17371
|
}
|
|
17372
17372
|
if (wsComponent.resourceName) {
|
|
17373
|
-
const [
|
|
17374
|
-
wsComponent.path =
|
|
17373
|
+
const [path9, query2] = wsComponent.resourceName.split("?");
|
|
17374
|
+
wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
|
|
17375
17375
|
wsComponent.query = query2;
|
|
17376
17376
|
wsComponent.resourceName = void 0;
|
|
17377
17377
|
}
|
|
@@ -22308,8 +22308,8 @@ var require_utils2 = __commonJS({
|
|
|
22308
22308
|
}
|
|
22309
22309
|
return ind;
|
|
22310
22310
|
}
|
|
22311
|
-
function removeDotSegments(
|
|
22312
|
-
let input =
|
|
22311
|
+
function removeDotSegments(path9) {
|
|
22312
|
+
let input = path9;
|
|
22313
22313
|
const output = [];
|
|
22314
22314
|
let nextSlash = -1;
|
|
22315
22315
|
let len = 0;
|
|
@@ -22654,8 +22654,8 @@ var require_schemes2 = __commonJS({
|
|
|
22654
22654
|
wsComponent.secure = void 0;
|
|
22655
22655
|
}
|
|
22656
22656
|
if (wsComponent.resourceName) {
|
|
22657
|
-
const [
|
|
22658
|
-
wsComponent.path =
|
|
22657
|
+
const [path9, query2] = wsComponent.resourceName.split("?");
|
|
22658
|
+
wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
|
|
22659
22659
|
wsComponent.query = query2;
|
|
22660
22660
|
wsComponent.resourceName = void 0;
|
|
22661
22661
|
}
|
|
@@ -24139,8 +24139,8 @@ var require_utils3 = __commonJS({
|
|
|
24139
24139
|
}
|
|
24140
24140
|
return ind;
|
|
24141
24141
|
}
|
|
24142
|
-
function removeDotSegments(
|
|
24143
|
-
let input =
|
|
24142
|
+
function removeDotSegments(path9) {
|
|
24143
|
+
let input = path9;
|
|
24144
24144
|
const output = [];
|
|
24145
24145
|
let nextSlash = -1;
|
|
24146
24146
|
let len = 0;
|
|
@@ -24485,8 +24485,8 @@ var require_schemes3 = __commonJS({
|
|
|
24485
24485
|
wsComponent.secure = void 0;
|
|
24486
24486
|
}
|
|
24487
24487
|
if (wsComponent.resourceName) {
|
|
24488
|
-
const [
|
|
24489
|
-
wsComponent.path =
|
|
24488
|
+
const [path9, query2] = wsComponent.resourceName.split("?");
|
|
24489
|
+
wsComponent.path = path9 && path9 !== "/" ? path9 : void 0;
|
|
24490
24490
|
wsComponent.query = query2;
|
|
24491
24491
|
wsComponent.resourceName = void 0;
|
|
24492
24492
|
}
|
|
@@ -32003,13 +32003,13 @@ var require_node = __commonJS({
|
|
|
32003
32003
|
this.staticChildrenNodes[index] = node;
|
|
32004
32004
|
}
|
|
32005
32005
|
}
|
|
32006
|
-
findStaticMatchingChild(
|
|
32007
|
-
const charCode =
|
|
32006
|
+
findStaticMatchingChild(path9, pathIndex) {
|
|
32007
|
+
const charCode = path9.charCodeAt(pathIndex);
|
|
32008
32008
|
const charCodes = this.staticChildrenCharCodes;
|
|
32009
32009
|
for (let i = 0; i < charCodes.length; i++) {
|
|
32010
32010
|
if (charCodes[i] === charCode) {
|
|
32011
32011
|
const staticChild = this.staticChildrenNodes[i];
|
|
32012
|
-
if (staticChild.matchPrefix(
|
|
32012
|
+
if (staticChild.matchPrefix(path9, pathIndex)) {
|
|
32013
32013
|
return staticChild;
|
|
32014
32014
|
}
|
|
32015
32015
|
return null;
|
|
@@ -32017,34 +32017,34 @@ var require_node = __commonJS({
|
|
|
32017
32017
|
}
|
|
32018
32018
|
return null;
|
|
32019
32019
|
}
|
|
32020
|
-
getStaticChild(
|
|
32021
|
-
if (
|
|
32020
|
+
getStaticChild(path9, pathIndex = 0) {
|
|
32021
|
+
if (path9.length === pathIndex) {
|
|
32022
32022
|
return this;
|
|
32023
32023
|
}
|
|
32024
|
-
const staticChild = this.findStaticMatchingChild(
|
|
32024
|
+
const staticChild = this.findStaticMatchingChild(path9, pathIndex);
|
|
32025
32025
|
if (staticChild) {
|
|
32026
|
-
return staticChild.getStaticChild(
|
|
32026
|
+
return staticChild.getStaticChild(path9, pathIndex + staticChild.prefix.length);
|
|
32027
32027
|
}
|
|
32028
32028
|
return null;
|
|
32029
32029
|
}
|
|
32030
|
-
createStaticChild(
|
|
32031
|
-
if (
|
|
32030
|
+
createStaticChild(path9) {
|
|
32031
|
+
if (path9.length === 0) {
|
|
32032
32032
|
return this;
|
|
32033
32033
|
}
|
|
32034
|
-
const childIndex = this.staticChildrenCharCodes.indexOf(
|
|
32034
|
+
const childIndex = this.staticChildrenCharCodes.indexOf(path9.charCodeAt(0));
|
|
32035
32035
|
let staticChild = childIndex === -1 ? void 0 : this.staticChildrenNodes[childIndex];
|
|
32036
32036
|
if (staticChild) {
|
|
32037
32037
|
let i = 1;
|
|
32038
32038
|
for (; i < staticChild.prefix.length; i++) {
|
|
32039
|
-
if (
|
|
32039
|
+
if (path9.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
|
|
32040
32040
|
staticChild = staticChild.split(this, i);
|
|
32041
32041
|
break;
|
|
32042
32042
|
}
|
|
32043
32043
|
}
|
|
32044
|
-
return staticChild.createStaticChild(
|
|
32044
|
+
return staticChild.createStaticChild(path9.slice(i));
|
|
32045
32045
|
}
|
|
32046
|
-
const node = new StaticNode(
|
|
32047
|
-
this.setStaticChild(
|
|
32046
|
+
const node = new StaticNode(path9);
|
|
32047
|
+
this.setStaticChild(path9.charAt(0), node);
|
|
32048
32048
|
return node;
|
|
32049
32049
|
}
|
|
32050
32050
|
};
|
|
@@ -32104,8 +32104,8 @@ var require_node = __commonJS({
|
|
|
32104
32104
|
parentNode.setStaticChild(parentPrefix.charAt(0), staticNode);
|
|
32105
32105
|
return staticNode;
|
|
32106
32106
|
}
|
|
32107
|
-
getNextNode(
|
|
32108
|
-
let node = this.findStaticMatchingChild(
|
|
32107
|
+
getNextNode(path9, pathIndex, nodeStack, paramsCount) {
|
|
32108
|
+
let node = this.findStaticMatchingChild(path9, pathIndex);
|
|
32109
32109
|
let parametricBrotherNodeIndex = 0;
|
|
32110
32110
|
if (node === null) {
|
|
32111
32111
|
if (this.parametricChildren.length === 0) {
|
|
@@ -32152,8 +32152,8 @@ var require_node = __commonJS({
|
|
|
32152
32152
|
this.kind = NODE_TYPES.PARAMETRIC;
|
|
32153
32153
|
this.nodePaths = /* @__PURE__ */ new Set([nodePath]);
|
|
32154
32154
|
}
|
|
32155
|
-
getNextNode(
|
|
32156
|
-
return this.findStaticMatchingChild(
|
|
32155
|
+
getNextNode(path9, pathIndex) {
|
|
32156
|
+
return this.findStaticMatchingChild(path9, pathIndex);
|
|
32157
32157
|
}
|
|
32158
32158
|
};
|
|
32159
32159
|
var WildcardNode = class extends Node {
|
|
@@ -32509,81 +32509,81 @@ var require_url_sanitizer = __commonJS({
|
|
|
32509
32509
|
return String.fromCharCode(charCode);
|
|
32510
32510
|
}
|
|
32511
32511
|
var MIN_NATIVE_SCAN_LENGTH = 12;
|
|
32512
|
-
function safeDecodeURI(
|
|
32513
|
-
if (
|
|
32514
|
-
return safeDecodeURINativeScan(
|
|
32512
|
+
function safeDecodeURI(path9, useSemicolonDelimiter) {
|
|
32513
|
+
if (path9.length >= MIN_NATIVE_SCAN_LENGTH) {
|
|
32514
|
+
return safeDecodeURINativeScan(path9, useSemicolonDelimiter);
|
|
32515
32515
|
}
|
|
32516
|
-
return safeDecodeURICharScan(
|
|
32516
|
+
return safeDecodeURICharScan(path9, useSemicolonDelimiter, 1);
|
|
32517
32517
|
}
|
|
32518
|
-
function safeDecodeURINativeScan(
|
|
32519
|
-
const percentIndex =
|
|
32520
|
-
let delimIndex =
|
|
32521
|
-
const hashIndex =
|
|
32518
|
+
function safeDecodeURINativeScan(path9, useSemicolonDelimiter) {
|
|
32519
|
+
const percentIndex = path9.indexOf("%", 1);
|
|
32520
|
+
let delimIndex = path9.indexOf("?", 1);
|
|
32521
|
+
const hashIndex = path9.indexOf("#", 1);
|
|
32522
32522
|
if (hashIndex !== -1 && (delimIndex === -1 || hashIndex < delimIndex)) {
|
|
32523
32523
|
delimIndex = hashIndex;
|
|
32524
32524
|
}
|
|
32525
32525
|
if (useSemicolonDelimiter) {
|
|
32526
|
-
const semicolonIndex =
|
|
32526
|
+
const semicolonIndex = path9.indexOf(";", 1);
|
|
32527
32527
|
if (semicolonIndex !== -1 && (delimIndex === -1 || semicolonIndex < delimIndex)) {
|
|
32528
32528
|
delimIndex = semicolonIndex;
|
|
32529
32529
|
}
|
|
32530
32530
|
}
|
|
32531
32531
|
if (percentIndex === -1 || delimIndex !== -1 && percentIndex > delimIndex) {
|
|
32532
32532
|
if (delimIndex === -1) {
|
|
32533
|
-
return { path:
|
|
32533
|
+
return { path: path9, querystring: "", shouldDecodeParam: false };
|
|
32534
32534
|
}
|
|
32535
32535
|
return {
|
|
32536
|
-
path:
|
|
32537
|
-
querystring:
|
|
32536
|
+
path: path9.slice(0, delimIndex),
|
|
32537
|
+
querystring: path9.slice(delimIndex + 1),
|
|
32538
32538
|
shouldDecodeParam: false
|
|
32539
32539
|
};
|
|
32540
32540
|
}
|
|
32541
|
-
return safeDecodeURIPercentScan(
|
|
32541
|
+
return safeDecodeURIPercentScan(path9, useSemicolonDelimiter, percentIndex);
|
|
32542
32542
|
}
|
|
32543
|
-
function safeDecodeURICharScan(
|
|
32544
|
-
for (let i = startIndex; i <
|
|
32545
|
-
const charCode =
|
|
32543
|
+
function safeDecodeURICharScan(path9, useSemicolonDelimiter, startIndex) {
|
|
32544
|
+
for (let i = startIndex; i < path9.length; i++) {
|
|
32545
|
+
const charCode = path9.charCodeAt(i);
|
|
32546
32546
|
if (charCode === 37) {
|
|
32547
|
-
return safeDecodeURIPercentScan(
|
|
32547
|
+
return safeDecodeURIPercentScan(path9, useSemicolonDelimiter, i);
|
|
32548
32548
|
} else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
|
|
32549
32549
|
return {
|
|
32550
|
-
path:
|
|
32551
|
-
querystring:
|
|
32550
|
+
path: path9.slice(0, i),
|
|
32551
|
+
querystring: path9.slice(i + 1),
|
|
32552
32552
|
shouldDecodeParam: false
|
|
32553
32553
|
};
|
|
32554
32554
|
}
|
|
32555
32555
|
}
|
|
32556
|
-
return { path:
|
|
32556
|
+
return { path: path9, querystring: "", shouldDecodeParam: false };
|
|
32557
32557
|
}
|
|
32558
|
-
function reencodePercentChar(
|
|
32559
|
-
return
|
|
32558
|
+
function reencodePercentChar(path9, index) {
|
|
32559
|
+
return path9.slice(0, index + 1) + "25" + path9.slice(index + 1);
|
|
32560
32560
|
}
|
|
32561
|
-
function safeDecodeURIPercentScan(
|
|
32561
|
+
function safeDecodeURIPercentScan(path9, useSemicolonDelimiter, startIndex) {
|
|
32562
32562
|
let shouldDecode = false;
|
|
32563
32563
|
let shouldDecodeParam = false;
|
|
32564
32564
|
let querystring = "";
|
|
32565
|
-
for (let i = startIndex; i <
|
|
32566
|
-
const charCode =
|
|
32565
|
+
for (let i = startIndex; i < path9.length; i++) {
|
|
32566
|
+
const charCode = path9.charCodeAt(i);
|
|
32567
32567
|
if (charCode === 37) {
|
|
32568
|
-
const componentCharCode = decodeComponentCharCode(
|
|
32568
|
+
const componentCharCode = decodeComponentCharCode(path9.charCodeAt(i + 1), path9.charCodeAt(i + 2));
|
|
32569
32569
|
if (componentCharCode === 0) {
|
|
32570
32570
|
shouldDecode = true;
|
|
32571
32571
|
} else {
|
|
32572
32572
|
shouldDecodeParam = true;
|
|
32573
32573
|
if (componentCharCode === 37) {
|
|
32574
32574
|
shouldDecode = true;
|
|
32575
|
-
|
|
32575
|
+
path9 = reencodePercentChar(path9, i);
|
|
32576
32576
|
i += 2;
|
|
32577
32577
|
}
|
|
32578
32578
|
i += 2;
|
|
32579
32579
|
}
|
|
32580
32580
|
} else if (charCode === 63 || charCode === 35 || charCode === 59 && useSemicolonDelimiter) {
|
|
32581
|
-
querystring =
|
|
32582
|
-
|
|
32581
|
+
querystring = path9.slice(i + 1);
|
|
32582
|
+
path9 = path9.slice(0, i);
|
|
32583
32583
|
break;
|
|
32584
32584
|
}
|
|
32585
32585
|
}
|
|
32586
|
-
const decodedPath = shouldDecode ? decodeURI(
|
|
32586
|
+
const decodedPath = shouldDecode ? decodeURI(path9) : path9;
|
|
32587
32587
|
return { path: decodedPath, querystring, shouldDecodeParam };
|
|
32588
32588
|
}
|
|
32589
32589
|
function safeDecodeURIComponent(uriComponent) {
|
|
@@ -32678,7 +32678,7 @@ var require_find_my_way = __commonJS({
|
|
|
32678
32678
|
this.trees = /* @__PURE__ */ Object.create(null);
|
|
32679
32679
|
this._treeGET = null;
|
|
32680
32680
|
}
|
|
32681
|
-
Router.prototype.on = function on(method,
|
|
32681
|
+
Router.prototype.on = function on(method, path9, opts, handler, store) {
|
|
32682
32682
|
if (typeof opts === "function") {
|
|
32683
32683
|
if (handler !== void 0) {
|
|
32684
32684
|
store = handler;
|
|
@@ -32686,34 +32686,34 @@ var require_find_my_way = __commonJS({
|
|
|
32686
32686
|
handler = opts;
|
|
32687
32687
|
opts = {};
|
|
32688
32688
|
}
|
|
32689
|
-
assert(typeof
|
|
32690
|
-
assert(
|
|
32691
|
-
assert(
|
|
32689
|
+
assert(typeof path9 === "string", "Path should be a string");
|
|
32690
|
+
assert(path9.length > 0, "The path could not be empty");
|
|
32691
|
+
assert(path9[0] === "/" || path9[0] === "*", "The first character of a path should be `/` or `*`");
|
|
32692
32692
|
assert(typeof handler === "function", "Handler should be a function");
|
|
32693
|
-
const optionalParamMatch =
|
|
32693
|
+
const optionalParamMatch = path9.match(OPTIONAL_PARAM_REGEXP);
|
|
32694
32694
|
if (optionalParamMatch) {
|
|
32695
|
-
assert(
|
|
32696
|
-
const pathFull =
|
|
32697
|
-
const pathOptional =
|
|
32695
|
+
assert(path9.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
|
|
32696
|
+
const pathFull = path9.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
|
|
32697
|
+
const pathOptional = path9.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
|
|
32698
32698
|
this.on(method, pathFull, opts, handler, store);
|
|
32699
32699
|
this.on(method, pathOptional, opts, handler, store);
|
|
32700
32700
|
return;
|
|
32701
32701
|
}
|
|
32702
|
-
const route =
|
|
32702
|
+
const route = path9;
|
|
32703
32703
|
if (this.ignoreDuplicateSlashes) {
|
|
32704
|
-
|
|
32704
|
+
path9 = removeDuplicateSlashes(path9);
|
|
32705
32705
|
}
|
|
32706
32706
|
if (this.ignoreTrailingSlash) {
|
|
32707
|
-
|
|
32707
|
+
path9 = trimLastSlash(path9);
|
|
32708
32708
|
}
|
|
32709
32709
|
const methods = Array.isArray(method) ? method : [method];
|
|
32710
32710
|
for (const method2 of methods) {
|
|
32711
32711
|
assert(typeof method2 === "string", "Method should be a string");
|
|
32712
32712
|
assert(httpMethods.includes(method2), `Method '${method2}' is not an http method.`);
|
|
32713
|
-
this._on(method2,
|
|
32713
|
+
this._on(method2, path9, opts, handler, store, route);
|
|
32714
32714
|
}
|
|
32715
32715
|
};
|
|
32716
|
-
Router.prototype._on = function _on(method,
|
|
32716
|
+
Router.prototype._on = function _on(method, path9, opts, handler, store) {
|
|
32717
32717
|
let constraints = {};
|
|
32718
32718
|
if (opts.constraints !== void 0) {
|
|
32719
32719
|
assert(typeof opts.constraints === "object" && opts.constraints !== null, "Constraints should be an object");
|
|
@@ -32726,7 +32726,7 @@ var require_find_my_way = __commonJS({
|
|
|
32726
32726
|
if (this.trees[method] === void 0) {
|
|
32727
32727
|
this.trees[method] = new StaticNode("/");
|
|
32728
32728
|
}
|
|
32729
|
-
let pattern =
|
|
32729
|
+
let pattern = path9;
|
|
32730
32730
|
if (pattern === "*" && this.trees[method].prefix.length !== 0) {
|
|
32731
32731
|
const currentRoot = this.trees[method];
|
|
32732
32732
|
this.trees[method] = new StaticNode("");
|
|
@@ -32834,19 +32834,19 @@ var require_find_my_way = __commonJS({
|
|
|
32834
32834
|
throw new Error(`Method '${method}' already declared for route '${pattern}' with constraints '${JSON.stringify(constraints)}'`);
|
|
32835
32835
|
}
|
|
32836
32836
|
}
|
|
32837
|
-
const route = { method, path:
|
|
32837
|
+
const route = { method, path: path9, pattern, params, opts, handler, store };
|
|
32838
32838
|
this.routes.push(route);
|
|
32839
32839
|
currentNode.addRoute(route, this.constrainer);
|
|
32840
32840
|
};
|
|
32841
|
-
Router.prototype.hasRoute = function hasRoute(method,
|
|
32842
|
-
const route = this.findRoute(method,
|
|
32841
|
+
Router.prototype.hasRoute = function hasRoute(method, path9, constraints) {
|
|
32842
|
+
const route = this.findRoute(method, path9, constraints);
|
|
32843
32843
|
return route !== null;
|
|
32844
32844
|
};
|
|
32845
|
-
Router.prototype.findRoute = function findNode(method,
|
|
32845
|
+
Router.prototype.findRoute = function findNode(method, path9, constraints = {}) {
|
|
32846
32846
|
if (this.trees[method] === void 0) {
|
|
32847
32847
|
return null;
|
|
32848
32848
|
}
|
|
32849
|
-
let pattern =
|
|
32849
|
+
let pattern = path9;
|
|
32850
32850
|
let currentNode = this.trees[method];
|
|
32851
32851
|
let parentNodePathIndex = currentNode.prefix.length;
|
|
32852
32852
|
const params = [];
|
|
@@ -32967,39 +32967,39 @@ var require_find_my_way = __commonJS({
|
|
|
32967
32967
|
this._treeGET = null;
|
|
32968
32968
|
this.routes = [];
|
|
32969
32969
|
};
|
|
32970
|
-
Router.prototype.off = function off(method,
|
|
32971
|
-
assert(typeof
|
|
32972
|
-
assert(
|
|
32973
|
-
assert(
|
|
32970
|
+
Router.prototype.off = function off(method, path9, constraints) {
|
|
32971
|
+
assert(typeof path9 === "string", "Path should be a string");
|
|
32972
|
+
assert(path9.length > 0, "The path could not be empty");
|
|
32973
|
+
assert(path9[0] === "/" || path9[0] === "*", "The first character of a path should be `/` or `*`");
|
|
32974
32974
|
assert(
|
|
32975
32975
|
typeof constraints === "undefined" || typeof constraints === "object" && !Array.isArray(constraints) && constraints !== null,
|
|
32976
32976
|
"Constraints should be an object or undefined."
|
|
32977
32977
|
);
|
|
32978
|
-
const optionalParamMatch =
|
|
32978
|
+
const optionalParamMatch = path9.match(OPTIONAL_PARAM_REGEXP);
|
|
32979
32979
|
if (optionalParamMatch) {
|
|
32980
|
-
assert(
|
|
32981
|
-
const pathFull =
|
|
32982
|
-
const pathOptional =
|
|
32980
|
+
assert(path9.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
|
|
32981
|
+
const pathFull = path9.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
|
|
32982
|
+
const pathOptional = path9.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
|
|
32983
32983
|
this.off(method, pathFull, constraints);
|
|
32984
32984
|
this.off(method, pathOptional, constraints);
|
|
32985
32985
|
return;
|
|
32986
32986
|
}
|
|
32987
32987
|
if (this.ignoreDuplicateSlashes) {
|
|
32988
|
-
|
|
32988
|
+
path9 = removeDuplicateSlashes(path9);
|
|
32989
32989
|
}
|
|
32990
32990
|
if (this.ignoreTrailingSlash) {
|
|
32991
|
-
|
|
32991
|
+
path9 = trimLastSlash(path9);
|
|
32992
32992
|
}
|
|
32993
32993
|
const methods = Array.isArray(method) ? method : [method];
|
|
32994
32994
|
for (const method2 of methods) {
|
|
32995
|
-
this._off(method2,
|
|
32995
|
+
this._off(method2, path9, constraints);
|
|
32996
32996
|
}
|
|
32997
32997
|
};
|
|
32998
|
-
Router.prototype._off = function _off(method,
|
|
32998
|
+
Router.prototype._off = function _off(method, path9, constraints) {
|
|
32999
32999
|
assert(typeof method === "string", "Method should be a string");
|
|
33000
33000
|
assert(httpMethods.includes(method), `Method '${method}' is not an http method.`);
|
|
33001
33001
|
function matcherWithoutConstraints(route) {
|
|
33002
|
-
return method !== route.method ||
|
|
33002
|
+
return method !== route.method || path9 !== route.path;
|
|
33003
33003
|
}
|
|
33004
33004
|
function matcherWithConstraints(route) {
|
|
33005
33005
|
return matcherWithoutConstraints(route) || !deepEqual(constraints, route.opts.constraints || {});
|
|
@@ -33036,37 +33036,37 @@ var require_find_my_way = __commonJS({
|
|
|
33036
33036
|
if (handle === null) return this._defaultRoute(req, res, ctx);
|
|
33037
33037
|
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);
|
|
33038
33038
|
};
|
|
33039
|
-
Router.prototype.find = function find(method,
|
|
33039
|
+
Router.prototype.find = function find(method, path9, derivedConstraints) {
|
|
33040
33040
|
let currentNode = method === "GET" ? this._treeGET : this.trees[method];
|
|
33041
33041
|
if (currentNode == null) return null;
|
|
33042
|
-
if (
|
|
33043
|
-
|
|
33042
|
+
if (path9.charCodeAt(0) !== 47) {
|
|
33043
|
+
path9 = path9.replace(FULL_PATH_REGEXP, "/");
|
|
33044
33044
|
}
|
|
33045
33045
|
if (this.ignoreDuplicateSlashes) {
|
|
33046
|
-
|
|
33046
|
+
path9 = removeDuplicateSlashes(path9);
|
|
33047
33047
|
}
|
|
33048
33048
|
let sanitizedUrl;
|
|
33049
33049
|
let querystring2;
|
|
33050
33050
|
let shouldDecodeParam;
|
|
33051
33051
|
try {
|
|
33052
|
-
sanitizedUrl =
|
|
33053
|
-
|
|
33052
|
+
sanitizedUrl = path9.length >= MIN_NATIVE_SCAN_LENGTH ? safeDecodeURINativeScan(path9, this.useSemicolonDelimiter) : safeDecodeURICharScan(path9, this.useSemicolonDelimiter, 1);
|
|
33053
|
+
path9 = sanitizedUrl.path;
|
|
33054
33054
|
querystring2 = sanitizedUrl.querystring;
|
|
33055
33055
|
shouldDecodeParam = sanitizedUrl.shouldDecodeParam;
|
|
33056
33056
|
} catch (error) {
|
|
33057
|
-
return this._onBadUrl(
|
|
33057
|
+
return this._onBadUrl(path9);
|
|
33058
33058
|
}
|
|
33059
33059
|
if (this.ignoreTrailingSlash) {
|
|
33060
|
-
|
|
33060
|
+
path9 = trimLastSlash(path9);
|
|
33061
33061
|
}
|
|
33062
|
-
const originPath =
|
|
33062
|
+
const originPath = path9;
|
|
33063
33063
|
if (this.caseSensitive === false) {
|
|
33064
|
-
|
|
33064
|
+
path9 = path9.toLowerCase();
|
|
33065
33065
|
}
|
|
33066
33066
|
const maxParamLength = this.maxParamLength;
|
|
33067
33067
|
let pathIndex = currentNode.prefix.length;
|
|
33068
33068
|
const params = [];
|
|
33069
|
-
const pathLen =
|
|
33069
|
+
const pathLen = path9.length;
|
|
33070
33070
|
const brothersNodesStack = [];
|
|
33071
33071
|
let maxParamLengthExceeded = false;
|
|
33072
33072
|
while (true) {
|
|
@@ -33081,7 +33081,7 @@ var require_find_my_way = __commonJS({
|
|
|
33081
33081
|
};
|
|
33082
33082
|
}
|
|
33083
33083
|
}
|
|
33084
|
-
let node = currentNode.getNextNode(
|
|
33084
|
+
let node = currentNode.getNextNode(path9, pathIndex, brothersNodesStack, params.length);
|
|
33085
33085
|
if (node === null) {
|
|
33086
33086
|
if (brothersNodesStack.length === 0) {
|
|
33087
33087
|
if (maxParamLengthExceeded && this.onMaxParamLength) {
|
|
@@ -33182,8 +33182,8 @@ var require_find_my_way = __commonJS({
|
|
|
33182
33182
|
Router.prototype._rebuild = function(routes) {
|
|
33183
33183
|
this.reset();
|
|
33184
33184
|
for (const route of routes) {
|
|
33185
|
-
const { method, path:
|
|
33186
|
-
this._on(method,
|
|
33185
|
+
const { method, path: path9, opts, handler, store } = route;
|
|
33186
|
+
this._on(method, path9, opts, handler, store);
|
|
33187
33187
|
}
|
|
33188
33188
|
};
|
|
33189
33189
|
Router.prototype._defaultRoute = function(req, res, ctx) {
|
|
@@ -33194,24 +33194,24 @@ var require_find_my_way = __commonJS({
|
|
|
33194
33194
|
res.end();
|
|
33195
33195
|
}
|
|
33196
33196
|
};
|
|
33197
|
-
Router.prototype._onBadUrl = function(
|
|
33197
|
+
Router.prototype._onBadUrl = function(path9) {
|
|
33198
33198
|
if (this.onBadUrl === null) {
|
|
33199
33199
|
return null;
|
|
33200
33200
|
}
|
|
33201
33201
|
const onBadUrl = this.onBadUrl;
|
|
33202
33202
|
return {
|
|
33203
|
-
handler: (req, res, ctx) => onBadUrl(
|
|
33203
|
+
handler: (req, res, ctx) => onBadUrl(path9, req, res),
|
|
33204
33204
|
params: {},
|
|
33205
33205
|
store: null
|
|
33206
33206
|
};
|
|
33207
33207
|
};
|
|
33208
|
-
Router.prototype._onMaxParamLength = function(
|
|
33208
|
+
Router.prototype._onMaxParamLength = function(path9) {
|
|
33209
33209
|
if (this.onMaxParamLength === null) {
|
|
33210
33210
|
return null;
|
|
33211
33211
|
}
|
|
33212
33212
|
const onMaxParamLength = this.onMaxParamLength;
|
|
33213
33213
|
return {
|
|
33214
|
-
handler: (req, res, ctx) => onMaxParamLength(
|
|
33214
|
+
handler: (req, res, ctx) => onMaxParamLength(path9, req, res),
|
|
33215
33215
|
params: {},
|
|
33216
33216
|
store: null
|
|
33217
33217
|
};
|
|
@@ -33243,12 +33243,12 @@ var require_find_my_way = __commonJS({
|
|
|
33243
33243
|
if (!httpMethods.hasOwnProperty(i)) continue;
|
|
33244
33244
|
const m = httpMethods[i];
|
|
33245
33245
|
const methodName = m.toLowerCase();
|
|
33246
|
-
Router.prototype[methodName] = function(
|
|
33247
|
-
return this.on(m,
|
|
33246
|
+
Router.prototype[methodName] = function(path9, handler, store) {
|
|
33247
|
+
return this.on(m, path9, handler, store);
|
|
33248
33248
|
};
|
|
33249
33249
|
}
|
|
33250
|
-
Router.prototype.all = function(
|
|
33251
|
-
this.on(httpMethods,
|
|
33250
|
+
Router.prototype.all = function(path9, handler, store) {
|
|
33251
|
+
this.on(httpMethods, path9, handler, store);
|
|
33252
33252
|
};
|
|
33253
33253
|
Router.sanitizeUrlPath = function sanitizeUrlPath(url, useSemicolonDelimiter) {
|
|
33254
33254
|
const decoded = safeDecodeURI(url, useSemicolonDelimiter);
|
|
@@ -33263,14 +33263,14 @@ var require_find_my_way = __commonJS({
|
|
|
33263
33263
|
function escapeRegExp(string) {
|
|
33264
33264
|
return string.replace(ESCAPE_REGEXP, "\\$&");
|
|
33265
33265
|
}
|
|
33266
|
-
function removeDuplicateSlashes(
|
|
33267
|
-
return
|
|
33266
|
+
function removeDuplicateSlashes(path9) {
|
|
33267
|
+
return path9.indexOf("//") !== -1 ? path9.replace(REMOVE_DUPLICATE_SLASHES_REGEXP, "/") : path9;
|
|
33268
33268
|
}
|
|
33269
|
-
function trimLastSlash(
|
|
33270
|
-
if (
|
|
33271
|
-
return
|
|
33269
|
+
function trimLastSlash(path9) {
|
|
33270
|
+
if (path9.length > 1 && path9.charCodeAt(path9.length - 1) === 47) {
|
|
33271
|
+
return path9.slice(0, -1);
|
|
33272
33272
|
}
|
|
33273
|
-
return
|
|
33273
|
+
return path9;
|
|
33274
33274
|
}
|
|
33275
33275
|
function trimRegExpStartAndEnd(regexString) {
|
|
33276
33276
|
if (regexString.charCodeAt(1) === 94) {
|
|
@@ -33281,22 +33281,22 @@ var require_find_my_way = __commonJS({
|
|
|
33281
33281
|
}
|
|
33282
33282
|
return regexString;
|
|
33283
33283
|
}
|
|
33284
|
-
function getClosingParenthensePosition(
|
|
33284
|
+
function getClosingParenthensePosition(path9, idx) {
|
|
33285
33285
|
let parentheses = 1;
|
|
33286
|
-
while (idx <
|
|
33286
|
+
while (idx < path9.length) {
|
|
33287
33287
|
idx++;
|
|
33288
|
-
if (
|
|
33288
|
+
if (path9.charCodeAt(idx) === 92) {
|
|
33289
33289
|
idx++;
|
|
33290
33290
|
continue;
|
|
33291
33291
|
}
|
|
33292
|
-
if (
|
|
33292
|
+
if (path9.charCodeAt(idx) === 41) {
|
|
33293
33293
|
parentheses--;
|
|
33294
|
-
} else if (
|
|
33294
|
+
} else if (path9.charCodeAt(idx) === 40) {
|
|
33295
33295
|
parentheses++;
|
|
33296
33296
|
}
|
|
33297
33297
|
if (!parentheses) return idx;
|
|
33298
33298
|
}
|
|
33299
|
-
throw new TypeError('Invalid regexp expression in "' +
|
|
33299
|
+
throw new TypeError('Invalid regexp expression in "' + path9 + '"');
|
|
33300
33300
|
}
|
|
33301
33301
|
function defaultBuildPrettyMeta(route) {
|
|
33302
33302
|
if (!route) return {};
|
|
@@ -33529,12 +33529,12 @@ var require_route = __commonJS({
|
|
|
33529
33529
|
function route({ options: options2, isFastify }) {
|
|
33530
33530
|
throwIfAlreadyStarted("Cannot add route!");
|
|
33531
33531
|
const opts = { ...options2 };
|
|
33532
|
-
const
|
|
33532
|
+
const path9 = opts.url || opts.path || "";
|
|
33533
33533
|
if (!opts.handler) {
|
|
33534
|
-
throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method,
|
|
33534
|
+
throw new FST_ERR_ROUTE_MISSING_HANDLER(opts.method, path9);
|
|
33535
33535
|
}
|
|
33536
33536
|
if (opts.errorHandler !== void 0 && typeof opts.errorHandler !== "function") {
|
|
33537
|
-
throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method,
|
|
33537
|
+
throw new FST_ERR_ROUTE_HANDLER_NOT_FN(opts.method, path9);
|
|
33538
33538
|
}
|
|
33539
33539
|
validateBodyLimitOption(opts.bodyLimit);
|
|
33540
33540
|
validateHandlerTimeoutOption(opts.handlerTimeout);
|
|
@@ -33544,22 +33544,22 @@ var require_route = __commonJS({
|
|
|
33544
33544
|
if (Array.isArray(opts.method)) {
|
|
33545
33545
|
for (let i = 0; i < opts.method.length; ++i) {
|
|
33546
33546
|
opts.method[i] = normalizeAndValidateMethod.call(this, opts.method[i]);
|
|
33547
|
-
validateSchemaBodyOption.call(this, opts.method[i],
|
|
33547
|
+
validateSchemaBodyOption.call(this, opts.method[i], path9, opts.schema);
|
|
33548
33548
|
isGetRoute = opts.method.includes("GET");
|
|
33549
33549
|
isHeadRoute = opts.method.includes("HEAD");
|
|
33550
33550
|
}
|
|
33551
33551
|
} else {
|
|
33552
33552
|
opts.method = normalizeAndValidateMethod.call(this, opts.method);
|
|
33553
|
-
validateSchemaBodyOption.call(this, opts.method,
|
|
33553
|
+
validateSchemaBodyOption.call(this, opts.method, path9, opts.schema);
|
|
33554
33554
|
isGetRoute = opts.method === "GET";
|
|
33555
33555
|
isHeadRoute = opts.method === "HEAD";
|
|
33556
33556
|
}
|
|
33557
33557
|
const headOpts = shouldExposeHead && isGetRoute ? { ...options2 } : null;
|
|
33558
33558
|
const prefix = this[kRoutePrefix];
|
|
33559
|
-
if (
|
|
33559
|
+
if (path9 === "/" && prefix.length > 0 && opts.method !== "HEAD") {
|
|
33560
33560
|
switch (opts.prefixTrailingSlash) {
|
|
33561
33561
|
case "slash":
|
|
33562
|
-
addNewRoute.call(this, { path:
|
|
33562
|
+
addNewRoute.call(this, { path: path9, isFastify });
|
|
33563
33563
|
break;
|
|
33564
33564
|
case "no-slash":
|
|
33565
33565
|
addNewRoute.call(this, { path: "", isFastify });
|
|
@@ -33568,20 +33568,20 @@ var require_route = __commonJS({
|
|
|
33568
33568
|
default:
|
|
33569
33569
|
addNewRoute.call(this, { path: "", isFastify });
|
|
33570
33570
|
if (ignoreTrailingSlash !== true && (ignoreDuplicateSlashes !== true || !prefix.endsWith("/"))) {
|
|
33571
|
-
addNewRoute.call(this, { path:
|
|
33571
|
+
addNewRoute.call(this, { path: path9, prefixing: true, isFastify });
|
|
33572
33572
|
}
|
|
33573
33573
|
}
|
|
33574
|
-
} else if (
|
|
33575
|
-
addNewRoute.call(this, { path:
|
|
33574
|
+
} else if (path9[0] === "/" && prefix.endsWith("/")) {
|
|
33575
|
+
addNewRoute.call(this, { path: path9.slice(1), isFastify });
|
|
33576
33576
|
} else {
|
|
33577
|
-
addNewRoute.call(this, { path:
|
|
33577
|
+
addNewRoute.call(this, { path: path9, isFastify });
|
|
33578
33578
|
}
|
|
33579
33579
|
return this;
|
|
33580
|
-
function addNewRoute({ path:
|
|
33581
|
-
const url = prefix +
|
|
33580
|
+
function addNewRoute({ path: path10, prefixing = false, isFastify: isFastify2 = false }) {
|
|
33581
|
+
const url = prefix + path10;
|
|
33582
33582
|
opts.url = url;
|
|
33583
33583
|
opts.path = url;
|
|
33584
|
-
opts.routePath =
|
|
33584
|
+
opts.routePath = path10;
|
|
33585
33585
|
opts.prefix = prefix;
|
|
33586
33586
|
opts.logLevel = opts.logLevel || this[kLogLevel];
|
|
33587
33587
|
validateLogLevelOption(opts.logLevel, opts.method, opts.url, logger);
|
|
@@ -33713,7 +33713,7 @@ var require_route = __commonJS({
|
|
|
33713
33713
|
});
|
|
33714
33714
|
if (shouldExposeHead && isGetRoute && !isHeadRoute && !hasHEADHandler) {
|
|
33715
33715
|
const onSendHandlers = parseHeadOnSendHandlers(headOpts.onSend);
|
|
33716
|
-
prepareRoute.call(this, { method: "HEAD", url:
|
|
33716
|
+
prepareRoute.call(this, { method: "HEAD", url: path10, options: { ...headOpts, onSend: onSendHandlers }, isFastify: true });
|
|
33717
33717
|
}
|
|
33718
33718
|
}
|
|
33719
33719
|
}
|
|
@@ -33837,9 +33837,9 @@ var require_route = __commonJS({
|
|
|
33837
33837
|
}
|
|
33838
33838
|
return method;
|
|
33839
33839
|
}
|
|
33840
|
-
function validateSchemaBodyOption(method,
|
|
33840
|
+
function validateSchemaBodyOption(method, path9, schema) {
|
|
33841
33841
|
if (this[kSupportedHTTPMethods].bodyless.has(method) && schema?.body) {
|
|
33842
|
-
throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method,
|
|
33842
|
+
throw new FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED(method, path9);
|
|
33843
33843
|
}
|
|
33844
33844
|
}
|
|
33845
33845
|
function validateBodyLimitOption(bodyLimit) {
|
|
@@ -33854,11 +33854,11 @@ var require_route = __commonJS({
|
|
|
33854
33854
|
throw new FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT(handlerTimeout);
|
|
33855
33855
|
}
|
|
33856
33856
|
}
|
|
33857
|
-
function validateLogLevelOption(logLevel, method,
|
|
33857
|
+
function validateLogLevelOption(logLevel, method, path9, logger) {
|
|
33858
33858
|
if (logLevel == null || logLevel === "") return;
|
|
33859
33859
|
if (logger?.levels?.values == null) return;
|
|
33860
33860
|
if (typeof logLevel !== "string" || logger.levels.values[logLevel] === void 0) {
|
|
33861
|
-
throw new FST_ERR_ROUTE_LOG_LEVEL_INVALID(method,
|
|
33861
|
+
throw new FST_ERR_ROUTE_LOG_LEVEL_INVALID(method, path9, logLevel);
|
|
33862
33862
|
}
|
|
33863
33863
|
}
|
|
33864
33864
|
function runPreParsing(err, request, reply) {
|
|
@@ -33947,7 +33947,7 @@ var require_four_oh_four = __commonJS({
|
|
|
33947
33947
|
});
|
|
33948
33948
|
}
|
|
33949
33949
|
function createRouteEventHandler() {
|
|
33950
|
-
return function onRouteEvent(
|
|
33950
|
+
return function onRouteEvent(path9, req, res) {
|
|
33951
33951
|
const fourOhFourContext = this[kFourOhFourLevelInstance][kFourOhFourContext];
|
|
33952
33952
|
const id = getGenReqId(fourOhFourContext.server, req);
|
|
33953
33953
|
const childLogger = createChildLogger(fourOhFourContext, logger, req, id);
|
|
@@ -36618,19 +36618,19 @@ var require_fastify = __commonJS({
|
|
|
36618
36618
|
}
|
|
36619
36619
|
fourOhFour.router.lookup(req, res);
|
|
36620
36620
|
}
|
|
36621
|
-
function onBadUrl(
|
|
36621
|
+
function onBadUrl(path9, req, res) {
|
|
36622
36622
|
if (options.frameworkErrors) {
|
|
36623
36623
|
const id = getGenReqId(routeEventContext.server, req);
|
|
36624
36624
|
const childLogger = createChildLogger(routeEventContext, options.logger, req, id);
|
|
36625
36625
|
const request = new Request(id, null, req, null, childLogger, routeEventContext);
|
|
36626
36626
|
const reply = new Reply(res, request, childLogger);
|
|
36627
36627
|
routeEventContext.server[kLogController].incomingRequest(request, reply);
|
|
36628
|
-
return options.frameworkErrors(new FST_ERR_BAD_URL(
|
|
36628
|
+
return options.frameworkErrors(new FST_ERR_BAD_URL(path9), request, reply);
|
|
36629
36629
|
}
|
|
36630
36630
|
const body = JSON.stringify({
|
|
36631
36631
|
error: "Bad Request",
|
|
36632
36632
|
code: "FST_ERR_BAD_URL",
|
|
36633
|
-
message: `'${
|
|
36633
|
+
message: `'${path9}' is not a valid url component`,
|
|
36634
36634
|
statusCode: 400
|
|
36635
36635
|
});
|
|
36636
36636
|
res.writeHead(400, {
|
|
@@ -36639,19 +36639,19 @@ var require_fastify = __commonJS({
|
|
|
36639
36639
|
});
|
|
36640
36640
|
res.end(body);
|
|
36641
36641
|
}
|
|
36642
|
-
function onMaxParamLength(
|
|
36642
|
+
function onMaxParamLength(path9, req, res) {
|
|
36643
36643
|
if (options.frameworkErrors) {
|
|
36644
36644
|
const id = getGenReqId(routeEventContext.server, req);
|
|
36645
36645
|
const childLogger = createChildLogger(routeEventContext, options.logger, req, id);
|
|
36646
36646
|
const request = new Request(id, null, req, null, childLogger, routeEventContext);
|
|
36647
36647
|
const reply = new Reply(res, request, childLogger);
|
|
36648
36648
|
routeEventContext.server[kLogController].incomingRequest(request, reply);
|
|
36649
|
-
return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(
|
|
36649
|
+
return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path9), request, reply);
|
|
36650
36650
|
}
|
|
36651
36651
|
const body = JSON.stringify({
|
|
36652
36652
|
error: "Bad Request",
|
|
36653
36653
|
code: "FST_ERR_MAX_PARAM_LENGTH",
|
|
36654
|
-
message: `'${
|
|
36654
|
+
message: `'${path9}' is exceeding the max param length`,
|
|
36655
36655
|
statusCode: 414
|
|
36656
36656
|
});
|
|
36657
36657
|
res.writeHead(414, {
|
|
@@ -41001,8 +41001,8 @@ var import_cors = __toESM(require_cors(), 1);
|
|
|
41001
41001
|
// src/db/index.ts
|
|
41002
41002
|
import Database from "better-sqlite3";
|
|
41003
41003
|
var db;
|
|
41004
|
-
function initDb(
|
|
41005
|
-
db = new Database(
|
|
41004
|
+
function initDb(path9 = "data.db") {
|
|
41005
|
+
db = new Database(path9);
|
|
41006
41006
|
db.pragma("journal_mode = WAL");
|
|
41007
41007
|
db.pragma("foreign_keys = ON");
|
|
41008
41008
|
createTables(db);
|
|
@@ -42248,11 +42248,11 @@ async function registerWorkspaceRoutes(fastify) {
|
|
|
42248
42248
|
}
|
|
42249
42249
|
}
|
|
42250
42250
|
}, async (request, reply) => {
|
|
42251
|
-
const { path:
|
|
42252
|
-
if (!
|
|
42251
|
+
const { path: path9, label = null } = request.body || {};
|
|
42252
|
+
if (!path9 || !path9.trim()) {
|
|
42253
42253
|
return reply.code(400).send({ error: "Path is required" });
|
|
42254
42254
|
}
|
|
42255
|
-
const trimmedPath =
|
|
42255
|
+
const trimmedPath = path9.trim();
|
|
42256
42256
|
const db2 = getDb();
|
|
42257
42257
|
const existing = db2.prepare("SELECT * FROM workspaces WHERE path = ?").get(trimmedPath);
|
|
42258
42258
|
if (existing) {
|
|
@@ -42280,8 +42280,8 @@ async function registerWorkspaceRoutes(fastify) {
|
|
|
42280
42280
|
"-e",
|
|
42281
42281
|
'POSIX path of (choose folder with prompt "Select a workspace directory")'
|
|
42282
42282
|
]);
|
|
42283
|
-
const
|
|
42284
|
-
return { path:
|
|
42283
|
+
const path9 = stdout.trim().replace(/\/$/, "");
|
|
42284
|
+
return { path: path9 };
|
|
42285
42285
|
} catch {
|
|
42286
42286
|
return reply.code(204).send({ cancelled: true });
|
|
42287
42287
|
}
|
|
@@ -42297,11 +42297,11 @@ async function registerWorkspaceRoutes(fastify) {
|
|
|
42297
42297
|
}
|
|
42298
42298
|
}
|
|
42299
42299
|
}, async (request, reply) => {
|
|
42300
|
-
const { path:
|
|
42301
|
-
if (!
|
|
42300
|
+
const { path: path9 } = request.body || {};
|
|
42301
|
+
if (!path9 || !path9.trim()) {
|
|
42302
42302
|
return reply.code(400).send({ error: "Path is required" });
|
|
42303
42303
|
}
|
|
42304
|
-
const trimmedPath =
|
|
42304
|
+
const trimmedPath = path9.trim();
|
|
42305
42305
|
const db2 = getDb();
|
|
42306
42306
|
const existing = db2.prepare("SELECT * FROM workspaces WHERE path = ?").get(trimmedPath);
|
|
42307
42307
|
if (existing) {
|
|
@@ -42948,17 +42948,17 @@ async function registerPerfLogRoutes(fastify) {
|
|
|
42948
42948
|
if (entries.length === 0) {
|
|
42949
42949
|
return reply.send({ written: 0 });
|
|
42950
42950
|
}
|
|
42951
|
-
const
|
|
42951
|
+
const path9 = perfLogPath();
|
|
42952
42952
|
try {
|
|
42953
|
-
mkdirSync(dirname(
|
|
42953
|
+
mkdirSync(dirname(path9), { recursive: true });
|
|
42954
42954
|
try {
|
|
42955
|
-
if (statSync(
|
|
42956
|
-
renameSync(
|
|
42955
|
+
if (statSync(path9).size > MAX_BYTES) {
|
|
42956
|
+
renameSync(path9, `${path9}.1`);
|
|
42957
42957
|
}
|
|
42958
42958
|
} catch {
|
|
42959
42959
|
}
|
|
42960
42960
|
const lines = entries.map((e) => `${new Date(e.t).toISOString()} [${oneLine(e.cat)}] ${oneLine(e.msg)}`).join("\n");
|
|
42961
|
-
appendFileSync(
|
|
42961
|
+
appendFileSync(path9, `${lines}
|
|
42962
42962
|
`, "utf-8");
|
|
42963
42963
|
return reply.send({ written: entries.length });
|
|
42964
42964
|
} catch (err) {
|
|
@@ -43522,7 +43522,7 @@ function proxyHandler(request, reply) {
|
|
|
43522
43522
|
|
|
43523
43523
|
// src/routes/apps.ts
|
|
43524
43524
|
import fs4 from "node:fs";
|
|
43525
|
-
import
|
|
43525
|
+
import path6 from "node:path";
|
|
43526
43526
|
|
|
43527
43527
|
// src/apps/instances.ts
|
|
43528
43528
|
import fs2 from "node:fs";
|
|
@@ -43573,15 +43573,20 @@ Each subdirectory of this folder is one mini app:
|
|
|
43573
43573
|
manifest.json - { "title": string, "description"?: string, "icon"?: string,
|
|
43574
43574
|
"tools"?: [{ "name", "description", "inputSchema" }] }
|
|
43575
43575
|
index.html - markup only (full HTML document); do NOT reference app.js
|
|
43576
|
-
app.ts -
|
|
43577
|
-
|
|
43576
|
+
app.ts - ENTRY logic file (TypeScript, PREFERRED); compiled
|
|
43577
|
+
together with any sibling .ts modules it imports
|
|
43578
|
+
and injected into the page as ONE compiled script
|
|
43579
|
+
*.ts - additional modules (flat folder, same directory as
|
|
43580
|
+
app.ts); import them from app.ts with relative names
|
|
43581
|
+
only ('./util' or './util.ts'); bare package imports
|
|
43582
|
+
are NOT supported \u2014 everything must be local
|
|
43578
43583
|
app.js - legacy plain-JS logic; used only when app.ts is absent
|
|
43579
43584
|
|
|
43580
|
-
The pane compiles app.ts on every change (strict
|
|
43581
|
-
type errors are shown in the app tab \u2014 check
|
|
43582
|
-
them before finishing. window.AgentPane is
|
|
43583
|
-
(getState/setState/createSession/
|
|
43584
|
-
needed.
|
|
43585
|
+
The pane compiles app.ts and its imported modules on every change (strict
|
|
43586
|
+
mode, lib dom). Compile and type errors are shown in the app tab \u2014 check
|
|
43587
|
+
them after every edit and fix them before finishing. window.AgentPane is
|
|
43588
|
+
typed via ambient declarations (getState/setState/createSession/
|
|
43589
|
+
submitTurn/onToolCall/...); no import needed.
|
|
43585
43590
|
|
|
43586
43591
|
App state does NOT live in this folder \u2014 it is stored in the pane database
|
|
43587
43592
|
(app_instances table) and reached with getState()/setState().
|
|
@@ -43594,7 +43599,6 @@ App state does NOT live in this folder \u2014 it is stored in the pane database
|
|
|
43594
43599
|
- submitTurn(sessionId, prompt) - send a prompt to a session
|
|
43595
43600
|
- onTurnCompleted(callback) - callback(event, { turnId, response }) when a turn ends
|
|
43596
43601
|
- onToolCall(callback) - callback({ callId, name, tool, args }) when the AGENT calls one of the manifest tools (name and tool carry the same tool name); answer with resolveToolCall(callId, result)
|
|
43597
|
-
one of the manifest tools; answer with resolveToolCall(callId, result)
|
|
43598
43602
|
|
|
43599
43603
|
## Agent tool calls (manifest "tools")
|
|
43600
43604
|
|
|
@@ -43749,6 +43753,7 @@ import vm2 from "node:vm";
|
|
|
43749
43753
|
|
|
43750
43754
|
// src/apps/app-compile.ts
|
|
43751
43755
|
import vm from "node:vm";
|
|
43756
|
+
import path5 from "node:path";
|
|
43752
43757
|
import ts from "typescript";
|
|
43753
43758
|
var APP_TS = "app.ts";
|
|
43754
43759
|
var BRIDGE_DTS_FILE = "agentpane.d.ts";
|
|
@@ -43790,30 +43795,128 @@ function tsDiagnosticToFile(file, d) {
|
|
|
43790
43795
|
message: ts.flattenDiagnosticMessageText(d.messageText, "\n")
|
|
43791
43796
|
};
|
|
43792
43797
|
}
|
|
43793
|
-
|
|
43798
|
+
var MODULE_LIMIT = 50;
|
|
43799
|
+
function resolveModuleName(spec) {
|
|
43800
|
+
if (!spec.startsWith("./")) return null;
|
|
43801
|
+
const base = spec.slice(2).replace(/\.(ts|js)$/, "");
|
|
43802
|
+
const file = `${base}.ts`;
|
|
43803
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*\.ts$/.test(file)) return null;
|
|
43804
|
+
return file;
|
|
43805
|
+
}
|
|
43806
|
+
function importRefs(sf) {
|
|
43807
|
+
const refs = [];
|
|
43808
|
+
const push = (expr) => {
|
|
43809
|
+
if (!ts.isStringLiteral(expr)) return;
|
|
43810
|
+
const pos = sf.getLineAndCharacterOfPosition(expr.getStart(sf));
|
|
43811
|
+
refs.push({ name: expr.text, file: sf.fileName, line: pos.line + 1, column: pos.character + 1 });
|
|
43812
|
+
};
|
|
43813
|
+
const visit = (node) => {
|
|
43814
|
+
if (ts.isImportDeclaration(node) && node.moduleSpecifier) push(node.moduleSpecifier);
|
|
43815
|
+
else if (ts.isExportDeclaration(node) && node.moduleSpecifier) push(node.moduleSpecifier);
|
|
43816
|
+
else if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword && node.arguments[0])
|
|
43817
|
+
push(node.arguments[0]);
|
|
43818
|
+
else ts.forEachChild(node, visit);
|
|
43819
|
+
};
|
|
43820
|
+
ts.forEachChild(sf, visit);
|
|
43821
|
+
return refs;
|
|
43822
|
+
}
|
|
43823
|
+
function buildModuleGraph(appId) {
|
|
43824
|
+
const modules = [{ file: APP_TS, source: readAppFile(appId, APP_TS) }];
|
|
43825
|
+
const seen = /* @__PURE__ */ new Set([APP_TS]);
|
|
43826
|
+
const blocking = [];
|
|
43827
|
+
for (let i = 0; i < modules.length; i++) {
|
|
43828
|
+
const mod = modules[i];
|
|
43829
|
+
const sf = ts.createSourceFile(mod.file, mod.source, ts.ScriptTarget.ES2020, true);
|
|
43830
|
+
for (const ref of importRefs(sf)) {
|
|
43831
|
+
const target = resolveModuleName(ref.name);
|
|
43832
|
+
const at = { severity: "error", file: ref.file, line: ref.line, column: ref.column };
|
|
43833
|
+
if (!target) {
|
|
43834
|
+
blocking.push({
|
|
43835
|
+
...at,
|
|
43836
|
+
message: `Unsupported import '${ref.name}' \u2014 mini app modules must be sibling .ts files imported as './name'.`
|
|
43837
|
+
});
|
|
43838
|
+
continue;
|
|
43839
|
+
}
|
|
43840
|
+
if (seen.has(target)) continue;
|
|
43841
|
+
seen.add(target);
|
|
43842
|
+
const source = readAppFile(appId, target);
|
|
43843
|
+
if (!source.trim()) {
|
|
43844
|
+
blocking.push({
|
|
43845
|
+
...at,
|
|
43846
|
+
message: `Cannot find module '${ref.name}' \u2014 add a file named '${target}' next to app.ts.`
|
|
43847
|
+
});
|
|
43848
|
+
continue;
|
|
43849
|
+
}
|
|
43850
|
+
if (modules.length >= MODULE_LIMIT) {
|
|
43851
|
+
blocking.push({ ...at, message: `Mini app bundles at most ${MODULE_LIMIT} modules.` });
|
|
43852
|
+
continue;
|
|
43853
|
+
}
|
|
43854
|
+
modules.push({ file: target, source });
|
|
43855
|
+
}
|
|
43856
|
+
}
|
|
43857
|
+
return { modules, blocking };
|
|
43858
|
+
}
|
|
43859
|
+
var LOADER_JS = `
|
|
43860
|
+
var __cache = {};
|
|
43861
|
+
var __resolve = ${resolveModuleName};
|
|
43862
|
+
function __load(file) {
|
|
43863
|
+
var cached = __cache[file];
|
|
43864
|
+
if (cached) return cached.exports;
|
|
43865
|
+
var mod = __modules[file];
|
|
43866
|
+
if (!mod) throw new Error('Module not found: ' + file);
|
|
43867
|
+
var module = { exports: {} };
|
|
43868
|
+
__cache[file] = module;
|
|
43869
|
+
mod.call(module.exports, module.exports, function (spec) {
|
|
43870
|
+
var target = __resolve(spec);
|
|
43871
|
+
if (!target) throw new Error("Unsupported import '" + spec + "' in " + file);
|
|
43872
|
+
return __load(target);
|
|
43873
|
+
}, module);
|
|
43874
|
+
return module.exports;
|
|
43875
|
+
}
|
|
43876
|
+
__load(${JSON.stringify(APP_TS)});
|
|
43877
|
+
`;
|
|
43878
|
+
function emitBundle(modules) {
|
|
43879
|
+
const defs = modules.map((m) => `${JSON.stringify(m.file)}: function (exports, require, module) {
|
|
43880
|
+
${m.js}
|
|
43881
|
+
}`).join(",\n");
|
|
43882
|
+
return `(function () {
|
|
43883
|
+
var __modules = {
|
|
43884
|
+
${defs}
|
|
43885
|
+
};
|
|
43886
|
+
${LOADER_JS}})();
|
|
43887
|
+
`;
|
|
43888
|
+
}
|
|
43889
|
+
function typeCheckModules(appId, modules) {
|
|
43890
|
+
const dir = appDir(appId);
|
|
43794
43891
|
const options = {
|
|
43795
43892
|
noEmit: true,
|
|
43796
43893
|
target: ts.ScriptTarget.ES2020,
|
|
43797
|
-
module: ts.ModuleKind.
|
|
43894
|
+
module: ts.ModuleKind.ESNext,
|
|
43895
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler,
|
|
43896
|
+
allowImportingTsExtensions: true,
|
|
43798
43897
|
lib: ["lib.es2020.d.ts", "lib.dom.d.ts"],
|
|
43799
43898
|
strict: true,
|
|
43800
|
-
skipLibCheck: true
|
|
43899
|
+
skipLibCheck: true,
|
|
43900
|
+
types: []
|
|
43901
|
+
// hermetic — no ambient @types discovery from the host
|
|
43801
43902
|
};
|
|
43802
43903
|
const host = ts.createCompilerHost(options);
|
|
43803
43904
|
const origReadFile = host.readFile.bind(host);
|
|
43804
|
-
|
|
43805
|
-
host.readFile = (fname) => {
|
|
43806
|
-
if (fname === APP_TS) return source;
|
|
43807
|
-
if (fname === BRIDGE_DTS_FILE) return BRIDGE_DTS;
|
|
43808
|
-
return origReadFile(fname);
|
|
43809
|
-
};
|
|
43810
|
-
host.fileExists = (fname) => fname === APP_TS || fname === BRIDGE_DTS_FILE ? true : origFileExists(fname);
|
|
43905
|
+
host.readFile = (fname) => path5.basename(fname) === BRIDGE_DTS_FILE ? BRIDGE_DTS : origReadFile(fname);
|
|
43811
43906
|
host.writeFile = () => {
|
|
43812
43907
|
};
|
|
43813
|
-
const
|
|
43814
|
-
const
|
|
43815
|
-
|
|
43816
|
-
|
|
43908
|
+
const bridgePath = path5.join(dir, BRIDGE_DTS_FILE);
|
|
43909
|
+
const rootNames = [...modules.map((m) => path5.join(dir, m.file)), bridgePath];
|
|
43910
|
+
const program = ts.createProgram(rootNames, options, host);
|
|
43911
|
+
const out = [];
|
|
43912
|
+
for (const mod of modules) {
|
|
43913
|
+
const sf = program.getSourceFile(path5.join(dir, mod.file));
|
|
43914
|
+
if (!sf) continue;
|
|
43915
|
+
out.push(
|
|
43916
|
+
...[...program.getSyntacticDiagnostics(sf), ...program.getSemanticDiagnostics(sf)].map((d) => tsDiagnosticToFile(mod.file, d)).filter((d) => d !== null)
|
|
43917
|
+
);
|
|
43918
|
+
}
|
|
43919
|
+
return out;
|
|
43817
43920
|
}
|
|
43818
43921
|
function checkJsSyntax(js) {
|
|
43819
43922
|
try {
|
|
@@ -43839,17 +43942,26 @@ function compileAppJs(appId) {
|
|
|
43839
43942
|
const tsSource = readAppFile(appId, APP_TS);
|
|
43840
43943
|
let result;
|
|
43841
43944
|
if (tsSource.trim()) {
|
|
43842
|
-
const
|
|
43843
|
-
|
|
43844
|
-
|
|
43845
|
-
|
|
43846
|
-
|
|
43847
|
-
|
|
43848
|
-
|
|
43849
|
-
|
|
43850
|
-
|
|
43945
|
+
const { modules, blocking: graphDiags } = buildModuleGraph(appId);
|
|
43946
|
+
const transpiled = [];
|
|
43947
|
+
const syntaxDiags = [];
|
|
43948
|
+
for (const mod of modules) {
|
|
43949
|
+
const out = ts.transpileModule(mod.source, {
|
|
43950
|
+
compilerOptions: { target: ts.ScriptTarget.ES2020, module: ts.ModuleKind.CommonJS },
|
|
43951
|
+
reportDiagnostics: true,
|
|
43952
|
+
fileName: mod.file
|
|
43953
|
+
});
|
|
43954
|
+
for (const d of out.diagnostics ?? []) {
|
|
43955
|
+
const diag = tsDiagnosticToFile(mod.file, d);
|
|
43956
|
+
if (diag) syntaxDiags.push(diag);
|
|
43957
|
+
}
|
|
43958
|
+
transpiled.push({ file: mod.file, js: out.outputText });
|
|
43959
|
+
}
|
|
43960
|
+
const blocked = graphDiags.length > 0 || syntaxDiags.some((d) => d.severity === "error");
|
|
43961
|
+
result = blocked ? { js: "", sourceFile: "app.ts", diagnostics: [...graphDiags, ...syntaxDiags] } : {
|
|
43962
|
+
js: emitBundle(transpiled),
|
|
43851
43963
|
sourceFile: "app.ts",
|
|
43852
|
-
diagnostics:
|
|
43964
|
+
diagnostics: [...graphDiags, ...syntaxDiags, ...typeCheckModules(appId, modules)]
|
|
43853
43965
|
};
|
|
43854
43966
|
} else {
|
|
43855
43967
|
const js = readAppFile(appId, "app.js");
|
|
@@ -44159,7 +44271,7 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
44159
44271
|
try {
|
|
44160
44272
|
for (const entry of fs4.readdirSync(exRoot, { withFileTypes: true })) {
|
|
44161
44273
|
if (!entry.isDirectory() || !APP_ID_RE.test(entry.name)) continue;
|
|
44162
|
-
const manifest = readManifestIn(
|
|
44274
|
+
const manifest = readManifestIn(path6.join(exRoot, entry.name));
|
|
44163
44275
|
if (!manifest) continue;
|
|
44164
44276
|
out.push({
|
|
44165
44277
|
id: entry.name,
|
|
@@ -44180,7 +44292,7 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
44180
44292
|
if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
|
|
44181
44293
|
const exRoot = examplesRoot();
|
|
44182
44294
|
if (!exRoot) return reply.code(404).send({ error: "Examples catalog not available" });
|
|
44183
|
-
const src =
|
|
44295
|
+
const src = path6.join(exRoot, id);
|
|
44184
44296
|
if (!readManifestIn(src)) return reply.code(404).send({ error: "Example not found" });
|
|
44185
44297
|
if (readManifest(id)) return reply.code(409).send({ error: "App already installed" });
|
|
44186
44298
|
ensureAppsRoot();
|
|
@@ -44213,7 +44325,7 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
44213
44325
|
fs4.mkdirSync(dir, { recursive: true });
|
|
44214
44326
|
const cleanTitle2 = title.trim();
|
|
44215
44327
|
fs4.writeFileSync(
|
|
44216
|
-
|
|
44328
|
+
path6.join(dir, "manifest.json"),
|
|
44217
44329
|
JSON.stringify(
|
|
44218
44330
|
{
|
|
44219
44331
|
title: cleanTitle2,
|
|
@@ -44224,8 +44336,8 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
44224
44336
|
2
|
|
44225
44337
|
)
|
|
44226
44338
|
);
|
|
44227
|
-
fs4.writeFileSync(
|
|
44228
|
-
fs4.writeFileSync(
|
|
44339
|
+
fs4.writeFileSync(path6.join(dir, "index.html"), SKELETON_HTML.replaceAll("__TITLE__", cleanTitle2));
|
|
44340
|
+
fs4.writeFileSync(path6.join(dir, "app.ts"), SKELETON_TS);
|
|
44229
44341
|
return { ok: true, id };
|
|
44230
44342
|
}
|
|
44231
44343
|
);
|
|
@@ -44262,9 +44374,9 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
44262
44374
|
const dir = appDir(id);
|
|
44263
44375
|
fs4.mkdirSync(dir, { recursive: true });
|
|
44264
44376
|
if (!Object.hasOwn(files ?? {}, "manifest.json")) {
|
|
44265
|
-
fs4.writeFileSync(
|
|
44377
|
+
fs4.writeFileSync(path6.join(dir, "manifest.json"), JSON.stringify({ title: id }, null, 2));
|
|
44266
44378
|
}
|
|
44267
|
-
for (const [name, content] of entries) fs4.writeFileSync(
|
|
44379
|
+
for (const [name, content] of entries) fs4.writeFileSync(path6.join(dir, name), content);
|
|
44268
44380
|
return { ok: true, id };
|
|
44269
44381
|
}
|
|
44270
44382
|
);
|
|
@@ -44492,18 +44604,18 @@ function mapTokenUsage(data) {
|
|
|
44492
44604
|
|
|
44493
44605
|
// src/apps/register-mcp.ts
|
|
44494
44606
|
import fs5 from "node:fs";
|
|
44495
|
-
import
|
|
44607
|
+
import path7 from "node:path";
|
|
44496
44608
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
44497
44609
|
var MCP_SERVER_NAME = "agentpane-miniapps";
|
|
44498
44610
|
function panePublicUrl() {
|
|
44499
44611
|
return (process.env.AGENT_PANE_PUBLIC_URL || process.env.REPOBURG_DAEMON_URL || "http://localhost:9998").replace(/\/+$/, "");
|
|
44500
44612
|
}
|
|
44501
44613
|
function stdioScriptPath() {
|
|
44502
|
-
const here =
|
|
44614
|
+
const here = path7.dirname(fileURLToPath2(import.meta.url));
|
|
44503
44615
|
const candidates = [
|
|
44504
|
-
|
|
44616
|
+
path7.resolve(here, "../../scripts/miniapp-mcp-stdio.mjs"),
|
|
44505
44617
|
// src/apps/ → backend/scripts
|
|
44506
|
-
|
|
44618
|
+
path7.resolve(here, "../scripts/miniapp-mcp-stdio.mjs")
|
|
44507
44619
|
// dist bundle → backend/scripts
|
|
44508
44620
|
];
|
|
44509
44621
|
for (const candidate of candidates) {
|
|
@@ -45228,9 +45340,9 @@ function mapToolUse(block) {
|
|
|
45228
45340
|
};
|
|
45229
45341
|
}
|
|
45230
45342
|
function deriveFileChangeData(input, toolName) {
|
|
45231
|
-
const
|
|
45343
|
+
const path9 = input.file_path ?? input.notebook_path ?? "";
|
|
45232
45344
|
const kind = toolName === "Write" ? "add" : "modify";
|
|
45233
|
-
return { changes: [{ path:
|
|
45345
|
+
return { changes: [{ path: path9, kind }], status: "in_progress" };
|
|
45234
45346
|
}
|
|
45235
45347
|
function extractToolResultText(content) {
|
|
45236
45348
|
if (!content) return "";
|
|
@@ -46261,8 +46373,8 @@ var RepoburgHttpClient = class {
|
|
|
46261
46373
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
46262
46374
|
}
|
|
46263
46375
|
/** Perform a JSON request. Throws a concise error on non-OK/non-JSON responses. */
|
|
46264
|
-
async request(method,
|
|
46265
|
-
const response = await fetch(`${this.baseUrl}${
|
|
46376
|
+
async request(method, path9, body) {
|
|
46377
|
+
const response = await fetch(`${this.baseUrl}${path9}`, {
|
|
46266
46378
|
method,
|
|
46267
46379
|
headers: { "Content-Type": "application/json" },
|
|
46268
46380
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
@@ -46271,17 +46383,17 @@ var RepoburgHttpClient = class {
|
|
|
46271
46383
|
if (!response.ok) {
|
|
46272
46384
|
if (isHtml(text)) {
|
|
46273
46385
|
throw new Error(
|
|
46274
|
-
`${method} ${
|
|
46386
|
+
`${method} ${path9} failed: ${response.status} HTML response from ${this.baseUrl} \u2014 the URL points to the wrong server`
|
|
46275
46387
|
);
|
|
46276
46388
|
}
|
|
46277
|
-
throw new Error(`${method} ${
|
|
46389
|
+
throw new Error(`${method} ${path9} failed: ${response.status} ${text}`);
|
|
46278
46390
|
}
|
|
46279
46391
|
if (text.length === 0) return void 0;
|
|
46280
46392
|
try {
|
|
46281
46393
|
return JSON.parse(text);
|
|
46282
46394
|
} catch {
|
|
46283
46395
|
throw new Error(
|
|
46284
|
-
`${method} ${
|
|
46396
|
+
`${method} ${path9} failed: non-JSON response from ${this.baseUrl} \u2014 the URL points to the wrong server`
|
|
46285
46397
|
);
|
|
46286
46398
|
}
|
|
46287
46399
|
}
|
|
@@ -46336,7 +46448,7 @@ var RepoburgHttpClient = class {
|
|
|
46336
46448
|
};
|
|
46337
46449
|
|
|
46338
46450
|
// src/repoburg/backend-resolver.ts
|
|
46339
|
-
import
|
|
46451
|
+
import path8 from "node:path";
|
|
46340
46452
|
var HEALTH_POLL_INTERVAL_MS = 1e3;
|
|
46341
46453
|
var HEALTH_TIMEOUT_MS = 3e4;
|
|
46342
46454
|
function daemonBaseUrl() {
|
|
@@ -46391,7 +46503,7 @@ async function backendHealthy(baseUrl, expectedPath) {
|
|
|
46391
46503
|
const health = await fetchJson(`${baseUrl}/health`, void 0, 2e3);
|
|
46392
46504
|
if (health.status !== "ok") return false;
|
|
46393
46505
|
if (expectedPath && health.projectPath) {
|
|
46394
|
-
return
|
|
46506
|
+
return path8.resolve(health.projectPath) === path8.resolve(expectedPath);
|
|
46395
46507
|
}
|
|
46396
46508
|
return true;
|
|
46397
46509
|
} catch {
|
|
@@ -46412,7 +46524,7 @@ function serviceBaseUrl(service) {
|
|
|
46412
46524
|
return `http://localhost:${service.port}`;
|
|
46413
46525
|
}
|
|
46414
46526
|
function coveringService(services, absPath) {
|
|
46415
|
-
return services.filter((s) => absPath === s.path || absPath.startsWith(s.path +
|
|
46527
|
+
return services.filter((s) => absPath === s.path || absPath.startsWith(s.path + path8.sep)).sort((a, b) => b.path.length - a.path.length)[0];
|
|
46416
46528
|
}
|
|
46417
46529
|
async function restartService(daemon, name) {
|
|
46418
46530
|
try {
|
|
@@ -46448,7 +46560,7 @@ async function resolveBackendUrl(projectPath, opts = {}) {
|
|
|
46448
46560
|
if (envUrl) {
|
|
46449
46561
|
return { baseUrl: envUrl.replace(/\/+$/, ""), port: 0, name: "REPOBURG_BACKEND_URL" };
|
|
46450
46562
|
}
|
|
46451
|
-
const absPath =
|
|
46563
|
+
const absPath = path8.resolve(projectPath);
|
|
46452
46564
|
const daemon = daemonBaseUrl();
|
|
46453
46565
|
const cached = resolvedCache.get(absPath);
|
|
46454
46566
|
if (cached && await backendHealthy(cached.baseUrl, cached.servesPath ?? absPath)) {
|