diff options
| author | Adam Malczewski <[email protected]> | 2026-05-23 05:06:12 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-05-23 05:06:12 +0900 |
| commit | 9287cccb29d135ea19f2612c26f3090c94820d8c (patch) | |
| tree | 2d68e8cacf6d71786f305d5f4a512a68f19137c5 /packages/api/src/routes | |
| parent | ef427d3eae77fca716c203dd8bd84939710c518a (diff) | |
| download | dispatch-9287cccb29d135ea19f2612c26f3090c94820d8c.tar.gz dispatch-9287cccb29d135ea19f2612c26f3090c94820d8c.zip | |
feat: add is_subagent flag to agents, fix all lint/type/test issues
- Add is_subagent checkbox to agent editor; subagents are hidden from Chat Settings
- Add is_subagent field to AgentDefinition type, TOML serialization, and API route
- Filter subagents from ModelSelector agent list
- Fix all biome lint/format errors across codebase (useLiteralKeys, noNonNullAssertion, noExplicitAny, formatting, import sorting)
- Fix svelte-check errors (type narrowing in SkillsBrowser, ToolPermissions, SidebarPanel)
- Fix a11y warnings in App.svelte (label-control associations)
- Fix test mocks missing BackgroundShellStore, BackgroundTranscriptStore, createWebSearchTool, createYoutubeTranscribeTool
- Update stale 409 test to match current message-queuing behavior
- Exclude packaging/ and release/ dirs from biome to avoid linting stale build artifacts
Diffstat (limited to 'packages/api/src/routes')
| -rw-r--r-- | packages/api/src/routes/agents.ts | 1 | ||||
| -rw-r--r-- | packages/api/src/routes/models.ts | 12 |
2 files changed, 6 insertions, 7 deletions
diff --git a/packages/api/src/routes/agents.ts b/packages/api/src/routes/agents.ts index 42339bf..d3ca23f 100644 --- a/packages/api/src/routes/agents.ts +++ b/packages/api/src/routes/agents.ts @@ -56,6 +56,7 @@ agentsRoutes.post("/", async (c) => { scope: body.scope, slug: body.slug, ...(body.cwd ? { cwd: body.cwd } : {}), + ...(body.is_subagent ? { is_subagent: true } : {}), }; saveAgent(agent); return c.json({ ok: true, agent }); diff --git a/packages/api/src/routes/models.ts b/packages/api/src/routes/models.ts index d6b82c2..b250263 100644 --- a/packages/api/src/routes/models.ts +++ b/packages/api/src/routes/models.ts @@ -112,7 +112,7 @@ modelsRoutes.get("/available", async (c) => { }); } - const apiKeyValue = resolveApiKey(keyId!); + const apiKeyValue = resolveApiKey(keyId); if (!apiKeyValue) { return c.json({ error: `no API key found for ${keyId}` }, 500); } @@ -420,10 +420,7 @@ modelsRoutes.post("/add-key", async (c) => { // Validate provider if (!VALID_PROVIDERS.includes(body.provider as SupportedProvider)) { - return c.json( - { error: `provider must be one of: ${VALID_PROVIDERS.join(", ")}` }, - 400, - ); + return c.json({ error: `provider must be one of: ${VALID_PROVIDERS.join(", ")}` }, 400); } const provider = body.provider as SupportedProvider; const base_url = PROVIDER_BASE_URLS[provider]; @@ -452,7 +449,7 @@ modelsRoutes.post("/add-key", async (c) => { newBlock += "\n"; // Insert before the # ─── Permissions section if it exists, otherwise at end - const permissionsMarker = /\n# [─\-]+ Permissions/; + const permissionsMarker = /\n# [─-]+ Permissions/; let newContent: string; const permMatch = permissionsMarker.exec(tomlContent); if (permMatch) { @@ -509,7 +506,8 @@ modelsRoutes.post("/remove-key", async (c) => { return c.json({ error: `key "${id}" not found in dispatch.toml` }, 404); } - const newContent = tomlContent.slice(0, match.index) + tomlContent.slice(match.index + match[0].length); + const newContent = + tomlContent.slice(0, match.index) + tomlContent.slice(match.index + match[0].length); try { writeFileSync(tomlPath, newContent, "utf-8"); |
