@app-vitals/agent-admin 1.91.1 → 1.92.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-admin",
3
- "version": "1.91.1",
3
+ "version": "1.92.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@anthropic-ai/sdk": "0.137.0",
47
- "@app-vitals/agent-lib": "1.91.1",
47
+ "@app-vitals/agent-lib": "1.92.0",
48
48
  "@hono/zod-openapi": "^1.0.0",
49
49
  "@prisma/adapter-pg": "^7.10.0",
50
50
  "@prisma/client": "^7.10.0",
@@ -79,7 +79,7 @@ export function renderGithubUsernameRow(
79
79
  <button type="submit" class="btn btn-danger" id="clear-github-username">Clear</button>
80
80
  </form>`
81
81
  : "";
82
- return `<tr><td style="color:#6b7280;width:200px">GitHub username</td><td>
82
+ return `<tr><td style="color:var(--vos-text-muted);width:200px">GitHub username</td><td>
83
83
  <div style="display:flex;gap:8px;flex-wrap:wrap;align-items:center">
84
84
  <form method="POST" action="${action}" id="github-username-form" style="display:flex;gap:8px;align-items:center">
85
85
  <input name="githubUsername" type="text" class="form-input mono" maxlength="39" placeholder="GitHub login" value="${escapeHtml(username ?? "")}" required />
@@ -95,7 +95,7 @@ export function renderGithubAccessCard(agentId: string): string {
95
95
  const url = `/admin/agents/${escapeHtml(agentId)}/github-access`;
96
96
  return `<div id="github-access-card" style="margin-top:20px">
97
97
  <div class="form-label" style="font-weight:600;margin-bottom:6px">Preview access</div>
98
- <p style="color:#6b7280;font-size:12px;margin:0 0 12px">Shows the repos this agent's GitHub user can reach. Read-only; nothing is stored.</p>
98
+ <p style="color:var(--vos-text-muted);font-size:12px;margin:0 0 12px">Shows the repos this agent's GitHub user can reach. Read-only; nothing is stored.</p>
99
99
  <button type="button" class="btn btn-primary" id="github-access-btn" data-url="${url}">Preview access</button>
100
100
  <div id="github-access-result" style="margin-top:12px"></div>
101
101
  <script>
@@ -159,7 +159,7 @@ export function renderGithubAccessResult(
159
159
  .join("");
160
160
  const unresolved =
161
161
  o.unresolved > 0
162
- ? ` <span style="color:#6b7280;font-size:12px">${o.unresolved} unresolved</span>`
162
+ ? ` <span style="color:var(--vos-text-muted);font-size:12px">${o.unresolved} unresolved</span>`
163
163
  : "";
164
164
  return `<div class="github-access-org" style="margin-bottom:16px">
165
165
  <div style="font-weight:600;margin-bottom:6px">${escapeHtml(o.org)} ${statusBadge(o.status)}${unresolved}</div>
@@ -192,7 +192,7 @@ export function renderGithubInstallCard(
192
192
  const url = `/admin/agents/${escapeHtml(agentId)}/github-orgs`;
193
193
  return `<div id="github-install-card" style="margin-top:20px">
194
194
  <div class="form-label" style="font-weight:600;margin-bottom:6px">Install on org</div>
195
- <p style="color:#6b7280;font-size:12px;margin:0 0 12px">Installs this agent's GitHub App on an organization.</p>
195
+ <p style="color:var(--vos-text-muted);font-size:12px;margin:0 0 12px">Installs this agent's GitHub App on an organization.</p>
196
196
  <div id="github-install-result" data-url="${url}">Loading...</div>
197
197
  <script>
198
198
  (function() {
@@ -139,7 +139,7 @@ export function renderInstallationSyncStatus(
139
139
  if (v.leaseHolder) parts.push(`Refreshing (${escapeHtml(v.leaseHolder)})`);
140
140
  if (v.lastTickAt) parts.push(`Last tick ${fmt(v.lastTickAt, timezone)}`);
141
141
  const cls = v.lastError || v.rateLimitResetAt ? "alert alert-warning" : "";
142
- return `<div class="${cls}" data-installation-sync="${complete ? "complete" : "incomplete"}" style="color:#6b7280;font-size:12px;margin:8px 0">${parts.join(" &middot; ")}</div>`;
142
+ return `<div class="${cls}" data-installation-sync="${complete ? "complete" : "incomplete"}" style="color:var(--vos-text-muted);font-size:12px;margin:8px 0">${parts.join(" &middot; ")}</div>`;
143
143
  }
144
144
 
145
145
  /** JSON body of GET /agents/:id/repos/:owner/:name/removal-preview. */
@@ -270,10 +270,10 @@ export function renderGithubSyncCard(
270
270
  const refresh =
271
271
  appsState === "lookup_missing"
272
272
  ? ""
273
- : `<div style="margin:0 0 12px"><button type="button" class="btn btn-secondary" id="github-refresh-btn" data-url="/admin/agents/${id}/github-cache/refresh">Refresh</button> <span style="color:#6b7280;font-size:12px">Re-reads the cached repo lists in the background. Reload the page to see progress.</span></div>`;
273
+ : `<div style="margin:0 0 12px"><button type="button" class="btn btn-secondary" id="github-refresh-btn" data-url="/admin/agents/${id}/github-cache/refresh">Refresh</button> <span style="color:var(--vos-text-muted);font-size:12px">Re-reads the cached repo lists in the background. Reload the page to see progress.</span></div>`;
274
274
  return `<div id="github-installation-card" data-base-url="${base}" style="margin-top:20px">
275
275
  <div class="form-label" style="font-weight:600;margin-bottom:6px">GitHub sync</div>
276
- <p style="color:#6b7280;font-size:12px;margin:0 0 12px">Brings this agent's App installation and its repos in line with what the bound GitHub user can push to.</p>
276
+ <p style="color:var(--vos-text-muted);font-size:12px;margin:0 0 12px">Brings this agent's App installation and its repos in line with what the bound GitHub user can push to.</p>
277
277
  ${refresh}
278
278
  ${action}
279
279
  ${loader}
@@ -374,7 +374,7 @@ export function renderInstallationReposBody(
374
374
  r.accessError ? `error: ${escapeHtml(r.accessError)}` : "",
375
375
  ].filter(Boolean);
376
376
  const meta = detail.length
377
- ? ` <span style="color:#6b7280;font-size:12px">${detail.join("; ")}</span>`
377
+ ? ` <span style="color:var(--vos-text-muted);font-size:12px">${detail.join("; ")}</span>`
378
378
  : "";
379
379
  return `<tr><td class="mono">${escapeHtml(r.fullName)}</td><td>${hint}${meta}</td></tr>`;
380
380
  })
@@ -14,6 +14,7 @@
14
14
  * metrics/src/dashboard/dashboard-page.ts.
15
15
  */
16
16
 
17
+ import { themeBootScript } from "@app-vitals/agent-lib/web/toolbar.ts";
17
18
  import { baseStyles, escapeHtml } from "./admin-ui-styles.ts";
18
19
 
19
20
  interface RenderAdminPageOptions {
@@ -51,6 +52,8 @@ export function renderAdminPage(opts: RenderAdminPageOptions): string {
51
52
  <meta charset="utf-8" />
52
53
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
53
54
  <title>${escapeHtml(opts.title)}</title>
55
+ <meta name="color-scheme" content="light dark" />
56
+ ${themeBootScript()}
54
57
  <style>${baseStyles()}${opts.extraStyles ?? ""}</style>${opts.headExtra ? `\n ${opts.headExtra}` : ""}
55
58
  </head>
56
59
  ${bodyTag}
@@ -138,3 +138,19 @@ describe("renderAdminPage", () => {
138
138
  expect(html).not.toContain('class="vos-signout-btn"');
139
139
  });
140
140
  });
141
+
142
+ describe("renderAdminPage — theme", () => {
143
+ test("sets data-theme in <head>, before the styles, so nothing paints light first", () => {
144
+ const html = renderAdminPage({ title: "T", body: "<p>x</p>" });
145
+ const boot = html.indexOf('setAttribute("data-theme",t)');
146
+ expect(boot).toBeGreaterThan(-1);
147
+ expect(boot).toBeLessThan(html.indexOf("<style>"));
148
+ expect(boot).toBeLessThan(html.indexOf("</head>"));
149
+ });
150
+
151
+ test("declares both colour schemes and ships the dark palette", () => {
152
+ const html = renderAdminPage({ title: "T", body: "<p>x</p>" });
153
+ expect(html).toContain('<meta name="color-scheme" content="light dark" />');
154
+ expect(html).toContain(':root[data-theme="dark"]');
155
+ });
156
+ });