mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-08 20:32:00 -04:00
Built against https://github.com/lightpanda-io/zig-v8-fork/tree/zig-0.16 but it doesn't require a new v8 build. Built against https://github.com/lightpanda-io/boringssl-zig/tree/zig-0.16 since the current fork we point to isn't updated. A global std.Io instance, lp.io. Way easier this way and requires 0 changes to our libcurl integration / event loop. Network code uses a new layer that does what Zig 0.15's posix package used to do. Again, quicker migration that way. But, as long as we have the global IO, and given the half-baked nature of networking in std.Io 0.16, this just makes sense. Things can be migrated as needed. The std.time.* -> std.Io.Timestamp/Clock/Duration resulted in _a lot_ of changes. ArrayList = .{} -> ArrayList -> .empty also resulted in a lot of changes, but that's obviously superficial. As is the trimLeft/trimRight -> trimStart/trimEnd rename. Locking adopt the `Uncancelable` variants, e.g. mutex.lockUncancelable() to preserve the error-free signature (and, because cancellation would be something we'd have to put more thought into). std.json.ObjectMap is now unmanaged, so the allocator had to be passed along. However, there's still a deprecated managed variant of MemoryPool, so I switched to it (we can do a small follow up PR to move to the unmanaged after). I tried use_llvm = false, but it locks my computer, consuming RAM until MacOS gives me a popup I've never seen before, begging me to start killing processes. Agent and the networking stuff saw the most significant changes.
62 lines
2.2 KiB
Zig
62 lines
2.2 KiB
Zig
// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
|
|
//
|
|
// Francis Bouvier <francis@lightpanda.io>
|
|
// Pierre Tachoire <pierre@lightpanda.io>
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
// License, or (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
//! Generates the LLM skill tree (`<outdir>/<name>/SKILL.md`), invoked by
|
|
//! `zig build skills`. The documents are rendered from the same code the
|
|
//! runtime uses, so they can't go stale.
|
|
|
|
const std = @import("std");
|
|
const lp = @import("lightpanda");
|
|
|
|
const Skill = struct {
|
|
name: []const u8,
|
|
write: *const fn (writer: *std.Io.Writer) std.Io.Writer.Error!void,
|
|
};
|
|
|
|
const skills = [_]Skill{
|
|
.{ .name = lp.skill.name, .write = lp.skill.write },
|
|
};
|
|
|
|
pub fn main(init: std.process.Init) !void {
|
|
// usage: skills <outdir>
|
|
var args = std.process.Args.Iterator.init(init.minimal.args);
|
|
_ = args.next(); // executable name
|
|
const out_path = args.next() orelse {
|
|
std.debug.print("usage: lightpanda-skills <outdir>\n", .{});
|
|
return error.MissingArgument;
|
|
};
|
|
|
|
try std.Io.Dir.cwd().createDirPath(lp.io, out_path);
|
|
var out_dir = try std.Io.Dir.cwd().openDir(lp.io, out_path, .{});
|
|
defer out_dir.close(lp.io);
|
|
|
|
for (skills) |s| {
|
|
try out_dir.createDirPath(lp.io, s.name);
|
|
var skill_dir = try out_dir.openDir(lp.io, s.name, .{});
|
|
defer skill_dir.close(lp.io);
|
|
|
|
const file = try skill_dir.createFile(lp.io, "SKILL.md", .{});
|
|
defer file.close(lp.io);
|
|
|
|
var buffer: [4096]u8 = undefined;
|
|
var writer = file.writer(lp.io, &buffer);
|
|
try s.write(&writer.interface);
|
|
try writer.end();
|
|
}
|
|
}
|