MCPcopy
hub / github.com/anomalyco/opencode / replaySessionProjection

Function replaySessionProjection

packages/core/test/session-runner.test.ts:370–394  ·  view source on GitHub ↗
(id: SessionV2.ID)

Source from the content-addressed store, hash-verified

368const systemTexts = (request: LLMRequest) => messageTexts(request, "system")
369
370const replaySessionProjection = (id: SessionV2.ID) =>
371 Effect.gen(function* () {
372 const { db } = yield* Database.Service
373 const events = yield* EventV2.Service
374 const recorded = yield* db
375 .select()
376 .from(EventTable)
377 .where(eq(EventTable.aggregate_id, id))
378 .orderBy(asc(EventTable.seq))
379 .all()
380 .pipe(Effect.orDie)
381
382 yield* events.remove(id)
383 yield* db.delete(SessionInputTable).where(eq(SessionInputTable.session_id, id)).run().pipe(Effect.orDie)
384 yield* db.delete(SessionMessageTable).where(eq(SessionMessageTable.session_id, id)).run().pipe(Effect.orDie)
385 yield* events.replayAll(
386 recorded.map((event) => ({
387 id: event.id,
388 aggregateID: event.aggregate_id,
389 seq: event.seq,
390 type: event.type,
391 data: event.data,
392 })),
393 )
394 })
395
396type FragmentKind = "text" | "reasoning" | "tool input"
397

Callers 2

verifyEphemeralDeltasFunction · 0.85

Calls 9

eqFunction · 0.85
removeMethod · 0.65
allMethod · 0.45
orderByMethod · 0.45
whereMethod · 0.45
fromMethod · 0.45
selectMethod · 0.45
runMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected