@joiner-platform/cli 0.0.0-stage → 0.1.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.
Files changed (303) hide show
  1. package/README.md +30 -2
  2. package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
  3. package/bundled-resources/poe-tile-templates/base/README.md +7 -0
  4. package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
  5. package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
  6. package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
  7. package/bundled-resources/poe-tile-templates/base/package.json +36 -0
  8. package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
  9. package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
  10. package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
  11. package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
  12. package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
  13. package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
  14. package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
  15. package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
  16. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
  17. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
  18. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
  19. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
  20. package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
  21. package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
  22. package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
  23. package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
  24. package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
  25. package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
  26. package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
  27. package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
  28. package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
  29. package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
  30. package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
  31. package/bundled-resources/poe-tile-templates/index.ts +27 -0
  32. package/bundled-resources/poe-tile-templates/package.json +31 -0
  33. package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
  34. package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
  35. package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
  36. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
  37. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
  38. package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
  39. package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
  40. package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
  41. package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
  42. package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
  43. package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
  44. package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
  45. package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
  46. package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
  47. package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
  48. package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
  49. package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
  50. package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
  51. package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
  52. package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
  53. package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
  54. package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
  55. package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
  56. package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
  57. package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
  58. package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
  59. package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
  60. package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
  61. package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
  62. package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
  63. package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
  64. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
  65. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
  66. package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
  67. package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
  68. package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
  69. package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
  70. package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
  71. package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
  72. package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
  73. package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
  74. package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
  75. package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
  76. package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
  77. package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
  78. package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
  79. package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
  80. package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
  81. package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
  82. package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
  83. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
  84. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
  85. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
  86. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
  87. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
  88. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
  89. package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
  90. package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
  91. package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
  92. package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
  93. package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
  94. package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
  95. package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
  96. package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
  97. package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
  98. package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
  99. package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
  100. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
  101. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
  102. package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
  103. package/cli.ts +134 -0
  104. package/index.ts +96 -0
  105. package/package.json +48 -5
  106. package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
  107. package/skills/audio-generation/SKILL.md +125 -0
  108. package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
  109. package/skills/finish-prototype/SKILL.md +22 -0
  110. package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
  111. package/skills/help-me-build/SKILL.md +56 -0
  112. package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
  113. package/skills/image-generation/SKILL.md +128 -0
  114. package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
  115. package/skills/one-shot/SKILL.md +22 -0
  116. package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
  117. package/skills/platform-prototype/SKILL.md +60 -0
  118. package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
  119. package/skills/platform-subagent/SKILL.md +16 -0
  120. package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
  121. package/skills/poe-tiles-cli/SKILL.md +609 -0
  122. package/skills/poe-tiles-cli/references/device-motion.md +40 -0
  123. package/skills/poe-tiles-cli/references/player-updates.md +41 -0
  124. package/skills/prototype/.generated-by-poe-templated-docs +0 -0
  125. package/skills/prototype/SKILL.md +149 -0
  126. package/skills/publish/.generated-by-poe-templated-docs +0 -0
  127. package/skills/publish/SKILL.md +73 -0
  128. package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
  129. package/skills/synced-store/SKILL.md +583 -0
  130. package/skills/synced-store/references/actions.md +85 -0
  131. package/skills/synced-store/references/api-patterns.md +245 -0
  132. package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
  133. package/skills/synced-store/references/client-api-reference.md +263 -0
  134. package/skills/synced-store/references/data-visibility.md +95 -0
  135. package/skills/synced-store/references/external-stores.md +162 -0
  136. package/skills/synced-store/references/file-uploads.md +216 -0
  137. package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
  138. package/skills/synced-store/references/limitations.md +72 -0
  139. package/skills/synced-store/references/live-data-limit-hook.md +131 -0
  140. package/skills/synced-store/references/mutator-rules.md +169 -0
  141. package/skills/synced-store/references/platform.md +49 -0
  142. package/skills/synced-store/references/schema-and-bindings.md +85 -0
  143. package/skills/synced-store/references/schema-libraries.md +57 -0
  144. package/skills/synced-store/references/schema-migrations.md +119 -0
  145. package/skills/synced-store/references/searchable-tables.md +27 -0
  146. package/skills/synced-store/references/server-forking.md +115 -0
  147. package/skills/synced-store/references/singleton-tables.md +61 -0
  148. package/skills/synced-store/references/sort-keys.md +253 -0
  149. package/skills/synced-store/references/ui-patterns.md +95 -0
  150. package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
  151. package/skills/tile-creator/SKILL.md +197 -0
  152. package/skills/tile-creator/references/assets.md +124 -0
  153. package/skills/tile-creator/references/backend-api.md +354 -0
  154. package/skills/tile-creator/references/cli-limitations.md +64 -0
  155. package/skills/tile-creator/references/cli.md +604 -0
  156. package/skills/tile-creator/references/client-api.md +2407 -0
  157. package/skills/tile-creator/references/composing-apps.md +166 -0
  158. package/skills/tile-creator/references/e2e-tests.md +55 -0
  159. package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
  160. package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
  161. package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
  162. package/skills/tile-creator/references/native-results.md +100 -0
  163. package/skills/tile-creator/references/platform-integration.md +201 -0
  164. package/skills/tile-creator/references/power-report.md +199 -0
  165. package/skills/tile-creator/references/publish-rollout.md +166 -0
  166. package/skills/tile-creator/references/publishing.md +33 -0
  167. package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
  168. package/skills/tile-creator/references/render-check.md +266 -0
  169. package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
  170. package/skills/tile-creator/references/safe-area-insets.md +79 -0
  171. package/skills/tile-creator/references/sandbox-limitations.md +32 -0
  172. package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
  173. package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
  174. package/skills/tile-creator/references/simulations.md +125 -0
  175. package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
  176. package/skills/tile-creator/references/troubleshooting.md +22 -0
  177. package/skills/tile-creator/references/turn-based-mutator.md +43 -0
  178. package/skills/tile-creator/references/user-erasure.md +14 -0
  179. package/skills/tile-creator/references/vite-plugin.md +166 -0
  180. package/skills/tile-creator/references/workspace-retention.md +72 -0
  181. package/src/admin-conversions-client.ts +28 -0
  182. package/src/admin-reviews-client.ts +36 -0
  183. package/src/api.generated.ts +1527 -0
  184. package/src/auth-token.ts +198 -0
  185. package/src/bounded-read.ts +35 -0
  186. package/src/bun-version.ts +33 -0
  187. package/src/checkout-base.ts +207 -0
  188. package/src/cli-bun-version.ts +16 -0
  189. package/src/cli-env.ts +28 -0
  190. package/src/cli-name.ts +23 -0
  191. package/src/client.ts +2474 -0
  192. package/src/collect-files.ts +226 -0
  193. package/src/commands/accounts.ts +55 -0
  194. package/src/commands/admin-abandon-conversion.ts +60 -0
  195. package/src/commands/admin-reviews.ts +66 -0
  196. package/src/commands/admin.ts +219 -0
  197. package/src/commands/auth.ts +89 -0
  198. package/src/commands/checkout-prototype.ts +67 -0
  199. package/src/commands/creator-source-capability.ts +11 -0
  200. package/src/commands/doctor-bun.ts +145 -0
  201. package/src/commands/doctor-command.ts +64 -0
  202. package/src/commands/doctor-package-json.ts +47 -0
  203. package/src/commands/doctor-sdk-pin.ts +156 -0
  204. package/src/commands/doctor-store-keys-lexer.ts +213 -0
  205. package/src/commands/doctor-store-keys-scan.ts +262 -0
  206. package/src/commands/doctor-store-keys.ts +196 -0
  207. package/src/commands/doctor.ts +371 -0
  208. package/src/commands/init/blank-scaffold-templates.ts +397 -0
  209. package/src/commands/init/index.ts +170 -0
  210. package/src/commands/init/internal-toolchain.ts +49 -0
  211. package/src/commands/init/manager-test-template.ts +107 -0
  212. package/src/commands/init/multiplayer-test-template.ts +217 -0
  213. package/src/commands/init/name-input.tsx +167 -0
  214. package/src/commands/init/no-store-scaffold-templates.ts +281 -0
  215. package/src/commands/init/no-store-scaffold.ts +134 -0
  216. package/src/commands/init/package-json-scripts.ts +72 -0
  217. package/src/commands/init/scaffold.ts +960 -0
  218. package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
  219. package/src/commands/init/sdk-tarball-url.ts +31 -0
  220. package/src/commands/init/template-picker.tsx +147 -0
  221. package/src/commands/inspect-child-entry.ts +107 -0
  222. package/src/commands/inspect-contract.ts +87 -0
  223. package/src/commands/inspect-freshness.ts +217 -0
  224. package/src/commands/inspect-lock.ts +201 -0
  225. package/src/commands/inspect-options.ts +360 -0
  226. package/src/commands/inspect-orchestrate.ts +375 -0
  227. package/src/commands/inspect-process.ts +172 -0
  228. package/src/commands/inspect-ready.ts +65 -0
  229. package/src/commands/inspect-report.ts +235 -0
  230. package/src/commands/inspect-run-state.ts +296 -0
  231. package/src/commands/inspect-run.ts +157 -0
  232. package/src/commands/inspect-watchdog.ts +74 -0
  233. package/src/commands/install-joiner.ts +208 -0
  234. package/src/commands/login.ts +308 -0
  235. package/src/commands/models.ts +40 -0
  236. package/src/commands/parse-options.ts +36 -0
  237. package/src/commands/remix-package-json.ts +64 -0
  238. package/src/commands/remix.ts +379 -0
  239. package/src/commands/sdk-url.ts +141 -0
  240. package/src/commands/simulations.ts +133 -0
  241. package/src/commands/skills.ts +108 -0
  242. package/src/commands/store-files.ts +92 -0
  243. package/src/commands/stores.ts +703 -0
  244. package/src/commands/tiles-channel-commands.ts +115 -0
  245. package/src/commands/tiles-checkout.ts +351 -0
  246. package/src/commands/tiles-gallery-command.ts +95 -0
  247. package/src/commands/tiles-get-helpers.ts +27 -0
  248. package/src/commands/tiles-inspect.ts +276 -0
  249. package/src/commands/tiles-power-command.ts +308 -0
  250. package/src/commands/tiles-power-format.ts +396 -0
  251. package/src/commands/tiles-power-versions.ts +299 -0
  252. package/src/commands/tiles-publish-helpers.ts +145 -0
  253. package/src/commands/tiles-upload-command.ts +277 -0
  254. package/src/commands/tiles-version-commands.ts +201 -0
  255. package/src/commands/tiles-visibility-command.ts +103 -0
  256. package/src/commands/tiles.ts +257 -0
  257. package/src/commands/upgrade.ts +307 -0
  258. package/src/commit-in-progress.ts +42 -0
  259. package/src/creator-source-context.ts +97 -0
  260. package/src/creator-source-publish.ts +52 -0
  261. package/src/deferred-assets.ts +125 -0
  262. package/src/distribution.ts +28 -0
  263. package/src/errors.ts +61 -0
  264. package/src/install-command.ts +43 -0
  265. package/src/output.ts +62 -0
  266. package/src/poe-tile-config-files.ts +100 -0
  267. package/src/poe-tile-config-players.ts +168 -0
  268. package/src/poe-tile-config-remix.ts +166 -0
  269. package/src/poe-tile-config.ts +831 -0
  270. package/src/power-report-client.ts +55 -0
  271. package/src/prototype-startup.ts +21 -0
  272. package/src/publish-change-summary.ts +55 -0
  273. package/src/publish-overrides-validation.ts +49 -0
  274. package/src/publish-pack.ts +167 -0
  275. package/src/publish-phases.ts +57 -0
  276. package/src/publish-retry.ts +51 -0
  277. package/src/publish-tile-from-config.ts +434 -0
  278. package/src/recorder-stream.ts +169 -0
  279. package/src/remix-provenance.ts +156 -0
  280. package/src/resolve-client-credential.ts +71 -0
  281. package/src/resolve-media-uploads.ts +147 -0
  282. package/src/sdk-dependency.ts +54 -0
  283. package/src/sdk-skills.ts +85 -0
  284. package/src/should-skip-client-setup.ts +20 -0
  285. package/src/simulation-snapshot.ts +123 -0
  286. package/src/simulation-types.ts +74 -0
  287. package/src/simulations-client.ts +112 -0
  288. package/src/source-bundle.ts +466 -0
  289. package/src/staged-publish-cleanup.ts +44 -0
  290. package/src/staged-publish-deferred.ts +160 -0
  291. package/src/staged-publish.ts +401 -0
  292. package/src/store-file-upload.ts +268 -0
  293. package/src/store-request.ts +168 -0
  294. package/src/tar-canonical.ts +41 -0
  295. package/src/tar-extensions.ts +159 -0
  296. package/src/tar-extract.ts +193 -0
  297. package/src/tar-parse.ts +224 -0
  298. package/src/tar.ts +231 -0
  299. package/src/template-check-scripts.ts +18 -0
  300. package/src/tile-gallery-client.ts +82 -0
  301. package/src/types.ts +258 -0
  302. package/src/upload-concurrency.ts +54 -0
  303. package/src/whole-tile.ts +52 -0
@@ -0,0 +1,166 @@
1
+ # Composing apps (advanced)
2
+
3
+ > **Most apps don't need this.** Build a single app first — one synced-store schema with the right visibility tiers handles role-specific or hidden state without splitting. Read this only when you have a concrete reason to compose (below) or are wiring a multi-user space that launches sub-apps.
4
+
5
+ ## Single app vs composition
6
+
7
+ **Default: single app.** Spy Words, Chess, Tic-Tac-Toe, polls, whiteboards — all single apps.
8
+
9
+ Compose into multiple apps **only** when at least one holds:
10
+ 1. **Sub-experience private to a subset of parent's users** — per-instance privacy beats per-channel ACLs in one giant schema.
11
+ 2. **Reusable, independently-publishable primitive** — e.g. a "threaded chat" multiple parents embed.
12
+ 3. **Lifecycles diverge sharply** — parent long-lived (server membership, tournament season), children created / used / archived independently (channels, matches).
13
+
14
+ **Not enough reasons:** "cleaner architecture", different screens / modes / roles of the same experience, splitting lobby + game. Routes inside one app are simpler than cross-app coordination.
15
+
16
+ `<poe-tile>` resolves children by `type-id`, which only exists once the child has been **published**. When composing: publish each child first, capture `type-id` from `joiner tiles list`, wire into parent as constants, then republish the parent.
17
+
18
+ ## Picker + detail: split view
19
+
20
+ When a parent is essentially a picker (server channel list, gallery, lobby) and the "experience" lives in the picked sub-app, prefer **split view** over inline `<poe-tile>` embedding. Split view runs the two apps side-by-side at the root level wherever the manager uses its two-column layout (desktop and tablets), and falls back to a normal forward navigation on phones (in any orientation) and narrow windows — one call site, both form factors:
21
+
22
+ ```javascript
23
+ // From the picker app
24
+ await Poe.open({
25
+ typeId: pickedAppId,
26
+ instanceId: pickedInstanceId,
27
+ placement: "splitView",
28
+ // Picker is a fixed-width list; opened app gets the rest of the screen.
29
+ viewWidth: "260px",
30
+ });
31
+ ```
32
+
33
+ Subsequent `placement: "splitView"` calls from the same picker swap the side pane in place, so a single picker drives a single detail pane through many selections without churning its own state.
34
+
35
+ ### Embedding with `<poe-tile>`
36
+
37
+ Alternative to split view: render a sub-app directly inside the parent's DOM using the `<poe-tile>` custom element. Each `<poe-tile>` instance gets its own synced-store instance scoped to its `instance-id`; the child inherits the parent's room by default.
38
+
39
+ ```html
40
+ <poe-tile type-id="my-chat" instance-id="room-42"></poe-tile>
41
+ ```
42
+
43
+ ```javascript
44
+ // Register the element once on entry so the parent can render <poe-tile> in its JSX/HTML.
45
+ // `environment` is the same `PostMessageEnvironment` you pass to `createPoe()` — see
46
+ // the Initialization snippet in client-api.md for the full wiring.
47
+ import {
48
+ createPoe,
49
+ PostMessageEnvironment,
50
+ registerPoeTileElement,
51
+ } from "joiner-sdk/v1/client.js";
52
+
53
+ const environment = new PostMessageEnvironment();
54
+ const Poe = createPoe({ environment });
55
+ registerPoeTileElement(environment);
56
+ ```
57
+
58
+ Use this over `Poe.open({ placement: "splitView" })` when the sub-app should be a real DOM child of the parent (parent's layout drives sizing, multiple sub-apps render simultaneously, parent owns the surrounding chrome). Use split view when the sub-app should behave as a top-level app (own back button, deep links on mobile, swaps in place across selections).
59
+
60
+ See [`<poe-tile>` attributes](./client-api.md#attributes) for the full attribute reference (including `room="explicit"` + `room-type-id` / `room-instance-id` for cross-room embeds).
61
+
62
+ See `Poe.open()` in [client-api.md](./client-api.md#poe-open-typeid-instanceid-openprops-anchorsortkey-placement-viewwidth) for the full parameter reference.
63
+
64
+ ## Rooms
65
+
66
+ > **Most apps don't need this.** Refer to this section only when launching a sub-app that breaks out of the current room (e.g. a chat launching a game whose `$users` should differ from the chat's roster, or an app registering members against a foreign room). Standalone apps and simple parent/child embeds inherit the right roster automatically — the platform sets sensible defaults.
67
+
68
+ ### What a room is
69
+
70
+ A **room** is an app instance whose `$users` roster is the source of truth for membership across a set of related sub-app instances. The platform fans every `$addUsers` / `$removeUser` on the room out to every registered member instance, so sub-apps inherit the roster automatically — including users admitted before the sub-app existed.
71
+
72
+ Most apps never touch room wiring directly:
73
+ - Top-level apps opened from the manager become their own room.
74
+ - Children opened via `Poe.open()` or `<poe-tile>` default to inheriting the opener's room.
75
+ - Apps just read `$users` and trust the roster.
76
+
77
+ Reach for the explicit APIs below only when the calling app *is* the room and needs to register sub-apps as members or react when they're added.
78
+
79
+ ### Room launches a sub-app
80
+
81
+ A parent that *is the room* mints a sub-app instance from its own UI. Two pieces:
82
+
83
+ 1. **Parent-side mutator** — call [`addInstanceToRoom`](./client-api.md#addinstancetoroom) to register the new instance on `$room_member_instances` so the platform fans the parent's `$users` into the sub-app. App-level mutators can't read their own `$$system:room` to auto-detect role, so the caller picks based on what it knows: when the calling store IS the room, omit `room` and the helper dispatches to itself. From a member store registering some *other* instance, pass `room: { storeTypeId, instanceId }` explicitly.
84
+ 2. **Client** — call `Poe.open({ placement: "splitView" })` to mount the sub-app alongside the parent. The client-side `room: { kind: "inherit" }` fan-out writes the same `$room_member_instances` row idempotently, so racing the mutator and open is safe.
85
+
86
+ ```typescript
87
+ // Parent mutator (runs on the room store).
88
+ import { addInstanceToRoom } from "joiner-sdk/v1/client.js";
89
+
90
+ launchSubTile: async (ctx, input) => {
91
+ await addInstanceToRoom(ctx, {
92
+ storeTypeId: input.tileTypeId,
93
+ instanceId: input.appInstanceId,
94
+ });
95
+ },
96
+ ```
97
+
98
+ ```typescript
99
+ // Parent client. Mint the instanceId, fire the mutator, open in split view.
100
+ // The sub-app inherits the parent's room (the default), and the
101
+ // `addInstanceToRoom` registration fans the room's `$users` into it +
102
+ // pins its `$$system:room` server-side — so no genesis declaration is
103
+ // needed here. (Reach for `Poe.tiles.prepareNewInstances` only when a fresh
104
+ // store owns its OWN room/roster — see "child room" below.)
105
+ const appInstanceId = generateUUID().slice(0, 8);
106
+ await Promise.all([
107
+ store.mutate.launchSubTile!({ tileTypeId: app.id, appInstanceId }),
108
+ Poe.open({
109
+ typeId: app.id,
110
+ instanceId: appInstanceId,
111
+ placement: "splitView",
112
+ }),
113
+ ]);
114
+
115
+ // Re-open later (any member). The instance already exists.
116
+ Poe.open({ typeId, instanceId, placement: "splitView" });
117
+ ```
118
+
119
+ > **Security:** if you persist the launch as a styled, attributed event (transcript row, activity log, "X started Y" announcement), store only `(tileTypeId, appInstanceId)` plus server-trusted launcher identity and resolve the creator handle / app name at render time from `Poe.tiles.get({ typeId: tileTypeId })`. Persisting client-supplied creator handle / app name lets a member call the mutator directly with spoofed values, then the styled UI renders verified-looking attribution on every viewer's screen.
120
+
121
+ ### Room launches a sub-app into its own child room
122
+
123
+ When the launched app should get a roster of its own instead of inheriting the parent's — e.g. a chat launching a game that only some chat members will join — the launching app does **not** dispatch genesis into the child room itself. Instead, the manager authors the child room's genesis before it opens the launched instance: it builds a `$bootstrapStore` genesis spec (via `buildChildRoomInstances`) that pins each fresh child room's `$$system:room` parent edge and seeds its roster, declares it via `Poe.tiles.prepareNewInstances({ instances })`, then opens the instance. Pass freshly-minted UUID instance ids for the child rooms — never reuse an existing room — so the genesis pins a clean parent edge for each. The parent edge must target a platform-authored `rootGroup` room; arbitrary `self` rooms cannot be used as parent rooms.
124
+
125
+ ### Single-room conflicts
126
+
127
+ `addInstanceToRoom` dispatches `$addTileInstanceToRoom` on the target room store via `ctx.mutateExternal`. The room's authorize refuses the dispatch (`external_access_denied`) when:
128
+
129
+ - The target instance is already a member of a *different* room (`$$system:room` pins to another `memberOf` ref).
130
+ - The target instance is itself a room (`{ type: "self" }` or `{ type: "rootGroup" }` already pinned).
131
+
132
+ The refusal happens **post-commit on the room store**, *not* on the source promise. The platform authorize enforces it; the `createPoeTileTestHarness` default open-door authorize does not, so a harness test will see the row land. `ctx.mutateExternal` is fire-and-forget (it returns `void`, not a promise), so the source mutator's `await store.mutate.launchSubTile!(...)` resolves cleanly even when the dispatch later fails. There is no try/catch recovery on the source path.
133
+
134
+ The single-room invariant means the right defense is upstream: mint a **fresh** `appInstanceId` for every launch (the example above slices a `generateUUID()` for exactly this reason), and never reuse one that already belongs to a foreign room or is itself a room. If you genuinely need to verify post-hoc whether the registration landed, observe the `$room_member_instances` row on the room (the [headless `flat-room` suite](https://github.com/quora-internal/poe2/blob/main/poe-tiles/shared-headless-integration-tests/suites/flat-room.ts) polls for row absence as the canonical signal); a missing row after the dispatch settles is the only client-side surface for the conflict.
135
+
136
+ ### Reacting to a new member instance
137
+
138
+ The room store can run code when a sub-app is registered (seed per-instance state, log a transcript row, send a notification) via the [`onAddTileInstanceToRoom`](./backend-api.md#system-hooks) system hook. Fires only on first registration; idempotent re-registers are suppressed. Register this hook in the room app's `defineClientConfig({ hooks })` as well as `defineBackendConfig({ hooks })` so prepared launches can render the hook-derived state optimistically before the server result arrives.
139
+
140
+ ### Cross-store dispatch carries the room
141
+
142
+ When a member dispatches to another store via `ctx.mutateExternal`, the trusted server stamps `ctx.source.room` on the receiver with the source's resolved room ref (a `{ storeTypeId, instanceId }` pair, server-resolved from the source's `$$system:room`). Use this to authorize / scope writes against the same room without trusting client input. See [synced-store `external-stores.md`](../../synced-store/references/external-stores.md) for full semantics.
143
+
144
+ ### Sharing the room
145
+
146
+ `Poe.room.openInvitePicker()` asks the host to open the Add members invite surface for the calling app instance. The host resolves the caller from trusted RPC context, resolves the caller's canonical room, lets the user add contacts to that room, and keeps share/copy invite links targeted at the calling tile instance. Apps that need the selected users back should use [`Poe.room.pickMembers()`](./client-api.md#poe-room-pickmembers) instead, then validate any resulting app-state writes with `assertRoomMember(ctx, { userId })`.
147
+
148
+ ### Reference: room mode forms
149
+
150
+ Three places talk about rooms, each with its own representation. They are *the same concept* in three forms:
151
+
152
+ | Where | Form | Values |
153
+ |---|---|---|
154
+ | `Poe.open({ room })` (JS) | tagged object, `kind` field | `{ kind: "self" }` · `{ kind: "inherit" }` · `{ kind: "explicit", storeTypeId, instanceId }` |
155
+ | `<poe-tile room="…">` (HTML attr) | bare string + companion attrs | `"self"` · `"inherit"` · `"explicit"` (with `room-type-id` / `room-instance-id`) |
156
+ | `$$system:room` (stored, server-pinned) | tagged object, `type` field | `{ type: "self" }` · `{ type: "rootGroup" }` · `{ type: "memberOf", storeTypeId, instanceId }` |
157
+
158
+ The first two are *intents* set when the instance is first opened. The server resolves the intent and pins one stored state:
159
+
160
+ - `self` stays `self`.
161
+ - `explicit` becomes `{ type: "memberOf", ...givenRef }`.
162
+ - `inherit` resolves to the opener's room — `memberOf` of the opener's foreign room if it has one, otherwise `memberOf` of the opener itself (which is the room). Falls back to `{ type: "self" }` only when the logical parent cannot be a room (e.g. the manager / `disallowedRoomTypeIds`).
163
+
164
+ The pin **cannot change afterwards** — the platform enforces a single-room invariant.
165
+
166
+ See [`Poe.open()` parameters](./client-api.md#poe-open-typeid-instanceid-openprops-anchorsortkey-placement-viewwidth) and [`<poe-tile>` attributes](./client-api.md#attributes) for the wire-level form.
@@ -0,0 +1,55 @@
1
+ # Two-player browser checks
2
+
3
+ For a two-player browser check, use the scaffold's `tests/multiplayer.ts` helpers with `TestServer` from `joiner-sdk/v1/test-utils/playwright.js`. For the `inspect_tile` tool's `script` mode, put the module in `.inspect-scripts/`, which is kept with the tile but never published (not in `.visual-checks/`, which is temporary); its default export receives the ready players with raw Playwright pages. The scaffold's `tests/e2e.test.playwright.ts` shows how to create and start the `TestServer` and get the `server` and `browser` the helper below takes.
4
+
5
+ ## Multiplayer quick path
6
+
7
+ New scaffolds ship `tests/multiplayer.ts`. Use it instead of rebuilding browser
8
+ contexts, membership setup, profile fixtures, and common assertions:
9
+
10
+ ```typescript
11
+ import {
12
+ expectDisabledAndUnchanged,
13
+ expectTileState,
14
+ openTwoUserTile,
15
+ } from "./multiplayer";
16
+
17
+ const sessions = await openTwoUserTile({
18
+ server,
19
+ browser,
20
+ tileTypeId: "my-turn-tile",
21
+ instanceId: "match-1",
22
+ readySelector: '[data-testid="match-status"]',
23
+ contextOptions: { viewport: { width: 390, height: 760 }, colorScheme: "dark" },
24
+ });
25
+
26
+ try {
27
+ await expectTileState({
28
+ frame: sessions.alice.frame,
29
+ selector: '[data-testid="match-status"]',
30
+ state: "alice-turn",
31
+ });
32
+
33
+ await expectDisabledAndUnchanged({
34
+ locator: sessions.bob.frame.locator('[data-cell-index="0"]'),
35
+ attribute: "data-mark",
36
+ value: "empty",
37
+ });
38
+ } finally {
39
+ await sessions.close();
40
+ }
41
+ ```
42
+
43
+ The helper performs the required sequence:
44
+
45
+ 1. Admit both users with `addUserToInstance`, including profile data so
46
+ `$userInfo` contains names and avatars and `onAddUsersV2` fires.
47
+ 2. Open independent browser contexts on that instance, then wait for readiness.
48
+ A readiness condition may require both members; do not wait for it before
49
+ admitting the second player.
50
+
51
+ Using the same `instanceId` is necessary but not sufficient: a second user must
52
+ also be admitted. Do not click a disabled control to prove rejection;
53
+ Playwright waits for it to become actionable and will time out. Assert that it
54
+ is disabled and that its state attribute remains unchanged.
55
+
@@ -0,0 +1,57 @@
1
+ # Game UX Best Practices
2
+
3
+ Conventions for games built on Joiner. Apply these unless the app's design has a specific reason to deviate.
4
+
5
+ - **Teach in context — don't gate the first session on a manual.** Players land in a tile cold (For You feed, a push, a shared link) with no setup screen and no patience for a wall of rules. Make each screen, phase, and state self-explanatory: right where the relevant control is, say what is happening now, what the player should do next, and what they are trying to achieve — short contextual lines like "Pick a card to beat the 7" or "Tap a square to claim it", revealed progressively as the game advances rather than all at once. A first-time player should be able to make their next move from the screen alone, without opening anything.
6
+ - **Keep a `?` "How to play" backstop in the top-right corner** — the full rules, controls, and win condition, openable anytime without leaving the tile. This is the reference a player *chooses* to open for detail; it complements but does not replace teaching in context (above), and must never be a prerequisite to start playing.
7
+ - **Default to no auto-opening first-time walkthrough; decide case by case.** First rely on in-context teaching and the opt-in rules backstop above. Add a walkthrough only when the tile has an unfamiliar goal, multiple concepts or phases, a hidden twist, or a long/costly first attempt that the first actionable screen cannot explain clearly. Skip it when rounds are quick and restartable, the mechanic and rules are simple or familiar, and a player can learn safely within seconds by doing. Poe Jump is the negative reference: its short rounds and immediately legible single mechanic do not justify an intro carousel. There is **no cross-instance per-user memory** for a tile. A `privateOfUser` synced-store row is scoped to `(instance, user)`, so it can suppress the walkthrough on later opens of that same instance and carry the preference across devices, but a different instance starts with no seen bit and would show it again. Do not describe this as “once per player”; treat repetition across new instances as a product cost that strongly weighs against adding an auto-opened walkthrough to ephemeral or frequently recreated tiles. Do not use `localStorage`, `sessionStorage`, or `IndexedDB` as a workaround; the blob-iframe sandbox blocks them.
8
+
9
+ If the tile-specific decision is to add a walkthrough (or the user explicitly requests one), make it a tight, skippable 2–4 step carousel: one idea per step, a hero visual drawn from the tile's own art, progress dots, Back/Next/Got it, and an X to close — not a scrolling rules wall. Auto-open it at the first relevant actionable moment, make it dismissible at any step, persist dismissal per `(instance, user)`, and keep the same content re-openable behind the `?` backstop. **Make it swipeable** because progress dots plus a card read as a swipeable carousel on a phone: use pointer events so touch and mouse-drag share one path, set `touch-action: pan-y`, move only when the gesture clears a small threshold (~45px) and is more horizontal than vertical, and do not dismiss by swiping past the final step.
10
+
11
+ - **Show the other players — faces, not just names.** In any multi-player game, render the avatars of the people the user is playing with *and against* where the action is: at the table, on the board, beside each move, score row, and turn indicator, and on the end-of-game screen. Seeing real faces is what makes a session feel like playing *with people* rather than against software. Read names/avatars from `$userInfo` (see [getting-user-info-of-members.md](../../synced-store/references/getting-user-info-of-members.md#rendering-co-player-avatars)), and design for the user who hasn't set a photo (initials fallback), never a broken image.
12
+ - **Let players invite and add others from inside the game.** When a game needs more players — to fill a seat, pick an opponent, or start a match — put a visible "Invite" / "Add player" control in the game itself (typically on the start/lobby screen, or right on an empty seat), opening the host people picker (`Poe.room.pickMembers()`). When an empty seat or slot visually offers the invitation (for example, a slot card with a `+`), make the whole slot one accessible tap target so the icon, label, and surrounding card all open the picker; don't wire only a smaller nested "Invite player" button. Don't make players leave the game and hunt through the surrounding platform chrome to add someone — the game often renders where that chrome isn't visible (the For You feed, a fresh instance).
13
+ - **Set up async, offline play — seat players who aren't here yet.** A player can be added and assigned a seat, side, or turn while offline; the game is then ready for them when they return. Prefer letting someone set up a turn-based match up front (assign the opponent's seat, make the first move, pass the turn) over requiring both players to be online at the same moment to start. Pair this with a "your turn" push (`setTurn`) so the absent player is pulled back in.
14
+ - **Show whose turn it is prominently** in multi-player turn-based games — display name + avatar of the active player, near the top of the screen. Don't make players hunt for it.
15
+ - **Make the waiting state explicit — a waiting screen must never look like a frozen one.** When it's not the player's turn, or they're otherwise blocked (waiting on an opponent's move, on others to ready up, on a round to start), say so on screen: "Waiting for Aaron to play…" with that player's avatar and a subtle animation (pulsing dots, a shimmer) so it reads as *waiting*, not *broken*. A waiting player and a hung app look identical unless you distinguish them — so always do. This is the in-tile complement to `setTurn`, which drives the manager's "Your Turn" indicator and the push for whoever is *up*; here you reassure whoever is *waiting*.
16
+ - <a id="stalled-turns"></a>**Keep a stalled turn from blocking the game forever, and try a nudge before escalation when it fits.** Before implementation, ask whether inactivity should block indefinitely, offer only a reminder, or eventually allow skip/default action/forfeit/removal. Choose the initial nudge delay from the game's cadence: synchronous party games may wait seconds, while asynchronous games may wait hours. A nudge is a targeted, context-rich push to the blocking player; show confirmation to the sender, attach no entry overlay, and enforce a server-enforced resend cooldown so multiple waiting players cannot spam the target. If escalation exists, require a grace period after the first nudge before revealing the control; repeated nudges may update `lastNudgedAt` but must not reset `firstNudgedAt`. Persist turn identity, turn start, and nudge state in shared data; validate the deadline, caller eligibility, and still-current turn server-authoritatively, including target membership and concurrent calls. Reset the state only when the authoritative turn advances, not when a client opens or refreshes.
17
+ - <a id="player-leaves"></a>**Handle actual player removal without confusing it with temporary absence.** Closing the tile or losing the connection is not leaving; preserve the player's seat and resumable state. React only to explicit room-membership removal in `onRemoveUser`, and decide the policy before defining the schema. In a lobby, normally vacate the seat. After a match ends, do not keep the leaver seated on the result screen or offer a rematch against them; reopen seating so remaining and newly joined members can start the next match. During play, remove the player and continue only when the rules stay fair after atomically repairing the active turn, teams, owned pieces/cards, nudge state, and win conditions. If removal would invalidate the match or a safe repair is ambiguous, persist a visible resolution state and let the remaining players choose a new match or a game-specific alternative such as replacement, forfeit, or abandonment — never silently choose an outcome. Make the hook idempotent and safe under simultaneous removals; never strand the turn on an inactive member.
18
+ - **Make the primary action obvious.** At any moment there should be one clear thing the player can do next (tap to roll, drag to place, pick a card). If you can't point at it in one sentence, the UI is too ambiguous.
19
+ - **Prefer dragging pieces over click-then-click controls.** For pieces, cards, tokens, or tiles that move between positions, make direct drag-and-drop the primary touch / pointer interaction; do not make clicking/tapping the piece and then its destination the default. Keep tap-to-select then tap-destination and keyboard controls as accessible fallbacks. During the drag, lift or track the piece, highlight legal destinations, and snap it back with feedback after an invalid drop. Use Pointer Events so one path covers touch and mouse.
20
+ - <a id="edge-gestures"></a>**Keep gesture starts and controls out of the side-edge bands; the platform owns them.** In both native apps an inward swipe that starts at a side edge navigates back, so a swipe that begins there leaves the tile instead of moving the piece. In the Android app the band is roughly 24 px on either side, wider when the user raises the back-sensitivity setting, and the OS consumes the swipe before the page sees any touch, so `touch-action: none` and `preventDefault()` cannot stop it. In the iOS app the WebView's history swipe starts at the left edge, and at the right edge when there is forward history. Desktop previews never reproduce it, so a swipe mechanic that feels fine there can still fail on a phone; an Android phone browser with gesture navigation is the cheapest repro. The play surface still draws edge to edge; what changes is where input is expected to begin. Never require a stroke to start in the band (one that starts further in and crosses it is fine), and keep tappable controls at least 24 px plus `--poe-safe-area-inset-left`/`-right` from either side edge by insetting the control row, not the canvas. A game that accepts a horizontal swipe anywhere on screen (lane changers, match-swipers) is the at-risk class: prefer taps, vertical swipes, or a swipe zone inset from both sides. This is a mitigation, not a fix: a fast swipe from the bezel still triggers back, and the platform offers no way for a tile to disable the gesture.
21
+ - <a id="timed-input"></a>**Judge a timed tap by when the finger landed, and reject a stale event stamp.** A rhythm, reaction, or timing-judged game compares each press and release with a target time. `event.timeStamp` is the right source: it records when the touch happened, while `performance.now()` in the handler is later by the delivery delay (10–30 ms on an iPhone, which delivers touches once per display frame, and more when the main thread is busy). Never judge from the time of a later animation frame. But iOS WebKit sometimes gives a touch the stamp of a different finger: while one finger is held, a new finger's `pointerdown`, `touchstart`, `pointerup`, and `touchend` can all carry the held finger's old stamp, hundreds of milliseconds to seconds early, on about half of the taps and at random (measured on iOS 26.2 in 2026-11; worst in the native apps, and Safari does it on releases). `touchstart` carries the same wrong stamp, so it is no workaround. Two-thumb play and hold notes always have a finger held, so a game that trusts the stamp misjudges those taps as early, and they read as dropped. Use the stamp only when it is recent, and the handler time otherwise, for releases too:
22
+
23
+ ```ts
24
+ /** A fresh touch stamp is 10–30 ms old; a stale one is far older. */
25
+ const STALE_EVENT_MS = 50;
26
+
27
+ function inputTime(event: Event): number {
28
+ const now = performance.now();
29
+ const stamp = event.timeStamp;
30
+ return stamp > 0 && stamp <= now && now - stamp <= STALE_EVENT_MS ? stamp : now;
31
+ }
32
+ ```
33
+
34
+ Do not widen the window to hundreds of milliseconds to keep more stamps: a stale stamp inside the window still moves the tap early by up to that much.
35
+ - **Highlight tappable inputs.** When only a subset of elements are interactive at a given moment (e.g. in a card game where only some cards are legally playable), visually distinguish them — glow, border, opacity, scale. Non-interactive elements should look non-interactive. Players shouldn't have to tap to discover what's allowed.
36
+ - **Give immediate feedback on every input** — visual state change, haptic (`Poe.haptics.impact("light")` / `Poe.haptics.selection()` for ticks, `Poe.haptics.notification("success"|"error")` for outcomes — see [client-api.md](./client-api.md#poe-haptics)), or sound. Never let a tap feel like it did nothing, even if the move is illegal (show *why* it was rejected).
37
+ - **At the moments the player earns or loses something, that choice becomes a requirement to combine channels.** Ordinary input acknowledgement can pick any one of the three above. Scoring, failing, and completing a round need a sound **and** at least one of the others: haptics do not exist on desktop and are off on a phone with the switch flipped, and a visual flourish is easy to miss when the player is looking elsewhere on the board. Give distinct outcomes distinct cues — a score and a crash must not be the same cue at a different pitch. Where a `generate_sound_effect` tool is available, generate every cue with it instead of synthesizing tones with Web Audio oscillators (read the `audio-generation` skill first); otherwise reuse the generated cues the tile already has (`assets/sfx-*.mp3`, loaded as the `audio-generation` skill describes) and synthesize only the missing cues with Web Audio. Vary the pitch slightly across repeats so a long run does not become a metronome, and never loop background music by default. Create or resume the context from a real user gesture and call `resumeAudioContext(context)` from `joiner-sdk/v1/client.js` before scheduling on a reused context — WebKit parks a context in the non-standard `"interrupted"` state after an alarm or call, so checking only for `"suspended"` leaves the tile silent until it is reopened. On an iPhone the platform keeps a running context audible when the silent switch is on, which also pauses the player's music, so suspend the context while the tile is muted or has nothing to play. Offer a mute control and persist the choice. Sound reinforces; it must never be the only carrier of information.
38
+ - <a id="cue-level-and-the-core-loop"></a>**Choose the peak level deliberately, and give the core loop an escalating cue.** You cannot hear your own tile, so both of these are decisions to make in code rather than checks to make by ear. A cue peaking below roughly a tenth of full scale vanishes under ambient noise on a phone speaker, which makes it decoration rather than feedback; pick a level that carries, keep the loudest cue short enough not to startle, and hold it in a named constant instead of scattering literals so it can be reviewed and retuned in one place. Separately: **if the tile has one action the player repeats as its core loop** — a drop, a stack, a shot, a match — then succeeding at that action earns its own cue, and a *run* of successes must sound different from a single one, escalating through added layers, added harmony, or a small rise in pitch. A game built on repetition is carried by the sound acknowledging the streak, not merely the event; a single flat blip per success leaves the reward loop silent at exactly the moment it should be most satisfying. If the tile has no such repeated action, skip this part.
39
+ - <a id="show-the-change-where-it-happens"></a>**Show a change to the score where the action happened, not only in the HUD.** A player mid-action is looking at their hands and at the thing they just hit, not at a counter in a corner, so a number that only ticks in the HUD is invisible at the exact moment it was earned. When an accepted action changes a score, a streak, a life count, or a clock the player is playing for, spawn the *delta* at the point of contact — `+1`, `+12`, `x3` — hold it for a readable beat, and let it leave on its own. When a streak or a multiplier is what made the delta large, the delta must show that it was multiplied rather than only its total, or the player learns nothing about why this hit paid more than the last one. Keep these transient and non-interactive (`pointer-events: none`) so they never swallow a tap, cap how many can exist at once with a named constant so a long run cannot flood the frame, and honour `prefers-reduced-motion` by holding the number still instead of animating it.
40
+ - <a id="acted-on-objects-need-two-states"></a>**Every object the player acts on needs a before and an after that differ in more than position.** The player-character rule covers the thing the player *controls*; this covers the things the player *hits*. An object that simply disappears on contact reads as a bug rather than as a hit: the player cannot tell a successful slice, capture, or destruction from an object that fell off the screen, or from their own input being dropped. Give the successful action a visible consequence that inherits the motion which caused it — halves that separate along the stroke, debris that keeps the object's velocity, a burst at the contact point — and give the failed or ignored case its own distinct visual so the two can never be confused. Choose the count, lifetime, and travel from named constants.
41
+ - **Enact physical actions; don't teleport to results.** If the UI represents a die rolling, coin flipping, deck shuffling/dealing/drawing, spinner spinning, piece moving, or projectile being thrown, animate that action before the final state appears. Animation is presentation, not authority: determine and persist the result first (server-authoritatively for shared state), then animate toward that known result; never use separate visual RNG. Keep the sequence brisk, prevent duplicate action while it plays, add matching haptic/sound feedback when appropriate, and honor reduced motion with a shortened transition that preserves cause and effect.
42
+ - <a id="difficulty-and-fairness"></a>**Derive difficulty and fairness from the movement rules instead of guessing at them.** Generate the challenge — obstacle gaps, spawn positions, hazard timing, target placement — fresh per run from a seed you persist so a run stays reproducible. The two failure modes are opposites and both read as broken: one hard-coded repeating sequence turns a skill game into a memorization drill, while re-randomizing each element independently across its full range produces stretches the player physically cannot clear. Bound the step between consecutive elements by what the player can actually traverse in the distance available, computed from the movement constants you already chose (gravity and flap impulse, speed and turn rate, cooldowns) rather than eyeballed. Give the opening a forgiving first challenge, then ramp — tighten spacing, raise speed, add hazards as the score climbs — and stop the ramp at a floor so late play stays a test of skill rather than a coin flip. Aim for a first-time player scoring within a few attempts and a practiced player reaching a satisfying run, then play both ends yourself and retune: unscoreable and unmissable are both failures. Award a point once per obstacle and only after the player has **fully** cleared it, never at its midpoint. Drive simulation from a fixed or clamped timestep so identical inputs produce an identical run on a 30 Hz and a 120 Hz display; never scale movement by an unbounded raw frame delta (this is the correctness counterpart to the battery guidance in [client-api.md](./client-api.md#render-budget)).
43
+ - **Make the end-of-tile overlay the conclusion, not the reveal.** Before implementing a terminal path, explicitly plan the reveal: what will show why the player won or lost, which animation/visual marker/copy/feedback will communicate it, and when the host overlay may safely cover the playfield. On a loss, disable further input but keep the decisive state visible; finish the collision, capture, timer-expiry, missed-target, or other terminal animation; add cause-specific copy when the visuals are not self-explanatory; then hold the result for a readable beat (typically about 800–1500 ms) before calling `Poe.room.tileEnd()`. Sequence the call from animation completion plus the readable hold instead of starting a blind timer in parallel with the animation. Under `prefers-reduced-motion`, shorten or skip movement but keep the visual explanation and pause. Make the transition cancelable and exactly-once across unmounts, restarts, and repeated reactive updates.
44
+ - **Reach a terminal state cleanly — use the platform end-of-tile overlay.** Wins, losses, draws, and final scores need an unmistakable end screen with a "play again" affordance — don't just freeze the board, and don't hand-roll the screen. Report the result through `Poe.room.tileEnd()` and let the host render its end-of-tile overlay: every active player ranked by result with avatar + name (so it *is* your leaderboard for scored games), plus Play Again and pick-another-tile. See [client-api.md](./client-api.md#poe-room-tileend-input).
45
+ - **Make the competition present *during* play, not just at the end — for scored / leaderboard games.** A leaderboard shown only on the end screen makes a scored game feel single-player until it's over. Casual leaderboard games are usually played solo, so the social charge has to come from feeling *who* you're racing as you go — bring other players' scores into the live run and give the player a jolt the instant they pull ahead. Pick the lightest mechanic that fits the game:
46
+ - **Live rank / "score to beat" HUD** — a small, non-interactive overlay (`pointer-events: none` so taps fall through to the game) showing the current top few scores with names + avatars, or the player's live rank ("3rd of 8"), updating reactively as their score climbs and as others post new scores. **No scores means no leaderboard HUD:** when the board has zero real entries, do not render empty-state copy ("Set the first record", "No scores yet"), placeholder rows, a leaderboard heading, or an empty panel. Collapse the region so gameplay reclaims the space, and reveal the real top scores reactively when the first result arrives. (This is how Poe Jump shows a top-3 board during play.)
47
+ - **Pace marker** — for time/distance runs, show a live "+4.2m ahead / −1.1m behind" delta (green ahead, red behind) against a reference run — the current leader's, or the player's own best — sampled at the same elapsed time. (This is how Top-Down Racer races you against the best stored run.)
48
+ - **Ghost** — replay another player's recorded run on-screen as a visual competitor moving in parallel, labeled with their name + avatar. (Flappy Crossing's ghosts.) Record the run as a **bounded, downsampled** trace and cap it with an explicit named limit constant — never persist an unbounded per-frame trace (Flappy Crossing caps a run at 200 hops; Top-Down Racer at 1200 samples). The leaderboard / best-score rows and any ghost traces are ordinary shared-instance synced-store data, so the live layer keeps working offline and replays from the local cache.
49
+ - **Celebrate the overtake in the moment.** When the live score crosses a stored opponent's score, fire a brief positive beat *right then* — `Poe.haptics.notification("success")` (see [client-api.md](./client-api.md#poe-haptics)), a transient banner with the passed player's name + avatar ("Passed Aaron! 🎉"), and/or a sound. This in-the-moment payoff is the whole point; don't make the player wait for the end screen to learn they pulled ahead.
50
+ - **Tell the person you passed.** When a finished run beats another player's stored best, send *them* a targeted high-signal push with `notifyActivity({ targetUserIds: [overtakenUserId], push })` ("Aaron just beat your high score!"), and reserve `postToChat` for a true milestone (a new #1). Default sender-suppression means you never notify yourself. (Both Flappy Crossing and Poe Jump do this.)
51
+ - **Keep the live layer meaningful when the player is first or alone.** Race the player's own personal-best ghost or a deliberately seeded stock ghost when that reference run exists. On a genuinely new board with no score or trace, let the primary gameplay stand alone until the first result rather than fabricating a text-only competition state. Read identities/avatars from `$userInfo` and degrade to initials, never a broken image (the "Show the other players" convention above, applied to a mostly-solo game).
52
+
53
+ This is the in-play complement to the end-of-tile overlay (above): keep reporting the terminal result through `Poe.room.tileEnd()` for the authoritative ranked end screen — the live layer adds presence *during* the run, it does not replace the end screen.
54
+ - <a id="resuming-play"></a>**Persist enough state to resume by default, including solo play.** Navigating away, closing the tile, reloading, or returning via a notification must restore the ongoing match/run in the same instance, not restart it or require the player to join again. Persist the phase, board/progress, score, player identity/seat, and active run or turn identity in synced-store as applicable; scope personal progress to the user within the instance. Save at meaningful state transitions, not only on unload, which may never fire. For real-time play, use bounded checkpoints rather than per-frame writes. Restore from durable state after bootstrap; initialization must not overwrite an existing session, and completed sessions must remain completed until an explicit replay/reset. Do not use `localStorage`, `sessionStorage`, or `IndexedDB` inside the tile; the sandbox blocks them.
55
+ - **Restore the correct state, not a stale snapshot.** Shared play may advance while a player is away: show the current authoritative board/turn/result when they return. Persist deadlines for real-time timers so reopening cannot grant extra time; for pausable solo play, persist remaining time or simulation progress and resume from a safe checkpoint. Keep committed attempts authoritative as below — recovery is not an undo mechanism.
56
+ - **Make committed attempts authoritative in scored or competitive play.** Define the commitment boundary explicitly (for example, releasing a shot or jump), persist an in-flight marker at that boundary, and clear it atomically only when a successful checkpoint is recorded. Persist a miss or terminal result as soon as it is detected; delay only animation and the host end overlay. On reopen, resume from a neutral checkpoint, but resolve a still-committed attempt conservatively as consumed rather than turning navigation into undo. Make terminal mutations idempotent.
57
+ - **Replay the opponent's last turn on open — for turn-based games.** When a player opens a turn-based game and it's now their turn (whether from a "your turn" push or from the surrounding platform chrome), don't just render the resumed board statically — first briefly show *what the opponent just did* so the player has the context to decide their move. Re-animate or highlight the last move (the piece that moved and where, the card played, the tiles placed, the score change), then hand control to the player. The player was away when it happened; the notification text ("Aaron moved knight to f3") sets expectation, but the move itself must be legible *in the game* — a player forced to reverse-engineer what changed from a static board is a player who'll misread the state. Keep it short (a single beat, ~600–1200 ms), make it skippable/tappable-through for players who already know, and under `prefers-reduced-motion` use a static highlight of the changed elements instead of movement. To land the player on the right screen for this, attach entry context to the push (see [client-api.md](./client-api.md) `push.context`); persist enough turn history to reconstruct the last move (the resume state above), not just the current position.
@@ -0,0 +1,79 @@
1
+ # Migrating a pre-rename app
2
+
3
+ The platform was renamed from "app platform" to **Poe Tiles**. Apps scaffolded
4
+ before the rename hit a cluster of breakages that look unrelated but share one
5
+ cause. Work through this checklist top to bottom — each item is something an
6
+ old scaffold discovers by failure otherwise.
7
+
8
+ ## 1. Upgrade the CLI first
9
+
10
+ Old CLI builds talk to retired hosts and removed subcommands. Self-upgrade
11
+ still works (the legacy docs host 301-redirects the upgrade manifest):
12
+
13
+ ```bash
14
+ poe-tiles upgrade
15
+ poe-tiles install-joiner
16
+ ```
17
+
18
+ An old CLI has no `joiner` command. Use `poe-tiles` until `install-joiner` adds it.
19
+
20
+ If the old binary can't even self-upgrade, reinstall from the
21
+ [current install snippet](cli.md#installing-from-a-published-tarball).
22
+
23
+ ## 2. `poe-tiles apps …` → `joiner tiles …`
24
+
25
+ The `apps` subcommand family was renamed to `tiles` (`joiner tiles upload`,
26
+ `tiles list`, `tiles init`, …). Any script or muscle memory using
27
+ `poe-tiles apps publish` now fails with an unknown-command error. (Within the
28
+ `tiles` family, `publish` was later renamed to `upload` — that older spelling
29
+ still works as an alias.)
30
+
31
+ ## 3. `publish-to-app-platform` → `publish-to-poe-tiles` script
32
+
33
+ Old scaffolds have this in `package.json`:
34
+
35
+ ```json
36
+ "publish-to-app-platform": "bun run build && poe-tiles apps publish"
37
+ ```
38
+
39
+ Replace it with the current form:
40
+
41
+ ```json
42
+ "publish-to-poe-tiles": "bun run build && poe-tiles tiles upload"
43
+ ```
44
+
45
+ ## 4. `poeApp()` → `poeTile()` in `vite.config.ts`
46
+
47
+ The Vite plugin was renamed; the `poeApp` compatibility alias has been
48
+ removed, so old configs fail at build time with an import error. Update:
49
+
50
+ ```ts
51
+ // Before
52
+ import { poeApp } from "poe-tiles-sdk/vite";
53
+ export default defineConfig({ plugins: [poeApp()] });
54
+
55
+ // After
56
+ import { poeTile } from "poe-tiles-sdk/vite";
57
+ export default defineConfig({ plugins: [poeTile()] });
58
+ ```
59
+
60
+ A pre-rename tile keeps its `poe-tiles-sdk` dependency key, so its imports
61
+ stay `poe-tiles-sdk/...`. Do not add a `joiner-sdk` key next to it.
62
+
63
+ (Related renames if you referenced them: `PoeAppPluginOptions` →
64
+ `PoeTilePluginOptions`, `POE_APP_EXTERNALS` → `POE_TILE_EXTERNALS`.)
65
+
66
+ ## 5. Upgrade the app's SDK pin
67
+
68
+ The renames above ship in newer SDK tarballs, and an old pin will keep
69
+ resurfacing them (plus miss newer APIs). See
70
+ [Upgrading an existing app's SDK](cli.md#upgrading-the-sdk-in-an-existing-app).
71
+
72
+ ## 6. Build and publish
73
+
74
+ ```bash
75
+ bun run build && bun run publish-to-poe-tiles
76
+ ```
77
+
78
+ A clean build and publish means the migration is complete. If something still
79
+ fails, check the [troubleshooting page](troubleshooting.md).
@@ -0,0 +1,205 @@
1
+ # Compact multiplayer API recipe
2
+
3
+ Use this shared path for React, Preact, SolidJS, Vanilla JS, and Phaser tiles.
4
+ The schema, mutators, hooks, and host APIs are framework-independent;
5
+ only the UI subscription adapter changes.
6
+
7
+ Use these documented shapes with the scaffold's SDK pin. Inspect declarations
8
+ only for a missing capability, blocking ambiguity or concrete type/runtime
9
+ discrepancy. Preserve the active workflow's feature requirements.
10
+ For new schemas, use the [schema and bindings example](../../synced-store/references/schema-and-bindings.md).
11
+
12
+ Sections: [client](#1-create-one-client), [membership](#2-model-people-and-seats),
13
+ [assignment](#3-add-or-assign-a-player), [turns and results](#4-commit-a-turn),
14
+ [UI binding](#5-bind-the-shared-reader-to-the-scaffold).
15
+
16
+ ## 1. Create one client
17
+
18
+ In the tile entry point, create `Poe` once, call `Poe.setupStore(clientConfig)`
19
+ once, show a loading state while `store.waitForBootstrap()` resolves, and pass
20
+ `store` into the UI. Pass the real `Poe` object too when the UI opens host
21
+ surfaces such as `Poe.room.pickMembers()` or `Poe.users.openProfile()`.
22
+
23
+ Keep app state in synced-store. Use component or scene state only for disposable
24
+ presentation details such as hover, animation progress, and an open menu.
25
+ The tile iframe cannot use browser storage (`localStorage`,
26
+ `sessionStorage`, IndexedDB or cookies); synced-store owns durable storage
27
+ outside the iframe. Never reset saved progress when mounting the UI.
28
+
29
+ ## 2. Model people and seats
30
+
31
+ - Read active membership from `$users`, filtering for `removedAt === undefined`
32
+ because removed members retain tombstone rows. App-owned seats may outlive
33
+ membership; do not count retained seats as active members. Never write system
34
+ tables.
35
+ - Read names and avatars from `$userInfo`; never display a raw user ID.
36
+ - Store seats, teams, roles, turn order, phase, and board state in app-owned
37
+ tables.
38
+ - Auto-seat newly admitted members with deterministic `onAddUsersV2` logic,
39
+ wired into both `client-config.ts` and `backend-config.ts`.
40
+ - `onAddUsersV2(ctx, { users })` runs once per batch with every member it
41
+ admitted, in admission order; a genesis roster arrives as one call. Each
42
+ entry has `userId` and optional `addedBatchUserIds`, the invitation context
43
+ for the operation, which is not stored on `$users`. Repeated admission must
44
+ not reset the round or duplicate seats. The older `onAddUsers` (one call per
45
+ user) is deprecated; a tile defines one or the other, never both.
46
+ - Ordinary offline presence does not remove membership or free a seat.
47
+ `onRemoveUser(ctx, { userId })` must repair or pause unfinished play and
48
+ clear obsolete turns, with an authorized recovery path.
49
+ - Decide public, per-user-private, and server-only visibility before writing the
50
+ schema. Do not hide public data with UI filtering.
51
+
52
+ Keep the SDK's optional profile fields rather than redeclaring them as required:
53
+
54
+ ```ts
55
+ import { type PoeUserInfo, usableDisplayName } from "joiner-sdk/v1/shared.js";
56
+
57
+ function playerLabel(profile: PoeUserInfo | undefined) {
58
+ return usableDisplayName(profile) || "Player";
59
+ }
60
+ ```
61
+
62
+ Render an avatar fallback when `profile?.profilePicture` is absent. For shared
63
+ hooks, use `InferSystemHooks<AppSchema>` from `joiner-sdk/v1/client.js`, as in
64
+ the scaffold; its `ctx` knows both app and system tables without casts.
65
+
66
+ ## 3. Add or assign a player
67
+
68
+ Open the host picker from a visible in-tile button or empty-seat button:
69
+
70
+ ```ts
71
+ const picked = await Poe.room.pickMembers({
72
+ title: "Choose player",
73
+ selection: { max: 1 },
74
+ excludeUserIds: [currentUserId],
75
+ playingUserIds: seatedUserIds,
76
+ });
77
+ const user = picked?.users[0];
78
+ if (user) {
79
+ await store.mutate.assignSeat({
80
+ seatId,
81
+ userId: user.userId,
82
+ now: Date.now(),
83
+ });
84
+ }
85
+ ```
86
+
87
+ Treat the picker result as UI input. In `assignSeat`, call
88
+ `assertRoomMember(ctx, { userId: input.userId })`, re-check that the seat is
89
+ available, write the assignment, and call `notifyUsersAddedToTile` when the user
90
+ was assigned or added. Expected conflicts such as a seat already being taken
91
+ should early-return or write visible status; do not throw a background error.
92
+
93
+ Also validate the authenticated actor, role and expected round before assignment.
94
+ `assertRoomMember` checks this tile's own `$users`. `Poe.room.pickMembers()`
95
+ resolves only once that roster lists everyone it added, so seat a picked user
96
+ right after it resolves; they do not need to have opened the tile.
97
+ Import these helpers from `joiner-sdk/v1/client.js`:
98
+
99
+ ```ts
100
+ await notifyUsersAddedToTile(ctx, {
101
+ targetUserIds: [input.userId],
102
+ appName,
103
+ reason: "assigned",
104
+ previewTimestamp: input.now,
105
+ });
106
+ ```
107
+
108
+ That call notifies the selected participant; membership admission remains
109
+ host-owned. Preserve the assignment while waiting for them to join.
110
+
111
+ ## 4. Commit a turn
112
+
113
+ Put validation and the authoritative state transition in one mutator. Generate
114
+ IDs and timestamps at the UI call site, pass explicit next values rather than
115
+ toggle instructions, and read before merging a row.
116
+
117
+ After an accepted move:
118
+
119
+ - Call `setTurn(ctx, { userIds: [nextUserId], push: { body } })` for the next
120
+ player. It already updates their turn marker, unread count, Activity tab order, and
121
+ optional push.
122
+ - Finish a round with `completeRound` below; it clears all turn markers.
123
+ - Every meaningful accepted shared action needs the actor's Activity tab bump:
124
+ add the actor-only call below with first-person copy. Reuse a shared
125
+ `notifyActivity` fan-out that includes the actor only when its preview names
126
+ no human actor. `setTurn` for the next player does not bump the actor.
127
+ Do not duplicate the next player's unread/push merely for discoverability.
128
+ - Emit activity at semantic boundaries, never for every pointer or animation
129
+ frame.
130
+
131
+ Subscriptions may fire for the optimistic write and again after confirmation.
132
+ Render from the latest snapshot and deduplicate sounds, animation, and toasts by
133
+ event ID or previous state.
134
+
135
+ Import `notifyActivity`, `setTurn` and `completeRound`
136
+ from `joiner-sdk/v1/client.js`. For an actor-only update, write the preview
137
+ in the first person; other members get the display name in their own call:
138
+
139
+ ```ts
140
+ await notifyActivity(ctx, {
141
+ preview: `You ${actionText}`, previewTimestamp: input.now,
142
+ targetUserIds: [ctx.userId], recency: "bump",
143
+ });
144
+ ```
145
+
146
+ On the single accepted terminal transition, call the SDK completion helper in
147
+ the same mutator as the final move:
148
+
149
+ ```ts
150
+ await completeRound(ctx, {
151
+ board: {
152
+ leaderboardId, players: scoresByUserId, bestScore: "highest",
153
+ label, unit: { singular: "point", plural: "points" },
154
+ },
155
+ participantUserIds: participantIds,
156
+ outcomeText, eventId: input.eventId, now: input.now,
157
+ });
158
+ ```
159
+
160
+ This overwrites the complete current-round board, clears turns, and sends one
161
+ completion activity/push/chat fan-out including the actor. Derive outcome, scores
162
+ and participants from validated state. Retain the SDK's sender suppression and
163
+ unread defaults. Guard the terminal transition: reusing a message ID alone does
164
+ not deduplicate chat. `players` is a complete `Record<string, number>`, including
165
+ non-winners. `outcomeText` is one string for every participant, actor included, so keep it free of a named actor ("Round over: 12–9", "Blue team wins") rather than "Aaron won"; for per-reader copy, compose `setLeaderboard(ctx, board, { mode: "overwrite" })`, `clearTurn(ctx, { all: true })`, and split `notifyActivity` calls instead (keep `push` and `postToChat` on the other-members call only). For cumulative boards, compose `setLeaderboard`/`setLeaderboardScore`
166
+ with `merge` or `replace`, `clearTurn`, and `notifyActivity` instead.
167
+
168
+ Use [`createNativeResults`](native-results.md) for native presentation rather
169
+ than reimplementing its lifecycle. `createNativeResults` requires SDK 34;
170
+ `completeRound` requires SDK 31. Production Vite builds infer these minima
171
+ from their imports. Set `poeTile({ minSdkVersion: 34 })` when using both helpers
172
+ for development or older build tooling; keep any higher existing requirement.
173
+ The controller consumes every live finished-round snapshot (or `null` while
174
+ unfinished), handles scheduling, shared-restart dismissal, stale responses,
175
+ and explicit retries. Render a readable in-game outcome before updating it;
176
+ clear error UI on `onErrorChange(null)` and dispose on unmount.
177
+ The game owns authorization, terminal guards, and expected-round restart.
178
+ Round IDs tag overlays; they do not partition leaderboard storage.
179
+
180
+ ## 5. Bind the shared reader to the scaffold
181
+
182
+ Keep reusable readers at module scope and type them with `AppReadContext`.
183
+
184
+ | Scaffold | Adapter |
185
+ | --- | --- |
186
+ | React | `useLiveQuery(store, readState)`; keep the reader reference stable. |
187
+ | Preact | `useEffect(() => store.subscribe(readState, setState), [store])`; returning the unsubscribe function handles cleanup. |
188
+ | SolidJS | `createLiveQueryResource(() => props.store, () => readState)` for query-shaped state. Use `subscribeToTable` plus `onCleanup` when table diffs drive keyed animation. |
189
+ | Vanilla JS | Subscribe once in `mountApp`, update existing DOM nodes from each snapshot, and retain the unsubscribe function if the mount can be destroyed. |
190
+ | Phaser | Let the DOM shell own subscriptions and the latest snapshot. Dynamically import the Phaser scene, pass `getSnapshot()` and semantic callbacks into it, and render snapshot changes into scene objects. Never mutate synced-store from `update()` or another per-frame loop. |
191
+
192
+ React's adapter imports from `joiner-sdk/v1/react` and returns
193
+ `{ data, isLoading, error }`; `error` holds what a throwing query threw. Data is
194
+ undefined while loading; keep bootstrap/loading
195
+ in an outer component and pass required, narrowed data into a ready view when
196
+ async handlers would otherwise lose that narrowing. Keep hook ordering stable.
197
+ Profile actions use `await Poe.users.openProfile({ userId })`; handle failures.
198
+
199
+ A mutation's `.confirmed` means processing finished, not proof the action was
200
+ accepted. Render authoritative subscribed state. Preserve SDK error handling;
201
+ use `onFailedMutation` when app-specific pending state needs repair, rather
202
+ than creating a duplicate background-error toast.
203
+
204
+ React, Preact, and SolidJS scaffolds include Tailwind. Vanilla JS and Phaser use
205
+ plain CSS unless Tailwind is explicitly configured.