refactor(agent-loop): separate injected context from turns
This commit is contained in:
@@ -14,7 +14,6 @@ import type {
|
||||
SessionEvent,
|
||||
SessionEventMap,
|
||||
} from '@deepseek-ai/dsh-session'
|
||||
import { displayPromptContent } from '@deepseek-ai/dsh-session'
|
||||
import { fallbackSessionTitle, normalizeSessionTitle } from './normalize.ts'
|
||||
|
||||
export { fallbackSessionTitle, normalizeSessionTitle, truncateTitleUtf8 } from './normalize.ts'
|
||||
@@ -202,7 +201,7 @@ export function collectSessionTitleMessages(
|
||||
for (const event of events) {
|
||||
if (throughSeq !== undefined && event.seq > throughSeq) break
|
||||
if (event.type !== 'user/message' || event.data.source.kind !== 'user') continue
|
||||
const content = displayPromptContent(event.data)
|
||||
const content = event.data.content
|
||||
const text = content
|
||||
.filter((block): block is Extract<(typeof content)[number], { type: 'text' }> => block.type === 'text')
|
||||
.map(block => block.text)
|
||||
|
||||
@@ -82,16 +82,8 @@ describe('SessionTitleService', () => {
|
||||
trigger: { kind: 'message', source: { kind: 'user' } },
|
||||
})
|
||||
session.append('user/message', {
|
||||
content: [
|
||||
{ type: 'text', text: 'referenced snapshot title must stay hidden' },
|
||||
{ type: 'text', text: '\n\n## My request:\n' },
|
||||
{ type: 'text', text: 'Explain this referenced session' },
|
||||
],
|
||||
content: [{ type: 'text', text: 'Explain this referenced session' }],
|
||||
source: { kind: 'user' },
|
||||
envelope: {
|
||||
displayContent: [{ type: 'text', text: 'Explain this referenced session' }],
|
||||
prefixContexts: [{ source: { kind: 'plugin', plugin: 'session-reference' } }],
|
||||
},
|
||||
}, { surfaceOp: 'append' })
|
||||
|
||||
await settleTitles()
|
||||
|
||||
Reference in New Issue
Block a user