| 224 | } |
| 225 | |
| 226 | export async function setIssueDefaultAgent(agent: string | null): Promise<string | null> { |
| 227 | const res = await fetch('/api/config/issue-default-agent', { |
| 228 | method: 'PUT', |
| 229 | headers: { 'content-type': 'application/json' }, |
| 230 | body: JSON.stringify({ agent }), |
| 231 | }); |
| 232 | if (!res.ok) { |
| 233 | const msg = await res.text().catch(() => ''); |
| 234 | throw new Error(`set issue default agent failed: ${res.status} ${msg}`); |
| 235 | } |
| 236 | const body = (await res.json()) as { agent?: string | null }; |
| 237 | return body.agent ?? null; |
| 238 | } |
| 239 | |
| 240 | // ── sessions ───────────────────────────────────────────────────────────────── |
| 241 | // |