MCPcopy Create free account
hub / github.com/apache/maka / createStableSession

Method createStableSession

packages/storage/src/session-store.ts:440–476  ·  view source on GitHub ↗
(
    request: CreateStableSessionRequest,
    initialBoundary?: ExecutionBoundary,
  )

Source from the content-addressed store, hash-verified

438 }
439
440 async createStableSession(
441 request: CreateStableSessionRequest,
442 initialBoundary?: ExecutionBoundary,
443 ): Promise<CreateStableSessionResult> {
444 await this.ensureReady();
445 if (
446 request.input.conversationCopy &&
447 request.input.conversationCopy.requestFingerprint !== request.requestFingerprint
448 ) {
449 throw new Error('Conversation copy fingerprint does not match the stable create request');
450 }
451 if (request.input.subagentSpawn) {
452 throw new Error('Subagent spawn metadata requires createSubagent()');
453 }
454 const probe = await this.metadata.claimStableSessionCreate(
455 request.sessionId,
456 request.requestFingerprint,
457 );
458 if (probe.kind === 'existing') {
459 return { kind: 'existing', record: projectHeaderSnapshot(probe.record) };
460 }
461 if (probe.kind === 'conflict') return probe;
462
463 const result = await this.metadata.createStableSession(
464 buildSessionHeader(
465 this.workspaceRoot,
466 request.input,
467 request.sessionId,
468 request.input.conversationCopy,
469 ),
470 request.requestFingerprint,
471 initialBoundary,
472 );
473 return result.kind === 'created' || result.kind === 'existing'
474 ? { kind: result.kind, record: projectHeaderSnapshot(result.record) }
475 : result;
476 }
477
478 async discardStableConversationCopy(
479 sessionId: string,

Callers

nothing calls this directly

Calls 5

ensureReadyMethod · 0.95
projectHeaderSnapshotFunction · 0.85
buildSessionHeaderFunction · 0.85
createStableSessionMethod · 0.65

Tested by

no test coverage detected