Compare commits

...

1 Commits

Author SHA1 Message Date
simosmik
8f1042cf25 feat: adding session resume in the api 2026-03-29 20:58:56 +00:00

View File

@@ -475,6 +475,7 @@ class SSEStreamWriter {
setSessionId(sessionId) { setSessionId(sessionId) {
this.sessionId = sessionId; this.sessionId = sessionId;
this.send({ type: 'session-id', sessionId });
} }
getSessionId() { getSessionId() {
@@ -839,7 +840,7 @@ class ResponseCollector {
* } * }
*/ */
router.post('/', validateExternalApiKey, async (req, res) => { router.post('/', validateExternalApiKey, async (req, res) => {
const { githubUrl, projectPath, message, provider = 'claude', model, githubToken, branchName } = req.body; const { githubUrl, projectPath, message, provider = 'claude', model, githubToken, branchName, sessionId } = req.body;
// Parse stream and cleanup as booleans (handle string "true"/"false" from curl) // Parse stream and cleanup as booleans (handle string "true"/"false" from curl)
const stream = req.body.stream === undefined ? true : (req.body.stream === true || req.body.stream === 'true'); const stream = req.body.stream === undefined ? true : (req.body.stream === true || req.body.stream === 'true');
@@ -949,7 +950,7 @@ router.post('/', validateExternalApiKey, async (req, res) => {
await queryClaudeSDK(message.trim(), { await queryClaudeSDK(message.trim(), {
projectPath: finalProjectPath, projectPath: finalProjectPath,
cwd: finalProjectPath, cwd: finalProjectPath,
sessionId: null, // New session sessionId: sessionId || null,
model: model, model: model,
permissionMode: 'bypassPermissions' // Bypass all permissions for API calls permissionMode: 'bypassPermissions' // Bypass all permissions for API calls
}, writer); }, writer);
@@ -960,7 +961,7 @@ router.post('/', validateExternalApiKey, async (req, res) => {
await spawnCursor(message.trim(), { await spawnCursor(message.trim(), {
projectPath: finalProjectPath, projectPath: finalProjectPath,
cwd: finalProjectPath, cwd: finalProjectPath,
sessionId: null, // New session sessionId: sessionId || null,
model: model || undefined, model: model || undefined,
skipPermissions: true // Bypass permissions for Cursor skipPermissions: true // Bypass permissions for Cursor
}, writer); }, writer);
@@ -970,7 +971,7 @@ router.post('/', validateExternalApiKey, async (req, res) => {
await queryCodex(message.trim(), { await queryCodex(message.trim(), {
projectPath: finalProjectPath, projectPath: finalProjectPath,
cwd: finalProjectPath, cwd: finalProjectPath,
sessionId: null, sessionId: sessionId || null,
model: model || CODEX_MODELS.DEFAULT, model: model || CODEX_MODELS.DEFAULT,
permissionMode: 'bypassPermissions' permissionMode: 'bypassPermissions'
}, writer); }, writer);
@@ -980,7 +981,7 @@ router.post('/', validateExternalApiKey, async (req, res) => {
await spawnGemini(message.trim(), { await spawnGemini(message.trim(), {
projectPath: finalProjectPath, projectPath: finalProjectPath,
cwd: finalProjectPath, cwd: finalProjectPath,
sessionId: null, sessionId: sessionId || null,
model: model, model: model,
skipPermissions: true // CLI mode bypasses permissions skipPermissions: true // CLI mode bypasses permissions
}, writer); }, writer);