(input: ExportSessionPayload)
| 516 | } |
| 517 | |
| 518 | async exportSession(input: ExportSessionPayload): Promise<ExportSessionResult> { |
| 519 | const summary = await this.sessionStore.get(input.sessionId); |
| 520 | const active = this.sessions.get(input.sessionId); |
| 521 | // Closed sessions have no `Session.log`; create an ad-hoc child bound to |
| 522 | // their id so the entries still route to the session log file. |
| 523 | const exportLog = |
| 524 | active?.log ?? log.createChild({ sessionId: input.sessionId }); |
| 525 | if (active !== undefined) { |
| 526 | try { |
| 527 | await active.flushMetadata(); |
| 528 | } catch (error) { |
| 529 | exportLog.warn('flushMetadata failed before export', { error }); |
| 530 | } |
| 531 | } |
| 532 | await warnIfLogFlushFails(exportLog, 'export session log flush failed', () => |
| 533 | getRootLogger().flushSession(input.sessionId), |
| 534 | ); |
| 535 | if (input.includeGlobalLog === true) { |
| 536 | await warnIfLogFlushFails(exportLog, 'export global log flush failed', () => |
| 537 | getRootLogger().flushGlobal(), |
| 538 | ); |
| 539 | } |
| 540 | const result = await exportSessionDirectory({ |
| 541 | request: input, |
| 542 | summary, |
| 543 | homeDir: this.homeDir, |
| 544 | globalLogPath: getRootLogger().getConfig()?.globalLogPath, |
| 545 | }); |
| 546 | return result; |
| 547 | } |
| 548 | |
| 549 | async getKimiConfig(input?: GetKimiConfigPayload): Promise<KimiConfig> { |
| 550 | if (input?.reload) { |
nothing calls this directly
no test coverage detected