Skip to content

Commit ec4e3dc

Browse files
authored
Merge branch 'main' into aws_bedrock
2 parents 1dc431a + ae5a21c commit ec4e3dc

5 files changed

Lines changed: 211 additions & 31 deletions

File tree

server/claude-sdk.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,8 @@ async function queryClaudeSDK(command, options = {}, ws) {
603603
const transformedMessage = transformMessage(message);
604604
ws.send({
605605
type: 'claude-response',
606-
data: transformedMessage
606+
data: transformedMessage,
607+
sessionId: capturedSessionId || sessionId || null
607608
});
608609

609610
// Extract and send token budget updates from result messages
@@ -613,7 +614,8 @@ async function queryClaudeSDK(command, options = {}, ws) {
613614
console.log('Token budget from modelUsage:', tokenBudget);
614615
ws.send({
615616
type: 'token-budget',
616-
data: tokenBudget
617+
data: tokenBudget,
618+
sessionId: capturedSessionId || sessionId || null
617619
});
618620
}
619621
}
@@ -651,7 +653,8 @@ async function queryClaudeSDK(command, options = {}, ws) {
651653
// Send error to WebSocket
652654
ws.send({
653655
type: 'claude-error',
654-
error: error.message
656+
error: error.message,
657+
sessionId: capturedSessionId || sessionId || null
655658
});
656659

657660
throw error;

server/cursor-cli.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ async function spawnCursor(command, options = {}, ws) {
114114
// Send system info to frontend
115115
ws.send({
116116
type: 'cursor-system',
117-
data: response
117+
data: response,
118+
sessionId: capturedSessionId || sessionId || null
118119
});
119120
}
120121
break;
@@ -123,7 +124,8 @@ async function spawnCursor(command, options = {}, ws) {
123124
// Forward user message
124125
ws.send({
125126
type: 'cursor-user',
126-
data: response
127+
data: response,
128+
sessionId: capturedSessionId || sessionId || null
127129
});
128130
break;
129131

@@ -142,7 +144,8 @@ async function spawnCursor(command, options = {}, ws) {
142144
type: 'text_delta',
143145
text: textContent
144146
}
145-
}
147+
},
148+
sessionId: capturedSessionId || sessionId || null
146149
});
147150
}
148151
break;
@@ -157,7 +160,8 @@ async function spawnCursor(command, options = {}, ws) {
157160
type: 'claude-response',
158161
data: {
159162
type: 'content_block_stop'
160-
}
163+
},
164+
sessionId: capturedSessionId || sessionId || null
161165
});
162166
}
163167

@@ -174,15 +178,17 @@ async function spawnCursor(command, options = {}, ws) {
174178
// Forward any other message types
175179
ws.send({
176180
type: 'cursor-response',
177-
data: response
181+
data: response,
182+
sessionId: capturedSessionId || sessionId || null
178183
});
179184
}
180185
} catch (parseError) {
181186
console.log('📄 Non-JSON response:', line);
182187
// If not JSON, send as raw text
183188
ws.send({
184189
type: 'cursor-output',
185-
data: line
190+
data: line,
191+
sessionId: capturedSessionId || sessionId || null
186192
});
187193
}
188194
}
@@ -193,7 +199,8 @@ async function spawnCursor(command, options = {}, ws) {
193199
console.error('Cursor CLI stderr:', data.toString());
194200
ws.send({
195201
type: 'cursor-error',
196-
error: data.toString()
202+
error: data.toString(),
203+
sessionId: capturedSessionId || sessionId || null
197204
});
198205
});
199206

@@ -229,7 +236,8 @@ async function spawnCursor(command, options = {}, ws) {
229236

230237
ws.send({
231238
type: 'cursor-error',
232-
error: error.message
239+
error: error.message,
240+
sessionId: capturedSessionId || sessionId || null
233241
});
234242

235243
reject(error);
@@ -264,4 +272,4 @@ export {
264272
abortCursorSession,
265273
isCursorSessionActive,
266274
getActiveCursorSessions
267-
};
275+
};

server/openai-codex.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ export async function queryCodex(command, options = {}, ws) {
272272
data: {
273273
used: totalTokens,
274274
total: 200000 // Default context window for Codex models
275-
}
275+
},
276+
sessionId: currentSessionId
276277
});
277278
}
278279
}

server/routes/codex.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ router.get('/mcp/config/read', async (req, res) => {
262262
}
263263

264264
if (!configData) {
265-
return res.json({ success: false, message: 'No Codex configuration file found', servers: [] });
266-
}
265+
return res.json({ success: true, configPath, servers: [] }); }
267266

268267
const servers = [];
269268

0 commit comments

Comments
 (0)