Merge remote-tracking branch 'origin/master' into feat/profile-plugin-management
# Conflicts: # apps/cli/src/headless.ts # docs/event-producer-consumer.md # packages/host/apiproxy/README.i18n.yaml
This commit is contained in:
@@ -155,7 +155,7 @@ export function apply(ctx: Context, config: Config): void {
|
||||
const abort = new AbortController()
|
||||
const frames = api.events.mux({}, abort.signal)
|
||||
const idle = new Promise<void>((resolve) => {
|
||||
ctx.on('agent/status', (agent, status) => {
|
||||
ctx.on('agent/status', ({ agent, status }) => {
|
||||
if (agent.id === created.sessionId && status === 'idle') resolve()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -70,9 +70,9 @@ async function run(events: ScriptedEvent[], options: { promptFails?: boolean } =
|
||||
// flip the agent idle exactly as the loop would. Foreign agents and
|
||||
// non-idle transitions must not settle the run.
|
||||
await new Promise(resolve => setTimeout(resolve, 10))
|
||||
ctx.emit('agent/status', { id: 'OTHER' } as Agent, 'idle')
|
||||
ctx.emit('agent/status', { id: 'S1' } as Agent, 'running')
|
||||
ctx.emit('agent/status', { id: 'S1' } as Agent, 'idle')
|
||||
ctx.emit('agent/status', { agent: { id: 'OTHER' } as Agent, status: 'idle' })
|
||||
ctx.emit('agent/status', { agent: { id: 'S1' } as Agent, status: 'running' })
|
||||
ctx.emit('agent/status', { agent: { id: 'S1' } as Agent, status: 'idle' })
|
||||
const code = await exited
|
||||
await ctx.fiber.dispose()
|
||||
return { code, out, err }
|
||||
@@ -168,7 +168,7 @@ describe('headless runner', () => {
|
||||
ctx.provide('httpServer', { port: 1 } as never)
|
||||
apply(ctx, { task: 't' })
|
||||
await new Promise(resolve => setTimeout(resolve, 10))
|
||||
ctx.emit('agent/status', { id: 'S1' } as Agent, 'idle')
|
||||
ctx.emit('agent/status', { agent: { id: 'S1' } as Agent, status: 'idle' })
|
||||
expect(await exited).toBe(1)
|
||||
expect(err).toContain('event stream failed')
|
||||
await ctx.fiber.dispose()
|
||||
|
||||
Reference in New Issue
Block a user