feat: implement manual SDK session sync and fix UI crash
Some checks failed
Release Binaries / release (push) Has been cancelled

This commit is contained in:
Gemini AI
2025-12-27 12:11:08 +04:00
Unverified
parent 251fad85b1
commit 0e5059fc88
5 changed files with 127 additions and 33 deletions

View File

@@ -1153,6 +1153,27 @@ async function loadMessages(instanceId: string, sessionId: string, force = false
updateSessionInfo(instanceId, sessionId)
}
async function syncSessionsFromSdk(instanceId: string): Promise<void> {
const instance = instances().get(instanceId)
if (!instance) throw new Error("Instance not ready")
const folderPath = instance.folder
if (!folderPath) throw new Error("No folder path for instance")
log.info({ instanceId, folderPath }, "Manual SDK sync requested")
try {
const result = await nativeSessionApi.syncFromSdk(instanceId, folderPath)
log.info({ instanceId, result }, "Manual SDK sync result")
// Refresh sessions after sync
await fetchSessions(instanceId)
} catch (error) {
log.error({ instanceId, error }, "Manual SDK sync failed")
throw error
}
}
export {
createSession,
deleteSession,
@@ -1160,6 +1181,7 @@ export {
fetchProviders,
fetchSessions,
syncSessionsFromSdk,
forkSession,
loadMessages,
}

View File

@@ -26,7 +26,7 @@ import {
setActiveParentSession,
setActiveSession,
setSessionDraftPrompt,
} from "./session-state"
} from "./session-state"
import { getDefaultModel } from "./session-models"
import {
@@ -35,6 +35,7 @@ import {
fetchAgents,
fetchProviders,
fetchSessions,
syncSessionsFromSdk,
forkSession,
loadMessages,
} from "./session-api"
@@ -88,6 +89,7 @@ export {
fetchAgents,
fetchProviders,
fetchSessions,
syncSessionsFromSdk,
forkSession,
getActiveParentSession,
getActiveSession,