refactor(agent-loop): simplify message machine
This commit is contained in:
@@ -1088,7 +1088,7 @@ export function apply(ctx: Context, config: AcpConfig): void {
|
||||
// produces an error stop reason).
|
||||
const stopReason = await new Promise<StopReason>((resolve, reject) => {
|
||||
rec.inflight = { resolve, reject, turn: undefined }
|
||||
rec.agent.send(preparedContent, { contexts: preparedContexts })
|
||||
rec.agent.send(preparedContent, { source: { kind: 'user' }, contexts: preparedContexts })
|
||||
})
|
||||
return { stopReason }
|
||||
},
|
||||
|
||||
@@ -2522,9 +2522,9 @@ export function createTuiChat(
|
||||
if (agent.status === 'disposed') {
|
||||
appendNotice(`Agent "${agent.id}" is disposed.`, 'error')
|
||||
} else if (agent.status === 'running') {
|
||||
agent.steer(content, { contexts })
|
||||
agent.steer(content, { source: { kind: 'user' }, contexts })
|
||||
} else {
|
||||
agent.send(content, { contexts })
|
||||
agent.send(content, { source: { kind: 'user' }, contexts })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user