@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
|
@@ -0,0 +1,1103 @@
|
|
|
1
|
+
const require_app_versions = require("./app-versions-C_ZyzuvD.cjs");
|
|
2
|
+
const require_errors = require("./errors-DNQ-g49I.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_app_versions.__toESM(node_path, 1);
|
|
7
|
+
let node_url = require("node:url");
|
|
8
|
+
let node_crypto = require("node:crypto");
|
|
9
|
+
|
|
10
|
+
//#region ../../packages/devtools/src/panels.ts
|
|
11
|
+
/** The extensions a panel serves from `files` when it lists none. */
|
|
12
|
+
const DEFAULT_PANEL_FILE_EXTENSIONS = [
|
|
13
|
+
".png",
|
|
14
|
+
".jpg",
|
|
15
|
+
".jpeg",
|
|
16
|
+
".webp",
|
|
17
|
+
".gif"
|
|
18
|
+
];
|
|
19
|
+
/** Extensions a panel may never serve from `files`: a browser runs or renders them as a page. */
|
|
20
|
+
const BLOCKED_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
21
|
+
".svg",
|
|
22
|
+
".html",
|
|
23
|
+
".htm",
|
|
24
|
+
".js",
|
|
25
|
+
".mjs"
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* Ids the dashboard already uses for its own tabs, API segments and URLs. A
|
|
29
|
+
* panel's routes live under `<path>/api/<id>`, so these would collide.
|
|
30
|
+
*/
|
|
31
|
+
const RESERVED_PANEL_IDS = /* @__PURE__ */ new Set([
|
|
32
|
+
"account",
|
|
33
|
+
"admin",
|
|
34
|
+
"agents",
|
|
35
|
+
"ai",
|
|
36
|
+
"api",
|
|
37
|
+
"assets",
|
|
38
|
+
"auth",
|
|
39
|
+
"background",
|
|
40
|
+
"docs",
|
|
41
|
+
"errors",
|
|
42
|
+
"health",
|
|
43
|
+
"instances",
|
|
44
|
+
"jobs",
|
|
45
|
+
"logs",
|
|
46
|
+
"mail",
|
|
47
|
+
"mails",
|
|
48
|
+
"panels",
|
|
49
|
+
"queries",
|
|
50
|
+
"requests",
|
|
51
|
+
"resources",
|
|
52
|
+
"routes",
|
|
53
|
+
"share",
|
|
54
|
+
"stream"
|
|
55
|
+
]);
|
|
56
|
+
const PANEL_ID = /^[a-z][a-z0-9-]*$/;
|
|
57
|
+
const ASSET_NAME = /^[A-Za-z0-9_][A-Za-z0-9._-]*$/;
|
|
58
|
+
const METHODS = /* @__PURE__ */ new Set([
|
|
59
|
+
"GET",
|
|
60
|
+
"POST",
|
|
61
|
+
"PUT",
|
|
62
|
+
"PATCH",
|
|
63
|
+
"DELETE"
|
|
64
|
+
]);
|
|
65
|
+
/** Content types for the files a panel may serve; anything else is sent as bytes. */
|
|
66
|
+
const CONTENT_TYPES = {
|
|
67
|
+
".js": "text/javascript; charset=utf-8",
|
|
68
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
69
|
+
".css": "text/css; charset=utf-8",
|
|
70
|
+
".json": "application/json; charset=utf-8",
|
|
71
|
+
".svg": "image/svg+xml",
|
|
72
|
+
".png": "image/png",
|
|
73
|
+
".jpg": "image/jpeg",
|
|
74
|
+
".jpeg": "image/jpeg",
|
|
75
|
+
".webp": "image/webp",
|
|
76
|
+
".gif": "image/gif",
|
|
77
|
+
".woff2": "font/woff2"
|
|
78
|
+
};
|
|
79
|
+
/** The content type a panel file is served with, from its served name. */
|
|
80
|
+
function panelContentType(name) {
|
|
81
|
+
return CONTENT_TYPES[node_path.default.extname(name).toLowerCase()] ?? "application/octet-stream";
|
|
82
|
+
}
|
|
83
|
+
/** An absolute file path from a path or `file:` URL, or `undefined` for anything else. */
|
|
84
|
+
function toFilePath(value) {
|
|
85
|
+
if (value instanceof URL) return value.protocol === "file:" ? (0, node_url.fileURLToPath)(value) : void 0;
|
|
86
|
+
if (typeof value !== "string" || value === "") return void 0;
|
|
87
|
+
if (value.startsWith("file:")) return (0, node_url.fileURLToPath)(value);
|
|
88
|
+
return node_path.default.isAbsolute(value) ? value : void 0;
|
|
89
|
+
}
|
|
90
|
+
function isFile(file) {
|
|
91
|
+
return (0, node_fs.existsSync)(file) && (0, node_fs.statSync)(file).isFile();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validates `value` as a panel and returns it ready to mount. Throws an
|
|
95
|
+
* error that names the panel and what to change; `taken` maps the ids
|
|
96
|
+
* already registered to their titles and receives this panel's id.
|
|
97
|
+
*/
|
|
98
|
+
function checkDevtoolsPanel(value, taken) {
|
|
99
|
+
const panel = value ?? {};
|
|
100
|
+
const id = panel.id;
|
|
101
|
+
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)}.`);
|
|
102
|
+
if (RESERVED_PANEL_IDS.has(id)) throw new Error(`Devtools panel id "${id}" is used by the dashboard itself; give the panel another id.`);
|
|
103
|
+
const existing = taken.get(id);
|
|
104
|
+
if (existing !== void 0) throw new Error(`Devtools panel id "${id}" is already registered by the "${existing}" panel; each panel needs its own id.`);
|
|
105
|
+
if (typeof panel.title !== "string" || panel.title.trim() === "") throw new Error(`Devtools panel "${id}" needs a "title" for its tab.`);
|
|
106
|
+
const view = toFilePath(panel.view);
|
|
107
|
+
if (view === void 0) throw new Error(`Devtools panel "${id}" needs a "view": an absolute path or file: URL of its browser module.`);
|
|
108
|
+
if (!isFile(view)) throw new Error(`The view module of devtools panel "${id}" was not found at ${view}.`);
|
|
109
|
+
const seen = /* @__PURE__ */ new Set();
|
|
110
|
+
const routes = (panel.routes ?? []).map((route) => {
|
|
111
|
+
const method = route.method ?? "GET";
|
|
112
|
+
if (!METHODS.has(method)) throw new Error(`Devtools panel "${id}" has a route with method "${String(method)}"; use GET, POST, PUT, PATCH or DELETE.`);
|
|
113
|
+
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 "/".`);
|
|
114
|
+
if (typeof route.handler !== "function") throw new Error(`Devtools panel "${id}" route ${method} "${route.path}" has no handler.`);
|
|
115
|
+
if (seen.has(`${method} ${route.path}`)) throw new Error(`Devtools panel "${id}" lists route ${method} "${route.path}" twice; keep one.`);
|
|
116
|
+
seen.add(`${method} ${route.path}`);
|
|
117
|
+
return {
|
|
118
|
+
...route,
|
|
119
|
+
method
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
const assets = {};
|
|
123
|
+
for (const [name, source] of Object.entries(panel.assets ?? {})) {
|
|
124
|
+
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".`);
|
|
125
|
+
const file = toFilePath(source);
|
|
126
|
+
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.`);
|
|
127
|
+
assets[name] = file;
|
|
128
|
+
}
|
|
129
|
+
const files = checkPanelFiles(id, panel.files);
|
|
130
|
+
const share = checkPanelShare(id, panel.share, routes, assets, files !== null);
|
|
131
|
+
taken.set(id, panel.title);
|
|
132
|
+
return {
|
|
133
|
+
id,
|
|
134
|
+
title: panel.title,
|
|
135
|
+
view,
|
|
136
|
+
routes,
|
|
137
|
+
assets,
|
|
138
|
+
files,
|
|
139
|
+
share,
|
|
140
|
+
production: panel.production === true
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const FILE_EXTENSION = /^\.[a-z0-9]{1,16}$/;
|
|
144
|
+
/** Validates `files`; `null` when the panel declares none. */
|
|
145
|
+
function checkPanelFiles(id, value) {
|
|
146
|
+
if (value === void 0 || value === null) return null;
|
|
147
|
+
if (typeof value !== "object") throw new Error(`Devtools panel "${id}" has files that is not an object; use { dir: "/absolute/folder" }.`);
|
|
148
|
+
const dir = toFilePath(value.dir);
|
|
149
|
+
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)}.`);
|
|
150
|
+
const given = value.extensions;
|
|
151
|
+
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.`);
|
|
152
|
+
for (const extension of given ?? []) {
|
|
153
|
+
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".`);
|
|
154
|
+
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).`);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
dir,
|
|
158
|
+
extensions: [...given ?? DEFAULT_PANEL_FILE_EXTENSIONS]
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/** Validates `share` against the panel's own routes, assets and files. */
|
|
162
|
+
function checkPanelShare(id, value, routes, assets, hasFiles) {
|
|
163
|
+
if (value === void 0 || value === null) return null;
|
|
164
|
+
if (typeof value !== "object") throw new Error(`Devtools panel "${id}" has share that is not an object; use { view, routes }.`);
|
|
165
|
+
const view = toFilePath(value.view);
|
|
166
|
+
if (view === void 0) throw new Error(`Devtools panel "${id}" needs share.view: an absolute path or file: URL of the shared view module.`);
|
|
167
|
+
if (!isFile(view)) throw new Error(`The share.view module of devtools panel "${id}" was not found at ${view}.`);
|
|
168
|
+
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.`);
|
|
169
|
+
const getPaths = routes.filter((route) => route.method === "GET").map((route) => route.path);
|
|
170
|
+
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)"}.`);
|
|
171
|
+
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)"}.`);
|
|
172
|
+
const files = value.files === true;
|
|
173
|
+
if (value.files !== void 0 && typeof value.files !== "boolean") throw new Error(`Devtools panel "${id}" needs share.files to be true or false.`);
|
|
174
|
+
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.`);
|
|
175
|
+
return {
|
|
176
|
+
view,
|
|
177
|
+
routes: [...value.routes],
|
|
178
|
+
assets: [...value.assets ?? []],
|
|
179
|
+
files
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** Validates a list of panels; the first invalid or duplicate one throws. */
|
|
183
|
+
function checkDevtoolsPanels(panels) {
|
|
184
|
+
const taken = /* @__PURE__ */ new Map();
|
|
185
|
+
return panels.map((panel) => checkDevtoolsPanel(panel, taken));
|
|
186
|
+
}
|
|
187
|
+
function isPlainObject(value) {
|
|
188
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
189
|
+
const prototype = Object.getPrototypeOf(value);
|
|
190
|
+
return prototype === Object.prototype || prototype === null;
|
|
191
|
+
}
|
|
192
|
+
/** What is wrong with a `[specifier, options]` entry, or `undefined` when it is valid. */
|
|
193
|
+
function tupleProblem(entry) {
|
|
194
|
+
if (entry.length !== 2) return `it has ${entry.length} item(s); use exactly [specifier, options]`;
|
|
195
|
+
if (typeof entry[0] !== "string" || entry[0] === "") return `its first item is ${JSON.stringify(entry[0])}; use the module specifier as a string`;
|
|
196
|
+
if (!isPlainObject(entry[1])) return `its second item is not a plain object; pass the options as { name: value }`;
|
|
197
|
+
}
|
|
198
|
+
/** The URL or specifier to import for a `panels` entry. */
|
|
199
|
+
function resolvePanelSpecifier(entry, root) {
|
|
200
|
+
if (entry.startsWith("./") || entry.startsWith("../") || node_path.default.isAbsolute(entry)) return (0, node_url.pathToFileURL)(node_path.default.resolve(root, entry)).href;
|
|
201
|
+
return resolveFromNodeModules(entry, root) ?? resolveWithRequire(entry, root) ?? entry;
|
|
202
|
+
}
|
|
203
|
+
/** Picks the file an `exports` target names: `import`, then `default`, then `node`. */
|
|
204
|
+
function exportTarget(target) {
|
|
205
|
+
if (typeof target === "string") return target;
|
|
206
|
+
if (Array.isArray(target)) {
|
|
207
|
+
for (const item of target) {
|
|
208
|
+
const found = exportTarget(item);
|
|
209
|
+
if (found !== void 0) return found;
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (target !== null && typeof target === "object") {
|
|
214
|
+
const conditions = target;
|
|
215
|
+
for (const condition of [
|
|
216
|
+
"import",
|
|
217
|
+
"node",
|
|
218
|
+
"default"
|
|
219
|
+
]) {
|
|
220
|
+
const found = exportTarget(conditions[condition]);
|
|
221
|
+
if (found !== void 0) return found;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Resolves a package specifier by looking it up in the `node_modules` folders
|
|
227
|
+
* above the app root and reading its `exports` map. `createRequire().resolve`
|
|
228
|
+
* cannot do this for a package that only has an `import` condition.
|
|
229
|
+
*/
|
|
230
|
+
function resolveFromNodeModules(entry, root) {
|
|
231
|
+
const parts = entry.split("/");
|
|
232
|
+
const nameLength = entry.startsWith("@") ? 2 : 1;
|
|
233
|
+
const name = parts.slice(0, nameLength).join("/");
|
|
234
|
+
const subpath = parts.length > nameLength ? `./${parts.slice(nameLength).join("/")}` : ".";
|
|
235
|
+
if (!name) return void 0;
|
|
236
|
+
let directory = node_path.default.resolve(root);
|
|
237
|
+
for (;;) {
|
|
238
|
+
const packageDirectory = node_path.default.join(directory, "node_modules", name);
|
|
239
|
+
const manifestFile = node_path.default.join(packageDirectory, "package.json");
|
|
240
|
+
if ((0, node_fs.existsSync)(manifestFile)) try {
|
|
241
|
+
const manifest = JSON.parse((0, node_fs.readFileSync)(manifestFile, "utf8"));
|
|
242
|
+
const exported = manifest.exports;
|
|
243
|
+
const map = exported !== null && typeof exported === "object" && !Array.isArray(exported) ? exported : void 0;
|
|
244
|
+
const hasSubpaths = map !== void 0 && Object.keys(map).some((key) => key.startsWith("."));
|
|
245
|
+
const target = exported === void 0 ? subpath === "." ? manifest.main ?? "index.js" : subpath : hasSubpaths ? exportTarget(map?.[subpath]) : subpath === "." ? exportTarget(exported) : void 0;
|
|
246
|
+
if (target === void 0) return void 0;
|
|
247
|
+
const file = node_path.default.resolve(packageDirectory, target);
|
|
248
|
+
return isFile(file) ? (0, node_url.pathToFileURL)(file).href : void 0;
|
|
249
|
+
} catch {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const parent = node_path.default.dirname(directory);
|
|
253
|
+
if (parent === directory) return void 0;
|
|
254
|
+
directory = parent;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/** The `require` resolution, for packages the `node_modules` lookup does not understand. */
|
|
258
|
+
function resolveWithRequire(entry, root) {
|
|
259
|
+
try {
|
|
260
|
+
return (0, node_url.pathToFileURL)((0, node_module.createRequire)(node_path.default.join(root, "package.json")).resolve(entry)).href;
|
|
261
|
+
} catch {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/** The panels a module's default export describes. */
|
|
266
|
+
async function panelsOf(exported, root, mode, panelOptions = {}, errors) {
|
|
267
|
+
const value = typeof exported === "function" ? await exported({
|
|
268
|
+
...panelOptions,
|
|
269
|
+
root,
|
|
270
|
+
mode,
|
|
271
|
+
...errors ? { errors } : {}
|
|
272
|
+
}) : exported;
|
|
273
|
+
return Array.isArray(value) ? value : [value];
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Loads the devtools `panels` option: imports each module entry, reads its
|
|
277
|
+
* default export, and validates every panel. An entry that fails to load and
|
|
278
|
+
* a panel that is invalid or reuses an id are reported through `warn` and
|
|
279
|
+
* skipped, so one broken panel never stops the dashboard.
|
|
280
|
+
*/
|
|
281
|
+
async function loadDevtoolsPanels(entries, options) {
|
|
282
|
+
if (!Array.isArray(entries)) {
|
|
283
|
+
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.`);
|
|
284
|
+
return [];
|
|
285
|
+
}
|
|
286
|
+
const importModule = options.importModule ?? ((specifier) => import(specifier));
|
|
287
|
+
const mode = options.mode ?? "development";
|
|
288
|
+
const taken = new Map(options.taken ?? []);
|
|
289
|
+
const panels = [];
|
|
290
|
+
for (const entry of entries) {
|
|
291
|
+
let candidates;
|
|
292
|
+
try {
|
|
293
|
+
if (Array.isArray(entry)) {
|
|
294
|
+
const problem = tupleProblem(entry);
|
|
295
|
+
if (problem !== void 0) {
|
|
296
|
+
options.warn(`Devtools panels entry ${JSON.stringify(entry)} is invalid: ${problem}. Example: ["@warlock.js/grimoire/devtools", { ttlMs: 60000 }]. The entry was not added.`);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (typeof entry === "string" || Array.isArray(entry)) {
|
|
301
|
+
const [specifier, panelOptions] = typeof entry === "string" ? [entry, void 0] : entry;
|
|
302
|
+
const module = await importModule(resolvePanelSpecifier(specifier, options.root));
|
|
303
|
+
if (module.default === void 0) throw new Error("the module has no default export");
|
|
304
|
+
candidates = await panelsOf(module.default, options.root, mode, panelOptions, options.errors);
|
|
305
|
+
} else candidates = [entry];
|
|
306
|
+
} catch (error) {
|
|
307
|
+
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.`);
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
for (const candidate of candidates) try {
|
|
311
|
+
panels.push(checkDevtoolsPanel(candidate, taken));
|
|
312
|
+
} catch (error) {
|
|
313
|
+
options.warn(`${describe(error)} The panel was not added.`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return panels;
|
|
317
|
+
}
|
|
318
|
+
function describe(error) {
|
|
319
|
+
return error instanceof Error ? error.message : String(error);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Which tabs the production monitor shows. A built-in tab follows
|
|
323
|
+
* `DEVTOOLS_BUILT_IN_PANELS` unless `overrides[id]` says otherwise. A package
|
|
324
|
+
* panel (the Processes panel included) shows when it declares
|
|
325
|
+
* `production: true` or `overrides[id]` is `true`; `overrides[id]: false` turns
|
|
326
|
+
* any tab off.
|
|
327
|
+
*/
|
|
328
|
+
function productionPanels(packagePanels, overrides = {}) {
|
|
329
|
+
return {
|
|
330
|
+
builtIn: require_errors.DEVTOOLS_BUILT_IN_PANELS.filter((tab) => overrides[tab.id] ?? tab.production).map((tab) => tab.id),
|
|
331
|
+
panels: packagePanels.filter((panel) => overrides[panel.id] ?? panel.production)
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* The tab list `GET api/panels` answers with: the built-in tabs in
|
|
336
|
+
* `builtIn` (default: every one), in display order, then the package panels
|
|
337
|
+
* in registration order.
|
|
338
|
+
*/
|
|
339
|
+
function listPanelInfos(panels, builtIn) {
|
|
340
|
+
const tabs = require_errors.DEVTOOLS_BUILT_IN_PANELS.filter((tab) => builtIn === void 0 || builtIn.includes(tab.id)).map((tab) => ({
|
|
341
|
+
id: tab.id,
|
|
342
|
+
title: tab.title,
|
|
343
|
+
type: "built-in",
|
|
344
|
+
shareable: false
|
|
345
|
+
}));
|
|
346
|
+
for (const panel of panels) tabs.push({
|
|
347
|
+
id: panel.id,
|
|
348
|
+
title: panel.title,
|
|
349
|
+
type: "package",
|
|
350
|
+
shareable: panel.share !== void 0 && panel.share !== null
|
|
351
|
+
});
|
|
352
|
+
return tabs;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region ../../packages/devtools/src/safe-value.ts
|
|
357
|
+
const MAX_DEPTH = 6;
|
|
358
|
+
/**
|
|
359
|
+
* A JSON-safe snapshot of a value devtools keeps for later display.
|
|
360
|
+
*
|
|
361
|
+
* Log contexts and phase attributes are app data: they can hold live objects
|
|
362
|
+
* (a request, its socket) whose graphs are circular and which must not be kept
|
|
363
|
+
* alive by the collector anyway. Plain objects and arrays are copied; anything
|
|
364
|
+
* with a `toJSON()` is serialized through it; other class instances collapse
|
|
365
|
+
* to `[ClassName]`, cycles to `[Circular]`, and nesting past a fixed depth to
|
|
366
|
+
* `[Object]` / `[Array]`.
|
|
367
|
+
*/
|
|
368
|
+
function toSafeValue(value) {
|
|
369
|
+
return snapshot(value, 0, /* @__PURE__ */ new WeakSet());
|
|
370
|
+
}
|
|
371
|
+
function snapshot(value, depth, seen) {
|
|
372
|
+
if (value === null || value === void 0) return value;
|
|
373
|
+
switch (typeof value) {
|
|
374
|
+
case "string":
|
|
375
|
+
case "number":
|
|
376
|
+
case "boolean": return value;
|
|
377
|
+
case "bigint": return value.toString();
|
|
378
|
+
case "symbol": return value.toString();
|
|
379
|
+
case "function": return;
|
|
380
|
+
}
|
|
381
|
+
const object = value;
|
|
382
|
+
if (seen.has(object)) return "[Circular]";
|
|
383
|
+
if (value instanceof Date) return Number.isNaN(value.getTime()) ? "Invalid Date" : value.toISOString();
|
|
384
|
+
if (value instanceof Error) return {
|
|
385
|
+
name: value.name,
|
|
386
|
+
message: value.message
|
|
387
|
+
};
|
|
388
|
+
if (depth >= MAX_DEPTH) return Array.isArray(value) ? "[Array]" : "[Object]";
|
|
389
|
+
seen.add(object);
|
|
390
|
+
try {
|
|
391
|
+
if (Array.isArray(value)) return value.map((item) => snapshot(item, depth + 1, seen));
|
|
392
|
+
const prototype = Object.getPrototypeOf(object);
|
|
393
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
394
|
+
const toJSON = object.toJSON;
|
|
395
|
+
if (typeof toJSON === "function") try {
|
|
396
|
+
return snapshot(toJSON.call(object), depth + 1, seen);
|
|
397
|
+
} catch {
|
|
398
|
+
return `[${constructorName(object)}]`;
|
|
399
|
+
}
|
|
400
|
+
return `[${constructorName(object)}]`;
|
|
401
|
+
}
|
|
402
|
+
const copy = {};
|
|
403
|
+
for (const [key, entry] of Object.entries(object)) {
|
|
404
|
+
const safe = snapshot(entry, depth + 1, seen);
|
|
405
|
+
if (safe !== void 0) copy[key] = safe;
|
|
406
|
+
}
|
|
407
|
+
return copy;
|
|
408
|
+
} finally {
|
|
409
|
+
seen.delete(object);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function constructorName(object) {
|
|
413
|
+
return object.constructor?.name || "Object";
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region ../../packages/devtools/src/sources/ai-source.ts
|
|
418
|
+
/** Replaces absolute file paths in an error line with their package-relative part, or `<path>`. */
|
|
419
|
+
function redactPaths(text) {
|
|
420
|
+
return text.replace(/(?:file:\/\/)?(?:[A-Za-z]:)?[\\/][^\s'"`()]*/g, (match) => {
|
|
421
|
+
const normalized = match.replace(/^file:\/\//, "").replaceAll("\\", "/");
|
|
422
|
+
const index = normalized.lastIndexOf("node_modules/");
|
|
423
|
+
return index === -1 ? "<path>" : normalized.slice(index + 13);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
const OBSERVATION_COMMAND = "ai.config({ panoptic: { observeAll: true } })";
|
|
427
|
+
/** The answer for each reason; `detail` carries the load error and versions for `panoptic-failed`. */
|
|
428
|
+
function describeAiUnavailable(reason, detail) {
|
|
429
|
+
switch (reason) {
|
|
430
|
+
case "ai-missing": return {
|
|
431
|
+
available: false,
|
|
432
|
+
reason,
|
|
433
|
+
title: "AI isn't installed",
|
|
434
|
+
message: "Add @warlock.js/ai to see AI runs here.",
|
|
435
|
+
command: "warlock add ai"
|
|
436
|
+
};
|
|
437
|
+
case "panoptic-missing": return {
|
|
438
|
+
available: false,
|
|
439
|
+
reason,
|
|
440
|
+
title: "Panoptic isn't installed",
|
|
441
|
+
message: "Your app uses @warlock.js/ai. Add Panoptic to see its runs.",
|
|
442
|
+
command: "warlock add ai-panoptic"
|
|
443
|
+
};
|
|
444
|
+
case "panoptic-failed": return {
|
|
445
|
+
available: false,
|
|
446
|
+
reason,
|
|
447
|
+
title: "Panoptic could not be loaded",
|
|
448
|
+
message: "Panoptic is installed but failed to load. Check that both packages share a version.",
|
|
449
|
+
detail
|
|
450
|
+
};
|
|
451
|
+
case "not-collected": return {
|
|
452
|
+
available: false,
|
|
453
|
+
reason,
|
|
454
|
+
title: "AI runs are not collected here",
|
|
455
|
+
message: "Production keeps hourly AI totals, not run details. Open Reports, Models or Errors here, or the Runs tab in development (warlock dev)."
|
|
456
|
+
};
|
|
457
|
+
case "table-missing": return {
|
|
458
|
+
available: false,
|
|
459
|
+
reason,
|
|
460
|
+
title: "AI reports need their table",
|
|
461
|
+
message: "Run the devtools migrations to create devtools_ai_rollups, then restart the app.",
|
|
462
|
+
command: "warlock migrate"
|
|
463
|
+
};
|
|
464
|
+
case "reports-off": return {
|
|
465
|
+
available: false,
|
|
466
|
+
reason,
|
|
467
|
+
title: "AI reports are off",
|
|
468
|
+
message: "Set devtools.ai.reports to true in src/config/devtools.ts to keep hourly AI totals."
|
|
469
|
+
};
|
|
470
|
+
case "observation-off": return {
|
|
471
|
+
available: false,
|
|
472
|
+
reason,
|
|
473
|
+
title: "AI observation is off",
|
|
474
|
+
message: "Turn it on in src/config/ai.ts, then restart warlock dev.",
|
|
475
|
+
command: OBSERVATION_COMMAND
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
/** The unavailable answer as the AI routes send it: `command` and `detail` are `null` when absent. */
|
|
480
|
+
function toAiUnavailableView(unavailable) {
|
|
481
|
+
return {
|
|
482
|
+
available: false,
|
|
483
|
+
reason: unavailable.reason,
|
|
484
|
+
title: unavailable.title,
|
|
485
|
+
message: unavailable.message,
|
|
486
|
+
command: unavailable.command ?? null,
|
|
487
|
+
detail: unavailable.detail ?? null
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
/** Summaries use root usage once: nested spans already roll up into it. */
|
|
491
|
+
function summarizeAiTrace(trace, cost) {
|
|
492
|
+
const models = /* @__PURE__ */ new Set();
|
|
493
|
+
let toolCalls = 0;
|
|
494
|
+
let retries = 0;
|
|
495
|
+
let cacheHits;
|
|
496
|
+
let incomplete = false;
|
|
497
|
+
let truncatedTrips = 0;
|
|
498
|
+
let compactions = 0;
|
|
499
|
+
let skippedCompactions = 0;
|
|
500
|
+
let providerCompactions = 0;
|
|
501
|
+
const visit = (span) => {
|
|
502
|
+
const attributes = span.attributes ?? {};
|
|
503
|
+
const model = attributes["agent.model.name"];
|
|
504
|
+
const provider = attributes["agent.model.provider"];
|
|
505
|
+
if (typeof model === "string") models.add(typeof provider === "string" ? `${provider}/${model}` : model);
|
|
506
|
+
if (span.type === "tool") toolCalls += 1;
|
|
507
|
+
if (typeof attributes.retries === "number") retries += attributes.retries;
|
|
508
|
+
if (typeof attributes["agent.cacheHits"] === "number") cacheHits = (cacheHits ?? 0) + attributes["agent.cacheHits"];
|
|
509
|
+
if (typeof attributes["agent.truncatedTrips"] === "number") truncatedTrips += attributes["agent.truncatedTrips"];
|
|
510
|
+
if (typeof attributes["agent.providerCompactions"] === "number") providerCompactions += attributes["agent.providerCompactions"];
|
|
511
|
+
if (Array.isArray(attributes["agent.compactions"])) {
|
|
512
|
+
const records = attributes["agent.compactions"];
|
|
513
|
+
for (const record of records) {
|
|
514
|
+
if (typeof record !== "object" || record === null || !("type" in record)) continue;
|
|
515
|
+
if (record.type === "applied") compactions += 1;
|
|
516
|
+
if (record.type === "skipped") skippedCompactions += 1;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
incomplete ||= span.status === "incomplete" || span.error?.type === "AgentIncompleteError" || span.error?.type === "AGENT_INCOMPLETE";
|
|
520
|
+
span.children.forEach(visit);
|
|
521
|
+
};
|
|
522
|
+
visit(trace.root);
|
|
523
|
+
return {
|
|
524
|
+
traceId: trace.traceId,
|
|
525
|
+
requestId: trace.requestId,
|
|
526
|
+
sessionId: trace.sessionId,
|
|
527
|
+
name: trace.root.name,
|
|
528
|
+
status: trace.root.status,
|
|
529
|
+
startedAt: trace.startedAt,
|
|
530
|
+
duration: trace.duration,
|
|
531
|
+
usage: trace.usage,
|
|
532
|
+
cost,
|
|
533
|
+
models: [...models],
|
|
534
|
+
toolCalls,
|
|
535
|
+
retries,
|
|
536
|
+
cacheHits,
|
|
537
|
+
incomplete,
|
|
538
|
+
truncatedTrips,
|
|
539
|
+
compactions,
|
|
540
|
+
skippedCompactions,
|
|
541
|
+
providerCompactions
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
/** Content-free snapshot; never retain prompts, completions or tool arguments/results. */
|
|
545
|
+
function snapshotSpan(span) {
|
|
546
|
+
return {
|
|
547
|
+
spanId: span.spanId,
|
|
548
|
+
parentSpanId: span.parentSpanId,
|
|
549
|
+
traceId: span.traceId,
|
|
550
|
+
sessionId: span.sessionId,
|
|
551
|
+
name: span.name,
|
|
552
|
+
version: span.version,
|
|
553
|
+
type: span.type,
|
|
554
|
+
status: span.status,
|
|
555
|
+
startedAt: span.startedAt,
|
|
556
|
+
endedAt: span.endedAt,
|
|
557
|
+
duration: span.duration,
|
|
558
|
+
usage: structuredClone(span.usage),
|
|
559
|
+
error: span.error ? {
|
|
560
|
+
type: span.error.type,
|
|
561
|
+
message: span.error.message
|
|
562
|
+
} : void 0,
|
|
563
|
+
attributes: toSafeValue(span.attributes),
|
|
564
|
+
children: span.children.map(snapshotSpan)
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Loads Panoptic (required) and `@warlock.js/ai` (for the observation check)
|
|
569
|
+
* lazily, or says why not. Shared by the development source and the AI
|
|
570
|
+
* reports wiring, so both answer the same unavailable reasons.
|
|
571
|
+
*/
|
|
572
|
+
async function loadAiPackages(deps = {}) {
|
|
573
|
+
const aiPackage = "@warlock.js/ai";
|
|
574
|
+
const load = deps.load ?? ((name) => name === "@warlock.js/ai-panoptic" ? import("@warlock.js/ai-panoptic") : import(aiPackage));
|
|
575
|
+
const version = deps.version ?? ((name) => require_app_versions.installedVersion(name, process.cwd(), {}.resolve));
|
|
576
|
+
let panoptic;
|
|
577
|
+
try {
|
|
578
|
+
panoptic = await load("@warlock.js/ai-panoptic");
|
|
579
|
+
if (typeof panoptic.subscribeTraces !== "function") throw new Error("Trace subscription unavailable");
|
|
580
|
+
} catch (error) {
|
|
581
|
+
const aiVersion = version("@warlock.js/ai");
|
|
582
|
+
const panopticVersion = version("@warlock.js/ai-panoptic");
|
|
583
|
+
if (aiVersion === null) return { unavailable: describeAiUnavailable("ai-missing") };
|
|
584
|
+
if (panopticVersion === null) return { unavailable: describeAiUnavailable("panoptic-missing") };
|
|
585
|
+
return { unavailable: describeAiUnavailable("panoptic-failed", `${redactPaths((error instanceof Error ? error.message : String(error)).split("\n")[0] ?? "").slice(0, 300)} (@warlock.js/ai ${aiVersion}, @warlock.js/ai-panoptic ${panopticVersion})`) };
|
|
586
|
+
}
|
|
587
|
+
let core;
|
|
588
|
+
try {
|
|
589
|
+
core = await load("@warlock.js/ai");
|
|
590
|
+
} catch {
|
|
591
|
+
core = void 0;
|
|
592
|
+
}
|
|
593
|
+
const observationOff = () => typeof core?.isObserveAll === "function" && typeof core.getObservers === "function" && !core.isObserveAll() && core.getObservers().length === 0;
|
|
594
|
+
return {
|
|
595
|
+
panoptic,
|
|
596
|
+
observationOff
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Optional, lazy integration. Retains only traces collected after devtools boots,
|
|
601
|
+
* using Panoptic's bounded query store; existing exporter/cache stores stay independent.
|
|
602
|
+
*/
|
|
603
|
+
async function attachAiSource(capacity, deps = {}) {
|
|
604
|
+
const loaded = await loadAiPackages(deps);
|
|
605
|
+
if ("unavailable" in loaded) return {
|
|
606
|
+
...loaded.unavailable,
|
|
607
|
+
dispose() {}
|
|
608
|
+
};
|
|
609
|
+
const { panoptic, observationOff } = loaded;
|
|
610
|
+
const { currentRequestId } = await Promise.resolve().then(() => require("./current-request-id-Badec-TH.cjs")).then((n) => n.current_request_id_exports);
|
|
611
|
+
const store = panoptic.createInMemoryTraceStore({ capacity });
|
|
612
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
613
|
+
const detach = panoptic.subscribeTraces((trace) => {
|
|
614
|
+
const requestId = currentRequestId() ?? trace.requestId;
|
|
615
|
+
store.add({
|
|
616
|
+
...trace,
|
|
617
|
+
requestId,
|
|
618
|
+
usage: structuredClone(trace.usage),
|
|
619
|
+
root: snapshotSpan(trace.root)
|
|
620
|
+
});
|
|
621
|
+
for (const listener of listeners) try {
|
|
622
|
+
listener({
|
|
623
|
+
traceId: trace.traceId,
|
|
624
|
+
requestId
|
|
625
|
+
});
|
|
626
|
+
} catch {}
|
|
627
|
+
});
|
|
628
|
+
return {
|
|
629
|
+
available: true,
|
|
630
|
+
observationOff,
|
|
631
|
+
totalCost: (usage) => panoptic.totalCostUsd(usage),
|
|
632
|
+
helpers: {
|
|
633
|
+
filterTraces: panoptic.filterTraces,
|
|
634
|
+
groupBySession: panoptic.groupBySession,
|
|
635
|
+
groupByPrompt: panoptic.groupByPrompt,
|
|
636
|
+
groupByType: panoptic.groupByType,
|
|
637
|
+
percentile: panoptic.percentile,
|
|
638
|
+
tracePromptKey: panoptic.tracePromptKey
|
|
639
|
+
},
|
|
640
|
+
store,
|
|
641
|
+
summarize: (trace) => summarizeAiTrace(trace, panoptic.totalCostUsd(trace.usage)),
|
|
642
|
+
subscribe(listener) {
|
|
643
|
+
listeners.add(listener);
|
|
644
|
+
return () => {
|
|
645
|
+
listeners.delete(listener);
|
|
646
|
+
};
|
|
647
|
+
},
|
|
648
|
+
dispose() {
|
|
649
|
+
detach();
|
|
650
|
+
listeners.clear();
|
|
651
|
+
store.clear();
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region ../../packages/devtools/src/ai/rollup/categories.ts
|
|
658
|
+
/** Labels the Errors page shows, by category. */
|
|
659
|
+
const DEVTOOLS_AI_ERROR_LABELS = {
|
|
660
|
+
"rate-limit": "Rate limit",
|
|
661
|
+
timeout: "Timeout",
|
|
662
|
+
refusal: "Refusal",
|
|
663
|
+
provider: "Provider error",
|
|
664
|
+
budget: "Budget",
|
|
665
|
+
tool: "Tool failed",
|
|
666
|
+
schema: "Invalid output",
|
|
667
|
+
incomplete: "Incomplete",
|
|
668
|
+
other: "Other"
|
|
669
|
+
};
|
|
670
|
+
/** Error counts with every category at 0. */
|
|
671
|
+
function emptyErrorCounts() {
|
|
672
|
+
const counts = {};
|
|
673
|
+
for (const category of require_errors.DEVTOOLS_AI_ERROR_CATEGORIES) counts[category] = 0;
|
|
674
|
+
return counts;
|
|
675
|
+
}
|
|
676
|
+
const CODE_CATEGORIES = {
|
|
677
|
+
PROVIDER_RATE_LIMIT: "rate-limit",
|
|
678
|
+
PROVIDER_QUOTA_EXCEEDED: "rate-limit",
|
|
679
|
+
PROVIDER_OVERLOADED: "rate-limit",
|
|
680
|
+
PROVIDER_TIMEOUT: "timeout",
|
|
681
|
+
CONTENT_FILTER: "refusal",
|
|
682
|
+
GUARDRAIL_VIOLATION: "refusal",
|
|
683
|
+
PROVIDER_ERROR: "provider",
|
|
684
|
+
PROVIDER_INVALID_REQUEST: "provider",
|
|
685
|
+
PROVIDER_AUTH: "provider",
|
|
686
|
+
CONTEXT_LENGTH_EXCEEDED: "provider",
|
|
687
|
+
PROVIDER_EMBEDDING_VECTOR_COUNT_MISMATCH: "provider",
|
|
688
|
+
BUDGET_EXCEEDED: "budget",
|
|
689
|
+
TOOL_EXEC_FAILED: "tool",
|
|
690
|
+
SCHEMA_VALIDATION_FAILED: "schema",
|
|
691
|
+
AGENT_INCOMPLETE: "incomplete",
|
|
692
|
+
AGENT_MAX_TRIPS: "incomplete",
|
|
693
|
+
AgentIncompleteError: "incomplete"
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
* The category of a failed or stopped agent span, from its status and error
|
|
697
|
+
* type (an `AIErrorCode` such as `PROVIDER_RATE_LIMIT`, or an error name):
|
|
698
|
+
*
|
|
699
|
+
* - `rate-limit`: PROVIDER_RATE_LIMIT, PROVIDER_QUOTA_EXCEEDED, PROVIDER_OVERLOADED
|
|
700
|
+
* - `timeout`: PROVIDER_TIMEOUT, or a name/type containing "Timeout"
|
|
701
|
+
* - `refusal`: CONTENT_FILTER, GUARDRAIL_VIOLATION
|
|
702
|
+
* - `provider`: PROVIDER_ERROR, PROVIDER_INVALID_REQUEST, PROVIDER_AUTH,
|
|
703
|
+
* CONTEXT_LENGTH_EXCEEDED, PROVIDER_EMBEDDING_VECTOR_COUNT_MISMATCH
|
|
704
|
+
* - `budget`: BUDGET_EXCEEDED
|
|
705
|
+
* - `tool`: TOOL_EXEC_FAILED
|
|
706
|
+
* - `schema`: SCHEMA_VALIDATION_FAILED
|
|
707
|
+
* - `incomplete`: status `incomplete` or `max-iterations`, AGENT_INCOMPLETE,
|
|
708
|
+
* AGENT_MAX_TRIPS, AgentIncompleteError
|
|
709
|
+
* - `other`: anything else
|
|
710
|
+
*/
|
|
711
|
+
function classifyAiError(status, errorType) {
|
|
712
|
+
if (status === "incomplete" || status === "max-iterations") return "incomplete";
|
|
713
|
+
if (!errorType) return "other";
|
|
714
|
+
const known = CODE_CATEGORIES[errorType];
|
|
715
|
+
if (known) return known;
|
|
716
|
+
return /timeout/i.test(errorType) ? "timeout" : "other";
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region ../../packages/devtools/src/ai/rollup/histogram.ts
|
|
721
|
+
/**
|
|
722
|
+
* Latency histograms over `DEVTOOLS_AI_LATENCY_BUCKETS_MS`, stored as plain
|
|
723
|
+
* count arrays in the rollups (one more count than bounds).
|
|
724
|
+
*/
|
|
725
|
+
const BUCKETS = require_errors.DEVTOOLS_AI_LATENCY_BUCKETS_MS;
|
|
726
|
+
/** `DEVTOOLS_AI_LATENCY_BUCKETS_MS.length + 1` zeros. */
|
|
727
|
+
function emptyAiLatency() {
|
|
728
|
+
return new Array(BUCKETS.length + 1).fill(0);
|
|
729
|
+
}
|
|
730
|
+
/** The bucket index of a duration; a negative or non-finite value counts as 0. */
|
|
731
|
+
function aiLatencyBucket(durationMs) {
|
|
732
|
+
if (!Number.isFinite(durationMs) || durationMs < 0) return 0;
|
|
733
|
+
const index = BUCKETS.findIndex((bound) => durationMs <= bound);
|
|
734
|
+
return index === -1 ? BUCKETS.length : index;
|
|
735
|
+
}
|
|
736
|
+
/** Adds `source` into `target` in place (same length). */
|
|
737
|
+
function addAiLatency(target, source) {
|
|
738
|
+
for (let index = 0; index < target.length; index++) target[index] = (target[index] ?? 0) + (source[index] ?? 0);
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* The `q` quantile (0–1): the upper bound of the bucket that holds it, or the
|
|
742
|
+
* last bound for the overflow bucket. `null` for an empty histogram.
|
|
743
|
+
*/
|
|
744
|
+
function aiLatencyQuantile(counts, q) {
|
|
745
|
+
let total = 0;
|
|
746
|
+
for (const count of counts) total += count;
|
|
747
|
+
if (total <= 0) return null;
|
|
748
|
+
const target = Math.max(1, Math.ceil(Math.min(1, Math.max(0, q)) * total));
|
|
749
|
+
let seen = 0;
|
|
750
|
+
for (let index = 0; index < counts.length; index++) {
|
|
751
|
+
seen += counts[index] ?? 0;
|
|
752
|
+
if (seen >= target) return BUCKETS[Math.min(index, BUCKETS.length - 1)] ?? null;
|
|
753
|
+
}
|
|
754
|
+
return BUCKETS[BUCKETS.length - 1] ?? null;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region ../../packages/devtools/src/ai/rollup/extract.ts
|
|
759
|
+
const HOUR_MS = 36e5;
|
|
760
|
+
const UNKNOWN = "(unknown)";
|
|
761
|
+
const MODEL_SPAN_TYPES = /* @__PURE__ */ new Set([
|
|
762
|
+
"agent",
|
|
763
|
+
"image",
|
|
764
|
+
"speech",
|
|
765
|
+
"transcription"
|
|
766
|
+
]);
|
|
767
|
+
function count(value) {
|
|
768
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
769
|
+
}
|
|
770
|
+
function normalise(usage) {
|
|
771
|
+
const cached = count(usage?.cachedTokens);
|
|
772
|
+
const cacheWrite = count(usage?.cacheWriteTokens);
|
|
773
|
+
const input = count(usage?.input);
|
|
774
|
+
return {
|
|
775
|
+
input: usage?.inputIncludesCache === false ? input + cached + cacheWrite : input,
|
|
776
|
+
output: count(usage?.output),
|
|
777
|
+
cached,
|
|
778
|
+
cacheWrite,
|
|
779
|
+
reasoning: count(usage?.reasoningTokens)
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
function subtract(own, other) {
|
|
783
|
+
own.input = Math.max(0, own.input - other.input);
|
|
784
|
+
own.output = Math.max(0, own.output - other.output);
|
|
785
|
+
own.cached = Math.max(0, own.cached - other.cached);
|
|
786
|
+
own.cacheWrite = Math.max(0, own.cacheWrite - other.cacheWrite);
|
|
787
|
+
own.reasoning = Math.max(0, own.reasoning - other.reasoning);
|
|
788
|
+
}
|
|
789
|
+
/** Whether a span is one run in the rollups: it reports a model, or is an agent/image/speech/transcription span. */
|
|
790
|
+
function isAiModelSpan(span) {
|
|
791
|
+
return typeof span.attributes?.["agent.model.name"] === "string" || MODEL_SPAN_TYPES.has(span.type);
|
|
792
|
+
}
|
|
793
|
+
/** The nearest model-bearing descendants of `span` (their own subtrees are not entered). */
|
|
794
|
+
function nearestModelSpans(span) {
|
|
795
|
+
const found = [];
|
|
796
|
+
for (const child of span.children ?? []) if (isAiModelSpan(child)) found.push(child);
|
|
797
|
+
else found.push(...nearestModelSpans(child));
|
|
798
|
+
return found;
|
|
799
|
+
}
|
|
800
|
+
function cut(value, max) {
|
|
801
|
+
if (typeof value !== "string" || value === "") return UNKNOWN;
|
|
802
|
+
return value.length > max ? value.slice(0, max) : value;
|
|
803
|
+
}
|
|
804
|
+
function spanCost(span, totalCost) {
|
|
805
|
+
return count(totalCost(span.usage));
|
|
806
|
+
}
|
|
807
|
+
/** Whether a span's usage carries pricing at all (a free model is priced at 0; no pricing is `undefined`). */
|
|
808
|
+
function hasPricing(span, totalCost) {
|
|
809
|
+
return typeof totalCost(span.usage) === "number";
|
|
810
|
+
}
|
|
811
|
+
function buildDelta(key, status, errorType, tokens, cost, pricedAtZero = false) {
|
|
812
|
+
const delta = emptyRollupDelta(key);
|
|
813
|
+
delta.runs = 1;
|
|
814
|
+
delta.inputTokens = tokens.input;
|
|
815
|
+
delta.outputTokens = tokens.output;
|
|
816
|
+
delta.cachedTokens = tokens.cached;
|
|
817
|
+
delta.cacheWriteTokens = tokens.cacheWrite;
|
|
818
|
+
delta.reasoningTokens = tokens.reasoning;
|
|
819
|
+
if (status === "completed") delta.completed = 1;
|
|
820
|
+
else if (status === "failed") delta.failed = 1;
|
|
821
|
+
else if (status === "incomplete" || status === "max-iterations") delta.incomplete = 1;
|
|
822
|
+
else if (status === "cancelled") delta.cancelled = 1;
|
|
823
|
+
if (status === "failed" || status === "incomplete" || status === "max-iterations") delta.errors[classifyAiError(status, errorType)] = 1;
|
|
824
|
+
if (cost > 0 || pricedAtZero && tokens.input + tokens.output > 0) {
|
|
825
|
+
delta.costUsd = cost;
|
|
826
|
+
delta.pricedRuns = 1;
|
|
827
|
+
} else if (tokens.input + tokens.output > 0) {
|
|
828
|
+
delta.unpricedRuns = 1;
|
|
829
|
+
delta.unpricedTokens = tokens.input + tokens.output;
|
|
830
|
+
}
|
|
831
|
+
return delta;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Turns one finished Panoptic trace into rollup deltas, one per
|
|
835
|
+
* model-bearing span (a span with an `agent.model.name` attribute, or of type
|
|
836
|
+
* `agent`, `image`, `speech` or `transcription`), keyed by the hour of the
|
|
837
|
+
* span's `endedAt`.
|
|
838
|
+
*
|
|
839
|
+
* Each span counts its OWN usage and cost: its rolled-up `usage` minus the
|
|
840
|
+
* usage of its nearest model-bearing descendants (an agent used as a tool is
|
|
841
|
+
* counted once, as itself). Root usage left after subtracting every
|
|
842
|
+
* model-bearing span (a custom flow with no agent span) becomes one more delta
|
|
843
|
+
* for the root name with model `(unknown)`, counted as one run.
|
|
844
|
+
*
|
|
845
|
+
* Per span: status maps to completed / failed / incomplete (`incomplete`,
|
|
846
|
+
* `max-iterations`) / cancelled; failed and incomplete runs add one error to
|
|
847
|
+
* `classifyAiError(status, error.type)`; tokens are normalised so `input`
|
|
848
|
+
* includes cache reads and writes; `costUsd` is `totalCost` of the own usage
|
|
849
|
+
* when it is above 0 (or the span's model is priced as free), otherwise a run
|
|
850
|
+
* with tokens counts in `unpricedRuns` and `unpricedTokens`; `agent.fallbackTrips > 0` adds a fallback run;
|
|
851
|
+
* `agent.refusals > 0` or a CONTENT_FILTER error adds a refusal; the span's
|
|
852
|
+
* `duration` goes into the latency histogram.
|
|
853
|
+
*
|
|
854
|
+
* Pure: no clock, no I/O. Names are cut to 200 (provider 100) characters.
|
|
855
|
+
*/
|
|
856
|
+
function traceToRollupDeltas(trace, totalCost) {
|
|
857
|
+
const root = trace.root;
|
|
858
|
+
if (!root) return [];
|
|
859
|
+
const rootEnd = Date.parse(root.endedAt);
|
|
860
|
+
const fallbackEnd = Number.isNaN(rootEnd) ? Date.parse(trace.endedAt) : rootEnd;
|
|
861
|
+
if (Number.isNaN(fallbackEnd)) return [];
|
|
862
|
+
const hourOf = (span) => {
|
|
863
|
+
const ended = Date.parse(span.endedAt);
|
|
864
|
+
return Math.floor((Number.isNaN(ended) ? fallbackEnd : ended) / HOUR_MS) * HOUR_MS;
|
|
865
|
+
};
|
|
866
|
+
const deltas = [];
|
|
867
|
+
const topLevel = isAiModelSpan(root) ? [root] : nearestModelSpans(root);
|
|
868
|
+
const visit = (span) => {
|
|
869
|
+
const tokens = normalise(span.usage);
|
|
870
|
+
let cost = spanCost(span, totalCost);
|
|
871
|
+
const inner = nearestModelSpans(span);
|
|
872
|
+
for (const child of inner) {
|
|
873
|
+
subtract(tokens, normalise(child.usage));
|
|
874
|
+
cost -= spanCost(child, totalCost);
|
|
875
|
+
}
|
|
876
|
+
cost = Math.max(0, cost);
|
|
877
|
+
const pricedAtZero = hasPricing(span, totalCost) && inner.every((child) => !hasPricing(child, totalCost));
|
|
878
|
+
const attributes = span.attributes ?? {};
|
|
879
|
+
const delta = buildDelta({
|
|
880
|
+
hour: hourOf(span),
|
|
881
|
+
...aiRollupNamesOf(span)
|
|
882
|
+
}, span.status, span.error?.type, tokens, cost, pricedAtZero);
|
|
883
|
+
if (count(attributes["agent.fallbackTrips"]) > 0) delta.fallbackRuns = 1;
|
|
884
|
+
if (count(attributes["agent.refusals"]) > 0 || span.error?.type === "CONTENT_FILTER") delta.refusals = 1;
|
|
885
|
+
const duration = count(span.duration);
|
|
886
|
+
const bucket = aiLatencyBucket(duration);
|
|
887
|
+
delta.latency[bucket] = (delta.latency[bucket] ?? 0) + 1;
|
|
888
|
+
delta.latencyCount = 1;
|
|
889
|
+
delta.latencySumMs = Math.max(0, duration);
|
|
890
|
+
deltas.push(delta);
|
|
891
|
+
for (const child of inner) visit(child);
|
|
892
|
+
};
|
|
893
|
+
for (const span of topLevel) visit(span);
|
|
894
|
+
const leftover = normalise(root.usage);
|
|
895
|
+
let leftoverCost = spanCost(root, totalCost);
|
|
896
|
+
for (const span of topLevel) {
|
|
897
|
+
subtract(leftover, normalise(span.usage));
|
|
898
|
+
leftoverCost -= spanCost(span, totalCost);
|
|
899
|
+
}
|
|
900
|
+
if (leftover.input + leftover.output > 0) deltas.push(buildDelta({
|
|
901
|
+
hour: hourOf(root),
|
|
902
|
+
agent: cut(root.name, 200),
|
|
903
|
+
model: UNKNOWN,
|
|
904
|
+
provider: UNKNOWN
|
|
905
|
+
}, root.status, root.error?.type, leftover, Math.max(0, leftoverCost)));
|
|
906
|
+
return deltas;
|
|
907
|
+
}
|
|
908
|
+
/** The agent, model and provider a span is counted under (names cut, `(unknown)` when missing). */
|
|
909
|
+
function aiRollupNamesOf(span) {
|
|
910
|
+
return {
|
|
911
|
+
agent: cut(span.name, 200),
|
|
912
|
+
model: cut(span.attributes?.["agent.model.name"], 200),
|
|
913
|
+
provider: cut(span.attributes?.["agent.model.provider"], 100)
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
/** `rollupId(key)`: first 40 hex characters of SHA-256 over `hour|agent|model|provider`. */
|
|
917
|
+
function rollupId(key) {
|
|
918
|
+
return (0, node_crypto.createHash)("sha256").update(`${key.hour}|${key.agent}|${key.model}|${key.provider}`).digest("hex").slice(0, 40);
|
|
919
|
+
}
|
|
920
|
+
/** A delta with every counter at zero for `key`. */
|
|
921
|
+
function emptyRollupDelta(key) {
|
|
922
|
+
return {
|
|
923
|
+
hour: key.hour,
|
|
924
|
+
agent: key.agent,
|
|
925
|
+
model: key.model,
|
|
926
|
+
provider: key.provider,
|
|
927
|
+
runs: 0,
|
|
928
|
+
completed: 0,
|
|
929
|
+
failed: 0,
|
|
930
|
+
incomplete: 0,
|
|
931
|
+
cancelled: 0,
|
|
932
|
+
inputTokens: 0,
|
|
933
|
+
outputTokens: 0,
|
|
934
|
+
cachedTokens: 0,
|
|
935
|
+
cacheWriteTokens: 0,
|
|
936
|
+
reasoningTokens: 0,
|
|
937
|
+
costUsd: 0,
|
|
938
|
+
pricedRuns: 0,
|
|
939
|
+
unpricedRuns: 0,
|
|
940
|
+
unpricedTokens: 0,
|
|
941
|
+
fallbackRuns: 0,
|
|
942
|
+
refusals: 0,
|
|
943
|
+
errors: emptyErrorCounts(),
|
|
944
|
+
latency: emptyAiLatency(),
|
|
945
|
+
latencyCount: 0,
|
|
946
|
+
latencySumMs: 0
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
const NUMERIC_COUNTERS = [
|
|
950
|
+
"runs",
|
|
951
|
+
"completed",
|
|
952
|
+
"failed",
|
|
953
|
+
"incomplete",
|
|
954
|
+
"cancelled",
|
|
955
|
+
"inputTokens",
|
|
956
|
+
"outputTokens",
|
|
957
|
+
"cachedTokens",
|
|
958
|
+
"cacheWriteTokens",
|
|
959
|
+
"reasoningTokens",
|
|
960
|
+
"costUsd",
|
|
961
|
+
"pricedRuns",
|
|
962
|
+
"unpricedRuns",
|
|
963
|
+
"unpricedTokens",
|
|
964
|
+
"fallbackRuns",
|
|
965
|
+
"refusals",
|
|
966
|
+
"latencyCount",
|
|
967
|
+
"latencySumMs"
|
|
968
|
+
];
|
|
969
|
+
/** Adds the counters of `source` into `target` in place (keys must match). */
|
|
970
|
+
function addRollupCounters(target, source) {
|
|
971
|
+
for (const field of NUMERIC_COUNTERS) target[field] += source[field];
|
|
972
|
+
for (const category of Object.keys(target.errors)) target.errors[category] += source.errors[category] ?? 0;
|
|
973
|
+
addAiLatency(target.latency, source.latency);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
//#endregion
|
|
977
|
+
Object.defineProperty(exports, "DEVTOOLS_AI_ERROR_LABELS", {
|
|
978
|
+
enumerable: true,
|
|
979
|
+
get: function () {
|
|
980
|
+
return DEVTOOLS_AI_ERROR_LABELS;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
Object.defineProperty(exports, "addAiLatency", {
|
|
984
|
+
enumerable: true,
|
|
985
|
+
get: function () {
|
|
986
|
+
return addAiLatency;
|
|
987
|
+
}
|
|
988
|
+
});
|
|
989
|
+
Object.defineProperty(exports, "addRollupCounters", {
|
|
990
|
+
enumerable: true,
|
|
991
|
+
get: function () {
|
|
992
|
+
return addRollupCounters;
|
|
993
|
+
}
|
|
994
|
+
});
|
|
995
|
+
Object.defineProperty(exports, "aiLatencyQuantile", {
|
|
996
|
+
enumerable: true,
|
|
997
|
+
get: function () {
|
|
998
|
+
return aiLatencyQuantile;
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
Object.defineProperty(exports, "aiRollupNamesOf", {
|
|
1002
|
+
enumerable: true,
|
|
1003
|
+
get: function () {
|
|
1004
|
+
return aiRollupNamesOf;
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
Object.defineProperty(exports, "attachAiSource", {
|
|
1008
|
+
enumerable: true,
|
|
1009
|
+
get: function () {
|
|
1010
|
+
return attachAiSource;
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
Object.defineProperty(exports, "checkDevtoolsPanels", {
|
|
1014
|
+
enumerable: true,
|
|
1015
|
+
get: function () {
|
|
1016
|
+
return checkDevtoolsPanels;
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
Object.defineProperty(exports, "classifyAiError", {
|
|
1020
|
+
enumerable: true,
|
|
1021
|
+
get: function () {
|
|
1022
|
+
return classifyAiError;
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
Object.defineProperty(exports, "describeAiUnavailable", {
|
|
1026
|
+
enumerable: true,
|
|
1027
|
+
get: function () {
|
|
1028
|
+
return describeAiUnavailable;
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
Object.defineProperty(exports, "emptyAiLatency", {
|
|
1032
|
+
enumerable: true,
|
|
1033
|
+
get: function () {
|
|
1034
|
+
return emptyAiLatency;
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
Object.defineProperty(exports, "emptyRollupDelta", {
|
|
1038
|
+
enumerable: true,
|
|
1039
|
+
get: function () {
|
|
1040
|
+
return emptyRollupDelta;
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
Object.defineProperty(exports, "isAiModelSpan", {
|
|
1044
|
+
enumerable: true,
|
|
1045
|
+
get: function () {
|
|
1046
|
+
return isAiModelSpan;
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
Object.defineProperty(exports, "listPanelInfos", {
|
|
1050
|
+
enumerable: true,
|
|
1051
|
+
get: function () {
|
|
1052
|
+
return listPanelInfos;
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
Object.defineProperty(exports, "loadAiPackages", {
|
|
1056
|
+
enumerable: true,
|
|
1057
|
+
get: function () {
|
|
1058
|
+
return loadAiPackages;
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
Object.defineProperty(exports, "loadDevtoolsPanels", {
|
|
1062
|
+
enumerable: true,
|
|
1063
|
+
get: function () {
|
|
1064
|
+
return loadDevtoolsPanels;
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
Object.defineProperty(exports, "panelContentType", {
|
|
1068
|
+
enumerable: true,
|
|
1069
|
+
get: function () {
|
|
1070
|
+
return panelContentType;
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
Object.defineProperty(exports, "productionPanels", {
|
|
1074
|
+
enumerable: true,
|
|
1075
|
+
get: function () {
|
|
1076
|
+
return productionPanels;
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1079
|
+
Object.defineProperty(exports, "rollupId", {
|
|
1080
|
+
enumerable: true,
|
|
1081
|
+
get: function () {
|
|
1082
|
+
return rollupId;
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
Object.defineProperty(exports, "toAiUnavailableView", {
|
|
1086
|
+
enumerable: true,
|
|
1087
|
+
get: function () {
|
|
1088
|
+
return toAiUnavailableView;
|
|
1089
|
+
}
|
|
1090
|
+
});
|
|
1091
|
+
Object.defineProperty(exports, "toSafeValue", {
|
|
1092
|
+
enumerable: true,
|
|
1093
|
+
get: function () {
|
|
1094
|
+
return toSafeValue;
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
Object.defineProperty(exports, "traceToRollupDeltas", {
|
|
1098
|
+
enumerable: true,
|
|
1099
|
+
get: function () {
|
|
1100
|
+
return traceToRollupDeltas;
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
//# sourceMappingURL=extract-8kaX_cUV.cjs.map
|