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
@@ -24,7 +24,9 @@ import {
import type { CatalogEntry, TopologyGraph } from "@/lib/api/topology";
import { RepoPicker, type PickedRepo } from "./RepoPicker";
import { NoAgentsGate } from "./NoAgentsGate";
import { fetchClaws } from "@/lib/api/team";
// Do NOT import @/lib/api/team here — it transitively pulls bearer.ts
// (next/headers, server-only) into the client bundle and breaks the
// production build. Call /api/team/claws with plain fetch instead.
import type { Agent } from "@/lib/api/schemas";
import {
LoopStaffingStep,
@@ -133,7 +135,9 @@ export function LoopsWizard({
let cancelled = false;
(async () => {
try {
const claws = await fetchClaws();
const r = await fetch("/api/team/claws");
if (!r.ok) throw new Error(`${r.status}`);
const claws = (await r.json()) as Agent[];
if (cancelled) return;
setRosterAgents(claws);
if (agentsCount === undefined) setRosterCount(claws.length);