fix(agent): decouple agent streams from compat

closes #6851
This commit is contained in:
Mario Zechner
2026-07-20 17:54:17 +02:00
parent 3a40794ea1
commit 1235c0ec64
29 changed files with 219 additions and 105 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { createAssistantMessageEventStream, Type } from "@earendil-works/pi-ai";
import { complete, getModel, getProviders } from "@earendil-works/pi-ai/compat";
import { complete, getModel, getProviders, streamSimple } from "@earendil-works/pi-ai/compat";
import {
Agent,
bashExecutionToText,
@@ -24,7 +24,7 @@ const model = getModel("google", "gemini-2.5-flash");
const schema = Type.Object({ prompt: Type.String() });
const stream = createAssistantMessageEventStream();
const agent = new Agent({ initialState: { model } });
const agent = new Agent({ initialState: { model }, streamFunction: streamSimple });
agent.steer({ role: "user", content: [{ type: "text", text: "queued" }], timestamp: 0 });
const repo = new InMemorySessionRepo();
const result = getOrThrow(ok({ value: 1 }));