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

Method resume

packages/agent-core/src/session/index.ts:300–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

298 }
299
300 async resume(): Promise<{ warning?: string }> {
301 await this.skillsReady;
302 this.log.info('session resume', { app_version: this.options.appVersion });
303 const { agents } = await this.readMetadata();
304 this.agents.clear();
305 // Only the main agent is needed to reopen the session; subagents replay
306 // lazily when an RPC or Agent(resume=...) call asks for their state.
307 const { warning } =
308 agents['main'] === undefined ? { warning: undefined } : await this.resumeAgent('main');
309 // A session migrated from an external tool ships a wire without the
310 // `config.update` bootstrap events a natively-created agent writes, so the
311 // main agent comes back with an empty system prompt and no tools. Apply the
312 // default profile so the resumed session is usable. Native sessions always
313 // replay a non-empty system prompt and never enter this branch.
314 const main = this.getReadyAgent('main');
315 const profile = DEFAULT_AGENT_PROFILES['agent'];
316 if (main !== undefined && profile !== undefined && main.config.systemPrompt === '') {
317 await this.bootstrapAgentProfile(main, profile);
318 }
319 await this.triggerSessionStart('resume');
320 return { warning };
321 }
322
323 async close(): Promise<void> {
324 try {

Callers 3

resumePersistedAgentMethod · 0.45
runAttemptMethod · 0.45

Calls 7

readMetadataMethod · 0.95
resumeAgentMethod · 0.95
getReadyAgentMethod · 0.95
bootstrapAgentProfileMethod · 0.95
triggerSessionStartMethod · 0.95
infoMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected