Nicholai 7f5efb84e2 feat(agent): migrate to Anthropic Agents SDK
Replace Vercel AI SDK with Anthropic Claude Agent SDK.
Add standalone agent server (packages/agent-server/)
with MCP tools, JWT auth, and SSE streaming. Introduce
bridge API routes (src/app/api/compass/) and custom
SSE hooks (use-agent, use-compass-chat) replacing
useChat. Remove provider.ts, tools.ts, system-prompt.ts,
github-tools.ts, usage.ts, and old agent route.
2026-02-16 18:37:26 -07:00

28 lines
701 B
TypeScript

/**
* Shared HTTP client for calling the Compass Workers API.
* All MCP tools use this to interact with the Compass backend.
*/
export async function compassApi<T>(
baseUrl: string,
path: string,
authToken: string,
body?: unknown
): Promise<T> {
const res = await fetch(`${baseUrl}${path}`, {
method: body ? "POST" : "GET",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${authToken}`,
},
body: body ? JSON.stringify(body) : undefined,
})
if (!res.ok) {
const err = await res.json().catch(() => ({ error: res.statusText }))
throw new Error(err.error ?? `API error ${res.status}`)
}
return res.json() as Promise<T>
}