loops wizard: stop pulling bearer.ts into the client bundle
ci / gates (push) Successful in 6s
ci / frontend (push) Successful in 36s
ci / rust (push) Successful in 2m43s
ci / e2e (push) Has been skipped
ci / publish (push) Successful in 2m31s

Same trap the pre-existing topology import comment warned about:
importing from @/lib/api/team or @/lib/api/structure drags http.ts
→ bearer.ts (uses next/headers, server-only) into the client
bundle and Turbopack refuses to build.

Replace fetchClaws / fetchTeams / fetchOrgs with plain fetch() to
/api/team/claws, /api/teams, /api/orgs. Types are inlined where
they were only used for the shape of the JSON response.
This commit is contained in:
Omar Sobh
2026-07-08 09:37:55 -07:00
parent 6e10528bc2
commit 1a2baee74b
2 changed files with 23 additions and 4 deletions
@@ -14,7 +14,17 @@ import { useEffect, useMemo, useState } from "react";
import { Building2, User, Users } from "lucide-react";
import type { Agent } from "@/lib/api/schemas";
import { fetchOrgs, fetchTeams, type GroupSummary } from "@/lib/api/structure";
// Do NOT import @/lib/api/structure — pulls bearer.ts (next/headers,
// server-only) into the client bundle and breaks the production build.
// Call /api/teams and /api/orgs with plain fetch instead.
interface GroupSummary {
id: string;
name: string;
kind: string;
status: string;
created_at: string;
}
const mono =
"ui-monospace, SFMono-Regular, SF Mono, Menlo, Monaco, Consolas, monospace";
@@ -50,8 +60,13 @@ export function LoopStaffingStep({
let cancelled = false;
(async () => {
try {
const [t, o] = await Promise.all([fetchTeams(), fetchOrgs()]);
const [tRes, oRes] = await Promise.all([
fetch("/api/teams"),
fetch("/api/orgs"),
]);
if (cancelled) return;
const t = tRes.ok ? ((await tRes.json()) as GroupSummary[]) : [];
const o = oRes.ok ? ((await oRes.json()) as GroupSummary[]) : [];
setTeams(t);
setOrgs(o);
} catch (e) {