diff options
| author | t <t@tjp.lol> | 2026-06-10 10:06:07 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-06-10 12:17:27 -0600 |
| commit | bb85e867bc938138f29fb45230169af1ba60761c (patch) | |
| tree | 5ad1cf50274c61ccfffab7048b4a4e28003d82b5 /build/gen_panto_so_embed.zig | |
| parent | d26890bbc52e9f0050db40f208763a7f2b714ddd (diff) | |
Add addUserText helper; update all call sites
Conversation.addUserMessage now takes a []ContentBlock (symmetric with
addAssistantMessage). Introduce a thin addUserText wrapper in agent.zig
for the plain-text case and update every call site in agent.zig and
anthropic_messages_json.zig accordingly.
Diffstat (limited to 'build/gen_panto_so_embed.zig')
| -rw-r--r-- | build/gen_panto_so_embed.zig | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/build/gen_panto_so_embed.zig b/build/gen_panto_so_embed.zig new file mode 100644 index 0000000..37b8329 --- /dev/null +++ b/build/gen_panto_so_embed.zig @@ -0,0 +1,42 @@ +//! Build-time codegen: emit a Zig module exposing the compiled +//! `libpanto-lua` shared object (`panto.so`) as embedded bytes. Bootstrap +//! writes these to `<tree>/lib/lua/<short>/panto.so` on first run so the +//! embedded VM's `require('panto')` resolves to the native module on a +//! cold machine with no network — the guaranteed initial module load. +//! +//! Invoked from `build.zig`: +//! +//! gen-panto-so-embed <embed-name> <out-file> +//! +//! `<embed-name>` is the filename the generated module `@embedFile`s; the +//! actual `.so` is materialized alongside the generated file under that +//! name via `addCopyFile` so `@embedFile` can reach it. + +const std = @import("std"); + +pub fn main(init: std.process.Init) !void { + const io = init.io; + + var args = init.minimal.args.iterate(); + defer args.deinit(); + _ = args.next(); + const embed_name = args.next() orelse return error.MissingEmbedName; + const out_path = args.next() orelse return error.MissingOutPath; + + var out_file = try std.Io.Dir.cwd().createFile(io, out_path, .{}); + defer out_file.close(io); + var buf: [4096]u8 = undefined; + var writer = out_file.writer(io, &buf); + const w = &writer.interface; + + try w.print( + \\//! Auto-generated. Do not edit. See build/gen_panto_so_embed.zig. + \\ + \\/// The compiled `libpanto-lua` shared object, embedded so the + \\/// bootstrap can stage it onto the embedded VM's `package.cpath`. + \\pub const bytes: []const u8 = @embedFile("{s}"); + \\ + , .{embed_name}); + + try w.flush(); +} |
