From 2ee988ccc04c09ceb6de7cdb75c94114e85d01b9 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sat, 14 Mar 2026 00:39:22 +0000 Subject: feat: add agent selector to UI and support direct agent assignment - Added an agent selector (Auto, Claude, Gemini) to the Start Next Task button. - Updated the backend to pass query parameters as environment variables to scripts. - Modified the executor pool to skip classification when a specific agent is requested. - Added --agent flag to claudomator start command. - Updated tests to cover the new functionality. --- web/test/start-next-task.test.mjs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'web/test') diff --git a/web/test/start-next-task.test.mjs b/web/test/start-next-task.test.mjs index 6863f7e..eaf3087 100644 --- a/web/test/start-next-task.test.mjs +++ b/web/test/start-next-task.test.mjs @@ -9,8 +9,11 @@ import assert from 'node:assert/strict'; // Returns {output, exit_code} on HTTP 2xx // Throws on HTTP error -async function startNextTask(basePath, fetchFn) { - const res = await fetchFn(`${basePath}/api/scripts/start-next-task`, { method: 'POST' }); +async function startNextTask(basePath, fetchFn, agent) { + const url = agent && agent !== 'auto' + ? `${basePath}/api/scripts/start-next-task?agent=${agent}` + : `${basePath}/api/scripts/start-next-task`; + const res = await fetchFn(url, { method: 'POST' }); if (!res.ok) { let msg = `HTTP ${res.status}`; try { const body = await res.json(); msg = body.error || msg; } catch {} @@ -35,6 +38,20 @@ describe('startNextTask', () => { assert.equal(captured.opts.method, 'POST'); }); + it('appends agent as query parameter when provided', async () => { + let captured = null; + const mockFetch = (url, opts) => { + captured = { url, opts }; + return Promise.resolve({ + ok: true, + json: () => Promise.resolve({ output: 'claudomator start --agent claude abc-123\n', exit_code: 0 }), + }); + }; + + await startNextTask('http://localhost:8484', mockFetch, 'claude'); + assert.equal(captured.url, 'http://localhost:8484/api/scripts/start-next-task?agent=claude'); + }); + it('returns output and exit_code on success', async () => { const mockFetch = () => Promise.resolve({ ok: true, -- cgit v1.2.3