( wsId: string, agent: string, )
| 634 | |
| 635 | /** Which vault credential a workspace's agent is currently configured with (null = none/hand-edited). */ |
| 636 | export async function detectWorkspaceCredential( |
| 637 | wsId: string, |
| 638 | agent: string, |
| 639 | ): Promise<{ slug: string | null; model: string | null }> { |
| 640 | const res = await fetch( |
| 641 | `/api/workspaces/${encodeURIComponent(wsId)}/agent-config/${encodeURIComponent(agent)}/credential`, |
| 642 | ); |
| 643 | if (!res.ok) return { slug: null, model: null }; |
| 644 | return (await res.json()) as { slug: string | null; model: string | null }; |
| 645 | } |
| 646 | |
| 647 | /** Persist a hand-entered provider as a reusable central credential. Returns the slug. */ |
| 648 | export async function saveCredential(input: { |
no test coverage detected