wire up /agent/execute and /agent/stop endpoints

- Add runSessionAgent: streaming variant of runAgent that PATCHes VIBN DB
  after every LLM turn and tool call so frontend can poll live output
- Track changed files from write_file / replace_in_file tool calls
- Add /agent/execute: receives sessionId + giteaRepo + task, clones repo,
  scopes workspace to appPath, runs Coder agent async (returns 202 immediately)
- Add /agent/stop: sets stopped flag; agent checks between turns and exits cleanly
- Agent does NOT commit on completion — leaves changes for user review/approval

Made-with: Cursor
This commit is contained in:
2026-03-06 18:01:30 -08:00
parent 335c7a7e97
commit 5aeddace91
13 changed files with 850 additions and 5 deletions

7
dist/atlas.js vendored
View File

@@ -38,7 +38,7 @@ function listAtlasSessions() {
// ---------------------------------------------------------------------------
// Main chat handler
// ---------------------------------------------------------------------------
const ATLAS_TOOLS = tools_1.ALL_TOOLS.filter(t => t.name === 'finalize_prd');
const ATLAS_TOOLS = tools_1.ALL_TOOLS.filter(t => ['finalize_prd', 'web_search'].includes(t.name));
async function atlasChat(sessionId, userMessage, ctx, opts) {
const llm = (0, llm_1.createLLM)(process.env.ATLAS_MODEL ?? 'A', { temperature: 0.5 });
const session = getOrCreateSession(sessionId);
@@ -48,7 +48,10 @@ async function atlasChat(sessionId, userMessage, ctx, opts) {
}
const oaiTools = (0, llm_1.toOAITools)(ATLAS_TOOLS);
const systemPrompt = (0, loader_1.resolvePrompt)('atlas');
session.history.push({ role: 'user', content: userMessage });
// For init triggers, don't add the synthetic prompt as a user turn
if (!opts?.isInit) {
session.history.push({ role: 'user', content: userMessage });
}
const buildMessages = () => [
{ role: 'system', content: systemPrompt },
...session.history.slice(-60)