test: migrate consumers to inbox and owned-run APIs
This commit is contained in:
@@ -136,9 +136,7 @@ describe('plan mode through the agent loop', () => {
|
||||
const adapter = new MockAdapter([failedRequest, textResponse('Recovered in plan mode.')])
|
||||
const ctx = await harness(adapter)
|
||||
const agent = ctx.agentLoop.create(SessionId('it-plan-retry-flip'), { provider: 'mock', model: 'mock' })
|
||||
ctx.on('agent/request-error', async (
|
||||
subject, _turn, _step, _error, _failure, _priorFailures, _retryPolicy, _signal, next,
|
||||
) => {
|
||||
ctx.on('agent/request-error', async (subject, _context, _signal, next) => {
|
||||
if (subject !== agent) return next()
|
||||
ctx.planMode.set(agent, true)
|
||||
return { kind: 'retry' }
|
||||
|
||||
@@ -59,14 +59,15 @@ async function setup(config: PlanModeConfig = PLAN_CONFIG): Promise<Context> {
|
||||
async function boundary(ctx: Context, agent: Agent & { session: Session }, type: 'turn/start' | 'step/end'): Promise<void> {
|
||||
const events = agentEvents(ctx, agent)
|
||||
if (type === 'turn/start') {
|
||||
const message = createUserMessage({
|
||||
content: [{ type: 'text', text: 'boundary probe' }],
|
||||
source: { kind: 'user' },
|
||||
})
|
||||
await events.waterfall(
|
||||
'agent/prompt-submit',
|
||||
createUserMessage({
|
||||
content: [{ type: 'text', text: 'boundary probe' }],
|
||||
source: { kind: 'user' },
|
||||
}),
|
||||
[message],
|
||||
new AbortController().signal,
|
||||
() => Promise.resolve({ kind: 'allow' }),
|
||||
() => Promise.resolve({ kind: 'allow', messages: [message] }),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user