facebook/meta-wearables-dat-ios/session-lifecycle

Claude Code and agent skill by facebook/meta-wearables-dat-ios

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Device session states, pause/resume, availability monitoring

Install

npx vskill@latest install facebook/meta-wearables-dat-ios/session-lifecycle

SKILL.md

The same SKILL.md was published earlier as facebook/meta-wearables-dat-ios/session-lifecycle.

Session Lifecycle (iOS)

Guide for managing device session states in DAT SDK integrations.

Overview

The DAT SDK runs work inside sessions. Meta glasses expose two experience types:

  • Device sessions — sustained access to device sensors and outputs
  • Transactions — short, system-owned interactions (notifications, "Hey Meta")

Your app observes session state changes. Your app drives start(), pause(), resume(), and stop(); the device can also pause, resume, or stop the session on its own.

Session states

StateMeaningApp action
idleSession created but not startedCall start() when ready
startingSession is connecting to the deviceShow connecting state
startedSession active and ready for capabilitiesAdd or resume work
pausedTemporarily suspended by pause() or the deviceHold work; call resume() or wait for the device to resume
stoppingSession is cleaning upWait for terminal state
stoppedSession inactive and terminalFree resources, create a new session to restart

Observing session state

swift
let session = try Wearables.shared.createSession(deviceSelector: AutoDeviceSelector(wearables: Wearables.shared))
let states = session.stateStream()
try session.start()
Task {
for await state in states {
switch state {
case .started:
// Confirm UI shows session is live
break
case .paused:
// Hold work; call session.resume() or wait for started or stopped
break
case .stopped:
// Release resources, allow user to restart
break
default:
break
}
}
}

DeviceSession exposes both shapes: stateStream() / errorStream() as AsyncStream, and statePublisher / errorPublisher as listener-token Announcers. Pick one per call site; subscribe before calling start() so no initial transition is missed.

Session errors

errorStream() and errorPublisher emit DeviceSessionError. Handle .noEligibleDevice (no matching device yet), .sessionAlreadyExists, .capabilityAlreadyActive, the thermal/battery cases (.thermalCritical, .thermalEmergency, .peakPowerShutdown, .batteryCritical), and .datAppOnTheGlassesUpdateRequired, which is delivered as a one-shot event and should open Wearables.shared.openDATGlassesAppUpdate().

start() uses typed throws, so you can catch the specific case:

swift
do throws(DeviceSessionError) {
try session.start()
} catch .datAppOnTheGlassesUpdateRequired {
showGlassesAppUpdatePrompt()
} catch {
showError(error.localizedDescription)
}

Stream state transitions

A Stream is a capability attached to a started DeviceSession:

text
stopped → waitingForDevice → starting → streaming → paused → stopped
swift
guard let camera = try session.addCamera(config: StreamConfiguration()) else { return }
let stream = camera.stream
let token = stream.statePublisher.listen { state in
Task { @MainActor in
// React to state changes
}
}

Common transitions

The device changes session state when:

  • User performs a system gesture that opens another experience
  • Another app starts a device session
  • User removes or folds the glasses (Bluetooth disconnects)
  • User removes the app from Meta AI companion app
  • Connectivity between companion app and glasses drops

Pause and resume

Call pause() on a started session and resume() on a paused one. Both are sync fire-and-forget and do not throw: observe stateStream() or statePublisher for the started → paused → started transitions. pause() outside started and resume() outside paused are no-ops. The state changes only when the device confirms, so wait for paused before calling resume() (and for started before calling pause() again); earlier calls are ignored. If the observed state doesn't match what your app wants, call pause() or resume() again once it settles.

swift
Button("Pause") { session.pause() } // started → paused
Button("Resume") { session.resume() } // paused → started

The device can also pause and resume the session on its own (for example a single touchpad tap). When a session is paused:

  • The device keeps the connection alive
  • Streams stop delivering data
  • The session returns to started when your app calls resume() or the device resumes it

Your app should not restart the session while paused — call resume() or wait for started or stopped.

Device availability

Monitor device availability to know when sessions can start:

swift
Task {
for await deviceIds in Wearables.shared.devicesStream() {
// deviceIds is [DeviceIdentifier]; resolve details with deviceForIdentifier(_:)
}
}

A DeviceSelector also reports availability directly. AutoDeviceSelector and SpecificDeviceSelector both expose activeDevice and activeDeviceStream(), which yields nil when no eligible device is available:

swift
let selector = AutoDeviceSelector(wearables: Wearables.shared)
Task {
for await deviceId in selector.activeDeviceStream() {
hasActiveDevice = deviceId != nil
}
}

Key behaviors:

  • Closing hinges disconnects Bluetooth → forces stopped
  • Opening hinges restores Bluetooth but does not restart sessions
  • Start a new session after the device becomes available again

Implementation checklist

  • [ ] Handle all relevant session states (started, paused, stopped)
  • [ ] Monitor device availability before starting work
  • [ ] Release resources only after stopped
  • [ ] Don't infer transition causes — rely only on observable state
  • [ ] Don't restart during paused — call resume() or wait for the device to resume or stop

Links

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
566
Repository forks
123
7-day trend score
31

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/facebook/meta-wearables-dat-ios/session-lifecycle/badge)](https://verified-skill.com/skills/facebook/meta-wearables-dat-ios/session-lifecycle)

Something wrong with this skill or its page? Tell us.