Add session rename dialogs and API wiring

This commit is contained in:
Shantur Rathore
2025-12-09 20:13:35 +00:00
parent bd0cb04b78
commit 67a12d6126
5 changed files with 317 additions and 19 deletions

View File

@@ -334,9 +334,39 @@ async function updateSessionModel(
updateSessionInfo(instanceId, sessionId)
}
async function renameSession(instanceId: string, sessionId: string, nextTitle: string): Promise<void> {
const instance = instances().get(instanceId)
if (!instance || !instance.client) {
throw new Error("Instance not ready")
}
const session = sessions().get(instanceId)?.get(sessionId)
if (!session) {
throw new Error("Session not found")
}
const trimmedTitle = nextTitle.trim()
if (!trimmedTitle) {
throw new Error("Session title is required")
}
await instance.client.session.update({
path: { id: sessionId },
body: { title: trimmedTitle },
})
withSession(instanceId, sessionId, (current) => {
current.title = trimmedTitle
const time = { ...(current.time ?? {}) }
time.updated = Date.now()
current.time = time
})
}
export {
abortSession,
executeCustomCommand,
renameSession,
runShellCommand,
sendMessage,
updateSessionAgent,

View File

@@ -41,6 +41,7 @@ import {
import {
abortSession,
executeCustomCommand,
renameSession,
runShellCommand,
sendMessage,
updateSessionAgent,
@@ -82,6 +83,7 @@ export {
createSession,
deleteSession,
executeCustomCommand,
renameSession,
runShellCommand,
fetchAgents,
fetchProviders,