@warlock.js/devtools 5.59.0 → 5.61.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/cjs/{app-versions-DfpPZOI2.cjs → app-versions-C_ZyzuvD.cjs} +1 -116
  3. package/cjs/app-versions-C_ZyzuvD.cjs.map +1 -0
  4. package/cjs/attach-D5aMqUnA.cjs +1342 -0
  5. package/cjs/attach-D5aMqUnA.cjs.map +1 -0
  6. package/cjs/{auth-B3wyjJnQ.cjs → auth-ChHh5E7j.cjs} +6 -6
  7. package/cjs/{auth-B3wyjJnQ.cjs.map → auth-ChHh5E7j.cjs.map} +1 -1
  8. package/cjs/{boot-nczSvJ_F.cjs → boot-D0nF-7w3.cjs} +78 -14
  9. package/cjs/boot-D0nF-7w3.cjs.map +1 -0
  10. package/cjs/{capture-CuyT8Vab.cjs → capture-D2k0GnBN.cjs} +23 -422
  11. package/cjs/capture-D2k0GnBN.cjs.map +1 -0
  12. package/cjs/{cascade-store-CuRRYzt_.cjs → cascade-store-DUT2Laha.cjs} +3 -3
  13. package/cjs/{cascade-store-CuRRYzt_.cjs.map → cascade-store-DUT2Laha.cjs.map} +1 -1
  14. package/cjs/{collector-CJbQbzzK.cjs → collector-BfC4v87v.cjs} +4 -46
  15. package/cjs/collector-BfC4v87v.cjs.map +1 -0
  16. package/cjs/{current-request-id-CeQhRz9Q.cjs → current-request-id-Badec-TH.cjs} +2 -2
  17. package/cjs/{current-request-id-CeQhRz9Q.cjs.map → current-request-id-Badec-TH.cjs.map} +1 -1
  18. package/cjs/{errors-BadbSDX8.cjs → errors-DNQ-g49I.cjs} +198 -1
  19. package/cjs/errors-DNQ-g49I.cjs.map +1 -0
  20. package/cjs/extract-8kaX_cUV.cjs +1103 -0
  21. package/cjs/extract-8kaX_cUV.cjs.map +1 -0
  22. package/cjs/{http-Biauhqi0.cjs → http-1nnpAoI7.cjs} +33 -10
  23. package/cjs/http-1nnpAoI7.cjs.map +1 -0
  24. package/cjs/index.cjs +1 -1
  25. package/cjs/{insights-BjJA6Ret.cjs → insights-COA3u37q.cjs} +54 -22
  26. package/cjs/insights-COA3u37q.cjs.map +1 -0
  27. package/cjs/migrations-BQdNOL5_.cjs +30 -0
  28. package/cjs/migrations-BQdNOL5_.cjs.map +1 -0
  29. package/cjs/{migrations-BP4cYTGo.cjs → models-DF1agAm4.cjs} +106 -24
  30. package/cjs/models-DF1agAm4.cjs.map +1 -0
  31. package/cjs/{process-panel-DskSA7Cm.cjs → process-panel-D3D9Y_dc.cjs} +4 -4
  32. package/cjs/{process-panel-DskSA7Cm.cjs.map → process-panel-D3D9Y_dc.cjs.map} +1 -1
  33. package/cjs/production/index.cjs +4 -4
  34. package/cjs/query-shape-DShKQa0x.cjs +45 -0
  35. package/cjs/query-shape-DShKQa0x.cjs.map +1 -0
  36. package/cjs/redact-DQ28mDzr.cjs +533 -0
  37. package/cjs/redact-DQ28mDzr.cjs.map +1 -0
  38. package/cjs/runs-DECWPGnq.cjs +390 -0
  39. package/cjs/runs-DECWPGnq.cjs.map +1 -0
  40. package/cjs/{server-D3XRbSSb.cjs → server-DLT3uPef.cjs} +8 -7
  41. package/cjs/{server-D3XRbSSb.cjs.map → server-DLT3uPef.cjs.map} +1 -1
  42. package/cjs/{src-QcNghoYN.cjs → src-BZiSv8A1.cjs} +182 -24
  43. package/cjs/src-BZiSv8A1.cjs.map +1 -0
  44. package/cjs/{store-CNFv3wVp.cjs → store-EFn4wp0T.cjs} +2 -2
  45. package/cjs/{stream-route-BqyAlfxQ.cjs → stream-route-B6WAjbPG.cjs} +111 -22
  46. package/cjs/stream-route-B6WAjbPG.cjs.map +1 -0
  47. package/esm/ai/attach.mjs +92 -0
  48. package/esm/ai/attach.mjs.map +1 -0
  49. package/esm/ai/options.mjs +31 -0
  50. package/esm/ai/options.mjs.map +1 -0
  51. package/esm/ai/reports/aggregate.mjs +330 -0
  52. package/esm/ai/reports/aggregate.mjs.map +1 -0
  53. package/esm/ai/reports/evaluate.mjs +108 -0
  54. package/esm/ai/reports/evaluate.mjs.map +1 -0
  55. package/esm/ai/reports/range.mjs +121 -0
  56. package/esm/ai/reports/range.mjs.map +1 -0
  57. package/esm/ai/reports/runs.d.mts +2 -0
  58. package/esm/ai/reports/runs.mjs +212 -0
  59. package/esm/ai/reports/runs.mjs.map +1 -0
  60. package/esm/ai/reports/service.mjs +132 -0
  61. package/esm/ai/reports/service.mjs.map +1 -0
  62. package/esm/ai/rollup/cascade-store.mjs +84 -0
  63. package/esm/ai/rollup/cascade-store.mjs.map +1 -0
  64. package/esm/ai/rollup/categories.mjs +67 -0
  65. package/esm/ai/rollup/categories.mjs.map +1 -0
  66. package/esm/ai/rollup/extract.mjs +225 -0
  67. package/esm/ai/rollup/extract.mjs.map +1 -0
  68. package/esm/ai/rollup/file-store.mjs +147 -0
  69. package/esm/ai/rollup/file-store.mjs.map +1 -0
  70. package/esm/ai/rollup/histogram.mjs +42 -0
  71. package/esm/ai/rollup/histogram.mjs.map +1 -0
  72. package/esm/ai/rollup/increment-error.mjs +19 -0
  73. package/esm/ai/rollup/increment-error.mjs.map +1 -0
  74. package/esm/ai/rollup/index.mjs +9 -0
  75. package/esm/ai/rollup/mapping.mjs +69 -0
  76. package/esm/ai/rollup/mapping.mjs.map +1 -0
  77. package/esm/ai/rollup/memory-store.mjs +26 -0
  78. package/esm/ai/rollup/memory-store.mjs.map +1 -0
  79. package/esm/ai/rollup/writer.mjs +113 -0
  80. package/esm/ai/rollup/writer.mjs.map +1 -0
  81. package/esm/ai/types.d.mts +29 -0
  82. package/esm/ai/types.d.mts.map +1 -0
  83. package/esm/devtools-connector.d.mts.map +1 -1
  84. package/esm/devtools-connector.mjs +58 -3
  85. package/esm/devtools-connector.mjs.map +1 -1
  86. package/esm/index.d.mts +3 -2
  87. package/esm/options.mjs +4 -0
  88. package/esm/options.mjs.map +1 -1
  89. package/esm/production/boot.mjs +70 -3
  90. package/esm/production/boot.mjs.map +1 -1
  91. package/esm/production/contracts.d.mts +388 -6
  92. package/esm/production/contracts.d.mts.map +1 -1
  93. package/esm/production/contracts.mjs +64 -2
  94. package/esm/production/contracts.mjs.map +1 -1
  95. package/esm/production/errors.mjs +8 -0
  96. package/esm/production/errors.mjs.map +1 -1
  97. package/esm/production/http/access.mjs +6 -0
  98. package/esm/production/http/access.mjs.map +1 -1
  99. package/esm/production/http/mount.mjs +21 -2
  100. package/esm/production/http/mount.mjs.map +1 -1
  101. package/esm/production/http/share.mjs.map +1 -1
  102. package/esm/production/index.d.mts +2 -2
  103. package/esm/production/insights/jobs.mjs +45 -11
  104. package/esm/production/insights/jobs.mjs.map +1 -1
  105. package/esm/production/store/migrations.d.mts +1 -1
  106. package/esm/production/store/migrations.d.mts.map +1 -1
  107. package/esm/production/store/migrations.mjs +4 -2
  108. package/esm/production/store/migrations.mjs.map +1 -1
  109. package/esm/production/store/models/ai-rollup.migration.mjs +48 -0
  110. package/esm/production/store/models/ai-rollup.migration.mjs.map +1 -0
  111. package/esm/production/store/models/ai-rollup.model.mjs +13 -0
  112. package/esm/production/store/models/ai-rollup.model.mjs.map +1 -0
  113. package/esm/production/store/models/index.mjs +3 -1
  114. package/esm/server/ai-report-routes.mjs +72 -0
  115. package/esm/server/ai-report-routes.mjs.map +1 -0
  116. package/esm/server/ai-routes.mjs +22 -1
  117. package/esm/server/ai-routes.mjs.map +1 -1
  118. package/esm/server/index.mjs +2 -0
  119. package/esm/server/index.mjs.map +1 -1
  120. package/esm/server/panel-routes.mjs.map +1 -1
  121. package/esm/server/ui-assets.mjs +4 -7
  122. package/esm/server/ui-assets.mjs.map +1 -1
  123. package/esm/sources/agent-trace-source.d.mts.map +1 -1
  124. package/esm/sources/agent-trace-source.mjs.map +1 -1
  125. package/esm/sources/ai-source.d.mts +2 -0
  126. package/esm/sources/ai-source.d.mts.map +1 -1
  127. package/esm/sources/ai-source.mjs +58 -17
  128. package/esm/sources/ai-source.mjs.map +1 -1
  129. package/esm/types.d.mts +13 -3
  130. package/esm/types.d.mts.map +1 -1
  131. package/llms-full.txt +61 -22
  132. package/package.json +8 -8
  133. package/skills/SKILL.md +61 -22
  134. package/ui/dashboard/assets/app.css +1 -1
  135. package/ui/dashboard/assets/app.js +12 -5
  136. package/ui/dashboard/build-info.json +7 -7
  137. package/cjs/ai-source-BdvMfyKw.cjs +0 -448
  138. package/cjs/ai-source-BdvMfyKw.cjs.map +0 -1
  139. package/cjs/app-versions-DfpPZOI2.cjs.map +0 -1
  140. package/cjs/boot-nczSvJ_F.cjs.map +0 -1
  141. package/cjs/capture-CuyT8Vab.cjs.map +0 -1
  142. package/cjs/collector-CJbQbzzK.cjs.map +0 -1
  143. package/cjs/errors-BadbSDX8.cjs.map +0 -1
  144. package/cjs/histogram-DTOGnNBW.cjs +0 -102
  145. package/cjs/histogram-DTOGnNBW.cjs.map +0 -1
  146. package/cjs/http-Biauhqi0.cjs.map +0 -1
  147. package/cjs/insights-BjJA6Ret.cjs.map +0 -1
  148. package/cjs/migrations-BP4cYTGo.cjs.map +0 -1
  149. package/cjs/options-B9FHbRAJ.cjs +0 -205
  150. package/cjs/options-B9FHbRAJ.cjs.map +0 -1
  151. package/cjs/panels-D1ITm-jc.cjs +0 -384
  152. package/cjs/panels-D1ITm-jc.cjs.map +0 -1
  153. package/cjs/src-QcNghoYN.cjs.map +0 -1
  154. package/cjs/stream-route-BqyAlfxQ.cjs.map +0 -1
@@ -1,10 +1,11 @@
1
- const require_app_versions = require("./app-versions-DfpPZOI2.cjs");
2
- const require_panels = require("./panels-D1ITm-jc.cjs");
3
- const require_ai_source = require("./ai-source-BdvMfyKw.cjs");
4
- const require_process_panel = require("./process-panel-DskSA7Cm.cjs");
5
- const require_collector = require("./collector-CJbQbzzK.cjs");
6
- const require_options = require("./options-B9FHbRAJ.cjs");
7
- const require_current_request_id = require("./current-request-id-CeQhRz9Q.cjs");
1
+ const require_app_versions = require("./app-versions-C_ZyzuvD.cjs");
2
+ const require_errors = require("./errors-DNQ-g49I.cjs");
3
+ const require_extract = require("./extract-8kaX_cUV.cjs");
4
+ const require_runs = require("./runs-DECWPGnq.cjs");
5
+ const require_process_panel = require("./process-panel-D3D9Y_dc.cjs");
6
+ const require_collector = require("./collector-BfC4v87v.cjs");
7
+ const require_attach = require("./attach-D5aMqUnA.cjs");
8
+ const require_current_request_id = require("./current-request-id-Badec-TH.cjs");
8
9
  let node_url = require("node:url");
9
10
  let _warlock_js_logger = require("@warlock.js/logger");
10
11
 
@@ -48,6 +49,7 @@ function resolveDevtoolsOptions(options = {}) {
48
49
  if (!path || !path.startsWith("/")) throw new Error("Devtools option \"path\" must be a non-root path starting with \"/\".");
49
50
  if (maxRequests < 1) throw new Error("Devtools option \"maxRequests\" must be at least 1.");
50
51
  if (nPlusOneThreshold < 2) throw new Error("Devtools option \"nPlusOneThreshold\" must be at least 2.");
52
+ if (options.ai !== void 0) require_attach.resolveDevtoolsAiOptions(options.ai, "development");
51
53
  return {
52
54
  path,
53
55
  maxRequests,
@@ -55,10 +57,115 @@ function resolveDevtoolsOptions(options = {}) {
55
57
  allowedHosts: options.allowedHosts ?? [],
56
58
  allowProxied: options.allowProxied ?? false,
57
59
  panels: options.panels ?? [],
60
+ ...options.ai === void 0 ? {} : { ai: options.ai },
58
61
  ...options.production === void 0 ? {} : { production: options.production }
59
62
  };
60
63
  }
61
64
 
65
+ //#endregion
66
+ //#region ../../packages/devtools/src/ai/reports/evaluate.ts
67
+ const MAX_PROMPTS = 50;
68
+ const MAX_RUNS_SCANNED = 300;
69
+ const MAX_SYSTEM_PROMPT = 1e5;
70
+ const MAX_INSTRUCTIONS = 4e3;
71
+ const PREVIEW_LENGTH = 200;
72
+ function judgeLabel(model) {
73
+ return typeof model.provider === "string" && typeof model.name === "string" ? `${model.provider}/${model.name}` : model.name ?? "custom model";
74
+ }
75
+ /** Builds the evaluator over the agent traces and Panoptic's evaluate helpers (loaded lazily). */
76
+ function createAiEvaluator(input) {
77
+ const load = input.load ?? (() => import("@warlock.js/ai-panoptic"));
78
+ /** Panoptic's evaluate helpers, or `undefined` when Panoptic (or its evaluate support) is not there. */
79
+ async function panoptic() {
80
+ try {
81
+ const module = await load("@warlock.js/ai-panoptic");
82
+ return typeof module.getEvaluateConfig === "function" && typeof module.evaluateSystemPrompt === "function" ? module : void 0;
83
+ } catch {
84
+ return;
85
+ }
86
+ }
87
+ const unavailable = () => new require_errors.DevtoolsApiError("ai.evaluate-unavailable");
88
+ return {
89
+ async view() {
90
+ const module = await panoptic();
91
+ let config;
92
+ try {
93
+ config = module?.getEvaluateConfig();
94
+ } catch {
95
+ config = void 0;
96
+ }
97
+ const byHash = /* @__PURE__ */ new Map();
98
+ const runs = input.agentTraces.list().sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt) || 0).slice(0, MAX_RUNS_SCANNED);
99
+ for (const run of runs) {
100
+ const prompt = input.agentTraces.get(run.runId)?.systemPrompt;
101
+ if (!prompt || typeof prompt.text !== "string" || prompt.text === "") continue;
102
+ const known = byHash.get(prompt.hash);
103
+ if (known) {
104
+ if (!known.agents.includes(run.agent)) known.agents.push(run.agent);
105
+ } else byHash.set(prompt.hash, {
106
+ agents: [run.agent],
107
+ runId: run.runId,
108
+ startedAt: run.startedAt,
109
+ text: prompt.text
110
+ });
111
+ }
112
+ return {
113
+ available: true,
114
+ configured: config !== void 0,
115
+ judge: config === void 0 ? null : typeof config.model === "function" ? "custom model" : judgeLabel(config.model),
116
+ instructions: config?.instructions ?? "",
117
+ prompts: [...byHash.entries()].slice(0, MAX_PROMPTS).map(([hash, item]) => ({
118
+ hash,
119
+ agents: item.agents,
120
+ runId: item.runId,
121
+ lastSeenAt: item.startedAt,
122
+ preview: item.text.slice(0, PREVIEW_LENGTH),
123
+ length: item.text.length
124
+ }))
125
+ };
126
+ },
127
+ async evaluate(request) {
128
+ const { runId, systemPrompt, instructions } = request;
129
+ if (runId === void 0 === (systemPrompt === void 0)) throw new require_errors.DevtoolsApiError("input.invalid");
130
+ if (runId !== void 0 && (typeof runId !== "string" || runId === "") || systemPrompt !== void 0 && (typeof systemPrompt !== "string" || systemPrompt.trim() === "" || systemPrompt.length > MAX_SYSTEM_PROMPT) || instructions !== void 0 && (typeof instructions !== "string" || instructions.length > MAX_INSTRUCTIONS)) throw new require_errors.DevtoolsApiError("input.invalid");
131
+ const module = await panoptic();
132
+ let config;
133
+ try {
134
+ config = module?.getEvaluateConfig();
135
+ } catch {
136
+ config = void 0;
137
+ }
138
+ if (!module || !config) throw unavailable();
139
+ let text = systemPrompt;
140
+ if (runId !== void 0) {
141
+ text = input.agentTraces.get(runId)?.systemPrompt?.text;
142
+ if (typeof text !== "string" || text === "") throw new require_errors.DevtoolsApiError("ai.prompt-not-found");
143
+ }
144
+ const started = Date.now();
145
+ try {
146
+ const model = typeof config.model === "function" ? await config.model() : config.model;
147
+ const verdict = await module.evaluateSystemPrompt(text, {
148
+ ...config,
149
+ model
150
+ }, instructions);
151
+ return {
152
+ score: typeof verdict.score === "number" ? verdict.score : null,
153
+ issues: Array.isArray(verdict.issues) ? verdict.issues.map(String) : [],
154
+ judge: judgeLabel(model),
155
+ durationMs: Date.now() - started
156
+ };
157
+ } catch (error) {
158
+ const ref = require_errors.createErrorRef();
159
+ input.warn?.(`Devtools evaluate error ${ref}: ${error instanceof Error ? error.message : String(error)}`);
160
+ throw new require_errors.DevtoolsApiError("ai.evaluate-failed", {
161
+ ref,
162
+ cause: error
163
+ });
164
+ }
165
+ }
166
+ };
167
+ }
168
+
62
169
  //#endregion
63
170
  //#region ../../packages/devtools/src/sources/cache-source.ts
64
171
  /** Cache events the dashboard's waterfall and background bucket care about. */
@@ -140,7 +247,7 @@ var DevtoolsLogChannel = class extends _warlock_js_logger.LogChannel {
140
247
  action: data.action,
141
248
  message: messageText(data.message),
142
249
  at: Date.now(),
143
- context: require_ai_source.toSafeValue(data.context)
250
+ context: require_extract.toSafeValue(data.context)
144
251
  };
145
252
  this.collector.addLog(require_current_request_id.currentRequestId(), entry);
146
253
  }
@@ -263,7 +370,7 @@ async function attachQuerySource(collector) {
263
370
  connection: event.connection,
264
371
  driver: event.driver,
265
372
  sql: event.sql,
266
- bindings: require_ai_source.toSafeValue(redactBindings(event.bindings)),
373
+ bindings: require_extract.toSafeValue(redactBindings(event.bindings)),
267
374
  collection: event.collection,
268
375
  command: event.command,
269
376
  pipeline: event.pipeline,
@@ -306,7 +413,7 @@ async function attachTracingSource(collector, options) {
306
413
  name: phase.name,
307
414
  durationMs: phase.durationMs,
308
415
  startedAt: phase.startedAt ?? performance.timeOrigin + performance.now() - phase.durationMs,
309
- attrs: phase.attrs === void 0 ? void 0 : require_ai_source.toSafeValue(phase.attrs)
416
+ attrs: phase.attrs === void 0 ? void 0 : require_extract.toSafeValue(phase.attrs)
310
417
  });
311
418
  },
312
419
  onRequestEnd(ctx, result) {
@@ -329,6 +436,8 @@ async function attachTracingSource(collector, options) {
329
436
  * that depends on it, so it simply goes last.
330
437
  */
331
438
  const DEVTOOLS_CONNECTOR_PRIORITY = 12;
439
+ /** The slot core reads to turn query events on; see `resolveDatabaseConnectionConfig`. */
440
+ const DEVTOOLS_PRODUCTION_REQUESTED = Symbol.for("@warlock.js/devtools.productionRequested");
332
441
  /**
333
442
  * The app's `src/config/devtools.ts`, or `{}` when there is none (or the
334
443
  * config store cannot be read, which must never stop the dev server).
@@ -364,6 +473,7 @@ function readConfiguredOptions(readConfig) {
364
473
  * import of this package); options passed here win over it.
365
474
  */
366
475
  function devtoolsConnector(options = {}) {
476
+ if (options.production?.enabled === true) globalThis[DEVTOOLS_PRODUCTION_REQUESTED] = true;
367
477
  let active = false;
368
478
  const disposers = [];
369
479
  const connector = {
@@ -394,17 +504,22 @@ function devtoolsConnector(options = {}) {
394
504
  await attachSource(log, "cache", () => attachCacheSource(collector));
395
505
  await attachSource(log, "mail", () => attachMailSource(collector));
396
506
  await attachSource(log, "log", () => attachLogSource(collector));
397
- const ai = await require_ai_source.attachAiSource(resolved.maxRequests);
507
+ const ai = await require_extract.attachAiSource(resolved.maxRequests);
398
508
  disposers.push(ai.dispose);
399
- const agentTraces = await require_ai_source.attachAgentTraceSource();
509
+ const agentTraces = await require_runs.attachAgentTraceSource();
400
510
  disposers.push(agentTraces.dispose);
401
- const { mountDevtoolsRoutes } = await Promise.resolve().then(() => require("./server-D3XRbSSb.cjs"));
511
+ const aiWiring = await wireDevelopmentAiReports(ai, resolved, core, log, disposers);
512
+ const aiEvaluator = createAiEvaluator({
513
+ agentTraces,
514
+ warn: (message) => log.warn("devtools", "evaluate", message)
515
+ });
516
+ const { mountDevtoolsRoutes } = await Promise.resolve().then(() => require("./server-DLT3uPef.cjs"));
402
517
  const postmanBuilder = await findPostmanBuilder();
403
518
  const requestLog = await findRequestLogSource();
404
519
  const processPanel = await require_process_panel.loadProcessPanel();
405
520
  const builtIn = require_process_panel.processesDevtoolsPanel(processPanel);
406
521
  const panelErrors = createPanelErrorSource();
407
- const panels = await require_panels.loadDevtoolsPanels(resolved.panels ?? [], {
522
+ const panels = await require_extract.loadDevtoolsPanels(resolved.panels ?? [], {
408
523
  root: "rootPath" in core ? core.rootPath() : process.cwd(),
409
524
  warn: (message) => log.warn("devtools", "panel", message),
410
525
  taken: /* @__PURE__ */ new Map([[builtIn.id, builtIn.title]]),
@@ -416,6 +531,8 @@ function devtoolsConnector(options = {}) {
416
531
  collector,
417
532
  ai,
418
533
  agentTraces,
534
+ aiReports: aiWiring,
535
+ aiEvaluator,
419
536
  ...processPanel ? { processPanel } : {},
420
537
  panels,
421
538
  options: resolved,
@@ -435,6 +552,13 @@ function devtoolsConnector(options = {}) {
435
552
  log.warn("devtools", "n+1", `${warning.message}${where} (${event.data.method} ${event.data.path})`);
436
553
  }
437
554
  }));
555
+ globalThis[require_attach.DEVTOOLS_MOUNTED_KEY] = {
556
+ path: resolved.path,
557
+ mode: "development"
558
+ };
559
+ disposers.push(() => {
560
+ delete globalThis[require_attach.DEVTOOLS_MOUNTED_KEY];
561
+ });
438
562
  active = true;
439
563
  log.info("devtools", "ready", `devtools ready at ${resolved.path}`);
440
564
  },
@@ -444,7 +568,11 @@ function devtoolsConnector(options = {}) {
444
568
  await connector.start();
445
569
  },
446
570
  async shutdown() {
447
- for (const dispose of disposers.splice(0)) dispose();
571
+ const finished = [];
572
+ for (const dispose of disposers.splice(0)) try {
573
+ finished.push(Promise.resolve(dispose()).catch(() => void 0));
574
+ } catch {}
575
+ await Promise.all(finished);
448
576
  active = false;
449
577
  },
450
578
  shouldRestart: () => false
@@ -469,18 +597,18 @@ function devtoolsConnector(options = {}) {
469
597
  async function wireDevelopmentInsights(collector, resolved, log, disposers) {
470
598
  const stops = [];
471
599
  try {
472
- const capture = await Promise.resolve().then(() => require("./capture-CuyT8Vab.cjs"));
473
- const insights = await Promise.resolve().then(() => require("./insights-BjJA6Ret.cjs"));
600
+ const capture = await Promise.resolve().then(() => require("./capture-D2k0GnBN.cjs"));
601
+ const insights = await Promise.resolve().then(() => require("./insights-COA3u37q.cjs"));
474
602
  const instance = insights.createInstanceInfo();
475
603
  const queries = capture.createQueryStats({
476
- maxShapes: require_options.DEVTOOLS_PRODUCTION_DEFAULTS.maxShapes,
604
+ maxShapes: require_attach.DEVTOOLS_PRODUCTION_DEFAULTS.maxShapes,
477
605
  instance: instance.id
478
606
  });
479
607
  const routes = capture.createRouteStats({
480
- maxRoutes: require_options.DEVTOOLS_PRODUCTION_DEFAULTS.maxRoutes,
608
+ maxRoutes: require_attach.DEVTOOLS_PRODUCTION_DEFAULTS.maxRoutes,
481
609
  instance: instance.id
482
610
  });
483
- const errors = capture.createErrorGroups({ maxGroups: require_options.DEVTOOLS_PRODUCTION_DEFAULTS.maxErrorGroups });
611
+ const errors = capture.createErrorGroups({ maxGroups: require_attach.DEVTOOLS_PRODUCTION_DEFAULTS.maxErrorGroups });
484
612
  const logs = capture.createRecentLogs({ maxEntries: 200 });
485
613
  stops.push(capture.attachDevelopmentStats(collector, {
486
614
  queries,
@@ -525,17 +653,47 @@ async function wireDevelopmentInsights(collector, resolved, log, disposers) {
525
653
  }
526
654
  }
527
655
  /**
656
+ * Starts this process's AI totals in development: loads the Panoptic feed and
657
+ * writes hourly rollups to `storage/devtools/ai-rollups`. Never throws; a
658
+ * failure leaves the Reports, Models and Errors pages answering why.
659
+ */
660
+ async function wireDevelopmentAiReports(ai, resolved, core, log, disposers) {
661
+ const none = (reason) => ({
662
+ ...require_extract.toAiUnavailableView(require_extract.describeAiUnavailable(reason)),
663
+ async dispose() {}
664
+ });
665
+ try {
666
+ const loaded = await require_attach.loadAiFeed();
667
+ if ("unavailable" in loaded) return {
668
+ ...loaded.unavailable,
669
+ async dispose() {}
670
+ };
671
+ const reports = await require_attach.attachAiReports({
672
+ feed: loaded.feed,
673
+ options: require_attach.resolveDevtoolsAiOptions(resolved.ai, "development"),
674
+ ...typeof core.storagePath === "function" ? { directory: core.storagePath("devtools/ai-rollups") } : {},
675
+ recentFailures: (filter) => ai.available ? require_runs.recentAiFailures(ai.store.query(), 50, filter) : [],
676
+ warn: (message) => log.warn("devtools", "ai-reports", message)
677
+ });
678
+ disposers.push(() => reports.dispose());
679
+ return reports;
680
+ } catch (error) {
681
+ log.warn("devtools", "ai-reports", `AI reports could not start: ${error instanceof Error ? error.message : String(error)}`);
682
+ return none("reports-off");
683
+ }
684
+ }
685
+ /**
528
686
  * Starts the production monitor: loads the panels in production mode and
529
687
  * hands everything to `bootProductionDevtools`, which refuses to boot (throws
530
688
  * `DevtoolsProductionConfigError`) when the configuration is incomplete.
531
689
  */
532
690
  async function bootProduction(core, log, resolved) {
533
- const { bootProductionDevtools } = await Promise.resolve().then(() => require("./boot-nczSvJ_F.cjs"));
691
+ const { bootProductionDevtools } = await Promise.resolve().then(() => require("./boot-D0nF-7w3.cjs"));
534
692
  const requestLog = await findRequestLogSource();
535
693
  const processPanel = resolved.production?.panels?.processes === true ? await require_process_panel.loadProcessPanel() : void 0;
536
694
  const builtIn = require_process_panel.processesDevtoolsPanel(processPanel);
537
695
  const panelErrors = createPanelErrorSource();
538
- const packagePanels = await require_panels.loadDevtoolsPanels(resolved.panels ?? [], {
696
+ const packagePanels = await require_extract.loadDevtoolsPanels(resolved.panels ?? [], {
539
697
  root: "rootPath" in core ? core.rootPath() : process.cwd(),
540
698
  warn: (message) => log.warn("devtools", "panel", message),
541
699
  taken: /* @__PURE__ */ new Map([[builtIn.id, builtIn.title]]),
@@ -548,7 +706,7 @@ async function bootProduction(core, log, resolved) {
548
706
  options: resolved,
549
707
  env: process.env,
550
708
  server: core.getHttpServer(),
551
- panels: [...require_panels.checkDevtoolsPanels([builtIn]), ...packagePanels],
709
+ panels: [...require_extract.checkDevtoolsPanels([builtIn]), ...packagePanels],
552
710
  routes: {
553
711
  ...processPanel ? { processPanel } : {},
554
712
  ...requestLog ? { requestLog } : {},
@@ -690,4 +848,4 @@ Object.defineProperty(exports, "mail_source_exports", {
690
848
  return mail_source_exports;
691
849
  }
692
850
  });
693
- //# sourceMappingURL=src-QcNghoYN.cjs.map
851
+ //# sourceMappingURL=src-BZiSv8A1.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-BZiSv8A1.cjs","names":["DevtoolsApiError","createErrorRef","currentRequestId","LogChannel","toSafeValue","currentRequestId","currentRequestId","fileURLToPath","applyRedact","log","currentRequestId","toSafeValue","toSafeValue","createCollector","attachAiSource","attachAgentTraceSource","loadProcessPanel","processesDevtoolsPanel","loadDevtoolsPanels","DEVTOOLS_MOUNTED_KEY","DEVTOOLS_PRODUCTION_DEFAULTS","toAiUnavailableView","describeAiUnavailable","loadAiFeed","attachAiReports","resolveDevtoolsAiOptions","recentAiFailures","checkDevtoolsPanels"],"sources":["../../../../../../../packages/devtools/src/panel-errors.ts","../../../../../../../packages/devtools/src/options.ts","../../../../../../../packages/devtools/src/ai/reports/evaluate.ts","../../../../../../../packages/devtools/src/sources/cache-source.ts","../../../../../../../packages/devtools/src/sources/log-source.ts","../../../../../../../packages/devtools/src/sources/mail-source.ts","../../../../../../../packages/devtools/src/caller-location.ts","../../../../../../../packages/devtools/src/sources/query-source.ts","../../../../../../../packages/devtools/src/sources/tracing-source.ts","../../../../../../../packages/devtools/src/devtools-connector.ts","../../../../../../../packages/devtools/src/panel-tokens.ts"],"sourcesContent":["import type { DevtoolsErrorsView } from \"./production/contracts\";\nimport type { DevtoolsPanelErrorSummary } from \"./types\";\n\n/** Captured errors are offered to panels for the last hour. */\nconst WINDOW_MS = 3_600_000;\n\n/** The most error groups one read maps. */\nconst MAX_GROUPS = 500;\n\n/** The part of the insights a panel's error counts come from. */\ntype ErrorInsights = {\n errors(query: { instance: string; limit: number }): Promise<DevtoolsErrorsView>;\n};\n\n/**\n * What a panel factory receives as `context.errors`. Panels load before the\n * capture starts, so this reads through a source the connector binds once the\n * insights exist; until then (and when they never start) it answers an empty\n * list. Only counts, the route and the class name leave: no message, no stack.\n */\nexport type PanelErrorSource = {\n read: () => Promise<readonly DevtoolsPanelErrorSummary[]>;\n /** Binds the insights (development: this process; production: every instance). */\n bind(insights: ErrorInsights | null): void;\n};\n\nexport function createPanelErrorSource(now: () => number = Date.now): PanelErrorSource {\n let insights: ErrorInsights | null = null;\n\n return {\n bind(next) {\n insights = next;\n },\n async read() {\n if (insights === null) return [];\n\n const since = now() - WINDOW_MS;\n const view = await insights.errors({ instance: \"all\", limit: MAX_GROUPS });\n\n return view.groups\n .filter((group) => group.lastSeen >= since)\n .map((group) => ({\n route: group.route,\n status: group.status,\n name: group.name,\n source: group.source,\n count: group.count,\n firstSeen: group.firstSeen,\n lastSeen: group.lastSeen,\n }));\n },\n };\n}\n","import { resolveDevtoolsAiOptions } from \"./ai/options\";\nimport type { DevtoolsOptions, ResolvedDevtoolsOptions } from \"./types\";\n\n/** Resolves dashboard options and rejects invalid capacity or URL-prefix values. */\nexport function resolveDevtoolsOptions(options: DevtoolsOptions = {}): ResolvedDevtoolsOptions {\n const path = (options.path ?? \"/__warlock\").replace(/\\/+$/, \"\");\n const maxRequests = options.maxRequests ?? 200;\n const nPlusOneThreshold = options.nPlusOneThreshold ?? 5;\n\n if (!path || !path.startsWith(\"/\")) {\n throw new Error('Devtools option \"path\" must be a non-root path starting with \"/\".');\n }\n\n if (maxRequests < 1) {\n throw new Error('Devtools option \"maxRequests\" must be at least 1.');\n }\n\n if (nPlusOneThreshold < 2) {\n throw new Error('Devtools option \"nPlusOneThreshold\" must be at least 2.');\n }\n\n // Validates the AI options; the mode defaults are applied where the mode is known.\n if (options.ai !== undefined) resolveDevtoolsAiOptions(options.ai, \"development\");\n\n return {\n path,\n maxRequests,\n nPlusOneThreshold,\n allowedHosts: options.allowedHosts ?? [],\n allowProxied: options.allowProxied ?? false,\n panels: options.panels ?? [],\n ...(options.ai === undefined ? {} : { ai: options.ai }),\n ...(options.production === undefined ? {} : { production: options.production }),\n };\n}\n","import type {\n DevtoolsAiEvaluateRequest,\n DevtoolsAiEvaluateResult,\n DevtoolsAiEvaluateView,\n} from \"../../production/contracts\";\nimport { createErrorRef, DevtoolsApiError } from \"../../production/errors\";\nimport type { DevtoolsAgentTraceSource } from \"../../sources/agent-trace-source\";\n\nconst MAX_PROMPTS = 50;\nconst MAX_RUNS_SCANNED = 300;\nconst MAX_SYSTEM_PROMPT = 100_000;\nconst MAX_INSTRUCTIONS = 4000;\nconst PREVIEW_LENGTH = 200;\n\ntype EvaluateModule = {\n getEvaluateConfig?: () => EvaluateConfigLike | undefined;\n evaluateSystemPrompt?: (\n systemPrompt: string,\n config: EvaluateConfigLike,\n instructions?: string,\n ) => Promise<{ score?: number; issues?: string[] }>;\n};\n\ntype ModelLike = { name?: string; provider?: string };\n\ntype EvaluateConfigLike = {\n model: ModelLike | (() => ModelLike | Promise<ModelLike>);\n instructions?: string;\n};\n\n/** What the Evaluate routes use; injected so specs need no model. */\nexport type DevtoolsAiEvaluator = {\n /** The page data: whether a judge is configured and the recent distinct system prompts. */\n view(): Promise<Extract<DevtoolsAiEvaluateView, { available: true }>>;\n /**\n * Grades a prompt with Panoptic's `evaluateSystemPrompt`. Throws\n * `DevtoolsApiError` `input.invalid` (both or neither of runId/systemPrompt,\n * sizes), `ai.evaluate-unavailable` (no judge configured),\n * `ai.prompt-not-found` (run gone or its text not kept) or\n * `ai.evaluate-failed` (the judge threw; logged with the reference).\n */\n evaluate(request: DevtoolsAiEvaluateRequest): Promise<DevtoolsAiEvaluateResult>;\n};\n\nfunction judgeLabel(model: ModelLike): string {\n return typeof model.provider === \"string\" && typeof model.name === \"string\"\n ? `${model.provider}/${model.name}`\n : (model.name ?? \"custom model\");\n}\n\n/** Builds the evaluator over the agent traces and Panoptic's evaluate helpers (loaded lazily). */\nexport function createAiEvaluator(input: {\n agentTraces: DevtoolsAgentTraceSource;\n load?: (name: string) => Promise<unknown>;\n warn?: (message: string) => void;\n}): DevtoolsAiEvaluator {\n const load = input.load ?? (() => import(\"@warlock.js/ai-panoptic\"));\n\n /** Panoptic's evaluate helpers, or `undefined` when Panoptic (or its evaluate support) is not there. */\n async function panoptic(): Promise<(EvaluateModule & Required<EvaluateModule>) | undefined> {\n try {\n const module = (await load(\"@warlock.js/ai-panoptic\")) as EvaluateModule;\n\n return typeof module.getEvaluateConfig === \"function\" &&\n typeof module.evaluateSystemPrompt === \"function\"\n ? (module as EvaluateModule & Required<EvaluateModule>)\n : undefined;\n } catch {\n return undefined;\n }\n }\n\n const unavailable = (): DevtoolsApiError => new DevtoolsApiError(\"ai.evaluate-unavailable\");\n\n return {\n async view() {\n const module = await panoptic();\n let config: EvaluateConfigLike | undefined;\n\n try {\n config = module?.getEvaluateConfig();\n } catch {\n config = undefined;\n }\n\n const byHash = new Map<\n string,\n { agents: string[]; runId: string; startedAt: string; text: string }\n >();\n const runs = input.agentTraces\n .list()\n .sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt) || 0)\n .slice(0, MAX_RUNS_SCANNED);\n\n for (const run of runs) {\n const prompt = input.agentTraces.get(run.runId)?.systemPrompt;\n\n if (!prompt || typeof prompt.text !== \"string\" || prompt.text === \"\") continue;\n\n const known = byHash.get(prompt.hash);\n\n if (known) {\n if (!known.agents.includes(run.agent)) known.agents.push(run.agent);\n } else {\n byHash.set(prompt.hash, {\n agents: [run.agent],\n runId: run.runId,\n startedAt: run.startedAt,\n text: prompt.text,\n });\n }\n }\n\n return {\n available: true as const,\n configured: config !== undefined,\n judge:\n config === undefined\n ? null\n : typeof config.model === \"function\"\n ? \"custom model\"\n : judgeLabel(config.model),\n instructions: config?.instructions ?? \"\",\n prompts: [...byHash.entries()].slice(0, MAX_PROMPTS).map(([hash, item]) => ({\n hash,\n agents: item.agents,\n runId: item.runId,\n lastSeenAt: item.startedAt,\n preview: item.text.slice(0, PREVIEW_LENGTH),\n length: item.text.length,\n })),\n };\n },\n\n async evaluate(request) {\n const { runId, systemPrompt, instructions } = request;\n\n if ((runId === undefined) === (systemPrompt === undefined)) {\n throw new DevtoolsApiError(\"input.invalid\");\n }\n\n if (\n (runId !== undefined && (typeof runId !== \"string\" || runId === \"\")) ||\n (systemPrompt !== undefined &&\n (typeof systemPrompt !== \"string\" ||\n systemPrompt.trim() === \"\" ||\n systemPrompt.length > MAX_SYSTEM_PROMPT)) ||\n (instructions !== undefined &&\n (typeof instructions !== \"string\" || instructions.length > MAX_INSTRUCTIONS))\n ) {\n throw new DevtoolsApiError(\"input.invalid\");\n }\n\n const module = await panoptic();\n let config: EvaluateConfigLike | undefined;\n\n try {\n config = module?.getEvaluateConfig();\n } catch {\n config = undefined;\n }\n\n if (!module || !config) throw unavailable();\n\n let text = systemPrompt;\n\n if (runId !== undefined) {\n text = input.agentTraces.get(runId)?.systemPrompt?.text;\n\n if (typeof text !== \"string\" || text === \"\")\n throw new DevtoolsApiError(\"ai.prompt-not-found\");\n }\n\n const started = Date.now();\n\n try {\n const model = typeof config.model === \"function\" ? await config.model() : config.model;\n const verdict = await module.evaluateSystemPrompt(\n text as string,\n { ...config, model },\n instructions,\n );\n\n return {\n score: typeof verdict.score === \"number\" ? verdict.score : null,\n issues: Array.isArray(verdict.issues) ? verdict.issues.map(String) : [],\n judge: judgeLabel(model),\n durationMs: Date.now() - started,\n };\n } catch (error) {\n const ref = createErrorRef();\n\n input.warn?.(\n `Devtools evaluate error ${ref}: ${error instanceof Error ? error.message : String(error)}`,\n );\n\n throw new DevtoolsApiError(\"ai.evaluate-failed\", { ref, cause: error });\n }\n },\n };\n}\n","import { currentRequestId } from \"../current-request-id\";\nimport type { DevtoolsCacheOperation, DevtoolsCollector, DevtoolsDisposer } from \"../types\";\n\n/** Cache events the dashboard's waterfall and background bucket care about. */\nconst EVENT_TYPES = [\"hit\", \"miss\", \"set\", \"removed\", \"invalidated\", \"flushed\"] as const;\n\n/** The shape `cache.on(event, handler)` hands the handler. */\ntype CacheEventData = {\n key?: string;\n driver: string;\n tags?: string[];\n keys?: string[];\n durationMs?: number;\n};\n\n/**\n * Feeds cache hits, misses and mutations, from `@warlock.js/cache`, into the\n * collector. A no-op when `@warlock.js/cache` isn't installed — it is an\n * optional peer.\n */\nexport async function attachCacheSource(collector: DevtoolsCollector): Promise<DevtoolsDisposer> {\n let cache: {\n on(event: (typeof EVENT_TYPES)[number], handler: (data: CacheEventData) => void): unknown;\n off(event: (typeof EVENT_TYPES)[number], handler: (data: CacheEventData) => void): unknown;\n };\n\n try {\n ({ cache } = await import(\"@warlock.js/cache\"));\n } catch {\n return () => {};\n }\n\n const handlers = EVENT_TYPES.map((type) => {\n const handler = (data: CacheEventData) => {\n const operation: DevtoolsCacheOperation = {\n type,\n driver: data.driver,\n key: data.key,\n tags: data.tags,\n keys: data.keys,\n at: Date.now(),\n durationMs: data.durationMs,\n };\n\n collector.addCacheOperation(currentRequestId(), operation);\n };\n\n cache.on(type, handler);\n\n return { type, handler };\n });\n\n return () => {\n for (const { type, handler } of handlers) cache.off(type, handler);\n };\n}\n","import { LogChannel, log, type LoggingData } from \"@warlock.js/logger\";\nimport { currentRequestId } from \"../current-request-id\";\nimport { toSafeValue } from \"../safe-value\";\nimport type { DevtoolsCollector, DevtoolsDisposer, DevtoolsLogEntry } from \"../types\";\n\n/** `LoggingData.type` includes `fatal`, which devtools folds into `error`. */\nfunction toDevtoolsLevel(type: LoggingData[\"type\"]): DevtoolsLogEntry[\"level\"] {\n return type === \"fatal\" ? \"error\" : type;\n}\n\n/**\n * The entry's message as text. `request.log(error)` and friends log an Error\n * (or any value) as the message; kept as is, it reached the dashboard as `{}`.\n */\nfunction messageText(message: unknown): string {\n if (typeof message === \"string\") return message;\n if (message instanceof Error) return `${message.name}: ${message.message}`;\n\n try {\n return JSON.stringify(message) ?? String(message);\n } catch {\n return String(message);\n }\n}\n\nclass DevtoolsLogChannel extends LogChannel {\n public override name = \"devtools\";\n public active = true;\n\n public constructor(private readonly collector: DevtoolsCollector) {\n super();\n }\n\n public log(data: LoggingData): void {\n if (!this.active) return;\n\n // Already passed through the logger's redaction floor (`Logger.log`\n // applies it before invoking any channel). It is still app data, and can\n // hold live objects (a request, its socket), so a JSON-safe snapshot is\n // kept instead of the object itself.\n const entry: DevtoolsLogEntry = {\n level: toDevtoolsLevel(data.type),\n module: data.module,\n action: data.action,\n message: messageText(data.message),\n at: Date.now(),\n context: toSafeValue(data.context),\n };\n\n this.collector.addLog(currentRequestId(), entry);\n }\n}\n\n/**\n * Feeds every log entry, from `@warlock.js/logger`, into the collector by\n * registering an additional channel. `Logger` has no way to remove a\n * channel, so the disposer flag-ignores further entries instead — the\n * channel stays registered for the process's lifetime.\n */\nexport async function attachLogSource(collector: DevtoolsCollector): Promise<DevtoolsDisposer> {\n const channel = new DevtoolsLogChannel(collector);\n\n log.addChannel(channel);\n\n return () => {\n channel.active = false;\n };\n}\n","import type { CapturedMail, MailAddress, MailAttachment } from \"@warlock.js/core\";\nimport { currentRequestId } from \"../current-request-id\";\nimport type { DevtoolsCollector, DevtoolsDisposer, DevtoolsMailAttachment } from \"../types\";\n\nfunction addressToString(address: MailAddress | undefined): string | undefined {\n if (!address) return undefined;\n\n return typeof address === \"string\" ? address : `${address.name} <${address.address}>`;\n}\n\nfunction attachmentSize(attachment: MailAttachment): number | undefined {\n if (typeof attachment.content === \"string\") return Buffer.byteLength(attachment.content);\n if (Buffer.isBuffer(attachment.content)) return attachment.content.length;\n\n return undefined;\n}\n\nfunction toDevtoolsAttachment(attachment: MailAttachment): DevtoolsMailAttachment {\n return {\n filename: attachment.filename,\n contentType: attachment.contentType,\n size: attachmentSize(attachment),\n };\n}\n\n/**\n * Feeds mails captured in development mode, from core's `mailEvents`, into\n * the collector. The captured attachments carry their content, but only\n * metadata is stored — the bytes are never kept.\n */\nexport async function attachMailSource(collector: DevtoolsCollector): Promise<DevtoolsDisposer> {\n const { mailEvents } = await import(\"@warlock.js/core\");\n\n const subscription = mailEvents.onCaptured((mail: CapturedMail) => {\n const { normalized } = mail;\n\n collector.addMail({\n id: mail.id,\n requestId: currentRequestId(),\n capturedAt: mail.timestamp.getTime(),\n from: addressToString(normalized.from),\n to: normalized.to,\n cc: normalized.cc,\n bcc: normalized.bcc,\n subject: normalized.subject,\n html: normalized.html,\n text: normalized.text,\n headers: normalized.headers,\n attachments: normalized.attachments.map(toDevtoolsAttachment),\n });\n });\n\n return () => subscription.unsubscribe();\n}\n","import { fileURLToPath } from \"node:url\";\n\nimport type { DevtoolsCallerLocation } from \"./types\";\n\nconst packageDirectory = normalizePath(fileURLToPath(new URL(\"../\", import.meta.url)));\n\n/** Returns the first non-runtime, non-devtools frame in a V8 stack trace. */\nexport function captureCallerLocation(\n stack: string = new Error().stack ?? \"\",\n): DevtoolsCallerLocation | undefined {\n for (const line of stack.split(\"\\n\")) {\n const frame = parseFrame(line);\n if (!frame || shouldSkip(frame.file)) continue;\n return frame;\n }\n return undefined;\n}\n\nfunction parseFrame(frame: string): DevtoolsCallerLocation | undefined {\n const match = frame.match(/\\bat\\s+(?:.*?\\s+\\()?(.+?):(\\d+):(\\d+)\\)?\\s*$/);\n const [, rawFile, line, column] = match ?? [];\n if (!rawFile || !line || !column) return undefined;\n const file = normalizePath(rawFile);\n return { file, line: Number(line), column: Number(column) };\n}\n\n/** A drive-letter file URL names a Windows path on whichever host decodes it. */\nconst WINDOWS_DRIVE_FILE_URL = /^file:\\/\\/\\/[A-Za-z]:/;\n\nfunction normalizePath(path: string): string {\n const decoded = !path.startsWith(\"file:\")\n ? path\n : WINDOWS_DRIVE_FILE_URL.test(path)\n ? fileURLToPath(path, { windows: true })\n : fileURLToPath(path);\n return decoded.replace(/\\\\/g, \"/\");\n}\n\nfunction shouldSkip(file: string): boolean {\n return (\n file.startsWith(\"node:\") ||\n file.includes(\"/node_modules/\") ||\n // Node's own frames (`node:internal/…`, or bare `internal/…` on older\n // runtimes); an app folder named `internal` is still an app frame.\n file.startsWith(\"internal/\") ||\n file.startsWith(packageDirectory)\n );\n}\n","import { applyRedact, log } from \"@warlock.js/logger\";\nimport { captureCallerLocation } from \"../caller-location\";\nimport { currentRequestId } from \"../current-request-id\";\nimport { toSafeValue } from \"../safe-value\";\nimport type { DevtoolsCollector, DevtoolsDisposer } from \"../types\";\n\n/** The shape of the event `dataSourceRegistry` emits for `\"query\"`. */\ntype QueryEvent = {\n connection: string;\n driver: \"postgres\" | \"mongodb\";\n sql?: string;\n bindings?: unknown[];\n collection?: string;\n command?: string;\n pipeline?: unknown;\n durationMs: number;\n startedAt: number;\n rowCount?: number;\n error?: unknown;\n};\n\n/** Redacts query bindings through the logger's redaction rules. */\nfunction redactBindings(bindings: unknown[] | undefined): unknown[] | undefined {\n if (!bindings) return bindings;\n\n const redacted = applyRedact(\n {\n type: \"debug\",\n module: \"devtools\",\n action: \"query\",\n message: undefined,\n context: { bindings },\n },\n log.getRedact(),\n );\n\n return (redacted.context as { bindings: unknown[] }).bindings;\n}\n\n/**\n * Feeds every settled database query, from cascade's data source registry,\n * into the collector. A no-op when `@warlock.js/cascade` isn't installed —\n * it is an optional peer.\n */\nexport async function attachQuerySource(collector: DevtoolsCollector): Promise<DevtoolsDisposer> {\n let dataSourceRegistry: {\n on(event: \"query\", listener: (event: QueryEvent) => void): void;\n off(event: \"query\", listener: (event: QueryEvent) => void): void;\n };\n\n try {\n ({ dataSourceRegistry } = await import(\"@warlock.js/cascade\"));\n } catch {\n return () => {};\n }\n\n const listener = (event: QueryEvent) => {\n collector.addQuery(currentRequestId(), {\n connection: event.connection,\n driver: event.driver,\n sql: event.sql,\n bindings: toSafeValue(redactBindings(event.bindings)) as unknown[] | undefined,\n collection: event.collection,\n command: event.command,\n pipeline: event.pipeline,\n startedAt: event.startedAt,\n durationMs: event.durationMs,\n rowCount: event.rowCount,\n error:\n event.error === undefined\n ? undefined\n : event.error instanceof Error\n ? event.error.message\n : String(event.error),\n caller: captureCallerLocation(),\n });\n };\n\n dataSourceRegistry.on(\"query\", listener);\n\n return () => dataSourceRegistry.off(\"query\", listener);\n}\n","import type { TracingContext, TracingPhaseInfo, TracingRequestEndInfo } from \"@warlock.js/core\";\nimport { toSafeValue } from \"../safe-value\";\nimport type { DevtoolsCollector, DevtoolsDisposer, ResolvedDevtoolsOptions } from \"../types\";\n\n/**\n * Feeds request timelines from core's tracing hooks into the collector: one\n * `startRequest`/`endRequest` pair per HTTP request, with every named phase\n * in between. Requests to the dashboard's own path are never recorded, so\n * the dashboard never watches itself.\n */\nexport async function attachTracingSource(\n collector: DevtoolsCollector,\n options: ResolvedDevtoolsOptions,\n): Promise<DevtoolsDisposer> {\n const { registerTracingHooks } = await import(\"@warlock.js/core\");\n\n const isDashboardPath = (path: string): boolean => path.startsWith(options.path);\n\n return registerTracingHooks({\n onRequestStart(ctx: TracingContext) {\n if (isDashboardPath(ctx.path)) return;\n\n collector.startRequest({\n id: ctx.requestId,\n method: ctx.method,\n path: ctx.path,\n route: ctx.route,\n startedAt: performance.timeOrigin + performance.now(),\n });\n },\n onPhase(ctx: TracingContext, phase: TracingPhaseInfo) {\n if (isDashboardPath(ctx.path)) return;\n\n collector.addPhase(ctx.requestId, {\n name: phase.name,\n durationMs: phase.durationMs,\n startedAt: phase.startedAt ?? performance.timeOrigin + performance.now() - phase.durationMs,\n attrs:\n phase.attrs === undefined\n ? undefined\n : (toSafeValue(phase.attrs) as Record<string, unknown>),\n });\n },\n onRequestEnd(ctx: TracingContext, result: TracingRequestEndInfo) {\n if (isDashboardPath(ctx.path)) return;\n\n collector.endRequest(ctx.requestId, {\n status: result.status,\n durationMs: result.durationMs,\n error:\n result.error === undefined\n ? undefined\n : result.error instanceof Error\n ? result.error.message\n : String(result.error),\n route: ctx.route,\n });\n },\n });\n}\n","/**\n * The devtools connector for `warlock.config.ts > connectors`.\n *\n * Deliberately a plain object with TYPE-ONLY imports from core: the config\n * file that constructs it must not drag core's runtime graph in at\n * config-load time. Core is imported lazily inside `boot()`, where the app\n * has already loaded it — see `queue/src/queue-connector.ts`, the pattern\n * this mirrors.\n */\nimport type { Connector, ConnectorLifecyclePhase } from \"@warlock.js/core\";\nimport { createPanelErrorSource } from \"./panel-errors\";\nimport { checkDevtoolsPanels, loadDevtoolsPanels } from \"./panels\";\nimport { loadProcessPanel, processesDevtoolsPanel } from \"./process-panel\";\nimport { createCollector } from \"./collector\";\nimport { resolveDevtoolsOptions } from \"./options\";\nimport { DEVTOOLS_PRODUCTION_DEFAULTS } from \"./production/options\";\nimport type { DevtoolsRequestLogSource, DevtoolsRouteRow, MountDevtoolsRoutesDeps } from \"./server\";\nimport { attachAgentTraceSource } from \"./sources/agent-trace-source\";\nimport { attachAiReports, DEVTOOLS_MOUNTED_KEY, loadAiFeed } from \"./ai/attach\";\nimport { resolveDevtoolsAiOptions } from \"./ai/options\";\nimport { createAiEvaluator } from \"./ai/reports/evaluate\";\nimport { recentAiFailures } from \"./ai/reports/runs\";\nimport { attachAiSource, describeAiUnavailable, toAiUnavailableView } from \"./sources/ai-source\";\nimport { attachCacheSource } from \"./sources/cache-source\";\nimport { attachLogSource } from \"./sources/log-source\";\nimport { attachMailSource } from \"./sources/mail-source\";\nimport { attachQuerySource } from \"./sources/query-source\";\nimport { attachTracingSource } from \"./sources/tracing-source\";\nimport type { DevtoolsDisposer, DevtoolsOptions, DevtoolsQuery } from \"./types\";\n\n/**\n * Boots after the queue connector (priority 11), which is the last\n * built-in/framework connector to claim a priority; devtools has nothing\n * that depends on it, so it simply goes last.\n */\nexport const DEVTOOLS_CONNECTOR_PRIORITY = 12;\n\n/** The slot core reads to turn query events on; see `resolveDatabaseConnectionConfig`. */\nexport const DEVTOOLS_PRODUCTION_REQUESTED = Symbol.for(\"@warlock.js/devtools.productionRequested\");\n\n/**\n * The app's `src/config/devtools.ts`, or `{}` when there is none (or the\n * config store cannot be read, which must never stop the dev server).\n */\nfunction readConfiguredOptions(readConfig: () => { get(name: string): unknown }): DevtoolsOptions {\n try {\n const value = readConfig().get(\"devtools\");\n\n return value !== null && typeof value === \"object\" ? (value as DevtoolsOptions) : {};\n } catch {\n return {};\n }\n}\n\n/** Options accepted by `devtoolsConnector()`. */\nexport type DevtoolsConnectorOptions = DevtoolsOptions;\n\n/**\n * Construct the devtools connector.\n *\n * Outside development, `boot()` checks `Application.runtimeStrategy` and\n * `devtools.production.enabled`: unless both say production, it logs one\n * warning and returns without mounting a route or subscribing to anything.\n * With `enabled: true` in production it starts the signed-in production\n * monitor (`bootProductionDevtools`), which refuses to boot when its\n * configuration is incomplete. In development it attaches every source\n * (tracing, queries, cache, mail, logs), loads the panels listed in the\n * `panels` option, then mounts the dashboard's routes on the HTTP server —\n * before it starts listening, the only point in the boot sequence where\n * mounting is possible (see `queue/src/dashboard-boot.ts` for the same\n * constraint).\n *\n * In development apps don't call this: `warlock dev` registers it\n * automatically when the package is installed (`warlock add devtools`). To\n * run the production monitor, list `devtoolsConnector()` in\n * `warlock.config.ts > connectors` (and keep the package in `dependencies`).\n * Options come from the app's `src/config/devtools.ts` (a plain object, no\n * import of this package); options passed here win over it.\n */\nexport function devtoolsConnector(options: DevtoolsConnectorOptions = {}): Connector {\n // Core reads this slot when it connects the database, so the monitor's\n // Queries tab gets query events without `devtools.production.enabled` in config.\n if (options.production?.enabled === true) {\n (globalThis as Record<symbol, unknown>)[DEVTOOLS_PRODUCTION_REQUESTED] = true;\n }\n\n let active = false;\n const disposers: DevtoolsDisposer[] = [];\n\n const connector: Connector = {\n name: \"devtools\",\n priority: DEVTOOLS_CONNECTOR_PRIORITY,\n // Core's `ConnectorLifecyclePhase.Late`; spelled out so this module stays\n // free of a runtime import of core.\n lifecyclePhase: \"late\" as ConnectorLifecyclePhase,\n isActive: () => active,\n async boot() {\n const core = await import(\"@warlock.js/core\");\n const { Application, getHttpServer } = core;\n const { log } = await import(\"@warlock.js/logger\");\n\n const resolved = resolveDevtoolsOptions({\n ...readConfiguredOptions(() => core.config),\n ...options,\n });\n\n if (Application.runtimeStrategy === \"production\" && resolved.production?.enabled === true) {\n disposers.push(await bootProduction(core, log, resolved));\n active = true;\n\n return;\n }\n\n if (Application.runtimeStrategy !== \"development\") {\n log.warn(\n \"devtools\",\n \"disabled\",\n \"@warlock.js/devtools only runs in development unless devtools.production.enabled is true; it is not mounted\",\n );\n return;\n }\n\n const collector = createCollector(resolved);\n\n await attachSource(log, \"tracing\", () => attachTracingSource(collector, resolved));\n await attachSource(log, \"query\", () => attachQuerySource(collector));\n await attachSource(log, \"cache\", () => attachCacheSource(collector));\n await attachSource(log, \"mail\", () => attachMailSource(collector));\n await attachSource(log, \"log\", () => attachLogSource(collector));\n\n const ai = await attachAiSource(resolved.maxRequests);\n disposers.push(ai.dispose);\n\n const agentTraces = await attachAgentTraceSource();\n disposers.push(agentTraces.dispose);\n\n const aiWiring = await wireDevelopmentAiReports(ai, resolved, core, log, disposers);\n const aiEvaluator = createAiEvaluator({\n agentTraces,\n warn: (message) => log.warn(\"devtools\", \"evaluate\", message),\n });\n\n const { mountDevtoolsRoutes } = await import(\"./server\");\n const postmanBuilder = await findPostmanBuilder();\n const requestLog = await findRequestLogSource();\n const processPanel = await loadProcessPanel();\n const builtIn = processesDevtoolsPanel(processPanel);\n // A panel that fails to load or reuses an id is reported and left out;\n // it never stops the dashboard or the app.\n const panelErrors = createPanelErrorSource();\n const panels = await loadDevtoolsPanels(resolved.panels ?? [], {\n root: \"rootPath\" in core ? core.rootPath() : process.cwd(),\n warn: (message) => log.warn(\"devtools\", \"panel\", message),\n taken: new Map([[builtIn.id, builtIn.title]]),\n errors: panelErrors.read,\n });\n\n const insightsWiring = await wireDevelopmentInsights(collector, resolved, log, disposers);\n\n panelErrors.bind(insightsWiring.insights ?? null);\n\n mountDevtoolsRoutes(getHttpServer(), {\n collector,\n ai,\n agentTraces,\n aiReports: aiWiring,\n aiEvaluator,\n ...(processPanel ? { processPanel } : {}),\n panels,\n options: resolved,\n ...insightsWiring,\n requestLog,\n isDevelopment: () => Application.runtimeStrategy === \"development\",\n warn: (message) => log.warn(\"devtools\", \"refused\", message),\n explain: (query) => explainQuery(query),\n listRoutes: () => listRoutes(),\n getOpenApiDocument: () => getOpenApiDocument(),\n getPostmanCollection: postmanBuilder\n ? async () => unwrapCollection(await postmanBuilder())\n : undefined,\n });\n\n // An N+1 is worth a terminal line, not just a badge the developer has\n // to go looking for: one warning per offending query shape, with the\n // line that issued it.\n disposers.push(\n collector.subscribe((event) => {\n if (event.type !== \"request\" || event.data.warningCount === 0) return;\n\n for (const warning of collector.getRequest(event.data.id)?.warnings ?? []) {\n const where = warning.caller ? ` — ${warning.caller.file}:${warning.caller.line}` : \"\";\n\n log.warn(\n \"devtools\",\n \"n+1\",\n `${warning.message}${where} (${event.data.method} ${event.data.path})`,\n );\n }\n }),\n );\n\n (globalThis as Record<symbol, unknown>)[DEVTOOLS_MOUNTED_KEY] = {\n path: resolved.path,\n mode: \"development\",\n };\n disposers.push(() => {\n delete (globalThis as Record<symbol, unknown>)[DEVTOOLS_MOUNTED_KEY];\n });\n\n active = true;\n\n log.info(\"devtools\", \"ready\", `devtools ready at ${resolved.path}`);\n },\n async start() {},\n async restart() {\n await connector.shutdown();\n await connector.start();\n },\n async shutdown() {\n // A disposer may return a promise (the AI totals' final flush): wait for it, never let one fail the rest.\n const finished: Promise<unknown>[] = [];\n\n for (const dispose of disposers.splice(0)) {\n try {\n finished.push(Promise.resolve(dispose()).catch(() => undefined));\n } catch {\n // The remaining disposers still run.\n }\n }\n\n await Promise.all(finished);\n active = false;\n },\n shouldRestart: () => false,\n };\n\n /** Attaches one source, logging and continuing when it fails to attach. */\n async function attachSource(\n logger: { warn: (module: string, action: string, message: string) => unknown },\n name: string,\n attach: () => Promise<DevtoolsDisposer>,\n ): Promise<void> {\n try {\n disposers.push(await attach());\n } catch (error) {\n logger.warn(\n \"devtools\",\n \"source-failed\",\n `devtools' ${name} source failed to attach: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n }\n\n return connector;\n}\n\ntype ConnectorLogger = {\n info: (module: string, action: string, message: string) => unknown;\n warn: (module: string, action: string, message: string) => unknown;\n error: (module: string, action: string, message: string) => unknown;\n};\n\n/**\n * Development: the statistics, resources, health and jobs behind the\n * Resources, Queries (statistics), Routes (statistics), Errors, Health and\n * Jobs tabs. Wrapped as a whole: when anything fails to start, one line is\n * logged and the dashboard mounts without insights (those tabs then say they\n * are not available). It never stops the dashboard.\n */\nasync function wireDevelopmentInsights(\n collector: ReturnType<typeof createCollector>,\n resolved: ReturnType<typeof resolveDevtoolsOptions>,\n log: ConnectorLogger,\n disposers: DevtoolsDisposer[],\n): Promise<Pick<MountDevtoolsRoutesDeps, \"instance\" | \"insights\" | \"explainShape\">> {\n const stops: DevtoolsDisposer[] = [];\n\n try {\n const capture = await import(\"./production/capture\");\n const insights = await import(\"./production/insights\");\n const instance = insights.createInstanceInfo();\n const queries = capture.createQueryStats({\n maxShapes: DEVTOOLS_PRODUCTION_DEFAULTS.maxShapes,\n instance: instance.id,\n });\n const routes = capture.createRouteStats({\n maxRoutes: DEVTOOLS_PRODUCTION_DEFAULTS.maxRoutes,\n instance: instance.id,\n });\n const errors = capture.createErrorGroups({\n maxGroups: DEVTOOLS_PRODUCTION_DEFAULTS.maxErrorGroups,\n });\n const logs = capture.createRecentLogs({ maxEntries: 200 });\n\n stops.push(\n capture.attachDevelopmentStats(collector, {\n queries,\n routes,\n errors,\n logs,\n nPlusOneThreshold: resolved.nPlusOneThreshold,\n }),\n );\n\n const resources = insights.createResourceMonitor();\n const health = insights.createHealthHistory();\n\n resources.start();\n health.start();\n stops.push(\n () => resources.stop(),\n () => health.stop(),\n );\n\n const reporter = insights.createLocalReporter({\n instance,\n resources,\n health,\n jobs: insights.createJobsReader(),\n queries,\n routes,\n errors,\n logs,\n counters: null,\n });\n const explainShape = capture.createShapeExplainer({\n queries,\n executing: false,\n instance: instance.id,\n });\n\n disposers.push(...stops);\n\n return { instance, insights: insights.createLocalInsights(reporter), explainShape };\n } catch (error) {\n for (const stop of stops) {\n try {\n stop();\n } catch {\n // Cleanup after a failed start must not hide the reason.\n }\n }\n\n log.warn(\n \"devtools\",\n \"insights-failed\",\n `devtools' statistics could not start, so the Resources, Queries, Routes, Errors, Health and Jobs tabs are not available: ${error instanceof Error ? error.message : String(error)}`,\n );\n\n return {};\n }\n}\n\n/**\n * Starts this process's AI totals in development: loads the Panoptic feed and\n * writes hourly rollups to `storage/devtools/ai-rollups`. Never throws; a\n * failure leaves the Reports, Models and Errors pages answering why.\n */\nasync function wireDevelopmentAiReports(\n ai: Awaited<ReturnType<typeof attachAiSource>>,\n resolved: ReturnType<typeof resolveDevtoolsOptions>,\n core: typeof import(\"@warlock.js/core\"),\n log: ConnectorLogger,\n disposers: DevtoolsDisposer[],\n): Promise<NonNullable<MountDevtoolsRoutesDeps[\"aiReports\"]>> {\n const none = (reason: \"ai-missing\" | \"reports-off\") => ({\n ...toAiUnavailableView(describeAiUnavailable(reason)),\n async dispose() {},\n });\n\n try {\n const loaded = await loadAiFeed();\n\n if (\"unavailable\" in loaded) return { ...loaded.unavailable, async dispose() {} };\n\n const reports = await attachAiReports({\n feed: loaded.feed,\n options: resolveDevtoolsAiOptions(resolved.ai, \"development\"),\n ...(typeof core.storagePath === \"function\"\n ? { directory: core.storagePath(\"devtools/ai-rollups\") }\n : {}),\n recentFailures: (filter) =>\n ai.available ? recentAiFailures(ai.store.query(), 50, filter) : [],\n warn: (message) => log.warn(\"devtools\", \"ai-reports\", message),\n });\n\n disposers.push(() => reports.dispose());\n\n return reports;\n } catch (error) {\n log.warn(\n \"devtools\",\n \"ai-reports\",\n `AI reports could not start: ${error instanceof Error ? error.message : String(error)}`,\n );\n\n return none(\"reports-off\");\n }\n}\n\n/**\n * Starts the production monitor: loads the panels in production mode and\n * hands everything to `bootProductionDevtools`, which refuses to boot (throws\n * `DevtoolsProductionConfigError`) when the configuration is incomplete.\n */\nasync function bootProduction(\n core: typeof import(\"@warlock.js/core\"),\n log: ConnectorLogger,\n resolved: ReturnType<typeof resolveDevtoolsOptions>,\n): Promise<DevtoolsDisposer> {\n const { bootProductionDevtools } = await import(\"./production/boot\");\n const requestLog = await findRequestLogSource();\n // The Processes panel reads an app file; load it only when the project turned that tab on.\n const processPanel =\n resolved.production?.panels?.processes === true ? await loadProcessPanel() : undefined;\n const builtIn = processesDevtoolsPanel(processPanel);\n const panelErrors = createPanelErrorSource();\n const packagePanels = await loadDevtoolsPanels(resolved.panels ?? [], {\n root: \"rootPath\" in core ? core.rootPath() : process.cwd(),\n warn: (message) => log.warn(\"devtools\", \"panel\", message),\n taken: new Map([[builtIn.id, builtIn.title]]),\n mode: \"production\",\n errors: panelErrors.read,\n });\n // `warlock start` registers no development OpenAPI provider: the API tab, when turned on, builds its own.\n const { createProductionOpenApi } = await import(\"./production/openapi\");\n const openApi = createProductionOpenApi(core);\n\n return bootProductionDevtools({\n options: resolved,\n env: process.env,\n server: core.getHttpServer(),\n panels: [...checkDevtoolsPanels([builtIn]), ...packagePanels],\n routes: {\n ...(processPanel ? { processPanel } : {}),\n ...(requestLog ? { requestLog } : {}),\n listRoutes: () => listRoutes(),\n getOpenApiDocument: openApi.getOpenApiDocument,\n getPostmanCollection: openApi.getPostmanCollection,\n },\n log,\n onInsights: (insights) => panelErrors.bind(insights),\n });\n}\n\n/** Runs `EXPLAIN (FORMAT JSON)` for a stored Postgres query on its own connection. */\nasync function explainQuery(query: DevtoolsQuery): Promise<unknown> {\n const { dataSourceRegistry } = await import(\"@warlock.js/cascade\");\n const dataSource = dataSourceRegistry.get(query.connection);\n const { rows } = await dataSource.raw(`EXPLAIN (FORMAT JSON) ${query.sql}`, query.bindings);\n\n return rows;\n}\n\n/** Lists every registered HTTP route — the same source `warlock routes --json` reads. */\nasync function listRoutes(): Promise<DevtoolsRouteRow[]> {\n const { router } = await import(\"@warlock.js/core\");\n\n return router.list().map((route) => ({\n method: route.method.toUpperCase(),\n path: route.path,\n name: route.name,\n middleware: route.middleware?.map((middleware) => middleware.name || \"anonymous\"),\n }));\n}\n\n/**\n * Builds the OpenAPI 3.1 document from the routes registered in this process —\n * the same generator behind `warlock generate.openapi`. Core is imported\n * lazily so this module stays free of a load-time dependency on it.\n */\nasync function getOpenApiDocument(): Promise<object> {\n const { getDevelopmentOpenApiDocument } = await import(\"@warlock.js/core\");\n const { document } = await getDevelopmentOpenApiDocument();\n\n return document;\n}\n\ntype PostmanBuilder = () => Promise<unknown>;\n\n/**\n * Looks up core's Postman collection builder, `getDevelopmentPostmanCollection`.\n * Older cores do not export it; the route then answers 503. The lookup is\n * guarded because a namespace without the export may throw on access. Core is\n * imported lazily, like the OpenAPI document above.\n */\nasync function findPostmanBuilder(): Promise<PostmanBuilder | undefined> {\n try {\n const core: Record<string, unknown> = await import(\"@warlock.js/core\");\n const build = core.getDevelopmentPostmanCollection;\n\n return typeof build === \"function\" ? (build as PostmanBuilder) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Looks up core's persistent request log reader. Older cores do not export\n * it; the dashboard then shows the in-memory requests only. Core is imported\n * lazily, like the builders above.\n */\nasync function findRequestLogSource(): Promise<DevtoolsRequestLogSource | undefined> {\n try {\n const core: Record<string, unknown> = await import(\"@warlock.js/core\");\n const { listRequestLogs, getRequestLog, requestLogToCurl, compileRequestLogFilter } = core;\n\n if (\n typeof listRequestLogs !== \"function\" ||\n typeof getRequestLog !== \"function\" ||\n typeof requestLogToCurl !== \"function\" ||\n typeof compileRequestLogFilter !== \"function\"\n ) {\n return undefined;\n }\n\n return {\n list: (filter) => listRequestLogs(filter),\n get: (id) => getRequestLog(id),\n curl: (record, baseUrl) => requestLogToCurl(record, baseUrl),\n compile: (filter) => compileRequestLogFilter(filter),\n };\n } catch {\n return undefined;\n }\n}\n\n/**\n * Core may return the collection itself or wrap it in `{ collection, warnings }`,\n * like the OpenAPI generator's `{ document, warnings }`.\n */\nfunction unwrapCollection(result: unknown): object {\n if (result && typeof result === \"object\" && \"collection\" in result) {\n return (result as { collection: object }).collection;\n }\n\n return result as object;\n}\n","/**\n * The CSS variables the dashboard defines for package panels, in both themes.\n *\n * A package panel's stylesheet may use only these variables, plus variables it\n * defines itself (in the same file). Anything else is undefined in the\n * dashboard and renders as the browser default, which is how a panel ends up\n * with unreadable text. The dashboard's own colours are checked for contrast\n * (4.5:1 for the text tokens on `--background` and `--card`) in both themes.\n */\nexport const DEVTOOLS_PANEL_TOKENS: readonly string[] = [\n \"--background\",\n \"--foreground\",\n \"--card\",\n \"--card-foreground\",\n \"--popover\",\n \"--popover-foreground\",\n \"--primary\",\n \"--primary-foreground\",\n \"--secondary\",\n \"--secondary-foreground\",\n \"--muted\",\n \"--muted-foreground\",\n \"--accent\",\n \"--accent-foreground\",\n \"--destructive\",\n \"--border\",\n \"--input\",\n \"--ring\",\n \"--radius\",\n \"--brand\",\n \"--brand-foreground\",\n \"--success\",\n \"--warning\",\n \"--info\",\n \"--chart-1\",\n \"--chart-2\",\n \"--chart-3\",\n \"--chart-4\",\n \"--chart-5\",\n];\n"],"mappings":";;;;;;;;;;;;;AAIA,MAAM,YAAY;;AAGlB,MAAM,aAAa;AAmBnB,SAAgB,uBAAuB,MAAoB,KAAK,KAAuB;CACrF,IAAI,WAAiC;CAErC,OAAO;EACL,KAAK,MAAM;GACT,WAAW;EACb;EACA,MAAM,OAAO;GACX,IAAI,aAAa,MAAM,OAAO,CAAC;GAE/B,MAAM,QAAQ,IAAI,IAAI;GAGtB,QAAO,MAFY,SAAS,OAAO;IAAE,UAAU;IAAO,OAAO;GAAW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e,qBAA0D;CACvE,IAAI;EAEF,MAAM,SAAQ,MAD8B,OAAO,oBACjC,CAAC;EAEnB,OAAO,OAAO,UAAU,aAAc,QAA2B;CACnE,QAAQ;EACN;CACF;AACF;;;;;;AAOA,eAAe,uBAAsE;CACnF,IAAI;EAEF,MAAM,EAAE,iBAAiB,eAAe,kBAAkB,4BAA4B,MAD1C,OAAO;EAGnD,IACE,OAAO,oBAAoB,cAC3B,OAAO,kBAAkB,cACzB,OAAO,qBAAqB,cAC5B,OAAO,4BAA4B,YAEnC;EAGF,OAAO;GACL,OAAO,WAAW,gBAAgB,MAAM;GACxC,MAAM,OAAO,cAAc,EAAE;GAC7B,OAAO,QAAQ,YAAY,iBAAiB,QAAQ,OAAO;GAC3D,UAAU,WAAW,wBAAwB,MAAM;EACrD;CACF,QAAQ;EACN;CACF;AACF;;;;;AAMA,SAAS,iBAAiB,QAAyB;CACjD,IAAI,UAAU,OAAO,WAAW,YAAY,gBAAgB,QAC1D,OAAQ,OAAkC;CAG5C,OAAO;AACT;;;;;;;;;;;;;AChhBA,MAAa,wBAA2C;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -1,5 +1,5 @@
1
- const require_migrations = require("./migrations-BP4cYTGo.cjs");
2
- const require_cascade_store = require("./cascade-store-CuRRYzt_.cjs");
1
+ const require_migrations = require("./migrations-BQdNOL5_.cjs");
2
+ const require_cascade_store = require("./cascade-store-DUT2Laha.cjs");
3
3
 
4
4
  exports.createCascadeStore = require_cascade_store.createCascadeStore;
5
5
  exports.createMemoryStore = require_cascade_store.createMemoryStore;