🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(agent): implement agent_pool fill instead of returning 'Unknown action' (#4561)
Aaditya04c637782f07
diff --git a/v3/@claude-flow/cli/__tests__/agent-pool-scaling-r50.test.ts b/v3/@claude-flow/cli/__tests__/agent-pool-scaling-r50.test.tsindex bcb166d534..a98c3ccf29 100644--- a/v3/@claude-flow/cli/__tests__/agent-pool-scaling-r50.test.ts+++ b/v3/@claude-flow/cli/__tests__/agent-pool-scaling-r50.test.ts@@ -35,3 +35,20 @@ it.each([-1, 1.5, NaN])('rejects invalid target %s without writing', async targeit('adds exactly the requested number for a valid scale-up', async () => {expect(await scale(3)).toMatchObject({ newSize: 3, added: [expect.any(String)], removed: [] });});+// #4555: 'fill' was in the action enum but returned { error: 'Unknown action' }.+const fill = (targetSize: number) => agentTools.find(t => t.name === 'agent_pool')!.handler({ action: 'fill', agentType: 'coder', targetSize }) as Promise<any>;+it('fill grows the pool to the target with idle agents', async () => {+ const result = await fill(4);+ expect(result).toMatchObject({ action: 'fill', previousSize: 2, targetSize: 4, newSize: 4, removed: [] });+ expect(result.added).toHaveLength(2);+ const agents = JSON.parse(readFileSync(path(), 'utf8')).agents;+ for (const id of result.added) expect(agents[id]).toMatchObject({ agentType: 'coder', status: 'idle' });+});+it('fill never shrinks: a target below the current size terminates nothing', async () => {+ const before = readFileSync(path(), 'utf8');+ expect(await fill(0)).toMatchObject({ action: 'fill', previousSize: 2, newSize: 2, added: [], removed: [] });+ expect(JSON.parse(readFileSync(path(), 'utf8')).agents).toEqual(JSON.parse(before).agents);+});+it.each([-1, 1.5])('fill rejects invalid target %s like scale does', async target => {+ expect(await fill(target)).toMatchObject({ error: expect.any(String) });+});diff --git a/v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/agent-tools.tsindex e25d7826e0..17bab90db7 100644--- a/v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts+++ b/v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts@@ -701,7 +701,7 @@ export const agentTools: MCPTool[] = [type: 'object',properties: {action: { type: 'string', enum: ['status', 'scale', 'drain', 'fill'], description: 'Pool action' },- targetSize: { type: 'number', description: 'Target pool size (for scale action)' },+ targetSize: { type: 'number', description: 'Target pool size (scale: grow or shrink to it; fill: grow to it, never shrink)' },agentType: { type: 'string', description: 'Agent type filter' },},required: ['action'],@@ -750,7 +750,9 @@ export const agentTools: MCPTool[] = [};}- if (action === 'scale') {+ // #4555: fill was advertised in the enum but had no branch. It is scale+ // without the shrink step: grow agentType's pool to targetSize, never terminate.+ if (action === 'scale' || action === 'fill') {const targetSize = input.targetSize === undefined ? 5 : input.targetSize;if (typeof targetSize !== 'number' || !Number.isSafeInteger(targetSize) || targetSize < 0) {return { action, error: 'targetSize must be a non-negative safe integer' };@@ -775,7 +777,7 @@ export const agentTools: MCPTool[] = [};added.push(agentId);}- } else if (delta < 0) {+ } else if (delta < 0 && action === 'scale') {const toRemove = agents.filter(a => a.agentType === agentType && a.status === 'idle').slice(0, -delta);for (const agent of toRemove) {store.agents[agent.agentId].status = 'terminated';