(request: ComposerStateRequest = {})
| 255 | } |
| 256 | |
| 257 | export async function getComposerState(request: ComposerStateRequest = {}) { |
| 258 | const persistedSessionPath = getPersistedSessionPath(request.sessionPath) |
| 259 | if (persistedSessionPath) { |
| 260 | return await withRuntimeMutationLock(persistedSessionPath, async () => { |
| 261 | const runtime = await getOrCreateRuntimeForSessionPath(persistedSessionPath, { |
| 262 | suspendDisposal: true, |
| 263 | settingsCwd: request.composerSessionDir ?? null, |
| 264 | chatGroupId: request.chatGroupId ?? null, |
| 265 | }) |
| 266 | if (!(runtime.session.isStreaming || isRuntimeExtensionCommandRunning(runtime))) { |
| 267 | await applyComposerModeSettings(runtime, request) |
| 268 | } |
| 269 | scheduleRuntimeDisposal(persistedSessionPath) |
| 270 | return await buildComposerState(runtime) |
| 271 | }) |
| 272 | } |
| 273 | |
| 274 | return await buildComposerStateSnapshot({ ...request, sessionPath: null }) |
| 275 | } |
| 276 | |
| 277 | export async function setComposerModel( |
| 278 | request: ComposerStateRequest, |
no test coverage detected