From 69a1ee138bb78ad4663fe2d9e58678f7b0d07b74 Mon Sep 17 00:00:00 2001 From: t Date: Tue, 23 Jun 2026 09:38:23 -0600 Subject: ponytail simplifications to panto cli and lua extensiosn --- src/main.zig | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 4b26a22..2c5b414 100644 --- a/src/main.zig +++ b/src/main.zig @@ -8,7 +8,6 @@ const lua_event_bridge = @import("lua_event_bridge.zig"); const extension_loader = @import("extension_loader.zig"); const panto_home = @import("panto_home.zig"); const luarocks_runtime = @import("luarocks_runtime.zig"); -const self_exe = @import("self_exe.zig"); const subcommand = @import("subcommand.zig"); const session_paths = @import("session_paths.zig"); const models_toml = @import("models_toml.zig"); @@ -20,9 +19,8 @@ const command = @import("command.zig"); const command_compaction = @import("compaction.zig"); const debug_log = @import("debug_log.zig"); -/// Route the process-wide log stream. In Debug builds this redirects every -/// `std.log` call to a per-session file (keeping the TUI clean); other builds -/// keep the stderr default. See `debug_log.zig`. +/// Route the process-wide log stream. `PANTO_DEBUG!=0` redirects it to a +/// per-session file; otherwise this keeps the stderr default. pub const std_options: std.Options = .{ .logFn = debug_log.logFn }; // TUI foundation layer (Phase 1, sub-phase 1). Not yet wired into the REPL; @@ -59,7 +57,6 @@ test { _ = extension_loader; _ = panto_home; _ = luarocks_runtime; - _ = self_exe; _ = subcommand; _ = models_toml; _ = config_file; @@ -169,7 +166,7 @@ pub fn main(init: std.process.Init) !void { // Resolve the absolute path of the running panto binary. Needed // both by `panto lua` (we re-exec ourselves through a wrapper // luarocks invokes) and by the agent's bootstrap. - const panto_path = try self_exe.selfExePathAlloc(alloc); + const panto_path = try std.process.executablePathAlloc(io, alloc); defer alloc.free(panto_path); // Subcommand dispatch: `panto lua` and `panto bootstrap` short @@ -289,10 +286,10 @@ pub fn main(init: std.process.Init) !void { // `session.info` is adopted by the agent below (`Agent.init` can't fail) // and freed in the agent's `deinit`; no separate cleanup here. - // Arm the per-session debug log now that we know the session id. In Debug - // builds this opens `$PANTO_HOME/debug/.log` and redirects all - // `std.log` output there; no-op in release. Best-effort — failures leave - // logging disabled rather than aborting startup. + // Arm the per-session debug log now that we know the session id. + // PANTO_DEBUG!=0 redirects `std.log` output to + // `/debug/.log`. Best-effort: failures leave normal + // logging in place. debug_log.init(alloc, io, init.environ_map, session.info.id); const is_resume = cli_flags.resume_kind != .none and session.info.message_count > 0; @@ -341,7 +338,7 @@ pub fn main(init: std.process.Init) !void { // Bootstrap luarocks against the Lua runtime's lua_State — same // pipeline as `panto lua` and `panto bootstrap`. After this, // `require("luarocks.*")` works and any pinned batteries from the - // manifest are installed under $PANTO_HOME. + // manifest are installed under the panto data home. const luarocks_rt = try luarocks_runtime.bootstrap( alloc, io, @@ -352,7 +349,7 @@ pub fn main(init: std.process.Init) !void { defer luarocks_rt.deinit(); // Source the system prompt now that the base agent tree has been - // staged to `$PANTO_HOME/agent` (the bootstrap above writes the + // staged to `/agent` (the bootstrap above writes the // bundled `SYSTEM.md` there). The prompt is sourced by convention // from SYSTEM.md / APPEND_SYSTEM.md across the base/user/project // layers; the base layer is `luarocks_rt.layout.agent_dir`. @@ -392,7 +389,7 @@ pub fn main(init: std.process.Init) !void { try rt.installScheduler(); // Discover Lua extensions across three layers — base - // ($PANTO_HOME/agent), user ($XDG_CONFIG_HOME/panto or + // (/agent), user ($XDG_CONFIG_HOME/panto or // $HOME/.config/panto), and project (./.panto). Project shadows // user shadows base; tool-name collisions across surviving // entries abort startup. -- cgit v1.3