diff --git a/CLAUDE.md b/CLAUDE.md
index c0a51bc..11438d8 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -84,7 +84,7 @@ Where to look first:
- `internal/server`: `net/http` ServeMux with method patterns (`"GET /health"`), wrapped in a request-logging middleware (its `statusRecorder` unwraps, so `http.ResponseController`, the read deadline of ingest bodies, reaches the connection) and `recoverPanics` inside it: a handler's panic is logged with method, path, route and stack and answered as a JSON 500 "internal error" (the connection is dropped if the answer had begun). Built from `server.Options`; depends on small interfaces (`Pinger`, `http.Handler` for ingest, `Routes` for the API and the web app), so tests use fakes. Mounts ingest (open), `/health` (open; 503 when `Store.Ping`, a read of the store, fails), the links that stop emails (`Unsubscribe`, open, signed), the API wrapped in `protectAPI` (IP allowlist first, then API token); MCP, OAuth, the web app (`Web`, every address no other route takes) and its API (`UIAPI`, a `UIRoutes`: routes plus the handler of every other address under `UIAPIPrefix`) use the IP allowlist plus their own authentication. `RESTPrefix` (`/api/v1/`) and `UIAPIPrefix` (`/api/ui/`) are defined here; the one `"/api/"` fallback (`unknownAPI`) sends `/api/ui/...` to the web app's API (a login, then a JSON 404) and anything else to a JSON 404 behind the token. `headers.go`: `ContentSecurityPolicy` (the one builder: script sources such as the page's inline hashes), `SecurityHeaders` (policy, nosniff, `Referrer-Policy: same-origin` (no-referrer would make browsers send `Origin: null` on same-origin POSTs), `X-Frame-Options`), `SameOrigin` (Origin's host is the request's, and https when the request is (`IsHTTPS` with the trusted proxies); oauth compares with PUBLIC_URL on purpose), used by `web` and `api/ui.go`.
- `internal/server` (`access.go`): `ClientIP` (uses `X-Forwarded-For` only when the direct peer is in `TRUSTED_PROXIES`, read right to left; entries may carry a port; addresses are compared unmapped and without an IPv6 zone, `comparable`, and IPv4-mapped networks in the settings are stored as IPv4), `FromTrustedProxy`, `RequireAllowedIP` (403, a debug log line with the address seen), `RequireToken` (constant-time; empty `API_TOKEN` closes the REST API).
- `internal/server` (`json.go`): `WriteJSON`/`JSONError` for JSON responses (`{"error": ...}`). Ingest keeps its own `writeError` because Sentry SDKs expect `{"detail": ...}` plus `X-Sentry-Error`.
-- `internal/api` (the catalog): the one catalog of requests, served as the REST API, as MCP tools and to the web app. `Endpoints(projects, services.All)` lists them in order; handlers reach data only through `services.All` (no store), so tools and pages apply the same rules (with nil arguments it only serves to read the definitions); each is `Define(Endpoint{Name, Description, ReadOnly, Idempotent, Destructive, Confirm, Admin, Transports, OpenWithTemporaryPassword}, handler)` with `handler(ctx, Call, In) (Out, error)`: the input schema comes from `In` (`json` + `jsonschema` tags, `jsonschema.For`) with the enums of `Choices` and the bounds of every `limit` (`DefaultLimit`, `MaxLimit`), `Run` validates the input map against it and decodes it. A new tool or API route = one entry + its handler; nothing else to register. `Call.Access()` is the projects the call sees (all for the REST token, the viewer's otherwise; handlers find projects by name or id through `services.Projects.Find` (`params.go`: `projectIDs` for filters, a missing one 404, a hidden one 403; `projectsField` for a form's field: unknown 400, hidden 403 at the field) and pass the access to services). `Call` has the `Transport` (`TransportREST`, `TransportMCP`, `TransportUI`; a `Call` without one runs nothing), the `Viewer` (the user of the agent or the web app; empty for the REST token), the `Actor` (recorded in the history) and the server `Address` (DSNs); `ForAgent()` is true unless the transport is REST or the web app (fail closed), and then `call.Text` redacts free text with `agentprompt.Redact`. Output is JSON, or `api.Text` written as is (the agent prompt of `get_issue`/`get_event`). Errors are sorted in one place (`OutcomeOf`: the HTTP status, the kind an MCP tool error starts with (`Outcome.ToolText`: `invalid: …`, `forbidden: …`, `not found: …`, `conflict: …`, `unavailable: …`, `internal error`) and the body), which `fail` (REST, the web app, the plain requests) and MCP's `failed` use: `InputError` with its status (`Invalid` 400, `notFound` 404, `conflict` 409, 413, 429 with `Retry-After`, 502 for a destination that refused a test message); `services.Reason` of `services.ErrForbidden` (the role or a rule of who may change whom; `services.Forbidden(reason)`), `services.ErrHidden` (a record of a project outside the viewer's; `services.Hidden(what, ids...)`, which names only what the caller gave, never the record's data) both 403, `store.ErrNotFound` (`services.Missing`) 404, `services.ErrConflict` 409; `services.Refusal` (a form refused as 403 or 409 with its fields, `formError` renames them; a taken project name 409, "This name cannot be used." for a hidden one); `ErrNotFound` 404; anything else logged and reported as "internal error". MCP adds the viewer's project names to a hidden record's refusal (`forbidden: issue k3x9q2mf is not in your projects (frontend, test2)`), which `list_projects` shows them anyway, so an agent tells a deleted issue from a hidden one; a 403 confirms only that an id or name exists. A refused form is `problemsError` (the problem of each field, renamed to the input's names) or `duplicateError` (409, the connection that already sends there, unnamed when hidden): over HTTP the body is `ErrorBody` `{error, fields?, duplicate?}` whatever the status, so a page shows each problem at its field, MCP gets the joined message (`TestInputErrorBody`, `errors_test.go`). Lists: `Page{items, next_cursor}`, 20 rows by default, at most 100, plain-number cursors (offset for issues/projects/deliveries, at most `store.MaxOffset` (`parseOffset`; `ListIssues` clamps too, since offset+limit must not overflow), last id for events/logs; `list_users` and `list_connections` return every row in one page). Every endpoint names its `Transports` (`Define` panics without; `AllTransports`, `ActsAsUser` = MCP and the web app, or one): `Run` refuses what `Refused(call)` names (`AllowedFor` is it being nil): an endpoint its transport does not serve (`ErrNotFound`), for a user without `CanAdminister` an `Admin` one (`services.ErrForbidden`, "your role may not do this"), and in the web app, while the user has a temporary password, anything without `OpenWithTemporaryPassword` (403 "change your password first"); the token runs every REST endpoint. REST only: `get_event_payload` (raw payload), `list_trace` (log attributes), their output must not reach a model provider (the web app reads the payload, indented, inside `get_issue_details`). `ActsAsUser` (`manage.go`, `notifications.go`): account, agents, projects, users, notification connections and email confirmation, acting as the user (`Users` and `Agents` refuse by role with `services.Forbidden` (403: "your role may not change this user" for a user changing an admin, `services.TakeOverProblem` for a user with projects the admin lacks; nobody changes themselves there: "change your own account on /account"); `Projects`, `Connections`, `Verification` and `Deliveries` check no role, only the access (`Projects.Save` keeps the disk share an admin's; `delete_project` is `Admin`)); form rules are shared because tools pass the form's fields as `url.Values` to `services.Projects.Save`/`Connections.Save`, starting from `FormValues` of the stored record so fields not given keep their values. `get_storage` (`session.go`, the web app only): the data the database holds against `MAX_DATABASE_SIZE` (`services.Projects.Storage`, `store.ProjectUsage.Live`, the cleanup's own measure) with the parts of the projects the viewer sees (`ProjectUsage.OnDisk`), other (live minus those projects), the files apart (`files`, `ProjectUsage.Files`), the start and stop percents, `last_received`, `dropped` (per project, `ingest.DropCounter` through `services.Dependencies.Dropped`) and `counting`, for the Projects page. `get_session` (`session.go`, the web app only, `OpenWithTemporaryPassword`): the viewer (`user`, with `display_name`), `can_administer`, `app_name` (`services.All.AppName`), the unresolved count, `project_colors` (the shown color of every project the viewer sees, by name, `services.Projects.ColorsByName`; badges set it with the `style:` directive), `all_projects` (the viewer sees every project, future ones included), `assignable_roles` (`store.User.AssignableRoles`, empty for a user) and `theme` (the user's, `store.User.Theme`, empty until the app records one). `set_theme` (the web app only, `OpenWithTemporaryPassword`, `store.Themes` as `Choices`; `services.Users.SetTheme`, `Store.UpdateUserTheme`) saves the user's theme. The web app's own endpoints (never MCP, mostly because their output is unredacted): `count_issues`, `list_issue_levels`, `list_issue_projects` (the count, level choices and project choices of the issue list (the projects some issue is in, from the tallies, `IssueProjects`: no issue read), from the filters `list_issues` takes, `issueFiltersInput`; `issueOutput.mcp_reference`, `agentprompt.MCPReference`, is filled only for the web app); `list_log_levels` (the level choices of the logs list: the levels some stored log in the viewer's projects has, highest first; no filters); `list_issue_projects` and `list_log_projects` (the project choices: from the issue tallies, `Store.IssueProjects`; one seek per visible project in the logs' project index, `Store.LogProjects`); `get_issue_details` (`issue_details.go`: an issue with its history, its 20 newest events (`next_cursor` for `list_issue_events`, whose items carry `received_at`) and one event (`?event=`, the latest by default) read by `services.Issues.Details`: `event_state` shown, unreadable, missing (not stored, or another issue's) or none (`services.EventState`, generated as a union through `outputSchemas`), the facts, exceptions outermost first with frames newest first, maps as name-sorted pairs, JSON indented by Go, related logs, the stored payload and the agent prompt); `apply_issue_action` (resolve, ignore, reopen or delete 1 to `services.MaxActionIssues` issues, `services.IssueActions` as choices; `ignore_for`/`ignore_until_events` (`ignoreBoundInput`, also on `update_issue_status`) only with ignore, else 400 (`services.ErrBoundWithoutIgnore`); invalid ids 400; deleted ones skipped; delete needs `CanAdminister`, checked by `services.Issues.ApplyAction`, else 403; missing and hidden issues skipped); `delete_logs` (`Admin`, `Destructive`, not for agents, whose logs are for reading: `log_ids`, 1 to `services.MaxActionLogs`, missing ones skipped; `{deleted}`; `list_logs` rows carry their `id`; `count_logs` and `list_logs` say `stopped` and `searched_to` when the search ran out of time, `count_logs` gives `from_id` for `list_logs`, and a stopped `list_logs` has a `next_cursor` that goes on below where it stopped); `list_cleanups` (`services.Projects.Cleanups` → `ShownRun`: `VisibleRun`, the projects outside access as one Other row, sizes from `ShownRun.Left`), `get_project_setup` (every role; `connected`/`connected_at` from the first contact (`services.Projects.Contact`, `store.ProjectUsage.FirstContact`), `received` once something is stored), `get_project_defaults`; `get_user` (`{user, can_manage, can_take_over, access_editable}` with reasons); `get_mcp_setup` (`agents.go`: how to connect an agent); `get_connection` (saved tokens masked by `textutil.MaskSecret`, never whole), `get_connection_defaults`, `test_chat`, `count_deliveries`. `set_connection_active` (also MCP) changes only `active`: a whole-form save would refuse a connection whose tokens cannot be read. `list_users` rows are `get_user`'s; `userOutput` has `display_name` and `created_at`; `list_agents` returns `user_id`, `owners` (whose agents the caller may list, only when more than one) and `connected` per agent; `get_project` gives `shown_color`, and an unknown project is `services.Missing` (404, naming it and pointing to `list_projects`). `create_user`/`update_user` take the roles of `store.AssignableRoles` as `Choices`. `list_projects` gives every role the recorded log levels as an explicit list, highest first (`config.Recording.RecordedLogLevels`, also behind `services.Projects.FormValues`). `typescript_test.go` (`TestTypeScriptCatalog`) generates `web/src/lib/api/catalog.gen.ts` from the endpoints the web app may call: inputs from `InputSchema`, outputs from the handler's output type (`Define` keeps it; `time.Time` → `IsoTime`, `json.RawMessage` → `unknown`), the method and admin/destructive/confirm flags (an endpoint of the web app that answers `Text` fails it: the app reads JSON only), the plain requests (`PlainRequests`, `plainRequests`), `ErrorBody`, `choices`, `levels` (highest first), `shownLevel` (the aliases of `config.EventLevelAliases` too), `apiPrefix`, `maxLimit`, and the values of the server's rules: `limits` (`config.Limits`), `issueStatuses` (with `store.StatusMeanings`), `maxActionIssues` (`services.MaxActionIssues`), `projectPalette` (`config.ProjectPalette`), `personalTokenKind` (`store.GrantToken`), `cleanupSteps` and `cleanupRules` (the cleanup by size), `diskShare` (`store.MinDiskShare`, `MaxDiskShare`, `DiskShareStep`), `roleSummaries`, `help` (`docs.Fields`, and of `docs.Settings` only `shownSettings`: a field or variable the app names that is not generated fails its type check); an unsupported schema keyword fails it, a stale file fails `make test`, `make api-types` rewrites it (excluded from Prettier). Never requests of the catalog, in any transport: logins, changing your own password (the account page asks for the current one, through `session.Auth` and its login limit) and generating personal tokens (`TestCatalogNeverChangesCredentials`, which allows them only in `plain*.go`): they are the plain requests of the web app (`plain.go`, `PlainRequests`: `login_state`, `login`, `setup_admin`, `logout`, `change_password`, `personal_token`, `authorization_request`, `authorization_decision`, each with its method and the Go types of its JSON input and output, `NoContent` for a 204), whose handlers (`LoginRequests` in `plain.go`, `AgentRequests` in `plain_agents.go`, joined in `app.New`) `NewUI` takes by name and mounts on their method inside the same guard; no endpoint takes their names (`TestEndpointNames`). The mount checks no session: each handler reads it itself (`sessionViewer`, the one session check of the catalog's calls and the plain requests) and applies the temporary-password rule where it matters, since `login` and `login_state` must work without one: `login_state` `{app_name, disabled?, redirect?}` (`disabled` the reason nobody can log in, without an admin and `ADMIN_PASSWORD`; redirect = `server.SafeNext(next)` only with a valid session); `login` 503 without an admin and `ADMIN_PASSWORD`, 429 `session.TooManyAttempts` with `Retry-After` (the login window), 401 "Wrong email or password." for a wrong password and an unknown user alike, 200 `{next}`, or `{next, setup: true}` for the env credentials while there is no admin (no session; see Users and roles); `logout` 204 even without a session; `change_password` open with a temporary password, problems as 400 `{error, fields}`, the login limit 429 at `current_password` (`session.ErrTooManyAttempts`); `personal_token` and the consent requests 403 with a temporary password; a body over 64 KiB 413. The description (`ToolDescription`) of a `Destructive` tool, or a `Confirm` one (it changes who may access the server, where errors are sent or what it records), tells the agent to get an explicit confirmation in chat.
+- `internal/api` (the catalog): the one catalog of requests, served as the REST API, as MCP tools and to the web app. `Endpoints(projects, services.All)` lists them in order; handlers reach data only through `services.All` (no store), so tools and pages apply the same rules (with nil arguments it only serves to read the definitions); each is `Define(Endpoint{Name, Description, ReadOnly, Idempotent, Destructive, Confirm, Admin, Transports, OpenWithTemporaryPassword}, handler)` with `handler(ctx, Call, In) (Out, error)`: the input schema comes from `In` (`json` + `jsonschema` tags, `jsonschema.For`) with the enums of `Choices` and the bounds of every `limit` (`DefaultLimit`, `MaxLimit`), `Run` validates the input map against it and decodes it. A new tool or API route = one entry + its handler; nothing else to register. `Call.Access()` is the projects the call sees (all for the REST token, the viewer's otherwise; handlers find projects by name or id through `services.Projects.Find` (`params.go`: `projectIDs` for filters, a missing one 404, a hidden one 403; `projectsField` for a form's field: unknown 400, hidden 403 at the field) and pass the access to services). `Call` has the `Transport` (`TransportREST`, `TransportMCP`, `TransportUI`; a `Call` without one runs nothing), the `Viewer` (the user of the agent or the web app; empty for the REST token), the `Actor` (recorded in the history) and the server `Address` (DSNs); `ForAgent()` is true unless the transport is REST or the web app (fail closed), and then `call.Text` redacts free text with `agentprompt.Redact`. Output is JSON, or `api.Text` written as is (the agent prompt of `get_issue`/`get_event`). Errors are sorted in one place (`OutcomeOf`: the HTTP status, the kind an MCP tool error starts with (`Outcome.ToolText`: `invalid: …`, `forbidden: …`, `not found: …`, `conflict: …`, `unavailable: …`, `internal error`) and the body), which `fail` (REST, the web app, the plain requests) and MCP's `failed` use: `InputError` with its status (`Invalid` 400, `notFound` 404, `conflict` 409, 413, 429 with `Retry-After`, 502 for a destination that refused a test message); `services.Reason` of `services.ErrForbidden` (the role or a rule of who may change whom; `services.Forbidden(reason)`), `services.ErrHidden` (a record of a project outside the viewer's; `services.Hidden(what, ids...)`, which names only what the caller gave, never the record's data) both 403, `store.ErrNotFound` (`services.Missing`) 404, `services.ErrConflict` 409; `services.Refusal` (a form refused as 403 or 409 with its fields, `formError` renames them; a taken project name 409, "This name cannot be used." for a hidden one); `ErrNotFound` 404; anything else logged and reported as "internal error". MCP adds the viewer's project names to a hidden record's refusal (`forbidden: issue k3x9q2mf is not in your projects (frontend, test2)`), which `list_projects` shows them anyway, so an agent tells a deleted issue from a hidden one; a 403 confirms only that an id or name exists. A refused form is `problemsError` (the problem of each field, renamed to the input's names) or `duplicateError` (409, the connection that already sends there, unnamed when hidden): over HTTP the body is `ErrorBody` `{error, fields?, duplicate?}` whatever the status, so a page shows each problem at its field, MCP gets the joined message (`TestInputErrorBody`, `errors_test.go`). Lists: `Page{items, next_cursor}`, 20 rows by default, at most 100, plain-number cursors (offset for issues/projects/deliveries, at most `store.MaxOffset` (`parseOffset`; `ListIssues` clamps too, since offset+limit must not overflow), last id for events/logs; `list_users` and `list_connections` return every row in one page). Every endpoint names its `Transports` (`Define` panics without; `AllTransports`, `ActsAsUser` = MCP and the web app, or one): `Run` refuses what `Refused(call)` names (`AllowedFor` is it being nil): an endpoint its transport does not serve (`ErrNotFound`), for a user without `CanAdminister` an `Admin` one (`services.ErrForbidden`, "your role may not do this"), and in the web app, while the user has a temporary password, anything without `OpenWithTemporaryPassword` (403 "change your password first"); the token runs every REST endpoint. REST only: `get_event_payload` (raw payload), `list_trace` (log attributes), their output must not reach a model provider (the web app reads the payload, indented, inside `get_issue_details`). `ActsAsUser` (`manage.go`, `notifications.go`): account, agents, projects, users, notification connections and email confirmation, acting as the user (`Users` and `Agents` refuse by role with `services.Forbidden` (403: "your role may not change this user" for a user changing an admin, `services.TakeOverProblem` for a user with projects the admin lacks; nobody changes themselves there: "change your own account on /account"); `Projects`, `Connections`, `Verification` and `Deliveries` check no role, only the access (`Projects.Save` keeps the disk share an admin's; `delete_project` is `Admin`)); form rules are shared because tools pass the form's fields as `url.Values` to `services.Projects.Save`/`Connections.Save`, starting from `FormValues` of the stored record so fields not given keep their values. `get_storage` (`session.go`, the web app only): the data the database holds against `MAX_DATABASE_SIZE` (`services.Projects.Storage`, `store.ProjectUsage.Live`, the cleanup's own measure) with the parts of the projects the viewer sees (`ProjectUsage.OnDisk`), other (live minus those projects), the files apart (`files`, `ProjectUsage.Files`), the start and stop percents, `last_received`, `dropped` (per project, `ingest.DropCounter` through `services.Dependencies.Dropped`), for the Projects page. `get_session` (`session.go`, the web app only, `OpenWithTemporaryPassword`): the viewer (`user`, with `display_name`), `can_administer`, `app_name` (`services.All.AppName`), the unresolved count, `project_colors` (the shown color of every project the viewer sees, by name, `services.Projects.ColorsByName`; badges set it with the `style:` directive), `all_projects` (the viewer sees every project, future ones included), `assignable_roles` (`store.User.AssignableRoles`, empty for a user) and `theme` (the user's, `store.User.Theme`, empty until the app records one). `set_theme` (the web app only, `OpenWithTemporaryPassword`, `store.Themes` as `Choices`; `services.Users.SetTheme`, `Store.UpdateUserTheme`) saves the user's theme. The web app's own endpoints (never MCP, mostly because their output is unredacted): `count_issues`, `list_issue_levels`, `list_issue_projects` (the count, level choices and project choices of the issue list (the projects some issue is in, from the tallies, `IssueProjects`: no issue read), from the filters `list_issues` takes, `issueFiltersInput`; `issueOutput.mcp_reference`, `agentprompt.MCPReference`, is filled only for the web app); `list_log_levels` (the level choices of the logs list: the levels some stored log in the viewer's projects has, highest first; no filters); `list_issue_projects` and `list_log_projects` (the project choices: from the issue tallies, `Store.IssueProjects`; one seek per visible project in the logs' project index, `Store.LogProjects`); `get_issue_details` (`issue_details.go`: an issue with its history, its 20 newest events (`next_cursor` for `list_issue_events`, whose items carry `received_at`) and one event (`?event=`, the latest by default) read by `services.Issues.Details`: `event_state` shown, unreadable, missing (not stored, or another issue's) or none (`services.EventState`, generated as a union through `outputSchemas`), the facts, exceptions outermost first with frames newest first, maps as name-sorted pairs, JSON indented by Go, related logs, the stored payload and the agent prompt); `apply_issue_action` (resolve, ignore, reopen or delete 1 to `services.MaxActionIssues` issues, `services.IssueActions` as choices; `ignore_for`/`ignore_until_events` (`ignoreBoundInput`, also on `update_issue_status`) only with ignore, else 400 (`services.ErrBoundWithoutIgnore`); invalid ids 400; deleted ones skipped; delete needs `CanAdminister`, checked by `services.Issues.ApplyAction`, else 403; missing and hidden issues skipped); `delete_logs` (`Admin`, `Destructive`, not for agents, whose logs are for reading: `log_ids`, 1 to `services.MaxActionLogs`, missing ones skipped; `{deleted}`; `list_logs` rows carry their `id`; `count_logs` and `list_logs` say `stopped` and `searched_to` when the search ran out of time, `count_logs` gives `from_id` for `list_logs`, and a stopped `list_logs` has a `next_cursor` that goes on below where it stopped); `list_cleanups` (`services.Projects.Cleanups` → `ShownRun`: `VisibleRun`, the projects outside access as one Other row, sizes from `ShownRun.Left`), `get_project_setup` (every role; `connected`/`connected_at` from the first contact (`services.Projects.Contact`, `store.ProjectUsage.FirstContact`), `received` once something is stored), `get_project_defaults`; `get_user` (`{user, can_manage, can_take_over, access_editable}` with reasons); `get_mcp_setup` (`agents.go`: how to connect an agent); `get_connection` (saved tokens masked by `textutil.MaskSecret`, never whole), `get_connection_defaults`, `test_chat`, `count_deliveries`. `set_connection_active` (also MCP) changes only `active`: a whole-form save would refuse a connection whose tokens cannot be read. `list_users` rows are `get_user`'s; `userOutput` has `display_name` and `created_at`; `list_agents` returns `user_id`, `owners` (whose agents the caller may list, only when more than one) and `connected` per agent; `get_project` gives `shown_color`, and an unknown project is `services.Missing` (404, naming it and pointing to `list_projects`). `create_user`/`update_user` take the roles of `store.AssignableRoles` as `Choices`. `list_projects` gives every role the recorded log levels as an explicit list, highest first (`config.Recording.RecordedLogLevels`, also behind `services.Projects.FormValues`). `typescript_test.go` (`TestTypeScriptCatalog`) generates `web/src/lib/api/catalog.gen.ts` from the endpoints the web app may call: inputs from `InputSchema`, outputs from the handler's output type (`Define` keeps it; `time.Time` → `IsoTime`, `json.RawMessage` → `unknown`), the method and admin/destructive/confirm flags (an endpoint of the web app that answers `Text` fails it: the app reads JSON only), the plain requests (`PlainRequests`, `plainRequests`), `ErrorBody`, `choices`, `levels` (highest first), `shownLevel` (the aliases of `config.EventLevelAliases` too), `apiPrefix`, `maxLimit`, and the values of the server's rules: `limits` (`config.Limits`), `issueStatuses` (with `store.StatusMeanings`), `maxActionIssues` (`services.MaxActionIssues`), `projectPalette` (`config.ProjectPalette`), `personalTokenKind` (`store.GrantToken`), `cleanupSteps` and `cleanupRules` (the cleanup by size), `diskShare` (`store.MinDiskShare`, `MaxDiskShare`, `DiskShareStep`), `roleSummaries`, `help` (`docs.Fields`, and of `docs.Settings` only `shownSettings`: a field or variable the app names that is not generated fails its type check); an unsupported schema keyword fails it, a stale file fails `make test`, `make api-types` rewrites it (excluded from Prettier). Never requests of the catalog, in any transport: logins, changing your own password (the account page asks for the current one, through `session.Auth` and its login limit) and generating personal tokens (`TestCatalogNeverChangesCredentials`, which allows them only in `plain*.go`): they are the plain requests of the web app (`plain.go`, `PlainRequests`: `login_state`, `login`, `setup_admin`, `logout`, `change_password`, `personal_token`, `authorization_request`, `authorization_decision`, each with its method and the Go types of its JSON input and output, `NoContent` for a 204), whose handlers (`LoginRequests` in `plain.go`, `AgentRequests` in `plain_agents.go`, joined in `app.New`) `NewUI` takes by name and mounts on their method inside the same guard; no endpoint takes their names (`TestEndpointNames`). The mount checks no session: each handler reads it itself (`sessionViewer`, the one session check of the catalog's calls and the plain requests) and applies the temporary-password rule where it matters, since `login` and `login_state` must work without one: `login_state` `{app_name, disabled?, redirect?}` (`disabled` the reason nobody can log in, without an admin and `ADMIN_PASSWORD`; redirect = `server.SafeNext(next)` only with a valid session); `login` 503 without an admin and `ADMIN_PASSWORD`, 429 `session.TooManyAttempts` with `Retry-After` (the login window), 401 "Wrong email or password." for a wrong password and an unknown user alike, 200 `{next}`, or `{next, setup: true}` for the env credentials while there is no admin (no session; see Users and roles); `logout` 204 even without a session; `change_password` open with a temporary password, problems as 400 `{error, fields}`, the login limit 429 at `current_password` (`session.ErrTooManyAttempts`); `personal_token` and the consent requests 403 with a temporary password; a body over 64 KiB 413. The description (`ToolDescription`) of a `Destructive` tool, or a `Confirm` one (it changes who may access the server, where errors are sent or what it records), tells the agent to get an explicit confirmation in chat.
- `internal/api` (`audit.go`): the audit log. Each changing handler records its change after it succeeded (`handler.audit` with an `auditChange`: resource, action, record id and name, projects, and views of the record before and after, `projectAudit`, `userAudit`, `connectionAudit`, `issueAudit`, `logAudit`, of which `services.AuditDiff` keeps the fields that differ and drops secret-named ones; `Replaced` puts `store.AuditReplaced` for a password or chat token that changed; a DSN reset keeps the old and the new DSN, field `dsn`), as `Call.Viewer` (email, role) or the API token, with `Call.Agent` (MCP: the grant's name) and `Call.IP` (`server.ClientIP`). Not recorded: own-account changes, test messages, refusals; an edit that changed nothing. The first admin's setup is recorded by `services.Users.SetupAdmin`. One request is one entry: a request that changed several records keeps them as `Items` (`store.AuditItem`), listed with `item_count` and a `record_name` such as "3 issues" (`itemsName`). `list_audit` (MCP and the web app) and `count_audit` read it through `services.Audit`, `list_audit_choices` (the web app) its filters' choices from tallies per project and resource, action and user (`auditTallies`, recounted once on databases from before them; `services.Audit.Choices`: the viewer's projects, of none only with every project, and the users they see; per project, so a rare entry spanning a project a limited viewer lacks can offer a value that matches nothing), `exists` saying the web app may link the record, and `get_audit_entry` (MCP and the web app) one entry with its items; an entry is seen by `AuditEntry.VisibleTo` (one record: all its projects within access; several: any item within it), trimmed to the viewer's items by `ShownTo` (403 outside it). A viewer who does not administer sees who acted only for the users they see (`AuditFilter.Actors`, `User.SeesUser`; `ShowsActor`): others are "Admin" or "User", without id, email, address or agent, and never found by `query` or `user_id`; agents never get the address. No endpoint changes it (`TestAuditTransports`). `audit_test.go` covers each action, secrets, visibility, actors and transports.
- `internal/api` (`rest.go`, `NewREST`): serves the catalog under `/api/v1/` behind `protectAPI`: `GET` with query parameters when `ReadOnly` (converted with `Endpoint.FieldType`; lists repeated or comma-separated; unknown parameters 400), `POST` with a JSON object otherwise (`api.Route(transport, endpoint)`, the prefix from the transport; a body over 64 KiB 413; the other method at an endpoint's path 405 with `Allow`, `wrongMethod`, after the caller is checked). Routes are registered one by one by `register` (a subtree would overlap `/api/{projectID}/envelope/`, so names must never be `envelope`, `TestEndpointNames`); the HTTP transports share `serve` (the caller first, then the role, before the input is read, then the input and the run) and `fail`. Actor "API token" (`store.SourceAPI`).
- `internal/api` (`ui.go`, `NewUI`): serves the catalog to the web app under `/api/ui/`, as the user of the login session (`SessionUsers`, the `session.Auth`): no valid session 401 `login required`, a session that could not be checked 500 (never a login loop). `guard` wraps every route and the fallback (`UI.ServeHTTP`: an unknown name 404 after the session check): `SecurityHeaders` with `default-src 'none'; frame-ancestors 'none'; sandbox`, `Cross-Origin-Resource-Policy: same-origin`, `Sec-Fetch-Site` cross-site or same-site 403, a change needs `application/json` (415) and a same-origin `Origin` (403); no CORS ever. The plain requests' handlers sit behind the same `guard` and the IP allowlist (`TestUIPlainRequests`). Actor the user with `store.SourceUI`; text unredacted (the user's own server). The API token, MCP tokens and the session never open each other's transports (`TestUIRequiresSession`).
@@ -100,7 +100,7 @@ Where to look first:
- Requests: `#lib/api/client.ts` calls the catalog through `catalog.gen.ts` (`get` only for reads, the only calls a `load` may make since loads run on hover (`data-sveltekit-preload-data="tap"`); `post` for changes, JSON with the page's Origin; `listAll` walks `next_cursor` with `maxLimit`; a 401 sends the browser to `/login?next=` (one trip for all the requests of a page), a second 401 within 10 s is an error instead (sessionStorage guard); `send(name, input)` makes a plain request, where a 401 from `login`/`login_state` is the form's answer and any other goes to the login, a 204 gives `undefined`; a request without an answer (fetch rejects: network, a dropped connection) is an `ApiError` 503 "The server did not answer…", so the error page says so; `ApiError` carries `fields` and `duplicate` of a refused form; `errorMessage(failure, fallback)` is the text of any failure; `pageError` turns a refused request into the error page of its status: 404 not found, 403 "You do not have access to this" with the reason; forms and dialogs show the message and `fields` whatever the status). Forms send one request through `#lib/form.svelte.ts` (`FormState.submit`: busy, a refusal's `fields` to each TextField, `duplicate`, any other failure to `error`); a form that edits a saved record gives `new FormState(() => input)` (what it would send, trimmed, empty secret fields left out): `changed` compares it with the saved values (the first ones, those shown after a successful submit, or `reset()`, e.g. when a dialog opens for a record), and `submit` sends nothing while unchanged; its submit button is `SubmitButton` (Edit project page and dialog, connection edit, user edit, account name; creation forms, login and password change give no values, so they are always sendable).
- Shell: the pages live in the `(app)` group, whose `+layout.ts` asks `get_session` unawaited (`depends('app:session')`, invalidated after every navigation but the first and shallow ones, for the unresolved count); `+layout.svelte` renders the sidebar and the page once it is known (pages and components read it as `session.current`, `#lib/session.svelte.ts`, never as page data) and sends a temporary password to `/account` (`goto`); `+layout.svelte` is `Sidebar` (groups and items from `#lib/nav.ts`; collapsed state in localStorage; `ThemeSwitch`; Log out through the plain `logout`) and `main`; `/` redirects to `/issues`. `/login` lives outside `(app)`, reads `login_state` and after a login does a full load of the server's `next`. Route parameters are matched by `src/params.ts` (`defineParams`: `projectId` a positive number, `connectionId` 8 characters of `store.NewID`).
- Lists: the filters live in the address (`#lib/filters.ts`: `readChoices`, `readText`, `readDays` (UTC days, a reversed range swapped), `readPaging` (20/50/100), `dayRange` for the API's since/until, `changed` (a filter change starts from page 1), `cleared` (keeps the page size)), changed with `showChanged` (`#lib/navigate.svelte.ts`: the controls show a change at once through `shown(name, value)`, and the list loads once nothing changed for `editPause` (1 s), every change meanwhile in one `goto` with `reset: false`; only typing replaces the history entry, Enter in a search field loads at once, a page size at once; another navigation first drops the waiting changes); while changes wait or the list loads another address of its own, its Table is `busy` (`#lib/loading.svelte.ts` `reloading()`); the chips of what a list applies come from the builders of `chips.ts` (`listChip`, `textChip`, `daysChip`, `appliedChips`), the Projects and Levels filters are a `FilterPicker`; a page asks the count first, so a page past the end shows the last one, then the list with `offset`/`cursor`; level, project (and the audit log's every) pickers offer the values some row has and the chosen ones (`offered`).
- - Pages: `/logs` (`count_logs`, then `list_logs` only when it found some, for the rows it found and back to its `from_id` (`listPage`), so the list never searches further than the count; a count that ran out of time shows a warning Notice with how far back it searched (`stoppedSearch`) and "+" in the Pager; LogBody; for admins checkboxes with Delete in a sticky `BulkBar`, `logs.ts`); `/issues` (`issues.ts`: `readIssueFilters` reads the address with `#lib/filters.ts`' `readProjects` (names or ids) and `readChoice` (one known value); status default unresolved and sort default `last_seen` are not written and give no chip (`withStatus`, `sortedBy`); `count_issues` then `list_issues` (`pageWithin` of `#lib/filters.ts`), `list_issue_levels`, the sortable headings `columnSorts`, rows tinted by status (`statusRowTone`, `issueStatusTitle`), badges filtering the list, per row "Copy for agent" and Open; checked rows in a sticky `BulkBar` with `IssueActions`, then a toast and `invalidateAll`); `/issues/[id]` (one `get_issue_details` load, rules in `issue.ts`: Breadcrumbs, facts, IssueActions (delete goes to the list), Prompt and Copy for agent, the event (clock drift, thinned note, trace linked to `/logs` when it has logs), exceptions (`ExceptionCard`, `StackFrame`: unfolds only with source or variables, open where the app threw), the missing-event notice, the status history (`StatusHistory`, `changeAuthor`), the events (selected row, "Load more" through `list_issue_events`), then closed Details: related logs, breadcrumbs, request, tags and user, contexts, raw JSON); `/projects` (storage card split per project in its color plus other (`usageSegments`), columns unresolved, logs recorded, size ("counting…" while the backfill runs), last received; under a project's name and id the logs and events dropped since its streak began (`list_projects` `dropped`, `droppedSince`, shown only when something was; `droppedLine`: else the 24 h `droppedSummary`, as for whole requests refused, which the totals leave out), a link to a Dialog of the last 24 h by kind and reason when it has rows; RowMenu: for admins Rename (name and color in one FormDialog); Show installation code; Settings for admins; Logs; Delete for admins), `/projects/new` (a hero `ProjectNameField` and Add project, then Advanced settings: `ColorField`, `LogLevelsField`, `DiskShareField`) and `/projects/[id=projectId]` (`ProjectForm`: the name renamed in place by `EditableTitle`, `ColorField`, `LogLevelsField`, `DiskShareField`); `ColorField`: swatches of the generated `projectPalette`, a custom color, a preview badge, `/projects/[id]/setup` (`get_project_setup`: "Connect" and the project's Badge, SDK code per platform in `Steps`, "Copy for agent", `ConnectStatus` (a `StatusCard`: waiting with Do it later, or connected with links to its issues and logs), asks again every 3 s until `connected`), `/projects/cleanups` (`list_cleanups`, a run's steps in a Dialog, its compaction afterwards in a column and the Dialog, `cleanups.ts`), `#lib/projects.ts` (delete confirmation, the form's input); `/notifications` (`list_connections` with `destination` and `delivery.failing`; RowMenu: Edit, Pause/Resume through `set_connection_active`, Delete; the Delivery column links to the connection's delivery log, the page heading to the whole log), `/notifications/new` and `/notifications/[id=connectionId]` (one `ConnectionForm`: the email address goes through `EmailStep`, its own form, with `start_email_verification`/`confirm_email`, its progress kept by the form so a type switch keeps it, and everything after it disabled until it is confirmed; saved tokens come masked from `get_connection` and an empty field keeps them, only typed fields are sent; chats are tested before saving with `test_chat`; after a save the form reads the stored connection again; "Include Open issue link" is not offered without PUBLIC_URL (`get_connection_defaults.issue_links_available`), so the stored value stays), `/notifications/log` (`count_deliveries`, `list_deliveries`, filters `connection`/`status`), rules in `#lib/notifications.ts`; `/users`, `/users/new`, `/users/[id]` (RowMenu: Edit, Reset password, Delete; a temporary password shown once in SecretReveal, held in `#lib/handoff.ts` (`handOver`/`takeOver`, module memory only) or component state); `/account` (`update_account_name`; under Profile and Security an `ActionRow` each opens a FormDialog: , `change_password`; with a temporary password only the password form, on the page); `/agents` (MCP: `McpSetup`, `ConnectedApps`, see `internal/oauth`); `/audit` ("Audit log" in Monitoring, every role: `count_audit`, then `list_audit`; filters records, actions, users (a Picker with `searchText`: the users of `list_users` with an entry, exact ids; every choice from `list_audit_choices`, `auditChoices`) and projects, search, dates (`audit.ts`); the action, the project badges (`ProjectsSummary` `limit` 1), the user and the record type filter the list; Message is a sentence (`entryMessage`: "Resolved" TypeError…, "Created" ops "→ ops@example.com"; a bulk entry's `before`/`after` are what all its records changed alike, `commonFields`); the eye opens a Dialog with Facts (the IP only there) and `AuditDiff`, or for "N issues" `AuditItems` from `get_audit_entry`; the record links to its page while `exists`, `#lib/audit.ts` `recordHref`); `/oauth/authorize` (the consent page, see `internal/oauth`).
+ - Pages: `/logs` (`count_logs`, then `list_logs` only when it found some, for the rows it found and back to its `from_id` (`listPage`), so the list never searches further than the count; a count that ran out of time shows a warning Notice with how far back it searched (`stoppedSearch`) and "+" in the Pager; LogBody; for admins checkboxes with Delete in a sticky `BulkBar`, `logs.ts`); `/issues` (`issues.ts`: `readIssueFilters` reads the address with `#lib/filters.ts`' `readProjects` (names or ids) and `readChoice` (one known value); status default unresolved and sort default `last_seen` are not written and give no chip (`withStatus`, `sortedBy`); `count_issues` then `list_issues` (`pageWithin` of `#lib/filters.ts`), `list_issue_levels`, the sortable headings `columnSorts`, rows tinted by status (`statusRowTone`, `issueStatusTitle`), badges filtering the list, per row "Copy for agent" and Open; checked rows in a sticky `BulkBar` with `IssueActions`, then a toast and `invalidateAll`); `/issues/[id]` (one `get_issue_details` load, rules in `issue.ts`: Breadcrumbs, facts, IssueActions (delete goes to the list), Prompt and Copy for agent, the event (clock drift, thinned note, trace linked to `/logs` when it has logs), exceptions (`ExceptionCard`, `StackFrame`: unfolds only with source or variables, open where the app threw), the missing-event notice, the status history (`StatusHistory`, `changeAuthor`), the events (selected row, "Load more" through `list_issue_events`), then closed Details: related logs, breadcrumbs, request, tags and user, contexts, raw JSON); `/projects` (storage card split per project in its color plus other (`usageSegments`), columns unresolved, logs recorded, size, last received; under a project's name and id the logs and events dropped since its streak began (`list_projects` `dropped`, `droppedSince`, shown only when something was; `droppedLine`: else the 24 h `droppedSummary`, as for whole requests refused, which the totals leave out), a link to a Dialog of the last 24 h by kind and reason when it has rows; RowMenu: for admins Rename (name and color in one FormDialog); Show installation code; Settings for admins; Logs; Delete for admins), `/projects/new` (a hero `ProjectNameField` and Add project, then Advanced settings: `ColorField`, `LogLevelsField`, `DiskShareField`) and `/projects/[id=projectId]` (`ProjectForm`: the name renamed in place by `EditableTitle`, `ColorField`, `LogLevelsField`, `DiskShareField`); `ColorField`: swatches of the generated `projectPalette`, a custom color, a preview badge, `/projects/[id]/setup` (`get_project_setup`: "Connect" and the project's Badge, SDK code per platform in `Steps`, "Copy for agent", `ConnectStatus` (a `StatusCard`: waiting with Do it later, or connected with links to its issues and logs), asks again every 3 s until `connected`), `/projects/cleanups` (`list_cleanups`, a run's steps in a Dialog, its compaction afterwards in a column and the Dialog, `cleanups.ts`), `#lib/projects.ts` (delete confirmation, the form's input); `/notifications` (`list_connections` with `destination` and `delivery.failing`; RowMenu: Edit, Pause/Resume through `set_connection_active`, Delete; the Delivery column links to the connection's delivery log, the page heading to the whole log), `/notifications/new` and `/notifications/[id=connectionId]` (one `ConnectionForm`: the email address goes through `EmailStep`, its own form, with `start_email_verification`/`confirm_email`, its progress kept by the form so a type switch keeps it, and everything after it disabled until it is confirmed; saved tokens come masked from `get_connection` and an empty field keeps them, only typed fields are sent; chats are tested before saving with `test_chat`; after a save the form reads the stored connection again; "Include Open issue link" is not offered without PUBLIC_URL (`get_connection_defaults.issue_links_available`), so the stored value stays), `/notifications/log` (`count_deliveries`, `list_deliveries`, filters `connection`/`status`), rules in `#lib/notifications.ts`; `/users`, `/users/new`, `/users/[id]` (RowMenu: Edit, Reset password, Delete; a temporary password shown once in SecretReveal, held in `#lib/handoff.ts` (`handOver`/`takeOver`, module memory only) or component state); `/account` (`update_account_name`; under Profile and Security an `ActionRow` each opens a FormDialog: , `change_password`; with a temporary password only the password form, on the page); `/agents` (MCP: `McpSetup`, `ConnectedApps`, see `internal/oauth`); `/audit` ("Audit log" in Monitoring, every role: `count_audit`, then `list_audit`; filters records, actions, users (a Picker with `searchText`: the users of `list_users` with an entry, exact ids; every choice from `list_audit_choices`, `auditChoices`) and projects, search, dates (`audit.ts`); the action, the project badges (`ProjectsSummary` `limit` 1), the user and the record type filter the list; Message is a sentence (`entryMessage`: "Resolved" TypeError…, "Created" ops "→ ops@example.com"; a bulk entry's `before`/`after` are what all its records changed alike, `commonFields`); the eye opens a Dialog with Facts (the IP only there) and `AuditDiff`, or for "N issues" `AuditItems` from `get_audit_entry`; the record links to its page while `exists`, `#lib/audit.ts` `recordHref`); `/oauth/authorize` (the consent page, see `internal/oauth`).
- Components (`#lib/components`; every element that looks or acts the same is one of them, shown with its variants on `/design-system`): ActionList and ActionRow (rows on a card's surface that open a dialog: an icon in a square, the label, a line under it, a chevron; under a small uppercase heading), Button (variants default, primary, danger, info, accent (indigo, filled on hover: the issue list's Open), neutral (grey on the code background: a disabled session action; CopyButton `variant`, CodeBlock/CopyField/SecretReveal `copyVariant`), menu (the ⋯ of a RowMenu: no box until hovered or open), link, muted (a grey secondary link: a log's trace), title (the name of a table row that opens its record: text color, bold), ghost; `size="large"` the one main action of a page (Add project), `truncate` its text on one line cut with "…" (a link in the delivery log); `expanded` for a toggle, `popup` (aria-haspopup), `busy` (ignores clicks, keeps the focus), `form` for a submit button outside its form, `external` (a new tab, `rel=noopener noreferrer`), `unavailable` (the reason it does nothing now, its tooltip; aria-disabled, so it keeps the focus)), SubmitButton (a form's submit through its FormState: busy, and "Nothing changed" while an edit form's values are the saved ones), Card, UsageBar (`segments`: parts in project colors, `usage.ts`; widths through the `style:` directive), PageTitle (the tab title ` · `, also set by PageHeading), Badge (tones error, warning, success, info, debug, plain, project; an on/off state is a StatusText; a project's color from `get_session`'s `project_colors`, or `color` for one not saved yet; `size="heading"` beside a page's title), LevelBadge (tone from the generated `shownLevel`), StatusBadge (`issueStatus.ts`: tone, mark, meaning from the generated `issueStatuses`; `detail` after it, what ends an ignore, `ignoreBoundText`, the list's row title `issueStatusTitle`), RoleBadge and RoleChoices (`role.ts`), AuditActionBadge (an audit action: create success, edit info, delete error, others plain, `#lib/audit.ts`), AuditDiff (an audit entry's changed fields as a git-style diff: each field with its before line (red) over its after line (green), the words that changed marked (`changedParts`); a side no field has is left out), AuditValue (one side of a changed value, a line in its side's color, the changed parts marked; `sideClasses`), AuditItems (the records of an entry whose request changed several: what they all changed alike once as an AuditDiff, then a Table of Project, Record and a column per field that differs (`groupFields`, `itemValue`), rows tinted by the status before (`statusRowTone`), the records the search finds first with the match marked (`searchParts`), a record linked only while it has a page), IssueActions (`issueActions.ts`: the actions of a status or of checked issues, confirmation texts, `doneMessage`, `selectionProblem`; Ignore is a labeled RowMenu of `ignoreOptions`: forever, each `ignore_for`, until 10/100/1000 more events), BulkBar (sticky above a list with checkboxes: the count checked or its `problem`, and the actions), AgentCopyButton ("Copy for agent", `mcp_reference`), CopyButton, CopyField (`masked`: dots until Show), Toast (the one live region, toasts stacked in the corner of its `position` (`toast.ts`); `toasts` shows another `ToastStore` than the app's `toast`, as the design-system page's sample does: each slides in with a bar of its time left, paused on hover, a × to close, white with a round status mark and a time bar in the tone color (success by default, error, info: copies), the newest 5 kept; `toast.show(text, tone, duration)`), PageHeading (`leading` before the title, `actions`, `description`: the muted line under the title (what the page is for, an issue's location)), EmptyState (`variant="card"`: a card with text on the left, the MCP page's connected apps), Notice (info, success, warning, error; `alert` announces it as it appears), StatusPage (404, or 403 "You do not have access to this" with the server's reason), ErrorPage (StatusPage for 404/403, the message otherwise), Table (columns and a `cell` snippet; column options `number`, `wideOnly`, `actions`, `fill` (takes the width the others leave; several fill columns share it equally), `rowHeader` (th scope=row: key–value tables), `sort` (`columnSort`: the heading links to its first direction, then the reverse; aria-sort); table options `sort`, bindable `selected` (a checkbox per row, select-all mixed in between, emptied when the rows change), `rowTone` (error, success, faded; the `row-*` tokens of `layout.css`) with `rowTitle`, `selectedKey`, `headerless`, `compact`, `flat` (no box of its own inside a card or a dialog), `top` (cells at the top of their row, for rows of several lines such as logs; centred otherwise); every table is as tall as its rows and scrolls only sideways, `busy` (rows faded under a running bar, aria-busy)), NavLink (a link, an `onclick` button or a form's submit), Sidebar, ThemeSwitch ("Dark mode" above the account, a NavLink with a Switch: the user's theme from `get_session` (`saved`), so every browser they log in from shows it; without one, the theme shown now (the system's or this browser's) is saved at once through `set_theme`, and toggling saves light or dark there too; Switch, a toggle with role switch; `#lib/theme.ts` keeps a copy in localStorage `exceptic-theme` and sets `data-theme` on ``, which an inline script of `app.html` also does before the first paint (the login page uses only that copy); Go hashes it like SvelteKit's, `TestEmbeddedBuild`), Breadcrumbs (the path above a title, the last item the page; Esc follows the one before it, decided on keydown and followed on keyup as a click, unless a field has the focus, a `dialog` is open or a popup carries `data-popup` (`#lib/escape.ts`); a popup that closes itself on Esc prevents the event's default), Dialog (`size` wide or narrow, `actions` footer, `onopen`, `dismissible` false while its action runs; one that is not dismissible opens again if the browser closes it), FormActions (the end of every form: FormError, then the SubmitButton and an optional Cancel link in one row; `stretch` puts the submit across the form: the login, Add project), FormError (a FormState's `error`, an alert Notice), FormDialog (a short form in a narrow Dialog, e.g. a project's name and color, the account's email and password, through a FormState: Cancel and Save (`submitLabel`), a refused field keeps it open with its problem, it closes on success, the first text field selected), ConfirmDialog and ConfirmButton (every delete, reset and bulk action: the `Confirmation` of `confirm.ts`, Cancel focused first, Cancel/Esc/backdrop do nothing, busy and not dismissible while the action runs, an `ApiError` shown in the dialog, `disabled`; never `window.confirm`), RowMenu (the ⋯ of a table row, or with `text` a labeled menu button with a chevron (`variant`, `disabled`, `title`), items as data (`menu.ts`: links, actions, `danger`, `separatorBefore`, a `confirm` asked first, `disabled` with its reason under the label, reached by the arrows), fixed under its button so a table's scroll box does not cut it, arrows/Home/End, Esc back to the button, Tab, a click outside, scrolling close it), Details (`section` card with h2, count and a one-line detail; `form` card with Hint and the values under the title, opened when `invalid`; `disclosure` a card of optional settings (Advanced settings): a line on what is inside, the body under a line, parted by `FormGroup`; `nested` a flat bordered box with title and count inside another card (a stack trace in an exception); `inline` small disclosure), CodeBlock (`plain` wrapped, `command` one line after › with copy, `snippet` with copy), TextField (label, `note`, Hint, `description` under the field, server error, limits as props, `action` (a button beside the field: Verify, Find chat ID), `saved`: a stored secret's mask in the placeholder and an sr-only description, `variant="hero"` the one large centered field of a page, its label for screen readers only (Add project), `variant="code"` narrow and monospace for a confirmation code), ChoiceGroup and Choice (fieldset of radios or checkboxes, descriptions, disabled with a `reason`; the group `inline` (side by side), `compact`/`beside` (a small legend over or before a tight row of short options: levels), `card` (a card of its own), `hideLegend` (sr-only, when a heading names it), `lead` (an option above the others, such as All projects; the empty row of the others is hidden); Choice `hint`: a "?" outside the label that describes the option (`aria-describedby` to the Hint's `id`)), LevelChoices and LevelSummary (levels highest first, or "none"; LevelChoices `inline` by default, `hideLegend`), SecretReveal (a secret shown once: a warning Notice and a CopyField, plain or masked), Select (a listbox popup; `all` adds the no-choice option; `field`: a form field with its label above, full width), Facts (`boxed`, `columns`: two to a row, the issue page's facts and its event's), StatusText (a state as a pill with a dot in its tone, `status.ts`: success, warning, error, muted), Steps and Step (numbered steps, the number in a circle, the content indented), StatusCard (a state the page watches: waiting with a PulseDot (an amber dot with a growing ring, still under reduced motion) or done with a green check, title, line, actions; a live region), Hint (the "?" whose text is its tooltip and name; `id` for the `aria-describedby` of what it explains), Tabs (a segmented tablist, or `variant="underline"`: names over a line, the chosen one underlined (the MCP page's client); arrows/Home/End through `#lib/roving.ts`, shared with RowMenu; `param` names the tab in the address, written with a shallow `goto`), and for lists FilterBar, FilterPicker (the Projects or Levels filter: a Picker of badges), Picker (a dropdown of checkboxes, hidden with one option and nothing chosen; its All is checked and disabled while nothing else is), SearchField (reports every change, and Enter with `now`; a × inside clears it at once), DateRange (UTC days in one field with its own month calendar, `popup.ts`; × clears it), ActiveFilters (`chips.ts`: a × after each chip removes the whole filter; among several values each project or level badge is a link that removes it, with a × inside, Badge `remove`), Pager, LogBody (color codes removed, Expand, Full screen in a Dialog with JSON fields as lines, `#lib/format.ts`), Time; and BackButton (Back before a page's title: the app page the viewer came from, else `fallback`; the setup page), EditableTitle (a page title with a pencil that turns it into a field of the form around it, sent by the form's Save, Esc drops the edit; PageHeading `heading`; the project form), FormGroup (a part of a `disclosure` Details: small heading with its Hint), Slider (a range input with its label, marks, `least` (the lowest value it takes) and an `output` saying what the value means; the disk share), ProjectsChoice (All projects or some, as badges, in a form card; `allowAll` false disables All with its reason, `locked` the whole field), ProjectsSummary (All projects, the projects as badges, or a dash for none; `limit` keeps a list row on one line: 1 in the audit log, 5 on Users and Notifications, the rest behind a MoreButton), MoreButton ("+N more": an outlined Badge (`tone="outline"`, Badge `onclick` makes it a button) opening the rest in a popup under it), ColorField (a project's color: palette swatches, a custom color, a preview badge). Types a page imports from a component live in a `.ts` beside it (`table.ts`, `badge.ts`, `menu.ts`, `confirm.ts`), so eslint resolves them; form controls share `field.ts` (`fieldClasses`, `controlClasses`, and every form's layout `formClasses`/`narrowFormClasses`), a ProjectsChoice's value is sent as `projectsInput` (`projectsChoice.ts`), popups and cards `surface.ts` (`popupClasses`, `cardClasses`: Card, Details, a ChoiceGroup card, Table; `boxClasses`: a box inside a card, a scroll box, a nested Details, an exception), a page title `heading.ts` (`titleClasses`); a choice among known values is `#lib/selection.ts` (`toggled`). Page-specific pieces sit beside their route (`ProjectForm`, `ConnectionForm`, `EmailStep`, …). Tokens are Tailwind theme variables in `routes/layout.css` (`--color-*` etc. reset to the app's; dark values switch the variables in one `@variant dark` block, the custom variant `[data-theme='dark']` or the system's dark unless `[data-theme='light']`; no `dark:` variants); icons come only through `#lib/icons.ts` and `Icon`; a focus ring is the `focus-ring` utility. ESLint cannot infer the parameters of callbacks passed to components (`onchange={(value: string) => ...}`) or of snippets: type them.
- Field hints: a `?` next to a settings field shows the description from the table row of `docs/ui.md` (by `## section` and field label) or `docs/configuration.md`, generated into `catalog.gen.ts` as `help` (`help.fields.Projects.Color`, `help.settings.MAX_DATABASE_SIZE`); a field the app names that the docs lack fails its type check. Never write the text in a component. Obvious fields (names, passwords) get no hint.
- Tests (`pnpm test`, vitest in jsdom with `@testing-library/svelte`): `*.test.ts` beside the code, the pure modules and the shared interactive components (Picker, Dialog, ConfirmButton/ConfirmDialog, RowMenu, Pager, Tabs, ActiveFilters, Breadcrumbs, Details, Table, IssueActions, FormDialog, RoleChoices, EmailStep, AuditDiff, AuditItems, the login page, the issue and audit pages); `src/test/setup.ts` adds the modal dialogs jsdom lacks, `src/test/` also holds test-only harness components; `$app/*` is mocked with `vi.mock` where a component uses it. `/design-system` (`#lib/design-system`) shows every component with its variants and exists only in the Vite dev server (`import.meta.env.DEV`; `TestEmbeddedBuild` fails if its marker reaches the build); new components also go into the design artifact (https://claude.ai/artifact/GuXpbC3LPKCjMTfdMZxn3t).
@@ -116,8 +116,8 @@ Where to look first:
- `Close` on shutdown writes the in-memory queue and pending summaries to the outbox and sends what is due; messages waiting for a retry are sent after the next start. Only a killed process loses the in-memory part, apart from what `Notify` drops while the queue (`QueueSize`, 1000) is full: counted, one warning with the count a minute and at `Close` (`warnDropped`); a notice dropped so logs its own warning.
- `Factory` builds channels from connections (decrypting secrets with the `Box`), sends test messages (`SendTest`) and is shared with services. Channels implement `Send`/`SendSummary`: `Slack` (incoming webhook, `{"text"}`, also Mattermost/Rocket.Chat, so text outside code goes through `slackText`, which also breaks `@all` mentions and Markdown images; or a bot: `SlackSecret.BotToken` + `Channel` posts through `chat.postMessage` and puts the agent prompt as a code block in a thread under each error (cut to a Slack message by `agentprompt.BuildWithin`, which shortens only the error data, so the end marker and the reminder stay), since a webhook does not return the message timestamp; a failed thread post is dropped so the message is not sent twice), `Telegram` (bot API, HTML parse mode; errors must not include the URL, it holds the token; an error is one message: the agent prompt as a `.md` file via `sendDocument` with the alert as its HTML caption (max 1024 characters, so details are capped), since a message holds 4096 characters and a `copy_text` button 256; a refused file falls back to a plain message, a rate limit is retried as usual; test messages and summaries stay `sendMessage`) and `Email` (plain SMTP via net/smtp, no provider SDK: STARTTLS, or TLS on port 465; multipart text + HTML from `templates/email.html`, styles inline for mail clients; `SendVerificationCode` for new addresses). A message carries the event's id (`Notification.EventID`), not the event: each attempt reads the stored one (`notifier.storedEvent`; deleted meanwhile, it goes out without details), so the outbox, which the size limit does not count, never holds copies of events. Email shows at most 10 exceptions, 15 frames with 5 source lines around the throwing one and 30 tags, every text cut (`fieldLength`; values and messages 2000 characters); every prompt (`Build`: `get_issue`, the issue page, Telegram and email) is cut to `agentprompt.MaxLength` (100000 characters) in its error data, the Slack thread to a Slack message (`maxSlackText`). Short formats share `format.go`; stack reading uses `sentry` methods (`OutermostFirst`, `NewestFirst`, `IsInApp`, `SourceLines`) like the issue page does. `Factory.TelegramURL` points to a fake Telegram API in tests, so no test reaches api.telegram.org. Tests use fake HTTP and SMTP servers (`fixtures.FakeSMTP`) and a real database; assertions do not depend on timing (`waitFor`).
- `internal/agentprompt`: `Build` (instructions + `Describe`) writes a prompt that asks a coding agent to reproduce and explain an error with evidence, without changing code or calling tools that change the monitor (the developer checks it and asks for the fix); the error data comes from anyone who can send errors and a copied prompt reaches the agent as the developer's own message, so it sits between `=== BEGIN/END ERROR DATA
- {#if storage.counting}
- Counting what each project holds…
- {/if}
At {storage.cleanup_start_percent}% of the limit the least useful data is deleted until the
database holds {storage.cleanup_stop_percent}%: old logs first, errors last.
MAX_DATABASE_SIZE
@@ -240,29 +238,32 @@
{#if droppedAllLine}
-
+
{@render droppedLink(`${droppedAllLine} in all projects`, 'all projects', droppedAll)}
-