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
@@ -1,5 +1,11 @@
import { Agent } from "@earendil-works/pi-agent-core";
import { type AssistantMessage, getModel, type ToolResultMessage, type Usage } from "@earendil-works/pi-ai/compat";
import {
type AssistantMessage,
getModel,
streamSimple,
type ToolResultMessage,
type Usage,
} from "@earendil-works/pi-ai/compat";
import { describe, expect, it } from "vitest";
import { AgentSession } from "../src/core/agent-session.ts";
import { AuthStorage } from "../src/core/auth-storage.ts";
@@ -69,6 +75,7 @@ async function createSession() {
const session = new AgentSession({
agent: new Agent({
getApiKey: () => "test-key",
streamFunction: streamSimple,
initialState: {
model,
systemPrompt: "You are a helpful assistant.",