MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / exportSession

Method exportSession

packages/agent-core/src/rpc/core-impl.ts:518–547  ·  view source on GitHub ↗
(input: ExportSessionPayload)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 10

getRootLoggerFunction · 0.90
exportSessionDirectoryFunction · 0.90
warnIfLogFlushFailsFunction · 0.85
flushMetadataMethod · 0.80
getMethod · 0.65
createChildMethod · 0.65
warnMethod · 0.65
flushSessionMethod · 0.65
flushGlobalMethod · 0.65
getConfigMethod · 0.65

Tested by

no test coverage detected