@plasius/gpu-xr
v0.1.19
Published
Framework-agnostic WebXR session management for Plasius GPU rendering projects.
Maintainers
Readme
@plasius/gpu-xr
Framework-agnostic WebXR session management for Plasius GPU rendering projects. This package isolates VR session lifecycle and capability probing so app layers can replace Three.js and still keep immersive workflows.
Apache-2.0. ESM + CJS builds.
Install
npm install @plasius/gpu-xrUsage
import { createXrManager } from "@plasius/gpu-xr";
const xr = createXrManager();
await xr.probeSupport(["immersive-vr"]);
const session = await xr.enterVr({
optionalFeatures: ["depth-sensing", "layers"],
});
// ... bind WebGPU render state to the session ...
await xr.exitSession();Adaptive Performance Integration
@plasius/gpu-xr now exposes XR runtime frame-rate hints so
@plasius/gpu-performance can negotiate platform-native frame targets while
@plasius/gpu-renderer and @plasius/gpu-worker stay aligned on the xr
worker budget profile.
import { createXrManager } from "@plasius/gpu-xr";
const xr = createXrManager();
await xr.enterVr();
const hint = xr.getPerformanceHint({ preferredFrameRates: [90, 72] });
console.log(hint.targetFrameRate, hint.workerBudget);
await xr.setTargetFrameRate(hint.targetFrameRate);API
isXrModeSupported(mode, options)requestXrSession(options)readXrFrameRateCapabilities(session, options)createXrPerformanceHint(options)updateXrTargetFrameRate(session, frameRate)createXrStore(initialState)createXrManager(options)mergeXrSessionInit(base, override)defaultVrSessionInitxrWorkerQueueClassxrWorkerSchedulerModedefaultXrWorkerBudgetProfile
Demo
Run the demo server from the repo root:
cd gpu-xr
npm run demoThen open http://localhost:8000/gpu-xr/demo/.
The demo mounts the shared @plasius/gpu-shared 3D harbor surface and keeps XR
capability, target mode, and worker-budget negotiation visible in context. It
stays browser-safe by rendering on the shared scene while @plasius/gpu-xr
continues to own XR support probing, frame-target hints, and session metadata
instead of a package-local renderer copy.
Development Checks
npm run lint
npm run typecheck
npm run test:coverage
npm run build
npm run pack:checkFiles
src/index.js: XR runtime/session manager and store.src/index.d.ts: public API typings.tests/package.test.js: Unit tests for support probing and lifecycle handling.docs/adrs/*: XR architecture decisions.docs/tdrs/*: XR technical direction records.docs/design/*: XR integration design notes.
Release integrity
CI keeps the administrative contributor registry outside Git and npm package
artifacts using exact, case-normalised path checks. CI runs on approved
GitHub-hosted runners for same-repository pull requests and main, with
package-manager cache finalization disabled; fork PR code is denied.
Publication uses the GitHub-hosted production job with Node 24 and a pinned
npm 11.6.2 client. It is token-free and proceeds only while the prepared SHA
is the exact main head after successful push-triggered CI. Do not dispatch CD
until the npm trusted-publisher binding is verified.
Automatic npm releases
Run .github/workflows/cd.yml on main with phase=prepare and the intended
version bump. The schema-template pipeline prepares release metadata through a
pull request, waits for CI on that exact main commit, then publishes the sealed
package through npm trusted publishing in the production environment.
Normal privacy, audit, tests, coverage and artifact checks run automatically.
No separate release-owner or dependency-coordination admission is required.
npm run privacy:check checks repository path metadata. npm run test:privacy
tests the policy and release contract. npm run pack:check checks the package
against the reviewed inventory in scripts/package-artifacts.json; update that
inventory deliberately when public package files change. Add real notes under
Unreleased; only the release pipeline promotes them to a versioned section.
