Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions apps/mcp-server/src/agent/agent.types.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { describe, it, expect } from 'vitest';
import type {
TaskmaestroAssignment,
TaskmaestroDispatch,
DispatchAgentsInput,
DispatchResult,
} from './agent.types';

describe('agent.types - TaskMaestro types', () => {
describe('TaskmaestroAssignment', () => {
it('accepts object with name, displayName, prompt', () => {
const assignment: TaskmaestroAssignment = {
name: 'frontend-dev',
displayName: 'Frontend Developer',
prompt: 'Implement the UI component',
};
expect(assignment.name).toBe('frontend-dev');
expect(assignment.displayName).toBe('Frontend Developer');
expect(assignment.prompt).toBe('Implement the UI component');
});
});

describe('TaskmaestroDispatch', () => {
it('accepts object with sessionName, paneCount, assignments', () => {
const dispatch: TaskmaestroDispatch = {
sessionName: 'workspace-1',
paneCount: 3,
assignments: [{ name: 'dev-1', displayName: 'Dev 1', prompt: 'Task 1' }],
};
expect(dispatch.sessionName).toBe('workspace-1');
expect(dispatch.paneCount).toBe(3);
expect(dispatch.assignments).toHaveLength(1);
});
});

describe('DispatchAgentsInput - executionStrategy', () => {
it('accepts executionStrategy: subagent', () => {
const input: DispatchAgentsInput = {
mode: 'PLAN',
executionStrategy: 'subagent',
};
expect(input.executionStrategy).toBe('subagent');
});

it('accepts executionStrategy: taskmaestro', () => {
const input: DispatchAgentsInput = {
mode: 'ACT',
executionStrategy: 'taskmaestro',
};
expect(input.executionStrategy).toBe('taskmaestro');
});

it('executionStrategy is optional', () => {
const input: DispatchAgentsInput = { mode: 'PLAN' };
expect(input.executionStrategy).toBeUndefined();
});
});

describe('DispatchResult - taskmaestro fields', () => {
it('accepts optional taskmaestro dispatch data', () => {
const result: DispatchResult = {
executionHint: 'Use taskmaestro for parallel execution',
taskmaestro: {
sessionName: 'ws-1',
paneCount: 2,
assignments: [],
},
executionStrategy: 'taskmaestro',
};
expect(result.taskmaestro?.sessionName).toBe('ws-1');
expect(result.executionStrategy).toBe('taskmaestro');
});

it('taskmaestro and executionStrategy are optional', () => {
const result: DispatchResult = {
executionHint: 'Use subagent',
};
expect(result.taskmaestro).toBeUndefined();
expect(result.executionStrategy).toBeUndefined();
});
});
});
24 changes: 24 additions & 0 deletions apps/mcp-server/src/agent/agent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ export interface DispatchedAgent {
dispatchParams: DispatchParams;
}

/**
* A single TaskMaestro pane assignment with agent name and prompt
*/
export interface TaskmaestroAssignment {
name: string;
displayName: string;
prompt: string;
}

/**
* TaskMaestro dispatch configuration for parallel tmux pane execution
*/
export interface TaskmaestroDispatch {
sessionName: string;
paneCount: number;
assignments: TaskmaestroAssignment[];
}

/**
* Result of dispatching agents for execution
*/
Expand All @@ -82,6 +100,10 @@ export interface DispatchResult {
executionHint: string;
/** Agents that failed to load */
failedAgents?: FailedAgent[];
/** TaskMaestro dispatch data when executionStrategy is 'taskmaestro' */
taskmaestro?: TaskmaestroDispatch;
/** Execution strategy used for this dispatch */
executionStrategy?: string;
}

/**
Expand All @@ -94,6 +116,8 @@ export interface DispatchAgentsInput {
specialists?: string[];
includeParallel?: boolean;
primaryAgent?: string;
/** Execution strategy: 'subagent' (default) or 'taskmaestro' */
executionStrategy?: 'subagent' | 'taskmaestro';
}

/**
Expand Down
4 changes: 4 additions & 0 deletions apps/mcp-server/src/keyword/keyword.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ export interface ParseModeResult {
* without needing to call dispatch_agents or prepare_parallel_agents.
*/
dispatchReady?: DispatchReady;
/** @apiProperty External API - do not rename. Available execution strategies (e.g. ['subagent', 'taskmaestro']) */
availableStrategies?: string[];
/** @apiProperty External API - do not rename. Hint for installing TaskMaestro when not available */
taskmaestroInstallHint?: string;
}

/**
Expand Down
50 changes: 45 additions & 5 deletions apps/mcp-server/src/tui/components/FlowMap.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,15 @@ describe('tui/components/FlowMap', () => {
}),
);
const { lastFrame } = render(
<FlowMap agents={agents} edges={[]} layoutMode="narrow" width={60} height={10} tick={0} now={now} />,
<FlowMap
agents={agents}
edges={[]}
layoutMode="narrow"
width={60}
height={10}
tick={0}
now={now}
/>,
);
const frame = lastFrame() ?? '';
expect(frame).toContain(pulseIcon(0));
Expand All @@ -136,7 +144,15 @@ describe('tui/components/FlowMap', () => {
}),
);
const { lastFrame } = render(
<FlowMap agents={agents} edges={makeEdges()} layoutMode="wide" width={120} height={20} tick={2} now={now} />,
<FlowMap
agents={agents}
edges={makeEdges()}
layoutMode="wide"
width={120}
height={20}
tick={2}
now={now}
/>,
);
const frame = lastFrame() ?? '';
expect(frame).toContain(pulseIcon(2));
Expand All @@ -157,7 +173,15 @@ describe('tui/components/FlowMap', () => {
}),
);
const { lastFrame } = render(
<FlowMap agents={agents} edges={[]} layoutMode="narrow" width={60} height={10} tick={3} now={now} />,
<FlowMap
agents={agents}
edges={[]}
layoutMode="narrow"
width={60}
height={10}
tick={3}
now={now}
/>,
);
const frame = lastFrame() ?? '';
// idle agent should NOT have pulse icons
Expand Down Expand Up @@ -190,10 +214,26 @@ describe('tui/components/FlowMap', () => {
}),
);
const { lastFrame: frame0 } = render(
<FlowMap agents={agents} edges={[]} layoutMode="narrow" width={60} height={10} tick={0} now={now} />,
<FlowMap
agents={agents}
edges={[]}
layoutMode="narrow"
width={60}
height={10}
tick={0}
now={now}
/>,
);
const { lastFrame: frame1 } = render(
<FlowMap agents={agents} edges={[]} layoutMode="narrow" width={60} height={10} tick={1} now={now} />,
<FlowMap
agents={agents}
edges={[]}
layoutMode="narrow"
width={60}
height={10}
tick={1}
now={now}
/>,
);
expect(frame0()).toContain('●');
expect(frame1()).toContain('◉');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ describe('tui/components/FocusedAgentPanel', () => {
agent={mockAgent}
activeSkills={[]}
objectives={[]}
eventLog={[
{ timestamp: '10:12:01', message: 'ACT start', level: 'info' },
]}
eventLog={[{ timestamp: '10:12:01', message: 'ACT start', level: 'info' }]}
/>,
);
const frame = lastFrame() ?? '';
Expand Down
4 changes: 1 addition & 3 deletions apps/mcp-server/src/tui/components/FocusedAgentPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ export function FocusedAgentPanel({
</Text>
)}
<Text color={statusColor}>{statusLabel}</Text>
{showElapsed && (
<Text dimColor>{formatElapsed(agent.startedAt!, now!)}</Text>
)}
{showElapsed && <Text dimColor>{formatElapsed(agent.startedAt!, now!)}</Text>}
<Text dimColor>{agent.stage}</Text>
</Box>

Expand Down
8 changes: 2 additions & 6 deletions apps/mcp-server/src/tui/components/HeaderBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ export function HeaderBar({
<ModeFlow currentMode={currentMode} />
<Box flexGrow={1} />
<StateIndicator globalState={globalState} tick={tick} />
{now !== undefined && (
<Text dimColor> {formatTimeWithSeconds(now)}</Text>
)}
{now !== undefined && <Text dimColor> {formatTimeWithSeconds(now)}</Text>}
</Box>
);
}
Expand All @@ -122,9 +120,7 @@ export function HeaderBar({
</Text>
<ModeFlow currentMode={currentMode} />
<StateIndicator globalState={globalState} tick={tick} />
{now !== undefined && (
<Text dimColor>{formatTimeWithSeconds(now)}</Text>
)}
{now !== undefined && <Text dimColor>{formatTimeWithSeconds(now)}</Text>}
</Box>
<Box flexGrow={1} />
<Box flexShrink={1} overflowX="hidden">
Expand Down
Loading