refactor(agent): unify agent-scoped event signatures as payload objects
All agent/* and agent-loop/config-start-failed events take one payload object carrying the agent subject; waterfall/serial payloads require a signal and keep next as the final argument. PreStepContext and RequestFailureContext are unfolded into payloads and retired. goal/changed follows the same shape so agentEvents keeps its listener error containment. ReactLoopAgent builds its scope carrier once in the constructor. Regenerates scope resolvers, tool-cordis api catalog, and docs catalogs; updates all affected listeners, tests, and the core-data-structures docs (en + zh).
This commit is contained in:
@@ -84,13 +84,13 @@ export function apply(ctx: Context): void {
|
||||
// runs, so the queued FIFO order is what the transcript records. The first
|
||||
// child enqueue is the initial delegation, which also pins the real child id.
|
||||
let accepted = 0
|
||||
ctx.on('agent/inbox/inserted', (agent) => {
|
||||
ctx.on('agent/inbox/inserted', ({ agent }) => {
|
||||
if (agent.session.header.parentSession === undefined) return
|
||||
if (realChildId === undefined) realChildId = agent.session.header.id
|
||||
accepted += 1
|
||||
if (accepted >= 3) followupsAccepted.resolve(undefined)
|
||||
})
|
||||
ctx.on('agent/pre-step', async (agent, _messages, _context, next) => {
|
||||
ctx.on('agent/pre-step', async ({ agent }, next) => {
|
||||
if (agent.session.header.parentSession !== undefined) await followupsAccepted.promise
|
||||
return next()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user