summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-07 11:42:41 -0600
committert <t@tjp.lol>2026-06-07 11:42:41 -0600
commit11818552dad254649af012df3b4277633943d2b6 (patch)
tree88c60f54b0a71d92adb4b09c7ff984080b5d86ac /src/main.zig
parent457ee6a0d56c5a0470e77fca79d3e85f65f51fec (diff)
Migrate panto CLI onto the public.zig surface
Move the CLI off the internal libpanto module namespaces onto the curated public API: data-type aliases (Config family, Message/MessageRole/ effectiveSystemBlocks, Event, Pricing/PricingRegistry, the session seam, FileSystemJSONLStore, ContentBlockType), process lifecycle (panto.init/ deinit), and ResultParts.fromText/fromTextOwned/deinit in place of the freestanding textResult/ownedTextResult/freeResultParts. The CLI remains on two flagged internal namespaces, panto.agent and panto.conversation: it is a deep embedder that drives the loop below the curated Agent/Conversation facades (system-prompt seeding through the agent, compaction_system_prompt, the open_stream_fn test seam, standalone Conversation values, compactAndPersist). These stay re-exported from public.zig as a documented deep-embedder escape hatch; trimming the transitional block removed every other internal re-export.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.zig b/src/main.zig
index 247817a..995735f 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -45,9 +45,9 @@ test {
_ = command_compaction;
}
-const ContentBlockType = panto.provider.ContentBlockType;
-const MessageRole = panto.conversation.MessageRole;
-const Event = panto.stream.Event;
+const ContentBlockType = panto.ContentBlockType;
+const MessageRole = panto.MessageRole;
+const Event = panto.Event;
/// Display state for the pull-stream CLI renderer. Prints streaming deltas
/// to stdout; thinking blocks are dimmed with ANSI escape codes, text blocks
@@ -307,22 +307,22 @@ pub fn main(init: std.process.Init) !void {
// Resolve the optional compaction-model override into a ProviderConfig.
// On any resolution failure we log and fall back to no override (the
// active chat model is used for compaction).
- const compaction_provider_config: ?panto.config.ProviderConfig = blk: {
+ const compaction_provider_config: ?panto.ProviderConfig = blk: {
const ref = app_config.compaction_model_ref orelse break :blk null;
break :blk config_file.buildProviderConfig(&app_config, &models.defs, ref) catch |err| {
std.log.warn("compaction_model resolution failed ({t}); using active model", .{err});
break :blk null;
};
};
- const compaction_cfg: panto.config.CompactionConfig = .{
+ const compaction_cfg: panto.CompactionConfig = .{
.keep_verbatim = app_config.compaction_keep_verbatim orelse 20_000,
.model = compaction_provider_config,
};
// Process-global HTTP client: one connection pool for every provider /
// base_url the agent may switch to. Torn down at shutdown.
- panto.config.initHttp(alloc, io);
- defer panto.config.deinitHttp();
+ panto.init(alloc, io);
+ defer panto.deinit();
const banner_model_initial: []const u8 = switch (provider_config) {
inline else => |c| c.model,
@@ -333,7 +333,7 @@ pub fn main(init: std.process.Init) !void {
// per-cwd `session_dir` (the CLI owns the cwd→dir grouping; the store
// is cwd-agnostic). Must outlive the agent, which appends through a
// `Session` handle minted/resolved below.
- var session_store_impl = try panto.session_manager.FileSystemJSONLStore.init(alloc, io, session_dir, cwd);
+ var session_store_impl = try panto.FileSystemJSONLStore.init(alloc, io, session_dir, cwd);
defer session_store_impl.deinit();
const session_store = session_store_impl.store();
@@ -376,7 +376,7 @@ pub fn main(init: std.process.Init) !void {
// built but before the first turn, so in-place registration is visible.
// System-prompt seeding/reconciliation below runs *through* the agent
// so those entries persist.
- const active_config: panto.config.Config = .{
+ const active_config: panto.Config = .{
.provider = provider_config,
.compaction = compaction_cfg,
};
@@ -648,12 +648,12 @@ fn parseAgentFlags(alloc: std.mem.Allocator, args: std.process.Args) !AgentFlags
/// most recent. The returned `Session` owns its `info` (freed via the
/// agent's `deinit`, which adopts it).
fn openSession(
- store: panto.session_store.SessionStore,
+ store: panto.SessionStore,
flags: AgentFlags,
session_dir: []const u8,
stdout: *std.Io.Writer,
stdout_file: *std.Io.File.Writer,
-) !panto.session_store.Session {
+) !panto.Session {
switch (flags.resume_kind) {
.none => return store.create(),
.most_recent => {