@app-vitals/agent-admin 1.135.0 → 1.136.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.135.0",
3
+ "version": "1.136.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@anthropic-ai/sdk": "0.137.0",
48
- "@app-vitals/agent-lib": "1.135.0",
48
+ "@app-vitals/agent-lib": "1.136.0",
49
49
  "@hono/zod-openapi": "^1.0.0",
50
50
  "@prisma/adapter-pg": "^7.10.0",
51
51
  "@prisma/client": "^7.10.0",
@@ -8,6 +8,7 @@ import type { AccountInvite } from "./account-invites.ts";
8
8
  import type { AccountMember } from "./account-members.ts";
9
9
  import type { AccountWithCounts } from "./accounts.ts";
10
10
  import { REMOVE_MEMBER_CONFIRM } from "./admin-ui-account-pages.ts";
11
+ import { renderHelpTip } from "./admin-ui-help-catalogue.ts";
11
12
  import { renderAdminPage } from "./admin-ui-layout.ts";
12
13
  import {
13
14
  buildSettingsNav,
@@ -77,7 +78,7 @@ export function renderAccountsListPage(opts: AccountsListPageOpts): string {
77
78
  isAdmin: true,
78
79
  body: `<div class="card">
79
80
  <table class="data-table">
80
- <thead><tr><th>Name</th><th>Owner</th><th>Members</th><th>Agents</th><th>Status</th><th>Trial expires</th><th>Created</th><th></th></tr></thead>
81
+ <thead><tr><th>Name</th><th>Owner</th><th>Members</th><th>Agents</th><th>Status${renderHelpTip("account-status", "Status")}</th><th>Trial expires${renderHelpTip("account-trial-expires", "Trial expires")}</th><th>Created</th><th></th></tr></thead>
81
82
  <tbody>${rows}</tbody>
82
83
  </table>
83
84
  </div>`,
@@ -7,6 +7,7 @@
7
7
  * never renders a key (the status API only reports `keySet`).
8
8
  */
9
9
 
10
+ import { renderHelpTip } from "./admin-ui-help-catalogue.ts";
10
11
  import { renderAdminPage } from "./admin-ui-layout.ts";
11
12
  import {
12
13
  buildSettingsNav,
@@ -217,6 +218,7 @@ function scopeNote(
217
218
  role: "installer" | "lookup",
218
219
  opts: GithubEnterpriseSettingsPageOpts,
219
220
  own: GheApp | null,
221
+ fallbackTip = "",
220
222
  ): string {
221
223
  if (!opts.accountId) {
222
224
  return opts.accounts && opts.accounts.length > 1
@@ -227,7 +229,7 @@ function scopeNote(
227
229
  return `<p class="help-text gh-ent-scope" style="font-size:12px;margin:8px 0"><span class="badge badge-green">Account's own App</span> This account uses its own ${role} App.</p>`;
228
230
  const fallback = opts.defaultStatus?.[role];
229
231
  return fallback
230
- ? `<p class="help-text gh-ent-scope" style="font-size:12px;margin:8px 0"><span class="badge badge-gray">Deployment-wide fallback</span> This account has no ${role} App of its own and uses the deployment-wide one (slug <strong>${escapeHtml(fallback.slug)}</strong>). Saving credentials below creates an account-specific App.</p>`
232
+ ? `<p class="help-text gh-ent-scope" style="font-size:12px;margin:8px 0"><span class="badge badge-gray">Deployment-wide fallback</span>${fallbackTip} This account has no ${role} App of its own and uses the deployment-wide one (slug <strong>${escapeHtml(fallback.slug)}</strong>). Saving credentials below creates an account-specific App.</p>`
231
233
  : `<p class="help-text gh-ent-scope" style="font-size:12px;margin:8px 0"><span class="badge badge-gray">None</span> No ${role} App for this account or deployment-wide.</p>`;
232
234
  }
233
235
 
@@ -236,6 +238,7 @@ function appCard(
236
238
  app: GheApp | null,
237
239
  opts: GithubEnterpriseSettingsPageOpts,
238
240
  lookupOnly: string[] | null,
241
+ fallbackTip = "",
239
242
  ): string {
240
243
  const warnings = opts.warnings;
241
244
  const copy = ROLE_COPY[role];
@@ -256,7 +259,7 @@ function appCard(
256
259
  <div class="card-title">${copy.title}</div>
257
260
  <p class="help-text" style="font-size:12px">${copy.descriptor}</p>
258
261
  ${accountSelector(opts)}
259
- ${scopeNote(role, opts, app)}
262
+ ${scopeNote(role, opts, app, fallbackTip)}
260
263
  ${guidance(role, lookupOnly)}
261
264
  ${summary}
262
265
  <form method="POST" action="${action}" enctype="multipart/form-data" style="display:grid;gap:8px;max-width:480px">
@@ -323,6 +326,15 @@ export function renderGithubEnterpriseSettingsPage(
323
326
  const lookupOnly = effectiveInstaller
324
327
  ? null
325
328
  : lookupOnlySteps(effectiveLookup?.slug);
329
+ // The fallback badge can appear on both cards; the tooltip renders once, on the first.
330
+ const showsFallback = (role: "installer" | "lookup") =>
331
+ Boolean(opts.accountId && !status[role] && opts.defaultStatus?.[role]);
332
+ const fallbackTip = renderHelpTip(
333
+ "deployment-wide-fallback",
334
+ "deployment-wide fallback",
335
+ );
336
+ const installerTip = showsFallback("installer") ? fallbackTip : "";
337
+ const lookupTip = !installerTip && showsFallback("lookup") ? fallbackTip : "";
326
338
  const error = opts.error
327
339
  ? `<div class="alert alert-error">${escapeHtml(opts.error)}</div>`
328
340
  : "";
@@ -345,8 +357,8 @@ export function renderGithubEnterpriseSettingsPage(
345
357
  active: BASE,
346
358
  isAdmin: opts.isAdmin ?? false,
347
359
  body: `${error}${notice}${intro}
348
- ${appCard("installer", status.installer, opts, lookupOnly)}
349
- ${appCard("lookup", status.lookup, opts, lookupOnly)}
360
+ ${appCard("installer", status.installer, opts, lookupOnly, installerTip)}
361
+ ${appCard("lookup", status.lookup, opts, lookupOnly, lookupTip)}
350
362
  ${orgsCard(opts)}`,
351
363
  }),
352
364
  });
@@ -51,6 +51,35 @@ export const HELP_CATALOGUE = {
51
51
  "The numeric ID of one installation of the App on an organization or account. It appears in the installation settings URL.",
52
52
  anchor: "github-installation-id",
53
53
  },
54
+ "account-status": {
55
+ summary:
56
+ "Whether the account is active, suspended, or its trial has expired. Suspended and trial-expired accounts have their agents' crons disabled.",
57
+ anchor: "account-status",
58
+ },
59
+ "account-trial-expires": {
60
+ summary:
61
+ "The date when an account's trial ends. After this date the status becomes trial_expired and the account's agent crons are disabled until the trial is extended or cleared and the account is reactivated.",
62
+ anchor: "account-trial-expires",
63
+ },
64
+ "deployment-wide-fallback": {
65
+ summary:
66
+ "This value is not set for the account, so the deployment's default is used instead. Set a value on the account to override the default.",
67
+ anchor: "deployment-wide-fallback",
68
+ },
69
+ "badge-from-helm-values": {
70
+ summary:
71
+ "The value comes from the deployment's Helm chart values, not from the console. Edits made here are overwritten on the next admin restart.",
72
+ anchor: "badge-from-helm-values",
73
+ },
74
+ "badge-user-can-push": {
75
+ summary: "The GitHub user bound to this agent can push to this repository.",
76
+ anchor: "badge-user-can-push",
77
+ },
78
+ "badge-user-cannot-push": {
79
+ summary:
80
+ "The GitHub user bound to this agent cannot push to this repository.",
81
+ anchor: "badge-user-cannot-push",
82
+ },
54
83
  "cron-system-vs-custom": {
55
84
  summary:
56
85
  "System crons are created and kept in sync by the platform; they cannot be edited or deleted here. Custom crons are yours to add, edit and remove.",
@@ -13,6 +13,12 @@ describe("help catalogue", () => {
13
13
  test("has the expected ids", () => {
14
14
  expect(ids.sort()).toEqual(
15
15
  [
16
+ "account-status",
17
+ "account-trial-expires",
18
+ "badge-from-helm-values",
19
+ "badge-user-can-push",
20
+ "badge-user-cannot-push",
21
+ "deployment-wide-fallback",
16
22
  "github-app-id",
17
23
  "cron-system-vs-custom",
18
24
  "cron-schedule",
@@ -54,6 +60,32 @@ describe("help catalogue", () => {
54
60
  }
55
61
  });
56
62
 
63
+ test("account copy matches the Account.status values and sweeper behaviour", () => {
64
+ const status = getHelpEntry("account-status")?.summary ?? "";
65
+ expect(status).toContain("active");
66
+ expect(status).toContain("suspended");
67
+ expect(status).toContain("trial has expired");
68
+ expect(status).toContain("crons disabled");
69
+ expect(status).not.toContain("in a trial");
70
+ const expires = getHelpEntry("account-trial-expires")?.summary ?? "";
71
+ expect(expires).toContain("trial_expired");
72
+ expect(expires).toContain("extended or cleared");
73
+ expect(expires).not.toContain("suspended");
74
+ expect(expires).not.toContain("upgraded");
75
+ });
76
+
77
+ test("push badge copy describes the agent's bound GitHub user, not the viewer", () => {
78
+ for (const id of ["badge-user-can-push", "badge-user-cannot-push"]) {
79
+ const summary = getHelpEntry(id)?.summary ?? "";
80
+ expect(summary).toContain("GitHub user bound to this agent");
81
+ expect(summary).not.toContain("Your");
82
+ }
83
+ expect(getHelpEntry("badge-user-can-push")?.summary).toContain("can push");
84
+ expect(getHelpEntry("badge-user-cannot-push")?.summary).toContain(
85
+ "cannot push",
86
+ );
87
+ });
88
+
57
89
  test("unknown and prototype ids return undefined", () => {
58
90
  for (const id of ["nope", "__proto__", "constructor", "toString", ""]) {
59
91
  expect(getHelpEntry(id)).toBeUndefined();
@@ -379,7 +379,7 @@ export function renderInstallationReposBody(
379
379
  return `<tr><td class="mono">${escapeHtml(r.fullName)}</td><td>${hint}${meta}</td></tr>`;
380
380
  })
381
381
  .join("");
382
- return `<div class="github-installation-org" data-org="${escapeHtml(o.org)}" style="margin-bottom:16px"><div style="font-weight:600;margin-bottom:6px">${escapeHtml(o.org)}</div>${renderInstallationSyncStatus(o, opts.timezone)}<table class="detail-table"><thead><tr><th>Repo</th><th>Bound user${orgIndex === 0 ? renderHelpTip("repo-user-push", "bound user push access") : ""}</th></tr></thead><tbody>${rows}</tbody></table></div>`;
382
+ return `<div class="github-installation-org" data-org="${escapeHtml(o.org)}" style="margin-bottom:16px"><div style="font-weight:600;margin-bottom:6px">${escapeHtml(o.org)}</div>${renderInstallationSyncStatus(o, opts.timezone)}<table class="detail-table"><thead><tr><th>Repo</th><th>Bound user${orgIndex === 0 ? renderHelpTip("badge-user-can-push", "user can push") + renderHelpTip("badge-user-cannot-push", "user cannot push") : ""}</th></tr></thead><tbody>${rows}</tbody></table></div>`;
383
383
  })
384
384
  .join("")
385
385
  );
@@ -123,7 +123,8 @@ describe("renderInstallationReposBody", () => {
123
123
  it("lists app repos without any per-repo action", () => {
124
124
  const html = renderInstallationReposBody(view);
125
125
  expect(html).toContain("acme/&lt;x&gt;");
126
- expect(html).not.toContain('<button type="submit"');
126
+ expect(html).not.toContain('type="submit"');
127
+ expect(html).not.toContain("<form");
127
128
  expect(html).not.toContain("data-action=");
128
129
  });
129
130
 
@@ -241,7 +241,7 @@ describe("admin UI — GitHub sync card (IRM-3.2)", () => {
241
241
  // acme/docs has no hint: exactly two hint badges
242
242
  expect(html.match(/>user can(not)? push</g)?.length).toBe(2);
243
243
  expect(html).not.toContain("data-action=");
244
- expect(html).not.toContain('<button type="submit"');
244
+ expect(html).not.toContain('type="submit"');
245
245
  });
246
246
 
247
247
  it("lists repos for an unbound username without hints", async () => {
@@ -0,0 +1,132 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { renderAccountsListPage } from "./admin-ui-accounts-pages.ts";
3
+ import {
4
+ type GheApp,
5
+ renderGithubEnterpriseSettingsPage,
6
+ } from "./admin-ui-github-enterprise-pages.ts";
7
+ import { HELP_CATALOGUE } from "./admin-ui-help-catalogue.ts";
8
+ import { renderInstallationReposBody } from "./admin-ui-installation-repos-pages.ts";
9
+ import {
10
+ managedByBadge,
11
+ renderTemplatesPage,
12
+ type TemplatesPageOpts,
13
+ } from "./admin-ui-templates-pages.ts";
14
+
15
+ const count = (html: string, needle: string) => html.split(needle).length - 1;
16
+ const tipCount = (html: string, id: string) => count(html, `id="help-${id}"`);
17
+
18
+ const d = new Date("2026-01-01T00:00:00Z");
19
+ const account = (id: string) => ({
20
+ id,
21
+ name: `Acme ${id}`,
22
+ status: "active",
23
+ maxAgents: 3,
24
+ plan: "pro",
25
+ trialExpiresAt: d,
26
+ trialExpiryWarnedAt: null,
27
+ createdAt: d,
28
+ updatedAt: d,
29
+ agentCount: 1,
30
+ memberCount: 1,
31
+ });
32
+
33
+ function app(role: "installer" | "lookup"): GheApp {
34
+ return {
35
+ role,
36
+ appId: "1",
37
+ slug: `acme-${role}`,
38
+ enterpriseSlug: null,
39
+ keySet: true,
40
+ lastValidationStatus: "valid",
41
+ lastValidatedAt: null,
42
+ lastValidationError: null,
43
+ createdAt: "2026-11-09T11:00:00.000Z",
44
+ updatedAt: "2026-11-09T11:00:00.000Z",
45
+ };
46
+ }
47
+
48
+ describe("settings page help tooltips", () => {
49
+ test("accounts list renders Status and Trial expires tips once with several rows", () => {
50
+ const html = renderAccountsListPage({
51
+ userEmail: "a@x.com",
52
+ accounts: [account("a1"), account("a2")],
53
+ owners: new Map(),
54
+ });
55
+ expect(tipCount(html, "account-status")).toBe(1);
56
+ expect(tipCount(html, "account-trial-expires")).toBe(1);
57
+ });
58
+
59
+ test("templates page renders the Helm badge tip once and no badge title", () => {
60
+ const base: TemplatesPageOpts = {
61
+ userEmail: "a@x.com",
62
+ accountOptions: [{ value: "", label: "Deployment-wide" }],
63
+ specialtyOptions: [{ value: "", label: "All agent types" }],
64
+ accountId: "",
65
+ specialty: "",
66
+ items: [
67
+ { kind: "env", key: "A", payload: {}, managedBy: "helm" },
68
+ { kind: "env", key: "B", payload: {}, managedBy: "helm" },
69
+ ] as TemplatesPageOpts["items"],
70
+ templateExists: true,
71
+ };
72
+ const html = renderTemplatesPage(base);
73
+ expect(tipCount(html, "badge-from-helm-values")).toBe(1);
74
+ expect(count(html, "from Helm values</span>")).toBe(2);
75
+ expect(html).not.toContain("edits are overwritten on the next admin");
76
+ expect(managedByBadge({ managedBy: "helm" })).not.toContain("title=");
77
+ });
78
+
79
+ test("GitHub enterprise page renders the fallback tip once across both cards", () => {
80
+ const html = renderGithubEnterpriseSettingsPage({
81
+ userEmail: "a@x.com",
82
+ accountId: "a1",
83
+ status: { configured: false, installer: null, lookup: null },
84
+ defaultStatus: {
85
+ configured: true,
86
+ installer: app("installer"),
87
+ lookup: app("lookup"),
88
+ },
89
+ });
90
+ expect(count(html, "Deployment-wide fallback</span>")).toBe(2);
91
+ expect(tipCount(html, "deployment-wide-fallback")).toBe(1);
92
+ });
93
+
94
+ test("GitHub enterprise page omits the fallback tip without a fallback badge", () => {
95
+ const html = renderGithubEnterpriseSettingsPage({
96
+ userEmail: "a@x.com",
97
+ status: { configured: false, installer: null, lookup: null },
98
+ });
99
+ expect(tipCount(html, "deployment-wide-fallback")).toBe(0);
100
+ });
101
+
102
+ test("installation repos render push tips once across orgs and no row titles", () => {
103
+ const html = renderInstallationReposBody({
104
+ orgs: [
105
+ {
106
+ org: "one",
107
+ repos: [
108
+ { fullName: "one/a", userCanPush: true },
109
+ { fullName: "one/b", userCanPush: false },
110
+ ],
111
+ },
112
+ { org: "two", repos: [{ fullName: "two/a", userCanPush: true }] },
113
+ ],
114
+ });
115
+ expect(tipCount(html, "badge-user-can-push")).toBe(1);
116
+ expect(tipCount(html, "badge-user-cannot-push")).toBe(1);
117
+ expect(html).not.toContain('title="The bound user');
118
+ });
119
+
120
+ test("new catalogue entries stay within the summary limit", () => {
121
+ for (const id of [
122
+ "account-status",
123
+ "account-trial-expires",
124
+ "deployment-wide-fallback",
125
+ "badge-from-helm-values",
126
+ "badge-user-can-push",
127
+ "badge-user-cannot-push",
128
+ ] as const) {
129
+ expect(HELP_CATALOGUE[id].summary.length).toBeLessThanOrEqual(280);
130
+ }
131
+ });
132
+ });
@@ -188,7 +188,8 @@ export function renderTemplatesPage(o: TemplatesPageOpts): string {
188
188
  isOwner: true,
189
189
  body: `${error}${notice}${blocked}
190
190
  <div class="card">
191
- <p class="help-text">Default env vars, tools, plugins, crons and plugin marketplaces for new agents in a scope. Secret values are masked after saving; leave <code>***</code> to keep the stored value.${renderHelpTip("template-managed-by", "from Helm values")}</p>
191
+ <p class="help-text">Default env vars, tools, plugins, crons and plugin marketplaces for new agents in a scope. Secret values are masked after saving; leave <code>***</code> to keep the stored value.</p>
192
+ <p class="help-text">Items marked "from Helm values"${renderHelpTip("badge-from-helm-values", "from Helm values")} are set by the deployment.</p>
192
193
  ${scopePicker(o)}
193
194
  ${del}
194
195
  </div>
@@ -325,7 +325,8 @@ describe("/admin/settings/templates smoke", () => {
325
325
  const res = await app.request(BASE);
326
326
  expect(res.status).toBe(200);
327
327
  const html = await res.text();
328
- expect(html.match(/>from Helm values</g)).toHaveLength(1);
328
+ // The header help text and its tooltip also name the badge; count only badge spans.
329
+ expect(html.match(/badge-template">from Helm values</g)).toHaveLength(1);
329
330
  const seeded = html.slice(
330
331
  html.indexOf('data-key="seeded@example-plugins"'),
331
332
  html.indexOf('data-key="manual@example-plugins"'),