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

Method getSessionView

packages/runtime/src/session-manager.ts:5406–5427  ·  view source on GitHub ↗
(
    sessionId: string,
    projectionCache: RuntimeReadModelProjectionCache = this.deps.store,
  )

Source from the content-addressed store, hash-verified

5404 }
5405
5406 private async getSessionView(
5407 sessionId: string,
5408 projectionCache: RuntimeReadModelProjectionCache = this.deps.store,
5409 ): Promise<RuntimeReadModelSessionView> {
5410 const repaired = new Set<string>();
5411 for (let attempt = 0; attempt < MAX_RUNTIME_LEDGER_REPAIR_ATTEMPTS; attempt += 1) {
5412 try {
5413 const view = await this.readModel(projectionCache).getSessionView(sessionId);
5414 const runId = firstRuntimeRepairRunId(view.diagnostics, repaired);
5415 if (!runId) return view;
5416 if (!(await this.repairMissingTerminalFactOnce(sessionId, runId))) return view;
5417 repaired.add(runId);
5418 } catch (error) {
5419 if (!(error instanceof RuntimeReadModelError)) throw error;
5420 const runId = firstRuntimeRepairRunId(error.diagnostics, repaired);
5421 if (!runId) throw error;
5422 if (!(await this.repairMissingTerminalFactOnce(sessionId, runId))) throw error;
5423 repaired.add(runId);
5424 }
5425 }
5426 return this.readModel(projectionCache).getSessionView(sessionId);
5427 }
5428
5429 private readModel(
5430 projectionCache: RuntimeReadModelProjectionCache = this.deps.store,

Callers 8

getMessagesMethod · 0.95
listTurnsMethod · 0.95
prepareRegenerateTurnMethod · 0.95
branchFromTurnMethod · 0.95
branchBeforeTurnMethod · 0.95
reviseBeforeTurnMethod · 0.95
requireTurnForActionMethod · 0.95

Calls 5

readModelMethod · 0.95
firstRuntimeRepairRunIdFunction · 0.85
getSessionViewMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected