mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
perf(session): reuse immutable event snapshots
This commit is contained in:
@@ -48,7 +48,7 @@ import type {
|
||||
interface SessionReadState {
|
||||
readonly id: SessionId
|
||||
readonly header: SessionHeader
|
||||
readonly events: SessionEvent[]
|
||||
readonly events: readonly SessionEvent[]
|
||||
}
|
||||
|
||||
/** Implements Session business commands delegated by the Session Controller Remote service. */
|
||||
@@ -484,7 +484,7 @@ export class SessionCommandController {
|
||||
private async readSessionState(sessionId: SessionId): Promise<SessionReadState> {
|
||||
const attached = this.ctx.sessions.get(sessionId)
|
||||
if (attached !== undefined) {
|
||||
return { id: attached.id, header: attached.header, events: [...attached.snapshotEvents()] }
|
||||
return { id: attached.id, header: attached.header, events: attached.snapshotEvents() }
|
||||
}
|
||||
const inspected = await inspectApiSession(this.ctx, sessionId)
|
||||
return { id: inspected.meta.id, header: inspected.meta, events: inspected.events }
|
||||
|
||||
@@ -191,10 +191,10 @@ export class SessionController extends TypertRemoteService {
|
||||
inspect(
|
||||
sessionId: SessionId,
|
||||
signal?: AbortSignal,
|
||||
): Promise<{ meta: SessionHeader; events: SessionEvent[] }> {
|
||||
): Promise<{ meta: SessionHeader; events: readonly SessionEvent[] }> {
|
||||
const attached = this.ctx.sessions.get(sessionId)
|
||||
if (attached !== undefined) {
|
||||
return Promise.resolve({ meta: attached.header, events: [...attached.snapshotEvents()] })
|
||||
return Promise.resolve({ meta: attached.header, events: attached.snapshotEvents() })
|
||||
}
|
||||
return inspectApiSession(this.ctx, sessionId, signal)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user