@app-vitals/agent-admin 1.47.0 → 1.49.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.47.0",
3
+ "version": "1.49.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@anthropic-ai/sdk": "0.135.0",
45
- "@app-vitals/agent-lib": "1.47.0",
45
+ "@app-vitals/agent-lib": "1.49.0",
46
46
  "@hono/zod-openapi": "^1.0.0",
47
47
  "@prisma/adapter-pg": "^7.10.0",
48
48
  "@prisma/client": "^7.10.0",
package/src/admin-boot.ts CHANGED
@@ -704,6 +704,9 @@ export async function startAdmin(
704
704
  ...(resolvedExtensions.agentDetailCards.length > 0
705
705
  ? { agentDetailCards: resolvedExtensions.agentDetailCards }
706
706
  : {}),
707
+ ...(resolvedExtensions.settingsNavItems.length > 0
708
+ ? { settingsNavItems: resolvedExtensions.settingsNavItems }
709
+ : {}),
707
710
  ...resolvedExtensions.uiDeps,
708
711
  });
709
712
  root.route("/", adminUIApp);
@@ -0,0 +1,33 @@
1
+ /**
2
+ * admin/src/admin-ui-account-nav.unit.test.ts
3
+ * Flag plumbing for the toolbar Account / Settings entries.
4
+ */
5
+
6
+ import { describe, expect, test } from "bun:test";
7
+ import {
8
+ runWithAccountNav,
9
+ runWithSettingsNav,
10
+ shouldShowAccountNav,
11
+ shouldShowSettingsNav,
12
+ } from "./admin-ui-account-nav.ts";
13
+
14
+ describe("account-nav flags", () => {
15
+ test("both hidden outside any context", () => {
16
+ expect(shouldShowAccountNav()).toBe(false);
17
+ expect(shouldShowSettingsNav()).toBe(false);
18
+ });
19
+ test("settings flag survives a nested account wrapper, and vice versa", () => {
20
+ runWithSettingsNav(true, () => {
21
+ runWithAccountNav(false, () => {
22
+ expect(shouldShowSettingsNav()).toBe(true);
23
+ expect(shouldShowAccountNav()).toBe(false);
24
+ });
25
+ });
26
+ runWithAccountNav(true, () => {
27
+ runWithSettingsNav(false, () => {
28
+ expect(shouldShowAccountNav()).toBe(true);
29
+ expect(shouldShowSettingsNav()).toBe(false);
30
+ });
31
+ });
32
+ });
33
+ });
@@ -0,0 +1,415 @@
1
+ /**
2
+ * admin/src/admin-ui-agent-template.smoke.test.ts
3
+ * Smoke tests for the ATP-2.4 agent template UI via app.request(): inherited /
4
+ * custom badges on the agent page, detach / reattach, reset to template, and
5
+ * the provisioning form's template defaults and opt-out. In-memory doubles.
6
+ */
7
+
8
+ import { beforeAll, describe, expect, it } from "bun:test";
9
+ import {
10
+ AGENT_ID,
11
+ MOCK_CRON,
12
+ MOCK_TOOL,
13
+ makeMockDeps,
14
+ makeSessionCookie,
15
+ } from "./admin-ui.fixtures.ts";
16
+ import { createAdminUIApp } from "./admin-ui.ts";
17
+ import { resolveDefaultSpecialtyName } from "./specialty-types.ts";
18
+ import type { TemplateView } from "./agent-templates.ts";
19
+
20
+ const TYPE = resolveDefaultSpecialtyName();
21
+ const d = new Date("2024-01-01");
22
+
23
+ let cookie: string;
24
+ beforeAll(async () => {
25
+ cookie = await makeSessionCookie();
26
+ });
27
+
28
+ interface ApiCall {
29
+ path: string;
30
+ method: string;
31
+ body: unknown;
32
+ }
33
+
34
+ /** In-memory stand-in for the agents API app's `request`. */
35
+ function fakeAgentsApi(opts: { status?: number } = {}) {
36
+ const calls: ApiCall[] = [];
37
+ const api = async (path: string, init?: RequestInit) => {
38
+ calls.push({
39
+ path,
40
+ method: init?.method ?? "GET",
41
+ body: init?.body ? JSON.parse(String(init.body)) : undefined,
42
+ });
43
+ const status = opts.status ?? 200;
44
+ return status === 200
45
+ ? Response.json({ ok: true })
46
+ : Response.json({ error: "agent is detached" }, { status });
47
+ };
48
+ return { api, calls };
49
+ }
50
+
51
+ function detailDeps(
52
+ over: {
53
+ detached?: boolean;
54
+ agentsApi?: ReturnType<typeof fakeAgentsApi>["api"];
55
+ } = {},
56
+ ) {
57
+ const base = makeMockDeps();
58
+ return makeMockDeps({
59
+ ...(over.agentsApi ? { agentsApi: over.agentsApi } : {}),
60
+ agentService: {
61
+ ...base.agentService,
62
+ getDetail: async () => ({
63
+ ...(await base.agentService.getDetail(AGENT_ID)),
64
+ id: AGENT_ID,
65
+ name: "Test Agent",
66
+ slackId: null,
67
+ selfHosted: false,
68
+ specialty: TYPE,
69
+ createdAt: d,
70
+ updatedAt: d,
71
+ repos: [],
72
+ reviewAuthorAllowlist: [],
73
+ patchAuthorAllowlist: [],
74
+ restrictSlackToMembers: false,
75
+ missingRequiredEnv: [],
76
+ templateDetached: over.detached ?? false,
77
+ }),
78
+ },
79
+ agentEnvService: {
80
+ ...base.agentEnvService,
81
+ getByAgentId: async () => ({
82
+ env: { TPL_KEY: "a", MINE: "b" },
83
+ secretKeys: [],
84
+ sources: { TPL_KEY: "template", MINE: "custom" },
85
+ }),
86
+ },
87
+ agentToolService: {
88
+ ...base.agentToolService,
89
+ list: async () => [
90
+ { ...MOCK_TOOL, id: "t-tpl", pattern: "Read", source: "template" },
91
+ { ...MOCK_TOOL, id: "t-own", pattern: "Bash(ls:*)", source: "custom" },
92
+ ],
93
+ },
94
+ agentPluginService: {
95
+ ...base.agentPluginService,
96
+ list: async () => [
97
+ {
98
+ id: "p-tpl",
99
+ agentId: AGENT_ID,
100
+ source: "template",
101
+ name: "tpl-plugin",
102
+ version: null,
103
+ enabled: true,
104
+ createdAt: d,
105
+ updatedAt: d,
106
+ },
107
+ ],
108
+ },
109
+ agentCronJobService: {
110
+ ...base.agentCronJobService,
111
+ listWithRunSummary: async () => [
112
+ {
113
+ ...MOCK_CRON,
114
+ id: "c-tpl",
115
+ name: "tpl-cron",
116
+ source: "template",
117
+ lastRun: null,
118
+ runCountToday: 0,
119
+ },
120
+ ],
121
+ },
122
+ });
123
+ }
124
+
125
+ const get = (app: ReturnType<typeof createAdminUIApp>, path: string) =>
126
+ app.request(path, { headers: { Cookie: `admin_session=${cookie}` } });
127
+
128
+ const post = (
129
+ app: ReturnType<typeof createAdminUIApp>,
130
+ path: string,
131
+ fields: Record<string, string> = {},
132
+ ) =>
133
+ app.request(path, {
134
+ method: "POST",
135
+ body: new URLSearchParams(fields).toString(),
136
+ headers: {
137
+ "Content-Type": "application/x-www-form-urlencoded",
138
+ Cookie: `admin_session=${cookie}`,
139
+ },
140
+ });
141
+
142
+ describe("agent page template badges (ATP-2.4)", () => {
143
+ it("marks every env, tool, plugin and cron as inherited or custom", async () => {
144
+ const { api } = fakeAgentsApi();
145
+ const html = await (
146
+ await get(
147
+ createAdminUIApp(detailDeps({ agentsApi: api })),
148
+ `/admin/agents/${AGENT_ID}`,
149
+ )
150
+ ).text();
151
+ // 1 env + 1 tool + 1 plugin + 1 cron inherited; 1 env + 1 tool custom.
152
+ expect(html.match(/data-source="template"/g)).toHaveLength(4);
153
+ expect(html.match(/data-source="custom"/g)).toHaveLength(2);
154
+ expect(html).toContain("badge-template");
155
+ expect(html).toContain("badge-custom");
156
+ });
157
+
158
+ it("shows no template UI when the agents API seam is not wired", async () => {
159
+ const html = await (
160
+ await get(createAdminUIApp(detailDeps()), `/admin/agents/${AGENT_ID}`)
161
+ ).text();
162
+ expect(html).not.toContain("data-source=");
163
+ expect(html).not.toContain("/template/detach");
164
+ });
165
+
166
+ it("an inherited env row flips to custom after it is edited", async () => {
167
+ const sources: Record<string, string> = { TPL_KEY: "template" };
168
+ const base = makeMockDeps();
169
+ const { api } = fakeAgentsApi();
170
+ const app = createAdminUIApp(
171
+ makeMockDeps({
172
+ agentsApi: api,
173
+ agentEnvService: {
174
+ ...base.agentEnvService,
175
+ getByAgentId: async () => ({
176
+ env: { TPL_KEY: "v" },
177
+ secretKeys: [],
178
+ sources: { ...sources },
179
+ }),
180
+ // Mirrors AgentEnvService.patch: an explicit write is custom.
181
+ patch: async (_id: string, env: Record<string, string>) => {
182
+ for (const k of Object.keys(env)) sources[k] = "custom";
183
+ },
184
+ },
185
+ }),
186
+ );
187
+ const before = await (await get(app, `/admin/agents/${AGENT_ID}`)).text();
188
+ expect(before).toContain('data-source="template"');
189
+ await post(app, `/admin/agents/${AGENT_ID}/envs`, {
190
+ key: "TPL_KEY",
191
+ value: "mine",
192
+ });
193
+ const after = await (await get(app, `/admin/agents/${AGENT_ID}`)).text();
194
+ expect(after).not.toContain('data-source="template"');
195
+ expect(after).toContain('data-source="custom"');
196
+ });
197
+ });
198
+
199
+ describe("detach / reattach (ATP-2.4)", () => {
200
+ it("attached agent offers Detach; POST calls the detach endpoint", async () => {
201
+ const { api, calls } = fakeAgentsApi();
202
+ const app = createAdminUIApp(detailDeps({ agentsApi: api }));
203
+ const html = await (await get(app, `/admin/agents/${AGENT_ID}`)).text();
204
+ expect(html).toContain(`/admin/agents/${AGENT_ID}/template/detach`);
205
+ expect(html).not.toContain(`/template/reattach`);
206
+
207
+ const res = await post(app, `/admin/agents/${AGENT_ID}/template/detach`);
208
+ expect(res.status).toBe(302);
209
+ expect(res.headers.get("Location")).toContain(`/admin/agents/${AGENT_ID}`);
210
+ expect(calls).toEqual([
211
+ {
212
+ path: `/agents/${AGENT_ID}/template/detach`,
213
+ method: "POST",
214
+ body: undefined,
215
+ },
216
+ ]);
217
+ });
218
+
219
+ it("detached agent shows a Detached state with Reattach; POST calls the reattach endpoint", async () => {
220
+ const { api, calls } = fakeAgentsApi();
221
+ const app = createAdminUIApp(
222
+ detailDeps({ agentsApi: api, detached: true }),
223
+ );
224
+ const html = await (await get(app, `/admin/agents/${AGENT_ID}`)).text();
225
+ expect(html).toContain("Detached from template");
226
+ expect(html).toContain(`/admin/agents/${AGENT_ID}/template/reattach`);
227
+ expect(html).not.toContain(`/template/detach`);
228
+ // No per-item reset while detached (the API answers 409).
229
+ expect(html).not.toContain(`/template/reset`);
230
+
231
+ const res = await post(app, `/admin/agents/${AGENT_ID}/template/reattach`);
232
+ expect(res.status).toBe(302);
233
+ expect(calls.map((c) => c.path)).toEqual([
234
+ `/agents/${AGENT_ID}/template/reattach`,
235
+ ]);
236
+ });
237
+
238
+ it("surfaces an API failure as an error on the agent page", async () => {
239
+ const { api } = fakeAgentsApi({ status: 409 });
240
+ const app = createAdminUIApp(detailDeps({ agentsApi: api }));
241
+ const res = await post(app, `/admin/agents/${AGENT_ID}/template/detach`);
242
+ expect(res.status).toBe(302);
243
+ expect(decodeURIComponent(res.headers.get("Location") ?? "")).toContain(
244
+ "agent is detached",
245
+ );
246
+ });
247
+
248
+ it("is 404-safe without the agents API seam", async () => {
249
+ const res = await post(
250
+ createAdminUIApp(detailDeps()),
251
+ `/admin/agents/${AGENT_ID}/template/detach`,
252
+ );
253
+ expect(res.status).toBe(404);
254
+ });
255
+ });
256
+
257
+ describe("reset to template (ATP-2.4)", () => {
258
+ it("custom rows get a per-item reset; template rows do not", async () => {
259
+ const { api } = fakeAgentsApi();
260
+ const html = await (
261
+ await get(
262
+ createAdminUIApp(detailDeps({ agentsApi: api })),
263
+ `/admin/agents/${AGENT_ID}`,
264
+ )
265
+ ).text();
266
+ // custom env MINE and custom tool Bash(ls:*) -> 2 per-item resets, plus
267
+ // the agent-wide reset.
268
+ expect(html.match(/name="kind" value="(env|tool)"/g)).toHaveLength(2);
269
+ expect(html).toContain(`/admin/agents/${AGENT_ID}/template/reset`);
270
+ });
271
+
272
+ it("POST with kind and key resets one item", async () => {
273
+ const { api, calls } = fakeAgentsApi();
274
+ const app = createAdminUIApp(detailDeps({ agentsApi: api }));
275
+ const res = await post(app, `/admin/agents/${AGENT_ID}/template/reset`, {
276
+ kind: "env",
277
+ key: "MINE",
278
+ });
279
+ expect(res.status).toBe(302);
280
+ expect(calls).toEqual([
281
+ {
282
+ path: `/agents/${AGENT_ID}/template/reset`,
283
+ method: "POST",
284
+ body: { kind: "env", key: "MINE" },
285
+ },
286
+ ]);
287
+ });
288
+
289
+ it("POST without kind/key resets everything", async () => {
290
+ const { api, calls } = fakeAgentsApi();
291
+ const app = createAdminUIApp(detailDeps({ agentsApi: api }));
292
+ await post(app, `/admin/agents/${AGENT_ID}/template/reset`);
293
+ expect(calls[0]?.body).toEqual({});
294
+ });
295
+
296
+ it("rejects an unknown kind without calling the API", async () => {
297
+ const { api, calls } = fakeAgentsApi();
298
+ const app = createAdminUIApp(detailDeps({ agentsApi: api }));
299
+ const res = await post(app, `/admin/agents/${AGENT_ID}/template/reset`, {
300
+ kind: "bogus",
301
+ key: "x",
302
+ });
303
+ expect(res.status).toBe(302);
304
+ expect(decodeURIComponent(res.headers.get("Location") ?? "")).toContain(
305
+ "Unknown",
306
+ );
307
+ expect(calls).toHaveLength(0);
308
+ });
309
+ });
310
+
311
+ describe("provisioning form (ATP-2.4)", () => {
312
+ const template: TemplateView = {
313
+ id: "t1",
314
+ accountId: null,
315
+ specialty: null,
316
+ createdAt: d,
317
+ updatedAt: d,
318
+ items: [
319
+ {
320
+ kind: "env",
321
+ key: "LOG_LEVEL",
322
+ payload: { value: "debug" },
323
+ updatedAt: d,
324
+ },
325
+ { kind: "tool", key: "Read", payload: {}, updatedAt: d },
326
+ ],
327
+ };
328
+ const templateService = {
329
+ list: async () => [template],
330
+ replace: async () => {
331
+ throw new Error("unused");
332
+ },
333
+ putItem: async () => {
334
+ throw new Error("unused");
335
+ },
336
+ deleteItem: async () => {
337
+ throw new Error("unused");
338
+ },
339
+ delete: async () => {},
340
+ };
341
+
342
+ function createDeps() {
343
+ const created: Array<Record<string, unknown>> = [];
344
+ const patched: Array<Record<string, string>> = [];
345
+ const plain = makeMockDeps();
346
+ const deps = makeMockDeps({
347
+ templateService,
348
+ agentService: {
349
+ ...plain.agentService,
350
+ create: async (
351
+ ...args: Parameters<typeof plain.agentService.create>
352
+ ) => {
353
+ created.push(args[0] as unknown as Record<string, unknown>);
354
+ return plain.agentService.create(...args);
355
+ },
356
+ },
357
+ agentEnvService: {
358
+ ...plain.agentEnvService,
359
+ patch: async (_id: string, env: Record<string, string>) => {
360
+ patched.push(env);
361
+ },
362
+ },
363
+ });
364
+ return { deps, created, patched };
365
+ }
366
+
367
+ it("shows template-provided values as defaults and an opt-out checkbox", async () => {
368
+ const html = await (
369
+ await get(createAdminUIApp(createDeps().deps), "/admin/agents/new")
370
+ ).text();
371
+ expect(html).toContain('name="templateDetached"');
372
+ expect(html).toContain("LOG_LEVEL");
373
+ expect(html).toContain("debug");
374
+ expect(html).toContain("Read");
375
+ expect(html).toContain('name="env"');
376
+ });
377
+
378
+ it("omits the template section when no template service is wired", async () => {
379
+ const html = await (
380
+ await get(createAdminUIApp(makeMockDeps()), "/admin/agents/new")
381
+ ).text();
382
+ expect(html).not.toContain('name="templateDetached"');
383
+ });
384
+
385
+ it("opt-out checkbox sends templateDetached:true", async () => {
386
+ const { deps, created } = createDeps();
387
+ const res = await post(createAdminUIApp(deps), "/admin/agents", {
388
+ name: "Test Agent",
389
+ type: TYPE,
390
+ templateDetached: "true",
391
+ });
392
+ expect(res.status).toBe(302);
393
+ expect(created[0]?.templateDetached).toBe(true);
394
+ });
395
+
396
+ it("without the checkbox the agent follows the template", async () => {
397
+ const { deps, created } = createDeps();
398
+ await post(createAdminUIApp(deps), "/admin/agents", {
399
+ name: "Test Agent",
400
+ type: TYPE,
401
+ });
402
+ expect(created[0]?.templateDetached).not.toBe(true);
403
+ });
404
+
405
+ it("form-entered env values are passed as explicit overrides", async () => {
406
+ const { deps, patched } = createDeps();
407
+ await post(createAdminUIApp(deps), "/admin/agents", {
408
+ name: "Test Agent",
409
+ type: TYPE,
410
+ env: "LOG_LEVEL=info\n# comment\n\nEXTRA = two words",
411
+ });
412
+ expect(patched.some((e) => e.LOG_LEVEL === "info")).toBe(true);
413
+ expect(patched.some((e) => e.EXTRA === "two words")).toBe(true);
414
+ });
415
+ });
@@ -12,7 +12,12 @@ import {
12
12
  type GheWarningCode,
13
13
  } from "./github-enterprise-warnings.ts";
14
14
  import { renderAdminPage } from "./admin-ui-layout.ts";
15
- import { escapeHtml, renderAdminToolbar } from "./admin-ui-styles.ts";
15
+ import { escapeHtml } from "./admin-ui-styles.ts";
16
+ import {
17
+ buildSettingsNav,
18
+ renderSettingsLayout,
19
+ type SettingsNav,
20
+ } from "./admin-ui-settings-layout.ts";
16
21
 
17
22
  export const ADMIN_GITHUB_ENTERPRISE_PATH = "/admin/settings/github-enterprise";
18
23
 
@@ -53,6 +58,10 @@ export interface GheOrgs {
53
58
 
54
59
  export interface GithubEnterpriseSettingsPageOpts {
55
60
  userEmail: string;
61
+ /** Viewer is an admin (drives adminOnly sidebar items). */
62
+ isAdmin?: boolean;
63
+ /** Settings sidebar nav; defaults to the base Platform nav. */
64
+ nav?: SettingsNav;
56
65
  status: GheStatus;
57
66
  /** Present when the installer App is configured and the org list loaded. */
58
67
  orgs?: GheOrgs;
@@ -263,13 +272,18 @@ export function renderGithubEnterpriseSettingsPage(
263
272
 
264
273
  return renderAdminPage({
265
274
  title: "GitHub Enterprise — Settings — Shipwright Admin",
266
- body: `${renderAdminToolbar(opts.userEmail, BASE)}
267
- <div class="vos-page">
268
- <div class="page-header"><h1 class="page-title">GitHub Enterprise apps</h1><a href="/admin/settings/templates" class="btn btn-secondary">Agent templates</a></div>
269
- ${error}${notice}${intro}
275
+ body: renderSettingsLayout({
276
+ userName: opts.userEmail,
277
+ title: "GitHub Enterprise apps",
278
+ nav:
279
+ opts.nav ??
280
+ buildSettingsNav({ githubEnterprise: true, templates: true }),
281
+ active: BASE,
282
+ isAdmin: opts.isAdmin ?? false,
283
+ body: `${error}${notice}${intro}
270
284
  ${appCard("installer", status.installer, opts.warnings)}
271
285
  ${appCard("lookup", status.lookup, opts.warnings)}
272
- ${orgsCard(opts)}
273
- </div>`,
286
+ ${orgsCard(opts)}`,
287
+ }),
274
288
  });
275
289
  }
@@ -262,6 +262,32 @@ describe("toolbar Settings entry", () => {
262
262
  test("hidden outside a settings-nav context, shown inside one", () => {
263
263
  expect(renderAdminToolbar("a@x.com")).not.toContain("/admin/settings");
264
264
  const html = runWithSettingsNav(true, () => renderAdminToolbar("a@x.com"));
265
- expect(html).toContain('href="/admin/settings/github-enterprise"');
265
+ expect(html).toContain('href="/admin/settings" class="vos-nav-link');
266
+ });
267
+ });
268
+
269
+ describe("settings shell wrapper (SGL-2.2)", () => {
270
+ const html = renderGithubEnterpriseSettingsPage({
271
+ userEmail: "a@x.com",
272
+ isAdmin: true,
273
+ status: { configured: false, installer: null, lookup: null },
274
+ });
275
+ test("renders inside the settings layout with the active GHE item", () => {
276
+ expect(html).toContain("settings-sidebar");
277
+ expect(html).toContain(
278
+ 'href="/admin/settings/github-enterprise" aria-current="page">GitHub Enterprise',
279
+ );
280
+ });
281
+ test("drops the ad hoc Agent templates cross-link button", () => {
282
+ expect(html).not.toContain('btn btn-secondary">Agent templates');
283
+ });
284
+ test("hides the adminOnly GHE item from non-admins", () => {
285
+ const h = renderGithubEnterpriseSettingsPage({
286
+ userEmail: "a@x.com",
287
+ status: { configured: false, installer: null, lookup: null },
288
+ });
289
+ expect(h).not.toContain(
290
+ 'class="settings-nav-link" href="/admin/settings/github-enterprise"',
291
+ );
266
292
  });
267
293
  });
@@ -383,7 +383,7 @@ describe("nav entry in the full admin UI", () => {
383
383
  headers: { "Content-Type": "application/json" },
384
384
  },
385
385
  );
386
- const NAV = 'href="/admin/settings/github-enterprise"';
386
+ const NAV = 'href="/admin/settings" class="vos-nav-link';
387
387
 
388
388
  it("shows Settings to admins and serves the page", async () => {
389
389
  const app = createAdminUIApp(makeMockDeps({ githubEnterpriseApi: api }));
@@ -7,6 +7,7 @@
7
7
  * `{ error }` bodies as readable messages. No key is ever read back.
8
8
  */
9
9
 
10
+ import type { SettingsNav } from "./admin-ui-settings-layout.ts";
10
11
  import type { Context, Hono, MiddlewareHandler } from "hono";
11
12
  import { readPrivateKeyField } from "./github-enterprise-pem-upload.ts";
12
13
  import { warningCodeFor } from "./github-enterprise-warnings.ts";
@@ -22,6 +23,8 @@ export interface AdminGithubEnterpriseRouteDeps {
22
23
  requireAuth: MiddlewareHandler<AdminUIEnv>;
23
24
  /** Calls the GHE-1.3 API app (its `.request`), e.g. `/github-enterprise/apps`. */
24
25
  api: (path: string, init?: RequestInit) => Response | Promise<Response>;
26
+ /** Settings sidebar nav (SGL-2.2). */
27
+ settingsNav?: SettingsNav;
25
28
  html: (content: string, opts?: { status?: number }) => Response;
26
29
  }
27
30
 
@@ -103,6 +106,8 @@ export function registerAdminGithubEnterpriseRoutes(
103
106
  return deps.html(
104
107
  renderGithubEnterpriseSettingsPage({
105
108
  userEmail: c.var.userEmail,
109
+ isAdmin: c.var.isAdmin === true,
110
+ ...(deps.settingsNav ? { nav: deps.settingsNav } : {}),
106
111
  status: { configured: false, installer: null, lookup: null },
107
112
  error: flash.error ?? statusRes.error,
108
113
  }),
@@ -123,6 +128,8 @@ export function registerAdminGithubEnterpriseRoutes(
123
128
  return deps.html(
124
129
  renderGithubEnterpriseSettingsPage({
125
130
  userEmail: c.var.userEmail,
131
+ isAdmin: c.var.isAdmin === true,
132
+ ...(deps.settingsNav ? { nav: deps.settingsNav } : {}),
126
133
  status,
127
134
  orgs,
128
135
  orgsError,