# Canonical WebXR device bridge profile for deterministic XR replay envelopes.
#
# The XR runtime remains deny-by-default; each op below is explicitly allowlisted
# and pinned to `xr_backend = "webxr-device"`.
#
# For native lanes, set `bridge_cmd` (+ optional args/hash) per op or per shared wrapper.
# For WASI parity lanes, provide deterministic `wasi_bridge_response` or
# `wasi_bridge_response_file` mappings per op.

allow = [
  "gfx/xr::session-open",
  "gfx/xr::frame-poll",
  "gfx/xr::input-poll",
  "gfx/xr::hands-poll",
  "gfx/xr::hit-test",
  "gfx/xr::spatial-mesh-poll",
  "gfx/xr::anchor-create",
  "gfx/xr::anchor-update",
  "gfx/xr::anchor-destroy",
  "gfx/xr::layer-create",
  "gfx/xr::layer-update",
  "gfx/xr::layer-destroy",
  "gfx/xr::haptics-pulse",
  "gfx/xr::submit-frame",
  "gfx/xr::session-close",
]

[op."gfx/xr::session-open"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :mode \"immersive-vr\" :reference-space \"local-floor\"}"

[op."gfx/xr::frame-poll"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :frame {:frame-index 1 :predicted-display-time-ms 11 :views []}}"

[op."gfx/xr::input-poll"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :inputs [{:id \"right-controller\" :kind :controller :select true}]}"

[op."gfx/xr::hands-poll"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :hands [{:hand :left :joints []} {:hand :right :joints []}]}"

[op."gfx/xr::hit-test"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :hits [{:hit-id \"hit-1\" :distance-mm 1200}]}"

[op."gfx/xr::spatial-mesh-poll"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :meshes [{:mesh-id \"mesh-1\" :lod \"medium\" :vertex-count 512 :triangle-count 170}]}"

[op."gfx/xr::anchor-create"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :anchor-id \"anchor-1\" :space \"local-floor\" :tracking-state :tracked}"

[op."gfx/xr::anchor-update"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :anchor-id \"anchor-1\" :space \"local-floor\" :tracking-state :tracked}"

[op."gfx/xr::anchor-destroy"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :anchor-id \"anchor-1\" :destroyed true}"

[op."gfx/xr::layer-create"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :layer-id \"layer-1\" :type \"quad\" :layout \"stereo\" :opacity 1000}"

[op."gfx/xr::layer-update"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :layer-id \"layer-1\" :type \"quad\" :layout \"stereo\" :opacity 900}"

[op."gfx/xr::layer-destroy"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :layer-id \"layer-1\" :destroyed true}"

[op."gfx/xr::haptics-pulse"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :input-id \"right-controller\" :pulse-id \"webxr-pulse-1\" :accepted true}"

[op."gfx/xr::submit-frame"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :accepted true :frame-index 1}"

[op."gfx/xr::session-close"]
xr_backend = "webxr-device"
wasi_bridge_profile = true
wasi_bridge_response = "{:ok true :session-id \"xr-webxr-1\" :closed true}"
