Conversation
A C ABI (include/lightpanda.h + src/c_api.zig) over the browser tool surface: lp_init/lp_shutdown, lp_fetch, sessions with lp_call/pump/ cancel, lp_tools_json. Built as a shared library only; the version script keeps everything but lp_* internal so the bundled OpenSSL/curl/ sqlite cannot collide with a host's own. Embedders get a hidden 'embed' Config mode (not parseable from the CLI) with telemetry defaulting off; crash reports honor the same opt-out. ToolSession in lightpanda.zig owns the browser/session/ registry lifecycle the C API drives. Build: C deps are always PIC (like boringssl's force_pic) and the pinned zig-v8-fork always builds V8 library-safe, so 'zig build shared-lib' needs no flags. It only refuses -Dprebuilt_v8_path: today's published archives are exe-only (local-exec TLS, malloc shim); the guard goes away once a fork release ships library-safe archives. make lib-shared / lib-test / lib-shared-example drive it.
karlseguin
left a comment
There was a problem hiding this comment.
I'm building on MacOS now. Will update if there's an issue.
Three things (+ the telemetry-off decision that needs to be OKd)
1 - Consuming a C API from a non-C language is often tedious because of the null-terminated strings. I always prefer APIs that support both the ability to pass a null-terminated string OR a ptr + len
2 - All the error codes are opaque. You have an arena, so an lp_last_error that takes a SessionHandle woudl be nice
3 - Would be nice if the CI could build this, build an example, and verify its output.
This was all Claude. I'm not good enough at builds. But the issue appears to be that the MacOS build exports everything and the only solution is to hide them at compile time. This does not work for v8 (which goes through its own build system), but Claude says it's fine since those are mangled and would only conflict if the user embedded v8 directly also.
Expose `lp_last_error` and `lp_browser_last_error` in the C API to retrieve the error name of the most recent failing call.
Remove the `enable_telemetry` option from `lp_options` and `Config`. Telemetry opt-out is now managed solely via the `LIGHTPANDA_DISABLE_TELEMETRY` environment variable.
|
@karlseguin regarding the example, I will add it once we provide pre-built v8 binaries with the latest changes. |
Limit exported symbols to lp_* on MacOS
Ensure lp.Browser remains pointer-stable as it uses self-pointers. Also simplify ToolSession cancel hooks and pkgconfig file generation.
|
Thank you, maybe we should wait for @krichprollsch in case he has some ideas on what the C API should look like. |
# Conflicts: # src/Config.zig
|
Note from the ToolSession follow-up (#3312): a reuse pass flagged that |
A C ABI (include/lightpanda.h + src/c_api.zig) over the browser tool surface: lp_init/lp_shutdown, lp_fetch, sessions with lp_call/pump/ cancel, lp_tools_json. Built as a shared library only; the version script keeps everything but lp_* internal so the bundled OpenSSL/curl/ sqlite cannot collide with a host's own.
Embedders get a hidden 'embed' Config mode (not parseable from the CLI) with telemetry defaulting off; crash reports honor the same opt-out. ToolSession in lightpanda.zig owns the browser/session/ registry lifecycle the C API drives.
Build: C deps are always PIC (like boringssl's force_pic) and the pinned zig-v8-fork always builds V8 library-safe, so 'zig build lib' needs no flags. It only refuses -Dprebuilt_v8_path: today's published archives are exe-only (local-exec TLS, malloc shim); the guard goes away once a fork release ships library-safe archives. make lib-shared / lib-test / lib-shared-example drive it.