mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
src/next is src (the main export), src/next-node is src/node with short subpaths (/http, /workers, /plugins, /plugins/runtime, /app, /surfaces, /web, /react, /tui, /tui/launcher); the foundations get /json and /watch; Chord v1 moves to src/old (/old, /old/node) until p2 runs on v2; tests and docs move likewise (test/, docs/, test/old, docs/old). Durable and env import the foundations from their subpaths.
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import { createHost, memoryLinkPair } from "@earendil-works/chord";
|
|
import { createHost as createOldHost, replicatedState } from "@earendil-works/chord/old";
|
|
import { createAssistantMessageEventStream, validateToolArguments } from "@earendil-works/pi-ai";
|
|
import { complete, getModel, getProviders, streamSimple } from "@earendil-works/pi-ai/compat";
|
|
import { Agent, streamProxy } from "@earendil-works/pi-agent-core";
|
|
import { obj, str } from "@earendil-works/pi-schema";
|
|
|
|
// Keep this entry browser-safe. It is bundled by scripts/check-browser-smoke.mjs
|
|
// to catch accidental Node-only runtime imports in browser-facing package exports.
|
|
const model = getModel("google", "gemini-2.5-flash");
|
|
const schema = obj({ prompt: str() });
|
|
const args = validateToolArguments(
|
|
{ name: "prompt", description: "", parameters: schema },
|
|
{ type: "toolCall", id: "1", name: "prompt", arguments: { prompt: 1 } },
|
|
);
|
|
const stream = createAssistantMessageEventStream();
|
|
|
|
const agent = new Agent({ initialState: { model }, streamFn: streamSimple });
|
|
agent.steer({ role: "user", content: [{ type: "text", text: "queued" }], timestamp: 0 });
|
|
|
|
console.log(
|
|
model.id,
|
|
getProviders().length,
|
|
typeof complete,
|
|
schema.type,
|
|
args.prompt,
|
|
typeof stream.push,
|
|
agent.hasQueuedMessages(),
|
|
typeof streamProxy,
|
|
typeof createHost,
|
|
typeof createOldHost,
|
|
typeof memoryLinkPair,
|
|
replicatedState({ browser: true }).value.browser,
|
|
);
|