@warlock.js/devtools 5.57.0 → 5.58.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 (114) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +3 -0
  3. package/cjs/{auth-DzU0gHDG.cjs → auth-DV2GA1A9.cjs} +33 -403
  4. package/cjs/auth-DV2GA1A9.cjs.map +1 -0
  5. package/cjs/{boot-Dy5OqgTM.cjs → boot-CyeHPFtk.cjs} +14 -12
  6. package/cjs/boot-CyeHPFtk.cjs.map +1 -0
  7. package/cjs/{capture-CqIiaznN.cjs → capture-DcyBhdqw.cjs} +3 -3
  8. package/cjs/{capture-CqIiaznN.cjs.map → capture-DcyBhdqw.cjs.map} +1 -1
  9. package/cjs/{cascade-store-pHjKeSFm.cjs → cascade-store-DEGxAFDI.cjs} +141 -4
  10. package/cjs/cascade-store-DEGxAFDI.cjs.map +1 -0
  11. package/cjs/{contracts-CVmplkNb.cjs → contracts-CDuY-ahl.cjs} +6 -2
  12. package/cjs/{contracts-CVmplkNb.cjs.map → contracts-CDuY-ahl.cjs.map} +1 -1
  13. package/cjs/{errors-CyZp5yS-.cjs → errors-DEqdWaqm.cjs} +3 -1
  14. package/cjs/{errors-CyZp5yS-.cjs.map → errors-DEqdWaqm.cjs.map} +1 -1
  15. package/cjs/helpers-7k_Q-abk.cjs +436 -0
  16. package/cjs/helpers-7k_Q-abk.cjs.map +1 -0
  17. package/cjs/{histogram-BaI-PnCv.cjs → histogram-BRV5eHcp.cjs} +2 -2
  18. package/cjs/{histogram-BaI-PnCv.cjs.map → histogram-BRV5eHcp.cjs.map} +1 -1
  19. package/cjs/{http-DCfXQvw-.cjs → http-XNLYU2vS.cjs} +517 -28
  20. package/cjs/http-XNLYU2vS.cjs.map +1 -0
  21. package/cjs/index.cjs +1 -1
  22. package/cjs/{insights-BKtqxdnP.cjs → insights-BBZnUpWO.cjs} +4 -3
  23. package/cjs/{insights-BKtqxdnP.cjs.map → insights-BBZnUpWO.cjs.map} +1 -1
  24. package/cjs/{migrations-w7GMsrQw.cjs → migrations-DTTzCNpR.cjs} +38 -3
  25. package/cjs/migrations-DTTzCNpR.cjs.map +1 -0
  26. package/cjs/{options-CWqFC5__.cjs → options-CHhmQJic.cjs} +16 -4
  27. package/cjs/options-CHhmQJic.cjs.map +1 -0
  28. package/cjs/{panels-Rcmeitu3.cjs → panels-CHd20RK5.cjs} +74 -7
  29. package/cjs/panels-CHd20RK5.cjs.map +1 -0
  30. package/cjs/production/index.cjs +4 -4
  31. package/cjs/{server-ykxsOwob.cjs → server-C8JfggQU.cjs} +5 -4
  32. package/cjs/server-C8JfggQU.cjs.map +1 -0
  33. package/cjs/{src-UPtTCI2j.cjs → src-DjOUdhKc.cjs} +47 -10
  34. package/cjs/src-DjOUdhKc.cjs.map +1 -0
  35. package/cjs/{store-aq207T8v.cjs → store-C06KO_A1.cjs} +2 -2
  36. package/cjs/{stream-route-CJTABkUy.cjs → stream-route-D4k-sJvW.cjs} +70 -9
  37. package/cjs/stream-route-D4k-sJvW.cjs.map +1 -0
  38. package/esm/devtools-connector.d.mts.map +1 -1
  39. package/esm/devtools-connector.mjs +10 -3
  40. package/esm/devtools-connector.mjs.map +1 -1
  41. package/esm/index.d.mts +3 -3
  42. package/esm/panel-errors.mjs +33 -0
  43. package/esm/panel-errors.mjs.map +1 -0
  44. package/esm/panels.mjs +73 -6
  45. package/esm/panels.mjs.map +1 -1
  46. package/esm/production/auth/service.mjs +4 -2
  47. package/esm/production/auth/service.mjs.map +1 -1
  48. package/esm/production/boot.mjs +4 -2
  49. package/esm/production/boot.mjs.map +1 -1
  50. package/esm/production/contracts.d.mts +68 -2
  51. package/esm/production/contracts.d.mts.map +1 -1
  52. package/esm/production/contracts.mjs +5 -1
  53. package/esm/production/contracts.mjs.map +1 -1
  54. package/esm/production/errors.mjs +2 -0
  55. package/esm/production/errors.mjs.map +1 -1
  56. package/esm/production/http/access.mjs +6 -2
  57. package/esm/production/http/access.mjs.map +1 -1
  58. package/esm/production/http/constants.mjs +7 -1
  59. package/esm/production/http/constants.mjs.map +1 -1
  60. package/esm/production/http/context.mjs.map +1 -1
  61. package/esm/production/http/cookie.mjs +23 -2
  62. package/esm/production/http/cookie.mjs.map +1 -1
  63. package/esm/production/http/mount.mjs +25 -3
  64. package/esm/production/http/mount.mjs.map +1 -1
  65. package/esm/production/http/share-session.mjs +114 -0
  66. package/esm/production/http/share-session.mjs.map +1 -0
  67. package/esm/production/http/share.mjs +339 -0
  68. package/esm/production/http/share.mjs.map +1 -0
  69. package/esm/production/index.d.mts +2 -2
  70. package/esm/production/insights/writer.mjs +2 -1
  71. package/esm/production/insights/writer.mjs.map +1 -1
  72. package/esm/production/options.d.mts +5 -0
  73. package/esm/production/options.d.mts.map +1 -1
  74. package/esm/production/options.mjs +14 -2
  75. package/esm/production/options.mjs.map +1 -1
  76. package/esm/production/store/cascade-store.mjs +49 -2
  77. package/esm/production/store/cascade-store.mjs.map +1 -1
  78. package/esm/production/store/mapping.mjs +29 -1
  79. package/esm/production/store/mapping.mjs.map +1 -1
  80. package/esm/production/store/memory-store.mjs +62 -0
  81. package/esm/production/store/memory-store.mjs.map +1 -1
  82. package/esm/production/store/migrations.d.mts +2 -1
  83. package/esm/production/store/migrations.d.mts.map +1 -1
  84. package/esm/production/store/migrations.mjs +5 -2
  85. package/esm/production/store/migrations.mjs.map +1 -1
  86. package/esm/production/store/models/index.mjs +3 -1
  87. package/esm/production/store/models/share.migration.mjs +27 -0
  88. package/esm/production/store/models/share.migration.mjs.map +1 -0
  89. package/esm/production/store/models/share.model.mjs +13 -0
  90. package/esm/production/store/models/share.model.mjs.map +1 -0
  91. package/esm/server/panel-files.mjs +35 -0
  92. package/esm/server/panel-files.mjs.map +1 -0
  93. package/esm/server/panel-routes.mjs +27 -7
  94. package/esm/server/panel-routes.mjs.map +1 -1
  95. package/esm/server/session-routes.mjs +2 -1
  96. package/esm/server/session-routes.mjs.map +1 -1
  97. package/esm/types.d.mts +81 -2
  98. package/esm/types.d.mts.map +1 -1
  99. package/llms-full.txt +34 -4
  100. package/package.json +8 -8
  101. package/skills/SKILL.md +34 -4
  102. package/ui/dashboard/assets/app.css +1 -1
  103. package/ui/dashboard/assets/app.js +16 -16
  104. package/ui/dashboard/build-info.json +7 -7
  105. package/cjs/auth-DzU0gHDG.cjs.map +0 -1
  106. package/cjs/boot-Dy5OqgTM.cjs.map +0 -1
  107. package/cjs/cascade-store-pHjKeSFm.cjs.map +0 -1
  108. package/cjs/http-DCfXQvw-.cjs.map +0 -1
  109. package/cjs/migrations-w7GMsrQw.cjs.map +0 -1
  110. package/cjs/options-CWqFC5__.cjs.map +0 -1
  111. package/cjs/panels-Rcmeitu3.cjs.map +0 -1
  112. package/cjs/server-ykxsOwob.cjs.map +0 -1
  113. package/cjs/src-UPtTCI2j.cjs.map +0 -1
  114. package/cjs/stream-route-CJTABkUy.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-route-CJTABkUy.cjs","names":["AGENT_TRACE_INSTALL_GUIDANCE","DevtoolsApiError","createErrorRef","DevtoolsApiError","path","resolveUiRoot","readFileSync","existsSync","path","resolveUiRoot","panelContentType","DevtoolsApiError"],"sources":["../../../../../../../packages/devtools/src/server/ai-routes.ts","../../../../../../../packages/devtools/src/server/explain-route.ts","../../../../../../../packages/devtools/src/server/insights-routes.ts","../../../../../../../packages/devtools/src/server/log-routes.ts","../../../../../../../packages/devtools/src/server/mail-routes.ts","../../../../../../../packages/devtools/src/server/ui-assets.ts","../../../../../../../packages/devtools/src/server/openapi-routes.ts","../../../../../../../packages/devtools/src/server/panel-routes.ts","../../../../../../../packages/devtools/src/request-history.ts","../../../../../../../packages/devtools/src/server/requests-routes.ts","../../../../../../../packages/devtools/src/server/route-routes.ts","../../../../../../../packages/devtools/src/server/stream-route.ts"],"sourcesContent":["import type { FastifyInstance } from \"fastify\";\nimport { AGENT_TRACE_INSTALL_GUIDANCE } from \"../sources/agent-trace-source\";\nimport { AI_INSTALL_GUIDANCE } from \"../sources/ai-source\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\n/** Read-only AI metadata, inside the same development/loopback guard as every panel. */\nexport function registerAiRoutes(server: FastifyInstance, deps: MountDevtoolsRoutesDeps): void {\n server.get<{ Querystring: { requestId?: string } }>(\"/api/ai\", async (request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n const source = deps.ai;\n if (!source?.available) {\n return { available: false, message: source?.message ?? AI_INSTALL_GUIDANCE, runs: [] };\n }\n const filter =\n request.query.requestId === undefined ? undefined : { requestId: request.query.requestId };\n return {\n available: true,\n runs: source.store.query(filter).map(source.summarize),\n aggregate: source.store.aggregate(filter),\n };\n });\n\n // Per-turn agent traces recorded by `@warlock.js/ai` itself (system prompt,\n // tools offered, tool calls, refusals, retries, usage and cost). Unlike the\n // Panoptic feed above, these carry prompt and tool content: they exist for\n // debugging in development and sit behind the same guard.\n server.get<{ Querystring: { requestId?: string } }>(\n \"/api/ai/agent-runs\",\n async (request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n const source = deps.agentTraces;\n\n if (!source?.available()) {\n return { available: false, message: AGENT_TRACE_INSTALL_GUIDANCE, runs: [] };\n }\n\n return {\n available: true,\n runs: source.list(\n request.query.requestId === undefined\n ? undefined\n : { requestId: request.query.requestId },\n ),\n };\n },\n );\n\n server.get<{ Params: { id: string } }>(\"/api/ai/agent-runs/:id\", async (request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n const trace = deps.agentTraces?.get(request.params.id);\n\n if (!trace) return reply.code(404).send();\n\n return trace;\n });\n\n server.get<{ Params: { id: string } }>(\"/api/ai/runs/:id\", async (request, reply) => {\n reply.header(\"Cache-Control\", \"no-store\");\n const source = deps.ai;\n const trace = source?.available ? source.store.get(request.params.id) : undefined;\n if (!trace) return reply.code(404).send();\n return trace;\n });\n}\n","import { log } from \"@warlock.js/logger\";\nimport type { FastifyInstance } from \"fastify\";\nimport { createErrorRef, DevtoolsApiError } from \"../production/errors\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\n/**\n * The value the logger's redaction substitutes for a censored leaf\n * (`logger/src/redact/redact.ts`, `DEFAULT_CENSOR`). Not exported from\n * `@warlock.js/logger`, so matched by literal here.\n */\nconst REDACTED_PLACEHOLDER = \"[REDACTED]\";\n\nfunction isExplainableSql(sql: string | undefined): boolean {\n return /^\\s*(select|with)\\b/i.test(sql ?? \"\");\n}\n\n/** Registers the EXPLAIN route: Postgres `SELECT`/`WITH` queries only. */\nexport function registerExplainRoute(server: FastifyInstance, deps: MountDevtoolsRoutesDeps): void {\n server.post<{ Params: { requestId: string; queryId: string } }>(\n \"/api/requests/:requestId/queries/:queryId/explain\",\n async (request, reply) => {\n const found = deps.collector.getRequest(request.params.requestId);\n const query = found?.queries.find((item) => item.id === request.params.queryId);\n\n if (!query) {\n reply.code(404).send();\n return;\n }\n\n if (query.driver !== \"postgres\" || !isExplainableSql(query.sql) || !deps.explain) {\n reply.code(400).send({ error: \"Only Postgres SELECT or WITH queries can be explained\" });\n return;\n }\n\n if (query.bindings?.some((binding) => binding === REDACTED_PLACEHOLDER)) {\n reply.code(400).send({ error: \"bindings redacted\" });\n return;\n }\n\n try {\n const plan = await deps.explain(query);\n return { plan };\n } catch (error) {\n reply.code(500).send({ error: error instanceof Error ? error.message : String(error) });\n }\n },\n );\n}\n\n/**\n * Registers `POST /api/queries/:shapeId/explain`: EXPLAIN for a query shape,\n * run by the process that kept an example of it (development and production).\n * A failure answers `{ error, code, ref?, instance? }` with the code's status.\n */\nexport function registerShapeExplainRoute(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n): void {\n const explainShape = deps.explainShape;\n\n if (!explainShape) return;\n\n server.post<{ Params: { shapeId: string } }>(\n \"/api/queries/:shapeId/explain\",\n async (request, reply) => {\n try {\n return await explainShape(request.params.shapeId);\n } catch (error) {\n if (error instanceof DevtoolsApiError) {\n reply.code(error.statusCode).send(error.toBody());\n return;\n }\n\n const failure = new DevtoolsApiError(\"server.error\", { ref: createErrorRef() });\n\n log.error(\n \"devtools\",\n \"explain\",\n `EXPLAIN route failed (ref ${failure.ref}): ${error instanceof Error ? error.message : String(error)}`,\n );\n reply.code(failure.statusCode).send(failure.toBody());\n }\n },\n );\n}\n","import type { FastifyInstance } from \"fastify\";\nimport { DevtoolsApiError } from \"../production/errors\";\nimport type { DevtoolsInsightQuery, DevtoolsInsights } from \"../production/insights/types\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\ntype InsightsQuerystring = { instance?: string; sort?: string; limit?: string };\n\nconst QUERY_SORTS = [\"total\", \"p95\", \"count\", \"n+1\"] as const;\nconst ROUTE_SORTS = [\"total\", \"p95\", \"count\", \"errors\"] as const;\n\n/**\n * Reads `?instance=&sort=&limit=`. A sort outside `sorts` or a limit that is\n * not a whole number from 1 to 500 answers `input.invalid`.\n */\nexport function parseInsightQuery(\n query: InsightsQuerystring,\n sorts?: readonly string[],\n): DevtoolsInsightQuery {\n const result: DevtoolsInsightQuery = { instance: query.instance || \"all\" };\n\n if (sorts && query.sort !== undefined && query.sort !== \"\") {\n if (!sorts.includes(query.sort)) throw new DevtoolsApiError(\"input.invalid\");\n\n result.sort = query.sort;\n }\n\n if (query.limit !== undefined && query.limit !== \"\") {\n const limit = Number(query.limit);\n\n if (!Number.isInteger(limit) || limit < 1 || limit > 500) {\n throw new DevtoolsApiError(\"input.invalid\");\n }\n\n result.limit = limit;\n }\n\n return result;\n}\n\n/**\n * The read-only routes of the Resources, Queries (statistics), Routes\n * (statistics), Health, Errors, Logs (production) and Jobs tabs, over\n * `deps.insights`: `GET /api/instances`, `/api/resources`,\n * `/api/queries/stats`, `/api/routes/stats`, `/api/health`, `/api/errors`,\n * `/api/jobs`. Each takes `?instance=<id|all>` (default `all`). Without\n * `deps.insights` nothing is registered.\n */\nexport function registerInsightsRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n): void {\n const insights: DevtoolsInsights | undefined = deps.insights;\n\n if (!insights) return;\n\n const route = (\n path: string,\n sorts: readonly string[] | undefined,\n read: (query: DevtoolsInsightQuery) => Promise<unknown>,\n ): void => {\n server.get<{ Querystring: InsightsQuerystring }>(path, async (request, reply) => {\n const query = parseInsightQuery(request.query, sorts);\n\n reply.header(\"Cache-Control\", \"no-store\");\n\n return read(query);\n });\n };\n\n route(\"/api/instances\", undefined, () => insights.instances());\n route(\"/api/resources\", undefined, (query) => insights.resources(query));\n route(\"/api/queries/stats\", QUERY_SORTS, (query) => insights.queryStats(query));\n route(\"/api/routes/stats\", ROUTE_SORTS, (query) => insights.routeStats(query));\n route(\"/api/health\", undefined, (query) => insights.health(query));\n route(\"/api/errors\", undefined, (query) => insights.errors(query));\n route(\"/api/jobs\", undefined, (query) => insights.jobs(query));\n}\n","import type { FastifyInstance } from \"fastify\";\nimport type { DevtoolsLogRow } from \"../production/contracts\";\nimport type { DevtoolsLogEntry } from \"../types\";\nimport { parseInsightQuery } from \"./insights-routes\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\ntype LogsQuery = {\n level?: DevtoolsLogEntry[\"level\"];\n module?: string;\n instance?: string;\n limit?: string;\n};\n\n/**\n * Registers the log listing route, filterable by `level` and `module`. In\n * production it answers from the insights (every instance, no `context`);\n * in development it answers from the collector's logs, which keep `context`.\n */\nexport function registerLogRoutes(server: FastifyInstance, deps: MountDevtoolsRoutesDeps): void {\n server.get<{ Querystring: LogsQuery }>(\"/api/logs\", async (request, reply) => {\n const { level, module } = request.query;\n\n if (deps.mode === \"production\" && deps.insights) {\n const query = parseInsightQuery(request.query);\n\n reply.header(\"Cache-Control\", \"no-store\");\n\n return deps.insights.logs({\n ...query,\n ...(level ? { level } : {}),\n ...(module ? { module } : {}),\n });\n }\n\n const rows: DevtoolsLogRow[] = deps.collector.listLogs({ level, module }).map((entry) => ({\n level: entry.level,\n module: entry.module,\n action: entry.action,\n message: entry.message,\n at: entry.at,\n requestId: null,\n instance: null,\n context: entry.context,\n }));\n\n return rows;\n });\n}\n","import type { FastifyInstance } from \"fastify\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\nconst MAIL_HTML_CSP =\n \"sandbox; default-src 'none'; img-src data: https: http:; style-src 'unsafe-inline'\";\n\n/** Registers the mailbox list, single-mail detail, and mail HTML routes. */\nexport function registerMailRoutes(server: FastifyInstance, deps: MountDevtoolsRoutesDeps): void {\n server.get(\"/api/mails\", async () => deps.collector.listMails());\n\n server.get<{ Params: { id: string } }>(\"/api/mails/:id\", async (request, reply) => {\n const mail = deps.collector.getMail(request.params.id);\n\n if (!mail) {\n reply.code(404).send();\n return;\n }\n\n const { html, ...rest } = mail;\n return rest;\n });\n\n server.get<{ Params: { id: string } }>(\"/api/mails/:id/html\", async (request, reply) => {\n const mail = deps.collector.getMail(request.params.id);\n\n if (!mail || !mail.html) {\n reply.code(404).send();\n return;\n }\n\n reply\n .header(\"Content-Security-Policy\", MAIL_HTML_CSP)\n .header(\"X-Content-Type-Options\", \"nosniff\")\n .header(\"Content-Type\", \"text/html; charset=utf-8\")\n .send(mail.html);\n });\n}\n","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","import path from \"node:path\";\nimport type { FastifyInstance, FastifyReply } from \"fastify\";\nimport { resolveUiRoot } from \"../ui-root\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\nimport { sendFile } from \"./ui-assets\";\n\n/**\n * Registers the API docs: `GET /api/openapi.json` returns the document core\n * builds from the registered routes (`deps.getOpenApiDocument`), and\n * `GET /docs` serves the page that renders it with Scalar and\n * `GET /docs/swagger` the same document in Swagger UI;\n * `GET /api/postman.json` returns the Postman collection core builds\n * (`deps.getPostmanCollection`). The pages use relative URLs, so it works under whatever base path the dashboard is\n * mounted on.\n */\nexport function registerOpenApiRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n): void {\n server.get(\"/api/openapi.json\", async (_request, reply) => {\n if (!deps.getOpenApiDocument) {\n return reply.code(503).header(\"Cache-Control\", \"no-store\").send({\n error: \"The OpenAPI document is not available: the host did not provide a generator.\",\n });\n }\n\n reply.header(\"Cache-Control\", \"no-store\");\n\n return deps.getOpenApiDocument();\n });\n\n server.get(\"/api/postman.json\", async (_request, reply) => {\n if (!deps.getPostmanCollection) {\n return reply.code(503).header(\"Cache-Control\", \"no-store\").send({\n error: \"The Postman collection is not available: the host did not provide a generator.\",\n });\n }\n\n reply.header(\"Cache-Control\", \"no-store\");\n\n return deps.getPostmanCollection();\n });\n\n // The API tab shows these pages in a frame. The app's own headers (core's security headers forbid framing) are\n // replaced on the reply; production sets its full docs policy on top.\n const frameable = (reply: FastifyReply): FastifyReply =>\n reply\n .header(\"X-Frame-Options\", \"SAMEORIGIN\")\n .header(\"Content-Security-Policy\", \"frame-ancestors 'self'\");\n\n server.get(\"/docs\", (_request, reply) => {\n sendFile(frameable(reply), path.join(resolveUiRoot(), \"docs.html\"), \"text/html; charset=utf-8\");\n });\n\n server.get(\"/docs/swagger\", (_request, reply) => {\n sendFile(\n frameable(reply),\n path.join(resolveUiRoot(), \"docs-swagger.html\"),\n \"text/html; charset=utf-8\",\n );\n });\n}\n","import type { FastifyInstance } from \"fastify\";\nimport { type MountedDevtoolsPanel, panelContentType } from \"../panels\";\nimport type { DevtoolsPanelRequest } from \"../types\";\nimport { sendFile } from \"./ui-assets\";\n\n/**\n * Mounts each panel's data routes at `/api/<id><route path>` and its view\n * module and assets at `/panels/<id>/<name>`. Callers register this inside\n * the devtools scope, so the guard covers every one of them. A file is\n * served only when its name is listed by the panel; the request never\n * becomes a filesystem path.\n */\nexport function registerPanelRoutes(\n server: FastifyInstance,\n panels: readonly MountedDevtoolsPanel[],\n): void {\n const byId = new Map(panels.map((panel) => [panel.id, panel]));\n\n for (const panel of panels) {\n for (const route of panel.routes) {\n server.route({\n method: route.method,\n url: `/api/${panel.id}${route.path}`,\n handler: async (request, reply) => {\n const input: DevtoolsPanelRequest = {\n params: (request.params ?? {}) as Record<string, string>,\n query: (request.query ?? {}) as Record<string, string | string[]>,\n body: request.body,\n };\n const result = await route.handler(input);\n\n reply.header(\"cache-control\", \"no-store\");\n\n if (result === undefined) return reply.code(204).send();\n\n return result;\n },\n });\n }\n }\n\n server.get<{ Params: { id: string; name: string } }>(\"/panels/:id/:name\", (request, reply) => {\n const panel = byId.get(request.params.id);\n const name = request.params.name;\n const file =\n panel === undefined\n ? undefined\n : name === \"view.js\"\n ? panel.view\n : Object.hasOwn(panel.assets, name)\n ? panel.assets[name]\n : undefined;\n\n if (file === undefined) {\n reply.code(404).header(\"Cache-Control\", \"no-store\").send();\n return;\n }\n\n reply.header(\"X-Content-Type-Options\", \"nosniff\");\n sendFile(reply, file, panelContentType(name));\n });\n}\n","import type { RequestLogFilter, RequestLogRecord, RequestLogSummary } from \"@warlock.js/core\";\nimport type {\n DevtoolsLogEntry,\n DevtoolsRequestDetail,\n DevtoolsRequestSummary,\n DevtoolsWarning,\n} from \"./types\";\n\n/** The list row filters run over, from an in-memory summary. */\nexport function summaryToRow(summary: DevtoolsRequestSummary): RequestLogSummary {\n return {\n id: summary.id,\n time: new Date(summary.startedAt).toISOString(),\n method: summary.method,\n url: summary.path,\n ...(summary.route ? { route: summary.route } : {}),\n status: summary.status ?? 0,\n durationMs: summary.durationMs ?? 0,\n };\n}\n\n/** An in-memory-shaped list row from a persisted one. */\nexport function rowToSummary(row: RequestLogSummary): DevtoolsRequestSummary {\n return {\n id: row.id,\n method: row.method,\n path: row.url,\n route: row.route,\n status: row.status,\n startedAt: Date.parse(row.time),\n durationMs: row.durationMs,\n queryCount: row.queryCount ?? 0,\n warningCount: row.nPlusOneCount ?? 0,\n persisted: true,\n };\n}\n\n/**\n * Merge the live ring buffer with the persisted log, newest first, without\n * duplicates: a request in both is shown from memory (it has the full\n * timeline). Persisted rows fill in what a restart or the ring buffer's size\n * evicted.\n */\nexport function mergeRequestHistory(\n live: readonly DevtoolsRequestSummary[],\n persisted: readonly RequestLogSummary[],\n limit: number,\n): DevtoolsRequestSummary[] {\n const seen = new Set(live.map((summary) => summary.id));\n const merged = [...live];\n\n for (const row of persisted) {\n if (seen.has(row.id)) continue;\n\n seen.add(row.id);\n merged.push(rowToSummary(row));\n }\n\n return merged.sort((first, second) => second.startedAt - first.startedAt).slice(0, limit);\n}\n\nconst FILTER_KEYS = [\"status\", \"route\", \"method\", \"since\", \"until\", \"q\"] as const;\n\n/** The request log filter in a `GET /api/requests` query string. */\nexport function filterFromQuery(query: Record<string, unknown>): RequestLogFilter {\n const filter: RequestLogFilter = {};\n\n for (const key of FILTER_KEYS) {\n const value = query[key];\n\n if (typeof value === \"string\" && value.trim() !== \"\") filter[key] = value.trim();\n }\n\n const limit = Number(query.limit);\n\n if (Number.isInteger(limit) && limit > 0) filter.limit = limit;\n\n return filter;\n}\n\n/** Whether a filter narrows anything. */\nexport function hasFilter(filter: RequestLogFilter): boolean {\n return FILTER_KEYS.some((key) => filter[key] !== undefined);\n}\n\nfunction toLogLevel(level: string): DevtoolsLogEntry[\"level\"] {\n return level === \"debug\" || level === \"info\" || level === \"warn\" || level === \"success\"\n ? level\n : \"error\";\n}\n\n/**\n * A request detail rebuilt from a persisted record, in the shape of an\n * in-memory one: phases, logs and N+1 warnings carry over; query-by-query\n * and cache detail live only in memory, so those lists are empty. `record`\n * has everything the log kept.\n */\nexport function recordToDetail(record: RequestLogRecord): DevtoolsRequestDetail {\n const startedAt = Date.parse(record.time);\n const warnings: DevtoolsWarning[] = (record.queries?.nPlusOne ?? []).map((finding) => ({\n type: \"n+1\",\n message: `${finding.query} ran ${finding.count} times`,\n shape: finding.query,\n count: finding.count,\n }));\n\n return {\n id: record.id,\n method: record.method,\n path: record.url,\n route: record.route.pattern,\n status: record.status,\n startedAt,\n durationMs: record.durationMs,\n error: record.error?.message,\n phases: (record.phases ?? []).map((phase) => ({\n name: phase.name,\n startedAt,\n durationMs: phase.durationMs,\n })),\n queries: [],\n cache: [],\n logs: (record.logs ?? []).map((entry) => ({\n level: toLogLevel(entry.level),\n module: entry.module,\n action: entry.action,\n message: entry.message,\n at: entry.at,\n ...(entry.context ? { context: entry.context } : {}),\n })),\n mails: [],\n warnings,\n persisted: true,\n record,\n };\n}\n","import type { RequestLogFilter } from \"@warlock.js/core\";\nimport type { FastifyInstance, FastifyReply } from \"fastify\";\nimport { DevtoolsApiError } from \"../production/errors\";\nimport type { DevtoolsSampleFilter } from \"../production/store/types\";\nimport {\n filterFromQuery,\n hasFilter,\n mergeRequestHistory,\n recordToDetail,\n summaryToRow,\n} from \"../request-history\";\nimport type { DevtoolsRequestDetail } from \"../types\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\nconst STATUS_FILTER = /^(?:[1-5]\\d\\d|[1-5]xx)$/i;\nconst METHOD_FILTER = /^[A-Za-z]{1,16}$/;\nconst RELATIVE_SINCE = /^(\\d+)(s|m|h|d)$/;\nconst UNIT_MS = { s: 1000, m: 60_000, h: 3_600_000, d: 86_400_000 } as const;\nconst DEFAULT_SAMPLE_LIMIT = 200;\nconst MAX_SAMPLE_LIMIT = 1000;\n\n/** A time bound as epoch ms: a number, an ISO date, or (for `since`) a duration back such as `15m`. */\nfunction parseTimeBound(value: string, allowRelative: boolean): number {\n if (/^\\d+$/.test(value)) return Number(value);\n\n const relative = allowRelative ? RELATIVE_SINCE.exec(value) : null;\n\n if (relative) {\n return Date.now() - Number(relative[1]) * UNIT_MS[relative[2] as keyof typeof UNIT_MS];\n }\n\n const parsed = Date.parse(value);\n\n if (Number.isNaN(parsed)) throw new DevtoolsApiError(\"request.invalid-filter\");\n\n return parsed;\n}\n\n/** The stored-sample filter in a `GET /api/requests` query string; throws `request.invalid-filter`. */\nfunction sampleFilterFromQuery(\n query: Record<string, unknown>,\n filter: RequestLogFilter,\n fallbackLimit: number,\n): DevtoolsSampleFilter {\n const result: DevtoolsSampleFilter = {\n limit: Math.min(MAX_SAMPLE_LIMIT, filter.limit ?? fallbackLimit),\n };\n\n if (filter.status !== undefined) {\n const status = String(filter.status);\n\n if (!STATUS_FILTER.test(status)) throw new DevtoolsApiError(\"request.invalid-filter\");\n\n result.status = status.toLowerCase();\n }\n\n if (filter.method !== undefined) {\n if (!METHOD_FILTER.test(String(filter.method))) {\n throw new DevtoolsApiError(\"request.invalid-filter\");\n }\n\n result.method = String(filter.method);\n }\n\n if (filter.route !== undefined) result.route = String(filter.route);\n if (filter.q !== undefined) result.q = String(filter.q);\n if (filter.since !== undefined) result.since = parseTimeBound(String(filter.since), true);\n if (filter.until !== undefined) result.until = parseTimeBound(String(filter.until), false);\n\n const instance = query.instance;\n\n if (typeof instance === \"string\" && instance.trim() !== \"\" && instance !== \"all\") {\n result.instance = instance.trim();\n }\n\n return result;\n}\n\nfunction sendApiError(reply: FastifyReply, error: DevtoolsApiError): void {\n reply.code(error.statusCode).send(error.toBody());\n}\n\n/**\n * Production: the same four routes over the request source (stored samples\n * and this process's memory), merged with the persisted request log the way\n * development merges it with the ring buffer.\n */\nfunction registerProductionRequestsRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n): void {\n const source = deps.requests;\n\n if (!source) return;\n\n server.get<{ Querystring: Record<string, unknown> }>(\"/api/requests\", async (request, reply) => {\n const { requestLog, options } = deps;\n\n try {\n const filter = filterFromQuery(request.query);\n const sampleFilter = sampleFilterFromQuery(request.query, filter, DEFAULT_SAMPLE_LIMIT);\n const limit = Math.min(MAX_SAMPLE_LIMIT, filter.limit ?? options.maxRequests);\n let persisted: Awaited<ReturnType<NonNullable<typeof requestLog>[\"list\"]>> = [];\n\n if (requestLog) {\n try {\n requestLog.compile(filter);\n persisted = await requestLog.list({ ...filter, limit });\n } catch (error) {\n // A bad filter value is the caller's mistake; a read failure leaves the samples.\n if (error instanceof Error && /^Invalid /.test(error.message)) {\n throw new DevtoolsApiError(\"request.invalid-filter\");\n }\n }\n }\n\n const samples = await source.list({ ...sampleFilter, limit });\n\n return mergeRequestHistory(samples, persisted, limit);\n } catch (error) {\n if (error instanceof DevtoolsApiError) {\n sendApiError(reply, error);\n return;\n }\n\n throw error;\n }\n });\n\n server.get<{ Params: { id: string } }>(\"/api/requests/:id\", async (request, reply) => {\n const { id } = request.params;\n const persisted = await deps.requestLog?.get(id).catch(() => undefined);\n const found = await source.get(id);\n\n if (found) {\n const hasTimeline = \"phases\" in found;\n\n if (hasTimeline) return persisted ? { ...found, record: persisted } : found;\n\n // A slow or failed request that was not sampled: the summary, plus what the log kept.\n if (persisted) {\n return {\n ...recordToDetail(persisted),\n ...(found.instance === undefined ? {} : { instance: found.instance }),\n partial: true,\n };\n }\n\n return found;\n }\n\n if (!persisted) {\n sendApiError(reply, new DevtoolsApiError(\"request.not-found\"));\n return;\n }\n\n return recordToDetail(persisted);\n });\n\n server.get<{ Params: { id: string } }>(\"/api/requests/:id/curl\", async (request, reply) => {\n const { id } = request.params;\n const baseUrl = `${request.protocol}://${request.headers.host ?? \"localhost\"}`;\n const persisted = await deps.requestLog?.get(id).catch(() => undefined);\n\n if (persisted && deps.requestLog) return { curl: deps.requestLog.curl(persisted, baseUrl) };\n\n const found = await source.get(id);\n\n if (!found) {\n sendApiError(reply, new DevtoolsApiError(\"request.not-found\"));\n return;\n }\n\n return { curl: `curl -X ${found.method} '${baseUrl}${found.path.replace(/'/g, `'\\\\''`)}'` };\n });\n\n server.delete(\"/api/requests\", async (_request, reply) => {\n await source.clear();\n deps.collector.clear();\n reply.code(204).send();\n });\n}\n\n/**\n * Registers the request list, single-request detail, \"copy as curl\", and\n * clear routes.\n *\n * With core's persistent request log available, the list and the detail also\n * read the JSON-lines history, so requests survive a restart. The list\n * accepts `status` (404 or 5xx), `route`, `method`, `since`, `until`, `q`\n * and `limit` query parameters.\n */\nexport function registerRequestsRoutes(\n server: FastifyInstance,\n deps: MountDevtoolsRoutesDeps,\n): void {\n if (deps.requests) {\n registerProductionRequestsRoutes(server, deps);\n return;\n }\n\n server.get<{ Querystring: Record<string, unknown> }>(\"/api/requests\", async (request, reply) => {\n const { requestLog, collector, options } = deps;\n\n if (!requestLog) return collector.listRequests();\n\n try {\n const filter = filterFromQuery(request.query);\n const matches = requestLog.compile(filter);\n const live = hasFilter(filter)\n ? collector.listRequests().filter((summary) => matches(summaryToRow(summary)))\n : collector.listRequests();\n const limit = filter.limit ?? options.maxRequests;\n const persisted = await requestLog.list({ ...filter, limit });\n\n return mergeRequestHistory(live, persisted, limit);\n } catch (error) {\n // A bad filter value is the caller's mistake; a read failure leaves the live list.\n if (error instanceof Error && /^Invalid /.test(error.message)) {\n reply.code(400).send({ error: error.message });\n return;\n }\n\n return collector.listRequests();\n }\n });\n\n server.get<{ Params: { id: string } }>(\"/api/requests/:id\", async (request, reply) => {\n const { id } = request.params;\n const persisted = await deps.requestLog?.get(id).catch(() => undefined);\n const found = deps.collector.getRequest(id);\n\n if (found) {\n const detail: DevtoolsRequestDetail = persisted ? { ...found, record: persisted } : found;\n\n return detail;\n }\n\n if (!persisted) {\n reply.code(404).send();\n return;\n }\n\n return recordToDetail(persisted);\n });\n\n server.get<{ Params: { id: string } }>(\"/api/requests/:id/curl\", async (request, reply) => {\n const { id } = request.params;\n const baseUrl = `${request.protocol}://${request.headers.host ?? \"localhost\"}`;\n const persisted = await deps.requestLog?.get(id).catch(() => undefined);\n\n if (persisted && deps.requestLog) return { curl: deps.requestLog.curl(persisted, baseUrl) };\n\n // Without a persisted record only the method and path are known.\n const live = deps.collector.getRequest(id);\n\n if (!live) {\n reply.code(404).send();\n return;\n }\n\n return { curl: `curl -X ${live.method} '${baseUrl}${live.path.replace(/'/g, `'\\\\''`)}'` };\n });\n\n server.delete(\"/api/requests\", async (_request, reply) => {\n deps.collector.clear();\n if (deps.ai?.available) deps.ai.store.clear();\n reply.code(204).send();\n });\n}\n","import type { FastifyInstance } from \"fastify\";\nimport type { MountDevtoolsRoutesDeps } from \"./types\";\n\n/** Registers the route map, sourced from core's router via `deps.listRoutes`. */\nexport function registerRouteRoutes(server: FastifyInstance, deps: MountDevtoolsRoutesDeps): void {\n server.get(\"/api/routes\", async () => (deps.listRoutes ? deps.listRoutes() : []));\n}\n","import type { FastifyInstance } from \"fastify\";\nimport type { DevtoolsStreamSession, MountDevtoolsRoutesDeps } from \"./types\";\nimport type { DevtoolsLogEntry, DevtoolsStreamEvent } from \"../types\";\n\nconst PING_INTERVAL_MS = 15_000;\n\n/** How long a browser waits before it reconnects a dropped stream. */\nconst RETRY_MS = 5000;\n\n/** The log entry as the production stream sends it: no context (it may hold values). */\nfunction withoutContext(entry: DevtoolsLogEntry): DevtoolsLogEntry {\n return {\n level: entry.level,\n module: entry.module,\n action: entry.action,\n message: entry.message,\n at: entry.at,\n };\n}\n\n/**\n * Registers the SSE stream: one `event: <type>\\ndata: <json>\\n\\n` frame per\n * collector event, plus a `: ping` comment every 15s to keep intermediaries\n * from closing an idle connection. The reply is hijacked so Fastify never\n * tries to serialize or close the response itself.\n *\n * The first frames are `retry: 5000` and an `event: hello` with the mode,\n * instance and role. In production (`deps.streamSession` set) the session and\n * the open state are checked again at every ping and the stream ends when\n * either fails; log entries carry no context; mail, AI and agent events flow\n * only when those tabs are enabled.\n */\nexport function registerStreamRoute(server: FastifyInstance, deps: MountDevtoolsRoutesDeps): void {\n server.get(\"/api/stream\", async (request, reply) => {\n // Opening first, so a refused stream (`stream.too-many`) is a normal JSON error.\n const session: DevtoolsStreamSession | null = deps.streamSession\n ? await deps.streamSession(request)\n : null;\n const enabled = new Set(deps.builtInPanels ?? []);\n const instanceId = deps.instance?.id;\n const mode = deps.mode ?? \"development\";\n\n reply.hijack();\n const res = reply.raw;\n\n res.writeHead(200, {\n ...session?.headers,\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-store\",\n Connection: \"keep-alive\",\n \"X-Accel-Buffering\": \"no\",\n });\n\n const write = (frame: string): void => {\n if (!res.writableEnded && !res.destroyed) res.write(frame);\n };\n\n write(`retry: ${RETRY_MS}\\n\\n`);\n\n const hello: Extract<DevtoolsStreamEvent, { type: \"hello\" }>[\"data\"] = {\n mode,\n instance: instanceId ?? null,\n role: session?.role ?? (mode === \"development\" ? \"admin\" : null),\n };\n\n write(`event: hello\\ndata: ${JSON.stringify(hello)}\\n\\n`);\n\n const dispose = deps.collector.subscribe((event) => {\n if (event.type === \"hello\") return;\n\n if (session !== null) {\n if (event.type === \"mail\" && !enabled.has(\"mail\")) return;\n\n if (event.type === \"log\") {\n if (!session.logLevels.includes(event.data.level)) return;\n\n const row = withoutContext(event.data);\n\n write(\n `event: log\\ndata: ${JSON.stringify(instanceId !== undefined ? { ...row, instance: instanceId } : row)}\\n\\n`,\n );\n return;\n }\n }\n\n const data =\n event.type === \"request\" && instanceId !== undefined\n ? { ...event.data, instance: instanceId }\n : event.data;\n\n write(`event: ${event.type}\\ndata: ${JSON.stringify(data)}\\n\\n`);\n });\n\n const aiAllowed = session === null || enabled.has(\"ai\");\n const agentsAllowed = session === null || enabled.has(\"agents\");\n\n const disposeAi =\n aiAllowed && deps.ai?.available\n ? deps.ai.subscribe((event) => {\n write(`event: ai\\ndata: ${JSON.stringify(event)}\\n\\n`);\n })\n : undefined;\n\n const disposeAgentTraces = agentsAllowed\n ? deps.agentTraces?.subscribe((event) => {\n write(`event: agent-trace\\ndata: ${JSON.stringify(event)}\\n\\n`);\n })\n : undefined;\n\n let closed = false;\n\n const close = (): void => {\n if (closed) return;\n\n closed = true;\n clearInterval(pingTimer);\n dispose();\n disposeAi?.();\n disposeAgentTraces?.();\n session?.release();\n\n if (!res.writableEnded && !res.destroyed) res.end();\n };\n\n const pingTimer = setInterval(() => {\n if (session === null) {\n write(\": ping\\n\\n\");\n return;\n }\n\n session.revalidate().then(\n (stillValid) => {\n if (closed) return;\n\n if (stillValid) write(\": ping\\n\\n\");\n else close();\n },\n () => close(),\n );\n }, PING_INTERVAL_MS);\n pingTimer.unref();\n\n request.raw.on(\"close\", close);\n res.on(\"error\", close);\n });\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAgB,iBAAiB,QAAyB,MAAqC;CAC7F,OAAO,IAA6C,WAAW,OAAO,SAAS,UAAU;EACvF,MAAM,OAAO,iBAAiB,UAAU;EACxC,MAAM,SAAS,KAAK;EACpB,IAAI,CAAC,QAAQ,WACX,OAAO;GAAE,WAAW;GAAO,SAAS,QAAQ;GAAgC,MAAM,CAAC;EAAE;EAEvF,MAAM,SACJ,QAAQ,MAAM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