1
1
import { defaultApplyEvents } from "@/apply/default" ;
2
- import { Message , State , RunAgentInput , RunAgent , BaseEvent , AgentState } from "@ag-ui/core" ;
2
+ import { Message , State , RunAgentInput , BaseEvent } from "@ag-ui/core" ;
3
3
4
4
import { AgentConfig , RunAgentParameters } from "./types" ;
5
5
import { v4 as uuidv4 } from "uuid" ;
@@ -12,7 +12,7 @@ import { convertToLegacyEvents } from "@/legacy/convert";
12
12
import { LegacyRuntimeProtocolEvent } from "@/legacy/types" ;
13
13
import { lastValueFrom , of } from "rxjs" ;
14
14
import { transformChunks } from "@/chunks" ;
15
- import { RunAgentSubscriber } from "./subscriber" ;
15
+ import { AgentStateMutation , RunAgentSubscriber } from "./subscriber" ;
16
16
17
17
export abstract class AbstractAgent {
18
18
public agentId ?: string ;
@@ -48,7 +48,7 @@ export abstract class AbstractAgent {
48
48
} ;
49
49
}
50
50
51
- protected abstract run ( ... args : Parameters < RunAgent > ) : ReturnType < RunAgent > ;
51
+ protected abstract run ( input : RunAgentInput ) : Observable < BaseEvent > ;
52
52
53
53
public async runAgent ( parameters ?: RunAgentParameters ) : Promise < void > {
54
54
this . agentId = this . agentId ?? uuidv4 ( ) ;
@@ -74,14 +74,17 @@ export abstract class AbstractAgent {
74
74
75
75
public abortRun ( ) { }
76
76
77
- protected apply ( input : RunAgentInput , events$ : Observable < BaseEvent > ) : Observable < AgentState > {
77
+ protected apply (
78
+ input : RunAgentInput ,
79
+ events$ : Observable < BaseEvent > ,
80
+ ) : Observable < AgentStateMutation > {
78
81
return defaultApplyEvents ( input , events$ ) ;
79
82
}
80
83
81
84
protected processApplyEvents (
82
85
input : RunAgentInput ,
83
- events$ : Observable < AgentState > ,
84
- ) : Observable < AgentState > {
86
+ events$ : Observable < AgentStateMutation > ,
87
+ ) : Observable < AgentStateMutation > {
85
88
return events$ . pipe (
86
89
tap ( ( event ) => {
87
90
if ( event . messages ) {
0 commit comments