@app-vitals/agent-admin 1.134.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 +2 -2
- package/src/admin-ui-accounts-pages.ts +2 -1
- package/src/admin-ui-agent-detail-help.unit.test.ts +12 -0
- package/src/admin-ui-github-enterprise-pages.ts +16 -4
- package/src/admin-ui-github-identity-pages.unit.test.ts +1 -3
- package/src/admin-ui-help-catalogue.ts +114 -0
- package/src/admin-ui-help-catalogue.unit.test.ts +56 -1
- package/src/admin-ui-installation-repos-pages.ts +6 -5
- package/src/admin-ui-installation-repos-pages.unit.test.ts +2 -1
- package/src/admin-ui-installation-repos.smoke.test.ts +1 -1
- package/src/admin-ui-new-agent-help.unit.test.ts +10 -2
- package/src/admin-ui-pages.ts +46 -14
- package/src/admin-ui-pages.unit.test.ts +88 -14
- package/src/admin-ui-settings-help.unit.test.ts +132 -0
- package/src/admin-ui-templates-pages.ts +3 -1
- package/src/admin-ui-templates.smoke.test.ts +2 -1
- package/src/admin-ui.smoke.test.ts +4 -6
- package/src/admin-ui.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@app-vitals/agent-admin",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
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>`,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { renderUncoveredBadge } from "./admin-ui-installation-repos-pages.ts";
|
|
3
|
+
import { managedByBadge } from "./admin-ui-templates-pages.ts";
|
|
4
|
+
|
|
5
|
+
describe("removed badge titles", () => {
|
|
6
|
+
test("uncovered badge has no title", () => {
|
|
7
|
+
expect(renderUncoveredBadge()).not.toContain("title=");
|
|
8
|
+
});
|
|
9
|
+
test("helm badge has no title", () => {
|
|
10
|
+
expect(managedByBadge({ managedBy: "helm" })).not.toContain("title=");
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -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
|
|
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
|
});
|
|
@@ -81,9 +81,7 @@ function page(
|
|
|
81
81
|
describe("agent detail — identity card (GHE-2.5)", () => {
|
|
82
82
|
test("card is retitled Owner & identities", () => {
|
|
83
83
|
const html = page(true, false);
|
|
84
|
-
expect(html).toContain(
|
|
85
|
-
'<div class="card-title">Owner & identities</div>',
|
|
86
|
-
);
|
|
84
|
+
expect(html).toContain('<div class="card-title">Owner & identities');
|
|
87
85
|
expect(html).not.toContain("Owner & Anthropic identity");
|
|
88
86
|
});
|
|
89
87
|
|
|
@@ -51,6 +51,120 @@ 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
|
+
},
|
|
83
|
+
"cron-system-vs-custom": {
|
|
84
|
+
summary:
|
|
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.",
|
|
86
|
+
anchor: "cron-system-vs-custom",
|
|
87
|
+
},
|
|
88
|
+
"cron-schedule": {
|
|
89
|
+
summary:
|
|
90
|
+
"When the cron fires, as a five-field cron expression: minute, hour, day of month, month, day of week. Example: 0 * * * * runs every hour.",
|
|
91
|
+
anchor: "cron-schedule",
|
|
92
|
+
},
|
|
93
|
+
"cron-precheck": {
|
|
94
|
+
summary:
|
|
95
|
+
"An optional script that runs before the prompt. Its output becomes the prompt; if it has nothing to report, the run is skipped.",
|
|
96
|
+
anchor: "cron-precheck",
|
|
97
|
+
},
|
|
98
|
+
"cron-target": {
|
|
99
|
+
summary:
|
|
100
|
+
"The Slack channel the cron posts its result to. Empty means the cron does not post to a channel.",
|
|
101
|
+
anchor: "cron-target",
|
|
102
|
+
},
|
|
103
|
+
"template-following-detached": {
|
|
104
|
+
summary:
|
|
105
|
+
"Following: template changes reach this agent. Detached: they no longer do, and your own rows are kept. Reattaching reconciles the agent against the template.",
|
|
106
|
+
anchor: "template-following-detached",
|
|
107
|
+
},
|
|
108
|
+
"template-row-source": {
|
|
109
|
+
summary:
|
|
110
|
+
"template: inherited from the agent template. custom: set on this agent and overrides the template. disabled: removed from this agent and not re-added by the template. from image: baked into the agent image; only an image update changes it.",
|
|
111
|
+
anchor: "template-row-source",
|
|
112
|
+
},
|
|
113
|
+
"agent-policy": {
|
|
114
|
+
summary:
|
|
115
|
+
"Per-agent rules for how reviews are posted, whether the agent may review its own pull requests, and how long finished work is kept.",
|
|
116
|
+
anchor: "agent-policy",
|
|
117
|
+
},
|
|
118
|
+
"task-store-tokens": {
|
|
119
|
+
summary:
|
|
120
|
+
"Bearer tokens the agent uses to call the task store. The kind sets what the token may do. A token is shown once when created.",
|
|
121
|
+
anchor: "task-store-tokens",
|
|
122
|
+
},
|
|
123
|
+
"owner-identities": {
|
|
124
|
+
summary:
|
|
125
|
+
"Read-only trace from this agent to its owner and to the identities it uses with Anthropic and GitHub. Blank means not set up.",
|
|
126
|
+
anchor: "owner-identities",
|
|
127
|
+
},
|
|
128
|
+
"tools-pattern": {
|
|
129
|
+
summary:
|
|
130
|
+
"A permission rule for a tool the agent may run without asking, such as Bash(git:*). The part in brackets narrows what is allowed.",
|
|
131
|
+
anchor: "tools-pattern",
|
|
132
|
+
},
|
|
133
|
+
plugins: {
|
|
134
|
+
summary:
|
|
135
|
+
"Plugins add commands, skills and agents. Write plugin@marketplace; a bare name is read from the shipwright marketplace.",
|
|
136
|
+
anchor: "plugins",
|
|
137
|
+
},
|
|
138
|
+
"marketplace-ref": {
|
|
139
|
+
summary:
|
|
140
|
+
"The branch, tag or commit of the marketplace to install from. Blank uses the repository's default branch.",
|
|
141
|
+
anchor: "marketplace-ref",
|
|
142
|
+
},
|
|
143
|
+
"marketplace-origin": {
|
|
144
|
+
summary:
|
|
145
|
+
"remote: added to this agent and editable here. from image: baked into the agent image; only an image update changes it. disabled: removed from this agent and not re-added by the template.",
|
|
146
|
+
anchor: "marketplace-origin",
|
|
147
|
+
},
|
|
148
|
+
"sync-manifest": {
|
|
149
|
+
summary:
|
|
150
|
+
"A manifest describing which GitHub installations and repositories to sync for this agent. Paste a token to run the sync.",
|
|
151
|
+
anchor: "sync-manifest",
|
|
152
|
+
},
|
|
153
|
+
"repo-user-push": {
|
|
154
|
+
summary:
|
|
155
|
+
"user can push / user cannot push: whether the GitHub user bound to this agent can push to the repo.",
|
|
156
|
+
anchor: "repo-user-push",
|
|
157
|
+
},
|
|
158
|
+
"repo-uncovered": {
|
|
159
|
+
summary:
|
|
160
|
+
"not on installation: the agent's GitHub App installation does not cover this repo. Nothing is changed automatically.",
|
|
161
|
+
anchor: "repo-uncovered",
|
|
162
|
+
},
|
|
163
|
+
"template-managed-by": {
|
|
164
|
+
summary:
|
|
165
|
+
"from Helm values: an item with this badge is set by admin.templateSeed in the Helm values, and edits to it are overwritten on the next admin restart. Items without the badge are not affected.",
|
|
166
|
+
anchor: "template-managed-by",
|
|
167
|
+
},
|
|
54
168
|
} as const satisfies Record<string, HelpEntry>;
|
|
55
169
|
|
|
56
170
|
export type HelpId = keyof typeof HELP_CATALOGUE;
|
|
@@ -10,10 +10,33 @@ import { ADMIN_DOCS_BASE_URL } from "./admin-ui-info-tip.ts";
|
|
|
10
10
|
const ids = Object.keys(HELP_CATALOGUE);
|
|
11
11
|
|
|
12
12
|
describe("help catalogue", () => {
|
|
13
|
-
test("has the
|
|
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",
|
|
23
|
+
"cron-system-vs-custom",
|
|
24
|
+
"cron-schedule",
|
|
25
|
+
"cron-precheck",
|
|
26
|
+
"cron-target",
|
|
27
|
+
"template-following-detached",
|
|
28
|
+
"template-row-source",
|
|
29
|
+
"agent-policy",
|
|
30
|
+
"task-store-tokens",
|
|
31
|
+
"owner-identities",
|
|
32
|
+
"tools-pattern",
|
|
33
|
+
"plugins",
|
|
34
|
+
"marketplace-ref",
|
|
35
|
+
"marketplace-origin",
|
|
36
|
+
"sync-manifest",
|
|
37
|
+
"repo-user-push",
|
|
38
|
+
"repo-uncovered",
|
|
39
|
+
"template-managed-by",
|
|
17
40
|
"github-installation-id",
|
|
18
41
|
"github-pat-vs-app",
|
|
19
42
|
"patch-author-allowlist",
|
|
@@ -37,6 +60,32 @@ describe("help catalogue", () => {
|
|
|
37
60
|
}
|
|
38
61
|
});
|
|
39
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
|
+
|
|
40
89
|
test("unknown and prototype ids return undefined", () => {
|
|
41
90
|
for (const id of ["nope", "__proto__", "constructor", "toString", ""]) {
|
|
42
91
|
expect(getHelpEntry(id)).toBeUndefined();
|
|
@@ -53,4 +102,10 @@ describe("help catalogue", () => {
|
|
|
53
102
|
`href="${ADMIN_DOCS_BASE_URL}admin-console-glossary#runtime"`,
|
|
54
103
|
);
|
|
55
104
|
});
|
|
105
|
+
|
|
106
|
+
test("template-managed-by warns only about badged items", () => {
|
|
107
|
+
const summary = HELP_CATALOGUE["template-managed-by"].summary;
|
|
108
|
+
expect(summary).toContain("an item with this badge");
|
|
109
|
+
expect(summary).toContain("Items without the badge are not affected.");
|
|
110
|
+
});
|
|
56
111
|
});
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import type { components } from "@app-vitals/agent-lib/admin-types";
|
|
15
|
+
import { renderHelpTip } from "./admin-ui-help-catalogue.ts";
|
|
15
16
|
import { escapeHtml } from "./admin-ui-styles.ts";
|
|
16
17
|
import {
|
|
17
18
|
type GithubAppsState,
|
|
@@ -351,7 +352,7 @@ export function renderInstallationReposBody(
|
|
|
351
352
|
return (
|
|
352
353
|
sync +
|
|
353
354
|
view.orgs
|
|
354
|
-
.map((o) => {
|
|
355
|
+
.map((o, orgIndex) => {
|
|
355
356
|
const rows =
|
|
356
357
|
o.repos.length === 0
|
|
357
358
|
? `<tr><td colspan="2" class="empty-state">No repos.</td></tr>`
|
|
@@ -361,8 +362,8 @@ export function renderInstallationReposBody(
|
|
|
361
362
|
r.userCanPush === undefined
|
|
362
363
|
? ""
|
|
363
364
|
: r.userCanPush
|
|
364
|
-
? '<span class="badge badge-green"
|
|
365
|
-
: '<span class="badge badge-warning"
|
|
365
|
+
? '<span class="badge badge-green">user can push</span>'
|
|
366
|
+
: '<span class="badge badge-warning">user cannot push</span>';
|
|
366
367
|
const detail = [
|
|
367
368
|
r.accessCheckedAt
|
|
368
369
|
? `checked ${escapeHtml(r.accessCheckedAt)}`
|
|
@@ -378,7 +379,7 @@ export function renderInstallationReposBody(
|
|
|
378
379
|
return `<tr><td class="mono">${escapeHtml(r.fullName)}</td><td>${hint}${meta}</td></tr>`;
|
|
379
380
|
})
|
|
380
381
|
.join("");
|
|
381
|
-
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</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>`;
|
|
382
383
|
})
|
|
383
384
|
.join("")
|
|
384
385
|
);
|
|
@@ -454,7 +455,7 @@ export function uncoveredRepos(
|
|
|
454
455
|
|
|
455
456
|
/** The badge shown on an uncovered repo row of the agent's repos list. */
|
|
456
457
|
export function renderUncoveredBadge(): string {
|
|
457
|
-
return ` <span class="badge badge-warning" data-uncovered="1"
|
|
458
|
+
return ` <span class="badge badge-warning" data-uncovered="1">not on installation</span>`;
|
|
458
459
|
}
|
|
459
460
|
|
|
460
461
|
const repoList = (kind: string, title: string, repos: readonly string[]) =>
|
|
@@ -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/<x>");
|
|
126
|
-
expect(html).not.toContain("
|
|
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("
|
|
244
|
+
expect(html).not.toContain('type="submit"');
|
|
245
245
|
});
|
|
246
246
|
|
|
247
247
|
it("lists repos for an unbound username without hints", async () => {
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { HELP_CATALOGUE } from "./admin-ui-help-catalogue.ts";
|
|
3
2
|
import { renderNewLocalAgentPage } from "./admin-ui-pages.ts";
|
|
4
3
|
|
|
4
|
+
const NEW_AGENT_HELP_IDS = [
|
|
5
|
+
"specialty",
|
|
6
|
+
"runtime",
|
|
7
|
+
"review-author-allowlist",
|
|
8
|
+
"patch-author-allowlist",
|
|
9
|
+
"github-pat-vs-app",
|
|
10
|
+
"github-app-id",
|
|
11
|
+
"github-installation-id",
|
|
12
|
+
];
|
|
5
13
|
const TYPES = [{ name: "coding", displayName: "Coding Agent" }];
|
|
6
14
|
const count = (html: string, needle: string) => html.split(needle).length - 1;
|
|
7
15
|
|
|
8
16
|
describe("renderNewLocalAgentPage help tooltips", () => {
|
|
9
17
|
const html = renderNewLocalAgentPage("Dan", TYPES);
|
|
10
18
|
|
|
11
|
-
for (const id of
|
|
19
|
+
for (const id of NEW_AGENT_HELP_IDS) {
|
|
12
20
|
test(`renders help-${id} exactly once`, () => {
|
|
13
21
|
expect(count(html, `id="help-${id}"`)).toBe(1);
|
|
14
22
|
});
|
package/src/admin-ui-pages.ts
CHANGED
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
renderGithubInstallCard,
|
|
17
17
|
renderGithubUsernameRow,
|
|
18
18
|
} from "./admin-ui-github-identity-pages.ts";
|
|
19
|
+
import { renderHelpTip } from "./admin-ui-help-catalogue.ts";
|
|
20
|
+
import { renderInfoTip } from "./admin-ui-info-tip.ts";
|
|
19
21
|
import {
|
|
20
22
|
type InstallationSyncView,
|
|
21
23
|
installationSnapshotComplete,
|
|
@@ -24,8 +26,6 @@ import {
|
|
|
24
26
|
renderUncoveredBadge,
|
|
25
27
|
uncoveredRepos,
|
|
26
28
|
} from "./admin-ui-installation-repos-pages.ts";
|
|
27
|
-
import { renderInfoTip } from "./admin-ui-info-tip.ts";
|
|
28
|
-
import { renderHelpTip } from "./admin-ui-help-catalogue.ts";
|
|
29
29
|
import { renderAdminPage } from "./admin-ui-layout.ts";
|
|
30
30
|
import { renderSettingsLayout } from "./admin-ui-settings-layout.ts";
|
|
31
31
|
import {
|
|
@@ -1266,6 +1266,20 @@ export function settingsRedirectSection(formData: FormData): AgentSection {
|
|
|
1266
1266
|
return formData.has("restrictSlackToMembers") ? "access" : "configuration";
|
|
1267
1267
|
}
|
|
1268
1268
|
|
|
1269
|
+
/**
|
|
1270
|
+
* Column help shown above a table. Tips are kept out of `<th>` because
|
|
1271
|
+
* `.data-table-wrapper` scrolls (overflow-x:auto), which would clip the
|
|
1272
|
+
* absolutely positioned popover.
|
|
1273
|
+
*/
|
|
1274
|
+
function renderColumnHelp(
|
|
1275
|
+
cols: ReadonlyArray<{ label: string; id: string; tipLabel: string }>,
|
|
1276
|
+
): string {
|
|
1277
|
+
const items = cols
|
|
1278
|
+
.map((c) => `${escapeHtml(c.label)}${renderHelpTip(c.id, c.tipLabel)}`)
|
|
1279
|
+
.join(" · ");
|
|
1280
|
+
return `<div class="table-col-help" style="font-size:12px;color:var(--vos-text-muted);margin:0 0 6px">Columns: ${items}</div>`;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1269
1283
|
/** Remove every state-changing control (POST forms, repo-removal buttons). */
|
|
1270
1284
|
function stripManagementControls(html: string): string {
|
|
1271
1285
|
return html
|
|
@@ -1415,8 +1429,8 @@ export function renderAgentDetailPage(
|
|
|
1415
1429
|
!tpl || (source !== "template" && source !== "custom")
|
|
1416
1430
|
? ""
|
|
1417
1431
|
: source === "template"
|
|
1418
|
-
? ` <span class="badge badge-template" data-source="template"
|
|
1419
|
-
: ` <span class="badge badge-custom" data-source="custom"
|
|
1432
|
+
? ` <span class="badge badge-template" data-source="template">template</span>`
|
|
1433
|
+
: ` <span class="badge badge-custom" data-source="custom">custom</span>`;
|
|
1420
1434
|
const resetForm = (
|
|
1421
1435
|
source: string | undefined,
|
|
1422
1436
|
kind: string,
|
|
@@ -1435,7 +1449,7 @@ export function renderAgentDetailPage(
|
|
|
1435
1449
|
: {};
|
|
1436
1450
|
const templateCard = tpl
|
|
1437
1451
|
? `<div class="card" id="template">
|
|
1438
|
-
<div class="card-title">Agent template</div>
|
|
1452
|
+
<div class="card-title">Agent template${renderHelpTip("template-following-detached", "template following and detached")}${renderHelpTip("template-row-source", "template row sources")}</div>
|
|
1439
1453
|
${
|
|
1440
1454
|
tpl.detached
|
|
1441
1455
|
? `<p style="font-size:13px;margin-bottom:12px"><span class="badge badge-gray">Detached from template</span>
|
|
@@ -1797,7 +1811,7 @@ export function renderAgentDetailPage(
|
|
|
1797
1811
|
<td class="mono">${m.ref ? escapeHtml(m.ref) : "default"}</td>
|
|
1798
1812
|
<td>${
|
|
1799
1813
|
tombstone
|
|
1800
|
-
? `<span class="badge badge-gray"
|
|
1814
|
+
? `<span class="badge badge-gray">disabled</span>`
|
|
1801
1815
|
: `<span class="badge badge-green">remote</span>`
|
|
1802
1816
|
}</td>
|
|
1803
1817
|
<td>${
|
|
@@ -1818,7 +1832,7 @@ export function renderAgentDetailPage(
|
|
|
1818
1832
|
<td class="mono">${escapeHtml(name)}</td>
|
|
1819
1833
|
<td class="mono" style="color:var(--vos-text-muted)">—</td>
|
|
1820
1834
|
<td class="mono" style="color:var(--vos-text-muted)">—</td>
|
|
1821
|
-
<td><span class="badge badge-gray"
|
|
1835
|
+
<td><span class="badge badge-gray">from image</span></td>
|
|
1822
1836
|
<td></td>
|
|
1823
1837
|
</tr>`,
|
|
1824
1838
|
)
|
|
@@ -1977,7 +1991,7 @@ export function renderAgentDetailPage(
|
|
|
1977
1991
|
: [],
|
|
1978
1992
|
);
|
|
1979
1993
|
const reposSection = `<div class="card">
|
|
1980
|
-
<div class="card-title">Repos</div>
|
|
1994
|
+
<div class="card-title">Repos${renderHelpTip("repo-uncovered", "repos not on the installation")}</div>
|
|
1981
1995
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/repos/add" style="margin-bottom:16px">
|
|
1982
1996
|
<div class="form-row">
|
|
1983
1997
|
<div class="form-group" style="flex:1">
|
|
@@ -2143,7 +2157,7 @@ export function renderAgentDetailPage(
|
|
|
2143
2157
|
: "";
|
|
2144
2158
|
|
|
2145
2159
|
const cronJobsSection = `<div class="card">
|
|
2146
|
-
<div class="card-title">Cron Jobs</div>
|
|
2160
|
+
<div class="card-title">Cron Jobs${renderHelpTip("cron-system-vs-custom", "system and custom crons")}</div>
|
|
2147
2161
|
|
|
2148
2162
|
${
|
|
2149
2163
|
agent.selfHosted
|
|
@@ -2153,6 +2167,15 @@ export function renderAgentDetailPage(
|
|
|
2153
2167
|
|
|
2154
2168
|
<div style="margin-bottom:20px">
|
|
2155
2169
|
<div style="font-size:12px;font-weight:600;color:var(--vos-text-muted);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:8px">System</div>
|
|
2170
|
+
${renderColumnHelp([
|
|
2171
|
+
{ label: "Schedule", id: "cron-schedule", tipLabel: "cron schedule" },
|
|
2172
|
+
{
|
|
2173
|
+
label: "Pre-check",
|
|
2174
|
+
id: "cron-precheck",
|
|
2175
|
+
tipLabel: "cron pre-check",
|
|
2176
|
+
},
|
|
2177
|
+
{ label: "Target", id: "cron-target", tipLabel: "cron target" },
|
|
2178
|
+
])}
|
|
2156
2179
|
<div class="data-table-wrapper">
|
|
2157
2180
|
<table class="data-table">
|
|
2158
2181
|
<thead>
|
|
@@ -2226,6 +2249,7 @@ export function renderAgentDetailPage(
|
|
|
2226
2249
|
<button type="submit" class="btn btn-primary">Add</button>
|
|
2227
2250
|
</div>
|
|
2228
2251
|
</form>
|
|
2252
|
+
${renderColumnHelp([{ label: "Pattern", id: "tools-pattern", tipLabel: "tool pattern" }])}
|
|
2229
2253
|
<div class="data-table-wrapper">
|
|
2230
2254
|
<table class="data-table">
|
|
2231
2255
|
<thead>
|
|
@@ -2244,7 +2268,7 @@ export function renderAgentDetailPage(
|
|
|
2244
2268
|
</div>`;
|
|
2245
2269
|
|
|
2246
2270
|
const tokensSection = `<div class="card">
|
|
2247
|
-
<div class="card-title">Task Store Tokens</div>
|
|
2271
|
+
<div class="card-title">Task Store Tokens${renderHelpTip("task-store-tokens", "task store tokens")}</div>
|
|
2248
2272
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/tokens" style="margin-bottom:16px">
|
|
2249
2273
|
<div class="form-row">
|
|
2250
2274
|
<div class="form-group" style="flex:1">
|
|
@@ -2278,7 +2302,7 @@ export function renderAgentDetailPage(
|
|
|
2278
2302
|
]),
|
|
2279
2303
|
];
|
|
2280
2304
|
const pluginsSection = `<div class="card">
|
|
2281
|
-
<div class="card-title">Plugins</div>
|
|
2305
|
+
<div class="card-title">Plugins${renderHelpTip("plugins", "plugins")}</div>
|
|
2282
2306
|
<div class="data-table-wrapper">
|
|
2283
2307
|
<table class="data-table" id="plugins-table">
|
|
2284
2308
|
<thead>
|
|
@@ -2304,6 +2328,14 @@ export function renderAgentDetailPage(
|
|
|
2304
2328
|
|
|
2305
2329
|
const marketplacesSection = `<div class="card">
|
|
2306
2330
|
<div class="card-title">Marketplaces</div>
|
|
2331
|
+
${renderColumnHelp([
|
|
2332
|
+
{ label: "Ref", id: "marketplace-ref", tipLabel: "marketplace ref" },
|
|
2333
|
+
{
|
|
2334
|
+
label: "Origin",
|
|
2335
|
+
id: "marketplace-origin",
|
|
2336
|
+
tipLabel: "marketplace origin",
|
|
2337
|
+
},
|
|
2338
|
+
])}
|
|
2307
2339
|
<div class="data-table-wrapper">
|
|
2308
2340
|
<table class="data-table" id="marketplaces-table">
|
|
2309
2341
|
<thead>
|
|
@@ -2340,7 +2372,7 @@ export function renderAgentDetailPage(
|
|
|
2340
2372
|
): string =>
|
|
2341
2373
|
`<tr><td style="color:var(--vos-text-muted);width:200px">${label}</td><td${mono ? ' class="mono"' : ""}>${value ? escapeHtml(value) : identityPlaceholder}</td></tr>`;
|
|
2342
2374
|
const identitySection = `<div class="card">
|
|
2343
|
-
<div class="card-title">Owner & identities</div>
|
|
2375
|
+
<div class="card-title">Owner & identities${renderHelpTip("owner-identities", "owner and identities")}</div>
|
|
2344
2376
|
<table class="detail-table"><tbody>
|
|
2345
2377
|
${identityRow("Owner email", agent.ownerEmail, false)}
|
|
2346
2378
|
${identityRow("Anthropic identity name", agent.anthropicIdentityName, true)}
|
|
@@ -2383,7 +2415,7 @@ export function renderAgentDetailPage(
|
|
|
2383
2415
|
: "";
|
|
2384
2416
|
|
|
2385
2417
|
const agentPolicySection = `<div class="card">
|
|
2386
|
-
<div class="card-title">Agent Policy</div>
|
|
2418
|
+
<div class="card-title">Agent Policy${renderHelpTip("agent-policy", "agent policy")}</div>
|
|
2387
2419
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/settings">
|
|
2388
2420
|
<div class="form-group" style="display:flex;align-items:center;gap:6px">
|
|
2389
2421
|
<input
|
|
@@ -2515,7 +2547,7 @@ export function renderAgentDetailPage(
|
|
|
2515
2547
|
<details>
|
|
2516
2548
|
<summary class="btn btn-secondary" style="cursor:pointer;font-size:12px;list-style:none">Sync Manifest</summary>
|
|
2517
2549
|
<div style="position:absolute;right:24px;margin-top:6px;background:var(--vos-surface);border:1px solid var(--vos-border);border-radius:6px;padding:12px;box-shadow:0 4px 12px rgba(0,0,0,0.08);z-index:10;min-width:320px">
|
|
2518
|
-
<p style="font-size:12px;color:var(--vos-text-muted);margin:0 0 10px">Syncs the current manifest to the provisioned Slack app. ${slackTokenCopy(slackStored, slackMismatch).help}</p>
|
|
2550
|
+
<p style="font-size:12px;color:var(--vos-text-muted);margin:0 0 10px">Syncs the current manifest to the provisioned Slack app. ${slackTokenCopy(slackStored, slackMismatch).help}${renderHelpTip("sync-manifest", "Sync Manifest", "end")}</p>
|
|
2519
2551
|
<form method="POST" action="/admin/agents/${escapeHtml(agent.id)}/sync-manifest" style="display:flex;flex-direction:column;gap:8px">
|
|
2520
2552
|
<input
|
|
2521
2553
|
name="xoxpToken"
|
|
@@ -2402,7 +2402,7 @@ describe("renderAgentDetailPage — sections", () => {
|
|
|
2402
2402
|
|
|
2403
2403
|
test("Automation renders only the cron jobs card", () => {
|
|
2404
2404
|
const html = render("automation");
|
|
2405
|
-
expect(html).toContain('<div class="card-title">Cron Jobs
|
|
2405
|
+
expect(html).toContain('<div class="card-title">Cron Jobs');
|
|
2406
2406
|
expect(html).toContain('action="/admin/agents/agent-123/crons"');
|
|
2407
2407
|
expect(html).not.toContain('class="stat-strip"');
|
|
2408
2408
|
expect(html).not.toContain("Danger Zone");
|
|
@@ -2414,9 +2414,9 @@ describe("renderAgentDetailPage — sections", () => {
|
|
|
2414
2414
|
const html = render("configuration");
|
|
2415
2415
|
const idx = [
|
|
2416
2416
|
'id="env-vars"',
|
|
2417
|
-
'<div class="card-title">Repos
|
|
2417
|
+
'<div class="card-title">Repos',
|
|
2418
2418
|
'id="ext-config"',
|
|
2419
|
-
'<div class="card-title">Agent Policy
|
|
2419
|
+
'<div class="card-title">Agent Policy',
|
|
2420
2420
|
].map((m) => html.indexOf(m));
|
|
2421
2421
|
expect(idx.every((i) => i > -1)).toBe(true);
|
|
2422
2422
|
expect([...idx].sort((x, y) => x - y)).toEqual(idx);
|
|
@@ -2442,7 +2442,7 @@ describe("renderAgentDetailPage — sections", () => {
|
|
|
2442
2442
|
expect(html).not.toContain('<div class="card-title">Slack access</div>');
|
|
2443
2443
|
expect(html).toContain("Task Store Tokens");
|
|
2444
2444
|
expect(html).toContain('action="/admin/agents/agent-123/tokens"');
|
|
2445
|
-
expect(html).not.toContain('<div class="card-title">Tools
|
|
2445
|
+
expect(html).not.toContain('<div class="card-title">Tools');
|
|
2446
2446
|
expect(html).not.toContain("Cron Jobs");
|
|
2447
2447
|
});
|
|
2448
2448
|
|
|
@@ -2460,8 +2460,8 @@ describe("renderAgentDetailPage — sections", () => {
|
|
|
2460
2460
|
expect(html).toContain('action="/admin/agents/agent-123/tools"');
|
|
2461
2461
|
expect(html).toContain('action="/admin/agents/agent-123/plugins"');
|
|
2462
2462
|
expect(html).toContain('action="/admin/agents/agent-123/marketplaces"');
|
|
2463
|
-
expect(html).toContain('<div class="card-title">Tools
|
|
2464
|
-
expect(html).toContain('<div class="card-title">Plugins
|
|
2463
|
+
expect(html).toContain('<div class="card-title">Tools');
|
|
2464
|
+
expect(html).toContain('<div class="card-title">Plugins');
|
|
2465
2465
|
expect(html).toContain('<div class="card-title">Marketplaces</div>');
|
|
2466
2466
|
expect(html).not.toContain("Task Store Tokens");
|
|
2467
2467
|
});
|
|
@@ -2524,10 +2524,16 @@ describe("renderAgentDetailPage — stat strip", () => {
|
|
|
2524
2524
|
|
|
2525
2525
|
test("stat tiles appear in order: crons active, missing env vars, members, repos", () => {
|
|
2526
2526
|
const html = render();
|
|
2527
|
-
const cronsIndex = html.indexOf(
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
const
|
|
2527
|
+
const cronsIndex = html.indexOf(
|
|
2528
|
+
'<div class="stat-tile-label">crons active</div>',
|
|
2529
|
+
);
|
|
2530
|
+
const envIndex = html.indexOf(
|
|
2531
|
+
'<div class="stat-tile-label">missing env vars</div>',
|
|
2532
|
+
);
|
|
2533
|
+
const membersIndex = html.indexOf(
|
|
2534
|
+
'<div class="stat-tile-label">members</div>',
|
|
2535
|
+
);
|
|
2536
|
+
const reposIndex = html.indexOf('<div class="stat-tile-label">repos</div>');
|
|
2531
2537
|
|
|
2532
2538
|
expect(cronsIndex).toBeGreaterThan(-1);
|
|
2533
2539
|
expect(envIndex).toBeGreaterThan(-1);
|
|
@@ -4528,10 +4534,10 @@ describe("renderAgentDetailPage — configuration card slots", () => {
|
|
|
4528
4534
|
'<div class="card">cfg-one</div>',
|
|
4529
4535
|
'<div class="card">cfg-two</div>',
|
|
4530
4536
|
]);
|
|
4531
|
-
const repos = html.indexOf('<div class="card-title">Repos
|
|
4537
|
+
const repos = html.indexOf('<div class="card-title">Repos');
|
|
4532
4538
|
const one = html.indexOf("cfg-one");
|
|
4533
4539
|
const two = html.indexOf("cfg-two");
|
|
4534
|
-
const policy = html.indexOf('<div class="card-title">Agent Policy
|
|
4540
|
+
const policy = html.indexOf('<div class="card-title">Agent Policy');
|
|
4535
4541
|
expect(repos).toBeGreaterThan(-1);
|
|
4536
4542
|
expect(repos).toBeLessThan(one);
|
|
4537
4543
|
expect(one).toBeLessThan(two);
|
|
@@ -4873,8 +4879,7 @@ describe("renderAgentDetailPage — cron help tooltips", () => {
|
|
|
4873
4879
|
{ timezone: "UTC", section: "automation", cronHelp },
|
|
4874
4880
|
);
|
|
4875
4881
|
}
|
|
4876
|
-
const tipCount = (html: string) =>
|
|
4877
|
-
html.split('class="info-tip-btn"').length - 1;
|
|
4882
|
+
const tipCount = (html: string) => html.split('id="cron-help-').length - 1;
|
|
4878
4883
|
|
|
4879
4884
|
test("a system row and a phase row each get exactly one tooltip", () => {
|
|
4880
4885
|
const html = render([SYSTEM_CRON, PHASE], lookup);
|
|
@@ -4907,3 +4912,72 @@ describe("renderAgentDetailPage — cron help tooltips", () => {
|
|
|
4907
4912
|
expect(tipCount(html)).toBe(0);
|
|
4908
4913
|
});
|
|
4909
4914
|
});
|
|
4915
|
+
|
|
4916
|
+
// ─── renderAgentDetailPage — help tooltips (9.3) ─────────────────────────────
|
|
4917
|
+
|
|
4918
|
+
describe("renderAgentDetailPage — help tooltips", () => {
|
|
4919
|
+
const renderSection = (section: (typeof AGENT_SECTIONS)[number]) =>
|
|
4920
|
+
renderAgentDetailSection(
|
|
4921
|
+
AGENT,
|
|
4922
|
+
{},
|
|
4923
|
+
[SYSTEM_CRON, CUSTOM_CRON],
|
|
4924
|
+
[TOOL_ENABLED],
|
|
4925
|
+
[TOKEN_ACTIVE],
|
|
4926
|
+
[PLUGIN_ENABLED],
|
|
4927
|
+
[],
|
|
4928
|
+
USER_NAME,
|
|
4929
|
+
true,
|
|
4930
|
+
{ timezone: "UTC", template: { detached: false }, section },
|
|
4931
|
+
);
|
|
4932
|
+
const count = (html: string, needle: string) => html.split(needle).length - 1;
|
|
4933
|
+
const EXPECTED: Record<(typeof AGENT_SECTIONS)[number], string[]> = {
|
|
4934
|
+
general: [],
|
|
4935
|
+
automation: [
|
|
4936
|
+
"cron-system-vs-custom",
|
|
4937
|
+
"cron-schedule",
|
|
4938
|
+
"cron-precheck",
|
|
4939
|
+
"cron-target",
|
|
4940
|
+
],
|
|
4941
|
+
configuration: [
|
|
4942
|
+
"template-following-detached",
|
|
4943
|
+
"template-row-source",
|
|
4944
|
+
"repo-uncovered",
|
|
4945
|
+
"agent-policy",
|
|
4946
|
+
],
|
|
4947
|
+
access: ["owner-identities", "task-store-tokens"],
|
|
4948
|
+
extensions: [
|
|
4949
|
+
"tools-pattern",
|
|
4950
|
+
"plugins",
|
|
4951
|
+
"marketplace-ref",
|
|
4952
|
+
"marketplace-origin",
|
|
4953
|
+
],
|
|
4954
|
+
};
|
|
4955
|
+
|
|
4956
|
+
for (const section of AGENT_SECTIONS) {
|
|
4957
|
+
for (const id of EXPECTED[section]) {
|
|
4958
|
+
test(`${section} renders help-${id} once`, () => {
|
|
4959
|
+
expect(count(renderSection(section), `id="help-${id}"`)).toBe(1);
|
|
4960
|
+
});
|
|
4961
|
+
}
|
|
4962
|
+
}
|
|
4963
|
+
|
|
4964
|
+
test("no help tip renders inside a scrolling table wrapper", () => {
|
|
4965
|
+
const html = AGENT_SECTIONS.map(renderSection).join("");
|
|
4966
|
+
const wrappers =
|
|
4967
|
+
html.match(/<div class="data-table-wrapper">[\s\S]*?<\/table>/g) ?? [];
|
|
4968
|
+
expect(wrappers.length).toBeGreaterThan(0);
|
|
4969
|
+
for (const w of wrappers) expect(w).not.toContain('id="help-');
|
|
4970
|
+
});
|
|
4971
|
+
|
|
4972
|
+
test("repeated badges carry no per-badge title", () => {
|
|
4973
|
+
const html = AGENT_SECTIONS.map(renderSection).join("");
|
|
4974
|
+
for (const t of [
|
|
4975
|
+
"Inherited from the agent template",
|
|
4976
|
+
"Set on this agent; overrides the template",
|
|
4977
|
+
"Comes from the agent image",
|
|
4978
|
+
"Removed from this agent; the template no longer re-adds it",
|
|
4979
|
+
]) {
|
|
4980
|
+
expect(html).not.toContain(`title="${t}`);
|
|
4981
|
+
}
|
|
4982
|
+
});
|
|
4983
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* the stored secret.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { renderHelpTip } from "./admin-ui-help-catalogue.ts";
|
|
11
12
|
import { renderAdminPage } from "./admin-ui-layout.ts";
|
|
12
13
|
import {
|
|
13
14
|
buildSettingsNav,
|
|
@@ -45,7 +46,7 @@ export function managedByBadge(
|
|
|
45
46
|
item: Pick<TemplateItemRow, "managedBy">,
|
|
46
47
|
): string {
|
|
47
48
|
return item.managedBy === "helm"
|
|
48
|
-
? ` <span class="badge badge-template"
|
|
49
|
+
? ` <span class="badge badge-template">from Helm values</span>`
|
|
49
50
|
: "";
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -188,6 +189,7 @@ export function renderTemplatesPage(o: TemplatesPageOpts): string {
|
|
|
188
189
|
body: `${error}${notice}${blocked}
|
|
189
190
|
<div class="card">
|
|
190
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>
|
|
191
193
|
${scopePicker(o)}
|
|
192
194
|
${del}
|
|
193
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
|
-
|
|
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"'),
|
|
@@ -1894,7 +1894,7 @@ describe("admin UI — authenticated pages", () => {
|
|
|
1894
1894
|
expect(res.status).toBe(200);
|
|
1895
1895
|
const html = await res.text();
|
|
1896
1896
|
// Tools card should appear for self-hosted agents
|
|
1897
|
-
expect(html).toContain('<div class="card-title">Tools
|
|
1897
|
+
expect(html).toContain('<div class="card-title">Tools');
|
|
1898
1898
|
// Tools should be rendered
|
|
1899
1899
|
expect(html).toContain("Bash(git:*)");
|
|
1900
1900
|
});
|
|
@@ -2323,9 +2323,7 @@ describe("admin UI — owner and Anthropic identity section (PAI-2.5)", () => {
|
|
|
2323
2323
|
});
|
|
2324
2324
|
expect(res.status).toBe(200);
|
|
2325
2325
|
const html = await res.text();
|
|
2326
|
-
expect(html).toContain(
|
|
2327
|
-
'<div class="card-title">Owner & identities</div>',
|
|
2328
|
-
);
|
|
2326
|
+
expect(html).toContain('<div class="card-title">Owner & identities');
|
|
2329
2327
|
expect(html).toContain("Owner email");
|
|
2330
2328
|
expect(html).toContain("jane.doe@example.com");
|
|
2331
2329
|
expect(html).toContain("Anthropic identity name");
|
|
@@ -2362,7 +2360,7 @@ describe("admin UI — owner and Anthropic identity section (PAI-2.5)", () => {
|
|
|
2362
2360
|
expect(res.status).toBe(200);
|
|
2363
2361
|
const html = await res.text();
|
|
2364
2362
|
const start = html.indexOf(
|
|
2365
|
-
'<div class="card-title">Owner & identities
|
|
2363
|
+
'<div class="card-title">Owner & identities',
|
|
2366
2364
|
);
|
|
2367
2365
|
expect(start).toBeGreaterThan(-1);
|
|
2368
2366
|
const sectionHtml = html.slice(start, html.indexOf("</table>", start));
|
|
@@ -2384,7 +2382,7 @@ describe("admin UI — agent policy fields", () => {
|
|
|
2384
2382
|
});
|
|
2385
2383
|
expect(res.status).toBe(200);
|
|
2386
2384
|
const html = await res.text();
|
|
2387
|
-
expect(html).toContain('<div class="card-title">Agent Policy
|
|
2385
|
+
expect(html).toContain('<div class="card-title">Agent Policy');
|
|
2388
2386
|
|
|
2389
2387
|
// Booleans default true/false/true — checkboxes reflect DB column defaults.
|
|
2390
2388
|
const autoPostReviewsInput = html.match(
|
package/src/admin-ui.ts
CHANGED
|
@@ -151,6 +151,7 @@ import {
|
|
|
151
151
|
scopeIncludesAgent,
|
|
152
152
|
type ViewerRole,
|
|
153
153
|
} from "./caller-scope.ts";
|
|
154
|
+
import { buildCronHelpLookup } from "./cron-help.ts";
|
|
154
155
|
import {
|
|
155
156
|
creatorFromScope,
|
|
156
157
|
type EnsureAccountMemberResult,
|
|
@@ -210,7 +211,6 @@ import {
|
|
|
210
211
|
SlackProvisioningService,
|
|
211
212
|
} from "./slack-provisioning-service.ts";
|
|
212
213
|
import type { SpecialtyDefaultsResolver } from "./specialty-defaults.ts";
|
|
213
|
-
import { buildCronHelpLookup } from "./cron-help.ts";
|
|
214
214
|
import {
|
|
215
215
|
type SpecialtyTypeResolver,
|
|
216
216
|
SpecialtyTypes,
|