feat: add Atlas PRD agent for product discovery

- src/prompts/atlas.ts — full Atlas system prompt (6-phase PM discovery flow)
- src/tools/prd.ts — finalize_prd tool that signals PRD completion
- src/agents/atlas.ts — Atlas agent config (Tier A, conversational)
- src/atlas.ts — atlasChat() multi-turn session handler
- server.ts — /atlas/chat, /atlas/sessions endpoints

Made-with: Cursor
This commit is contained in:
2026-03-01 15:56:26 -08:00
parent e29dccf745
commit e503e4312d
20 changed files with 756 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import { AGENTS } from './agents';
import { ToolContext } from './tools';
import { PROTECTED_GITEA_REPOS } from './tools/security';
import { orchestratorChat, listSessions, clearSession } from './orchestrator';
import { atlasChat, listAtlasSessions, clearAtlasSession } from './atlas';
import { LLMMessage } from './llm';
const app = express();
@@ -216,6 +217,43 @@ app.delete('/orchestrator/sessions/:id', (req: Request, res: Response) => {
res.json({ cleared: req.params.id });
});
// ---------------------------------------------------------------------------
// Atlas — PRD discovery agent
// ---------------------------------------------------------------------------
app.post('/atlas/chat', async (req: Request, res: Response) => {
const {
message,
session_id,
history
} = req.body as {
message?: string;
session_id?: string;
history?: LLMMessage[];
};
if (!message) { res.status(400).json({ error: '"message" is required' }); return; }
const sessionId = session_id || `atlas_${Date.now()}`;
const ctx = buildContext();
try {
const result = await atlasChat(sessionId, message, ctx, { preloadedHistory: history });
res.json(result);
} catch (err) {
res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
}
});
app.get('/atlas/sessions', (_req: Request, res: Response) => {
res.json(listAtlasSessions());
});
app.delete('/atlas/sessions/:id', (req: Request, res: Response) => {
clearAtlasSession(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);