fix(agent): restore public send method

This commit is contained in:
_Kerman
2026-07-31 10:01:35 +08:00
parent c891cb6f6f
commit 060c0f78f0
28 changed files with 76 additions and 32 deletions

View File

@@ -43,7 +43,7 @@ function agent(ctx: Context): Agent {
const session = new Session(id)
return {
id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx,
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
}
}
@@ -250,7 +250,7 @@ describe('pty-local plugin shape', () => {
const ownerFiber = await ctx.plugin(() => {})
const owner: Agent = {
id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: ownerFiber.ctx,
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
}
ctx.agents.register(owner)
const providerFiber = await registerStubLocalBackend(ctx, () => stubLocalSession())
@@ -293,7 +293,7 @@ describe('pty-local plugin shape', () => {
const ownerFiber = await ctx.plugin(() => {})
const owner: Agent = {
id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: ownerFiber.ctx,
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
}
ctx.agents.register(owner)
const gate = Promise.withResolvers<undefined>()

View File

@@ -36,7 +36,7 @@ function stubAgent(ctx: Context, rawId: string): Agent {
const session = new Session(id)
return {
id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: scope.ctx,
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
}
}

View File

@@ -29,6 +29,7 @@ function stubAgent(ctx: Context, rawId: string): Agent {
inbox: new Inbox(session),
status: 'idle',
ctx: scopeFiber.ctx,
send: () => {},
followup: () => {},
steer: () => {},
inject: () => {},

View File

@@ -46,6 +46,7 @@ function agent(ctx: Context, cwd: string): Agent {
inbox: new Inbox(session),
status: 'idle',
ctx: scope.ctx,
send: () => {},
followup: () => {},
steer: () => {},
inject: () => {},

View File

@@ -42,6 +42,7 @@ function agent(ctx: Context, cwd: string | undefined): Agent {
inbox: new Inbox(session),
status: 'idle',
ctx: scope.ctx,
send: () => {},
followup: () => {},
steer: () => {},
inject: () => {},

View File

@@ -41,7 +41,7 @@ function agent(ctx: Context): Agent {
const session = new Session(id)
const value: Agent = {
id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: scope.ctx,
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
}
ctx.agents.register(value)
return value

View File

@@ -19,7 +19,7 @@ function fakeAgent(ctx: Context, rawId: string): Agent {
const session = new Session(id)
const agent: Agent = {
id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: scope.ctx,
followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(),
}
ctx.agents.register(agent)
return agent