(request: ComposerStateRequest)
| 650 | } |
| 651 | |
| 652 | export async function openThreadRuntime(request: ComposerStateRequest) { |
| 653 | const persistedSessionPath = getPersistedSessionPath(request.sessionPath) |
| 654 | if (!persistedSessionPath) { |
| 655 | const { composer } = await emitComposerUpdate({ ...request, sessionPath: null }) |
| 656 | return composer |
| 657 | } |
| 658 | |
| 659 | return await withRuntimeMutationLock(persistedSessionPath, async () => { |
| 660 | const runtime = await getOrCreateRuntimeForSessionPath(persistedSessionPath, { |
| 661 | suspendDisposal: true, |
| 662 | settingsCwd: request.composerSessionDir ?? null, |
| 663 | chatGroupId: request.chatGroupId ?? null, |
| 664 | }) |
| 665 | if (!(runtime.session.isStreaming || isRuntimeExtensionCommandRunning(runtime))) { |
| 666 | await applyComposerModeSettings(runtime, request) |
| 667 | } |
| 668 | const composer = await buildComposerState(runtime) |
| 669 | publishComposerUpdate(composer, { |
| 670 | projectId: request.projectId ?? runtime.cwd, |
| 671 | sessionPath: persistedSessionPath, |
| 672 | }) |
| 673 | scheduleRuntimeDisposal(persistedSessionPath) |
| 674 | return composer |
| 675 | }) |
| 676 | } |
no test coverage detected