refactor: identify and freeze messages at creation
This commit is contained in:
345 files changed
+5220
-2901
No files matched your search
@@ -8,8 +8,9 @@
|
||||
import { Context, Service } from 'cordis'
|
||||
import z from 'schemastery'
|
||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
|
||||
import type { SessionId, UserMessageData } from '@deepseek-ai/dsh-session'
|
||||
import type { SessionId, UserMessage } from '@deepseek-ai/dsh-session'
|
||||
import type { SessionSurfaceSnapshot } from '@deepseek-ai/dsh-session-query'
|
||||
import {
|
||||
DEFAULT_CANDIDATE_LIMIT,
|
||||
@@ -192,10 +193,10 @@ export class SessionReferenceService extends Service {
|
||||
inputIndex: index,
|
||||
})),
|
||||
}
|
||||
const additionalContext: UserMessageData = {
|
||||
const additionalContext: UserMessage = createUserMessage({
|
||||
source,
|
||||
content: [{ type: 'text', text: prompt }],
|
||||
}
|
||||
})
|
||||
return { content: acceptedContent, additionalContext }
|
||||
}
|
||||
|
||||
|
||||
@@ -45,13 +45,13 @@ function projectSessionConversation(snapshot: SessionSurfaceSnapshot): Projected
|
||||
break
|
||||
}
|
||||
case 'steering/message': {
|
||||
if (event.data.source.kind !== 'user') break
|
||||
const text = textContent(event.data.content)
|
||||
if (event.data.message.source.kind !== 'user') break
|
||||
const text = textContent(event.data.message.content)
|
||||
if (text !== '') conversation.push({ role: 'user', text, checkpoint: false, originalText: text, omittedBytes: 0 })
|
||||
break
|
||||
}
|
||||
case 'assistant/message': {
|
||||
const text = textContent(event.data.content)
|
||||
const text = textContent(event.data.message.content)
|
||||
if (text !== '') conversation.push({ role: 'assistant', text, checkpoint: false, originalText: text, omittedBytes: 0 })
|
||||
break
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** Public session-reference request, candidate, and preparation records. */
|
||||
|
||||
import type { ContentBlock } from '@deepseek-ai/dsh-llm'
|
||||
import type { SessionId, UserMessageData } from '@deepseek-ai/dsh-session'
|
||||
import type { SessionId, UserMessage } from '@deepseek-ai/dsh-session'
|
||||
|
||||
/** Durable provenance for one prepared cross-session context. */
|
||||
export interface SessionReferenceSource {
|
||||
@@ -52,7 +52,7 @@ export interface PreparedReferencedMessage {
|
||||
/** Readable message content after host mention tokens are removed. */
|
||||
content: ContentBlock[]
|
||||
/** Aggregated untrusted snapshot, absent when the message has no references. */
|
||||
additionalContext?: UserMessageData
|
||||
additionalContext?: UserMessage
|
||||
}
|
||||
|
||||
/** Text-only projected conversation item. */
|
||||
|
||||
Reference in New Issue
Block a user