@iwsdk/create 0.5.3 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +7224 -216
- package/dist/guidance/agents/.agents/skills/iwsdk-build-model/SKILL.md +311 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-build-model/agents/openai.yaml +4 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-build-model/assets/hardsurface.ts.template +599 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-compose-scene/SKILL.md +262 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-compose-scene/agents/openai.yaml +4 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-compose-scene/references/extended-workflow.md +166 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-compose-scene/references/scene-composition.md +80 -0
- package/dist/guidance/{claude/.claude/skills/iwsdk-scene-composer → agents/.agents/skills/iwsdk-compose-scene}/references/scene-format.md +3 -3
- package/dist/guidance/agents/.agents/skills/iwsdk-compose-scene/references/scene-review.md +66 -0
- package/dist/guidance/agents/.agents/skills/{iwsdk-scene-composer → iwsdk-compose-scene}/references/text-intake.md +3 -5
- package/dist/guidance/agents/.agents/skills/iwsdk-debug/SKILL.md +69 -91
- package/dist/guidance/agents/.agents/skills/iwsdk-depth-occlusion/SKILL.md +81 -129
- package/dist/guidance/agents/.agents/skills/iwsdk-dev/SKILL.md +45 -0
- package/dist/guidance/{claude/.claude/skills/iwsdk-planner → agents/.agents/skills/iwsdk-dev}/references/api-reference.md +53 -45
- package/dist/guidance/agents/.agents/skills/iwsdk-dev/references/iterate.md +239 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-dev/references/planner.md +303 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-grab/SKILL.md +37 -114
- package/dist/guidance/agents/.agents/skills/iwsdk-hosting/SKILL.md +177 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-hosting/references/existing-hosts.md +181 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-hosting/references/vercel.md +114 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-native-xr-test/SKILL.md +246 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-physics/SKILL.md +92 -78
- package/dist/guidance/agents/.agents/skills/iwsdk-physics/references/tuning-and-config.md +15 -1
- package/dist/guidance/agents/.agents/skills/iwsdk-pwa-packaging/SKILL.md +218 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-pwa-packaging/references/app-modes.md +104 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-pwa-packaging/references/bubblewrap.md +219 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-pwa-packaging/references/manifest-and-icons.md +149 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-pwa-packaging/references/store-upload.md +104 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-pwa-packaging/references/troubleshooting.md +178 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-ray/SKILL.md +45 -136
- package/dist/guidance/agents/.agents/skills/iwsdk-ui/SKILL.md +251 -157
- package/dist/guidance/claude/.claude/agents/iwsdk-project-code-reviewer.md +9 -6
- package/dist/guidance/claude/.claude/rules/scene-json.md +6 -4
- package/dist/guidance/claude/.claude/settings.json +6 -2
- package/dist/guidance/claude/.claude/skills/iwsdk-build-model/SKILL.md +311 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-build-model/agents/openai.yaml +4 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-build-model/assets/hardsurface.ts.template +599 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-compose-scene/SKILL.md +262 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-compose-scene/agents/openai.yaml +4 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-compose-scene/references/extended-workflow.md +166 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-compose-scene/references/scene-composition.md +80 -0
- package/dist/guidance/{agents/.agents/skills/iwsdk-scene-composer → claude/.claude/skills/iwsdk-compose-scene}/references/scene-format.md +3 -3
- package/dist/guidance/claude/.claude/skills/iwsdk-compose-scene/references/scene-review.md +66 -0
- package/dist/guidance/claude/.claude/skills/{iwsdk-scene-composer → iwsdk-compose-scene}/references/text-intake.md +3 -5
- package/dist/guidance/claude/.claude/skills/iwsdk-debug/SKILL.md +69 -91
- package/dist/guidance/claude/.claude/skills/iwsdk-depth-occlusion/SKILL.md +81 -129
- package/dist/guidance/claude/.claude/skills/iwsdk-dev/SKILL.md +45 -0
- package/dist/guidance/{agents/.agents/skills/iwsdk-planner → claude/.claude/skills/iwsdk-dev}/references/api-reference.md +53 -45
- package/dist/guidance/claude/.claude/skills/iwsdk-dev/references/iterate.md +239 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-dev/references/planner.md +303 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-grab/SKILL.md +37 -114
- package/dist/guidance/claude/.claude/skills/iwsdk-hosting/SKILL.md +177 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-hosting/references/existing-hosts.md +181 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-hosting/references/vercel.md +114 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-native-xr-test/SKILL.md +246 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-physics/SKILL.md +92 -78
- package/dist/guidance/claude/.claude/skills/iwsdk-physics/references/tuning-and-config.md +15 -1
- package/dist/guidance/claude/.claude/skills/iwsdk-pwa-packaging/SKILL.md +218 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-pwa-packaging/references/app-modes.md +104 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-pwa-packaging/references/bubblewrap.md +219 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-pwa-packaging/references/manifest-and-icons.md +149 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-pwa-packaging/references/store-upload.md +104 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-pwa-packaging/references/troubleshooting.md +178 -0
- package/dist/guidance/claude/.claude/skills/iwsdk-ray/SKILL.md +45 -136
- package/dist/guidance/claude/.claude/skills/iwsdk-ui/SKILL.md +251 -157
- package/dist/guidance/claude/CLAUDE.md +2 -141
- package/dist/guidance/codex/.codex/config.toml +1 -1
- package/dist/guidance/common/AGENTS.md +96 -37
- package/dist/guidance/copilot/.github/instructions/scene-json.instructions.md +6 -4
- package/dist/guidance/cursor/.cursor/rules/scene-json.mdc +6 -4
- package/dist/guidance/scoped-agents/public/scenes/AGENTS.md +6 -4
- package/dist/template/common/README.md +13 -0
- package/dist/template/common/public/ui/welcome.uikitml +0 -19
- package/dist/template/common/src/robot.ts +5 -0
- package/dist/template/common/vite.config.ts +18 -0
- package/dist/template/common-js/README.md +13 -0
- package/dist/template/common-js/public/ui/welcome.uikitml +0 -19
- package/dist/template/common-js/src/robot.js +5 -0
- package/dist/template/common-js/vite.config.js +18 -0
- package/package.json +8 -7
- package/scripts/verify-release-ready.mjs +25 -0
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/SKILL.md +0 -364
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/build-milestones.md +0 -243
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/design-deck.md +0 -101
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/grounding.md +0 -176
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/ideation.md +0 -156
- package/dist/guidance/agents/.agents/skills/iwsdk-planner/references/verification.md +0 -199
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/SKILL.md +0 -257
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/agents/openai.yaml +0 -4
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/asset-authoring.md +0 -295
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/composition-patterns.md +0 -243
- package/dist/guidance/agents/.agents/skills/iwsdk-scene-composer/references/review-and-stop.md +0 -99
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/SKILL.md +0 -364
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/build-milestones.md +0 -243
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/design-deck.md +0 -101
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/grounding.md +0 -176
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/ideation.md +0 -156
- package/dist/guidance/claude/.claude/skills/iwsdk-planner/references/verification.md +0 -199
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/SKILL.md +0 -257
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/agents/openai.yaml +0 -4
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/asset-authoring.md +0 -295
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/composition-patterns.md +0 -243
- package/dist/guidance/claude/.claude/skills/iwsdk-scene-composer/references/review-and-stop.md +0 -99
- /package/dist/guidance/agents/.agents/skills/{iwsdk-scene-composer → iwsdk-compose-scene}/references/image-intake.md +0 -0
- /package/dist/guidance/claude/.claude/skills/{iwsdk-scene-composer → iwsdk-compose-scene}/references/image-intake.md +0 -0
|
@@ -1,91 +1,105 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: iwsdk-physics
|
|
3
|
-
description:
|
|
3
|
+
description: Add or repair IWSDK rigid-body simulation, collision shapes, forces, and physics-aware grabbing. Use for gravity, falling, collision, bouncing, kinematic motion, or physics tuning.
|
|
4
|
+
argument-hint: '(use the current request)'
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# IWSDK Physics
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
# IWSDK Physics
|
|
8
|
+
|
|
9
|
+
Use the current request as the specification. Prefer the scaffold's project
|
|
10
|
+
manifest and native scene components over rebuilding physics in TypeScript.
|
|
11
|
+
|
|
12
|
+
## Implement the smallest complete physics path
|
|
13
|
+
|
|
14
|
+
1. Inspect `iwsdk.config.json`, the active scene, and only the source file that
|
|
15
|
+
owns any requested custom behavior.
|
|
16
|
+
Make the complete first config/asset/scene edit before starting the dev
|
|
17
|
+
server. The contracts below are sufficient for the common path: do not call
|
|
18
|
+
`scene capabilities`, CLI `--help`, search `node_modules`, or inspect
|
|
19
|
+
generated declarations unless a concrete build/runtime error remains after
|
|
20
|
+
that edit.
|
|
21
|
+
2. Set `world.features.physics` to `true`. The scaffold registers
|
|
22
|
+
`PhysicsSystem`, `PhysicsBody`, `PhysicsShape`, and `PhysicsManipulation`; do
|
|
23
|
+
not register them again unless the project deliberately replaced bootstrap.
|
|
24
|
+
3. Every colliding entity needs both `PhysicsBody` and `PhysicsShape`:
|
|
25
|
+
|
|
26
|
+
- moving under simulation: `PhysicsBody.state: "DYNAMIC"`;
|
|
27
|
+
- fixed floor or wall: `PhysicsBody.state: "STATIC"`;
|
|
28
|
+
- code-driven moving platform: `PhysicsBody.state: "KINEMATIC"`.
|
|
29
|
+
|
|
30
|
+
4. Match shapes to visible geometry. Use `Sphere`, `Box`, or `Cylinder` with
|
|
31
|
+
explicit dimensions for primitives. Use `ConvexHull` for a dynamic complex
|
|
32
|
+
mesh and reserve `TriMesh` for static geometry.
|
|
33
|
+
5. Add only requested material tuning. Start with low restitution and moderate
|
|
34
|
+
friction; avoid compensating for a missing collider with extreme damping.
|
|
35
|
+
6. For a throwable object, combine a dynamic body and shape with the requested
|
|
36
|
+
grab component. `OneHandGrabbable` is proximity squeeze; a distance grab
|
|
37
|
+
also requires `RayInteractable` and `DistanceGrabbable`.
|
|
38
|
+
7. Apply a one-shot force or velocity through `PhysicsManipulation`. For a
|
|
39
|
+
reset/teleport of an existing body, use `PhysicsSystem.setBodyTransform` so
|
|
40
|
+
Havok and the render transform remain synchronized.
|
|
41
|
+
|
|
42
|
+
For simple primitive assets, import `Mesh`, `SphereGeometry`, `BoxGeometry`,
|
|
43
|
+
and `MeshStandardMaterial` from `@iwsdk/core`, construct parentless meshes, and
|
|
44
|
+
add those mesh values directly to the existing `defineAssets({...})` map. Keep
|
|
45
|
+
the render geometry and collider dimensions identical: a sphere of radius `r`
|
|
46
|
+
uses `PhysicsShape: { shape: "Sphere", dimensions: [r, 0, 0] }`; a box sized
|
|
47
|
+
`[w, h, d]` uses `{ shape: "Box", dimensions: [w, h, d] }`.
|
|
48
|
+
|
|
49
|
+
Read one bundled reference only when needed; do not read the complete set:
|
|
50
|
+
|
|
51
|
+
- exact component fields and dimensions: `references/component-reference.md`;
|
|
52
|
+
- implementation patterns: `references/workflows.md`;
|
|
53
|
+
- material or system tuning: `references/tuning-and-config.md`.
|
|
54
|
+
|
|
55
|
+
## Verify behavior, not just source
|
|
56
|
+
|
|
57
|
+
Run the production build once. Start the app once and inspect the named live
|
|
58
|
+
entities. For falling, collision, force, or kinematic behavior, pause before the
|
|
59
|
+
interesting transition, take a `before` snapshot, step a small fixed number of
|
|
60
|
+
frames, take an `after` snapshot, and diff them. Query the final transform and
|
|
61
|
+
physics state. Capture one final runtime image when spatial layout matters.
|
|
62
|
+
|
|
63
|
+
Use the documented CLI shape directly; do not call help to rediscover it:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx @iwsdk/cli ecs pause --input-json '{}'
|
|
67
|
+
npx @iwsdk/cli ecs snapshot --input-json '{"label":"before"}'
|
|
68
|
+
npx @iwsdk/cli ecs step --input-json '{"count":8,"delta":0.016}'
|
|
69
|
+
npx @iwsdk/cli ecs snapshot --input-json '{"label":"after"}'
|
|
70
|
+
npx @iwsdk/cli ecs diff --input-json '{"from":"before","to":"after"}'
|
|
71
|
+
npx @iwsdk/cli ecs resume --input-json '{}'
|
|
72
|
+
```
|
|
9
73
|
|
|
10
|
-
|
|
74
|
+
If a gravity body has already settled by the time the bridge is ready, its
|
|
75
|
+
resting transform plus a zero-motion stepped diff is valid collision evidence.
|
|
76
|
+
Do not teleport the body solely to recreate the fall.
|
|
11
77
|
|
|
12
|
-
|
|
78
|
+
Use an options object when you need to select the execution mode or simulation rate. Worker execution is the default; `useWorker: false` runs the same physics runtime and protocol on the main thread for compatibility and diagnostics.
|
|
13
79
|
|
|
14
80
|
```jsonc
|
|
15
|
-
{
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"features": {
|
|
20
|
-
"physics": true,
|
|
21
|
-
"grabbing": true,
|
|
22
|
-
"locomotion": true
|
|
23
|
-
}
|
|
24
|
-
}
|
|
81
|
+
"physics": {
|
|
82
|
+
"useWorker": true,
|
|
83
|
+
"updateFrequency": 60,
|
|
84
|
+
"interpolation": true
|
|
25
85
|
}
|
|
26
86
|
```
|
|
27
87
|
|
|
28
|
-
Setting `physics: true` automatically registers `PhysicsBody`, `PhysicsShape`, `PhysicsManipulation` components and the `PhysicsSystem` at priority `-2`.
|
|
29
|
-
|
|
30
88
|
**Only enable physics when needed.** If no objects require dynamic simulation, omit it to avoid overhead.
|
|
31
89
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- Check that `physics: true` is set in `iwsdk.config.json` world features
|
|
49
|
-
|
|
50
|
-
**Objects don't move:**
|
|
51
|
-
|
|
52
|
-
- Confirm `state` is `PhysicsState.Dynamic` (not Static or Kinematic)
|
|
53
|
-
- Check `gravityFactor` is > 0
|
|
54
|
-
- Verify both `PhysicsShape` and `PhysicsBody` are added (both are required)
|
|
55
|
-
|
|
56
|
-
**Objects are too bouncy or slide too much:**
|
|
57
|
-
|
|
58
|
-
- Lower `restitution` to reduce bouncing (0 = no bounce)
|
|
59
|
-
- Increase `friction` to reduce sliding (0.8+ for grippy surfaces)
|
|
60
|
-
|
|
61
|
-
**Objects move too slowly or feel sluggish:**
|
|
62
|
-
|
|
63
|
-
- Reduce `linearDamping` (0 = no air resistance)
|
|
64
|
-
- Check `density` is not too high (high density = heavy = resists force)
|
|
65
|
-
|
|
66
|
-
**Poor frame rate with many physics objects:**
|
|
67
|
-
|
|
68
|
-
- Use simpler shape types (Sphere/Box instead of ConvexHull/TriMesh)
|
|
69
|
-
- Use `TriMesh` only for static objects
|
|
70
|
-
- Explicitly set shape types instead of `Auto` to avoid detection overhead
|
|
71
|
-
- Reduce the number of dynamic bodies; make non-essential objects static
|
|
72
|
-
|
|
73
|
-
**Grabbed object doesn't follow hand:**
|
|
74
|
-
|
|
75
|
-
- Ensure `grabbing: true` in features
|
|
76
|
-
- Verify the entity has `RayInteractable` and a grabbable component (`OneHandGrabbable`, `TwoHandsGrabbable`, or `DistanceGrabbable`)
|
|
77
|
-
|
|
78
|
-
**PhysicsManipulation has no effect:**
|
|
79
|
-
|
|
80
|
-
- The entity must have a `PhysicsBody` with an active engine body (`_engineBody != 0`)
|
|
81
|
-
- The component is auto-removed after one frame; re-add it for sustained effects
|
|
82
|
-
- Force values may need to be larger; they are scaled by frame delta time
|
|
83
|
-
|
|
84
|
-
## Performance Tips
|
|
85
|
-
|
|
86
|
-
1. **Use primitive shapes** (Sphere, Box, Cylinder) over ConvexHull/TriMesh whenever acceptable
|
|
87
|
-
2. **Use `PhysicsState.Static`** for all non-moving objects; static bodies have zero simulation cost
|
|
88
|
-
3. **Explicitly set shape types** in production; avoid `Auto` detection overhead
|
|
89
|
-
4. **Minimize dynamic body count** -- each dynamic body requires per-frame transform sync
|
|
90
|
-
5. **Use damping** to settle objects faster and reduce ongoing simulation work
|
|
91
|
-
6. **TriMesh is for static only** -- it is computationally expensive and should never be used on dynamic bodies
|
|
90
|
+
For a newly composed test fixture, run `scene render-file` on the authored hero
|
|
91
|
+
view once and inspect at most that one image. After a valid, readable hero,
|
|
92
|
+
do not call `scene open`, `scene state`, or `scene screenshot`, and do not create
|
|
93
|
+
alternate editor views. Save the final live browser screenshot to a file but do
|
|
94
|
+
not read it back when the ECS measurements already prove the requested motion.
|
|
95
|
+
|
|
96
|
+
Pure rigid-body verification does not require entering XR. The authored `hero`
|
|
97
|
+
view is composition evidence, while the live browser camera can differ. Do not
|
|
98
|
+
temporarily edit `iwsdk.config.json`, restart the runtime, or render extra camera
|
|
99
|
+
angles solely to make a screenshot match the hero view. Save the live capture
|
|
100
|
+
directly with `npx @iwsdk/cli browser screenshot --output-file <path>` and let the
|
|
101
|
+
authored render cover deliberate framing.
|
|
102
|
+
|
|
103
|
+
Make at most one focused correction, then replay the same observation. Stop
|
|
104
|
+
when the requested bodies, collisions, and final state are evidenced. Resume
|
|
105
|
+
ECS time and leave the app in a stable state.
|
|
@@ -32,7 +32,21 @@ world.registerSystem(MyPhysicsLogicSystem, { priority: 5 });
|
|
|
32
32
|
|
|
33
33
|
## PhysicsSystem Configuration
|
|
34
34
|
|
|
35
|
-
The
|
|
35
|
+
The project manifest accepts execution, frequency, and interpolation options:
|
|
36
|
+
|
|
37
|
+
```jsonc
|
|
38
|
+
"physics": {
|
|
39
|
+
"useWorker": true,
|
|
40
|
+
"updateFrequency": 60,
|
|
41
|
+
"interpolation": true
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- `useWorker` defaults to `true`. Set it to `false` to run the same runtime and message protocol on the main thread.
|
|
46
|
+
- `updateFrequency` defaults to 60 Hz and is capped at 240 Hz.
|
|
47
|
+
- `interpolation` defaults to `true` and smooths rendered transforms between fixed physics snapshots.
|
|
48
|
+
|
|
49
|
+
The system also accepts a reactive `gravity` config (defaults to Earth gravity):
|
|
36
50
|
|
|
37
51
|
```typescript
|
|
38
52
|
import { PhysicsSystem } from '@iwsdk/core';
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: iwsdk-pwa-packaging
|
|
3
|
+
description: Ship an IWSDK app to Meta Quest and the Horizon Store as a PWA/TWA — both immersive WebXR and 2D windowed panel modes. Use for PWA packaging, web app manifest and icons, auto-enter-XR on launch, bubblewrap APK builds, signing keystores, Digital Asset Links, sideloading, and Horizon Store upload. Also use when a packaged app is stuck loading, shows a URL bar, or will not launch.
|
|
4
|
+
argument-hint: '[packaging goal, e.g. "ship to the store" or "build an APK"]'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PWA Packaging for Meta Horizon
|
|
8
|
+
|
|
9
|
+
Turn a built IWSDK app into a signed Quest APK and get it on the Store. The app
|
|
10
|
+
runs from a live URL inside a Trusted Web Activity — the APK is a thin native
|
|
11
|
+
wrapper, not a bundle of your files. That single fact explains most of the
|
|
12
|
+
pipeline: the origin must be live before packaging, and web fixes ship by
|
|
13
|
+
redeploying rather than rebuilding.
|
|
14
|
+
|
|
15
|
+
User request is in `$ARGUMENTS`.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
0. Pick app mode → immersive WebXR vs 2D panel (decides steps 1 and 4)
|
|
19
|
+
1. Prepare the app → auto-enter XR (immersive only) + manifest link
|
|
20
|
+
2. Get it hosted → public HTTPS origin = <DOMAIN> [iwsdk-hosting]
|
|
21
|
+
3. Manifest + icons → installable PWA, live on <DOMAIN>
|
|
22
|
+
4. Package the APK → keystore, twa-manifest.json, build, asset links
|
|
23
|
+
5. Upload to Store → ovr-platform-util
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Do not reorder these. Step 4 fetches from `<DOMAIN>`, and asset links in step 4
|
|
27
|
+
need a second publish through step 2 — so hosting is a dependency, not a
|
|
28
|
+
finishing touch.
|
|
29
|
+
|
|
30
|
+
## Step 0 — Pick the app mode first
|
|
31
|
+
|
|
32
|
+
One decision, made once, that changes exactly two things downstream. Ask the
|
|
33
|
+
developer if it is not obvious from the project.
|
|
34
|
+
|
|
35
|
+
| | **Immersive WebXR** | **2D panel** |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| Runs as | full VR/WebXR session | windowed 2D panel with a Library entry |
|
|
38
|
+
| Auto-enter session (step 1) | **yes** | **no — must not be added** |
|
|
39
|
+
| `horizonOSAppMode` (step 4) | `"immersive"` | `"2D"` |
|
|
40
|
+
|
|
41
|
+
An IWSDK app scaffolded with `--mode vr` or `--mode ar` is immersive. A wrong
|
|
42
|
+
value here is the classic failure: a 2D app marked `immersive` hangs on a
|
|
43
|
+
loading screen, and an immersive app marked `2D` opens with a browser URL bar.
|
|
44
|
+
Details and the AR/VR nuance: [`references/app-modes.md`](references/app-modes.md).
|
|
45
|
+
|
|
46
|
+
## Step 1 — Prepare the app
|
|
47
|
+
|
|
48
|
+
**Immersive only: auto-enter the XR session on launch.** An installed immersive
|
|
49
|
+
PWA has no 2D page to click, so nothing would ever call `requestSession` — the
|
|
50
|
+
app-icon tap is the user activation and the app must spend it itself. Gate on
|
|
51
|
+
`getDigitalGoodsService` so this fires only in the installed PWA and never in a
|
|
52
|
+
browser tab, which keeps its normal Enter-XR button.
|
|
53
|
+
|
|
54
|
+
In `src/index.ts`, inside the `World.create(...)` callback:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
World.create(container, projectOptions).then((world) => {
|
|
58
|
+
// …system registration…
|
|
59
|
+
|
|
60
|
+
const nav = navigator as Navigator & {
|
|
61
|
+
xr?: { isSessionSupported?: (m: string) => Promise<boolean> };
|
|
62
|
+
};
|
|
63
|
+
if ('getDigitalGoodsService' in window && nav.xr?.isSessionSupported) {
|
|
64
|
+
nav.xr
|
|
65
|
+
.isSessionSupported('immersive-vr') // 'immersive-ar' for an AR app
|
|
66
|
+
.then((supported) => {
|
|
67
|
+
if (supported) world.launchXR();
|
|
68
|
+
})
|
|
69
|
+
.catch(() => {});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`world.launchXR()` is IWSDK's `requestSession` plus session setup — do not call
|
|
75
|
+
`navigator.xr.requestSession` directly. `getDigitalGoodsService` exists only on
|
|
76
|
+
device, so this path cannot be validated in a desktop browser or in IWER; verify
|
|
77
|
+
it on the headset after sideloading (step 4).
|
|
78
|
+
|
|
79
|
+
**Both modes:** link the manifest and icons in `index.html`. The scaffolded
|
|
80
|
+
`index.html` ships `<link rel="icon" href="data:," />` and no manifest link, so
|
|
81
|
+
the app is not installable until step 3 adds them.
|
|
82
|
+
|
|
83
|
+
Then confirm the app itself is sound before wrapping it — `npm run --if-present typecheck`,
|
|
84
|
+
and `npm run build` producing a `dist/` you have actually loaded. Packaging a
|
|
85
|
+
broken build wastes a full round trip through hosting, signing, and upload.
|
|
86
|
+
|
|
87
|
+
## Step 2 — Get it hosted
|
|
88
|
+
|
|
89
|
+
**Invoke the `iwsdk-hosting` skill.** It asks whether hosting already exists,
|
|
90
|
+
recommends and runs Vercel if not, and — if the developer already has a host —
|
|
91
|
+
pauses with concrete upload steps instead of guessing at their pipeline.
|
|
92
|
+
|
|
93
|
+
Come back with a `<DOMAIN>` that passes the hosting contract: root, manifest,
|
|
94
|
+
and icons all 200, manifest served as `application/manifest+json`. Asset links
|
|
95
|
+
are still expected to 404 at this point; they arrive in step 4.
|
|
96
|
+
|
|
97
|
+
Do not substitute a localhost tunnel or a preview URL. `bubblewrap` bakes the
|
|
98
|
+
host into the APK, and a URL that later 401s or disappears produces an app that
|
|
99
|
+
installs and then shows nothing.
|
|
100
|
+
|
|
101
|
+
## Step 3 — Manifest and icons
|
|
102
|
+
|
|
103
|
+
Both modes need a valid installable manifest plus PNG icons, live on `<DOMAIN>`
|
|
104
|
+
before `bubblewrap update` runs — it fetches them over the network.
|
|
105
|
+
|
|
106
|
+
`public/manifest.webmanifest`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"name": "…", "short_name": "…", "description": "…",
|
|
111
|
+
"start_url": "/", "scope": "/",
|
|
112
|
+
"display": "standalone", "orientation": "landscape",
|
|
113
|
+
"background_color": "#06010f", "theme_color": "#0a0418",
|
|
114
|
+
"icons": [
|
|
115
|
+
{ "src": "/icons/icon-192.png", "type": "image/png", "sizes": "192x192", "purpose": "any" },
|
|
116
|
+
{ "src": "/icons/icon-512.png", "type": "image/png", "sizes": "512x512", "purpose": "any" },
|
|
117
|
+
{ "src": "/icons/icon-512-maskable.png", "type": "image/png", "sizes": "512x512", "purpose": "maskable" }
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Generate icons with `sharp` (`npm i -D sharp`; the scaffold already pins a
|
|
123
|
+
working version). The maskable icon must be full-bleed and opaque. Full manifest
|
|
124
|
+
reference, the icon script, and subpath/multi-origin cases:
|
|
125
|
+
[`references/manifest-and-icons.md`](references/manifest-and-icons.md).
|
|
126
|
+
|
|
127
|
+
Rebuild and publish — via `iwsdk-hosting` again if the developer owns the host —
|
|
128
|
+
then verify the manifest and both icon URLs return 200 before continuing.
|
|
129
|
+
|
|
130
|
+
## Step 4 — Package the APK with bubblewrap
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npm i -g @meta-quest/bubblewrap-cli # bin: bubblewrap, needs Node >= 18
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
First run downloads a JDK 17 and the Android SDK into `~/.bubblewrap` behind
|
|
137
|
+
**interactive prompts** (including an SDK licence confirmation). An agent cannot
|
|
138
|
+
answer those — have the developer run `bubblewrap doctor` once in a real
|
|
139
|
+
terminal, then continue. Everything after that is scriptable.
|
|
140
|
+
|
|
141
|
+
`bubblewrap init` is also an interactive wizard with no value flags to bypass
|
|
142
|
+
it, so **use the scripted path**: hand-write `twa-manifest.json`, then `update`
|
|
143
|
+
and `build`.
|
|
144
|
+
|
|
145
|
+
Four things happen here, in order:
|
|
146
|
+
|
|
147
|
+
1. **Choose the signing key — pause and ask.** The key is permanent: every
|
|
148
|
+
future update must reuse the same keystore, alias, and `packageId`, and a
|
|
149
|
+
published listing is already bound to one. Reuse an existing keystore, or
|
|
150
|
+
generate a new one outside the deployable web tree so it never ships.
|
|
151
|
+
2. **Write `twa-manifest.json`**, with `isMetaQuest: true` and the
|
|
152
|
+
`horizonOSAppMode` chosen in step 0.
|
|
153
|
+
3. **Build** — `bubblewrap update && bubblewrap build`, passwords passed through
|
|
154
|
+
`BUBBLEWRAP_KEYSTORE_PASSWORD` / `BUBBLEWRAP_KEY_PASSWORD` (there are no
|
|
155
|
+
password CLI flags).
|
|
156
|
+
4. **Publish `public/.well-known/assetlinks.json`** with the package name and
|
|
157
|
+
the certificate SHA-256. Until it is live on `<DOMAIN>`, the TWA will not
|
|
158
|
+
launch. This is the second hosting handoff — go back through `iwsdk-hosting`
|
|
159
|
+
and verify the URL yourself.
|
|
160
|
+
|
|
161
|
+
Commands, the full manifest template, keystore handling, and build verification:
|
|
162
|
+
[`references/bubblewrap.md`](references/bubblewrap.md).
|
|
163
|
+
|
|
164
|
+
Sideload and test on device before uploading — `adb install -r
|
|
165
|
+
app-release-signed.apk`, or the `metavr` MCP server that scaffolded projects
|
|
166
|
+
register. This is the only place the immersive auto-enter path can be verified.
|
|
167
|
+
|
|
168
|
+
## Step 5 — Upload to the Horizon Store
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
./ovr-platform-util upload-quest-build \
|
|
172
|
+
--app-id <HORIZON_APP_ID> --app-secret <SECRET> \
|
|
173
|
+
--apk app-release-signed.apk \
|
|
174
|
+
--channel ALPHA --age-group MIXED_AGES \
|
|
175
|
+
--notes "…" --disable-progress-bar
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Same command for both modes. Channels: `ALPHA`/`BETA`/`RC` for testing, `STORE`
|
|
179
|
+
for production. Auth is the app's App Secret or a user token — ask the
|
|
180
|
+
developer, never invent one, and never write it into a file under `public/`.
|
|
181
|
+
|
|
182
|
+
Expect the first upload to fail with *"must first agree to our Developer
|
|
183
|
+
Distribution Agreement"*. Only an org admin can sign it, so pause, ask, and
|
|
184
|
+
retry the identical command. Tool download, auth, and flag reference:
|
|
185
|
+
[`references/store-upload.md`](references/store-upload.md).
|
|
186
|
+
|
|
187
|
+
## Redeploy vs rebuild
|
|
188
|
+
|
|
189
|
+
| Change | Action |
|
|
190
|
+
| ------ | ------ |
|
|
191
|
+
| App logic, assets, styling, manifest text, icons, asset links | republish `<DOMAIN>`; installed TWA picks it up next launch |
|
|
192
|
+
| Package id, app name, launcher icon, version, **app mode**, signing | rebuild the APK and re-upload |
|
|
193
|
+
|
|
194
|
+
## Security
|
|
195
|
+
|
|
196
|
+
The keystore and the app secret never go near `public/` or `dist/`. After every
|
|
197
|
+
publish, confirm the keystore is not being served:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
curl -s -o /dev/null -w '%{http_code}\n' https://<DOMAIN>/android.keystore # want 404
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Back up the keystore somewhere durable. Losing it means the app can never be
|
|
204
|
+
updated — only replaced by a new Store entry.
|
|
205
|
+
|
|
206
|
+
## Reference Files
|
|
207
|
+
|
|
208
|
+
| File | Load when |
|
|
209
|
+
| ---- | --------- |
|
|
210
|
+
| [`references/app-modes.md`](references/app-modes.md) | Step 0 — choosing immersive vs 2D, and what each implies |
|
|
211
|
+
| [`references/manifest-and-icons.md`](references/manifest-and-icons.md) | Step 3 — manifest fields, icon generation, subpath and multi-origin |
|
|
212
|
+
| [`references/bubblewrap.md`](references/bubblewrap.md) | Step 4 — prereqs, keystore, `twa-manifest.json`, build, asset links |
|
|
213
|
+
| [`references/store-upload.md`](references/store-upload.md) | Step 5 — `ovr-platform-util`, auth, channels, the DDA blocker |
|
|
214
|
+
| [`references/troubleshooting.md`](references/troubleshooting.md) | Anything installed but misbehaving — stuck loading, URL bar, will-not-launch |
|
|
215
|
+
|
|
216
|
+
Getting the app online is the `iwsdk-hosting` skill. Building the app itself is
|
|
217
|
+
`iwsdk-planner` and the other `iwsdk-*` skills — do not re-derive IWSDK
|
|
218
|
+
patterns here.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# App Modes: Immersive WebXR vs 2D Panel
|
|
2
|
+
|
|
3
|
+
The first decision in the pipeline and the one most likely to be wrong. It is
|
|
4
|
+
made once, and it changes exactly two things:
|
|
5
|
+
|
|
6
|
+
1. Whether the app auto-enters a WebXR session on launch (immersive only).
|
|
7
|
+
2. The `horizonOSAppMode` value in `twa-manifest.json`.
|
|
8
|
+
|
|
9
|
+
Everything else — hosting, manifest, icons, keystore, asset links, Store upload
|
|
10
|
+
— is identical for both.
|
|
11
|
+
|
|
12
|
+
| | **Immersive WebXR** | **2D panel** |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| Runs as | full VR/WebXR session on launch | windowed 2D panel with its own Library entry |
|
|
15
|
+
| Typical app | IWSDK scene, game, spatial tool | dashboard, companion app, store front, any responsive site |
|
|
16
|
+
| Web app requirement | must support `immersive-vr` / `immersive-ar` | any responsive PWA; IWSDK not required |
|
|
17
|
+
| Auto-enter `requestSession` | **yes — built into the app** | **no — must not be added** |
|
|
18
|
+
| `horizonOSAppMode` | `"immersive"` | `"2D"` |
|
|
19
|
+
|
|
20
|
+
## Choosing
|
|
21
|
+
|
|
22
|
+
An IWSDK app scaffolded with `--mode vr` or `--mode ar` is immersive; that is
|
|
23
|
+
the whole point of the scaffold. Pick 2D only when the experience is genuinely a
|
|
24
|
+
flat panel — a companion or admin surface next to an immersive app, or a web
|
|
25
|
+
property being brought to the headset unchanged.
|
|
26
|
+
|
|
27
|
+
If the same origin should be both, that is two Store apps with two `packageId`s
|
|
28
|
+
sharing one `<DOMAIN>`. The asset-links file lists both packages.
|
|
29
|
+
|
|
30
|
+
## The classic failure
|
|
31
|
+
|
|
32
|
+
`horizonOSAppMode` is validated against `['immersive', '2D']` and **defaults to
|
|
33
|
+
`immersive`** when absent or misspelled — so a 2D app whose manifest omits the
|
|
34
|
+
field inherits the wrong mode silently.
|
|
35
|
+
|
|
36
|
+
| Symptom on device | Cause | Fix |
|
|
37
|
+
| ----------------- | ----- | --- |
|
|
38
|
+
| 2D app stuck on a loading screen | mode is `immersive`; Horizon waits for a session that never starts | set `"2D"`, `bubblewrap update && bubblewrap build`, re-upload |
|
|
39
|
+
| Immersive app opens showing a browser URL bar | mode is `2D` | set `"immersive"`, rebuild, re-upload |
|
|
40
|
+
| Immersive app opens flat with no URL bar | mode is right, auto-enter code is missing or never fires | add/repair the auto-enter block, republish `<DOMAIN>` — no rebuild needed |
|
|
41
|
+
|
|
42
|
+
The third row is worth internalizing: a missing session call is a **web** bug,
|
|
43
|
+
fixed by a redeploy. A wrong mode is a **native** bug, fixed only by a new APK.
|
|
44
|
+
Check the mode in the built APK before blaming the app code:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
"$BT/aapt" dump badging app-release-signed.apk | grep -iE 'package:|APP_MODE|OCULUS'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Auto-enter, in detail (immersive only)
|
|
51
|
+
|
|
52
|
+
An installed immersive PWA has no 2D page and no button to press. Horizon
|
|
53
|
+
launches it straight into a headset context, so if the app waits for a click it
|
|
54
|
+
waits forever. The app-icon tap counts as the user activation that
|
|
55
|
+
`requestSession` requires — but only if the app spends it immediately on load.
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const nav = navigator as Navigator & {
|
|
59
|
+
xr?: { isSessionSupported?: (m: string) => Promise<boolean> };
|
|
60
|
+
};
|
|
61
|
+
if ('getDigitalGoodsService' in window && nav.xr?.isSessionSupported) {
|
|
62
|
+
nav.xr
|
|
63
|
+
.isSessionSupported('immersive-vr') // 'immersive-ar' for an AR app
|
|
64
|
+
.then((supported) => {
|
|
65
|
+
if (supported) world.launchXR();
|
|
66
|
+
})
|
|
67
|
+
.catch(() => {});
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Three things this code is doing deliberately:
|
|
72
|
+
|
|
73
|
+
- **`getDigitalGoodsService` as the install gate.** It is present in an
|
|
74
|
+
installed PWA and absent in a browser tab, so the same build keeps its normal
|
|
75
|
+
Enter-XR button on desktop and in IWER while auto-entering on device. Feature-
|
|
76
|
+
detecting the headset any other way (user agent, screen size) misfires.
|
|
77
|
+
- **`isSessionSupported` before `launchXR`.** Calling into an unsupported mode
|
|
78
|
+
throws and leaves the app on a black screen with nothing in the console.
|
|
79
|
+
- **`world.launchXR()`, not `navigator.xr.requestSession`.** `launchXR` is
|
|
80
|
+
IWSDK's session request plus the renderer, reference-space, and input wiring
|
|
81
|
+
that the world needs. A raw `requestSession` gets a session the world does not
|
|
82
|
+
know about.
|
|
83
|
+
|
|
84
|
+
Match the session mode to `iwsdk.config.json` — `world.xr.mode: "ar"` means
|
|
85
|
+
`isSessionSupported('immersive-ar')`. Querying the wrong mode returns `false`
|
|
86
|
+
and the app silently stays flat.
|
|
87
|
+
|
|
88
|
+
Because `getDigitalGoodsService` is device-only, this branch never runs on a
|
|
89
|
+
development machine. It can only be verified by sideloading the APK and
|
|
90
|
+
launching from the Library.
|
|
91
|
+
|
|
92
|
+
## 2D panel notes
|
|
93
|
+
|
|
94
|
+
A 2D app runs as a single-instance standalone panel. There is no tab or
|
|
95
|
+
navigation bar by default; `theme_color` / `theme_color_dark` in the web
|
|
96
|
+
manifest color the custom tab bar when one is shown. Cookies and storage are
|
|
97
|
+
shared with the Quest Browser.
|
|
98
|
+
|
|
99
|
+
Out-of-scope links open inside the panel unless targeted at a new tab or window.
|
|
100
|
+
If the app legitimately spans origins, add `additional_trusted_origins` to the
|
|
101
|
+
web manifest and host `/.well-known/assetlinks.json` on **every** listed origin
|
|
102
|
+
— a missing one silently drops that origin out of scope mid-session.
|
|
103
|
+
|
|
104
|
+
Do not add the auto-enter block to a 2D app under any circumstances.
|