-- LuaRocks rockspec for `libpanto-lua`: the native Lua 5.4 binding for -- libpanto, built in pure Zig. -- -- Distribution model (see docs/libpanto-bindings.md): this is the *source* -- rock — universal, buildable on any OS/arch that has a Zig toolchain. -- LuaRocks prefers a matching pre-built `.PLATFORM.rock` when one is -- published and falls back to building this source rock otherwise (the -- pip "wheel-or-sdist" model). Pre-built binary rocks per platform are a -- later step; no rockspec change is needed to add them. -- -- Build: `build.type = "command"` shells out to `zig build` (so the build -- dependency is Zig, declared informally below since LuaRocks can't fetch -- a compiler), then stages the emitted `panto.so` into `$(LIBDIR)` as the -- bare module name `panto` — discovered by `require('panto')` on cpath. rockspec_format = "3.0" package = "libpanto-lua" version = "0.0.0-1" source = { url = "git+https://code.tjp.lol/libpantograph.git", -- The module lives in the `libpanto-lua/` subdirectory of the repo. dir = "libpantograph/libpanto-lua", } description = { summary = "Native Lua 5.4 bindings for libpanto (pure Zig).", detailed = [[ A loadable Lua 5.4 C-module exposing libpanto's agent + pull-stream API. require('panto') yields panto.agent{...}; an Agent runs turns that stream Events, registers Lua tool handlers (driven by libuv via luv), swaps provider config, manages the system prompt, and compacts. Implemented entirely in Zig (no C translation units); the .so is emitted by `zig build`. ]], homepage = "https://code.tjp.lol/libpantograph", license = "MIT", labels = { "ai", "llm", "agent", "libpanto" }, } -- Lua 5.4 only (Lua has no stable ABI across minor versions; a module -- built for 5.4 will not load in 5.3 or 5.5). `luv` is required for tool -- dispatch: tool handlers run as coroutines driven by `uv.run`. dependencies = { "lua >= 5.4, < 5.5", "luv", } -- Zig is required at build time. LuaRocks has no notion of a Zig toolchain -- dependency, so this is enforced by the build_command failing loudly if -- `zig` is absent rather than by a declared dependency. build = { type = "command", -- Build the shared object. `zig build` reads ./build.zig and emits -- zig-out/lib/panto.so (see build.zig: the install step renames the -- artifact to the bare `panto.so` a Lua C-module requires). build_command = "zig build -Doptimize=ReleaseFast", -- Stage the emitted module into LuaRocks' library dir under the bare -- name `panto` so `require('panto')` resolves it on cpath. $(LIBDIR) -- is substituted by LuaRocks at install time. install_command = "cp zig-out/lib/panto.so $(LIBDIR)/panto.so", }