(
request: WrapperSessionReadyRequest
)
| 529 | onCompletionSignal: () => { |
| 530 | lifecycleManager?.signalCompletion(); |
| 531 | }, |
| 532 | onSessionIdle: () => { |
| 533 | lifecycleManager?.onSessionIdle(); |
| 534 | }, |
| 535 | onRootSessionActivity: () => { |
| 536 | lifecycleManager?.onRootSessionActivity(); |
| 537 | }, |
| 538 | onReconnecting: (attempt: number) => { |
| 539 | logToFile(`ingest WS reconnecting: attempt ${attempt}`); |
| 540 | }, |
| 541 | onReconnected: () => { |
| 542 | logToFile('ingest WS reconnected'); |
| 543 | lifecycleManager?.onConnectionRestored(); |
| 544 | const lastError = state.getLastError(); |
| 545 | if (lastError?.code === 'DISCONNECT') { |
| 546 | state.clearLastError(); |
| 547 | } |
| 548 | }, |
| 549 | onSseEvent: () => { |
| 550 | lifecycleManager?.onSseEvent(); |
| 551 | }, |
| 552 | } |
| 553 | ); |
| 554 | |
| 555 | lifecycleManager = createLifecycleManager( |
| 556 | { workspacePath }, |
| 557 | { |
| 558 | state, |
| 559 | kiloClient: nextKiloClient, |
| 560 | closeConnections: () => connectionManager?.close() ?? Promise.resolve(), |
| 561 | isConnected: () => connectionManager?.isConnected() ?? false, |
| 562 | reconnectEventSubscription: () => connectionManager?.reconnectEventSubscription(), |
| 563 | } |
| 564 | ); |
| 565 | lifecycleManager.start(); |
| 566 | globalFeedManager.onRuntimeReady(); |
| 567 | } |
| 568 | |
| 569 | async function updateRuntimeEnvironment(env: Record<string, string>): Promise<void> { |
| 570 | const environmentChanged = Object.entries(env).some( |
| 571 | ([name, value]) => process.env[name] !== value |
| 572 | ); |
| 573 | Object.assign(process.env, env); |
| 574 | if (runtimeWorkspacePath && (environmentChanged || !kiloClient)) { |
| 575 | await startKiloRuntime(runtimeWorkspacePath, kiloSessionId || undefined, true); |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | function wrapperFinalizingResponse(): WrapperSessionReadyResponse { |
| 580 | return { |
| 581 | status: 'error', |
| 582 | error: { |
| 583 | code: 'WRAPPER_FINALIZING', |
| 584 | message: 'Wrapper is shutting down', |
| 585 | retryable: true, |
| 586 | }, |
| 587 | }; |
| 588 | } |
nothing calls this directly
no test coverage detected