@app-vitals/agent-admin 1.131.0 → 1.132.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.
|
|
3
|
+
"version": "1.132.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/app-vitals/agent.git",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"./admin-boot": "./src/admin-boot.ts",
|
|
19
19
|
"./admin-extension": "./src/admin-extension.ts",
|
|
20
20
|
"./admin-spec": "./src/admin-spec.ts",
|
|
21
|
+
"./admin-ui-help-catalogue": "./src/admin-ui-help-catalogue.ts",
|
|
21
22
|
"./main": "./src/main.ts",
|
|
22
23
|
"./openapi-schemas": "./src/openapi-schemas.ts",
|
|
23
24
|
"./platform-routes": "./src/platform-routes.ts",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@anthropic-ai/sdk": "0.137.0",
|
|
47
|
-
"@app-vitals/agent-lib": "1.
|
|
48
|
+
"@app-vitals/agent-lib": "1.132.0",
|
|
48
49
|
"@hono/zod-openapi": "^1.0.0",
|
|
49
50
|
"@prisma/adapter-pg": "^7.10.0",
|
|
50
51
|
"@prisma/client": "^7.10.0",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* admin/src/admin-ui-help-catalogue.ts
|
|
3
|
+
*
|
|
4
|
+
* Typed catalogue of help-tooltip content for the admin UI, keyed by help id.
|
|
5
|
+
* Each entry has a plain-text summary and a glossary anchor; the docs link is
|
|
6
|
+
* ADMIN_DOCS_BASE_URL + "admin-console-glossary#" + anchor.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { ADMIN_DOCS_BASE_URL, renderInfoTip } from "./admin-ui-info-tip.ts";
|
|
10
|
+
|
|
11
|
+
export interface HelpEntry {
|
|
12
|
+
/** Plain-text summary (<= 280 chars). */
|
|
13
|
+
summary: string;
|
|
14
|
+
/** Section anchor in the admin console glossary. */
|
|
15
|
+
anchor: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const HELP_CATALOGUE = {
|
|
19
|
+
specialty: {
|
|
20
|
+
summary:
|
|
21
|
+
"What the agent is meant to be good at. The specialty is added to the agent's instructions.",
|
|
22
|
+
anchor: "specialty",
|
|
23
|
+
},
|
|
24
|
+
runtime: {
|
|
25
|
+
summary:
|
|
26
|
+
"Where the agent's code runs: on the platform cluster or on a machine you manage. This decides how the agent is started, updated and stopped.",
|
|
27
|
+
anchor: "runtime",
|
|
28
|
+
},
|
|
29
|
+
"review-author-allowlist": {
|
|
30
|
+
summary:
|
|
31
|
+
"GitHub usernames whose pull requests the agent reviews automatically. Pull requests from anyone else are skipped.",
|
|
32
|
+
anchor: "review-author-allowlist",
|
|
33
|
+
},
|
|
34
|
+
"patch-author-allowlist": {
|
|
35
|
+
summary:
|
|
36
|
+
"GitHub usernames whose pull requests the agent may push fixes to. Pull requests from anyone else are never patched.",
|
|
37
|
+
anchor: "patch-author-allowlist",
|
|
38
|
+
},
|
|
39
|
+
"github-pat-vs-app": {
|
|
40
|
+
summary:
|
|
41
|
+
"A personal access token acts as one person. A GitHub App has its own identity, scoped to the repositories it is installed on.",
|
|
42
|
+
anchor: "github-pat-vs-app",
|
|
43
|
+
},
|
|
44
|
+
"github-app-id": {
|
|
45
|
+
summary:
|
|
46
|
+
"The numeric ID GitHub assigns to an App. Find it on the App's settings page under About.",
|
|
47
|
+
anchor: "github-app-id",
|
|
48
|
+
},
|
|
49
|
+
"github-installation-id": {
|
|
50
|
+
summary:
|
|
51
|
+
"The numeric ID of one installation of the App on an organization or account. It appears in the installation settings URL.",
|
|
52
|
+
anchor: "github-installation-id",
|
|
53
|
+
},
|
|
54
|
+
} as const satisfies Record<string, HelpEntry>;
|
|
55
|
+
|
|
56
|
+
export type HelpId = keyof typeof HELP_CATALOGUE;
|
|
57
|
+
|
|
58
|
+
/** Look up a catalogue entry; undefined for unknown ids and prototype keys. */
|
|
59
|
+
export function getHelpEntry(id: string): HelpEntry | undefined {
|
|
60
|
+
if (!Object.hasOwn(HELP_CATALOGUE, id)) return undefined;
|
|
61
|
+
return HELP_CATALOGUE[id as HelpId];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Absolute docs URL for a catalogue entry. */
|
|
65
|
+
export function helpDocsHref(entry: HelpEntry): string {
|
|
66
|
+
return `${ADMIN_DOCS_BASE_URL}admin-console-glossary#${entry.anchor}`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Render the info tooltip for a catalogue id (popover id `help-${id}`).
|
|
71
|
+
* Returns "" for an unknown id so a stale reference never breaks a page.
|
|
72
|
+
*/
|
|
73
|
+
export function renderHelpTip(
|
|
74
|
+
id: string,
|
|
75
|
+
label: string,
|
|
76
|
+
align?: "start" | "end",
|
|
77
|
+
): string {
|
|
78
|
+
const entry = getHelpEntry(id);
|
|
79
|
+
if (!entry) return "";
|
|
80
|
+
return renderInfoTip({
|
|
81
|
+
id: `help-${id}`,
|
|
82
|
+
label,
|
|
83
|
+
summary: entry.summary,
|
|
84
|
+
docsHref: helpDocsHref(entry),
|
|
85
|
+
align,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
getHelpEntry,
|
|
4
|
+
HELP_CATALOGUE,
|
|
5
|
+
helpDocsHref,
|
|
6
|
+
renderHelpTip,
|
|
7
|
+
} from "./admin-ui-help-catalogue.ts";
|
|
8
|
+
import { ADMIN_DOCS_BASE_URL } from "./admin-ui-info-tip.ts";
|
|
9
|
+
|
|
10
|
+
const ids = Object.keys(HELP_CATALOGUE);
|
|
11
|
+
|
|
12
|
+
describe("help catalogue", () => {
|
|
13
|
+
test("has the seven expected ids", () => {
|
|
14
|
+
expect(ids.sort()).toEqual(
|
|
15
|
+
[
|
|
16
|
+
"github-app-id",
|
|
17
|
+
"github-installation-id",
|
|
18
|
+
"github-pat-vs-app",
|
|
19
|
+
"patch-author-allowlist",
|
|
20
|
+
"review-author-allowlist",
|
|
21
|
+
"runtime",
|
|
22
|
+
"specialty",
|
|
23
|
+
].sort(),
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("every entry is well-formed", () => {
|
|
28
|
+
for (const id of ids) {
|
|
29
|
+
const entry = getHelpEntry(id);
|
|
30
|
+
expect(entry).toBeDefined();
|
|
31
|
+
expect(entry?.summary.length).toBeGreaterThan(0);
|
|
32
|
+
expect(entry?.summary.length).toBeLessThanOrEqual(280);
|
|
33
|
+
expect(entry?.anchor).toBe(id);
|
|
34
|
+
expect(helpDocsHref(entry as NonNullable<typeof entry>)).toBe(
|
|
35
|
+
`${ADMIN_DOCS_BASE_URL}admin-console-glossary#${id}`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("unknown and prototype ids return undefined", () => {
|
|
41
|
+
for (const id of ["nope", "__proto__", "constructor", "toString", ""]) {
|
|
42
|
+
expect(getHelpEntry(id)).toBeUndefined();
|
|
43
|
+
expect(renderHelpTip(id, "X")).toBe("");
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("renderHelpTip renders popover id, link and align", () => {
|
|
48
|
+
const html = renderHelpTip("runtime", "Runtime", "end");
|
|
49
|
+
expect(html).toContain('id="help-runtime"');
|
|
50
|
+
expect(html).toContain('aria-label="About Runtime"');
|
|
51
|
+
expect(html).toContain("info-tip-end");
|
|
52
|
+
expect(html).toContain(
|
|
53
|
+
`href="${ADMIN_DOCS_BASE_URL}admin-console-glossary#runtime"`,
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { HELP_CATALOGUE } from "./admin-ui-help-catalogue.ts";
|
|
3
|
+
import { renderNewLocalAgentPage } from "./admin-ui-pages.ts";
|
|
4
|
+
|
|
5
|
+
const TYPES = [{ name: "coding", displayName: "Coding Agent" }];
|
|
6
|
+
const count = (html: string, needle: string) => html.split(needle).length - 1;
|
|
7
|
+
|
|
8
|
+
describe("renderNewLocalAgentPage help tooltips", () => {
|
|
9
|
+
const html = renderNewLocalAgentPage("Dan", TYPES);
|
|
10
|
+
|
|
11
|
+
for (const id of Object.keys(HELP_CATALOGUE)) {
|
|
12
|
+
test(`renders help-${id} exactly once`, () => {
|
|
13
|
+
expect(count(html, `id="help-${id}"`)).toBe(1);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
test("selfServe omits the specialty tip but keeps the rest", () => {
|
|
18
|
+
const ss = renderNewLocalAgentPage("Dan", TYPES, {
|
|
19
|
+
selfServe: { remaining: 1, max: 3 },
|
|
20
|
+
});
|
|
21
|
+
expect(count(ss, 'id="help-specialty"')).toBe(0);
|
|
22
|
+
expect(count(ss, 'id="help-runtime"')).toBe(1);
|
|
23
|
+
expect(count(ss, 'id="help-github-app-id"')).toBe(1);
|
|
24
|
+
});
|
|
25
|
+
});
|
package/src/admin-ui-pages.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
renderUncoveredBadge,
|
|
25
25
|
uncoveredRepos,
|
|
26
26
|
} from "./admin-ui-installation-repos-pages.ts";
|
|
27
|
+
import { renderHelpTip } from "./admin-ui-help-catalogue.ts";
|
|
27
28
|
import { renderAdminPage } from "./admin-ui-layout.ts";
|
|
28
29
|
import { renderSettingsLayout } from "./admin-ui-settings-layout.ts";
|
|
29
30
|
import {
|
|
@@ -768,7 +769,7 @@ export function renderNewLocalAgentPage(
|
|
|
768
769
|
const typeFieldHtml = selfServe
|
|
769
770
|
? `<input type="hidden" name="type" value="${escapeHtml(getOwnerAgentSpecialty())}" />`
|
|
770
771
|
: `<div class="form-group">
|
|
771
|
-
<label class="form-label" for="type">Specialty <span style="color:#ef4444">*</span
|
|
772
|
+
<label class="form-label" for="type">Specialty <span style="color:#ef4444">*</span>${renderHelpTip("specialty", "Specialty")}</label>
|
|
772
773
|
<select id="type" name="type" class="form-input" required>
|
|
773
774
|
${typeOptions}
|
|
774
775
|
</select>
|
|
@@ -808,7 +809,7 @@ export function renderNewLocalAgentPage(
|
|
|
808
809
|
${typeFieldHtml}
|
|
809
810
|
${accountFieldHtml}
|
|
810
811
|
<fieldset style="border:1px solid var(--vos-border);border-radius:8px;padding:16px">
|
|
811
|
-
<legend style="font-size:13px;font-weight:600;padding:0 8px">Runtime</legend>
|
|
812
|
+
<legend style="font-size:13px;font-weight:600;padding:0 8px">Runtime${renderHelpTip("runtime", "Runtime")}</legend>
|
|
812
813
|
<div class="form-group" style="margin-bottom:0">
|
|
813
814
|
<label style="display:block;font-size:13px;font-weight:500;margin-bottom:8px">
|
|
814
815
|
<input type="radio" name="runtime" value="in-cluster" ${canProvision ? "checked" : "disabled"}
|
|
@@ -850,7 +851,7 @@ export function renderNewLocalAgentPage(
|
|
|
850
851
|
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">Format: <span class="mono">org/repo</span></p>
|
|
851
852
|
</div>
|
|
852
853
|
<div class="form-group">
|
|
853
|
-
<label class="form-label" for="authorAllowlist">Author allowlist (review) (optional, one GitHub login per line)</label
|
|
854
|
+
<label class="form-label" for="authorAllowlist">Author allowlist (review) (optional, one GitHub login per line)</label>${renderHelpTip("review-author-allowlist", "review author allowlist")}
|
|
854
855
|
<textarea
|
|
855
856
|
id="authorAllowlist"
|
|
856
857
|
name="authorAllowlist"
|
|
@@ -861,7 +862,7 @@ export function renderNewLocalAgentPage(
|
|
|
861
862
|
<p style="font-size:12px;color:var(--vos-text-muted);margin-top:4px">GitHub login, one per line</p>
|
|
862
863
|
</div>
|
|
863
864
|
<div class="form-group">
|
|
864
|
-
<label class="form-label" for="patchAuthorAllowlist">Patch author allowlist (optional, one GitHub login per line)</label
|
|
865
|
+
<label class="form-label" for="patchAuthorAllowlist">Patch author allowlist (optional, one GitHub login per line)</label>${renderHelpTip("patch-author-allowlist", "patch author allowlist")}
|
|
865
866
|
<textarea
|
|
866
867
|
id="patchAuthorAllowlist"
|
|
867
868
|
name="patchAuthorAllowlist"
|
|
@@ -930,7 +931,7 @@ export function renderNewLocalAgentPage(
|
|
|
930
931
|
</div>
|
|
931
932
|
</fieldset>
|
|
932
933
|
<fieldset id="github-section" style="display:${runtimeSectionsDisplay};border:1px solid var(--vos-border);border-radius:8px;padding:16px">
|
|
933
|
-
<legend style="font-size:13px;font-weight:600;padding:0 8px">GitHub Authentication (optional)</legend>
|
|
934
|
+
<legend style="font-size:13px;font-weight:600;padding:0 8px">GitHub Authentication (optional)${renderHelpTip("github-pat-vs-app", "personal access token versus GitHub App")}</legend>
|
|
934
935
|
<!--
|
|
935
936
|
ghAppMode disambiguates the two ghAuthMode="app" radios below
|
|
936
937
|
(Create GitHub App = auto, Use existing GitHub App = manual).
|
|
@@ -985,11 +986,11 @@ export function renderNewLocalAgentPage(
|
|
|
985
986
|
</div>
|
|
986
987
|
<div id="gh-app-manual-fields" style="display:none">
|
|
987
988
|
<div class="form-group">
|
|
988
|
-
<label class="form-label" for="ghAppId">GitHub App ID</label>
|
|
989
|
+
<label class="form-label" for="ghAppId">GitHub App ID${renderHelpTip("github-app-id", "GitHub App ID")}</label>
|
|
989
990
|
<input id="ghAppId" name="ghAppId" type="text" class="form-input" placeholder="App ID" />
|
|
990
991
|
</div>
|
|
991
992
|
<div class="form-group">
|
|
992
|
-
<label class="form-label" for="ghAppInstallationId">Installation ID</label>
|
|
993
|
+
<label class="form-label" for="ghAppInstallationId">Installation ID${renderHelpTip("github-installation-id", "Installation ID")}</label>
|
|
993
994
|
<input id="ghAppInstallationId" name="ghAppInstallationId" type="text" class="form-input" placeholder="Installation ID" />
|
|
994
995
|
</div>
|
|
995
996
|
<div class="form-group">
|