feat(ffi): add release-ffi profile and publish guard for cdylib

Workspace Cargo.toml gains [profile.release-ffi] inheriting from
release with panic = "unwind". Cargo rejects per-package `panic`
overrides (error: panic may not be specified in a package profile —
verified experimentally), so a dedicated profile is the Cargo-supported
path to build the cdylib with unwinding while the CLI stays on
panic = "abort".

crates/ffi/Cargo.toml gains:
- publish = false — prevents accidental `cargo publish` of the cdylib
  crate until the distribution plan intentionally removes the guard.
- libc = "0.2" under the macos target — Unit 11 uses pthread_main_np().

Both profiles coexist:
- target/release/libagent_desktop_ffi.dylib       442 KB (panic=abort)
- target/release-ffi/libagent_desktop_ffi.dylib   464 KB (panic=unwind)

Size delta for unwind metadata (~22 KB, under the 500 KB risk budget).
Prerequisite for Unit 1's panic-boundary macro.
This commit is contained in:
Lahfir 2026-04-16 03:34:28 -07:00
parent 078553299a
commit a38bdd22d9
2 changed files with 6 additions and 0 deletions

View file

@ -25,3 +25,7 @@ lto = true
codegen-units = 1
strip = true
panic = "abort"
[profile.release-ffi]
inherits = "release"
panic = "unwind"

View file

@ -3,6 +3,7 @@ name = "agent-desktop-ffi"
version.workspace = true
edition.workspace = true
license.workspace = true
publish = false
[lib]
crate-type = ["cdylib"]
@ -12,6 +13,7 @@ agent-desktop-core.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
agent-desktop-macos = { path = "../macos" }
libc = "0.2"
[target.'cfg(target_os = "windows")'.dependencies]
agent-desktop-windows = { path = "../windows" }