feat: plugin system#159
Merged
Merged
Conversation
- PluginInfo (repr(C)), PluginFn/FreeStringFn type aliases - PluginManifest with plugin.toml parsing and ABI/semver validation - PluginHooks bitmask, PluginInstance, empty PluginManager shell
- PluginManager::load() scans plugins/ dir, parses plugin.toml - ABI + semver validation before loading shared library - Hook mask validation, graceful skip + warn on failures - Unit tests for empty/missing/invalid plugin dirs
…ory management - call_hook_safe() with thread-based timeout and panic isolation - NULL return optimization, libc::free on plugin-allocated strings - parse_hook_response() and parse_status_response() for JSON handling - C test plugins compiled via build.rs, integration tests for all paths
- sandbox-linux feature flag (default off), landlock 0.4 on Linux only - apply_landlock() with runtime detection and graceful degradation - Restricts FS to site, public, plugins, cache directories
- pre_build/post_build in build.rs bookend the full build - post_convert/post_render in build_content_entry modify per-page HTML - dev.rs: PluginManager in ServerState, hooks in render_all_pages - sandbox: fix redundant closure in unwrap_or_else
Collaborator
Author
|
For some reason the Linux build CI using Nix shat itself after 6908709 even tho the commit didn't modify anything related to Nix lmfao |
- list: show loaded plugins with name, version, hooks, status - new: scaffold plugin dir with Cargo.toml, plugin.toml, src/lib.rs - install: validate manifest, cargo build --release, copy .so + manifest - uninstall: remove plugin directory - make library_filename/library_extension pub for install command
- workspace root Cargo.toml with members core and sdk - core/: norgolith binary, all existing code - sdk/: norgolith-plugin-sdk v0.1.0 - SDK provides PluginInfo, context types, register_plugin! macro Note: plugin sdk can be published to crates.io with no hassle, but core needs the rust-norg git dep to be published as a crate.
- __bridge_json: universal JSON I/O bridge (C string → handler → JSON/NULL/error) - __set_hook: maps hook name to bitmask + array index - register_plugin! generates init fn + bridge fns per hook - integration test: Rust cdylib plugin built + loaded by PluginManager
call_hook() already extracts html from JSON via parse_hook_response(). The build and dev commands were parsing the result a second time, silently dropping all plugin output Also fix build output: add blank line before Plugins section, remove blank line between Plugins and Contenr
- Validate plugin names to block path traversal - Add priority field for deterministic execution ordering - Propagate hook errors visibly to user - Track and print per-plugin hook timing - Document allocator assumption: libc::free assumes system allocator - Document Landlock timing gap: .so constructors run before sandbox
- Name on its own line, version/status/hooks/priority/abi/norgolith/timeout/fs/net below - Status shows "ok" (green) or "no hooks" (yellow) when no hooks declared - Empty state improved with installation hints
Collaborator
Author
|
I think this is ready for an MVP release. I'll improve the system further down the road |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TBD: provide a proper PR body message once I mark it as ready to review
Resolves #57