(request: ComposerStateRequest)
| 569 | } |
| 570 | |
| 571 | export async function openThreadRuntime(request: ComposerStateRequest): Promise<ComposerState> { |
| 572 | const persistedSessionPath = getPersistedSessionPath(request.sessionPath) |
| 573 | if (!persistedSessionPath) { |
| 574 | const { composer } = await emitComposerUpdate({ ...request, sessionPath: null }) |
| 575 | return composer |
| 576 | } |
| 577 | |
| 578 | return await withRuntimeMutationLock(persistedSessionPath, async () => { |
| 579 | const runtime = await getOrCreateRuntimeForSessionPath(persistedSessionPath, { |
| 580 | suspendDisposal: true, |
| 581 | settingsCwd: request.composerSessionDir ?? null, |
| 582 | chatGroupId: request.chatGroupId ?? null, |
| 583 | }) |
| 584 | if (!(runtime.session.isStreaming || isRuntimeExtensionCommandRunning(runtime))) { |
| 585 | await applyComposerModeSettings(runtime, request) |
| 586 | } |
| 587 | scheduleRuntimeDisposalForRuntime(runtime) |
| 588 | const composer = await buildComposerState(runtime) |
| 589 | publishComposerUpdate(composer, { |
| 590 | projectId: request.projectId ?? runtime.cwd, |
| 591 | sessionPath: persistedSessionPath, |
| 592 | }) |
| 593 | return composer |
| 594 | }) |
| 595 | } |
no test coverage detected