Migrate the orchestration coordination package from v0 with full file-based mission/task lifecycle management. Adds gateway REST API at /api/coord/* and agent tools for coord queries. Package modules: - types: Mission, task, session, milestone type definitions - mission: Create, load, save missions with atomic file writes - tasks-file: TASKS.md markdown table parsing/generation with file locking - runner: Task execution subprocess spawning with session locks - status: Mission and task status queries Gateway integration: - CoordModule with CoordService wrapping coord functions - CoordController exposing status/tasks/task-detail endpoints - Agent tools: coord_mission_status, coord_list_tasks, coord_task_detail Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { Controller, Get, NotFoundException, Param, Query, UseGuards } from '@nestjs/common';
|
|
import { AuthGuard } from '../auth/auth.guard.js';
|
|
import { CoordService } from './coord.service.js';
|
|
|
|
@Controller('api/coord')
|
|
@UseGuards(AuthGuard)
|
|
export class CoordController {
|
|
constructor(private readonly coordService: CoordService) {}
|
|
|
|
@Get('status')
|
|
async missionStatus(@Query('projectPath') projectPath?: string) {
|
|
const resolvedPath = projectPath ?? process.cwd();
|
|
const status = await this.coordService.getMissionStatus(resolvedPath);
|
|
if (!status) throw new NotFoundException('No active coord mission found');
|
|
return status;
|
|
}
|
|
|
|
@Get('tasks')
|
|
async listTasks(@Query('projectPath') projectPath?: string) {
|
|
const resolvedPath = projectPath ?? process.cwd();
|
|
return this.coordService.listTasks(resolvedPath);
|
|
}
|
|
|
|
@Get('tasks/:taskId')
|
|
async taskStatus(@Param('taskId') taskId: string, @Query('projectPath') projectPath?: string) {
|
|
const resolvedPath = projectPath ?? process.cwd();
|
|
const detail = await this.coordService.getTaskStatus(resolvedPath, taskId);
|
|
if (!detail) throw new NotFoundException(`Task ${taskId} not found in coord mission`);
|
|
return detail;
|
|
}
|
|
}
|