refactor(agent): simplify inbox-driven turn admission
This commit is contained in:
@@ -43,8 +43,8 @@ function agent(ctx: Context, cwd?: string): Agent {
|
||||
const session = new Session(id, undefined, { version: 0, id, createdAt: 0, ...cwd === undefined ? {} : { cwd } })
|
||||
return {
|
||||
id, options: {}, session, inbox: new Inbox(session, { inserted: () => {}, discarded: () => {} }),
|
||||
status: 'idle', acceptsNextStep: false, ctx,
|
||||
send: () => {}, updateInbox: () => 'not-found', reserveTurnAdmission: () => undefined,
|
||||
status: 'idle', ctx,
|
||||
send: () => {},
|
||||
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
}
|
||||
@@ -258,8 +258,8 @@ describe('pty-local plugin shape', () => {
|
||||
const ownerFiber = await ctx.plugin(() => {})
|
||||
const owner: Agent = {
|
||||
id: session.id, options: {}, session, inbox: new Inbox(session, { inserted: () => {}, discarded: () => {} }),
|
||||
status: 'idle', acceptsNextStep: false, ctx: ownerFiber.ctx,
|
||||
send: () => {}, updateInbox: () => 'not-found', reserveTurnAdmission: () => undefined,
|
||||
status: 'idle', ctx: ownerFiber.ctx,
|
||||
send: () => {},
|
||||
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
ctx.agents.register(owner)
|
||||
@@ -303,8 +303,8 @@ describe('pty-local plugin shape', () => {
|
||||
const ownerFiber = await ctx.plugin(() => {})
|
||||
const owner: Agent = {
|
||||
id: session.id, options: {}, session, inbox: new Inbox(session, { inserted: () => {}, discarded: () => {} }),
|
||||
status: 'idle', acceptsNextStep: false, ctx: ownerFiber.ctx,
|
||||
send: () => {}, updateInbox: () => 'not-found', reserveTurnAdmission: () => undefined,
|
||||
status: 'idle', ctx: ownerFiber.ctx,
|
||||
send: () => {},
|
||||
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
ctx.agents.register(owner)
|
||||
|
||||
@@ -36,8 +36,8 @@ function stubAgent(ctx: Context, rawId: string): Agent {
|
||||
const session = new Session(id)
|
||||
return {
|
||||
id, options: {}, session, inbox: new Inbox(session, { inserted: () => {}, discarded: () => {} }),
|
||||
status: 'idle', acceptsNextStep: false, ctx: scope.ctx,
|
||||
send: () => {}, updateInbox: () => 'not-found', reserveTurnAdmission: () => undefined,
|
||||
status: 'idle', ctx: scope.ctx,
|
||||
send: () => {},
|
||||
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ function stubAgent(ctx: Context, rawId: string): Agent {
|
||||
followup: () => {},
|
||||
steer: () => {},
|
||||
inject: () => {},
|
||||
updateInbox: () => 'not-found',
|
||||
reserveTurnAdmission: () => undefined,
|
||||
cancel() {},
|
||||
whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
|
||||
@@ -50,8 +50,6 @@ function agent(ctx: Context, cwd: string): Agent {
|
||||
followup: () => {},
|
||||
steer: () => {},
|
||||
inject: () => {},
|
||||
updateInbox: () => 'not-found',
|
||||
reserveTurnAdmission: () => undefined,
|
||||
cancel() {},
|
||||
whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ function agent(ctx: Context, cwd: string | undefined): Agent {
|
||||
followup: () => {},
|
||||
steer: () => {},
|
||||
inject: () => {},
|
||||
updateInbox: () => 'not-found',
|
||||
reserveTurnAdmission: () => undefined,
|
||||
cancel() {},
|
||||
whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ function agent(ctx: Context): Agent {
|
||||
const session = new Session(id)
|
||||
const value: Agent = {
|
||||
id, options: {}, session, inbox: new Inbox(session, { inserted: () => {}, discarded: () => {} }),
|
||||
status: 'idle', acceptsNextStep: false, ctx: scope.ctx,
|
||||
send: () => {}, updateInbox: () => 'not-found', reserveTurnAdmission: () => undefined,
|
||||
status: 'idle', ctx: scope.ctx,
|
||||
send: () => {},
|
||||
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
ctx.agents.register(value)
|
||||
|
||||
@@ -19,8 +19,8 @@ function fakeAgent(ctx: Context, rawId: string): Agent {
|
||||
const session = new Session(id)
|
||||
const agent: Agent = {
|
||||
id, options: {}, session, inbox: new Inbox(session, { inserted: () => {}, discarded: () => {} }),
|
||||
status: 'idle', acceptsNextStep: false, ctx: scope.ctx,
|
||||
send: () => {}, updateInbox: () => 'not-found', reserveTurnAdmission: () => undefined,
|
||||
status: 'idle', ctx: scope.ctx,
|
||||
send: () => {},
|
||||
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
|
||||
}
|
||||
ctx.agents.register(agent)
|
||||
|
||||
Reference in New Issue
Block a user