loops wizard: stop pulling bearer.ts into the client bundle
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user