mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-12 04:01:20 +00:00
feat(session)!: embed assistant streams in format v2
This commit is contained in:
@@ -11,7 +11,6 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { setTimeout as delay } from 'node:timers/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { decodeStorageRecord } from '@deepseek-ai/dsh-session/chunk-rows'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import WebSocket from 'ws'
|
||||
|
||||
@@ -60,10 +59,7 @@ interface WorkspaceBaseline {
|
||||
}
|
||||
|
||||
interface HistoryPage {
|
||||
records: Array<
|
||||
| { type: 'event'; event: HistoryEvent }
|
||||
| { type: 'chunks'; event: HistoryChunkEvent }
|
||||
>
|
||||
records: Array<{ type: 'event'; event: HistoryEvent }>
|
||||
hasMore: boolean
|
||||
}
|
||||
|
||||
@@ -72,11 +68,6 @@ interface HistoryEvent {
|
||||
data: unknown
|
||||
}
|
||||
|
||||
interface HistoryChunkEvent extends HistoryEvent {
|
||||
seq: number
|
||||
time: number
|
||||
}
|
||||
|
||||
interface ProcessObservation {
|
||||
readonly ready: Promise<string>
|
||||
readonly text: () => string
|
||||
@@ -314,16 +305,9 @@ function assistantText(page: HistoryPage): string {
|
||||
return text.join('\n')
|
||||
}
|
||||
|
||||
/** Expand lossless history records for assertions over the public event stream. */
|
||||
/** Read scalar v2 history records for assertions over the public event stream. */
|
||||
function historyEvents(page: HistoryPage): HistoryEvent[] {
|
||||
return page.records.flatMap(record => record.type === 'event'
|
||||
? [record.event]
|
||||
: decodeStorageRecord({
|
||||
type: record.event.type.replace(/^chunkrow\//u, ''),
|
||||
seq0: record.event.seq,
|
||||
time0: record.event.time,
|
||||
data: record.event.data,
|
||||
}))
|
||||
return page.records.map(record => record.event)
|
||||
}
|
||||
|
||||
/** Stop the spawned CLI through its normal signal path, escalating only on a stuck teardown. */
|
||||
|
||||
Reference in New Issue
Block a user