Devtools
@warlock.js/devtools is an in-app dashboard for understanding what a request
did while you develop. It is served at /__warlock and keeps its data only in
memory. It is a React app, and the same dashboard can run in production at a
secret path behind sign-in: see Use it in production.
Install
Section titled “Install”warlock add devtoolswarlock dev# open http://localhost:<port>/__warlockThe command adds @warlock.js/devtools as a development dependency. There is
nothing to configure: warlock dev discovers and loads it automatically.
For development nothing else is needed. If you also want the
production monitor, install the package as a
regular dependency and register devtoolsConnector() in warlock.config.ts;
the production page has the steps. Without that, do not import devtools from
application configuration: a production install that omits development
dependencies could not resolve it.
The dashboard
Section titled “The dashboard”The default dashboard retains the latest 200 requests at /__warlock. The sidebar groups its tabs; the AI group
holds Reports, Runs, Agents, Models, Errors and Evaluate.
| Panel | What it shows |
|---|---|
| Requests | Status, duration, query count, and a waterfall for router and page middleware, loaders, page-cache activity, rendering, and deferred values. |
| AI | A sidebar group of six pages: Reports, Models and Errors (hourly totals of runs, tokens, estimated cost and errors that survive restarts and, in production, add up every process), and Runs, Agents and Evaluate (single runs, agent traces and prompt grading, development only). See AI section. |
| Queries | SQL with bindings or Mongo commands, duration, rows, and Postgres SELECT query plans through Explain. Explain uses EXPLAIN (FORMAT JSON), never ANALYZE. |
| N+1 | Repeated query shapes within one request, including the source file and line. The dashboard marks the request and prints a terminal warning such as N+1: 12× "select … where post_id = $1" — src/app/posts/services/list-posts.service.ts:18. The fixed threshold is 5. |
| Mail captured by the development mail mode, including headers, sandboxed HTML and text, and attachment names. | |
| Logs | Request-associated log entries, filterable by level and module. |
| Cache | Hit, miss, set, removed, and tag-invalidation activity. |
| Routes | Registered HTTP routes with their method, path, name, and middleware. |
| Resources | Memory, CPU, event-loop delay and garbage collection of the process, with a short history. |
| Health | The app’s readiness checks over time. |
| Errors | Failed requests grouped by cause, with counts, the first and last time seen, and the route. |
| Jobs | The registered scheduled jobs of @warlock.js/scheduler with their schedule, last and next run. Each schedule shows its last duration, last error, runs, failures and its latest runs (green for success, red for failed, grey for skipped), read from the scheduler’s run history; error messages are scrubbed like request errors (quoted values, emails and documents removed). Queue job counts (waiting, active, delayed, failed, completed) appear for every driver that implements counts(); the tab says “not available” only for a driver that cannot count. |
| API | The app’s API reference, rendered from its OpenAPI 3.1 document. See API docs. |
The dashboard uses the Warlock logo colours: gold on near-black in the dark theme, and gold fills with dark text on a
warm off-white in the light theme. The top of the sidebar shows the Warlock logo with the installed @warlock.js/core
version (for example v5.58.0), and the bottom shows your app’s own name and version from its package.json
(for example shop v1.4.0). Both are read once on the server, only the name and version are sent, and they are shown
to signed-in users only; a line is left out when the value is not known. The sign-in screens and shared read-only
views show the logo without any version.
Each panel opens with a short description and its main actions, then a row of figures computed from the data on screen
(for Requests: the count, the server error rate, the p95 duration and the slowest request). Lists have a filter bar with a
result count (42 of 310) and a Clear filters action. Status codes and log levels are colour-coded, durations carry
a small bar that shows their size against the rest of the list, and a row opens its detail with the keyboard (Enter or
Space) as well as the mouse. Tables scroll inside their card on narrow screens.
Queries also lists query statistics: each query shape with its count, total and mean time, and p50 and p95. Routes lists the same for each route. In development these come from this process’s memory.
Work that is not part of a request, such as boot work or a scheduler tick, appears separately so it does not distort a request timeline.
Use it in production
Section titled “Use it in production”Development is unchanged: loopback only, no sign-in. The production monitor is a separate, opt-in mode. It shows requests, query and route statistics, errors, resources, health, jobs and, with Panoptic installed, hourly AI reports of the running app at a secret path, behind accounts with two-factor sign-in, and is off until you enable it. See Devtools in production to set it up and Devtools security for how it is protected.
Request history
Section titled “Request history”The dashboard keeps the latest 200 requests in memory. With core’s
request log on (the default in
development), the Requests panel also reads the persisted JSON-lines files
in storage/logs/requests, so history survives a restart and the 200-request
limit. A request in both places is shown once, from memory. Requests read only
from disk are marked saved.
- Filter the list by text (URL or id), status (
404or5xx) and method. The API takesstatus,route,method,since,until,qandlimit:GET /__warlock/api/requests?status=5xx&since=1h. - Open a saved request to see its error with stack, page file and site, the redacted request (headers, params, query, body, user), the response, the log entries and the query summary with N+1 findings. Per-query detail and Explain exist only for requests still in memory.
- Copy as curl builds a
curlcommand from the record (GET /__warlock/api/requests/:id/curl). Values the log redacted stay[REDACTED], so the command is safe to paste; replace them before running it.
Clear empties the in-memory list only; the files are not touched. Without the request log, or with a core older than 5.38, the panel shows only the in-memory requests.
Processes
Section titled “Processes”npx warlock add process registers a read-only Processes panel through
src/app/processes/devtools.ts. With @warlock.js/process configured, refresh
the panel to see its current PIDs, workload types, labels, command display,
limits, enforcement mode and peak memory. Environment tokens are not listed.
The endpoint is GET /__warlock/api/processes and uses the same development
and loopback guards. Without registration it returns an empty list. Process
stops remain application APIs; this panel has no stop endpoint. See
process supervision for ownership and platform limits.
Your own panels
Section titled “Your own panels”A package or the app can add a tab with its own data routes and view, with one
line in src/config/devtools.ts (panels: ["<package>/devtools"]). The
Processes tab is registered the same way. See
Registering a panel.
Grimoire tab
Section titled “Grimoire tab”With Grimoire in the project, panels: ["@warlock.js/grimoire/devtools"] adds a Grimoire tab:
search across flows, blocks, routes, files and tasks, and views for features, flows, pages, tasks, releases and the check
report. It keeps the generated book up to date with cached routes, never boots the app or changes an agent-written
file, and it can be exported as a static folder. See
The devtools tab.
API docs
Section titled “API docs”The dashboard has an API tab, and the same page is served on its own at /__warlock/docs. It renders the app’s OpenAPI 3.1 document with Scalar: every API route with its parameters, request body, responses and security.
http://localhost:<port>/__warlock/docsThe document is built in-process, on every request to GET /__warlock/api/openapi.json, from the routes the running dev server has already registered. It is the same generator as warlock generate.openapi, so what you see here is what that command writes (minus page routes), and it follows your edits without a CLI run. What it documents, and how to declare it (validation, description, responseSchema, authMiddleware()), is in the generate.openapi guide.
- If the host provides no document generator,
/__warlock/api/openapi.jsonanswers503. - Scalar’s prebuilt browser bundle is vendored in the package, so apps install nothing extra. The page fetches nothing from a CDN, and Scalar’s web fonts, telemetry, AI agent and MCP are turned off, so it makes no outside request.
- Warnings about routes that cannot be fully described are logged once per process.
- New in 5.28:
/__warlock/docs/swaggershows the same document in Swagger UI (vendored swagger-ui-dist 5.33.0, no outside requests, the validator badge off). The API tab has a Scalar | Swagger UI switch (remembered per browser) and download links for the OpenAPI document and a Postman collection (GET /__warlock/api/postman.json,503when the host provides no generator). - To get files on disk, run
warlock generate.openapi(OpenAPI, for Insomnia or SDK generators) orwarlock generate.postman(a native Postman collection).
Safe by construction
Section titled “Safe by construction”In development:
- The package is not installed in a production dependency install.
- If it is present anyway, devtools mounts nothing outside development unless you enabled the production monitor.
- Dashboard and API routes answer only loopback clients (
127.0.0.1and::1). The check uses the socket address;X-Forwarded-Forcannot unlock it. - The request must also be addressed to a loopback host:
localhost,*.localhost,127.0.0.1or[::1]. A website you visit cannot point its own domain at127.0.0.1and read your request history, queries or mail, and a page from another origin cannot call the API. - A request that carries
X-Forwarded-For,X-Forwarded-Host,X-Real-IPorForwardedis refused, because a local proxy or tunnel (ngrok, cloudflared) makes every visitor look like a loopback client. - A refused request gets an empty 404, and the terminal prints one warning per reason naming the option to change.
To open the dashboard on a custom dev hostname, or through a local proxy only
you can reach, add src/config/devtools.ts. It is a plain object, so it does
not import the package and is safe in production:
export default { // Extra hosts besides localhost; ".app.test" also matches subdomains. Default: []. allowedHosts: ["app.test"], // Answer requests that came through a proxy. Default: false. allowProxied: false, // Extra tabs, loaded only in development. Default: []. // See /v/latest/devtools/panels/. panels: [],};- Live data is held in memory and disappears when the process restarts. Only what core’s request log wrote (already redacted) is read back from disk.
Build your own tooling
Section titled “Build your own tooling”The dashboard uses public observability hooks rather than a private telemetry path. You can subscribe to the same request, query, mail, and cache events in your own tooling; see Request tracing.