refactor agent pre-step inbox lifecycle
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
import type { Context } from 'cordis'
|
||||
import z from 'schemastery'
|
||||
import type { Agent, PromptDecision } from '@deepseek-ai/dsh-agent'
|
||||
import type { Agent, PreStepDecision } from '@deepseek-ai/dsh-agent'
|
||||
import { createUserMessage } from '@deepseek-ai/dsh-llm'
|
||||
import type { MessageSource } from '@deepseek-ai/dsh-llm'
|
||||
import type { UserMessage } from '@deepseek-ai/dsh-session'
|
||||
@@ -223,8 +223,8 @@ export function apply(ctx: Context, config: Config): void {
|
||||
// A user interjection changes the context; repetition across it is not a
|
||||
// loop. Pure reset hook: always delegates (attaching nothing, vetoing
|
||||
// nothing).
|
||||
ctx.on('agent/prompt-submit', (agent, _message, _signal, next): Promise<PromptDecision> => {
|
||||
chains.delete(agent)
|
||||
ctx.on('agent/pre-step', (agent, messages, _context, next): Promise<PreStepDecision> => {
|
||||
if (messages.some(message => message.source.kind === 'user')) chains.delete(agent)
|
||||
return next()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user