const std = @import("std"); const libpanto = @import("panto"); pub fn main() !void { const config = libpanto.config.Config{ .api_style = .anthropic, .api_key = "test", .base_url = "https://api.anthropic.com", .model = "claude-sonnet-4-20250514", }; var debug_allocator = std.heap.DebugAllocator(.{}).init; defer _ = debug_allocator.deinit(); const alloc = debug_allocator.allocator(); var conv = libpanto.conversation.Conversation.init(alloc); defer conv.deinit(); try conv.addSystemMessage("You are a helpful assistant."); const io = std.Io.Threaded.global_single_threaded.io(); var stdout_buffer: [4096]u8 = undefined; var stdout_file = std.Io.File.stdout().writer(io, &stdout_buffer); const stdout = &stdout_file.interface; var stdin_buffer: [4096]u8 = undefined; var stdin_file = std.Io.File.stdin().reader(io, &stdin_buffer); const stdin = &stdin_file.interface; try stdout.print("panto — model: {s}\n> ", .{config.model}); try stdout_file.flush(); while (true) { const line = stdin.takeDelimiter('\n') catch |err| { std.debug.print("Read error: {}\n", .{err}); return; }; if (line) |text| { if (text.len == 0) { try stdout.print("> ", .{}); try stdout_file.flush(); continue; } // Copy the line since the reader buffer may be reused const owned = try alloc.dupe(u8, text); defer alloc.free(owned); try conv.addUserMessage(owned); // TODO: call agent.runStep() once provider is implemented try stdout.print("(streaming not yet implemented)\n> ", .{}); try stdout_file.flush(); } else { // EOF (Ctrl+D) try stdout.print("\n", .{}); try stdout_file.flush(); break; } } }