From f72b5793a5c7e7891e4904be73c0bc6bc038fa18 Mon Sep 17 00:00:00 2001 From: T Date: Wed, 27 May 2026 16:34:32 -0600 Subject: system agent definition scaffolding --- src/panto_home.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/panto_home.zig') diff --git a/src/panto_home.zig b/src/panto_home.zig index b7c1799..353e54b 100644 --- a/src/panto_home.zig +++ b/src/panto_home.zig @@ -30,6 +30,11 @@ pub const Layout = struct { allocator: Allocator, /// `$PANTO_HOME` itself. home: []u8, + /// `$PANTO_HOME/agent/` — the "system" extension/tool tree, + /// populated at bootstrap from files embedded into the panto + /// binary. Searched after user/project layers for tools and + /// extensions; project shadows user shadows system. + agent_dir: []u8, /// `$PANTO_HOME/rocks/lua-/` — the versioned tree. tree: []u8, /// `/include/` — where Lua headers are staged. @@ -52,6 +57,7 @@ pub const Layout = struct { pub fn deinit(self: Layout) void { const a = self.allocator; a.free(self.home); + a.free(self.agent_dir); a.free(self.tree); a.free(self.include_dir); a.free(self.share_lua_dir); @@ -76,6 +82,9 @@ pub fn resolve( const home = try resolveHome(allocator, environ_map); errdefer allocator.free(home); + const agent_dir = try std.fs.path.join(allocator, &.{ home, "agent" }); + errdefer allocator.free(agent_dir); + // `/rocks/lua-` const tree_subdir = try std.fmt.allocPrint( allocator, @@ -111,6 +120,7 @@ pub fn resolve( return .{ .allocator = allocator, .home = home, + .agent_dir = agent_dir, .tree = tree, .include_dir = include_dir, .share_lua_dir = share_lua_dir, @@ -143,6 +153,7 @@ fn resolveHome( /// — existing directories are left alone. pub fn ensureDirsExist(layout: Layout, io: Io) !void { try makePathRecursive(io, layout.home); + try makePathRecursive(io, layout.agent_dir); try makePathRecursive(io, layout.tree); try makePathRecursive(io, layout.include_dir); try makePathRecursive(io, layout.share_lua_dir); -- cgit v1.3