@lyboai/media
v0.3.1
Published
LyboOS media layer for JS hosts — content-addressed media store, EXIF scrubbing, grounded-vision guardrails, OS-AI surface & bridge contracts. Mirrors lybo-core/src/media.
Maintainers
Readme
@lyboai/media
The LyboOS media layer for JavaScript hosts — multimodality with the same
structural guarantees LyboOS gives text. Mirrors lybo-core/src/media
(Rust) contract-for-contract; both sides are covered by tests against the
same JSON shapes.
npm i @lyboai/mediaWhat it does
- Content-addressed media store —
MediaStore.ingest()scrubs metadata before hashing (JPEG EXIF: GPS, device serials, comments), so the un-scrubbed original never exists in the store. Retention (sweep) is a policy, not a hope. - MediaRef / OsAiSurface contracts — the exact JSON shapes the Rust
runtime consumes (
register_os_ai_surface,ModelRequest.media). Media crosses the bridge by id + path, never as base64 blobs. - Grounded-vision guardrails —
crossCheckWithOcr()verifies visual claims against an independent OCR pass (it can only confirm, never invent);visionGate()maps low confidence, unconfirmed critical claims, or empty extractions toneeds_human_review. For pixels, the floor is a human — never a guess. - Media egress gate —
assertEnvelopePermitted()enforces the mesh doctrine: consent id required, scrub recorded, raw-to-cloud off by default, LocalOnly privacy mode always wins, hard size budget.
Quick example
import {
MediaStore, crossCheckWithOcr, visionGate,
} from "@lyboai/media";
const store = new MediaStore("/data/lybo/media");
const rec = store.ingest(jpegBytes, "image", "image/jpeg", Date.now());
// rec.scrubbed → ["exif_stripped"]; rec.media_id → "med_…"
// After the OS vision engine extracts claims and OCR ran independently:
const checks = crossCheckWithOcr(claims, ocrText);
const outcome = visionGate(claims, checks, 0.75);
if (outcome.outcome === "needs_human_review") {
// park for approval — same consent flow as any sensitive tool
}Part of LyboOS
LyboOS is the agent layer for every OS — one governed agent across Gemini Nano (Android), Apple Foundation Models (iOS), Phi Silica (Windows) and a fully offline sovereign mode. Docs: https://lyboai.app/developers/docs/lyboos · Live demo: https://lyboai.app/lyboos/demo.html
