summaryrefslogtreecommitdiff
path: root/libpanto/src/root.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-05 13:55:20 -0600
committert <t@tjp.lol>2026-06-05 14:50:42 -0600
commit73645129a9de90f867908d35e77c9252bae4e534 (patch)
tree90b6cb5f5ec4082a2bc0029de5b6647b7ff4f951 /libpanto/src/root.zig
parent6dbde15c1a08906f26443311a0d5fbd84d0523f0 (diff)
refactor: Agent.run() -> Stream -> Stream.next() -> Event
converted the main agent loop from push-based (into callbacks on a Receiver vtable) to pull-based, where `next()` re-enters a state-machine Stream until the next event can be returned.
Diffstat (limited to 'libpanto/src/root.zig')
-rw-r--r--libpanto/src/root.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/libpanto/src/root.zig b/libpanto/src/root.zig
index a49a428..b5fab1a 100644
--- a/libpanto/src/root.zig
+++ b/libpanto/src/root.zig
@@ -2,6 +2,7 @@ const std = @import("std");
pub const conversation = @import("conversation.zig");
pub const provider = @import("provider.zig");
+pub const stream = @import("stream.zig");
pub const agent = @import("agent.zig");
pub const config = @import("config.zig");
pub const sse = @import("sse.zig");
@@ -32,12 +33,17 @@ pub const ToolRegistry = tool_registry.ToolRegistry;
pub const Config = config.Config;
pub const ProviderConfig = config.ProviderConfig;
+// Re-export the pull-streaming surface for embedders.
+pub const Event = stream.Event;
+pub const Stream = agent.Stream;
+pub const Agent = agent.Agent;
+
// Internal modules. Not part of the public API — callers drive turns via
-// `provider.streamStep(allocator, io, &config, conv, receiver)` (or via the
-// `Agent`, which holds a swappable `*const Config`). The process-global HTTP
-// client is initialized with `config.initHttp` / torn down with
-// `config.deinitHttp`. These impls are exposed here only so `refAllDecls`
-// picks up their tests.
+// the `Agent` (which holds a swappable `*const Config`): `agent.run()`
+// returns a `*Stream` whose `next()` pulls one `Event` at a time. The
+// process-global HTTP client is initialized with `config.initHttp` / torn
+// down with `config.deinitHttp`. These impls are exposed here only so
+// `refAllDecls` picks up their tests.
const openai_chat_json = @import("openai_chat_json.zig");
const provider_openai_chat = @import("provider_openai_chat.zig");
const anthropic_messages_json = @import("anthropic_messages_json.zig");