@warlock.js/devtools 5.58.0 → 5.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/cjs/app-versions-C_ZyzuvD.cjs +138 -0
- package/cjs/app-versions-C_ZyzuvD.cjs.map +1 -0
- package/cjs/attach-D5aMqUnA.cjs +1342 -0
- package/cjs/attach-D5aMqUnA.cjs.map +1 -0
- package/cjs/{auth-DV2GA1A9.cjs → auth-ChHh5E7j.cjs} +20 -13
- package/cjs/auth-ChHh5E7j.cjs.map +1 -0
- package/cjs/{boot-CyeHPFtk.cjs → boot-Dg5YZGGR.cjs} +78 -14
- package/cjs/boot-Dg5YZGGR.cjs.map +1 -0
- package/cjs/{capture-DcyBhdqw.cjs → capture-CBgONYhk.cjs} +4 -4
- package/cjs/{capture-DcyBhdqw.cjs.map → capture-CBgONYhk.cjs.map} +1 -1
- package/cjs/{cascade-store-DEGxAFDI.cjs → cascade-store-DUT2Laha.cjs} +3 -3
- package/cjs/cascade-store-DUT2Laha.cjs.map +1 -0
- package/cjs/{current-request-id-BoJJb3y7.cjs → current-request-id-Badec-TH.cjs} +3 -3
- package/cjs/{current-request-id-BoJJb3y7.cjs.map → current-request-id-Badec-TH.cjs.map} +1 -1
- package/cjs/{errors-DEqdWaqm.cjs → errors-DNQ-g49I.cjs} +201 -4
- package/cjs/errors-DNQ-g49I.cjs.map +1 -0
- package/cjs/extract-8kaX_cUV.cjs +1103 -0
- package/cjs/extract-8kaX_cUV.cjs.map +1 -0
- package/cjs/{helpers-7k_Q-abk.cjs → helpers-BcMBFy9v.cjs} +9 -6
- package/cjs/{helpers-7k_Q-abk.cjs.map → helpers-BcMBFy9v.cjs.map} +1 -1
- package/cjs/{histogram-BRV5eHcp.cjs → histogram-CkoVizdf.cjs} +6 -6
- package/cjs/{histogram-BRV5eHcp.cjs.map → histogram-CkoVizdf.cjs.map} +1 -1
- package/cjs/{http-XNLYU2vS.cjs → http-DCVCf44M.cjs} +26 -9
- package/cjs/http-DCVCf44M.cjs.map +1 -0
- package/cjs/index.cjs +1 -1
- package/cjs/{insights-BBZnUpWO.cjs → insights-CFof59kF.cjs} +6 -6
- package/cjs/{insights-BBZnUpWO.cjs.map → insights-CFof59kF.cjs.map} +1 -1
- package/cjs/migrations-BQdNOL5_.cjs +30 -0
- package/cjs/migrations-BQdNOL5_.cjs.map +1 -0
- package/cjs/{migrations-DTTzCNpR.cjs → models-DF1agAm4.cjs} +107 -25
- package/cjs/models-DF1agAm4.cjs.map +1 -0
- package/cjs/{process-panel-DEOnLxoT.cjs → process-panel-D3D9Y_dc.cjs} +5 -5
- package/cjs/{process-panel-DEOnLxoT.cjs.map → process-panel-D3D9Y_dc.cjs.map} +1 -1
- package/cjs/production/index.cjs +4 -4
- package/cjs/runs-DECWPGnq.cjs +390 -0
- package/cjs/runs-DECWPGnq.cjs.map +1 -0
- package/cjs/{server-C8JfggQU.cjs → server-CC5DpObz.cjs} +10 -7
- package/cjs/server-CC5DpObz.cjs.map +1 -0
- package/cjs/{src-DjOUdhKc.cjs → src-VyOjEEAo.cjs} +179 -24
- package/cjs/src-VyOjEEAo.cjs.map +1 -0
- package/cjs/{store-C06KO_A1.cjs → store-EFn4wp0T.cjs} +2 -2
- package/cjs/{stream-route-D4k-sJvW.cjs → stream-route-DFHuIWgg.cjs} +125 -19
- package/cjs/stream-route-DFHuIWgg.cjs.map +1 -0
- package/esm/ai/attach.mjs +92 -0
- package/esm/ai/attach.mjs.map +1 -0
- package/esm/ai/options.mjs +31 -0
- package/esm/ai/options.mjs.map +1 -0
- package/esm/ai/reports/aggregate.mjs +330 -0
- package/esm/ai/reports/aggregate.mjs.map +1 -0
- package/esm/ai/reports/evaluate.mjs +108 -0
- package/esm/ai/reports/evaluate.mjs.map +1 -0
- package/esm/ai/reports/range.mjs +121 -0
- package/esm/ai/reports/range.mjs.map +1 -0
- package/esm/ai/reports/runs.d.mts +2 -0
- package/esm/ai/reports/runs.mjs +212 -0
- package/esm/ai/reports/runs.mjs.map +1 -0
- package/esm/ai/reports/service.mjs +132 -0
- package/esm/ai/reports/service.mjs.map +1 -0
- package/esm/ai/rollup/cascade-store.mjs +84 -0
- package/esm/ai/rollup/cascade-store.mjs.map +1 -0
- package/esm/ai/rollup/categories.mjs +67 -0
- package/esm/ai/rollup/categories.mjs.map +1 -0
- package/esm/ai/rollup/extract.mjs +225 -0
- package/esm/ai/rollup/extract.mjs.map +1 -0
- package/esm/ai/rollup/file-store.mjs +147 -0
- package/esm/ai/rollup/file-store.mjs.map +1 -0
- package/esm/ai/rollup/histogram.mjs +42 -0
- package/esm/ai/rollup/histogram.mjs.map +1 -0
- package/esm/ai/rollup/increment-error.mjs +19 -0
- package/esm/ai/rollup/increment-error.mjs.map +1 -0
- package/esm/ai/rollup/index.mjs +9 -0
- package/esm/ai/rollup/mapping.mjs +69 -0
- package/esm/ai/rollup/mapping.mjs.map +1 -0
- package/esm/ai/rollup/memory-store.mjs +26 -0
- package/esm/ai/rollup/memory-store.mjs.map +1 -0
- package/esm/ai/rollup/writer.mjs +113 -0
- package/esm/ai/rollup/writer.mjs.map +1 -0
- package/esm/ai/types.d.mts +29 -0
- package/esm/ai/types.d.mts.map +1 -0
- package/esm/app-versions.mjs +74 -0
- package/esm/app-versions.mjs.map +1 -0
- package/esm/devtools-connector.d.mts.map +1 -1
- package/esm/devtools-connector.mjs +54 -2
- package/esm/devtools-connector.mjs.map +1 -1
- package/esm/index.d.mts +3 -2
- package/esm/options.mjs +4 -0
- package/esm/options.mjs.map +1 -1
- package/esm/production/auth/helpers.mjs +8 -5
- package/esm/production/auth/helpers.mjs.map +1 -1
- package/esm/production/auth/service.mjs +14 -6
- package/esm/production/auth/service.mjs.map +1 -1
- package/esm/production/boot.mjs +70 -3
- package/esm/production/boot.mjs.map +1 -1
- package/esm/production/contracts.d.mts +378 -2
- package/esm/production/contracts.d.mts.map +1 -1
- package/esm/production/contracts.mjs +64 -2
- package/esm/production/contracts.mjs.map +1 -1
- package/esm/production/errors.d.mts +1 -1
- package/esm/production/errors.mjs +11 -3
- package/esm/production/errors.mjs.map +1 -1
- package/esm/production/http/access.mjs +6 -0
- package/esm/production/http/access.mjs.map +1 -1
- package/esm/production/http/mount.mjs +13 -0
- package/esm/production/http/mount.mjs.map +1 -1
- package/esm/production/http/share-session.mjs.map +1 -1
- package/esm/production/index.d.mts +2 -2
- package/esm/production/insights/writer.mjs.map +1 -1
- package/esm/production/options.d.mts +5 -1
- package/esm/production/options.d.mts.map +1 -1
- package/esm/production/options.mjs +13 -1
- package/esm/production/options.mjs.map +1 -1
- package/esm/production/store/memory-store.mjs.map +1 -1
- package/esm/production/store/migrations.d.mts +1 -1
- package/esm/production/store/migrations.d.mts.map +1 -1
- package/esm/production/store/migrations.mjs +4 -2
- package/esm/production/store/migrations.mjs.map +1 -1
- package/esm/production/store/models/ai-rollup.migration.mjs +48 -0
- package/esm/production/store/models/ai-rollup.migration.mjs.map +1 -0
- package/esm/production/store/models/ai-rollup.model.mjs +13 -0
- package/esm/production/store/models/ai-rollup.model.mjs.map +1 -0
- package/esm/production/store/models/index.mjs +3 -1
- package/esm/server/ai-report-routes.mjs +72 -0
- package/esm/server/ai-report-routes.mjs.map +1 -0
- package/esm/server/ai-routes.mjs +41 -6
- package/esm/server/ai-routes.mjs.map +1 -1
- package/esm/server/index.mjs +2 -0
- package/esm/server/index.mjs.map +1 -1
- package/esm/server/session-routes.mjs +3 -1
- package/esm/server/session-routes.mjs.map +1 -1
- package/esm/sources/agent-trace-source.d.mts.map +1 -1
- package/esm/sources/agent-trace-source.mjs.map +1 -1
- package/esm/sources/ai-source.d.mts +2 -0
- package/esm/sources/ai-source.d.mts.map +1 -1
- package/esm/sources/ai-source.mjs +120 -11
- package/esm/sources/ai-source.mjs.map +1 -1
- package/esm/types.d.mts +23 -4
- package/esm/types.d.mts.map +1 -1
- package/llms-full.txt +79 -32
- package/package.json +8 -8
- package/skills/SKILL.md +79 -32
- package/ui/dashboard/assets/app.css +1 -1
- package/ui/dashboard/assets/app.js +23 -16
- package/ui/dashboard/build-info.json +7 -7
- package/cjs/ai-source-DTpxumMA.cjs +0 -381
- package/cjs/ai-source-DTpxumMA.cjs.map +0 -1
- package/cjs/auth-DV2GA1A9.cjs.map +0 -1
- package/cjs/boot-CyeHPFtk.cjs.map +0 -1
- package/cjs/cascade-store-DEGxAFDI.cjs.map +0 -1
- package/cjs/contracts-CDuY-ahl.cjs +0 -116
- package/cjs/contracts-CDuY-ahl.cjs.map +0 -1
- package/cjs/errors-DEqdWaqm.cjs.map +0 -1
- package/cjs/http-XNLYU2vS.cjs.map +0 -1
- package/cjs/migrations-DTTzCNpR.cjs.map +0 -1
- package/cjs/options-CHhmQJic.cjs +0 -193
- package/cjs/options-CHhmQJic.cjs.map +0 -1
- package/cjs/panels-CHd20RK5.cjs +0 -385
- package/cjs/panels-CHd20RK5.cjs.map +0 -1
- package/cjs/rolldown-runtime-Zuuoy_Rh.cjs +0 -52
- package/cjs/server-C8JfggQU.cjs.map +0 -1
- package/cjs/src-DjOUdhKc.cjs.map +0 -1
- package/cjs/stream-route-D4k-sJvW.cjs.map +0 -1
package/cjs/panels-CHd20RK5.cjs
DELETED
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-Zuuoy_Rh.cjs");
|
|
2
|
-
const require_contracts = require("./contracts-CDuY-ahl.cjs");
|
|
3
|
-
let node_fs = require("node:fs");
|
|
4
|
-
let node_module = require("node:module");
|
|
5
|
-
let node_path = require("node:path");
|
|
6
|
-
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
7
|
-
let node_url = require("node:url");
|
|
8
|
-
|
|
9
|
-
//#region ../../packages/devtools/src/panels.ts
|
|
10
|
-
/** The extensions a panel serves from `files` when it lists none. */
|
|
11
|
-
const DEFAULT_PANEL_FILE_EXTENSIONS = [
|
|
12
|
-
".png",
|
|
13
|
-
".jpg",
|
|
14
|
-
".jpeg",
|
|
15
|
-
".webp",
|
|
16
|
-
".gif"
|
|
17
|
-
];
|
|
18
|
-
/** Extensions a panel may never serve from `files`: a browser runs or renders them as a page. */
|
|
19
|
-
const BLOCKED_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
20
|
-
".svg",
|
|
21
|
-
".html",
|
|
22
|
-
".htm",
|
|
23
|
-
".js",
|
|
24
|
-
".mjs"
|
|
25
|
-
]);
|
|
26
|
-
/**
|
|
27
|
-
* Ids the dashboard already uses for its own tabs, API segments and URLs. A
|
|
28
|
-
* panel's routes live under `<path>/api/<id>`, so these would collide.
|
|
29
|
-
*/
|
|
30
|
-
const RESERVED_PANEL_IDS = /* @__PURE__ */ new Set([
|
|
31
|
-
"account",
|
|
32
|
-
"admin",
|
|
33
|
-
"agents",
|
|
34
|
-
"ai",
|
|
35
|
-
"api",
|
|
36
|
-
"assets",
|
|
37
|
-
"auth",
|
|
38
|
-
"background",
|
|
39
|
-
"docs",
|
|
40
|
-
"errors",
|
|
41
|
-
"health",
|
|
42
|
-
"instances",
|
|
43
|
-
"jobs",
|
|
44
|
-
"logs",
|
|
45
|
-
"mail",
|
|
46
|
-
"mails",
|
|
47
|
-
"panels",
|
|
48
|
-
"queries",
|
|
49
|
-
"requests",
|
|
50
|
-
"resources",
|
|
51
|
-
"routes",
|
|
52
|
-
"share",
|
|
53
|
-
"stream"
|
|
54
|
-
]);
|
|
55
|
-
const PANEL_ID = /^[a-z][a-z0-9-]*$/;
|
|
56
|
-
const ASSET_NAME = /^[A-Za-z0-9_][A-Za-z0-9._-]*$/;
|
|
57
|
-
const METHODS = /* @__PURE__ */ new Set([
|
|
58
|
-
"GET",
|
|
59
|
-
"POST",
|
|
60
|
-
"PUT",
|
|
61
|
-
"PATCH",
|
|
62
|
-
"DELETE"
|
|
63
|
-
]);
|
|
64
|
-
/** Content types for the files a panel may serve; anything else is sent as bytes. */
|
|
65
|
-
const CONTENT_TYPES = {
|
|
66
|
-
".js": "text/javascript; charset=utf-8",
|
|
67
|
-
".mjs": "text/javascript; charset=utf-8",
|
|
68
|
-
".css": "text/css; charset=utf-8",
|
|
69
|
-
".json": "application/json; charset=utf-8",
|
|
70
|
-
".svg": "image/svg+xml",
|
|
71
|
-
".png": "image/png",
|
|
72
|
-
".jpg": "image/jpeg",
|
|
73
|
-
".jpeg": "image/jpeg",
|
|
74
|
-
".webp": "image/webp",
|
|
75
|
-
".gif": "image/gif",
|
|
76
|
-
".woff2": "font/woff2"
|
|
77
|
-
};
|
|
78
|
-
/** The content type a panel file is served with, from its served name. */
|
|
79
|
-
function panelContentType(name) {
|
|
80
|
-
return CONTENT_TYPES[node_path.default.extname(name).toLowerCase()] ?? "application/octet-stream";
|
|
81
|
-
}
|
|
82
|
-
/** An absolute file path from a path or `file:` URL, or `undefined` for anything else. */
|
|
83
|
-
function toFilePath(value) {
|
|
84
|
-
if (value instanceof URL) return value.protocol === "file:" ? (0, node_url.fileURLToPath)(value) : void 0;
|
|
85
|
-
if (typeof value !== "string" || value === "") return void 0;
|
|
86
|
-
if (value.startsWith("file:")) return (0, node_url.fileURLToPath)(value);
|
|
87
|
-
return node_path.default.isAbsolute(value) ? value : void 0;
|
|
88
|
-
}
|
|
89
|
-
function isFile(file) {
|
|
90
|
-
return (0, node_fs.existsSync)(file) && (0, node_fs.statSync)(file).isFile();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Validates `value` as a panel and returns it ready to mount. Throws an
|
|
94
|
-
* error that names the panel and what to change; `taken` maps the ids
|
|
95
|
-
* already registered to their titles and receives this panel's id.
|
|
96
|
-
*/
|
|
97
|
-
function checkDevtoolsPanel(value, taken) {
|
|
98
|
-
const panel = value ?? {};
|
|
99
|
-
const id = panel.id;
|
|
100
|
-
if (typeof id !== "string" || !PANEL_ID.test(id)) throw new Error(`A devtools panel needs an "id" of lower-case letters, digits and dashes that starts with a letter; got ${JSON.stringify(id)}.`);
|
|
101
|
-
if (RESERVED_PANEL_IDS.has(id)) throw new Error(`Devtools panel id "${id}" is used by the dashboard itself; give the panel another id.`);
|
|
102
|
-
const existing = taken.get(id);
|
|
103
|
-
if (existing !== void 0) throw new Error(`Devtools panel id "${id}" is already registered by the "${existing}" panel; each panel needs its own id.`);
|
|
104
|
-
if (typeof panel.title !== "string" || panel.title.trim() === "") throw new Error(`Devtools panel "${id}" needs a "title" for its tab.`);
|
|
105
|
-
const view = toFilePath(panel.view);
|
|
106
|
-
if (view === void 0) throw new Error(`Devtools panel "${id}" needs a "view": an absolute path or file: URL of its browser module.`);
|
|
107
|
-
if (!isFile(view)) throw new Error(`The view module of devtools panel "${id}" was not found at ${view}.`);
|
|
108
|
-
const seen = /* @__PURE__ */ new Set();
|
|
109
|
-
const routes = (panel.routes ?? []).map((route) => {
|
|
110
|
-
const method = route.method ?? "GET";
|
|
111
|
-
if (!METHODS.has(method)) throw new Error(`Devtools panel "${id}" has a route with method "${String(method)}"; use GET, POST, PUT, PATCH or DELETE.`);
|
|
112
|
-
if (typeof route.path !== "string" || route.path !== "" && !route.path.startsWith("/")) throw new Error(`Devtools panel "${id}" has a route path ${JSON.stringify(route.path)}; use "" or a path starting with "/".`);
|
|
113
|
-
if (typeof route.handler !== "function") throw new Error(`Devtools panel "${id}" route ${method} "${route.path}" has no handler.`);
|
|
114
|
-
if (seen.has(`${method} ${route.path}`)) throw new Error(`Devtools panel "${id}" lists route ${method} "${route.path}" twice; keep one.`);
|
|
115
|
-
seen.add(`${method} ${route.path}`);
|
|
116
|
-
return {
|
|
117
|
-
...route,
|
|
118
|
-
method
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
const assets = {};
|
|
122
|
-
for (const [name, source] of Object.entries(panel.assets ?? {})) {
|
|
123
|
-
if (!ASSET_NAME.test(name) || name === "view.js") throw new Error(`Devtools panel "${id}" has an asset named ${JSON.stringify(name)}; use a plain file name other than "view.js".`);
|
|
124
|
-
const file = toFilePath(source);
|
|
125
|
-
if (file === void 0 || !isFile(file)) throw new Error(`The asset "${name}" of devtools panel "${id}" was not found at ${String(source)}; give an absolute path or file: URL.`);
|
|
126
|
-
assets[name] = file;
|
|
127
|
-
}
|
|
128
|
-
const files = checkPanelFiles(id, panel.files);
|
|
129
|
-
const share = checkPanelShare(id, panel.share, routes, assets, files !== null);
|
|
130
|
-
taken.set(id, panel.title);
|
|
131
|
-
return {
|
|
132
|
-
id,
|
|
133
|
-
title: panel.title,
|
|
134
|
-
view,
|
|
135
|
-
routes,
|
|
136
|
-
assets,
|
|
137
|
-
files,
|
|
138
|
-
share,
|
|
139
|
-
production: panel.production === true
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
const FILE_EXTENSION = /^\.[a-z0-9]{1,16}$/;
|
|
143
|
-
/** Validates `files`; `null` when the panel declares none. */
|
|
144
|
-
function checkPanelFiles(id, value) {
|
|
145
|
-
if (value === void 0 || value === null) return null;
|
|
146
|
-
if (typeof value !== "object") throw new Error(`Devtools panel "${id}" has files that is not an object; use { dir: "/absolute/folder" }.`);
|
|
147
|
-
const dir = toFilePath(value.dir);
|
|
148
|
-
if (dir === void 0) throw new Error(`Devtools panel "${id}" needs files.dir to be an absolute path or a file: URL; got ${String(value.dir)}.`);
|
|
149
|
-
const given = value.extensions;
|
|
150
|
-
if (given !== void 0 && (!Array.isArray(given) || given.length === 0)) throw new Error(`Devtools panel "${id}" has files.extensions that is not a list; use [".png", ".jpg"] or leave it out.`);
|
|
151
|
-
for (const extension of given ?? []) {
|
|
152
|
-
if (typeof extension !== "string" || !FILE_EXTENSION.test(extension)) throw new Error(`Devtools panel "${id}" has files.extensions entry ${JSON.stringify(extension)}; use lower-case extensions that start with a dot, such as ".png".`);
|
|
153
|
-
if (BLOCKED_FILE_EXTENSIONS.has(extension)) throw new Error(`Devtools panel "${id}" lists files.extensions entry "${extension}", which can run as a page or script in the browser; remove it (images such as .png, .jpg, .webp and .gif are fine).`);
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
dir,
|
|
157
|
-
extensions: [...given ?? DEFAULT_PANEL_FILE_EXTENSIONS]
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
/** Validates `share` against the panel's own routes, assets and files. */
|
|
161
|
-
function checkPanelShare(id, value, routes, assets, hasFiles) {
|
|
162
|
-
if (value === void 0 || value === null) return null;
|
|
163
|
-
if (typeof value !== "object") throw new Error(`Devtools panel "${id}" has share that is not an object; use { view, routes }.`);
|
|
164
|
-
const view = toFilePath(value.view);
|
|
165
|
-
if (view === void 0) throw new Error(`Devtools panel "${id}" needs share.view: an absolute path or file: URL of the shared view module.`);
|
|
166
|
-
if (!isFile(view)) throw new Error(`The share.view module of devtools panel "${id}" was not found at ${view}.`);
|
|
167
|
-
if (!Array.isArray(value.routes)) throw new Error(`Devtools panel "${id}" needs share.routes: a list of the paths of its GET routes the shared page may call.`);
|
|
168
|
-
const getPaths = routes.filter((route) => route.method === "GET").map((route) => route.path);
|
|
169
|
-
for (const route of value.routes) if (typeof route !== "string" || !getPaths.includes(route)) throw new Error(`Devtools panel "${id}" lists share.routes entry ${JSON.stringify(route)}, which is not the path of one of its GET routes${getPaths.length > 0 ? `; use one of ${getPaths.map((path) => JSON.stringify(path)).join(", ")}` : " (the panel has no GET routes)"}.`);
|
|
170
|
-
for (const name of value.assets ?? []) if (typeof name !== "string" || !Object.hasOwn(assets, name)) throw new Error(`Devtools panel "${id}" lists share.assets entry ${JSON.stringify(name)}, which is not a name in its assets; use one of ${Object.keys(assets).join(", ") || "(the panel has no assets)"}.`);
|
|
171
|
-
const files = value.files === true;
|
|
172
|
-
if (value.files !== void 0 && typeof value.files !== "boolean") throw new Error(`Devtools panel "${id}" needs share.files to be true or false.`);
|
|
173
|
-
if (files && !hasFiles) throw new Error(`Devtools panel "${id}" sets share.files, but the panel has no files folder; add files: { dir } or remove share.files.`);
|
|
174
|
-
return {
|
|
175
|
-
view,
|
|
176
|
-
routes: [...value.routes],
|
|
177
|
-
assets: [...value.assets ?? []],
|
|
178
|
-
files
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
/** Validates a list of panels; the first invalid or duplicate one throws. */
|
|
182
|
-
function checkDevtoolsPanels(panels) {
|
|
183
|
-
const taken = /* @__PURE__ */ new Map();
|
|
184
|
-
return panels.map((panel) => checkDevtoolsPanel(panel, taken));
|
|
185
|
-
}
|
|
186
|
-
function isPlainObject(value) {
|
|
187
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
188
|
-
const prototype = Object.getPrototypeOf(value);
|
|
189
|
-
return prototype === Object.prototype || prototype === null;
|
|
190
|
-
}
|
|
191
|
-
/** What is wrong with a `[specifier, options]` entry, or `undefined` when it is valid. */
|
|
192
|
-
function tupleProblem(entry) {
|
|
193
|
-
if (entry.length !== 2) return `it has ${entry.length} item(s); use exactly [specifier, options]`;
|
|
194
|
-
if (typeof entry[0] !== "string" || entry[0] === "") return `its first item is ${JSON.stringify(entry[0])}; use the module specifier as a string`;
|
|
195
|
-
if (!isPlainObject(entry[1])) return `its second item is not a plain object; pass the options as { name: value }`;
|
|
196
|
-
}
|
|
197
|
-
/** The URL or specifier to import for a `panels` entry. */
|
|
198
|
-
function resolvePanelSpecifier(entry, root) {
|
|
199
|
-
if (entry.startsWith("./") || entry.startsWith("../") || node_path.default.isAbsolute(entry)) return (0, node_url.pathToFileURL)(node_path.default.resolve(root, entry)).href;
|
|
200
|
-
return resolveFromNodeModules(entry, root) ?? resolveWithRequire(entry, root) ?? entry;
|
|
201
|
-
}
|
|
202
|
-
/** Picks the file an `exports` target names: `import`, then `default`, then `node`. */
|
|
203
|
-
function exportTarget(target) {
|
|
204
|
-
if (typeof target === "string") return target;
|
|
205
|
-
if (Array.isArray(target)) {
|
|
206
|
-
for (const item of target) {
|
|
207
|
-
const found = exportTarget(item);
|
|
208
|
-
if (found !== void 0) return found;
|
|
209
|
-
}
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
if (target !== null && typeof target === "object") {
|
|
213
|
-
const conditions = target;
|
|
214
|
-
for (const condition of [
|
|
215
|
-
"import",
|
|
216
|
-
"node",
|
|
217
|
-
"default"
|
|
218
|
-
]) {
|
|
219
|
-
const found = exportTarget(conditions[condition]);
|
|
220
|
-
if (found !== void 0) return found;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Resolves a package specifier by looking it up in the `node_modules` folders
|
|
226
|
-
* above the app root and reading its `exports` map. `createRequire().resolve`
|
|
227
|
-
* cannot do this for a package that only has an `import` condition.
|
|
228
|
-
*/
|
|
229
|
-
function resolveFromNodeModules(entry, root) {
|
|
230
|
-
const parts = entry.split("/");
|
|
231
|
-
const nameLength = entry.startsWith("@") ? 2 : 1;
|
|
232
|
-
const name = parts.slice(0, nameLength).join("/");
|
|
233
|
-
const subpath = parts.length > nameLength ? `./${parts.slice(nameLength).join("/")}` : ".";
|
|
234
|
-
if (!name) return void 0;
|
|
235
|
-
let directory = node_path.default.resolve(root);
|
|
236
|
-
for (;;) {
|
|
237
|
-
const packageDirectory = node_path.default.join(directory, "node_modules", name);
|
|
238
|
-
const manifestFile = node_path.default.join(packageDirectory, "package.json");
|
|
239
|
-
if ((0, node_fs.existsSync)(manifestFile)) try {
|
|
240
|
-
const manifest = JSON.parse((0, node_fs.readFileSync)(manifestFile, "utf8"));
|
|
241
|
-
const exported = manifest.exports;
|
|
242
|
-
const map = exported !== null && typeof exported === "object" && !Array.isArray(exported) ? exported : void 0;
|
|
243
|
-
const hasSubpaths = map !== void 0 && Object.keys(map).some((key) => key.startsWith("."));
|
|
244
|
-
const target = exported === void 0 ? subpath === "." ? manifest.main ?? "index.js" : subpath : hasSubpaths ? exportTarget(map?.[subpath]) : subpath === "." ? exportTarget(exported) : void 0;
|
|
245
|
-
if (target === void 0) return void 0;
|
|
246
|
-
const file = node_path.default.resolve(packageDirectory, target);
|
|
247
|
-
return isFile(file) ? (0, node_url.pathToFileURL)(file).href : void 0;
|
|
248
|
-
} catch {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const parent = node_path.default.dirname(directory);
|
|
252
|
-
if (parent === directory) return void 0;
|
|
253
|
-
directory = parent;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
/** The `require` resolution, for packages the `node_modules` lookup does not understand. */
|
|
257
|
-
function resolveWithRequire(entry, root) {
|
|
258
|
-
try {
|
|
259
|
-
return (0, node_url.pathToFileURL)((0, node_module.createRequire)(node_path.default.join(root, "package.json")).resolve(entry)).href;
|
|
260
|
-
} catch {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/** The panels a module's default export describes. */
|
|
265
|
-
async function panelsOf(exported, root, mode, panelOptions = {}, errors) {
|
|
266
|
-
const value = typeof exported === "function" ? await exported({
|
|
267
|
-
...panelOptions,
|
|
268
|
-
root,
|
|
269
|
-
mode,
|
|
270
|
-
...errors ? { errors } : {}
|
|
271
|
-
}) : exported;
|
|
272
|
-
return Array.isArray(value) ? value : [value];
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Loads the devtools `panels` option: imports each module entry, reads its
|
|
276
|
-
* default export, and validates every panel. An entry that fails to load and
|
|
277
|
-
* a panel that is invalid or reuses an id are reported through `warn` and
|
|
278
|
-
* skipped, so one broken panel never stops the dashboard.
|
|
279
|
-
*/
|
|
280
|
-
async function loadDevtoolsPanels(entries, options) {
|
|
281
|
-
if (!Array.isArray(entries)) {
|
|
282
|
-
options.warn(`The devtools "panels" option must be a list, such as panels: ["@warlock.js/grimoire/devtools"]; got ${JSON.stringify(entries)}. No panel was added.`);
|
|
283
|
-
return [];
|
|
284
|
-
}
|
|
285
|
-
const importModule = options.importModule ?? ((specifier) => import(specifier));
|
|
286
|
-
const mode = options.mode ?? "development";
|
|
287
|
-
const taken = new Map(options.taken ?? []);
|
|
288
|
-
const panels = [];
|
|
289
|
-
for (const entry of entries) {
|
|
290
|
-
let candidates;
|
|
291
|
-
try {
|
|
292
|
-
if (Array.isArray(entry)) {
|
|
293
|
-
const problem = tupleProblem(entry);
|
|
294
|
-
if (problem !== void 0) {
|
|
295
|
-
options.warn(`Devtools panels entry ${JSON.stringify(entry)} is invalid: ${problem}. Example: ["@warlock.js/grimoire/devtools", { ttlMs: 60000 }]. The entry was not added.`);
|
|
296
|
-
continue;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
if (typeof entry === "string" || Array.isArray(entry)) {
|
|
300
|
-
const [specifier, panelOptions] = typeof entry === "string" ? [entry, void 0] : entry;
|
|
301
|
-
const module = await importModule(resolvePanelSpecifier(specifier, options.root));
|
|
302
|
-
if (module.default === void 0) throw new Error("the module has no default export");
|
|
303
|
-
candidates = await panelsOf(module.default, options.root, mode, panelOptions, options.errors);
|
|
304
|
-
} else candidates = [entry];
|
|
305
|
-
} catch (error) {
|
|
306
|
-
options.warn(`Devtools panel module "${String(Array.isArray(entry) ? entry[0] : entry)}" could not be loaded: ${describe(error)}. Check that it is installed and listed correctly in the devtools "panels" option.`);
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
for (const candidate of candidates) try {
|
|
310
|
-
panels.push(checkDevtoolsPanel(candidate, taken));
|
|
311
|
-
} catch (error) {
|
|
312
|
-
options.warn(`${describe(error)} The panel was not added.`);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return panels;
|
|
316
|
-
}
|
|
317
|
-
function describe(error) {
|
|
318
|
-
return error instanceof Error ? error.message : String(error);
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Which tabs the production monitor shows. A built-in tab follows
|
|
322
|
-
* `DEVTOOLS_BUILT_IN_PANELS` unless `overrides[id]` says otherwise. A package
|
|
323
|
-
* panel (the Processes panel included) shows when it declares
|
|
324
|
-
* `production: true` or `overrides[id]` is `true`; `overrides[id]: false` turns
|
|
325
|
-
* any tab off.
|
|
326
|
-
*/
|
|
327
|
-
function productionPanels(packagePanels, overrides = {}) {
|
|
328
|
-
return {
|
|
329
|
-
builtIn: require_contracts.DEVTOOLS_BUILT_IN_PANELS.filter((tab) => overrides[tab.id] ?? tab.production).map((tab) => tab.id),
|
|
330
|
-
panels: packagePanels.filter((panel) => overrides[panel.id] ?? panel.production)
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* The tab list `GET api/panels` answers with: the built-in tabs in
|
|
335
|
-
* `builtIn` (default: every one), in display order, then the package panels
|
|
336
|
-
* in registration order.
|
|
337
|
-
*/
|
|
338
|
-
function listPanelInfos(panels, builtIn) {
|
|
339
|
-
const tabs = require_contracts.DEVTOOLS_BUILT_IN_PANELS.filter((tab) => builtIn === void 0 || builtIn.includes(tab.id)).map((tab) => ({
|
|
340
|
-
id: tab.id,
|
|
341
|
-
title: tab.title,
|
|
342
|
-
type: "built-in",
|
|
343
|
-
shareable: false
|
|
344
|
-
}));
|
|
345
|
-
for (const panel of panels) tabs.push({
|
|
346
|
-
id: panel.id,
|
|
347
|
-
title: panel.title,
|
|
348
|
-
type: "package",
|
|
349
|
-
shareable: panel.share !== void 0 && panel.share !== null
|
|
350
|
-
});
|
|
351
|
-
return tabs;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
//#endregion
|
|
355
|
-
Object.defineProperty(exports, "checkDevtoolsPanels", {
|
|
356
|
-
enumerable: true,
|
|
357
|
-
get: function () {
|
|
358
|
-
return checkDevtoolsPanels;
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
Object.defineProperty(exports, "listPanelInfos", {
|
|
362
|
-
enumerable: true,
|
|
363
|
-
get: function () {
|
|
364
|
-
return listPanelInfos;
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
Object.defineProperty(exports, "loadDevtoolsPanels", {
|
|
368
|
-
enumerable: true,
|
|
369
|
-
get: function () {
|
|
370
|
-
return loadDevtoolsPanels;
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
Object.defineProperty(exports, "panelContentType", {
|
|
374
|
-
enumerable: true,
|
|
375
|
-
get: function () {
|
|
376
|
-
return panelContentType;
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
Object.defineProperty(exports, "productionPanels", {
|
|
380
|
-
enumerable: true,
|
|
381
|
-
get: function () {
|
|
382
|
-
return productionPanels;
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
//# sourceMappingURL=panels-CHd20RK5.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"panels-CHd20RK5.cjs","names":["path","fileURLToPath","existsSync","statSync","pathToFileURL","readFileSync","createRequire","DEVTOOLS_BUILT_IN_PANELS"],"sources":["../../../../../../../packages/devtools/src/panels.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { DEVTOOLS_BUILT_IN_PANELS } from \"./production/contracts\";\nimport type { DevtoolsMode, DevtoolsPanelInfo } from \"./production/contracts\";\nimport type {\n DevtoolsPanel,\n DevtoolsPanelEntry,\n DevtoolsPanelErrorSummary,\n DevtoolsPanelExport,\n DevtoolsPanelMethod,\n DevtoolsPanelRoute,\n} from \"./types\";\n\n/**\n * A validated panel: file paths are absolute strings and every list is\n * present, so the server never re-checks them per request.\n */\nexport type MountedDevtoolsPanel = {\n id: string;\n title: string;\n view: string;\n routes: readonly (DevtoolsPanelRoute & { method: DevtoolsPanelMethod })[];\n assets: Readonly<Record<string, string>>;\n /** The folder of images the panel serves; `null` when it declared none. */\n files: MountedPanelFiles | null;\n /** What a read-only share link of the panel opens; `null` when the panel cannot be shared. */\n share: MountedPanelShare | null;\n /** Whether the panel declared itself safe for the production monitor. */\n production: boolean;\n};\n\n/** A panel's folder of images, validated: an absolute directory and lower-case extensions. */\nexport type MountedPanelFiles = {\n dir: string;\n extensions: readonly string[];\n};\n\n/** A panel's shared view, validated. */\nexport type MountedPanelShare = {\n /** Absolute path of the shared view module. */\n view: string;\n /** Paths of the GET routes the shared page may call. */\n routes: readonly string[];\n /** Served names from `assets` the shared page may load. */\n assets: readonly string[];\n /** Whether the shared page may load images from `files`. */\n files: boolean;\n};\n\n/** The extensions a panel serves from `files` when it lists none. */\nexport const DEFAULT_PANEL_FILE_EXTENSIONS: readonly string[] = [\n \".png\",\n \".jpg\",\n \".jpeg\",\n \".webp\",\n \".gif\",\n];\n\n/** Extensions a panel may never serve from `files`: a browser runs or renders them as a page. */\nconst BLOCKED_FILE_EXTENSIONS = new Set([\".svg\", \".html\", \".htm\", \".js\", \".mjs\"]);\n\n/**\n * Ids the dashboard already uses for its own tabs, API segments and URLs. A\n * panel's routes live under `<path>/api/<id>`, so these would collide.\n */\nconst RESERVED_PANEL_IDS = new Set([\n \"account\",\n \"admin\",\n \"agents\",\n \"ai\",\n \"api\",\n \"assets\",\n \"auth\",\n \"background\",\n \"docs\",\n \"errors\",\n \"health\",\n \"instances\",\n \"jobs\",\n \"logs\",\n \"mail\",\n \"mails\",\n \"panels\",\n \"queries\",\n \"requests\",\n \"resources\",\n \"routes\",\n \"share\",\n \"stream\",\n]);\n\nconst PANEL_ID = /^[a-z][a-z0-9-]*$/;\nconst ASSET_NAME = /^[A-Za-z0-9_][A-Za-z0-9._-]*$/;\nconst METHODS = new Set<DevtoolsPanelMethod>([\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"]);\n\n/** Content types for the files a panel may serve; anything else is sent as bytes. */\nconst CONTENT_TYPES: Record<string, string> = {\n \".js\": \"text/javascript; charset=utf-8\",\n \".mjs\": \"text/javascript; charset=utf-8\",\n \".css\": \"text/css; charset=utf-8\",\n \".json\": \"application/json; charset=utf-8\",\n \".svg\": \"image/svg+xml\",\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".webp\": \"image/webp\",\n \".gif\": \"image/gif\",\n \".woff2\": \"font/woff2\",\n};\n\n/** The content type a panel file is served with, from its served name. */\nexport function panelContentType(name: string): string {\n return CONTENT_TYPES[path.extname(name).toLowerCase()] ?? \"application/octet-stream\";\n}\n\n/** An absolute file path from a path or `file:` URL, or `undefined` for anything else. */\nfunction toFilePath(value: unknown): string | undefined {\n if (value instanceof URL) return value.protocol === \"file:\" ? fileURLToPath(value) : undefined;\n if (typeof value !== \"string\" || value === \"\") return undefined;\n if (value.startsWith(\"file:\")) return fileURLToPath(value);\n\n return path.isAbsolute(value) ? value : undefined;\n}\n\nfunction isFile(file: string): boolean {\n return existsSync(file) && statSync(file).isFile();\n}\n\n/**\n * Validates `value` as a panel and returns it ready to mount. Throws an\n * error that names the panel and what to change; `taken` maps the ids\n * already registered to their titles and receives this panel's id.\n */\nexport function checkDevtoolsPanel(\n value: unknown,\n taken: Map<string, string>,\n): MountedDevtoolsPanel {\n const panel = (value ?? {}) as Partial<DevtoolsPanel>;\n const id = panel.id;\n\n if (typeof id !== \"string\" || !PANEL_ID.test(id)) {\n throw new Error(\n `A devtools panel needs an \"id\" of lower-case letters, digits and dashes that starts with a letter; got ${JSON.stringify(id)}.`,\n );\n }\n\n if (RESERVED_PANEL_IDS.has(id)) {\n throw new Error(\n `Devtools panel id \"${id}\" is used by the dashboard itself; give the panel another id.`,\n );\n }\n\n const existing = taken.get(id);\n\n if (existing !== undefined) {\n throw new Error(\n `Devtools panel id \"${id}\" is already registered by the \"${existing}\" panel; each panel needs its own id.`,\n );\n }\n\n if (typeof panel.title !== \"string\" || panel.title.trim() === \"\") {\n throw new Error(`Devtools panel \"${id}\" needs a \"title\" for its tab.`);\n }\n\n const view = toFilePath(panel.view);\n\n if (view === undefined) {\n throw new Error(\n `Devtools panel \"${id}\" needs a \"view\": an absolute path or file: URL of its browser module.`,\n );\n }\n\n if (!isFile(view)) {\n throw new Error(`The view module of devtools panel \"${id}\" was not found at ${view}.`);\n }\n\n // Two routes on one method and path would make the server refuse to start.\n const seen = new Set<string>();\n const routes = (panel.routes ?? []).map((route) => {\n const method = route.method ?? \"GET\";\n\n if (!METHODS.has(method)) {\n throw new Error(\n `Devtools panel \"${id}\" has a route with method \"${String(method)}\"; use GET, POST, PUT, PATCH or DELETE.`,\n );\n }\n\n if (typeof route.path !== \"string\" || (route.path !== \"\" && !route.path.startsWith(\"/\"))) {\n throw new Error(\n `Devtools panel \"${id}\" has a route path ${JSON.stringify(route.path)}; use \"\" or a path starting with \"/\".`,\n );\n }\n\n if (typeof route.handler !== \"function\") {\n throw new Error(`Devtools panel \"${id}\" route ${method} \"${route.path}\" has no handler.`);\n }\n\n if (seen.has(`${method} ${route.path}`)) {\n throw new Error(\n `Devtools panel \"${id}\" lists route ${method} \"${route.path}\" twice; keep one.`,\n );\n }\n\n seen.add(`${method} ${route.path}`);\n\n return { ...route, method };\n });\n\n const assets: Record<string, string> = {};\n\n for (const [name, source] of Object.entries(panel.assets ?? {})) {\n if (!ASSET_NAME.test(name) || name === \"view.js\") {\n throw new Error(\n `Devtools panel \"${id}\" has an asset named ${JSON.stringify(name)}; use a plain file name other than \"view.js\".`,\n );\n }\n\n const file = toFilePath(source);\n\n if (file === undefined || !isFile(file)) {\n throw new Error(\n `The asset \"${name}\" of devtools panel \"${id}\" was not found at ${String(source)}; give an absolute path or file: URL.`,\n );\n }\n\n assets[name] = file;\n }\n\n const files = checkPanelFiles(id, panel.files);\n const share = checkPanelShare(id, panel.share, routes, assets, files !== null);\n\n taken.set(id, panel.title);\n\n return {\n id,\n title: panel.title,\n view,\n routes,\n assets,\n files,\n share,\n production: panel.production === true,\n };\n}\n\nconst FILE_EXTENSION = /^\\.[a-z0-9]{1,16}$/;\n\n/** Validates `files`; `null` when the panel declares none. */\nfunction checkPanelFiles(\n id: string,\n value: DevtoolsPanel[\"files\"] | null,\n): MountedPanelFiles | null {\n // A panel that was mounted before carries `null` for \"none\".\n if (value === undefined || value === null) return null;\n\n if (typeof value !== \"object\") {\n throw new Error(\n `Devtools panel \"${id}\" has files that is not an object; use { dir: \"/absolute/folder\" }.`,\n );\n }\n\n const dir = toFilePath(value.dir);\n\n if (dir === undefined) {\n throw new Error(\n `Devtools panel \"${id}\" needs files.dir to be an absolute path or a file: URL; got ${String(value.dir)}.`,\n );\n }\n\n const given = value.extensions;\n\n if (given !== undefined && (!Array.isArray(given) || given.length === 0)) {\n throw new Error(\n `Devtools panel \"${id}\" has files.extensions that is not a list; use [\".png\", \".jpg\"] or leave it out.`,\n );\n }\n\n for (const extension of given ?? []) {\n if (typeof extension !== \"string\" || !FILE_EXTENSION.test(extension)) {\n throw new Error(\n `Devtools panel \"${id}\" has files.extensions entry ${JSON.stringify(extension)}; use lower-case extensions that start with a dot, such as \".png\".`,\n );\n }\n\n if (BLOCKED_FILE_EXTENSIONS.has(extension)) {\n throw new Error(\n `Devtools panel \"${id}\" lists files.extensions entry \"${extension}\", which can run as a page or script in the browser; remove it (images such as .png, .jpg, .webp and .gif are fine).`,\n );\n }\n }\n\n return { dir, extensions: [...(given ?? DEFAULT_PANEL_FILE_EXTENSIONS)] };\n}\n\n/** Validates `share` against the panel's own routes, assets and files. */\nfunction checkPanelShare(\n id: string,\n value: DevtoolsPanel[\"share\"] | null,\n routes: readonly { method: DevtoolsPanelMethod; path: string }[],\n assets: Readonly<Record<string, string>>,\n hasFiles: boolean,\n): MountedPanelShare | null {\n // A panel that was mounted before carries `null` for \"none\".\n if (value === undefined || value === null) return null;\n\n if (typeof value !== \"object\") {\n throw new Error(\n `Devtools panel \"${id}\" has share that is not an object; use { view, routes }.`,\n );\n }\n\n const view = toFilePath(value.view);\n\n if (view === undefined) {\n throw new Error(\n `Devtools panel \"${id}\" needs share.view: an absolute path or file: URL of the shared view module.`,\n );\n }\n\n if (!isFile(view)) {\n throw new Error(`The share.view module of devtools panel \"${id}\" was not found at ${view}.`);\n }\n\n if (!Array.isArray(value.routes)) {\n throw new Error(\n `Devtools panel \"${id}\" needs share.routes: a list of the paths of its GET routes the shared page may call.`,\n );\n }\n\n const getPaths = routes.filter((route) => route.method === \"GET\").map((route) => route.path);\n\n for (const route of value.routes) {\n if (typeof route !== \"string\" || !getPaths.includes(route)) {\n throw new Error(\n `Devtools panel \"${id}\" lists share.routes entry ${JSON.stringify(route)}, which is not the path of one of its GET routes${getPaths.length > 0 ? `; use one of ${getPaths.map((path) => JSON.stringify(path)).join(\", \")}` : \" (the panel has no GET routes)\"}.`,\n );\n }\n }\n\n for (const name of value.assets ?? []) {\n if (typeof name !== \"string\" || !Object.hasOwn(assets, name)) {\n throw new Error(\n `Devtools panel \"${id}\" lists share.assets entry ${JSON.stringify(name)}, which is not a name in its assets; use one of ${Object.keys(assets).join(\", \") || \"(the panel has no assets)\"}.`,\n );\n }\n }\n\n const files = value.files === true;\n\n if (value.files !== undefined && typeof value.files !== \"boolean\") {\n throw new Error(`Devtools panel \"${id}\" needs share.files to be true or false.`);\n }\n\n if (files && !hasFiles) {\n throw new Error(\n `Devtools panel \"${id}\" sets share.files, but the panel has no files folder; add files: { dir } or remove share.files.`,\n );\n }\n\n return { view, routes: [...value.routes], assets: [...(value.assets ?? [])], files };\n}\n\n/** Validates a list of panels; the first invalid or duplicate one throws. */\nexport function checkDevtoolsPanels(panels: readonly unknown[]): MountedDevtoolsPanel[] {\n const taken = new Map<string, string>();\n\n return panels.map((panel) => checkDevtoolsPanel(panel, taken));\n}\n\n/** Hooks `loadDevtoolsPanels` uses; replaced in specs. */\nexport type LoadDevtoolsPanelsOptions = {\n /** The app's root directory: bare specifiers resolve from here, `./` paths are relative to it. */\n root: string;\n /** Receives one line per entry that could not be loaded or was rejected. */\n warn: (message: string) => void;\n /** Ids already taken (the built-in panels), mapped to their titles. */\n taken?: ReadonlyMap<string, string>;\n /** Imports a module URL or specifier; defaults to a dynamic `import()`. */\n importModule?: (specifier: string) => Promise<unknown>;\n /** Where the dashboard runs; panel factories receive it as `context.mode`. @default \"development\" */\n mode?: DevtoolsMode;\n /** The captured error groups of the last hour; panel factories receive it as `context.errors`. */\n errors?: () => Promise<readonly DevtoolsPanelErrorSummary[]>;\n};\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) return false;\n\n const prototype = Object.getPrototypeOf(value);\n\n return prototype === Object.prototype || prototype === null;\n}\n\n/** What is wrong with a `[specifier, options]` entry, or `undefined` when it is valid. */\nfunction tupleProblem(entry: readonly unknown[]): string | undefined {\n if (entry.length !== 2) {\n return `it has ${entry.length} item(s); use exactly [specifier, options]`;\n }\n\n if (typeof entry[0] !== \"string\" || entry[0] === \"\") {\n return `its first item is ${JSON.stringify(entry[0])}; use the module specifier as a string`;\n }\n\n if (!isPlainObject(entry[1])) {\n return `its second item is not a plain object; pass the options as { name: value }`;\n }\n\n return undefined;\n}\n\n/** The URL or specifier to import for a `panels` entry. */\nfunction resolvePanelSpecifier(entry: string, root: string): string {\n if (entry.startsWith(\"./\") || entry.startsWith(\"../\") || path.isAbsolute(entry)) {\n return pathToFileURL(path.resolve(root, entry)).href;\n }\n\n return resolveFromNodeModules(entry, root) ?? resolveWithRequire(entry, root) ?? entry;\n}\n\n/** Picks the file an `exports` target names: `import`, then `default`, then `node`. */\nfunction exportTarget(target: unknown): string | undefined {\n if (typeof target === \"string\") return target;\n\n if (Array.isArray(target)) {\n for (const item of target) {\n const found = exportTarget(item);\n\n if (found !== undefined) return found;\n }\n\n return undefined;\n }\n\n if (target !== null && typeof target === \"object\") {\n const conditions = target as Record<string, unknown>;\n\n for (const condition of [\"import\", \"node\", \"default\"]) {\n const found = exportTarget(conditions[condition]);\n\n if (found !== undefined) return found;\n }\n }\n\n return undefined;\n}\n\n/**\n * Resolves a package specifier by looking it up in the `node_modules` folders\n * above the app root and reading its `exports` map. `createRequire().resolve`\n * cannot do this for a package that only has an `import` condition.\n */\nfunction resolveFromNodeModules(entry: string, root: string): string | undefined {\n const parts = entry.split(\"/\");\n const nameLength = entry.startsWith(\"@\") ? 2 : 1;\n const name = parts.slice(0, nameLength).join(\"/\");\n const subpath = parts.length > nameLength ? `./${parts.slice(nameLength).join(\"/\")}` : \".\";\n\n if (!name) return undefined;\n\n let directory = path.resolve(root);\n\n for (;;) {\n const packageDirectory = path.join(directory, \"node_modules\", name);\n const manifestFile = path.join(packageDirectory, \"package.json\");\n\n if (existsSync(manifestFile)) {\n try {\n const manifest = JSON.parse(readFileSync(manifestFile, \"utf8\")) as {\n exports?: unknown;\n main?: string;\n };\n const exported = manifest.exports;\n const map =\n exported !== null && typeof exported === \"object\" && !Array.isArray(exported)\n ? (exported as Record<string, unknown>)\n : undefined;\n const hasSubpaths =\n map !== undefined && Object.keys(map).some((key) => key.startsWith(\".\"));\n const target =\n exported === undefined\n ? subpath === \".\"\n ? (manifest.main ?? \"index.js\")\n : subpath\n : hasSubpaths\n ? exportTarget(map?.[subpath])\n : subpath === \".\"\n ? exportTarget(exported)\n : undefined;\n\n if (target === undefined) return undefined;\n\n const file = path.resolve(packageDirectory, target);\n\n return isFile(file) ? pathToFileURL(file).href : undefined;\n } catch {\n return undefined;\n }\n }\n\n const parent = path.dirname(directory);\n\n if (parent === directory) return undefined;\n\n directory = parent;\n }\n}\n\n/** The `require` resolution, for packages the `node_modules` lookup does not understand. */\nfunction resolveWithRequire(entry: string, root: string): string | undefined {\n try {\n return pathToFileURL(createRequire(path.join(root, \"package.json\")).resolve(entry)).href;\n } catch {\n return undefined;\n }\n}\n\n/** The panels a module's default export describes. */\nasync function panelsOf(\n exported: DevtoolsPanelExport,\n root: string,\n mode: DevtoolsMode,\n panelOptions: Readonly<Record<string, unknown>> = {},\n errors?: () => Promise<readonly DevtoolsPanelErrorSummary[]>,\n): Promise<readonly unknown[]> {\n const value =\n typeof exported === \"function\"\n ? await exported({ ...panelOptions, root, mode, ...(errors ? { errors } : {}) })\n : exported;\n\n return Array.isArray(value) ? value : [value];\n}\n\n/**\n * Loads the devtools `panels` option: imports each module entry, reads its\n * default export, and validates every panel. An entry that fails to load and\n * a panel that is invalid or reuses an id are reported through `warn` and\n * skipped, so one broken panel never stops the dashboard.\n */\nexport async function loadDevtoolsPanels(\n entries: readonly DevtoolsPanelEntry[],\n options: LoadDevtoolsPanelsOptions,\n): Promise<MountedDevtoolsPanel[]> {\n // `src/config/devtools.ts` is a plain object with no types: a single string would be read letter by letter.\n if (!Array.isArray(entries as unknown)) {\n options.warn(\n `The devtools \"panels\" option must be a list, such as panels: [\"@warlock.js/grimoire/devtools\"]; got ${JSON.stringify(entries)}. No panel was added.`,\n );\n\n return [];\n }\n\n const importModule = options.importModule ?? ((specifier: string) => import(specifier));\n const mode = options.mode ?? \"development\";\n const taken = new Map<string, string>(options.taken ?? []);\n const panels: MountedDevtoolsPanel[] = [];\n\n for (const entry of entries) {\n let candidates: readonly unknown[];\n\n try {\n if (Array.isArray(entry as unknown)) {\n const problem = tupleProblem(entry as readonly unknown[]);\n\n if (problem !== undefined) {\n options.warn(\n `Devtools panels entry ${JSON.stringify(entry)} is invalid: ${problem}. Example: [\"@warlock.js/grimoire/devtools\", { ttlMs: 60000 }]. The entry was not added.`,\n );\n continue;\n }\n }\n\n if (typeof entry === \"string\" || Array.isArray(entry as unknown)) {\n const [specifier, panelOptions] =\n typeof entry === \"string\"\n ? [entry, undefined]\n : (entry as readonly [string, Record<string, unknown>]);\n const module = (await importModule(resolvePanelSpecifier(specifier, options.root))) as {\n default?: DevtoolsPanelExport;\n };\n\n if (module.default === undefined) {\n throw new Error(\"the module has no default export\");\n }\n\n candidates = await panelsOf(\n module.default,\n options.root,\n mode,\n panelOptions,\n options.errors,\n );\n } else {\n candidates = [entry];\n }\n } catch (error) {\n options.warn(\n `Devtools panel module \"${String(Array.isArray(entry as unknown) ? (entry as readonly unknown[])[0] : entry)}\" could not be loaded: ${describe(error)}. Check that it is installed and listed correctly in the devtools \"panels\" option.`,\n );\n continue;\n }\n\n for (const candidate of candidates) {\n try {\n panels.push(checkDevtoolsPanel(candidate, taken));\n } catch (error) {\n options.warn(`${describe(error)} The panel was not added.`);\n }\n }\n }\n\n return panels;\n}\n\nfunction describe(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** What `productionPanels` decides. */\nexport type DevtoolsProductionPanels = {\n /** Built-in tab ids shown, in display order. */\n builtIn: string[];\n /** Package panels shown. */\n panels: MountedDevtoolsPanel[];\n};\n\n/**\n * Which tabs the production monitor shows. A built-in tab follows\n * `DEVTOOLS_BUILT_IN_PANELS` unless `overrides[id]` says otherwise. A package\n * panel (the Processes panel included) shows when it declares\n * `production: true` or `overrides[id]` is `true`; `overrides[id]: false` turns\n * any tab off.\n */\nexport function productionPanels(\n packagePanels: readonly MountedDevtoolsPanel[],\n overrides: Readonly<Record<string, boolean>> = {},\n): DevtoolsProductionPanels {\n const builtIn = DEVTOOLS_BUILT_IN_PANELS.filter((tab) => overrides[tab.id] ?? tab.production).map(\n (tab) => tab.id,\n );\n const panels = packagePanels.filter((panel) => overrides[panel.id] ?? panel.production);\n\n return { builtIn, panels };\n}\n\n/**\n * The tab list `GET api/panels` answers with: the built-in tabs in\n * `builtIn` (default: every one), in display order, then the package panels\n * in registration order.\n */\nexport function listPanelInfos(\n panels: readonly (Pick<MountedDevtoolsPanel, \"id\" | \"title\"> &\n Partial<Pick<MountedDevtoolsPanel, \"share\">>)[],\n builtIn?: readonly string[],\n): DevtoolsPanelInfo[] {\n const tabs: DevtoolsPanelInfo[] = DEVTOOLS_BUILT_IN_PANELS.filter(\n (tab) => builtIn === undefined || builtIn.includes(tab.id),\n ).map((tab) => ({\n id: tab.id,\n title: tab.title,\n type: \"built-in\" as const,\n shareable: false,\n }));\n\n for (const panel of panels) {\n tabs.push({\n id: panel.id,\n title: panel.title,\n type: \"package\" as const,\n shareable: panel.share !== undefined && panel.share !== null,\n });\n }\n\n return tabs;\n}\n"],"mappings":";;;;;;;;;;AAoDA,MAAa,gCAAmD;CAC9D;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAM,0CAA0B,IAAI,IAAI;CAAC;CAAQ;CAAS;CAAQ;CAAO;AAAM,CAAC;;;;;AAMhF,MAAM,qCAAqB,IAAI,IAAI;CACjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA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
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __exportAll = (all, no_symbols) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) {
|
|
11
|
-
__defProp(target, name, {
|
|
12
|
-
get: all[name],
|
|
13
|
-
enumerable: true
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
if (!no_symbols) {
|
|
17
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
|
-
}
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
-
key = keys[i];
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
26
|
-
__defProp(to, key, {
|
|
27
|
-
get: ((k) => from[k]).bind(null, key),
|
|
28
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return to;
|
|
34
|
-
};
|
|
35
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
36
|
-
value: mod,
|
|
37
|
-
enumerable: true
|
|
38
|
-
}) : target, mod));
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
Object.defineProperty(exports, "__exportAll", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: function () {
|
|
44
|
-
return __exportAll;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(exports, "__toESM", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function () {
|
|
50
|
-
return __toESM;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-C8JfggQU.cjs","names":["listPanelInfos","checkDevtoolsPanels","processesDevtoolsPanel"],"sources":["../../../../../../../packages/devtools/src/server/background-routes.ts","../../../../../../../packages/devtools/src/server/guard.ts","../../../../../../../packages/devtools/src/server/session-routes.ts","../../../../../../../packages/devtools/src/server/index.ts"],"sourcesContent":["import type { FastifyInstance } from \"fastify\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\n/** Registers the route that returns work recorded outside any request. */\nexport function registerBackgroundRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n): void {\n server.get(\"/api/background\", async () => deps.collector.getBackground());\n}\n","import type { FastifyInstance, FastifyReply, FastifyRequest } from \"fastify\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\nconst LOOPBACK_ADDRESSES = new Set([\"127.0.0.1\", \"::1\", \"::ffff:127.0.0.1\"]);\n\n/** Host names that always reach this machine, so DNS cannot be pointed at them. */\nconst LOOPBACK_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\"]);\n\n/** Headers a proxy or tunnel adds; their presence means the loopback peer is not the visitor. */\nconst PROXY_HEADERS = [\"x-forwarded-for\", \"x-forwarded-host\", \"x-real-ip\", \"forwarded\"] as const;\n\n/** At most this many distinct refusals are logged per boot. */\nconst MAX_WARNINGS = 20;\n\n/**\n * Whether `address` is a loopback address. Deliberately reads\n * `request.socket.remoteAddress` rather than `request.ip`, which honours\n * `X-Forwarded-For` when the app trusts a proxy — a header any client can\n * set.\n */\nfunction isLoopbackAddress(address: string | undefined): boolean {\n return address !== undefined && LOOPBACK_ADDRESSES.has(address);\n}\n\n/** The lower-cased host name of a `Host` header value, without its port (`[::1]` keeps its brackets). */\nexport function hostnameOf(host: string): string {\n const value = host.trim().toLowerCase();\n\n if (value.startsWith(\"[\")) {\n const end = value.indexOf(\"]\");\n\n return end === -1 ? \"\" : value.slice(0, end + 1);\n }\n\n const colon = value.indexOf(\":\");\n const name = colon === -1 ? value : value.slice(0, colon);\n\n return name.endsWith(\".\") ? name.slice(0, -1) : name;\n}\n\n/**\n * Whether `hostname` is a loopback name or one of `allowedHosts`. An entry\n * starting with `.` matches that domain and every subdomain of it.\n */\nexport function isAllowedDevtoolsHost(\n hostname: string,\n allowedHosts: readonly string[] = [],\n): boolean {\n if (!hostname) return false;\n if (LOOPBACK_HOSTS.has(hostname) || hostname.endsWith(\".localhost\")) return true;\n\n return allowedHosts.some((entry) => {\n const allowed = entry.trim().toLowerCase();\n\n if (allowed.startsWith(\".\")) {\n return hostname === allowed.slice(1) || hostname.endsWith(allowed);\n }\n\n return hostname === allowed;\n });\n}\n\n/** The `Origin` header's host name, `\"\"` for `null` or an unparsable value. */\nfunction originHostname(origin: string): string {\n try {\n return new URL(origin).hostname.toLowerCase();\n } catch {\n return \"\";\n }\n}\n\n/**\n * Why `request` must be refused, or `undefined` when it may be served.\n * `\"not-local\"` is the silent case (production, or a remote socket). Beyond a\n * loopback socket, the request must be ADDRESSED to a loopback (or allowed)\n * host, come from such an origin, and not have passed through a proxy: a page\n * whose domain was re-pointed at 127.0.0.1, or a tunnel, also arrives on a\n * loopback socket.\n */\nfunction refusalReason(request: FastifyRequest, deps: MountDevtoolsRoutesDeps): string | undefined {\n if (!deps.isDevelopment() || !isLoopbackAddress(request.socket.remoteAddress)) {\n return \"not-local\";\n }\n\n const allowedHosts = deps.options.allowedHosts ?? [];\n const host = hostnameOf(request.headers.host ?? \"\");\n\n if (!isAllowedDevtoolsHost(host, allowedHosts)) {\n return `Devtools refused a request for host \"${host}\". Open the dashboard on localhost, or add the host to the devtools \"allowedHosts\" option.`;\n }\n\n const origin = request.headers.origin;\n\n if (origin !== undefined && !isAllowedDevtoolsHost(originHostname(origin), allowedHosts)) {\n return `Devtools refused a request from origin \"${origin}\". Only pages served from localhost or a host in the devtools \"allowedHosts\" option may call the dashboard.`;\n }\n\n if (\n !deps.options.allowProxied &&\n PROXY_HEADERS.some((name) => request.headers[name] !== undefined)\n ) {\n return 'Devtools refused a proxied request (it carries a forwarding header). Open the dashboard directly on localhost, or set the devtools \"allowProxied\" option for a local proxy nobody else can reach.';\n }\n\n return undefined;\n}\n\n/**\n * Registers the dev-only, local-only guard as an `onRequest` hook on\n * `server`. Callers must register this inside an encapsulated Fastify\n * context (a plugin/prefix) so the hook never reaches routes outside the\n * dashboard.\n */\nexport function registerDevtoolsGuard(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n): void {\n // One terminal line per distinct refusal, so a misconfigured host is\n // explained once without flooding the log on every poll.\n const warned = new Set<string>();\n\n server.addHook(\"onRequest\", async (request: FastifyRequest, reply: FastifyReply) => {\n const reason = refusalReason(request, deps);\n\n if (reason === undefined) return;\n\n if (reason !== \"not-local\" && !warned.has(reason) && warned.size < MAX_WARNINGS) {\n warned.add(reason);\n deps.warn?.(reason);\n }\n\n // Returning the reply is what stops the lifecycle in an async hook;\n // without it Fastify still runs the handler after the 404 is sent.\n return reply.code(404).send();\n });\n}\n","import type { FastifyInstance } from \"fastify\";\nimport { listPanelInfos, type MountedDevtoolsPanel } from \"../panels\";\nimport type { DevtoolsPanelInfo, DevtoolsSessionView } from \"../production/contracts\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\n/**\n * The session view of the development dashboard: there are no accounts, the\n * loopback guard is the access control, and the visitor is an admin.\n */\nexport function developmentSessionView(deps: MountDevtoolsRoutesDeps): DevtoolsSessionView {\n return {\n mode: \"development\",\n stage: \"active\",\n account: null,\n role: \"admin\",\n csrf: null,\n expiresAt: null,\n instance: deps.instance ?? null,\n methods: null,\n share: null,\n };\n}\n\n/** The tabs `GET api/panels` lists: the built-in tabs in `deps.builtInPanels` (default all), then the package panels. */\nexport function panelInfos(\n deps: MountDevtoolsRoutesDeps,\n panels: readonly (Pick<MountedDevtoolsPanel, \"id\" | \"title\"> &\n Partial<Pick<MountedDevtoolsPanel, \"share\">>)[],\n): DevtoolsPanelInfo[] {\n return listPanelInfos(panels, deps.builtInPanels);\n}\n\n/**\n * Registers `GET /api/auth/session` (the development view: signed in as an\n * admin, no accounts) and `GET /api/panels`, so the same dashboard shell\n * works in both modes. Production answers these from its own mount.\n */\nexport function registerSessionRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n panels: readonly MountedDevtoolsPanel[],\n): void {\n server.get(\"/api/auth/session\", async (_request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n\n return developmentSessionView(deps);\n });\n\n server.get(\"/api/panels\", async (_request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n\n return panelInfos(deps, panels);\n });\n}\n","import type { FastifyError, FastifyInstance } from \"fastify\";\nimport { checkDevtoolsPanels } from \"../panels\";\nimport { processesDevtoolsPanel } from \"../process-panel\";\nimport { registerAiRoutes } from \"./ai-routes\";\nimport { registerBackgroundRoutes } from \"./background-routes\";\nimport { registerExplainRoute, registerShapeExplainRoute } from \"./explain-route\";\nimport { registerInsightsRoutes } from \"./insights-routes\";\nimport { registerDevtoolsGuard } from \"./guard\";\nimport { registerLogRoutes } from \"./log-routes\";\nimport { registerMailRoutes } from \"./mail-routes\";\nimport { registerOpenApiRoutes } from \"./openapi-routes\";\nimport { registerPanelRoutes } from \"./panel-routes\";\nimport { registerRequestsRoutes } from \"./requests-routes\";\nimport { registerRouteRoutes } from \"./route-routes\";\nimport { registerSessionRoutes } from \"./session-routes\";\nimport { registerStreamRoute } from \"./stream-route\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\nimport { registerUiAssets } from \"./ui-assets\";\n\nexport type { DevtoolsRequestLogSource, DevtoolsRouteRow, MountDevtoolsRoutesDeps } from \"./types\";\n\n/**\n * Mounts the devtools dashboard and its API under `deps.options.path` on\n * `server`. Every route is registered inside a single encapsulated Fastify\n * context so the dev-only, loopback-only guard never reaches the app's\n * other routes — the registered panels' data routes and files included.\n *\n * Throws before mounting anything when a panel is invalid or reuses an id.\n */\nexport function mountDevtoolsRoutes(server: FastifyInstance, deps: MountDevtoolsRoutesDeps): void {\n const panels = checkDevtoolsPanels([\n processesDevtoolsPanel(deps.processPanel),\n ...(deps.panels ?? []),\n ]);\n\n server.register(\n async (instance) => {\n registerDevtoolsGuard(instance, deps);\n\n instance.setErrorHandler((error: FastifyError, _request, reply) => {\n reply.code(error.statusCode ?? 500).send({ error: error.message });\n });\n\n registerUiAssets(instance);\n registerSessionRoutes(instance, deps, panels);\n registerRequestsRoutes(instance, deps);\n registerAiRoutes(instance, deps);\n registerBackgroundRoutes(instance, deps);\n registerMailRoutes(instance, deps);\n registerLogRoutes(instance, deps);\n registerRouteRoutes(instance, deps);\n registerPanelRoutes(instance, panels);\n registerOpenApiRoutes(instance, deps);\n registerExplainRoute(instance, deps);\n registerShapeExplainRoute(instance, deps);\n if (deps.insights) registerInsightsRoutes(instance, deps);\n registerStreamRoute(instance, deps);\n },\n { prefix: deps.options.path },\n );\n}\n"],"mappings":";;;;;;AAIA,SAAgB,yBACd,QACA,MACM;CACN,OAAO,IAAI,mBAAmB,YAAY,KAAK,UAAU,cAAc,CAAC;AAC1E;;;;ACNA,MAAM,qCAAqB,IAAI,IAAI;CAAC;CAAa;CAAO;AAAkB,CAAC;;AAG3E,MAAM,iCAAiB,IAAI,IAAI;CAAC;CAAa;CAAa;AAAO,CAAC;;AAGlE,MAAM,gBAAgB;CAAC;CAAmB;CAAoB;CAAa;AAAW;;AAGtF,MAAM,eAAe;;;;;;;AAQrB,SAAS,kBAAkB,SAAsC;CAC/D,OAAO,YAAY,UAAa,mBAAmB,IAAI,OAAO;AAChE;;AAGA,SAAgB,WAAW,MAAsB;CAC/C,MAAM,QAAQ,KAAK,KAAK,CAAC,CAAC,YAAY;CAEtC,IAAI,MAAM,WAAW,GAAG,GAAG;EACzB,MAAM,MAAM,MAAM,QA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