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:
@@ -8,20 +8,20 @@
|
||||
type ScopedSubjectResolver = (args: readonly unknown[]) => unknown
|
||||
|
||||
const scopedSubjectResolvers: Readonly<Record<string, ScopedSubjectResolver | null>> = Object.freeze({
|
||||
'agent/created': args => args[0],
|
||||
'agent/disposed': args => args[0],
|
||||
'agent/error': args => args[0],
|
||||
'agent/inbox/claimed': args => args[0],
|
||||
'agent/inbox/discarded': args => args[0],
|
||||
'agent/inbox/inserted': args => args[0],
|
||||
'agent/pre-step': args => args[0],
|
||||
'agent/request': args => args[0],
|
||||
'agent/request-error': args => args[0],
|
||||
'agent/session-start': args => args[0],
|
||||
'agent/status': args => args[0],
|
||||
'agent/turn-stopping': args => args[0],
|
||||
'agent/created': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/disposed': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/error': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/inbox/claimed': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/inbox/discarded': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/inbox/inserted': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/pre-step': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/request': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/request-error': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/session-start': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/status': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'agent/turn-stopping': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'approval/request': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'goal/changed': args => args[0],
|
||||
'goal/changed': args => (args[0] as Record<string, unknown>)['agent'],
|
||||
'session/created': null,
|
||||
'session/disposed': null,
|
||||
'session/event': null,
|
||||
|
||||
Reference in New Issue
Block a user