refactor(agent): simplify inbox-driven turn admission

This commit is contained in:
_Kerman
2026-08-02 00:27:37 +08:00
parent d38c8bfaf3
commit dbdf270af0
104 changed files with 550 additions and 511 deletions

View File

@@ -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)

View File

@@ -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(),
}
}