mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-14 04:01:35 +00:00
feat(session)!: embed assistant streams in format v2
This commit is contained in:
@@ -90,8 +90,8 @@ function summarize(session: Session, firstSeq: SessionLogOffset): RunOutcome {
|
||||
|
||||
/**
|
||||
* Project provider-reported reasoning from one owned run to stderr as it is
|
||||
* appended, while keeping final outcome derivation on the durable log.
|
||||
* @param ctx - plugin context carrying the Session event feed.
|
||||
* streamed, while keeping final outcome derivation on the durable log.
|
||||
* @param ctx - plugin context carrying the live Assistant frame feed.
|
||||
* @param agent - the exact Agent whose reasoning belongs to this invocation.
|
||||
* @param stderr - progress output sink.
|
||||
* @returns a disposer that also terminates an unterminated reasoning line.
|
||||
@@ -101,7 +101,6 @@ function streamReasoning(
|
||||
agent: Agent,
|
||||
stderr: HeadlessIo['stderr'],
|
||||
): () => void {
|
||||
let started = false
|
||||
let open = false
|
||||
let endsWithNewline = true
|
||||
const close = (): void => {
|
||||
@@ -110,15 +109,17 @@ function streamReasoning(
|
||||
open = false
|
||||
endsWithNewline = true
|
||||
}
|
||||
const dispose = ctx.on('session/event', (session, event) => {
|
||||
if (session !== agent.session) return
|
||||
if (event.type === 'turn/start') {
|
||||
const dispose = ctx.on('agent/assistant-stream', ({ agent: subject, frame }) => {
|
||||
if (subject !== agent) return
|
||||
if (frame.type === 'start') {
|
||||
close()
|
||||
started = true
|
||||
return
|
||||
}
|
||||
if (!started || event.type !== 'assistant/chunk') return
|
||||
const chunk = event.data.chunk
|
||||
if (frame.type === 'end') {
|
||||
close()
|
||||
return
|
||||
}
|
||||
const chunk = frame.chunk
|
||||
switch (chunk.type) {
|
||||
case 'reasoning-delta':
|
||||
if (chunk.text === '') return
|
||||
|
||||
Reference in New Issue
Block a user