Skip to content

feat: Ray-Ban Meta glasses as a first-class Omi capture device (iOS + backend) - #9178

Merged
eulicesl merged 23 commits into
BasedHardware:mainfrom
eulicesl:feature/rayban-meta-ios
Jul 8, 2026
Merged

eulicesl merged 23 commits into
BasedHardware:mainfrom
eulicesl:feature/rayban-meta-ios

Conversation

@eulicesl

@eulicesl eulicesl commented Jul 7, 2026 •

Copy link
Copy Markdown
Collaborator

What

Adds Ray-Ban Meta (and Oakley Meta) glasses as a first-class capture device in the Omi mobile app, through the existing device abstraction — discoverer → transport → DeviceConnection → factory (Apple Watch non-BLE pattern; OmiGlass photo pipeline). Never spoofed as a BLE Omi device.

  • Device model: DeviceType.raybanMeta, TransportKind.metaDat locator, name-based serialization with legacy-index compat, device asset/image mapping.
  • Audio: glasses mic via Bluetooth HFP (Meta's documented input path — DAT 0.8 has no mic API), captured natively (AVAudioEngine → PCM16 mono 16 kHz) and streamed to wss…/v4/listen?source=rayban_meta.
  • Photos: Meta Wearables Device Access Toolkit camera (capturePhoto, hardware LED on), riding the existing OpenGlass image_chunk path — behind #if canImport(MWDATCore). The SPM package is intentionally not linked in the default build (see Known limitations); without it the app ships a clearly-labeled audio-only mode. No fake success states.
  • Backend: ConversationSource.rayban_meta; photo storage no longer force-relabels photo-capable sources to openglass (resolve_photo_conversation_source).
  • UX: pairing sheet (Meta AI registration → glasses camera permission → honest audio-only explanation incl. the HFP music-pause tradeoff), connected screen capability rows + Capture Photo action, Pigeon RayBanMetaHostAPI/FlutterAPI. All 19 strings localized across the 48 non-English locales (gen-l10n: zero untranslated).
  • Docs: docs/rayban-meta-{device,dat-setup,founder-acceptance,troubleshooting}.md.

Why

Ray-Ban Meta can replace the Omi wearable for audio (and visual context on DAT builds) — same product role as OmiGlass, using only official SDKs and platform audio routing.

How it was tested

  • app/test/unit/rayban_meta_device_test.dart — 9/9 (serialization round-trip, legacy index, locator extras, photo-event framing, precise product-name matcher).
  • backend/tests/unit/test_rayban_meta_source.py — 7/7 (enum membership, model round-trip, photo-source resolution contract); existing source tests still pass.
  • Full flutter test suite: 641/641; flutter analyze clean.
  • iOS dev-flavor build succeeds in the default (audio-only) configuration.
  • DAT-enabled configuration compiles against the real meta-wearables-dat-ios 0.8.0 binary interfaces (device streams, async registration, listener-token retention, capturePhoto semantics reconciled against the shipped .swiftinterface).
  • Hardware: on macOS the same glasses were validated end-to-end as a Bluetooth HFP mic feeding Omi transcription (separate desktop PR). iOS on-device validation is pending signing access; the exact checklist is in docs/rayban-meta-founder-acceptance.md.

Known limitations / review notes

  • SwiftProtobuf collision (why the DAT package ships unlinked): MWDATCore.framework embeds and exports SwiftProtobuf, duplicating the copy mcumgr_flutter links → Swift runtime metadata corruption → launch SIGSEGV. Reproduced and verified on hardware; fix directions documented in docs/rayban-meta-troubleshooting.md (cleanest: upstream issue on facebook/meta-wearables-dat-ios). Linking instructions for dev/DAT builds: docs/rayban-meta-dat-setup.md.
  • Developer Mode testing needs no Meta Developer Center credentials; Meta's portal rejects hyphens in bundle ids, so beta distribution through Meta's channel will need a dedicated bundle id (documented).
  • DAT 0.8 exposes no battery API (row hidden); HFP is voice-quality and pauses phone music while capturing (stated in UI copy).
  • Android is future work; the discoverer self-gates to iOS.

🤖 Generated with Claude Code

Review in cubic

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

22 issues found and verified against the latest diff

Confidence score: 2/5

  • app/lib/l10n/app_th.arb, app_bn.arb, and app_fr.arb define errorConnectingRayBanMeta with {error} but omit the matching @errorConnectingRayBanMeta placeholder metadata, which can fail or destabilize flutter gen-l10n and block builds/release localization checks — add the placeholder blocks (with error typed as String) before merging.
  • app/ios/Runner/RayBanMeta/RayBanMetaHostApiImpl.swift (handleUrl(_:)) uses a DispatchSemaphore.wait() to bridge async work on a likely main-thread URL callback, creating a concrete deadlock/UI-freeze risk during registration or deep-link handling — switch to a non-blocking async callback/continuation path before merging.
  • app/lib/widgets/rayban_meta_setup_sheet.dart and app/lib/services/devices/transports/rayban_meta_transport.dart call multiple Future<void> host APIs without await (including startRegistration() and connect()), so failures can surface as unhandled async errors and connection polling can race stale state — await these calls and handle errors explicitly to prevent flaky connect/setup behavior.
  • app/ios/Runner/RayBanMeta/RayBanMetaHostApiImpl.swift has lifecycle cleanup gaps (observerTasks never cancelled, and full-mode disconnect() not stopping HFP capture), which can leak background work and leave microphone streaming after disconnect — add task cancellation and make disconnect semantics consistent across modes before merge.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread app/lib/l10n/app_bn.arb Resolved
Comment thread app/lib/l10n/app_th.arb Resolved
Comment thread app/lib/l10n/app_en.arb Resolved
Comment thread app/lib/pages/home/device.dart Resolved
Comment thread app/lib/l10n/app_zh.arb Resolved
Comment thread docs/rayban-meta-dat-setup.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Ray-Ban Meta (and Oakley Meta) glasses as a first-class capture device across the mobile device abstraction and backend conversation-source model, including preserving device provenance when photos are attached to a conversation.

Changes:

  • Backend: introduces ConversationSource.rayban_meta and preserves photo-capable conversation sources when storing photos (instead of always relabeling to openglass).
  • App: adds DeviceType.raybanMeta + TransportKind.metaDat, onboarding flow, and Pigeon bridge wiring for Meta Wearables DAT + Bluetooth HFP audio capture.
  • UX/iOS: adds Ray-Ban Meta setup strings across locales and optional iOS build credentials include.

Reviewed changes

Copilot reviewed 135 out of 137 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
backend/utils/transcribe_decisions.py Adds photo-source preservation set + helper used by transcribe flow.
backend/tests/unit/test_rayban_meta_source.py Adds unit tests for enum membership + photo-source preservation contract.
backend/routers/transcribe.py Uses helper to avoid overwriting photo-capable sources when photos are stored.
backend/models/conversation_enums.py Adds ConversationSource.rayban_meta.
app/lib/utils/device.dart Maps DeviceType.raybanMeta to its asset image.
app/lib/services/devices/discovery/device_locator.dart Adds TransportKind.metaDat and locator factory/deserialization branch.
app/lib/services/devices/connectors/device_connection.dart Wires meta DAT transport + Ray-Ban Meta device connection creation.
app/lib/services/devices.dart Registers RayBanMetaDiscoverer in the device discovery pipeline.
app/lib/services/capture/capture_controller.dart Emits source=rayban_meta for capture + disables BLE-GATT target for Ray-Ban Meta.
app/lib/services/bridges/rayban_meta_bridge.dart Adds Dart-side Pigeon callback bridge for Ray-Ban Meta events.
app/lib/providers/device_provider.dart Prevents OmiGlass name-matching from misclassifying Ray-Ban Meta devices.
app/lib/pages/onboarding/find_device/found_devices.dart Adds Ray-Ban Meta-specific onboarding/setup flow integration.
app/lib/l10n/app_zh.arb Adds Ray-Ban Meta localized strings (zh).
app/lib/l10n/app_vi.arb Adds Ray-Ban Meta localized strings (vi).
app/lib/l10n/app_ur.arb Adds Ray-Ban Meta localized strings (ur).
app/lib/l10n/app_uk.arb Adds Ray-Ban Meta localized strings (uk).
app/lib/l10n/app_tr.arb Adds Ray-Ban Meta localized strings (tr).
app/lib/l10n/app_tl.arb Adds Ray-Ban Meta localized strings (tl).
app/lib/l10n/app_th.arb Adds Ray-Ban Meta localized strings (th).
app/lib/l10n/app_te.arb Adds Ray-Ban Meta localized strings (te).
app/lib/l10n/app_ta.arb Adds Ray-Ban Meta localized strings (ta).
app/lib/l10n/app_sv.arb Adds Ray-Ban Meta localized strings (sv).
app/lib/l10n/app_sr.arb Adds Ray-Ban Meta localized strings (sr).
app/lib/l10n/app_sl.arb Adds Ray-Ban Meta localized strings (sl).
app/lib/l10n/app_sk.arb Adds Ray-Ban Meta localized strings (sk).
app/lib/l10n/app_ru.arb Adds Ray-Ban Meta localized strings (ru).
app/lib/l10n/app_ro.arb Adds Ray-Ban Meta localized strings (ro).
app/lib/l10n/app_pt.arb Adds Ray-Ban Meta localized strings (pt).
app/lib/l10n/app_pl.arb Adds Ray-Ban Meta localized strings (pl).
app/lib/l10n/app_no.arb Adds Ray-Ban Meta localized strings (no).
app/lib/l10n/app_nl.arb Adds Ray-Ban Meta localized strings (nl).
app/lib/l10n/app_ms.arb Adds Ray-Ban Meta localized strings (ms).
app/lib/l10n/app_mr.arb Adds Ray-Ban Meta localized strings (mr).
app/lib/l10n/app_mk.arb Adds Ray-Ban Meta localized strings (mk).
app/lib/l10n/app_lv.arb Adds Ray-Ban Meta localized strings (lv).
app/lib/l10n/app_lt.arb Adds Ray-Ban Meta localized strings (lt).
app/lib/l10n/app_ko.arb Adds Ray-Ban Meta localized strings (ko).
app/lib/l10n/app_kn.arb Adds Ray-Ban Meta localized strings (kn).
app/lib/l10n/app_ja.arb Adds Ray-Ban Meta localized strings (ja).
app/lib/l10n/app_it.arb Adds Ray-Ban Meta localized strings (it).
app/lib/l10n/app_id.arb Adds Ray-Ban Meta localized strings (id).
app/lib/l10n/app_hu.arb Adds Ray-Ban Meta localized strings (hu).
app/lib/l10n/app_hr.arb Adds Ray-Ban Meta localized strings (hr).
app/lib/l10n/app_hi.arb Adds Ray-Ban Meta localized strings (hi).
app/lib/l10n/app_he.arb Adds Ray-Ban Meta localized strings (he).
app/lib/l10n/app_fr.arb Adds Ray-Ban Meta localized strings (fr).
app/lib/l10n/app_fi.arb Adds Ray-Ban Meta localized strings (fi).
app/lib/l10n/app_fa.arb Adds Ray-Ban Meta localized strings (fa).
app/lib/l10n/app_et.arb Adds Ray-Ban Meta localized strings (et).
app/lib/l10n/app_es.arb Adds Ray-Ban Meta localized strings (es).
app/lib/l10n/app_en.arb Adds Ray-Ban Meta localized strings + placeholder metadata (en).
app/lib/l10n/app_el.arb Adds Ray-Ban Meta localized strings (el).
app/lib/l10n/app_de.arb Adds Ray-Ban Meta localized strings (de).
app/lib/l10n/app_da.arb Adds Ray-Ban Meta localized strings (da).
app/lib/l10n/app_cs.arb Adds Ray-Ban Meta localized strings (cs).
app/lib/l10n/app_ca.arb Adds Ray-Ban Meta localized strings (ca).
app/lib/l10n/app_bs.arb Adds Ray-Ban Meta localized strings (bs).
app/lib/l10n/app_bn.arb Adds Ray-Ban Meta localized strings (bn).
app/lib/l10n/app_bg.arb Adds Ray-Ban Meta localized strings (bg).
app/lib/l10n/app_be.arb Adds Ray-Ban Meta localized strings (be).
app/lib/l10n/app_ar.arb Adds Ray-Ban Meta localized strings (ar).
app/lib/l10n/app_localizations_zh.dart Updates generated localizations for new Ray-Ban Meta keys (zh).
app/lib/l10n/app_localizations_vi.dart Updates generated localizations for new Ray-Ban Meta keys (vi).
app/lib/l10n/app_localizations_ur.dart Updates generated localizations for new Ray-Ban Meta keys (ur).
app/lib/l10n/app_localizations_uk.dart Updates generated localizations for new Ray-Ban Meta keys (uk).
app/lib/l10n/app_localizations_tr.dart Updates generated localizations for new Ray-Ban Meta keys (tr).
app/lib/l10n/app_localizations_tl.dart Updates generated localizations for new Ray-Ban Meta keys (tl).
app/lib/l10n/app_localizations_th.dart Updates generated localizations for new Ray-Ban Meta keys (th).
app/lib/l10n/app_localizations_sv.dart Updates generated localizations for new Ray-Ban Meta keys (sv).
app/lib/l10n/app_localizations_sr.dart Updates generated localizations for new Ray-Ban Meta keys (sr).
app/lib/l10n/app_localizations_sl.dart Updates generated localizations for new Ray-Ban Meta keys (sl).
app/lib/l10n/app_localizations_sk.dart Updates generated localizations for new Ray-Ban Meta keys (sk).
app/lib/l10n/app_localizations_ru.dart Updates generated localizations for new Ray-Ban Meta keys (ru).
app/lib/l10n/app_localizations_ro.dart Updates generated localizations for new Ray-Ban Meta keys (ro).
app/lib/l10n/app_localizations_pt.dart Updates generated localizations for new Ray-Ban Meta keys (pt).
app/lib/l10n/app_localizations_pl.dart Updates generated localizations for new Ray-Ban Meta keys (pl).
app/lib/l10n/app_localizations_no.dart Updates generated localizations for new Ray-Ban Meta keys (no).
app/lib/l10n/app_localizations_nl.dart Updates generated localizations for new Ray-Ban Meta keys (nl).
app/lib/l10n/app_localizations_ms.dart Updates generated localizations for new Ray-Ban Meta keys (ms).
app/lib/l10n/app_localizations_lv.dart Updates generated localizations for new Ray-Ban Meta keys (lv).
app/lib/l10n/app_localizations_lt.dart Updates generated localizations for new Ray-Ban Meta keys (lt).
app/lib/l10n/app_localizations_ko.dart Updates generated localizations for new Ray-Ban Meta keys (ko).
app/lib/l10n/app_localizations_ja.dart Updates generated localizations for new Ray-Ban Meta keys (ja).
app/lib/l10n/app_localizations_it.dart Updates generated localizations for new Ray-Ban Meta keys (it).
app/lib/l10n/app_localizations_id.dart Updates generated localizations for new Ray-Ban Meta keys (id).
app/lib/l10n/app_localizations_hr.dart Updates generated localizations for new Ray-Ban Meta keys (hr).
app/lib/l10n/app_localizations_hi.dart Updates generated localizations for new Ray-Ban Meta keys (hi).
app/lib/l10n/app_localizations_he.dart Updates generated localizations for new Ray-Ban Meta keys (he).
app/lib/l10n/app_localizations_fr.dart Updates generated localizations for new Ray-Ban Meta keys (fr).
app/lib/l10n/app_localizations_fi.dart Updates generated localizations for new Ray-Ban Meta keys (fi).
app/lib/l10n/app_localizations_fa.dart Updates generated localizations for new Ray-Ban Meta keys (fa).
app/lib/l10n/app_localizations_et.dart Updates generated localizations for new Ray-Ban Meta keys (et).
app/lib/l10n/app_localizations_es.dart Updates generated localizations for new Ray-Ban Meta keys (es).
app/lib/l10n/app_localizations_en.dart Updates generated localizations for new Ray-Ban Meta keys (en).
app/lib/l10n/app_localizations_de.dart Updates generated localizations for new Ray-Ban Meta keys (de).
app/lib/l10n/app_localizations_da.dart Updates generated localizations for new Ray-Ban Meta keys (da).
app/lib/l10n/app_localizations_cs.dart Updates generated localizations for new Ray-Ban Meta keys (cs).
app/lib/l10n/app_localizations_ca.dart Updates generated localizations for new Ray-Ban Meta keys (ca).
app/lib/l10n/app_localizations_bs.dart Updates generated localizations for new Ray-Ban Meta keys (bs).
app/lib/l10n/app_localizations_bn.dart Updates generated localizations for new Ray-Ban Meta keys (bn).
app/lib/l10n/app_localizations_bg.dart Updates generated localizations for new Ray-Ban Meta keys (bg).
app/lib/l10n/app_localizations_be.dart Updates generated localizations for new Ray-Ban Meta keys (be).
app/lib/l10n/app_localizations_ar.dart Updates generated localizations for new Ray-Ban Meta keys (ar).
app/lib/gen/assets.gen.dart Adds generated asset accessor for rayban_meta.png.
app/lib/backend/schema/conversation.dart Adds rayban_meta to app-side ConversationSource + tag labeling.
app/lib/backend/schema/bt_device/bt_device.dart Adds DeviceType.raybanMeta + stable serialization/identity info mapping.
app/lib/backend/schema/app.dart Handles generated.reviews possibly being null (defaults to empty list).
app/ios/Runner/AppDelegate.swift Registers Ray-Ban Meta Pigeon APIs + URL callback handling.
app/ios/Flutter/RayBanMetaCredentials.xcconfig.template Adds template for optional Meta DAT credentials (kept out of git).
app/ios/Flutter/Base.xcconfig Optionally includes the Ray-Ban Meta credentials xcconfig.
Files not reviewed (1)
  • app/lib/gen/assets.gen.dart: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

eulicesl added a commit to eulicesl/omi-fork that referenced this pull request Jul 7, 2026
… metadata

Review fixes (cubic-dev-ai on BasedHardware#9178):

- l10n: add @errorConnectingRayBanMeta placeholder metadata to all 48
  non-English ARBs, matching the errorConnectingAppleWatch convention.
- RayBanMetaTransport: await native connect (poll no longer races the
  connect call; errors surface); await start/stop audio/camera and
  capturePhoto so failures hit the existing catch blocks; audio-only
  connect()/isConnected() now require a Meta-glasses-matched HFP input
  rather than any HFP device.
- Setup sheet: await startRegistration (native failure no longer advances
  UI to the polling state); re-entrancy guard on _refreshStep; pop-once
  guard so concurrent refreshes can't double-pop.
- iOS: handleUrl no longer blocks the main thread on a semaphore — it
  claims the callback by scheme match and hands the URL to the SDK in a
  Task (registration state arrives via the stream);
  getCameraPermissionStatus is now @async end-to-end (pigeon regenerated);
  full-mode disconnect also stops HFP audio capture; session observer task
  is cancelled on disconnect and all observer tasks in deinit.
- Connected page: photo capture is gated on camera permission with the
  honest 'unavailable' message; camera-status FutureBuilder future is
  memoized per device instead of re-created every rebuild.
- Docs: Xcode 16.4+ per setup.sh; clarify that full mode is gated by SDK
  linkage, not credentials.

Verified: flutter gen-l10n zero warnings; rayban_meta_device_test 9/9;
full suite + iOS dev build re-run on this branch.
eulicesl added a commit to eulicesl/omi-fork that referenced this pull request Jul 7, 2026
Review follow-ups (BasedHardware#9178):
- DeviceLocator.fromJson no longer throws on missing/corrupted/out-of-range
  locator JSON: kind falls back to bluetooth, bluetoothId to '', and extras
  tolerates Map<dynamic,dynamic> (regression test added).
- rayban-meta-dat-setup.md Step 1 now matches the shipped project: the DAT
  package is deliberately unlinked (SwiftProtobuf collision) and the doc
  shows how to link it for development builds.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 61 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread docs/rayban-meta-dat-setup.md Resolved
@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge feature-fit-review Needs review of product/feature direction with Omi mission/vision dependency-review Touches dependencies or lockfiles; needs dependency review docs-accuracy Documentation or committed reports need accuracy fixes labels Jul 7, 2026

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the very thorough work here. The shape is promising: keeping Ray-Ban Meta out of the BLE/Omi-device path, using the existing device abstraction, preserving source=rayban_meta when photos arrive, and being explicit about the audio-only default are all good directions.

I’m going to request changes rather than approve because this is a broad first-class capture-device feature with iOS native code, a dependency-sensitive DAT path, camera/mic behavior, backend API surface changes, and currently failing CI. It needs human maintainer/product review before merge.

Blocking / needs update:

  1. Public Developer API contract is failing. The failing job says docs/api-reference/openapi.json is stale and should be regenerated with backend/scripts/export_openapi.py --write ../docs/api-reference/openapi.json. Please update the committed OpenAPI artifact so the new ConversationSource.rayban_meta backend/API contract is reflected.

  2. The Ray-Ban Meta docs and generated API comments are likely to be reused by AI coding/review agents in this repo, so they need to be internally consistent. In docs/rayban-meta-device.md and the Pigeon interface comments, full mode is described as requiring DAT SDK + Meta credentials, while the Swift implementation and docs/rayban-meta-dat-setup.md say getAvailabilityMode() returns full whenever the DAT SDK is linked and credentials are not required for Developer Mode. Please make the availability-mode contract one clear source of truth so future agents/maintainers don’t implement a credential gate that the code intentionally does not have.

Human maintainer review still needed:

  • Product/UX fit: Ray-Ban Meta as a first-class ambient capture device changes the hardware strategy and privacy posture; this should get explicit maintainer sign-off.
  • Native/dependency risk: the DAT SDK is deliberately unlinked by default due to the SwiftProtobuf collision, and the full path cannot be exercised in normal CI. That’s a reasonable staging approach, but it should be accepted intentionally.
  • Privacy/permissions: camera/mic usage, hardware LED behavior, and 30-second auto-photo capture should be reviewed against the desired Omi UX and consent model.

No security/supply-chain attack stood out in the static review; this is a scope/product/native-dependency review gate, not a malicious PR concern.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ray-Ban Meta capture device (iOS+backend) — large feature; approve-only, needs Nik's feature-fit sign-off before merge.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 12 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread docs/rayban-meta-founder-acceptance.md Resolved
@eulicesl eulicesl added the no-changelog-needed Skip desktop changelog enforcement for internal-only changes label Jul 8, 2026
eulicesl added 10 commits July 7, 2026 23:27
… layer)

Adds DeviceType.raybanMeta through the existing device abstraction, modeled
on the Apple Watch (non-BLE) and OmiGlass (photo pipeline) precedents:

- Pigeon RayBanMetaHostAPI/RayBanMetaFlutterAPI contract. Photos come from
  the Meta Wearables Device Access Toolkit (DAT); audio comes from the
  platform Bluetooth HFP route as PCM16 mono frames, since DAT 0.8 has no
  microphone API. Availability modes: full / audio_only / none — the
  audio-only fallback is explicitly labeled, never masquerading as full
  support.
- RayBanMetaTransport maps native events onto the synthetic
  characteristic-stream vocabulary; RayBanMetaDeviceConnection implements
  the DeviceConnection contract (pcm16 codec, image listener emitting
  OrientedImage, camera start/stop -> DAT stream session, honest
  unavailability for battery/storage/accel).
- RayBanMetaDiscoverer self-gates on iOS + native availability (the repo's
  idiomatic feature gate); audio-only detection matches Meta product names
  precisely, never generic 'glass' substrings.
- Factory + capture wiring: conversation source 'rayban_meta', no native
  BLE background target (foreground Dart path like Apple Watch).
- Guard _isOmiGlassDevice so Meta glasses names can't trigger OmiGlass OTA.
- Device asset + image mapping; ConversationSource.rayban_meta + tag.

Tests: test/unit/rayban_meta_device_test.dart (serialization round-trip,
legacy index, locator extras, photo-event framing, product-name matcher).
Verified: flutter analyze clean (except pre-existing latent app.dart issue
fixed in previous commit); flutter test test/unit/rayban_meta_device_test.dart
9/9 passing.
Ray-Ban Meta glasses stream /v4/listen with source=rayban_meta and reuse
the OpenGlass image_chunk pipeline for photos.

- Add ConversationSource.rayban_meta — without the member,
  ConversationSource._missing_ silently degrades the source to 'unknown'.
- Make the photo -> openglass source flip source-aware via
  resolve_photo_conversation_source(): photo-capable sources (openglass,
  rayban_meta) keep their provenance; every other source keeps the legacy
  openglass relabeling. Pure function in utils/transcribe_decisions.py.
- No endpoint validation change needed: /v4/listen already accepts a
  free-form source string. STT routing, codec decode, credits are
  source-agnostic.

Tests: tests/unit/test_rayban_meta_source.py (enum membership, model
round-trip, photo-source resolution contract).
Verified: .venv pytest tests/unit/test_rayban_meta_source.py
tests/unit/test_conversation_source_unknown.py — 19 passed.
RayBanMetaAudioCapture: AVAudioSession playAndRecord with allowBluetoothHFP,
prefers the glasses' bluetoothHFP input, taps AVAudioEngine and converts to
PCM16 mono 16 kHz (Omi live-socket format), reports route changes. No DAT
dependency — powers the labeled audio-only fallback on every build.

RayBanMetaHostApiImpl: Pigeon host API. Full mode under
#if canImport(MWDATCore): Wearables configure/registration via Meta AI
callback (AppDelegate open-url override), device stream observation, session
connect, camera stream at minimum frame rate to arm photo capture, JPEG photo
events. Sequences Meta's documented ordering rule (HFP fully active before the
DAT stream starts). Without the SDK: honest audio-only stubs, no fake success.

Registered in AppDelegate beside the Watch/BLE Pigeon APIs; Swift files added
to the Runner target.

Verified: flutter build ios --flavor dev --debug --no-codesign succeeds
(audio-only configuration; DAT-enabled compile requires the credential-gated
SPM package — see docs/rayban-meta-dat-setup.md).
- RayBanMetaSetupSheet: guided setup in plain language — Meta AI
  authorization (with registration polling), glasses camera permission, and
  an honest 'audio-only mode' explanation on builds without the Meta toolkit
  (incl. the music-pauses caveat). White/neutral accents per design rules.
- Device list: Ray-Ban Meta tap flow mirrors the Apple Watch bespoke path;
  before registration the discoverer emits a setup entry so pairing can start
  from the normal device list.
- Connected screen: Capture Photo action, Microphone/Camera capability rows
  with honest states; firmware-update rows hidden (Meta AI owns glasses
  firmware); 30s auto photo capture while capture is active.
- All new user-facing strings via l10n (19 keys added to app_en.arb;
  translations follow in the next commit).
- rayban-meta-device.md: architecture, audio (HFP)/photo (DAT) paths,
  availability modes, privacy, honest limitations.
- rayban-meta-dat-setup.md: Meta Wearables Developer Center setup, SPM
  package, Info.plist credentials, build + verification steps, MockDevice.
- rayban-meta-founder-acceptance.md: acceptance checklist, 3-minute founder
  demo script, and an explicit hardware-vs-automated verification split.
- rayban-meta-troubleshooting.md: discovery, registration, audio route,
  photo, and source-label failure modes.
19 keys per locale, matching each file's register and terminology
conventions; product names (Ray-Ban Meta, Meta AI, Omi) kept verbatim;
{error} placeholder preserved. Bluetooth follows each file's existing
convention (transliterated in kn/te/zh).

Verified: flutter gen-l10n emits zero 'untranslated message(s)' warnings;
flutter analyze clean; rayban_meta_device_test 9/9.
- Add SPM reference facebook/meta-wearables-dat-ios @ exact 0.8.0 (binary
  xcframeworks) with MWDATCore + MWDATCamera on the Runner target — the
  #if canImport(MWDATCore) path now compiles against the real SDK with no
  changes (verified: flutter build ios --flavor dev succeeds; both
  frameworks embedded and linked in Runner.app).
- Info.plist: MWDAT dict resolving MetaAppID/ClientToken from build
  settings, omirayban callback URL scheme, com.meta.ar.wearable accessory
  protocol.
- Credentials stay out of git: optional include of git-ignored
  ios/Flutter/RayBanMetaCredentials.xcconfig (template committed). Without
  it the app runs in labeled audio-only mode; with it availability becomes
  'full'.
- Update docs/rayban-meta-dat-setup.md accordingly.
First compile against the actual SDK (binary xcframework interfaces)
surfaced drift from the docs the bridge was written against:

- devicesStream() yields [DeviceIdentifier] (String); resolve display names
  via deviceForIdentifier().nameOrId().
- startRegistration()/startUnregistration() are async — dispatched in Tasks
  with errors surfaced through onError.
- Retain Announcer listener tokens (camera state/photo listeners deregister
  when their token deallocates).
- capturePhoto(format:) returns Bool — surface a typed error when not ready;
  stream.start()/stop() are non-throwing.
- Map RegistrationState.registering distinctly.
- Full mode now gates on the linked SDK alone: per the Developer Center,
  MWDAT Info.plist credentials must NOT be set when testing with glasses
  Developer Mode; they only matter for distribution.

Verified: flutter build ios --flavor dev --debug --no-codesign succeeds;
prior build failed on exactly these symbols, proving the DAT path compiles
against the real 0.8.0 interfaces.
Meta's Developer Center: the MWDAT credential entry must not be set when
testing via glasses Developer Mode. Keep AppLinkURLScheme + DAMEnabled
(registration callback); credentials return via the git-ignored xcconfig
only for distribution builds (template notes this).
Confirmed from Meta's DAT sample apps: dev-mode testing is glasses
Developer Mode + local build + Connect. The Developer Center mobile-app
configuration applies only to beta-channel distribution — and its Bundle ID
field rejects hyphens, which Omi's current iOS bundle ids contain; flagged
as a distribution blocker.
eulicesl and others added 13 commits July 7, 2026 23:27
Document two blockers surfaced while running the DAT SDK on real hardware:

- SwiftProtobuf collision: MWDATCore.framework embeds and exports its own
  SwiftProtobuf, which duplicates the copy Omi links via mcumgr_flutter and
  corrupts the Swift runtime -> EXC_BAD_ACCESS in swift_getObjectType at
  launch. Confirmed by removing mcumgr_flutter (0 SwiftProtobuf symbols ->
  no crash), which is not shippable. Documented three fix directions; until
  one lands the DAT package stays out of the default shipping build (the
  #if canImport(MWDATCore) guard keeps the app compiling/running without it).

- Signing/identity prerequisites: the app must build under the Based
  Hardware team (needs Developer role, not Customer Support) with the
  original bundle id, so the based-hardware-dev Firebase + custom-token auth
  match. A personal-team fallback cascades into Firebase 401s, lost
  entitlements, and Watch/widget bundle-prefix signing errors.
MWDATCore.framework embeds/exports SwiftProtobuf, colliding with the copy
mcumgr_flutter links and crashing at launch (SIGSEGV in swift_getObjectType;
see docs/rayban-meta-troubleshooting.md). Until that is resolved, the
default build ships the labeled audio-only Ray-Ban Meta mode: all DAT code
is #if canImport(MWDATCore)-guarded and activates when the package is
linked per docs/rayban-meta-dat-setup.md.
…e scope

scripts/check_module_stub_pollution.py flags module-scope sys.modules
mutation; only the pre-existing source test file is grandfathered. Verified:
7/7 tests pass, checker reports 0 violations.

(cherry picked from commit db8164b7720e26b444cc84d28573f96dbf50c5ea)
… metadata

Review fixes (cubic-dev-ai on BasedHardware#9178):

- l10n: add @errorConnectingRayBanMeta placeholder metadata to all 48
  non-English ARBs, matching the errorConnectingAppleWatch convention.
- RayBanMetaTransport: await native connect (poll no longer races the
  connect call; errors surface); await start/stop audio/camera and
  capturePhoto so failures hit the existing catch blocks; audio-only
  connect()/isConnected() now require a Meta-glasses-matched HFP input
  rather than any HFP device.
- Setup sheet: await startRegistration (native failure no longer advances
  UI to the polling state); re-entrancy guard on _refreshStep; pop-once
  guard so concurrent refreshes can't double-pop.
- iOS: handleUrl no longer blocks the main thread on a semaphore — it
  claims the callback by scheme match and hands the URL to the SDK in a
  Task (registration state arrives via the stream);
  getCameraPermissionStatus is now @async end-to-end (pigeon regenerated);
  full-mode disconnect also stops HFP audio capture; session observer task
  is cancelled on disconnect and all observer tasks in deinit.
- Connected page: photo capture is gated on camera permission with the
  honest 'unavailable' message; camera-status FutureBuilder future is
  memoized per device instead of re-created every rebuild.
- Docs: Xcode 16.4+ per setup.sh; clarify that full mode is gated by SDK
  linkage, not credentials.

Verified: flutter gen-l10n zero warnings; rayban_meta_device_test 9/9;
full suite + iOS dev build re-run on this branch.
Review follow-ups (BasedHardware#9178):
- DeviceLocator.fromJson no longer throws on missing/corrupted/out-of-range
  locator JSON: kind falls back to bluetooth, bluetoothId to '', and extras
  tolerates Map<dynamic,dynamic> (regression test added).
- rayban-meta-dat-setup.md Step 1 now matches the shipped project: the DAT
  package is deliberately unlinked (SwiftProtobuf collision) and the doc
  shows how to link it for development builds.
ConversationSource.rayban_meta adds one enum value to the committed
docs/api-reference/openapi.json. Regenerated via
backend/scripts/openapi_runner.sh scripts/export_openapi.py.
…rfaces

The OpenAPI contract check validates three surfaces; the previous commit
only refreshed the default. rayban_meta adds one enum value to each of the
app-client and integration-public ConversationSource schemas too.
generate_ts_openapi_types.py propagates the ConversationSource enum into
the four omiApi.generated.ts clients (desktop-windows, web app/admin/personas).
generate_swift_openapi_types.py propagates ConversationSource.rayban_meta
into desktop macOS OmiApi.generated.swift. Completes the generated-artifact
chain (3 JSON surfaces + TS clients + Dart models + Swift DTOs) the OpenAPI
contract check validates.
Sources/Generated/*.generated.swift is produced from the OpenAPI contract,
not hand-written, so it can't be covered by an e2e flow. Changing a shared
backend enum (here ConversationSource.rayban_meta) forces these DTOs to
regenerate; the coverage ratchet then wrongly demanded a user-flow covers:
entry for generated code. Exclude Generated/ from the changed-Swift set.

Verified: check-e2e-flow-coverage.py --strict on the regenerated
OmiApi.generated.swift now reports no uncovered files.
… polish

Final-pass review findings against current main:

- RayBanMetaAudioCapture now observes AVAudioSession interruptions and
  AVAudioEngine configuration changes, and stops + surfaces an error when the
  glasses' HFP input route is lost mid-capture — previously a phone call or
  route drop left isRunning=true while the tap fed silence or the phone mic
  (silent failure). Errors: audio_interrupted / audio_route_lost /
  audio_config_changed.
- getBluetoothHfpInputNames snapshots and restores the shared AVAudioSession
  category (it can run during discovery while another device records).
- DAT-mode latestGlasses/connectionState writes hop to the main thread, matching
  the main-thread Pigeon reads (no cross-thread publication).
- Photo-capture error snackbar uses the localized wrapper (parity with
  found_devices) instead of raw e.toString().
- backfill_user_signup_platform maps rayban_meta -> mobile.
- pubspec.lock restored to main's (the branch's older toolchain had downgraded
  five SDK-pinned transitive packages; no pubspec.yaml change warrants a lock
  change).
- Docs: DAT-setup no longer overclaims 'verified' compilation (aligned with the
  troubleshooting doc's symbols-may-drift caveat) and notes the iOS 26 SDK
  requirement for .allowBluetoothHFP.
- Orientation byte emit documented as a DAT-0.8 limitation (always 0).

Verified: flutter analyze 916 (= main baseline trend, no regression);
rayban_meta_device_test 12/12; backend test_rayban_meta_source 7/7; full
flutter test 648/648 on the rebased branch; both edited Swift files parse
clean against the iOS 26.5 SDK (arm64-apple-ios15.0).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@eulicesl
eulicesl force-pushed the feature/rayban-meta-ios branch from 7c7df18 to ec0990a Compare July 8, 2026 03:46
@eulicesl

eulicesl commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto current main (24ca7ce) + senior final-pass review — summary for re-review:

All 27 inline threads were already resolved on-branch; this push adds a final review pass against latest main:

  • Silent-failure fix (the one real find): RayBanMetaAudioCapture now observes AVAudioSession interruptions and AVAudioEngine configuration changes, and stops + surfaces an error (audio_interrupted / audio_route_lost / audio_config_changed) when a phone call or HFP route loss kills capture mid-session — previously isRunning stayed true while the tap fed silence or the phone mic.
  • getBluetoothHfpInputNames snapshots/restores the shared session category (it can run during discovery while another device records); DAT-mode state writes hop to main to match Pigeon's main-thread reads; photo-capture error snackbar now uses the localized wrapper; backfill_user_signup_platform maps rayban_meta; DAT-setup doc no longer overclaims 'verified' compilation and notes the iOS 26 SDK requirement for .allowBluetoothHFP.
  • pubspec.lock restored to main's — the branch's older toolchain had downgraded five SDK-pinned transitive packages; no pubspec.yaml change warrants a lock change.

Verified on the rebased branch: full flutter test 648/648, flutter analyze no regression vs baseline, rayban unit tests 12/12, backend test_rayban_meta_source 7/7, and both edited Swift files parse clean against the iOS 26.5 SDK. Independent deep review confirmed: no unhandled-enum breaks backend or app side (source stored as string, all DeviceType/TransportKind switches covered), no openglass photo-source regression (resolve_photo_conversation_source preserves prior behavior exactly), no secrets in the diff (template ships empty, real xcconfig git-ignored), default build genuinely audio-only (no MWDAT SPM linkage in pbxproj).

@eulicesl
eulicesl merged commit dd6a22f into BasedHardware:main Jul 8, 2026
22 checks passed
@eulicesl
eulicesl deleted the feature/rayban-meta-ios branch July 8, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependency-review Touches dependencies or lockfiles; needs dependency review docs-accuracy Documentation or committed reports need accuracy fixes feature-fit-review Needs review of product/feature direction with Omi mission/vision needs-maintainer-review Needs a human maintainer to sign off before merge no-changelog-needed Skip desktop changelog enforcement for internal-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants