Skip to content

Commit 9fbb4fe

Browse files
committed
remove stream.ts
1 parent 2792de3 commit 9fbb4fe

File tree

5 files changed

+14
-30
lines changed

5 files changed

+14
-30
lines changed

typescript-sdk/packages/client/src/agent/agent.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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";
33

44
import { AgentConfig, RunAgentParameters } from "./types";
55
import { v4 as uuidv4 } from "uuid";
@@ -12,7 +12,7 @@ import { convertToLegacyEvents } from "@/legacy/convert";
1212
import { LegacyRuntimeProtocolEvent } from "@/legacy/types";
1313
import { lastValueFrom, of } from "rxjs";
1414
import { transformChunks } from "@/chunks";
15-
import { RunAgentSubscriber } from "./subscriber";
15+
import { AgentStateMutation, RunAgentSubscriber } from "./subscriber";
1616

1717
export abstract class AbstractAgent {
1818
public agentId?: string;
@@ -48,7 +48,7 @@ export abstract class AbstractAgent {
4848
};
4949
}
5050

51-
protected abstract run(...args: Parameters<RunAgent>): ReturnType<RunAgent>;
51+
protected abstract run(input: RunAgentInput): Observable<BaseEvent>;
5252

5353
public async runAgent(parameters?: RunAgentParameters): Promise<void> {
5454
this.agentId = this.agentId ?? uuidv4();
@@ -74,14 +74,17 @@ export abstract class AbstractAgent {
7474

7575
public abortRun() {}
7676

77-
protected apply(input: RunAgentInput, events$: Observable<BaseEvent>): Observable<AgentState> {
77+
protected apply(
78+
input: RunAgentInput,
79+
events$: Observable<BaseEvent>,
80+
): Observable<AgentStateMutation> {
7881
return defaultApplyEvents(input, events$);
7982
}
8083

8184
protected processApplyEvents(
8285
input: RunAgentInput,
83-
events$: Observable<AgentState>,
84-
): Observable<AgentState> {
86+
events$: Observable<AgentStateMutation>,
87+
): Observable<AgentStateMutation> {
8588
return events$.pipe(
8689
tap((event) => {
8790
if (event.messages) {

typescript-sdk/packages/client/src/agent/http.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { AbstractAgent } from "./agent";
2-
import { runHttpRequest, HttpEvent } from "@/run/http-request";
2+
import { runHttpRequest } from "@/run/http-request";
33
import { HttpAgentConfig, RunAgentParameters } from "./types";
4-
import { RunAgent, RunAgentInput, BaseEvent } from "@ag-ui/core";
4+
import { RunAgentInput, BaseEvent } from "@ag-ui/core";
55
import { structuredClone_ } from "@/utils";
66
import { transformHttpEventStream } from "@/transform/http";
77
import { Observable } from "rxjs";

typescript-sdk/packages/client/src/apply/default.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { mergeMap } from "rxjs/operators";
1919
import { structuredClone_ } from "../utils";
2020
import { applyPatch } from "fast-json-patch";
2121
import untruncateJson from "untruncate-json";
22-
import { AgentState } from "@ag-ui/core";
22+
import { AgentStateMutation } from "@/agent/subscriber";
2323
import { Observable } from "rxjs";
2424

2525
interface PredictStateValue {
@@ -31,13 +31,13 @@ interface PredictStateValue {
3131
export const defaultApplyEvents = (
3232
input: RunAgentInput,
3333
events$: Observable<BaseEvent>,
34-
): Observable<AgentState> => {
34+
): Observable<AgentStateMutation> => {
3535
let messages = structuredClone_(input.messages);
3636
let state = structuredClone_(input.state);
3737
let predictState: PredictStateValue[] | undefined;
3838

3939
// Helper function to emit state updates with proper cloning
40-
const emitUpdate = (agentState: AgentState) => [structuredClone_(agentState)];
40+
const emitUpdate = (agentState: AgentStateMutation) => [structuredClone_(agentState)];
4141

4242
const emitNoUpdate = () => [];
4343

typescript-sdk/packages/core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ export * from "./types";
33

44
// Export all event-related types and schemas
55
export * from "./events";
6-
7-
// Export all stream-related types and schemas
8-
export * from "./stream";

typescript-sdk/packages/core/src/stream.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)