summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AGENTS.md3
-rw-r--r--build.zig6
-rw-r--r--build.zig.zon6
-rw-r--r--libawl/src/config.zig37
-rw-r--r--libpanto/build.zig (renamed from libawl/build.zig)4
-rw-r--r--libpanto/build.zig.zon (renamed from libawl/build.zig.zon)4
-rw-r--r--libpanto/src/agent.zig (renamed from libawl/src/agent.zig)0
-rw-r--r--libpanto/src/config.zig25
-rw-r--r--libpanto/src/conversation.zig (renamed from libawl/src/conversation.zig)0
-rw-r--r--libpanto/src/json.zig (renamed from libawl/src/json.zig)0
-rw-r--r--libpanto/src/provider.zig (renamed from libawl/src/provider.zig)0
-rw-r--r--libpanto/src/provider_openai.zig (renamed from libawl/src/provider_openai.zig)0
-rw-r--r--libpanto/src/root.zig (renamed from libawl/src/root.zig)0
-rw-r--r--libpanto/src/sse.zig (renamed from libawl/src/sse.zig)0
-rw-r--r--src/main.zig12
15 files changed, 44 insertions, 53 deletions
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..1adfa7a
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,3 @@
+# pantograph
+
+Acronyms in CamelCase are fully capitalized: `APIStyle`, `HTTPClient`, `IDLookup`. Field names are snake_case: `api_style`, `base_url`, `model`.
diff --git a/build.zig b/build.zig
index f7d7149..c5ea966 100644
--- a/build.zig
+++ b/build.zig
@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
- const libpanto_dep = b.dependency("libpanto", .{
+ const panto_lib_dep = b.dependency("panto", .{
.target = target,
.optimize = optimize,
});
@@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
- exe_mod.addImport("libpanto", libpanto_dep.module("libpanto"));
+ exe_mod.addImport("panto", panto_lib_dep.module("panto"));
const exe = b.addExecutable(.{
.name = "panto",
@@ -39,7 +39,7 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
- test_mod.addImport("libpanto", libpanto_dep.module("libpanto"));
+ test_mod.addImport("panto", panto_lib_dep.module("panto"));
const unit_tests = b.addTest(.{
.name = "panto-tests",
diff --git a/build.zig.zon b/build.zig.zon
index 71373e1..57dc3b5 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -1,10 +1,10 @@
.{
- .fingerprint = 0x922eba47080389e5,
+ .fingerprint = 0x687da1a5c89a370f,
.name = .panto,
.version = "0.0.0",
.dependencies = .{
- .libpanto = .{
- .path = "libpanto",
+ .panto = .{
+ .path = "panto",
},
},
.paths = .{
diff --git a/libawl/src/config.zig b/libawl/src/config.zig
deleted file mode 100644
index 8b6f147..0000000
--- a/libawl/src/config.zig
+++ /dev/null
@@ -1,37 +0,0 @@
-const std = @import("std");
-
-pub const Config = struct {
- api_key: []const u8,
- base_url: []const u8,
- model: []const u8,
-
- pub const Error = error{MissingApiKey};
-
- pub fn fromEnv() Error!Config {
- const api_key_z = std.c.getenv("PANTO_API_KEY") orelse return Error.MissingApiKey;
- const api_key = std.mem.sliceTo(api_key_z, 0);
-
- const base_url_z = std.c.getenv("PANTO_BASE_URL") orelse "https://api.openai.com/v1";
- const base_url = std.mem.sliceTo(base_url_z, 0);
-
- const model_z = std.c.getenv("PANTO_MODEL") orelse "gpt-4o";
- const model = std.mem.sliceTo(model_z, 0);
-
- return Config{
- .api_key = api_key,
- .base_url = base_url,
- .model = model,
- };
- }
-};
-
-test "Config - defaults" {
- const cfg = Config{
- .api_key = "test-key",
- .base_url = "https://api.openai.com/v1",
- .model = "gpt-4o",
- };
- try std.testing.expectEqualStrings("test-key", cfg.api_key);
- try std.testing.expectEqualStrings("https://api.openai.com/v1", cfg.base_url);
- try std.testing.expectEqualStrings("gpt-4o", cfg.model);
-}
diff --git a/libawl/build.zig b/libpanto/build.zig
index 5e8442b..b70ae7b 100644
--- a/libawl/build.zig
+++ b/libpanto/build.zig
@@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
// Public module — other packages can import this via dependency
- _ = b.addModule("libpanto", .{
+ _ = b.addModule("panto", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
@@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void {
});
const unit_tests = b.addTest(.{
- .name = "libpanto-tests",
+ .name = "panto-tests",
.root_module = test_module,
});
diff --git a/libawl/build.zig.zon b/libpanto/build.zig.zon
index f00be75..10d9111 100644
--- a/libawl/build.zig.zon
+++ b/libpanto/build.zig.zon
@@ -1,6 +1,6 @@
.{
- .fingerprint = 0xa69627633d440178,
- .name = .libpanto,
+ .fingerprint = 0x687da1a5092d6c39,
+ .name = .panto,
.version = "0.0.0",
.paths = .{
"build.zig",
diff --git a/libawl/src/agent.zig b/libpanto/src/agent.zig
index 7ebc058..7ebc058 100644
--- a/libawl/src/agent.zig
+++ b/libpanto/src/agent.zig
diff --git a/libpanto/src/config.zig b/libpanto/src/config.zig
new file mode 100644
index 0000000..295f2c6
--- /dev/null
+++ b/libpanto/src/config.zig
@@ -0,0 +1,25 @@
+pub const APIStyle = enum {
+ anthropic,
+};
+
+pub const Config = struct {
+ api_style: APIStyle,
+ api_key: []const u8,
+ base_url: []const u8,
+ model: []const u8,
+};
+
+const t = @import("std").testing;
+
+test "Config - construct with all fields" {
+ const cfg = Config{
+ .api_style = .anthropic,
+ .api_key = "sk-ant-test",
+ .base_url = "https://api.anthropic.com",
+ .model = "claude-sonnet-4-20250514",
+ };
+ try t.expectEqual(APIStyle.anthropic, cfg.api_style);
+ try t.expectEqualStrings("sk-ant-test", cfg.api_key);
+ try t.expectEqualStrings("https://api.anthropic.com", cfg.base_url);
+ try t.expectEqualStrings("claude-sonnet-4-20250514", cfg.model);
+}
diff --git a/libawl/src/conversation.zig b/libpanto/src/conversation.zig
index 0e9a4e9..0e9a4e9 100644
--- a/libawl/src/conversation.zig
+++ b/libpanto/src/conversation.zig
diff --git a/libawl/src/json.zig b/libpanto/src/json.zig
index 542391e..542391e 100644
--- a/libawl/src/json.zig
+++ b/libpanto/src/json.zig
diff --git a/libawl/src/provider.zig b/libpanto/src/provider.zig
index 8d6eea5..8d6eea5 100644
--- a/libawl/src/provider.zig
+++ b/libpanto/src/provider.zig
diff --git a/libawl/src/provider_openai.zig b/libpanto/src/provider_openai.zig
index c459a9e..c459a9e 100644
--- a/libawl/src/provider_openai.zig
+++ b/libpanto/src/provider_openai.zig
diff --git a/libawl/src/root.zig b/libpanto/src/root.zig
index 72ceb97..72ceb97 100644
--- a/libawl/src/root.zig
+++ b/libpanto/src/root.zig
diff --git a/libawl/src/sse.zig b/libpanto/src/sse.zig
index 150c3ea..150c3ea 100644
--- a/libawl/src/sse.zig
+++ b/libpanto/src/sse.zig
diff --git a/src/main.zig b/src/main.zig
index 1356bdc..4f9c490 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1,12 +1,12 @@
const std = @import("std");
-const libpanto = @import("libpanto");
+const libpanto = @import("panto");
pub fn main() !void {
- const config = libpanto.config.Config.fromEnv() catch |err| switch (err) {
- error.MissingApiKey => {
- std.debug.print("panto: PANTO_API_KEY environment variable is required\n", .{});
- return;
- },
+ 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;