summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-16 12:28:55 -0600
committert <t@tjp.lol>2026-06-16 13:10:31 -0600
commit7847db3b13bc8639b5173ce3c56ae4068617ce12 (patch)
treedabd476e020edfcd2b39681c14a78042d587632d
parent493a15c310fe2566107a1b200cb654295502657a (diff)
support static linking, and openai_codex_responses in libpanto-c
-rw-r--r--docs/todos.md6
-rw-r--r--libpanto-c/build.zig11
-rw-r--r--libpanto-c/src/lib.zig8
3 files changed, 16 insertions, 9 deletions
diff --git a/docs/todos.md b/docs/todos.md
index 17dee74..72b2d4d 100644
--- a/docs/todos.md
+++ b/docs/todos.md
@@ -2,16 +2,16 @@
- [x] user-provided system prompt (design: docs/archive/system-prompt.md)
- [x] polish zig API
-- [ ] C ABI
+- [x] C ABI
- [x] Agent compaction with custom compaction prompts
- [x] Agent auto-compaction
- [x] image upload support
- [ ] google gemini native provider
-- [ ] openai responses API native provider
+- [x] openai responses API native provider
- [ ] non-streaming
- [ ] one-shot simple API
- [x] message-level error retries
-- [ ] abort/cancellation
+- [x] abort/cancellation
- [ ] user message queueing: steering, follow-up
- [ ] step cap, stop conditions
diff --git a/libpanto-c/build.zig b/libpanto-c/build.zig
index 8c3cb8e..2e3160c 100644
--- a/libpanto-c/build.zig
+++ b/libpanto-c/build.zig
@@ -14,8 +14,15 @@ pub fn build(b: *std.Build) void {
});
mod.addImport("panto", panto_dep.module("panto"));
- const lib = b.addLibrary(.{ .name = "panto", .root_module = mod, .linkage = .dynamic });
- lib.rdynamic = true;
+ const linkage = b.option(std.builtin.LinkMode, "linkage", "Library linkage: dynamic (default) or static") orelse .dynamic;
+ const lib = b.addLibrary(.{ .name = "panto", .root_module = mod, .linkage = linkage });
+ if (linkage == .dynamic) {
+ lib.rdynamic = true;
+ } else {
+ // Bundle compiler_rt into the archive so the final consumer link
+ // (e.g. cgo) doesn't need Zig's runtime support library separately.
+ lib.bundle_compiler_rt = true;
+ }
b.installArtifact(lib);
b.installFile("include/panto.h", "include/panto.h");
diff --git a/libpanto-c/src/lib.zig b/libpanto-c/src/lib.zig
index d877abe..716e16b 100644
--- a/libpanto-c/src/lib.zig
+++ b/libpanto-c/src/lib.zig
@@ -368,10 +368,10 @@ fn freeProvider(pv: *panto.ProviderConfig) void {
allocator.free(c.model);
if (c.api_version.ptr != "2023-06-01".ptr) allocator.free(c.api_version);
},
- // The Responses style is not constructible across the C ABI (no
- // PantoAPIStyle variant), so `convertProvider` never builds it; this
- // case exists only to keep the union switch exhaustive.
- .openai_responses => |c| {
+ // The Responses styles are not constructible across the C ABI (no
+ // PantoAPIStyle variant), so `convertProvider` never builds them; these
+ // cases exist only to keep the union switch exhaustive.
+ .openai_responses, .openai_codex_responses => |c| {
allocator.free(c.api_key);
allocator.free(c.base_url);
allocator.free(c.model);