@warlock.js/devtools 5.55.0 → 5.56.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 (234) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +26 -13
  3. package/cjs/ai-source-DTpxumMA.cjs +381 -0
  4. package/cjs/ai-source-DTpxumMA.cjs.map +1 -0
  5. package/cjs/auth-DzU0gHDG.cjs +1655 -0
  6. package/cjs/auth-DzU0gHDG.cjs.map +1 -0
  7. package/cjs/boot-BQi0Etor.cjs +138 -0
  8. package/cjs/boot-BQi0Etor.cjs.map +1 -0
  9. package/cjs/capture-CqIiaznN.cjs +1342 -0
  10. package/cjs/capture-CqIiaznN.cjs.map +1 -0
  11. package/cjs/cascade-store-pHjKeSFm.cjs +863 -0
  12. package/cjs/cascade-store-pHjKeSFm.cjs.map +1 -0
  13. package/cjs/collector-CJbQbzzK.cjs +271 -0
  14. package/cjs/collector-CJbQbzzK.cjs.map +1 -0
  15. package/cjs/contracts-CVmplkNb.cjs +112 -0
  16. package/cjs/contracts-CVmplkNb.cjs.map +1 -0
  17. package/cjs/current-request-id-BoJJb3y7.cjs +37 -0
  18. package/cjs/current-request-id-BoJJb3y7.cjs.map +1 -0
  19. package/cjs/errors-CyZp5yS-.cjs +177 -0
  20. package/cjs/errors-CyZp5yS-.cjs.map +1 -0
  21. package/cjs/histogram-BaI-PnCv.cjs +102 -0
  22. package/cjs/histogram-BaI-PnCv.cjs.map +1 -0
  23. package/cjs/http-CabcUwBx.cjs +870 -0
  24. package/cjs/http-CabcUwBx.cjs.map +1 -0
  25. package/cjs/index.cjs +1 -1
  26. package/cjs/insights-BKtqxdnP.cjs +811 -0
  27. package/cjs/insights-BKtqxdnP.cjs.map +1 -0
  28. package/cjs/ip-DbNhPOzi.cjs +153 -0
  29. package/cjs/ip-DbNhPOzi.cjs.map +1 -0
  30. package/cjs/migrations-w7GMsrQw.cjs +297 -0
  31. package/cjs/migrations-w7GMsrQw.cjs.map +1 -0
  32. package/cjs/openapi-CC7OAUc6.cjs +52 -0
  33. package/cjs/openapi-CC7OAUc6.cjs.map +1 -0
  34. package/cjs/options-CWqFC5__.cjs +181 -0
  35. package/cjs/options-CWqFC5__.cjs.map +1 -0
  36. package/cjs/panels-B0dAfGbJ.cjs +298 -0
  37. package/cjs/panels-B0dAfGbJ.cjs.map +1 -0
  38. package/cjs/process-panel-DEOnLxoT.cjs +48 -0
  39. package/cjs/process-panel-DEOnLxoT.cjs.map +1 -0
  40. package/cjs/production/index.cjs +238 -0
  41. package/cjs/production/index.cjs.map +1 -0
  42. package/cjs/rolldown-runtime-Zuuoy_Rh.cjs +52 -0
  43. package/cjs/server-B6xdeKS8.cjs +184 -0
  44. package/cjs/server-B6xdeKS8.cjs.map +1 -0
  45. package/cjs/{src-Xwm3Eel9.cjs → src-Ce-3Lniv.cjs} +163 -295
  46. package/cjs/src-Ce-3Lniv.cjs.map +1 -0
  47. package/cjs/store-aq207T8v.cjs +9 -0
  48. package/cjs/stream-route-BGJa-zQu.cjs +875 -0
  49. package/cjs/stream-route-BGJa-zQu.cjs.map +1 -0
  50. package/esm/devtools-connector.d.mts +16 -13
  51. package/esm/devtools-connector.d.mts.map +1 -1
  52. package/esm/devtools-connector.mjs +127 -18
  53. package/esm/devtools-connector.mjs.map +1 -1
  54. package/esm/index.d.mts +3 -2
  55. package/esm/options.mjs +2 -1
  56. package/esm/options.mjs.map +1 -1
  57. package/esm/panels.mjs +50 -5
  58. package/esm/panels.mjs.map +1 -1
  59. package/esm/production/auth/common-passwords.mjs +303 -0
  60. package/esm/production/auth/common-passwords.mjs.map +1 -0
  61. package/esm/production/auth/default-crypto.mjs +19 -0
  62. package/esm/production/auth/default-crypto.mjs.map +1 -0
  63. package/esm/production/auth/helpers.mjs +77 -0
  64. package/esm/production/auth/helpers.mjs.map +1 -0
  65. package/esm/production/auth/index.mjs +6 -0
  66. package/esm/production/auth/passkeys.mjs +96 -0
  67. package/esm/production/auth/passkeys.mjs.map +1 -0
  68. package/esm/production/auth/service.mjs +1166 -0
  69. package/esm/production/auth/service.mjs.map +1 -0
  70. package/esm/production/boot.mjs +138 -0
  71. package/esm/production/boot.mjs.map +1 -0
  72. package/esm/production/capture/dev-stats.mjs +83 -0
  73. package/esm/production/capture/dev-stats.mjs.map +1 -0
  74. package/esm/production/capture/engine.mjs +442 -0
  75. package/esm/production/capture/engine.mjs.map +1 -0
  76. package/esm/production/capture/explain.mjs +271 -0
  77. package/esm/production/capture/explain.mjs.map +1 -0
  78. package/esm/production/capture/filter.mjs +24 -0
  79. package/esm/production/capture/filter.mjs.map +1 -0
  80. package/esm/production/capture/index.mjs +7 -0
  81. package/esm/production/capture/production-capture.mjs +134 -0
  82. package/esm/production/capture/production-capture.mjs.map +1 -0
  83. package/esm/production/capture/redact.mjs +109 -0
  84. package/esm/production/capture/redact.mjs.map +1 -0
  85. package/esm/production/capture/stats-stores.mjs +300 -0
  86. package/esm/production/capture/stats-stores.mjs.map +1 -0
  87. package/esm/production/cli/actions.mjs +151 -0
  88. package/esm/production/cli/actions.mjs.map +1 -0
  89. package/esm/production/cli/index.d.mts +17 -0
  90. package/esm/production/cli/index.d.mts.map +1 -0
  91. package/esm/production/cli/index.mjs +86 -0
  92. package/esm/production/cli/index.mjs.map +1 -0
  93. package/esm/production/contracts.d.mts +592 -0
  94. package/esm/production/contracts.d.mts.map +1 -0
  95. package/esm/production/contracts.mjs +95 -0
  96. package/esm/production/contracts.mjs.map +1 -0
  97. package/esm/production/errors.d.mts +31 -0
  98. package/esm/production/errors.d.mts.map +1 -0
  99. package/esm/production/errors.mjs +142 -0
  100. package/esm/production/errors.mjs.map +1 -0
  101. package/esm/production/http/access.mjs +124 -0
  102. package/esm/production/http/access.mjs.map +1 -0
  103. package/esm/production/http/auth-routes.mjs +280 -0
  104. package/esm/production/http/auth-routes.mjs.map +1 -0
  105. package/esm/production/http/client.mjs +57 -0
  106. package/esm/production/http/client.mjs.map +1 -0
  107. package/esm/production/http/constants.mjs +11 -0
  108. package/esm/production/http/constants.mjs.map +1 -0
  109. package/esm/production/http/context.mjs +14 -0
  110. package/esm/production/http/context.mjs.map +1 -0
  111. package/esm/production/http/cookie.mjs +39 -0
  112. package/esm/production/http/cookie.mjs.map +1 -0
  113. package/esm/production/http/headers.mjs +25 -0
  114. package/esm/production/http/headers.mjs.map +1 -0
  115. package/esm/production/http/index.mjs +10 -0
  116. package/esm/production/http/ip.mjs +130 -0
  117. package/esm/production/http/ip.mjs.map +1 -0
  118. package/esm/production/http/mount.mjs +300 -0
  119. package/esm/production/http/mount.mjs.map +1 -0
  120. package/esm/production/http/state.mjs +54 -0
  121. package/esm/production/http/state.mjs.map +1 -0
  122. package/esm/production/index.d.mts +6 -0
  123. package/esm/production/index.mjs +5 -0
  124. package/esm/production/insights/cap-report.mjs +67 -0
  125. package/esm/production/insights/cap-report.mjs.map +1 -0
  126. package/esm/production/insights/health.mjs +88 -0
  127. package/esm/production/insights/health.mjs.map +1 -0
  128. package/esm/production/insights/index.mjs +10 -0
  129. package/esm/production/insights/insights.mjs +167 -0
  130. package/esm/production/insights/insights.mjs.map +1 -0
  131. package/esm/production/insights/instance.mjs +24 -0
  132. package/esm/production/insights/instance.mjs.map +1 -0
  133. package/esm/production/insights/jobs.mjs +100 -0
  134. package/esm/production/insights/jobs.mjs.map +1 -0
  135. package/esm/production/insights/reporter.mjs +59 -0
  136. package/esm/production/insights/reporter.mjs.map +1 -0
  137. package/esm/production/insights/resources.mjs +139 -0
  138. package/esm/production/insights/resources.mjs.map +1 -0
  139. package/esm/production/insights/writer.mjs +72 -0
  140. package/esm/production/insights/writer.mjs.map +1 -0
  141. package/esm/production/openapi.mjs +52 -0
  142. package/esm/production/openapi.mjs.map +1 -0
  143. package/esm/production/options.d.mts +60 -0
  144. package/esm/production/options.d.mts.map +1 -0
  145. package/esm/production/options.mjs +170 -0
  146. package/esm/production/options.mjs.map +1 -0
  147. package/esm/production/stats/histogram.mjs +67 -0
  148. package/esm/production/stats/histogram.mjs.map +1 -0
  149. package/esm/production/stats/merge.mjs +106 -0
  150. package/esm/production/stats/merge.mjs.map +1 -0
  151. package/esm/production/store/cascade-store.mjs +322 -0
  152. package/esm/production/store/cascade-store.mjs.map +1 -0
  153. package/esm/production/store/index.mjs +5 -0
  154. package/esm/production/store/mapping.mjs +258 -0
  155. package/esm/production/store/mapping.mjs.map +1 -0
  156. package/esm/production/store/memory-store.mjs +291 -0
  157. package/esm/production/store/memory-store.mjs.map +1 -0
  158. package/esm/production/store/migrations.d.mts +11 -0
  159. package/esm/production/store/migrations.d.mts.map +1 -0
  160. package/esm/production/store/migrations.mjs +29 -0
  161. package/esm/production/store/migrations.mjs.map +1 -0
  162. package/esm/production/store/models/account.migration.mjs +34 -0
  163. package/esm/production/store/models/account.migration.mjs.map +1 -0
  164. package/esm/production/store/models/account.model.mjs +13 -0
  165. package/esm/production/store/models/account.model.mjs.map +1 -0
  166. package/esm/production/store/models/audit.migration.mjs +30 -0
  167. package/esm/production/store/models/audit.migration.mjs.map +1 -0
  168. package/esm/production/store/models/audit.model.mjs +13 -0
  169. package/esm/production/store/models/audit.model.mjs.map +1 -0
  170. package/esm/production/store/models/base.mjs +27 -0
  171. package/esm/production/store/models/base.mjs.map +1 -0
  172. package/esm/production/store/models/index.mjs +17 -0
  173. package/esm/production/store/models/invite.migration.mjs +26 -0
  174. package/esm/production/store/models/invite.migration.mjs.map +1 -0
  175. package/esm/production/store/models/invite.model.mjs +13 -0
  176. package/esm/production/store/models/invite.model.mjs.map +1 -0
  177. package/esm/production/store/models/report.migration.mjs +20 -0
  178. package/esm/production/store/models/report.migration.mjs.map +1 -0
  179. package/esm/production/store/models/report.model.mjs +13 -0
  180. package/esm/production/store/models/report.model.mjs.map +1 -0
  181. package/esm/production/store/models/sample.migration.mjs +25 -0
  182. package/esm/production/store/models/sample.migration.mjs.map +1 -0
  183. package/esm/production/store/models/sample.model.mjs +13 -0
  184. package/esm/production/store/models/sample.model.mjs.map +1 -0
  185. package/esm/production/store/models/session.migration.mjs +31 -0
  186. package/esm/production/store/models/session.migration.mjs.map +1 -0
  187. package/esm/production/store/models/session.model.mjs +13 -0
  188. package/esm/production/store/models/session.model.mjs.map +1 -0
  189. package/esm/production/store/models/state.migration.mjs +26 -0
  190. package/esm/production/store/models/state.migration.mjs.map +1 -0
  191. package/esm/production/store/models/state.model.mjs +13 -0
  192. package/esm/production/store/models/state.model.mjs.map +1 -0
  193. package/esm/query-shape.mjs +14 -1
  194. package/esm/query-shape.mjs.map +1 -1
  195. package/esm/server/explain-route.mjs +26 -1
  196. package/esm/server/explain-route.mjs.map +1 -1
  197. package/esm/server/index.mjs +9 -4
  198. package/esm/server/index.mjs.map +1 -1
  199. package/esm/server/insights-routes.mjs +62 -0
  200. package/esm/server/insights-routes.mjs.map +1 -0
  201. package/esm/server/log-routes.mjs +32 -5
  202. package/esm/server/log-routes.mjs.map +1 -1
  203. package/esm/server/openapi-routes.mjs +3 -2
  204. package/esm/server/openapi-routes.mjs.map +1 -1
  205. package/esm/server/requests-routes.mjs +125 -0
  206. package/esm/server/requests-routes.mjs.map +1 -1
  207. package/esm/server/session-routes.mjs +42 -0
  208. package/esm/server/session-routes.mjs.map +1 -0
  209. package/esm/server/stream-route.mjs +81 -11
  210. package/esm/server/stream-route.mjs.map +1 -1
  211. package/esm/server/ui-assets.mjs +34 -25
  212. package/esm/server/ui-assets.mjs.map +1 -1
  213. package/esm/sources/log-source.mjs +14 -1
  214. package/esm/sources/log-source.mjs.map +1 -1
  215. package/esm/types.d.mts +202 -1
  216. package/esm/types.d.mts.map +1 -1
  217. package/esm/ui-root.mjs +9 -4
  218. package/esm/ui-root.mjs.map +1 -1
  219. package/llms-full.txt +159 -21
  220. package/llms.txt +2 -2
  221. package/package.json +32 -8
  222. package/skills/SKILL.md +159 -21
  223. package/ui/dashboard/assets/app.css +3 -0
  224. package/ui/dashboard/assets/app.js +50 -0
  225. package/ui/dashboard/build-info.json +21 -0
  226. package/ui/dashboard/index.html +15 -0
  227. package/cjs/ai-source-Dz_3tlZ5.cjs +0 -703
  228. package/cjs/ai-source-Dz_3tlZ5.cjs.map +0 -1
  229. package/cjs/server-B11ShQYE.cjs +0 -628
  230. package/cjs/server-B11ShQYE.cjs.map +0 -1
  231. package/cjs/src-Xwm3Eel9.cjs.map +0 -1
  232. package/ui/app.css +0 -376
  233. package/ui/app.js +0 -1158
  234. package/ui/index.html +0 -28
@@ -1,10 +1,8 @@
1
1
  import { resolveUiRoot } from "../ui-root.mjs";
2
- import { readFileSync } from "node:fs";
2
+ import { existsSync, readFileSync } from "node:fs";
3
3
  import path from "node:path";
4
4
 
5
5
  //#region ../../packages/devtools/src/server/ui-assets.ts
6
- /** Where `index.html` takes the registered panels' tab buttons. */
7
- const PANEL_TABS_MARKER = "<!-- devtools:panel-tabs -->";
8
6
  const uiFile = (name) => () => path.join(resolveUiRoot(), name);
9
7
  /**
10
8
  * The only assets that can be requested. The request's asset name is looked
@@ -13,11 +11,11 @@ const uiFile = (name) => () => path.join(resolveUiRoot(), name);
13
11
  const UI_ASSETS = {
14
12
  "app.js": {
15
13
  contentType: "text/javascript; charset=utf-8",
16
- file: uiFile("app.js")
14
+ file: uiFile("dashboard/assets/app.js")
17
15
  },
18
16
  "app.css": {
19
17
  contentType: "text/css; charset=utf-8",
20
- file: uiFile("app.css")
18
+ file: uiFile("dashboard/assets/app.css")
21
19
  },
22
20
  "scalar.js": {
23
21
  contentType: "text/javascript; charset=utf-8",
@@ -40,38 +38,49 @@ const UI_ASSETS = {
40
38
  function sendFile(reply, file, contentType) {
41
39
  reply.header("Cache-Control", "no-store").header("Content-Type", contentType).send(readFileSync(file));
42
40
  }
43
- function escapeHtml(value) {
44
- return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;");
45
- }
46
- /** `index.html` with one tab button per registered panel, in registration order. */
47
- function renderIndexHtml(html, panels) {
48
- const buttons = panels.map((panel) => `<button class="tab" data-tab="${panel.id}" data-panel="${panel.id}">${escapeHtml(panel.title)}</button>`).join("\n ");
49
- return html.replace(PANEL_TABS_MARKER, buttons);
50
- }
41
+ const NOT_BUILT_HTML = "<!doctype html><title>Warlock Devtools</title><p>The devtools dashboard has not been built. Run <code>pnpm --filter @warlock.js/devtools build:ui</code>.</p>";
51
42
  /**
52
- * Serves the static dashboard: `index.html` at the dashboard root (with a
53
- * tab per registered panel) and the whitelisted assets (`app.js`, `app.css`,
54
- * the vendored Scalar bundle as `scalar.js`, and the vendored Swagger UI
55
- * files plus their init script). The asset name is matched against a fixed
43
+ * Serves the static dashboard: the built `ui/dashboard/index.html` at the
44
+ * dashboard root and the whitelisted assets (`app.js`, `app.css`, the
45
+ * vendored Scalar bundle as `scalar.js`, and the vendored Swagger UI files
46
+ * plus their init script). The asset name is matched against a fixed
56
47
  * whitelist — never joined into a filesystem path — so no request can
57
- * traverse outside it.
48
+ * traverse outside it. Before the first `build:ui` the root answers 503 with
49
+ * a note that says how to build. `notFound` answers an unknown asset (the
50
+ * production gate passes its uniform 404, so the public asset route answers
51
+ * like any unknown URL of the app); without it the answer is a bare 404.
58
52
  */
59
- function registerUiAssets(server, panels = []) {
60
- const serveIndex = (_request, reply) => {
61
- const html = readFileSync(path.join(resolveUiRoot(), "index.html"), "utf8");
62
- reply.header("Cache-Control", "no-store").header("Content-Type", "text/html; charset=utf-8").send(renderIndexHtml(html, panels));
53
+ function registerUiAssets(server, options = {}) {
54
+ const serveIndex = (request, reply) => {
55
+ const [pathname = "", search] = (request.originalUrl ?? request.url).split("?");
56
+ if (!pathname.endsWith("/")) {
57
+ const base = (request.routeOptions.url ?? pathname).replace(/\/+$/, "");
58
+ reply.code(308).header("Cache-Control", "no-store").redirect(`${base}/${search === void 0 ? "" : `?${search}`}`, 308);
59
+ return;
60
+ }
61
+ const index = path.join(resolveUiRoot(), "dashboard", "index.html");
62
+ if (!existsSync(index)) {
63
+ reply.code(503).header("Cache-Control", "no-store").header("Content-Type", "text/html; charset=utf-8").send(NOT_BUILT_HTML);
64
+ return;
65
+ }
66
+ reply.header("Cache-Control", "no-store").header("Content-Type", "text/html; charset=utf-8").send(readFileSync(index));
63
67
  };
64
68
  server.get("/", serveIndex);
65
69
  server.get("/assets/:name", (request, reply) => {
66
70
  const asset = Object.hasOwn(UI_ASSETS, request.params.name) ? UI_ASSETS[request.params.name] : void 0;
67
- if (!asset) {
71
+ const file = asset?.file();
72
+ if (!asset || !file || !existsSync(file)) {
73
+ if (options.notFound) {
74
+ options.notFound(request, reply);
75
+ return;
76
+ }
68
77
  reply.code(404).header("Cache-Control", "no-store").send();
69
78
  return;
70
79
  }
71
- sendFile(reply, asset.file(), asset.contentType);
80
+ sendFile(reply, file, asset.contentType);
72
81
  });
73
82
  }
74
83
 
75
84
  //#endregion
76
- export { registerUiAssets, renderIndexHtml, sendFile };
85
+ export { registerUiAssets, sendFile };
77
86
  //# sourceMappingURL=ui-assets.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-assets.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/server/ui-assets.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { FastifyInstance, FastifyReply } from \"fastify\";\nimport type { MountedDevtoolsPanel } from \"../panels\";\nimport { resolveUiRoot } from \"../ui-root\";\n\n/** Where `index.html` takes the registered panels' tab buttons. */\nconst PANEL_TABS_MARKER = \"<!-- devtools:panel-tabs -->\";\n\n/**\n * Where an asset's bytes come from: a file in this package's `ui/` folder.\n */\ntype UiAsset = {\n contentType: string;\n file: () => string;\n};\n\nconst uiFile = (name: string) => () => path.join(resolveUiRoot(), name);\n\n/**\n * The only assets that can be requested. The request's asset name is looked\n * up here and never joined into a filesystem path.\n */\nconst UI_ASSETS: Record<string, UiAsset> = {\n \"app.js\": { contentType: \"text/javascript; charset=utf-8\", file: uiFile(\"app.js\") },\n \"app.css\": { contentType: \"text/css; charset=utf-8\", file: uiFile(\"app.css\") },\n \"scalar.js\": {\n contentType: \"text/javascript; charset=utf-8\",\n file: uiFile(\"vendor/scalar/standalone.js\"),\n },\n \"swagger-ui-bundle.js\": {\n contentType: \"text/javascript; charset=utf-8\",\n file: uiFile(\"vendor/swagger-ui/swagger-ui-bundle.js\"),\n },\n \"swagger-ui.css\": {\n contentType: \"text/css; charset=utf-8\",\n file: uiFile(\"vendor/swagger-ui/swagger-ui.css\"),\n },\n \"docs-swagger.js\": {\n contentType: \"text/javascript; charset=utf-8\",\n file: uiFile(\"docs-swagger.js\"),\n },\n};\n\n/** Sends `file` with `contentType` and no caching. */\nexport function sendFile(reply: FastifyReply, file: string, contentType: string): void {\n reply\n .header(\"Cache-Control\", \"no-store\")\n .header(\"Content-Type\", contentType)\n .send(readFileSync(file));\n}\n\nfunction escapeHtml(value: string): string {\n return value\n .replaceAll(\"&\", \"&amp;\")\n .replaceAll(\"<\", \"&lt;\")\n .replaceAll(\">\", \"&gt;\")\n .replaceAll('\"', \"&quot;\");\n}\n\n/** `index.html` with one tab button per registered panel, in registration order. */\nexport function renderIndexHtml(html: string, panels: readonly MountedDevtoolsPanel[]): string {\n const buttons = panels\n .map(\n (panel) =>\n `<button class=\"tab\" data-tab=\"${panel.id}\" data-panel=\"${panel.id}\">${escapeHtml(panel.title)}</button>`,\n )\n .join(\"\\n \");\n\n return html.replace(PANEL_TABS_MARKER, buttons);\n}\n\n/**\n * Serves the static dashboard: `index.html` at the dashboard root (with a\n * tab per registered panel) and the whitelisted assets (`app.js`, `app.css`,\n * the vendored Scalar bundle as `scalar.js`, and the vendored Swagger UI\n * files plus their init script). The asset name is matched against a fixed\n * whitelist — never joined into a filesystem path — so no request can\n * traverse outside it.\n */\nexport function registerUiAssets(\n server: FastifyInstance,\n panels: readonly MountedDevtoolsPanel[] = [],\n): void {\n const serveIndex = (_request: unknown, reply: FastifyReply): void => {\n const html = readFileSync(path.join(resolveUiRoot(), \"index.html\"), \"utf8\");\n\n reply\n .header(\"Cache-Control\", \"no-store\")\n .header(\"Content-Type\", \"text/html; charset=utf-8\")\n .send(renderIndexHtml(html, panels));\n };\n\n server.get(\"/\", serveIndex);\n\n server.get<{ Params: { name: string } }>(\"/assets/:name\", (request, reply) => {\n const asset = Object.hasOwn(UI_ASSETS, request.params.name)\n ? UI_ASSETS[request.params.name]\n : undefined;\n\n if (!asset) {\n reply.code(404).header(\"Cache-Control\", \"no-store\").send();\n return;\n }\n\n sendFile(reply, asset.file(), asset.contentType);\n });\n}\n"],"mappings":";;;;;;AAOA,MAAM,oBAAoB;AAU1B,MAAM,UAAU,eAAuB,KAAK,KAAK,cAAc,GAAG,IAAI;;;;;AAMtE,MAAM,YAAqC;CACzC,UAAU;EAAE,aAAa;EAAkC,MAAM,OAAO,QAAQ;CAAE;CAClF,WAAW;EAAE,aAAa;EAA2B,MAAM,OAAO,SAAS;CAAE;CAC7E,aAAa;EACX,aAAa;EACb,MAAM,OAAO,6BAA6B;CAC5C;CACA,wBAAwB;EACtB,aAAa;EACb,MAAM,OAAO,wCAAwC;CACvD;CACA,kBAAkB;EAChB,aAAa;EACb,MAAM,OAAO,kCAAkC;CACjD;CACA,mBAAmB;EACjB,aAAa;EACb,MAAM,OAAO,iBAAiB;CAChC;AACF;;AAGA,SAAgB,SAAS,OAAqB,MAAc,aAA2B;CACrF,MACG,OAAO,iBAAiB,UAAU,CAAC,CACnC,OAAO,gBAAgB,WAAW,CAAC,CACnC,KAAK,aAAa,IAAI,CAAC;AAC5B;AAEA,SAAS,WAAW,OAAuB;CACzC,OAAO,MACJ,WAAW,KAAK,OAAO,CAAC,CACxB,WAAW,KAAK,MAAM,CAAC,CACvB,WAAW,KAAK,MAAM,CAAC,CACvB,WAAW,MAAK,QAAQ;AAC7B;;AAGA,SAAgB,gBAAgB,MAAc,QAAiD;CAC7F,MAAM,UAAU,OACb,KACE,UACC,iCAAiC,MAAM,GAAG,gBAAgB,MAAM,GAAG,IAAI,WAAW,MAAM,KAAK,EAAE,UACnG,CAAC,CACA,KAAK,YAAY;CAEpB,OAAO,KAAK,QAAQ,mBAAmB,OAAO;AAChD;;;;;;;;;AAUA,SAAgB,iBACd,QACA,SAA0C,CAAC,GACrC;CACN,MAAM,cAAc,UAAmB,UAA8B;EACnE,MAAM,OAAO,aAAa,KAAK,KAAK,cAAc,GAAG,YAAY,GAAG,MAAM;EAE1E,MACG,OAAO,iBAAiB,UAAU,CAAC,CACnC,OAAO,gBAAgB,0BAA0B,CAAC,CAClD,KAAK,gBAAgB,MAAM,MAAM,CAAC;CACvC;CAEA,OAAO,IAAI,KAAK,UAAU;CAE1B,OAAO,IAAkC,kBAAkB,SAAS,UAAU;EAC5E,MAAM,QAAQ,OAAO,OAAO,WAAW,QAAQ,OAAO,IAAI,IACtD,UAAU,QAAQ,OAAO,QACzB;EAEJ,IAAI,CAAC,OAAO;GACV,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,iBAAiB,UAAU,CAAC,CAAC,KAAK;GACzD;EACF;EAEA,SAAS,OAAO,MAAM,KAAK,GAAG,MAAM,WAAW;CACjD,CAAC;AACH"}
1
+ {"version":3,"file":"ui-assets.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/server/ui-assets.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { FastifyInstance, FastifyReply, FastifyRequest } from \"fastify\";\nimport { resolveUiRoot } from \"../ui-root\";\n\n/**\n * Where an asset's bytes come from: a file in this package's `ui/` folder.\n */\ntype UiAsset = {\n contentType: string;\n file: () => string;\n};\n\nconst uiFile = (name: string) => () => path.join(resolveUiRoot(), name);\n\n/**\n * The only assets that can be requested. The request's asset name is looked\n * up here and never joined into a filesystem path.\n */\nconst UI_ASSETS: Record<string, UiAsset> = {\n \"app.js\": {\n contentType: \"text/javascript; charset=utf-8\",\n file: uiFile(\"dashboard/assets/app.js\"),\n },\n \"app.css\": { contentType: \"text/css; charset=utf-8\", file: uiFile(\"dashboard/assets/app.css\") },\n \"scalar.js\": {\n contentType: \"text/javascript; charset=utf-8\",\n file: uiFile(\"vendor/scalar/standalone.js\"),\n },\n \"swagger-ui-bundle.js\": {\n contentType: \"text/javascript; charset=utf-8\",\n file: uiFile(\"vendor/swagger-ui/swagger-ui-bundle.js\"),\n },\n \"swagger-ui.css\": {\n contentType: \"text/css; charset=utf-8\",\n file: uiFile(\"vendor/swagger-ui/swagger-ui.css\"),\n },\n \"docs-swagger.js\": {\n contentType: \"text/javascript; charset=utf-8\",\n file: uiFile(\"docs-swagger.js\"),\n },\n};\n\n/** Sends `file` with `contentType` and no caching. */\nexport function sendFile(reply: FastifyReply, file: string, contentType: string): void {\n reply\n .header(\"Cache-Control\", \"no-store\")\n .header(\"Content-Type\", contentType)\n .send(readFileSync(file));\n}\n\nconst NOT_BUILT_HTML =\n \"<!doctype html><title>Warlock Devtools</title><p>The devtools dashboard has not been built. Run <code>pnpm --filter @warlock.js/devtools build:ui</code>.</p>\";\n\n/**\n * Serves the static dashboard: the built `ui/dashboard/index.html` at the\n * dashboard root and the whitelisted assets (`app.js`, `app.css`, the\n * vendored Scalar bundle as `scalar.js`, and the vendored Swagger UI files\n * plus their init script). The asset name is matched against a fixed\n * whitelist — never joined into a filesystem path — so no request can\n * traverse outside it. Before the first `build:ui` the root answers 503 with\n * a note that says how to build. `notFound` answers an unknown asset (the\n * production gate passes its uniform 404, so the public asset route answers\n * like any unknown URL of the app); without it the answer is a bare 404.\n */\nexport function registerUiAssets(\n server: FastifyInstance,\n options: { notFound?: (request: FastifyRequest, reply: FastifyReply) => FastifyReply } = {},\n): void {\n const serveIndex = (request: FastifyRequest, reply: FastifyReply): void => {\n // The address as sent: core's server drops a trailing slash before routing.\n const [pathname = \"\", search] = (request.originalUrl ?? request.url).split(\"?\");\n\n // The page loads its assets by relative URL, so it must be served from `<path>/`. The target is built from\n // the route, never from the request, so it always stays on the dashboard path.\n if (!pathname.endsWith(\"/\")) {\n const base = (request.routeOptions.url ?? pathname).replace(/\\/+$/, \"\");\n\n reply\n .code(308)\n .header(\"Cache-Control\", \"no-store\")\n .redirect(`${base}/${search === undefined ? \"\" : `?${search}`}`, 308);\n return;\n }\n\n const index = path.join(resolveUiRoot(), \"dashboard\", \"index.html\");\n\n if (!existsSync(index)) {\n reply\n .code(503)\n .header(\"Cache-Control\", \"no-store\")\n .header(\"Content-Type\", \"text/html; charset=utf-8\")\n .send(NOT_BUILT_HTML);\n return;\n }\n\n reply\n .header(\"Cache-Control\", \"no-store\")\n .header(\"Content-Type\", \"text/html; charset=utf-8\")\n .send(readFileSync(index));\n };\n\n server.get(\"/\", serveIndex);\n\n server.get<{ Params: { name: string } }>(\"/assets/:name\", (request, reply) => {\n const asset = Object.hasOwn(UI_ASSETS, request.params.name)\n ? UI_ASSETS[request.params.name]\n : undefined;\n const file = asset?.file();\n\n if (!asset || !file || !existsSync(file)) {\n if (options.notFound) {\n options.notFound(request, reply);\n return;\n }\n\n reply.code(404).header(\"Cache-Control\", \"no-store\").send();\n return;\n }\n\n sendFile(reply, file, asset.contentType);\n });\n}\n"],"mappings":";;;;;AAaA,MAAM,UAAU,eAAuB,KAAK,KAAK,cAAc,GAAG,IAAI;;;;;AAMtE,MAAM,YAAqC;CACzC,UAAU;EACR,aAAa;EACb,MAAM,OAAO,yBAAyB;CACxC;CACA,WAAW;EAAE,aAAa;EAA2B,MAAM,OAAO,0BAA0B;CAAE;CAC9F,aAAa;EACX,aAAa;EACb,MAAM,OAAO,6BAA6B;CAC5C;CACA,wBAAwB;EACtB,aAAa;EACb,MAAM,OAAO,wCAAwC;CACvD;CACA,kBAAkB;EAChB,aAAa;EACb,MAAM,OAAO,kCAAkC;CACjD;CACA,mBAAmB;EACjB,aAAa;EACb,MAAM,OAAO,iBAAiB;CAChC;AACF;;AAGA,SAAgB,SAAS,OAAqB,MAAc,aAA2B;CACrF,MACG,OAAO,iBAAiB,UAAU,CAAC,CACnC,OAAO,gBAAgB,WAAW,CAAC,CACnC,KAAK,aAAa,IAAI,CAAC;AAC5B;AAEA,MAAM,iBACJ;;;;;;;;;;;;AAaF,SAAgB,iBACd,QACA,UAAyF,CAAC,GACpF;CACN,MAAM,cAAc,SAAyB,UAA8B;EAEzE,MAAM,CAAC,WAAW,IAAI,WAAW,QAAQ,eAAe,QAAQ,IAAG,CAAE,MAAM,GAAG;EAI9E,IAAI,CAAC,SAAS,SAAS,GAAG,GAAG;GAC3B,MAAM,QAAQ,QAAQ,aAAa,OAAO,SAAQ,CAAE,QAAQ,QAAQ,EAAE;GAEtE,MACG,KAAK,GAAG,CAAC,CACT,OAAO,iBAAiB,UAAU,CAAC,CACnC,SAAS,GAAG,KAAK,GAAG,WAAW,SAAY,KAAK,IAAI,YAAY,GAAG;GACtE;EACF;EAEA,MAAM,QAAQ,KAAK,KAAK,cAAc,GAAG,aAAa,YAAY;EAElE,IAAI,CAAC,WAAW,KAAK,GAAG;GACtB,MACG,KAAK,GAAG,CAAC,CACT,OAAO,iBAAiB,UAAU,CAAC,CACnC,OAAO,gBAAgB,0BAA0B,CAAC,CAClD,KAAK,cAAc;GACtB;EACF;EAEA,MACG,OAAO,iBAAiB,UAAU,CAAC,CACnC,OAAO,gBAAgB,0BAA0B,CAAC,CAClD,KAAK,aAAa,KAAK,CAAC;CAC7B;CAEA,OAAO,IAAI,KAAK,UAAU;CAE1B,OAAO,IAAkC,kBAAkB,SAAS,UAAU;EAC5E,MAAM,QAAQ,OAAO,OAAO,WAAW,QAAQ,OAAO,IAAI,IACtD,UAAU,QAAQ,OAAO,QACzB;EACJ,MAAM,OAAO,OAAO,KAAK;EAEzB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,GAAG;GACxC,IAAI,QAAQ,UAAU;IACpB,QAAQ,SAAS,SAAS,KAAK;IAC/B;GACF;GAEA,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,iBAAiB,UAAU,CAAC,CAAC,KAAK;GACzD;EACF;EAEA,SAAS,OAAO,MAAM,MAAM,WAAW;CACzC,CAAC;AACH"}
@@ -7,6 +7,19 @@ import { LogChannel, log } from "@warlock.js/logger";
7
7
  function toDevtoolsLevel(type) {
8
8
  return type === "fatal" ? "error" : type;
9
9
  }
10
+ /**
11
+ * The entry's message as text. `request.log(error)` and friends log an Error
12
+ * (or any value) as the message; kept as is, it reached the dashboard as `{}`.
13
+ */
14
+ function messageText(message) {
15
+ if (typeof message === "string") return message;
16
+ if (message instanceof Error) return `${message.name}: ${message.message}`;
17
+ try {
18
+ return JSON.stringify(message) ?? String(message);
19
+ } catch {
20
+ return String(message);
21
+ }
22
+ }
10
23
  var DevtoolsLogChannel = class extends LogChannel {
11
24
  constructor(collector) {
12
25
  super();
@@ -20,7 +33,7 @@ var DevtoolsLogChannel = class extends LogChannel {
20
33
  level: toDevtoolsLevel(data.type),
21
34
  module: data.module,
22
35
  action: data.action,
23
- message: data.message,
36
+ message: messageText(data.message),
24
37
  at: Date.now(),
25
38
  context: toSafeValue(data.context)
26
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"log-source.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/sources/log-source.ts"],"sourcesContent":["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\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: 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"],"mappings":";;;;;;AAMA,SAAS,gBAAgB,MAAsD;CAC7E,OAAO,SAAS,UAAU,UAAU;AACtC;AAEA,IAAM,qBAAN,cAAiC,WAAW;CAI1C,AAAO,YAAY,AAAiB,WAA8B;EAChE,MAAM;EAD4B;cAHb;gBACP;CAIhB;CAEA,AAAO,IAAI,MAAyB;EAClC,IAAI,CAAC,KAAK,QAAQ;EAMlB,MAAM,QAA0B;GAC9B,OAAO,gBAAgB,KAAK,IAAI;GAChC,QAAQ,KAAK;GACb,QAAQ,KAAK;GACb,SAAS,KAAK;GACd,IAAI,KAAK,IAAI;GACb,SAAS,YAAY,KAAK,OAAO;EACnC;EAEA,KAAK,UAAU,OAAO,iBAAiB,GAAG,KAAK;CACjD;AACF;;;;;;;AAQA,eAAsB,gBAAgB,WAAyD;CAC7F,MAAM,UAAU,IAAI,mBAAmB,SAAS;CAEhD,IAAI,WAAW,OAAO;CAEtB,aAAa;EACX,QAAQ,SAAS;CACnB;AACF"}
1
+ {"version":3,"file":"log-source.mjs","names":[],"sources":["../../../../../../../../packages/devtools/src/sources/log-source.ts"],"sourcesContent":["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"],"mappings":";;;;;;AAMA,SAAS,gBAAgB,MAAsD;CAC7E,OAAO,SAAS,UAAU,UAAU;AACtC;;;;;AAMA,SAAS,YAAY,SAA0B;CAC7C,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,IAAI,mBAAmB,OAAO,OAAO,GAAG,QAAQ,KAAK,IAAI,QAAQ;CAEjE,IAAI;EACF,OAAO,KAAK,UAAU,OAAO,KAAK,OAAO,OAAO;CAClD,QAAQ;EACN,OAAO,OAAO,OAAO;CACvB;AACF;AAEA,IAAM,qBAAN,cAAiC,WAAW;CAI1C,AAAO,YAAY,AAAiB,WAA8B;EAChE,MAAM;EAD4B;cAHb;gBACP;CAIhB;CAEA,AAAO,IAAI,MAAyB;EAClC,IAAI,CAAC,KAAK,QAAQ;EAMlB,MAAM,QAA0B;GAC9B,OAAO,gBAAgB,KAAK,IAAI;GAChC,QAAQ,KAAK;GACb,QAAQ,KAAK;GACb,SAAS,YAAY,KAAK,OAAO;GACjC,IAAI,KAAK,IAAI;GACb,SAAS,YAAY,KAAK,OAAO;EACnC;EAEA,KAAK,UAAU,OAAO,iBAAiB,GAAG,KAAK;CACjD;AACF;;;;;;;AAQA,eAAsB,gBAAgB,WAAyD;CAC7F,MAAM,UAAU,IAAI,mBAAmB,SAAS;CAEhD,IAAI,WAAW,OAAO;CAEtB,aAAa;EACX,QAAQ,SAAS;CACnB;AACF"}
package/esm/types.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { DevtoolsAgentTraceEvent } from "./sources/agent-trace-source.mjs";
2
2
  import { DevtoolsAiEvent } from "./sources/ai-source.mjs";
3
+ import { DEVTOOLS_BUILT_IN_PANELS, DEVTOOLS_FAILURE_AUDIT_TYPES, DEVTOOLS_LATENCY_BUCKETS_MS, DevtoolsAccountView, DevtoolsApiErrorBody, DevtoolsAuditEntry, DevtoolsAuditType, DevtoolsAuthStepResult, DevtoolsBuiltInPanelId, DevtoolsCaptureCounters, DevtoolsCreatedInvite, DevtoolsErrorCode, DevtoolsErrorGroup, DevtoolsErrorsView, DevtoolsExplainResult, DevtoolsHealthReport, DevtoolsHealthView, DevtoolsHistogram, DevtoolsInstanceInfo, DevtoolsInstanceReport, DevtoolsInstancesView, DevtoolsInviteView, DevtoolsJobsReport, DevtoolsJobsView, DevtoolsLogRow, DevtoolsLoginInput, DevtoolsLogsView, DevtoolsMode, DevtoolsPanelInfo, DevtoolsPasswordSource, DevtoolsQueryShapeRow, DevtoolsQueryShapeStats, DevtoolsQueryStatsView, DevtoolsRecoveryCodes, DevtoolsReportLogEntry, DevtoolsResourcePoint, DevtoolsResourceSnapshot, DevtoolsResourcesView, DevtoolsRole, DevtoolsRoutePhaseStats, DevtoolsRouteStats, DevtoolsRouteStatsRow, DevtoolsRouteStatsView, DevtoolsSampleDetail, DevtoolsSampleQuery, DevtoolsSampleSummary, DevtoolsScheduleInfo, DevtoolsSessionInfo, DevtoolsSessionStage, DevtoolsSessionView, DevtoolsTotpEnrolment, DevtoolsUserListView } from "./production/contracts.mjs";
3
4
  import { RequestLogRecord } from "@warlock.js/core";
4
5
  //#region ../../packages/devtools/src/types.d.ts
5
6
  /**
@@ -60,9 +61,182 @@ export type DevtoolsOptions = {
60
61
  * @default []
61
62
  */
62
63
  panels?: readonly (string | DevtoolsPanel)[];
64
+ /**
65
+ * The production monitor: a signed-in dashboard at a secret path. Off
66
+ * unless `enabled` is `true`; read only when the app runs in production
67
+ * (development keeps the loopback dashboard and ignores this block).
68
+ * Secrets come from the environment, never from this object in source
69
+ * control: `DEVTOOLS_PATH`, `DEVTOOLS_ADMIN_EMAIL`, and
70
+ * `DEVTOOLS_ADMIN_PASSWORD` or `DEVTOOLS_SETUP_TOKEN`.
71
+ *
72
+ * @default undefined (off)
73
+ */
74
+ production?: DevtoolsProductionOptions;
75
+ };
76
+ /**
77
+ * Options of the production monitor (`devtools.production`). Every value has
78
+ * a safe default; only `enabled` must be set, and the path and first admin
79
+ * come from the environment.
80
+ */
81
+ export type DevtoolsProductionOptions = {
82
+ /**
83
+ * Turn the monitor on in production. Without it nothing is mounted and
84
+ * nothing is captured.
85
+ *
86
+ * @default false
87
+ */
88
+ enabled?: boolean;
89
+ /**
90
+ * The dashboard path. Prefer the `DEVTOOLS_PATH` environment variable; at
91
+ * least 8 characters, never `/__warlock`.
92
+ *
93
+ * @default process.env.DEVTOOLS_PATH
94
+ */
95
+ path?: string;
96
+ /**
97
+ * Share of requests captured with a full timeline, 0–1. Slow and failed
98
+ * requests outside the sample are kept as a summary.
99
+ *
100
+ * @default 0.1
101
+ */
102
+ sampleRate?: number;
103
+ /**
104
+ * A request at least this slow is kept even when not sampled.
105
+ *
106
+ * @default 1000
107
+ */
108
+ slowRequestMs?: number;
109
+ /**
110
+ * A query at least this slow counts in the query statistics even outside a
111
+ * sampled request.
112
+ *
113
+ * @default 200
114
+ */
115
+ slowQueryMs?: number;
116
+ /**
117
+ * Sampled requests kept in memory per process (the live view).
118
+ *
119
+ * @default 200
120
+ */
121
+ maxRequests?: number;
122
+ /**
123
+ * How long stored request samples are kept, in hours.
124
+ *
125
+ * @default 24
126
+ */
127
+ requestRetentionHours?: number;
128
+ /**
129
+ * The most samples one process writes to the database per minute; the rest
130
+ * stay in memory only.
131
+ *
132
+ * @default 120
133
+ */
134
+ maxStoredSamplesPerMinute?: number;
135
+ /**
136
+ * How often each process writes its report (resources, statistics, health)
137
+ * to the database, in ms.
138
+ *
139
+ * @default 10000
140
+ */
141
+ reportIntervalMs?: number;
142
+ /**
143
+ * Proxies whose `X-Forwarded-For`, `X-Forwarded-Proto` and
144
+ * `X-Forwarded-Host` headers are believed: IP addresses, CIDR ranges, or
145
+ * `"loopback"` and `"private"`. Without an entry the socket address is the
146
+ * client.
147
+ *
148
+ * @default []
149
+ */
150
+ trustedProxies?: readonly string[];
151
+ /**
152
+ * Answer only requests that arrived over HTTPS (directly or through a
153
+ * trusted proxy). Turn off only to try the monitor on a local machine.
154
+ *
155
+ * @default true
156
+ */
157
+ requireHttps?: boolean;
158
+ /**
159
+ * When set, only these client IPs or CIDR ranges reach the dashboard;
160
+ * everyone else gets a 404.
161
+ *
162
+ * @default [] (any client)
163
+ */
164
+ allowedIps?: readonly string[];
165
+ /**
166
+ * The public origin of the app (`https://app.example.com`), used for the
167
+ * CSRF origin check and passkeys. Without it the request's own origin is
168
+ * used.
169
+ *
170
+ * @default null
171
+ */
172
+ origin?: string;
173
+ /** Session lifetime. */
174
+ session?: {
175
+ /** Signed out after this many idle minutes. @default 30 */
176
+ idleMinutes?: number;
177
+ /** Signed out after this many hours whatever happens. @default 8 */
178
+ maxHours?: number;
179
+ };
180
+ /**
181
+ * Who must use a second factor (an authenticator app or a passkey).
182
+ *
183
+ * @default "admins"
184
+ */
185
+ twoFactor?: "admins" | "everyone";
186
+ /** Failed sign-in limits, counted over the audit log in a sliding window. */
187
+ rateLimits?: {
188
+ /** @default 15 */
189
+ windowMinutes?: number;
190
+ /** Failures per account before it is refused for the window. @default 5 */
191
+ account?: number;
192
+ /** Failures per client IP before it is refused for the window. @default 20 */
193
+ ip?: number;
194
+ /** Failures in total before the whole dashboard answers 404 for `lockMinutes`. @default 100 */
195
+ global?: number;
196
+ /** @default 15 */
197
+ lockMinutes?: number;
198
+ };
199
+ /** EXPLAIN in production. */
200
+ explain?: {
201
+ /**
202
+ * Allow executing plans (PostgreSQL `EXPLAIN ANALYZE`, MongoDB
203
+ * `executionStats`). They run the query; leave off unless you accept that.
204
+ *
205
+ * @default false
206
+ */
207
+ executing?: boolean;
208
+ };
209
+ /**
210
+ * Turn tabs on or off by id. Built-in tabs `mail`, `ai`, `agents`, `api`
211
+ * and `processes` are off in production unless set to `true`; a package
212
+ * panel shows only when it declares `production: true` or is set to `true`
213
+ * here.
214
+ *
215
+ * @default {}
216
+ */
217
+ panels?: Readonly<Record<string, boolean>>;
218
+ /**
219
+ * Log levels the Logs tab keeps outside sampled requests.
220
+ *
221
+ * @default ["warn", "error"]
222
+ */
223
+ logLevels?: readonly DevtoolsLogEntry["level"][];
224
+ /**
225
+ * How long audit entries are kept, in days.
226
+ *
227
+ * @default 90
228
+ */
229
+ auditRetentionDays?: number;
230
+ /** Passkeys as a second factor (needs `@simplewebauthn/server`). */
231
+ passkeys?: {
232
+ /** The name authenticators show. @default "Warlock monitor" */
233
+ rpName?: string;
234
+ /** The WebAuthn relying party id. @default the host of `origin`, else of the request */
235
+ rpId?: string;
236
+ };
63
237
  };
64
238
  /** `DevtoolsOptions` with every default applied. */
65
- export type ResolvedDevtoolsOptions = Required<Pick<DevtoolsOptions, "path" | "maxRequests" | "nPlusOneThreshold">> & Pick<DevtoolsOptions, "allowedHosts" | "allowProxied" | "panels">;
239
+ export type ResolvedDevtoolsOptions = Required<Pick<DevtoolsOptions, "path" | "maxRequests" | "nPlusOneThreshold">> & Pick<DevtoolsOptions, "allowedHosts" | "allowProxied" | "panels" | "production">;
66
240
  /** HTTP methods a panel data route may answer. */
67
241
  export type DevtoolsPanelMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
68
242
  /** What a panel data route handler receives. */
@@ -103,6 +277,16 @@ export type DevtoolsPanel = {
103
277
  view: string | URL;
104
278
  /** Data routes the view calls. */
105
279
  routes?: readonly DevtoolsPanelRoute[];
280
+ /**
281
+ * Whether the panel is safe to show in the production monitor. Without it
282
+ * the panel is left out in production unless the project sets
283
+ * `production.panels[<id>]: true`. In production its GET routes are open to
284
+ * viewers and every other method to admins only (with the CSRF check and an
285
+ * audit entry).
286
+ *
287
+ * @default false
288
+ */
289
+ production?: boolean;
106
290
  /**
107
291
  * More files the view loads, by served name: `{ "graph.js": "/abs/graph.js" }`
108
292
  * is served at `<path>/panels/<id>/graph.js`, so the view can
@@ -114,6 +298,11 @@ export type DevtoolsPanel = {
114
298
  export type DevtoolsPanelFactoryContext = {
115
299
  /** The app's root directory. */
116
300
  root: string;
301
+ /**
302
+ * Where the dashboard runs. In `production` a panel must not write files
303
+ * or run anything costly per request. Absent means `development`.
304
+ */
305
+ mode?: DevtoolsMode;
117
306
  };
118
307
  /** One panel or several. */
119
308
  export type DevtoolsPanels = DevtoolsPanel | readonly DevtoolsPanel[];
@@ -245,6 +434,10 @@ export type DevtoolsRequestSummary = {
245
434
  warningCount: number;
246
435
  /** Read from the persisted request log only: the request is no longer in memory. */
247
436
  persisted?: true;
437
+ /** The instance that served the request (production monitor). */
438
+ instance?: string;
439
+ /** Kept because it was slow or failed, without a timeline: the request was not sampled (production monitor). */
440
+ partial?: true;
248
441
  };
249
442
  /**
250
443
  * `GET <path>/api/requests/:id`: the in-memory record, or one rebuilt from
@@ -274,6 +467,13 @@ export type DevtoolsBackground = {
274
467
  };
275
468
  /** Server-sent events on `GET <path>/api/stream`. */
276
469
  export type DevtoolsStreamEvent = {
470
+ type: "hello";
471
+ data: {
472
+ mode: DevtoolsMode;
473
+ instance: string | null;
474
+ role: DevtoolsRole | null;
475
+ };
476
+ } | {
277
477
  type: "request";
278
478
  data: DevtoolsRequestSummary;
279
479
  } | {
@@ -330,4 +530,5 @@ export type DevtoolsCollector = {
330
530
  clear(): void;
331
531
  };
332
532
  //#endregion
533
+ export type { DEVTOOLS_BUILT_IN_PANELS, DEVTOOLS_FAILURE_AUDIT_TYPES, DEVTOOLS_LATENCY_BUCKETS_MS, DevtoolsAccountView, DevtoolsApiErrorBody, DevtoolsAuditEntry, DevtoolsAuditType, DevtoolsAuthStepResult, DevtoolsBuiltInPanelId, DevtoolsCaptureCounters, DevtoolsCreatedInvite, DevtoolsErrorCode, DevtoolsErrorGroup, DevtoolsErrorsView, DevtoolsExplainResult, DevtoolsHealthReport, DevtoolsHealthView, DevtoolsHistogram, DevtoolsInstanceInfo, DevtoolsInstanceReport, DevtoolsInstancesView, DevtoolsInviteView, DevtoolsJobsReport, DevtoolsJobsView, DevtoolsLogRow, DevtoolsLoginInput, DevtoolsLogsView, DevtoolsMode, DevtoolsPanelInfo, DevtoolsPasswordSource, DevtoolsQueryShapeRow, DevtoolsQueryShapeStats, DevtoolsQueryStatsView, DevtoolsRecoveryCodes, DevtoolsReportLogEntry, DevtoolsResourcePoint, DevtoolsResourceSnapshot, DevtoolsResourcesView, DevtoolsRole, DevtoolsRoutePhaseStats, DevtoolsRouteStats, DevtoolsRouteStatsRow, DevtoolsRouteStatsView, DevtoolsSampleDetail, DevtoolsSampleQuery, DevtoolsSampleSummary, DevtoolsScheduleInfo, DevtoolsSessionInfo, DevtoolsSessionStage, DevtoolsSessionView, DevtoolsTotpEnrolment, DevtoolsUserListView };
333
534
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/devtools/src/types.ts"],"mappings":";;;;;;;;;;;;;YAcY;;;;;;EAMV;;;;;;EAMA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;;;;;;;EAUA,4BAA4B;;;YAIlB,0BAA0B,SACpC,KAAK,kEAEL,KAAK;;YAGK;;YAGA;;EAEV,QAAQ,SAAS;;EAEjB,OAAO,SAAS;;EAEhB;;;;;;;;YASU;;EAEV,SAAS;;EAET;EACA,UAAU,SAAS;;;;;;;;;YAUT;;EAEV;;EAEA;;EAEA,eAAe;;EAEf,kBAAkB;;;;;;EAMlB,SAAS,SAAS,wBAAwB;;;YAIhC;;EAEV;;;YAIU,iBAAiB,yBAAyB;;;;;YAM1C,sBACR,mBACE,SAAS,gCAAgC,iBAAiB,QAAQ;;YAG5D;;EAEV;EACA;EACA;;;YAIU;EACV;EACA;EACA;EACA,QAAQ;;;YAIE;;EAEV;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;;;;;EAMA;;EAEA,SAAS;;;YAIC;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;;YAIU;EACV;EACA;EACA;EACA;EACA;;EAEA;;;YAIU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,aAAa;;;YAIH;EACV;EACA;EACA;;;YAIU;EACV;EACA;EACA;EACA;EACA,SAAS;;;YAIC;;EAEV;EACA;EACA;;EAEA;EACA;EACA;;EAEA;EACA;EACA,QAAQ;EACR,SAAS;EACT,OAAO;EACP,MAAM;;EAEN;EACA,UAAU;;;YAIA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;;;;;;YAQU,wBAAwB;EAClC;EACA,SAAS;;;YAIC;EACV;EACA;EACA;EACA;EACA;;;;;;YAOU;EACV,SAAS;EACT,OAAO;EACP,MAAM;;;YAII;EACN;EAAiB,MAAM;;EACvB;EAAc,MAAM;;EACpB;EAAa,MAAM;;EACnB;EAAY,MAAM;;EAClB;EAAqB,MAAM;;;YAGrB;;;;;;YAOA;EACV,aAAa;IACX;IACA;IACA;IACA;IACA;;;EAGF,WACE,YACA;IAAU;IAAiB;IAAoB;IAAgB;;EAEjE,SAAS,mBAAmB,OAAO;;EAEnC,SACE,+BACA,OAAO,KAAK,iCACX;EACH,kBAAkB,+BAA+B,WAAW;EAC5D,OAAO,+BAA+B,OAAO;EAC7C,QAAQ,MAAM;EACd,gBAAgB;EAChB,WAAW,aAAa;EACxB,aAAa;EACb,QAAQ,aAAa;EACrB,SAAS;IAAW,QAAQ;IAA2B;MAAoB;EAC3E,iBAAiB;EACjB,UAAU,WAAW,OAAO,+BAA+B;EAC3D"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/devtools/src/types.ts"],"mappings":";;;;;;;;;;;;;;YAiBY;;;;;;EAMV;;;;;;EAMA;;;;;;;EAOA;;;;;;;;;;EAUA;;;;;;;;;EASA;;;;;;;;;;EAUA,4BAA4B;;;;;;;;;;;EAW5B,aAAa;;;;;;;YAQH;;;;;;;EAOV;;;;;;;EAOA;;;;;;;EAOA;;;;;;EAMA;;;;;;;EAOA;;;;;;EAMA;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;;;EASA;;;;;;;EAOA;;;;;;;EAOA;;;;;;;;EAQA;;EAEA;;IAEE;;IAEA;;;;;;;EAOF;;EAEA;;IAEE;;IAEA;;IAEA;;IAEA;;IAEA;;;EAGF;;;;;;;IAOE;;;;;;;;;;EAUF,SAAS,SAAS;;;;;;EAMlB,qBAAqB;;;;;;EAMrB;;EAEA;;IAEE;;IAEA;;;;YAKQ,0BAA0B,SACpC,KAAK,kEAEL,KAAK;;YAGK;;YAGA;;EAEV,QAAQ,SAAS;;EAEjB,OAAO,SAAS;;EAEhB;;;;;;;;YASU;;EAEV,SAAS;;EAET;EACA,UAAU,SAAS;;;;;;;;;YAUT;;EAEV;;EAEA;;EAEA,eAAe;;EAEf,kBAAkB;;;;;;;;;;EAUlB;;;;;;EAMA,SAAS,SAAS,wBAAwB;;;YAIhC;;EAEV;;;;;EAKA,OAAO;;;YAIG,iBAAiB,yBAAyB;;;;;YAM1C,sBACR,mBACE,SAAS,gCAAgC,iBAAiB,QAAQ;;YAG5D;;EAEV;EACA;EACA;;;YAIU;EACV;EACA;EACA;EACA,QAAQ;;;YAIE;;EAEV;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;;;;;EAMA;;EAEA,SAAS;;;YAIC;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;;YAIU;EACV;EACA;EACA;EACA;EACA;;EAEA;;;YAIU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS;EACT,aAAa;;;YAIH;EACV;EACA;EACA;;;YAIU;EACV;EACA;EACA;EACA;EACA,SAAS;;;YAIC;;EAEV;EACA;EACA;;EAEA;EACA;EACA;;EAEA;EACA;EACA,QAAQ;EACR,SAAS;EACT,OAAO;EACP,MAAM;;EAEN;EACA,UAAU;;;YAIA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;;EAEA;;EAEA;;;;;;;YAQU,wBAAwB;EAClC;EACA,SAAS;;;YAIC;EACV;EACA;EACA;EACA;EACA;;;;;;YAOU;EACV,SAAS;EACT,OAAO;EACP,MAAM;;;YAII;EAEN;EACA;IAAQ,MAAM;IAAc;IAAyB,MAAM;;;EAE3D;EAAiB,MAAM;;EACvB;EAAc,MAAM;;EACpB;EAAa,MAAM;;EACnB;EAAY,MAAM;;EAClB;EAAqB,MAAM;;;YAGrB;;;;;;YAOA;EACV,aAAa;IACX;IACA;IACA;IACA;IACA;;;EAGF,WACE,YACA;IAAU;IAAiB;IAAoB;IAAgB;;EAEjE,SAAS,mBAAmB,OAAO;;EAEnC,SACE,+BACA,OAAO,KAAK,iCACX;EACH,kBAAkB,+BAA+B,WAAW;EAC5D,OAAO,+BAA+B,OAAO;EAC7C,QAAQ,MAAM;EACd,gBAAgB;EAChB,WAAW,aAAa;EACxB,aAAa;EACb,QAAQ,aAAa;EACrB,SAAS;IAAW,QAAQ;IAA2B;MAAoB;EAC3E,iBAAiB;EACjB,UAAU,WAAW,OAAO,+BAA+B;EAC3D"}
package/esm/ui-root.mjs CHANGED
@@ -4,11 +4,16 @@ import { fileURLToPath } from "node:url";
4
4
 
5
5
  //#region ../../packages/devtools/src/ui-root.ts
6
6
  let cachedUiRoot;
7
- /** Whether `dir` is this package's root: it has `ui/index.html` beside a `package.json` named `@warlock.js/devtools`. */
7
+ /**
8
+ * Whether `dir` is this package's root: it has the built dashboard
9
+ * (`ui/dashboard/index.html`) or, before the first build, the Processes panel
10
+ * view (`ui/panels/processes.js`), beside a `package.json` named
11
+ * `@warlock.js/devtools`.
12
+ */
8
13
  function isPackageRoot(dir) {
9
- const indexHtml = path.join(dir, "ui", "index.html");
14
+ const hasUi = existsSync(path.join(dir, "ui", "dashboard", "index.html")) || existsSync(path.join(dir, "ui", "panels", "processes.js"));
10
15
  const packageJson = path.join(dir, "package.json");
11
- if (!existsSync(indexHtml) || !existsSync(packageJson)) return false;
16
+ if (!hasUi || !existsSync(packageJson)) return false;
12
17
  try {
13
18
  return JSON.parse(readFileSync(packageJson, "utf8")).name === "@warlock.js/devtools";
14
19
  } catch {
@@ -30,7 +35,7 @@ function resolveUiRoot() {
30
35
  return cachedUiRoot;
31
36
  }
32
37
  const parent = path.dirname(dir);
33
- if (parent === dir) throw new Error("Could not locate the devtools UI directory: no ancestor of this module has a ui/index.html beside a package.json named @warlock.js/devtools.");
38
+ if (parent === dir) throw new Error("Could not locate the devtools UI directory: no ancestor of this module has ui/dashboard/index.html or ui/panels/processes.js beside a package.json named @warlock.js/devtools.");
34
39
  dir = parent;
35
40
  }
36
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ui-root.mjs","names":[],"sources":["../../../../../../../packages/devtools/src/ui-root.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nlet cachedUiRoot: string | undefined;\n\n/** Whether `dir` is this package's root: it has `ui/index.html` beside a `package.json` named `@warlock.js/devtools`. */\nfunction isPackageRoot(dir: string): boolean {\n const indexHtml = path.join(dir, \"ui\", \"index.html\");\n const packageJson = path.join(dir, \"package.json\");\n\n if (!existsSync(indexHtml) || !existsSync(packageJson)) {\n return false;\n }\n\n try {\n const parsed = JSON.parse(readFileSync(packageJson, \"utf8\")) as { name?: string };\n return parsed.name === \"@warlock.js/devtools\";\n } catch {\n return false;\n }\n}\n\n/**\n * Locate this package's `ui/` directory by walking up from the current\n * module's directory. Works from `src/` in development and from the built\n * `esm/`/`cjs/` output, since both sit beside `ui/` and `package.json` at\n * the package root.\n */\nexport function resolveUiRoot(): string {\n if (cachedUiRoot) {\n return cachedUiRoot;\n }\n\n let dir = path.dirname(fileURLToPath(import.meta.url));\n\n while (true) {\n if (isPackageRoot(dir)) {\n cachedUiRoot = path.join(dir, \"ui\");\n return cachedUiRoot;\n }\n\n const parent = path.dirname(dir);\n if (parent === dir) {\n throw new Error(\n \"Could not locate the devtools UI directory: no ancestor of \" +\n \"this module has a ui/index.html beside a package.json named \" +\n \"@warlock.js/devtools.\",\n );\n }\n\n dir = parent;\n }\n}\n"],"mappings":";;;;;AAIA,IAAI;;AAGJ,SAAS,cAAc,KAAsB;CAC3C,MAAM,YAAY,KAAK,KAAK,KAAK,MAAM,YAAY;CACnD,MAAM,cAAc,KAAK,KAAK,KAAK,cAAc;CAEjD,IAAI,CAAC,WAAW,SAAS,KAAK,CAAC,WAAW,WAAW,GACnD,OAAO;CAGT,IAAI;EAEF,OADe,KAAK,MAAM,aAAa,aAAa,MAAM,CAC9C,CAAC,CAAC,SAAS;CACzB,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;AAQA,SAAgB,gBAAwB;CACtC,IAAI,cACF,OAAO;CAGT,IAAI,MAAM,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;CAErD,OAAO,MAAM;EACX,IAAI,cAAc,GAAG,GAAG;GACtB,eAAe,KAAK,KAAK,KAAK,IAAI;GAClC,OAAO;EACT;EAEA,MAAM,SAAS,KAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KACb,MAAM,IAAI,MACR,8IAGF;EAGF,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"ui-root.mjs","names":[],"sources":["../../../../../../../packages/devtools/src/ui-root.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nlet cachedUiRoot: string | undefined;\n\n/**\n * Whether `dir` is this package's root: it has the built dashboard\n * (`ui/dashboard/index.html`) or, before the first build, the Processes panel\n * view (`ui/panels/processes.js`), beside a `package.json` named\n * `@warlock.js/devtools`.\n */\nfunction isPackageRoot(dir: string): boolean {\n const hasUi =\n existsSync(path.join(dir, \"ui\", \"dashboard\", \"index.html\")) ||\n existsSync(path.join(dir, \"ui\", \"panels\", \"processes.js\"));\n const packageJson = path.join(dir, \"package.json\");\n\n if (!hasUi || !existsSync(packageJson)) {\n return false;\n }\n\n try {\n const parsed = JSON.parse(readFileSync(packageJson, \"utf8\")) as { name?: string };\n return parsed.name === \"@warlock.js/devtools\";\n } catch {\n return false;\n }\n}\n\n/**\n * Locate this package's `ui/` directory by walking up from the current\n * module's directory. Works from `src/` in development and from the built\n * `esm/`/`cjs/` output, since both sit beside `ui/` and `package.json` at\n * the package root.\n */\nexport function resolveUiRoot(): string {\n if (cachedUiRoot) {\n return cachedUiRoot;\n }\n\n let dir = path.dirname(fileURLToPath(import.meta.url));\n\n while (true) {\n if (isPackageRoot(dir)) {\n cachedUiRoot = path.join(dir, \"ui\");\n return cachedUiRoot;\n }\n\n const parent = path.dirname(dir);\n if (parent === dir) {\n throw new Error(\n \"Could not locate the devtools UI directory: no ancestor of \" +\n \"this module has ui/dashboard/index.html or ui/panels/processes.js beside a package.json named \" +\n \"@warlock.js/devtools.\",\n );\n }\n\n dir = parent;\n }\n}\n"],"mappings":";;;;;AAIA,IAAI;;;;;;;AAQJ,SAAS,cAAc,KAAsB;CAC3C,MAAM,QACJ,WAAW,KAAK,KAAK,KAAK,MAAM,aAAa,YAAY,CAAC,KAC1D,WAAW,KAAK,KAAK,KAAK,MAAM,UAAU,cAAc,CAAC;CAC3D,MAAM,cAAc,KAAK,KAAK,KAAK,cAAc;CAEjD,IAAI,CAAC,SAAS,CAAC,WAAW,WAAW,GACnC,OAAO;CAGT,IAAI;EAEF,OADe,KAAK,MAAM,aAAa,aAAa,MAAM,CAC9C,CAAC,CAAC,SAAS;CACzB,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;AAQA,SAAgB,gBAAwB;CACtC,IAAI,cACF,OAAO;CAGT,IAAI,MAAM,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;CAErD,OAAO,MAAM;EACX,IAAI,cAAc,GAAG,GAAG;GACtB,eAAe,KAAK,KAAK,KAAK,IAAI;GAClC,OAAO;EACT;EAEA,MAAM,SAAS,KAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KACb,MAAM,IAAI,MACR,gLAGF;EAGF,MAAM;CACR;AACF"}