mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
Resolves merge conflicts: - apps/server/src/routes/terminal/common.ts: Keep randomBytes import, use @automaker/utils for createLogger - apps/ui/eslint.config.mjs: Use main's explicit globals list with XMLHttpRequest and MediaQueryListEvent additions - apps/ui/src/components/views/terminal-view.tsx: Keep our terminal improvements (killAllSessions, beforeunload, better error handling) - apps/ui/src/config/terminal-themes.ts: Keep our search highlight colors for all themes - apps/ui/src/store/app-store.ts: Keep our terminal settings persistence improvements (merge function) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
/**
|
|
* POST /start endpoint - Start a conversation
|
|
*/
|
|
|
|
import type { Request, Response } from 'express';
|
|
import { AgentService } from '../../../services/agent-service.js';
|
|
import { createLogger } from '@automaker/utils';
|
|
import { getErrorMessage, logError } from '../common.js';
|
|
const logger = createLogger('Agent');
|
|
|
|
export function createStartHandler(agentService: AgentService) {
|
|
return async (req: Request, res: Response): Promise<void> => {
|
|
try {
|
|
const { sessionId, workingDirectory } = req.body as {
|
|
sessionId: string;
|
|
workingDirectory?: string;
|
|
};
|
|
|
|
if (!sessionId) {
|
|
res.status(400).json({ success: false, error: 'sessionId is required' });
|
|
return;
|
|
}
|
|
|
|
const result = await agentService.startConversation({
|
|
sessionId,
|
|
workingDirectory,
|
|
});
|
|
|
|
res.json(result);
|
|
} catch (error) {
|
|
logError(error, 'Start conversation failed');
|
|
res.status(500).json({ success: false, error: getErrorMessage(error) });
|
|
}
|
|
};
|
|
}
|