feat: Master Orchestrator — persistent chat with full project context and awareness tools
Made-with: Cursor
This commit is contained in:
@@ -8,6 +8,7 @@ import { createJob, getJob, listJobs, updateJob } from './job-store';
|
||||
import { runAgent } from './agent-runner';
|
||||
import { AGENTS } from './agents';
|
||||
import { ToolContext } from './tools';
|
||||
import { orchestratorChat, listSessions, clearSession } from './orchestrator';
|
||||
|
||||
const app = express();
|
||||
app.use(cors());
|
||||
@@ -164,6 +165,34 @@ app.get('/api/jobs/:id', (req: Request, res: Response) => {
|
||||
res.json(job);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Orchestrator — persistent chat with full project context
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
app.post('/orchestrator/chat', async (req: Request, res: Response) => {
|
||||
const { message, session_id } = req.body as { message?: string; session_id?: string };
|
||||
if (!message) { res.status(400).json({ error: '"message" is required' }); return; }
|
||||
|
||||
const sessionId = session_id || `session_${Date.now()}`;
|
||||
const ctx = buildContext();
|
||||
|
||||
try {
|
||||
const result = await orchestratorChat(sessionId, message, ctx);
|
||||
res.json(result);
|
||||
} catch (err) {
|
||||
res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/orchestrator/sessions', (_req: Request, res: Response) => {
|
||||
res.json(listSessions());
|
||||
});
|
||||
|
||||
app.delete('/orchestrator/sessions/:id', (req: Request, res: Response) => {
|
||||
clearSession(req.params.id);
|
||||
res.json({ cleared: req.params.id });
|
||||
});
|
||||
|
||||
// List recent jobs
|
||||
app.get('/api/jobs', (req: Request, res: Response) => {
|
||||
const limit = parseInt((req.query.limit as string) || '20', 10);
|
||||
|
||||
Reference in New Issue
Block a user