fix(agent): address initial review findings
This commit is contained in:
@@ -1502,6 +1502,20 @@ export function createApiProxy(ctx: Context, defaults: ApiProxyDefaults): ApiPro
|
||||
const view = viewFor(ctx, event, callId =>
|
||||
openCalls.get(session.id)?.get(callId) ?? backscanArgs(session.events, callId))
|
||||
queue.push(frame({ type: 'session/event', sessionId: session.id, event, ...view === undefined ? {} : { view } }))
|
||||
if (event.type === 'agent/inbox/spliced' && event.data.target === 'next-turn') {
|
||||
const agent = ctx.agents.get(session.id)
|
||||
if (agent?.session === session) {
|
||||
queue.push(frame({
|
||||
type: 'session/queue',
|
||||
sessionId: session.id,
|
||||
items: agent.inbox.nextTurn.toSpliced(
|
||||
event.data.start,
|
||||
event.data.removedCount ?? 0,
|
||||
...event.data.inserted,
|
||||
),
|
||||
}))
|
||||
}
|
||||
}
|
||||
}),
|
||||
ctx.on('session/created', (session: Session) => {
|
||||
subscribeSession(queue, session)
|
||||
|
||||
@@ -62,9 +62,9 @@ export type MuxFrame =
|
||||
| { type: 'question/requested'; sessionId: SessionId; questions: AskUserQuestionItem[] }
|
||||
| { type: 'question/resolved'; sessionId: SessionId; questionRpcId: RpcId; outcome: 'answered' | 'cancelled' }
|
||||
/**
|
||||
* Complete next-turn queue baseline emitted when a mux stream opens. Live
|
||||
* mutations arrive through durable `agent/inbox/spliced` session events.
|
||||
* Pending next-step input is outside this Web queue projection.
|
||||
* Complete next-turn queue snapshot emitted when a mux stream opens and
|
||||
* after every live next-turn mutation. Pending next-step input is outside
|
||||
* this Web queue projection.
|
||||
*/
|
||||
| { type: 'session/queue'; sessionId: SessionId; items: UserMessage[] }
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user