@app-vitals/agent-admin 1.49.0 → 1.50.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/e2e/agents-page.e2e.ts +61 -21
- package/e2e/marketplaces-section.e2e.ts +5 -24
- package/e2e/plugins-section.e2e.ts +6 -27
- package/package.json +2 -2
- package/src/admin-ui-agent-sections.unit.test.ts +95 -0
- package/src/admin-ui-agent-template.smoke.test.ts +22 -16
- package/src/admin-ui-github-identity-pages.unit.test.ts +22 -1
- package/src/admin-ui-github-identity.smoke.test.ts +1 -1
- package/src/admin-ui-installation-repos.smoke.test.ts +7 -7
- package/src/admin-ui-pages.ts +137 -110
- package/src/admin-ui-pages.unit.test.ts +166 -225
- package/src/admin-ui-styles.ts +0 -65
- package/src/admin-ui.smoke.test.ts +171 -69
- package/src/admin-ui.ts +184 -96
package/src/admin-ui.ts
CHANGED
|
@@ -74,14 +74,19 @@ import {
|
|
|
74
74
|
type RepoRemovalPreviewView,
|
|
75
75
|
renderInstallationReposBody,
|
|
76
76
|
renderInstallationReposError,
|
|
77
|
-
renderSyncConfirm,
|
|
78
|
-
renderSyncResult,
|
|
79
77
|
renderRepoRemovalConfirm,
|
|
80
78
|
renderRepoRemovalResult,
|
|
79
|
+
renderSyncConfirm,
|
|
80
|
+
renderSyncResult,
|
|
81
81
|
} from "./admin-ui-installation-repos-pages.ts";
|
|
82
82
|
import {
|
|
83
|
+
AGENT_SECTIONS,
|
|
83
84
|
type AgentDetail,
|
|
84
85
|
type AgentOption,
|
|
86
|
+
type AgentSection,
|
|
87
|
+
agentSectionPath,
|
|
88
|
+
isAgentSection,
|
|
89
|
+
settingsRedirectSection,
|
|
85
90
|
renderAgentDetailPage,
|
|
86
91
|
renderAgentsPage,
|
|
87
92
|
renderChatMessageBubble,
|
|
@@ -739,17 +744,20 @@ async function redirectWithMembersWarning(
|
|
|
739
744
|
agentMemberService: Pick<AgentMemberService, "listByAgentId">,
|
|
740
745
|
agentId: string,
|
|
741
746
|
restrictSlackToMembers: boolean,
|
|
747
|
+
section: AgentSection,
|
|
742
748
|
) {
|
|
743
749
|
if (restrictSlackToMembers) {
|
|
744
750
|
const members = await agentMemberService.listByAgentId(agentId);
|
|
745
751
|
if (members.length === 0) {
|
|
746
752
|
return c.redirect(
|
|
747
|
-
|
|
753
|
+
agentSectionPath(agentId, section, {
|
|
754
|
+
warning: "restrict_slack_no_members",
|
|
755
|
+
}),
|
|
748
756
|
302,
|
|
749
757
|
);
|
|
750
758
|
}
|
|
751
759
|
}
|
|
752
|
-
return c.redirect(
|
|
760
|
+
return c.redirect(agentSectionPath(agentId, section), 302);
|
|
753
761
|
}
|
|
754
762
|
|
|
755
763
|
// ─── HTML helper ──────────────────────────────────────────────────────────────
|
|
@@ -1609,10 +1617,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
1609
1617
|
...(templateService
|
|
1610
1618
|
? {
|
|
1611
1619
|
template: {
|
|
1612
|
-
items: await templateDefaultItems(
|
|
1613
|
-
c.var.isAdmin,
|
|
1614
|
-
accountId,
|
|
1615
|
-
),
|
|
1620
|
+
items: await templateDefaultItems(c.var.isAdmin, accountId),
|
|
1616
1621
|
allowEnv: c.var.isAdmin === true,
|
|
1617
1622
|
},
|
|
1618
1623
|
}
|
|
@@ -1916,6 +1921,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
1916
1921
|
agentMemberService,
|
|
1917
1922
|
agent.id,
|
|
1918
1923
|
restrictSlackToMembers,
|
|
1924
|
+
"general",
|
|
1919
1925
|
);
|
|
1920
1926
|
});
|
|
1921
1927
|
|
|
@@ -1995,7 +2001,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
1995
2001
|
}),
|
|
1996
2002
|
},
|
|
1997
2003
|
);
|
|
1998
|
-
const base =
|
|
2004
|
+
const base = agentSectionPath(agentId, "access");
|
|
1999
2005
|
if (res?.ok) {
|
|
2000
2006
|
return c.redirect(
|
|
2001
2007
|
`${base}?success=${username === "" ? "github_username_cleared" : "github_username_saved"}`,
|
|
@@ -2009,7 +2015,10 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2009
2015
|
} catch {
|
|
2010
2016
|
// keep the generic message
|
|
2011
2017
|
}
|
|
2012
|
-
return c.redirect(
|
|
2018
|
+
return c.redirect(
|
|
2019
|
+
agentSectionPath(agentId, "access", { error: message }),
|
|
2020
|
+
302,
|
|
2021
|
+
);
|
|
2013
2022
|
});
|
|
2014
2023
|
|
|
2015
2024
|
app.get("/admin/agents/:id/github-access", requireAuth, async (c) => {
|
|
@@ -2272,8 +2281,13 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2272
2281
|
},
|
|
2273
2282
|
);
|
|
2274
2283
|
|
|
2275
|
-
|
|
2276
|
-
const agentId = c.req.param("id");
|
|
2284
|
+
const agentDetailHandler = async (c: Context<AdminUIEnv, any>) => {
|
|
2285
|
+
const agentId = c.req.param("id") ?? "";
|
|
2286
|
+
const sectionParam = c.req.param("section") ?? "general";
|
|
2287
|
+
if (!isAgentSection(sectionParam)) {
|
|
2288
|
+
return new Response("Not found", { status: 404 });
|
|
2289
|
+
}
|
|
2290
|
+
const section: AgentSection = sectionParam;
|
|
2277
2291
|
const agent = await agentService.getDetail(agentId);
|
|
2278
2292
|
if (!agent) {
|
|
2279
2293
|
return new Response("Agent not found", { status: 404 });
|
|
@@ -2397,6 +2411,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2397
2411
|
c.var.userEmail,
|
|
2398
2412
|
c.var.isAdmin,
|
|
2399
2413
|
{
|
|
2414
|
+
section,
|
|
2400
2415
|
canManage: canManageAgents(c.var.isAdmin),
|
|
2401
2416
|
error,
|
|
2402
2417
|
newToken,
|
|
@@ -2415,7 +2430,16 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2415
2430
|
},
|
|
2416
2431
|
),
|
|
2417
2432
|
);
|
|
2418
|
-
}
|
|
2433
|
+
};
|
|
2434
|
+
app.get("/admin/agents/:id", requireAuth, agentDetailHandler);
|
|
2435
|
+
// Constrained to the known sections so other /admin/agents/:id/<x> GET routes
|
|
2436
|
+
// (extension-mounted pages) still match; an unknown section falls through to
|
|
2437
|
+
// the default 404.
|
|
2438
|
+
app.get(
|
|
2439
|
+
`/admin/agents/:id/:section{${AGENT_SECTIONS.join("|")}}`,
|
|
2440
|
+
requireAuth,
|
|
2441
|
+
agentDetailHandler,
|
|
2442
|
+
);
|
|
2419
2443
|
|
|
2420
2444
|
// ─── Env var mutations ────────────────────────────────────────────────────
|
|
2421
2445
|
|
|
@@ -2433,7 +2457,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2433
2457
|
value = formData.get("value")?.toString();
|
|
2434
2458
|
secretStr = formData.get("secret")?.toString();
|
|
2435
2459
|
} catch {
|
|
2436
|
-
return c.redirect(
|
|
2460
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2437
2461
|
}
|
|
2438
2462
|
if (key && value !== undefined) {
|
|
2439
2463
|
const isSecret = secretStr === "true";
|
|
@@ -2448,14 +2472,14 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2448
2472
|
// value) on the agent page instead of a 500.
|
|
2449
2473
|
if (err instanceof AnthropicCredentialsBlockedError) {
|
|
2450
2474
|
return c.redirect(
|
|
2451
|
-
|
|
2475
|
+
agentSectionPath(agentId, "configuration", { error: err.message }),
|
|
2452
2476
|
302,
|
|
2453
2477
|
);
|
|
2454
2478
|
}
|
|
2455
2479
|
throw err;
|
|
2456
2480
|
}
|
|
2457
2481
|
}
|
|
2458
|
-
return c.redirect(
|
|
2482
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2459
2483
|
});
|
|
2460
2484
|
|
|
2461
2485
|
app.post("/admin/agents/:id/envs/delete", requireAuth, async (c) => {
|
|
@@ -2468,31 +2492,38 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2468
2492
|
const formData = await c.req.formData();
|
|
2469
2493
|
key = formData.get("key")?.toString();
|
|
2470
2494
|
} catch {
|
|
2471
|
-
return c.redirect(
|
|
2495
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2472
2496
|
}
|
|
2473
2497
|
if (key) {
|
|
2474
2498
|
await agentEnvService.deleteKey(agentId, key);
|
|
2475
2499
|
}
|
|
2476
|
-
return c.redirect(
|
|
2500
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2477
2501
|
});
|
|
2478
2502
|
|
|
2479
2503
|
// ─── Agent template (ATP-2.4) ─────────────────────────────────────────────
|
|
2480
2504
|
// Thin forwards to the ATP-2.2 endpoints through the agents API seam, with
|
|
2481
2505
|
// the caller's session cookie, so its own auth and 409 rules apply.
|
|
2482
2506
|
|
|
2483
|
-
|
|
2507
|
+
// A per-item reset lands on the section whose row it was clicked from.
|
|
2508
|
+
const TEMPLATE_KIND_SECTIONS: Record<string, AgentSection> = {
|
|
2509
|
+
env: "configuration",
|
|
2510
|
+
tool: "extensions",
|
|
2511
|
+
plugin: "extensions",
|
|
2512
|
+
cron: "automation",
|
|
2513
|
+
};
|
|
2514
|
+
const TEMPLATE_KINDS = Object.keys(TEMPLATE_KIND_SECTIONS);
|
|
2484
2515
|
|
|
2485
2516
|
async function templateAction(
|
|
2486
2517
|
c: Context<AdminUIEnv>,
|
|
2487
2518
|
action: "detach" | "reattach" | "reset",
|
|
2488
2519
|
body?: Record<string, string>,
|
|
2520
|
+
section: AgentSection = "configuration",
|
|
2489
2521
|
): Promise<Response> {
|
|
2490
2522
|
const agentId = c.req.param("id") ?? "";
|
|
2491
2523
|
if (!agentsApi) return new Response("Not found", { status: 404 });
|
|
2492
2524
|
if (!(await assertAgentAccess(agentId, c.var.userEmail, c.var.isAdmin))) {
|
|
2493
2525
|
return new Response("Forbidden", { status: 403 });
|
|
2494
2526
|
}
|
|
2495
|
-
const base = `/admin/agents/${agentId}`;
|
|
2496
2527
|
const res = await callApi(
|
|
2497
2528
|
c,
|
|
2498
2529
|
agentsApi,
|
|
@@ -2507,7 +2538,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2507
2538
|
: {}),
|
|
2508
2539
|
},
|
|
2509
2540
|
);
|
|
2510
|
-
if (res?.ok) return c.redirect(
|
|
2541
|
+
if (res?.ok) return c.redirect(agentSectionPath(agentId, section), 302);
|
|
2511
2542
|
let message = "Could not update the agent template.";
|
|
2512
2543
|
try {
|
|
2513
2544
|
const j = (await res?.json()) as { error?: unknown };
|
|
@@ -2515,7 +2546,10 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2515
2546
|
} catch {
|
|
2516
2547
|
// keep the generic message
|
|
2517
2548
|
}
|
|
2518
|
-
return c.redirect(
|
|
2549
|
+
return c.redirect(
|
|
2550
|
+
agentSectionPath(agentId, section, { error: message }),
|
|
2551
|
+
302,
|
|
2552
|
+
);
|
|
2519
2553
|
}
|
|
2520
2554
|
|
|
2521
2555
|
app.post("/admin/agents/:id/template/detach", requireAuth, (c) =>
|
|
@@ -2538,11 +2572,18 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2538
2572
|
}
|
|
2539
2573
|
if (kind !== "" && (!TEMPLATE_KINDS.includes(kind) || key === "")) {
|
|
2540
2574
|
return c.redirect(
|
|
2541
|
-
|
|
2575
|
+
agentSectionPath(c.req.param("id"), "configuration", {
|
|
2576
|
+
error: "Unknown template item to reset.",
|
|
2577
|
+
}),
|
|
2542
2578
|
302,
|
|
2543
2579
|
);
|
|
2544
2580
|
}
|
|
2545
|
-
return templateAction(
|
|
2581
|
+
return templateAction(
|
|
2582
|
+
c,
|
|
2583
|
+
"reset",
|
|
2584
|
+
kind === "" ? {} : { kind, key },
|
|
2585
|
+
TEMPLATE_KIND_SECTIONS[kind] ?? "configuration",
|
|
2586
|
+
);
|
|
2546
2587
|
});
|
|
2547
2588
|
|
|
2548
2589
|
// ─── Repo mutations ───────────────────────────────────────────────────────
|
|
@@ -2557,11 +2598,13 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2557
2598
|
const formData = await c.req.formData();
|
|
2558
2599
|
repo = formData.get("repo")?.toString()?.trim();
|
|
2559
2600
|
} catch {
|
|
2560
|
-
return c.redirect(
|
|
2601
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2561
2602
|
}
|
|
2562
2603
|
if (!repo || !isOrgRepo(repo)) {
|
|
2563
2604
|
return c.redirect(
|
|
2564
|
-
|
|
2605
|
+
agentSectionPath(agentId, "configuration", {
|
|
2606
|
+
error: "invalid_repo_format",
|
|
2607
|
+
}),
|
|
2565
2608
|
302,
|
|
2566
2609
|
);
|
|
2567
2610
|
}
|
|
@@ -2574,12 +2617,12 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2574
2617
|
const collision = describeRepoNameCollision(deduped);
|
|
2575
2618
|
if (collision) {
|
|
2576
2619
|
return c.redirect(
|
|
2577
|
-
|
|
2620
|
+
agentSectionPath(agentId, "configuration", { error: collision }),
|
|
2578
2621
|
302,
|
|
2579
2622
|
);
|
|
2580
2623
|
}
|
|
2581
2624
|
await agentService.updateFields(agentId, { repos: deduped });
|
|
2582
|
-
return c.redirect(
|
|
2625
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2583
2626
|
});
|
|
2584
2627
|
|
|
2585
2628
|
app.post("/admin/agents/:id/repos/delete", requireAuth, async (c) => {
|
|
@@ -2592,7 +2635,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2592
2635
|
const formData = await c.req.formData();
|
|
2593
2636
|
repo = formData.get("repo")?.toString()?.trim();
|
|
2594
2637
|
} catch {
|
|
2595
|
-
return c.redirect(
|
|
2638
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2596
2639
|
}
|
|
2597
2640
|
if (repo) {
|
|
2598
2641
|
const agent = await agentService.getDetail(agentId);
|
|
@@ -2602,7 +2645,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2602
2645
|
const updated = (agent.repos ?? []).filter((r) => r !== repo);
|
|
2603
2646
|
await agentService.updateFields(agentId, { repos: updated });
|
|
2604
2647
|
}
|
|
2605
|
-
return c.redirect(
|
|
2648
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2606
2649
|
});
|
|
2607
2650
|
|
|
2608
2651
|
// ─── Author allowlist (review) mutations ───────────────────────────────────
|
|
@@ -2620,11 +2663,13 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2620
2663
|
const formData = await c.req.formData();
|
|
2621
2664
|
login = formData.get("login")?.toString()?.trim();
|
|
2622
2665
|
} catch {
|
|
2623
|
-
return c.redirect(
|
|
2666
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2624
2667
|
}
|
|
2625
2668
|
if (!login || !isGithubLogin(login)) {
|
|
2626
2669
|
return c.redirect(
|
|
2627
|
-
|
|
2670
|
+
agentSectionPath(agentId, "access", {
|
|
2671
|
+
error: "invalid_author_allowlist_format",
|
|
2672
|
+
}),
|
|
2628
2673
|
302,
|
|
2629
2674
|
);
|
|
2630
2675
|
}
|
|
@@ -2639,7 +2684,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2639
2684
|
await agentService.updateFields(agentId, {
|
|
2640
2685
|
reviewAuthorAllowlist: deduped,
|
|
2641
2686
|
});
|
|
2642
|
-
return c.redirect(
|
|
2687
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2643
2688
|
},
|
|
2644
2689
|
);
|
|
2645
2690
|
|
|
@@ -2656,7 +2701,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2656
2701
|
const formData = await c.req.formData();
|
|
2657
2702
|
login = formData.get("login")?.toString()?.trim();
|
|
2658
2703
|
} catch {
|
|
2659
|
-
return c.redirect(
|
|
2704
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2660
2705
|
}
|
|
2661
2706
|
if (login) {
|
|
2662
2707
|
const agent = await agentService.getDetail(agentId);
|
|
@@ -2670,7 +2715,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2670
2715
|
reviewAuthorAllowlist: updated,
|
|
2671
2716
|
});
|
|
2672
2717
|
}
|
|
2673
|
-
return c.redirect(
|
|
2718
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2674
2719
|
},
|
|
2675
2720
|
);
|
|
2676
2721
|
|
|
@@ -2689,11 +2734,13 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2689
2734
|
const formData = await c.req.formData();
|
|
2690
2735
|
login = formData.get("login")?.toString()?.trim();
|
|
2691
2736
|
} catch {
|
|
2692
|
-
return c.redirect(
|
|
2737
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2693
2738
|
}
|
|
2694
2739
|
if (!login || !isGithubLogin(login)) {
|
|
2695
2740
|
return c.redirect(
|
|
2696
|
-
|
|
2741
|
+
agentSectionPath(agentId, "access", {
|
|
2742
|
+
error: "invalid_author_allowlist_format",
|
|
2743
|
+
}),
|
|
2697
2744
|
302,
|
|
2698
2745
|
);
|
|
2699
2746
|
}
|
|
@@ -2708,7 +2755,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2708
2755
|
await agentService.updateFields(agentId, {
|
|
2709
2756
|
patchAuthorAllowlist: deduped,
|
|
2710
2757
|
});
|
|
2711
|
-
return c.redirect(
|
|
2758
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2712
2759
|
},
|
|
2713
2760
|
);
|
|
2714
2761
|
|
|
@@ -2725,7 +2772,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2725
2772
|
const formData = await c.req.formData();
|
|
2726
2773
|
login = formData.get("login")?.toString()?.trim();
|
|
2727
2774
|
} catch {
|
|
2728
|
-
return c.redirect(
|
|
2775
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2729
2776
|
}
|
|
2730
2777
|
if (login) {
|
|
2731
2778
|
const agent = await agentService.getDetail(agentId);
|
|
@@ -2739,7 +2786,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2739
2786
|
patchAuthorAllowlist: updated,
|
|
2740
2787
|
});
|
|
2741
2788
|
}
|
|
2742
|
-
return c.redirect(
|
|
2789
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
2743
2790
|
},
|
|
2744
2791
|
);
|
|
2745
2792
|
|
|
@@ -2769,7 +2816,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2769
2816
|
try {
|
|
2770
2817
|
formData = await c.req.formData();
|
|
2771
2818
|
} catch {
|
|
2772
|
-
return c.redirect(
|
|
2819
|
+
return c.redirect(agentSectionPath(agentId, "configuration"), 302);
|
|
2773
2820
|
}
|
|
2774
2821
|
|
|
2775
2822
|
const readBool = (name: string): boolean | undefined => {
|
|
@@ -2821,6 +2868,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2821
2868
|
agentMemberService,
|
|
2822
2869
|
agent.id,
|
|
2823
2870
|
agent.restrictSlackToMembers,
|
|
2871
|
+
settingsRedirectSection(formData),
|
|
2824
2872
|
);
|
|
2825
2873
|
});
|
|
2826
2874
|
|
|
@@ -2852,10 +2900,13 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2852
2900
|
enabled = enabledVal === "on" || enabledVal === "true";
|
|
2853
2901
|
name = formData.get("name")?.toString() || null;
|
|
2854
2902
|
} catch {
|
|
2855
|
-
return c.redirect(
|
|
2903
|
+
return c.redirect(agentSectionPath(agentId, "automation"), 302);
|
|
2856
2904
|
}
|
|
2857
2905
|
if (!schedule || !prompt) {
|
|
2858
|
-
return c.redirect(
|
|
2906
|
+
return c.redirect(
|
|
2907
|
+
agentSectionPath(agentId, "automation", { error: "missing_fields" }),
|
|
2908
|
+
302,
|
|
2909
|
+
);
|
|
2859
2910
|
}
|
|
2860
2911
|
try {
|
|
2861
2912
|
await agentCronJobService.create(agentId, {
|
|
@@ -2872,7 +2923,9 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2872
2923
|
const msg = err.message.toLowerCase();
|
|
2873
2924
|
if (msg.includes("invalid cron")) {
|
|
2874
2925
|
return c.redirect(
|
|
2875
|
-
|
|
2926
|
+
agentSectionPath(agentId, "automation", {
|
|
2927
|
+
error: "invalid_schedule",
|
|
2928
|
+
}),
|
|
2876
2929
|
302,
|
|
2877
2930
|
);
|
|
2878
2931
|
}
|
|
@@ -2882,14 +2935,19 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2882
2935
|
msg.includes("target")
|
|
2883
2936
|
) {
|
|
2884
2937
|
return c.redirect(
|
|
2885
|
-
|
|
2938
|
+
agentSectionPath(agentId, "automation", {
|
|
2939
|
+
error: "invalid_target",
|
|
2940
|
+
}),
|
|
2886
2941
|
302,
|
|
2887
2942
|
);
|
|
2888
2943
|
}
|
|
2889
2944
|
}
|
|
2890
|
-
return c.redirect(
|
|
2945
|
+
return c.redirect(
|
|
2946
|
+
agentSectionPath(agentId, "automation", { error: "create_failed" }),
|
|
2947
|
+
302,
|
|
2948
|
+
);
|
|
2891
2949
|
}
|
|
2892
|
-
return c.redirect(
|
|
2950
|
+
return c.redirect(agentSectionPath(agentId, "automation"), 302);
|
|
2893
2951
|
});
|
|
2894
2952
|
|
|
2895
2953
|
app.post("/admin/agents/:id/crons/:cronId/toggle", requireAuth, async (c) => {
|
|
@@ -2910,7 +2968,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2910
2968
|
} catch {
|
|
2911
2969
|
// ignore errors — redirect back regardless
|
|
2912
2970
|
}
|
|
2913
|
-
return c.redirect(
|
|
2971
|
+
return c.redirect(agentSectionPath(agentId, "automation"), 302);
|
|
2914
2972
|
});
|
|
2915
2973
|
|
|
2916
2974
|
app.post("/admin/agents/:id/crons/:cronId/update", requireAuth, async (c) => {
|
|
@@ -2936,7 +2994,9 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2936
2994
|
}
|
|
2937
2995
|
if (!schedule || !prompt) {
|
|
2938
2996
|
return c.redirect(
|
|
2939
|
-
|
|
2997
|
+
agentSectionPath(agentId, "automation", {
|
|
2998
|
+
error: "schedule and prompt are required",
|
|
2999
|
+
}),
|
|
2940
3000
|
302,
|
|
2941
3001
|
);
|
|
2942
3002
|
}
|
|
@@ -2948,7 +3008,9 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2948
3008
|
const existing = await agentCronJobService.get(agentId, cronId);
|
|
2949
3009
|
if (existing.system) {
|
|
2950
3010
|
return c.redirect(
|
|
2951
|
-
|
|
3011
|
+
agentSectionPath(agentId, "automation", {
|
|
3012
|
+
error: "system crons cannot be edited",
|
|
3013
|
+
}),
|
|
2952
3014
|
302,
|
|
2953
3015
|
);
|
|
2954
3016
|
}
|
|
@@ -2963,13 +3025,13 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2963
3025
|
} catch (err) {
|
|
2964
3026
|
// Surface validation errors (e.g. invalid cron expression) back to the page.
|
|
2965
3027
|
return c.redirect(
|
|
2966
|
-
|
|
2967
|
-
err instanceof Error ? err.message : "cron update failed",
|
|
2968
|
-
)
|
|
3028
|
+
agentSectionPath(agentId, "automation", {
|
|
3029
|
+
error: err instanceof Error ? err.message : "cron update failed",
|
|
3030
|
+
}),
|
|
2969
3031
|
302,
|
|
2970
3032
|
);
|
|
2971
3033
|
}
|
|
2972
|
-
return c.redirect(
|
|
3034
|
+
return c.redirect(agentSectionPath(agentId, "automation"), 302);
|
|
2973
3035
|
});
|
|
2974
3036
|
|
|
2975
3037
|
app.post("/admin/agents/:id/crons/:cronId/delete", requireAuth, async (c) => {
|
|
@@ -2987,13 +3049,13 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
2987
3049
|
} catch (err) {
|
|
2988
3050
|
if (err instanceof ForbiddenError) {
|
|
2989
3051
|
return c.redirect(
|
|
2990
|
-
|
|
3052
|
+
agentSectionPath(agentId, "automation", { error: err.message }),
|
|
2991
3053
|
302,
|
|
2992
3054
|
);
|
|
2993
3055
|
}
|
|
2994
3056
|
// other errors (NotFoundError, etc.) — redirect back silently
|
|
2995
3057
|
}
|
|
2996
|
-
return c.redirect(
|
|
3058
|
+
return c.redirect(agentSectionPath(agentId, "automation"), 302);
|
|
2997
3059
|
});
|
|
2998
3060
|
|
|
2999
3061
|
// ─── Tool mutations ───────────────────────────────────────────────────────
|
|
@@ -3008,17 +3070,20 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3008
3070
|
const formData = await c.req.formData();
|
|
3009
3071
|
pattern = formData.get("pattern")?.toString();
|
|
3010
3072
|
} catch {
|
|
3011
|
-
return c.redirect(
|
|
3073
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3012
3074
|
}
|
|
3013
3075
|
if (!pattern) {
|
|
3014
|
-
return c.redirect(
|
|
3076
|
+
return c.redirect(
|
|
3077
|
+
agentSectionPath(agentId, "extensions", { error: "missing_fields" }),
|
|
3078
|
+
302,
|
|
3079
|
+
);
|
|
3015
3080
|
}
|
|
3016
3081
|
try {
|
|
3017
3082
|
await agentToolService.add(agentId, pattern);
|
|
3018
3083
|
} catch {
|
|
3019
3084
|
// ignore errors — redirect back regardless
|
|
3020
3085
|
}
|
|
3021
|
-
return c.redirect(
|
|
3086
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3022
3087
|
});
|
|
3023
3088
|
|
|
3024
3089
|
app.post("/admin/agents/:id/tools/:toolId/toggle", requireAuth, async (c) => {
|
|
@@ -3039,7 +3104,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3039
3104
|
} catch {
|
|
3040
3105
|
// ignore errors — redirect back regardless
|
|
3041
3106
|
}
|
|
3042
|
-
return c.redirect(
|
|
3107
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3043
3108
|
});
|
|
3044
3109
|
|
|
3045
3110
|
app.post("/admin/agents/:id/tools/:toolId/delete", requireAuth, async (c) => {
|
|
@@ -3053,7 +3118,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3053
3118
|
} catch {
|
|
3054
3119
|
// ignore errors — redirect back regardless
|
|
3055
3120
|
}
|
|
3056
|
-
return c.redirect(
|
|
3121
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3057
3122
|
});
|
|
3058
3123
|
|
|
3059
3124
|
// ─── Marketplace mutations (PMK-1.5) ──────────────────────────────────────
|
|
@@ -3074,23 +3139,26 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3074
3139
|
source = formData.get("source")?.toString().trim();
|
|
3075
3140
|
ref = formData.get("ref")?.toString().trim() || undefined;
|
|
3076
3141
|
} catch {
|
|
3077
|
-
return c.redirect(
|
|
3142
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3078
3143
|
}
|
|
3079
3144
|
if (!name || !source) {
|
|
3080
|
-
return c.redirect(
|
|
3145
|
+
return c.redirect(
|
|
3146
|
+
agentSectionPath(agentId, "extensions", { error: "missing_fields" }),
|
|
3147
|
+
302,
|
|
3148
|
+
);
|
|
3081
3149
|
}
|
|
3082
3150
|
try {
|
|
3083
3151
|
await agentMarketplaceService?.upsert(agentId, { name, source, ref });
|
|
3084
3152
|
} catch (err) {
|
|
3085
3153
|
if (err instanceof UnprocessableEntityError) {
|
|
3086
3154
|
return c.redirect(
|
|
3087
|
-
|
|
3155
|
+
agentSectionPath(agentId, "extensions", { error: err.message }),
|
|
3088
3156
|
302,
|
|
3089
3157
|
);
|
|
3090
3158
|
}
|
|
3091
3159
|
// other errors — redirect back silently, like the tool routes
|
|
3092
3160
|
}
|
|
3093
|
-
return c.redirect(
|
|
3161
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3094
3162
|
});
|
|
3095
3163
|
|
|
3096
3164
|
app.post("/admin/agents/:id/marketplaces/delete", requireAuth, async (c) => {
|
|
@@ -3103,7 +3171,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3103
3171
|
const formData = await c.req.formData();
|
|
3104
3172
|
marketplaceId = formData.get("marketplaceId")?.toString();
|
|
3105
3173
|
} catch {
|
|
3106
|
-
return c.redirect(
|
|
3174
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3107
3175
|
}
|
|
3108
3176
|
if (marketplaceId) {
|
|
3109
3177
|
try {
|
|
@@ -3112,7 +3180,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3112
3180
|
// already gone, ignore
|
|
3113
3181
|
}
|
|
3114
3182
|
}
|
|
3115
|
-
return c.redirect(
|
|
3183
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3116
3184
|
});
|
|
3117
3185
|
|
|
3118
3186
|
// ─── Plugin mutations (PUI-1.2) ───────────────────────────────────────────
|
|
@@ -3130,11 +3198,11 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3130
3198
|
const formData = await c.req.formData();
|
|
3131
3199
|
raw = formData.get("spec")?.toString().trim();
|
|
3132
3200
|
} catch {
|
|
3133
|
-
return c.redirect(
|
|
3201
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3134
3202
|
}
|
|
3135
3203
|
const redirectError = (message: string) =>
|
|
3136
3204
|
c.redirect(
|
|
3137
|
-
|
|
3205
|
+
agentSectionPath(agentId, "extensions", { error: message }),
|
|
3138
3206
|
302,
|
|
3139
3207
|
);
|
|
3140
3208
|
if (!raw) return redirectError("missing_fields");
|
|
@@ -3146,7 +3214,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3146
3214
|
}
|
|
3147
3215
|
// other errors — redirect back silently, like the tool routes
|
|
3148
3216
|
}
|
|
3149
|
-
return c.redirect(
|
|
3217
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3150
3218
|
});
|
|
3151
3219
|
|
|
3152
3220
|
app.post("/admin/agents/:id/plugins/delete", requireAuth, async (c) => {
|
|
@@ -3159,7 +3227,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3159
3227
|
const formData = await c.req.formData();
|
|
3160
3228
|
pluginId = formData.get("pluginId")?.toString();
|
|
3161
3229
|
} catch {
|
|
3162
|
-
return c.redirect(
|
|
3230
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3163
3231
|
}
|
|
3164
3232
|
if (pluginId) {
|
|
3165
3233
|
try {
|
|
@@ -3168,7 +3236,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3168
3236
|
// already gone, ignore
|
|
3169
3237
|
}
|
|
3170
3238
|
}
|
|
3171
|
-
return c.redirect(
|
|
3239
|
+
return c.redirect(agentSectionPath(agentId, "extensions"), 302);
|
|
3172
3240
|
});
|
|
3173
3241
|
|
|
3174
3242
|
// ─── Token mutations ──────────────────────────────────────────────────────
|
|
@@ -3183,7 +3251,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3183
3251
|
const formData = await c.req.formData();
|
|
3184
3252
|
label = formData.get("label")?.toString() || undefined;
|
|
3185
3253
|
} catch {
|
|
3186
|
-
return c.redirect(
|
|
3254
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
3187
3255
|
}
|
|
3188
3256
|
const agent = await agentService.getDetail(agentId);
|
|
3189
3257
|
if (!agent) {
|
|
@@ -3258,6 +3326,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3258
3326
|
c.var.userEmail,
|
|
3259
3327
|
c.var.isAdmin,
|
|
3260
3328
|
{
|
|
3329
|
+
section: "access",
|
|
3261
3330
|
canManage: canManageAgents(c.var.isAdmin),
|
|
3262
3331
|
newToken: rawToken,
|
|
3263
3332
|
timezone,
|
|
@@ -3273,7 +3342,10 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3273
3342
|
),
|
|
3274
3343
|
);
|
|
3275
3344
|
} catch {
|
|
3276
|
-
return c.redirect(
|
|
3345
|
+
return c.redirect(
|
|
3346
|
+
agentSectionPath(agentId, "access", { error: "create_failed" }),
|
|
3347
|
+
302,
|
|
3348
|
+
);
|
|
3277
3349
|
}
|
|
3278
3350
|
});
|
|
3279
3351
|
|
|
@@ -3291,7 +3363,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3291
3363
|
} catch {
|
|
3292
3364
|
// ignore errors — redirect back regardless
|
|
3293
3365
|
}
|
|
3294
|
-
return c.redirect(
|
|
3366
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
3295
3367
|
},
|
|
3296
3368
|
);
|
|
3297
3369
|
|
|
@@ -3317,12 +3389,17 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3317
3389
|
const formData = await c.req.formData();
|
|
3318
3390
|
xoxpToken = formData.get("xoxpToken")?.toString();
|
|
3319
3391
|
} catch {
|
|
3320
|
-
return c.redirect(
|
|
3392
|
+
return c.redirect(
|
|
3393
|
+
agentSectionPath(agentId, "general", { error: "missing_fields" }),
|
|
3394
|
+
302,
|
|
3395
|
+
);
|
|
3321
3396
|
}
|
|
3322
3397
|
|
|
3323
3398
|
if (!xoxpToken?.startsWith("xoxe.xoxp-")) {
|
|
3324
3399
|
return c.redirect(
|
|
3325
|
-
|
|
3400
|
+
agentSectionPath(agentId, "general", {
|
|
3401
|
+
error: "Slack app configuration token must start with xoxe.xoxp-",
|
|
3402
|
+
}),
|
|
3326
3403
|
302,
|
|
3327
3404
|
);
|
|
3328
3405
|
}
|
|
@@ -3331,7 +3408,9 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3331
3408
|
const appId = envBundle?.env.SLACK_APP_ID;
|
|
3332
3409
|
if (!appId) {
|
|
3333
3410
|
return c.redirect(
|
|
3334
|
-
|
|
3411
|
+
agentSectionPath(agentId, "general", {
|
|
3412
|
+
error: "SLACK_APP_ID is not set — provision the agent first.",
|
|
3413
|
+
}),
|
|
3335
3414
|
302,
|
|
3336
3415
|
);
|
|
3337
3416
|
}
|
|
@@ -3344,7 +3423,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3344
3423
|
const msg =
|
|
3345
3424
|
err instanceof Error ? err.message : "Unknown error syncing manifest.";
|
|
3346
3425
|
return c.redirect(
|
|
3347
|
-
|
|
3426
|
+
agentSectionPath(agentId, "general", { error: msg }),
|
|
3348
3427
|
302,
|
|
3349
3428
|
);
|
|
3350
3429
|
}
|
|
@@ -3394,7 +3473,10 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3394
3473
|
);
|
|
3395
3474
|
}
|
|
3396
3475
|
|
|
3397
|
-
return c.redirect(
|
|
3476
|
+
return c.redirect(
|
|
3477
|
+
agentSectionPath(agentId, "general", { success: "manifest_synced" }),
|
|
3478
|
+
302,
|
|
3479
|
+
);
|
|
3398
3480
|
});
|
|
3399
3481
|
|
|
3400
3482
|
// ─── connect-slack (UAP-1.1) ───────────────────────────────────────────────
|
|
@@ -3414,7 +3496,10 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3414
3496
|
const formData = await c.req.formData();
|
|
3415
3497
|
xoxpToken = formData.get("xoxpToken")?.toString();
|
|
3416
3498
|
} catch {
|
|
3417
|
-
return c.redirect(
|
|
3499
|
+
return c.redirect(
|
|
3500
|
+
agentSectionPath(agentId, "access", { error: "missing_fields" }),
|
|
3501
|
+
302,
|
|
3502
|
+
);
|
|
3418
3503
|
}
|
|
3419
3504
|
|
|
3420
3505
|
const result = await slackProvisioningService.startConnect(
|
|
@@ -3425,7 +3510,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3425
3510
|
|
|
3426
3511
|
if (!result.ok) {
|
|
3427
3512
|
return c.redirect(
|
|
3428
|
-
|
|
3513
|
+
agentSectionPath(agentId, "access", { error: result.error }),
|
|
3429
3514
|
302,
|
|
3430
3515
|
);
|
|
3431
3516
|
}
|
|
@@ -3503,7 +3588,10 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3503
3588
|
const query = ghConnectWarning
|
|
3504
3589
|
? `?success=reinstalled&warning=${encodeURIComponent(ghConnectWarning)}`
|
|
3505
3590
|
: "?success=reinstalled";
|
|
3506
|
-
return c.redirect(
|
|
3591
|
+
return c.redirect(
|
|
3592
|
+
`${agentSectionPath(result.agentId, "access")}${query}`,
|
|
3593
|
+
302,
|
|
3594
|
+
);
|
|
3507
3595
|
}
|
|
3508
3596
|
|
|
3509
3597
|
// result.outcome === "needs_app_token"
|
|
@@ -3822,7 +3910,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3822
3910
|
const result = await githubProvisioningService.getAddOrgUrl(agentId);
|
|
3823
3911
|
if (!result.ok) {
|
|
3824
3912
|
return c.redirect(
|
|
3825
|
-
|
|
3913
|
+
agentSectionPath(agentId, "access", { error: result.error }),
|
|
3826
3914
|
302,
|
|
3827
3915
|
);
|
|
3828
3916
|
}
|
|
@@ -3848,7 +3936,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3848
3936
|
const formData = await c.req.formData();
|
|
3849
3937
|
email = formData.get("email")?.toString()?.toLowerCase();
|
|
3850
3938
|
} catch {
|
|
3851
|
-
return c.redirect(
|
|
3939
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
3852
3940
|
}
|
|
3853
3941
|
if (email) {
|
|
3854
3942
|
try {
|
|
@@ -3857,7 +3945,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3857
3945
|
// unique constraint violation — already a member, ignore
|
|
3858
3946
|
}
|
|
3859
3947
|
}
|
|
3860
|
-
return c.redirect(
|
|
3948
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
3861
3949
|
});
|
|
3862
3950
|
|
|
3863
3951
|
app.post("/admin/agents/:id/members/delete", requireAuth, async (c) => {
|
|
@@ -3872,7 +3960,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3872
3960
|
const formData = await c.req.formData();
|
|
3873
3961
|
memberId = formData.get("memberId")?.toString();
|
|
3874
3962
|
} catch {
|
|
3875
|
-
return c.redirect(
|
|
3963
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
3876
3964
|
}
|
|
3877
3965
|
if (memberId) {
|
|
3878
3966
|
try {
|
|
@@ -3881,7 +3969,7 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
3881
3969
|
// already gone, ignore
|
|
3882
3970
|
}
|
|
3883
3971
|
}
|
|
3884
|
-
return c.redirect(
|
|
3972
|
+
return c.redirect(agentSectionPath(agentId, "access"), 302);
|
|
3885
3973
|
});
|
|
3886
3974
|
|
|
3887
3975
|
// ─── Enterprise GitHub apps settings (GHE-1.4) ───────────────────────────
|
|
@@ -4752,9 +4840,9 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
4752
4840
|
// steps still need a retry.
|
|
4753
4841
|
const failedSteps = result.failed.map((f) => f.step).join(", ");
|
|
4754
4842
|
return c.redirect(
|
|
4755
|
-
|
|
4756
|
-
`Cleanup incomplete — retry. Failed steps: ${failedSteps}`,
|
|
4757
|
-
)
|
|
4843
|
+
agentSectionPath(agentId, "general", {
|
|
4844
|
+
error: `Cleanup incomplete — retry. Failed steps: ${failedSteps}`,
|
|
4845
|
+
}),
|
|
4758
4846
|
302,
|
|
4759
4847
|
);
|
|
4760
4848
|
}
|
|
@@ -4769,11 +4857,11 @@ export function createAdminUIApp(deps: AdminUIDeps): Hono<AdminUIEnv> {
|
|
|
4769
4857
|
302,
|
|
4770
4858
|
);
|
|
4771
4859
|
} catch (err) {
|
|
4772
|
-
const msg =
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4860
|
+
const msg = err instanceof Error ? err.message : "delete_failed";
|
|
4861
|
+
return c.redirect(
|
|
4862
|
+
agentSectionPath(agentId, "general", { error: msg }),
|
|
4863
|
+
302,
|
|
4864
|
+
);
|
|
4777
4865
|
}
|
|
4778
4866
|
});
|
|
4779
4867
|
|