npm.io
0.3.1 • Published 2d ago

@lyboai/media

Licence
LicenseRef-LYBO-Commercial-1.0
Version
0.3.1
Deps
0
Size
41 kB
Vulns
0
Weekly
0

@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/media

What it does

  • Content-addressed media storeMediaStore.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 guardrailscrossCheckWithOcr() verifies visual claims against an independent OCR pass (it can only confirm, never invent); visionGate() maps low confidence, unconfirmed critical claims, or empty extractions to needs_human_review. For pixels, the floor is a human — never a guess.
  • Media egress gateassertEnvelopePermitted() 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

Keywords