@joiner-platform/cli 0.0.0-stage → 0.1.0

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 +148 -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 +196 -0
  152. package/skills/tile-creator/references/assets.md +124 -0
  153. package/skills/tile-creator/references/backend-api.md +308 -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,43 @@
1
+ # Turn-based mutator recipe
2
+
3
+ Use this recipe for a sequential turn-based tile. Adapt the table and field names to the tile, but keep the SDK import and call placement.
4
+
5
+ ## Pass or clear the turn from the mutator
6
+
7
+ Import both helpers from the client entry point. Call them after writing the new authoritative match state, in the same mutator that accepts the move. Do not wrap them in `if (ctx.isServer)`: the client pass clears or marks the caller optimistically, while the server pass performs the authoritative fan-out.
8
+
9
+ ```typescript
10
+ import { clearTurn, setTurn } from "joiner-sdk/v1/client.js";
11
+ import type { TileMutator } from "./types";
12
+
13
+ export const makeMove: TileMutator<"makeMove"> = async (ctx, input) => {
14
+ const match = await ctx.table("match").get("current");
15
+ if (!match) throw new Error("The match has not started");
16
+
17
+ // Validate the caller and move, then derive the complete next state from
18
+ // authoritative stored state. These names are tile-specific.
19
+ const { nextMatch, nextPlayerId, pushBody } = applyMove({
20
+ match,
21
+ userId: ctx.userId,
22
+ move: input,
23
+ });
24
+
25
+ await ctx.table("match").set({
26
+ itemKey: "current",
27
+ value: nextMatch,
28
+ });
29
+
30
+ if (nextMatch.status === "finished") {
31
+ await clearTurn(ctx, { all: true });
32
+ return;
33
+ }
34
+
35
+ await setTurn(ctx, {
36
+ userIds: [nextPlayerId],
37
+ // setTurn pushes the caller too. Do not push a player for their own action.
38
+ push: nextPlayerId === ctx.userId ? false : { body: pushBody },
39
+ });
40
+ };
41
+ ```
42
+
43
+ `setTurn` uses replace semantics by default, so passing the next player also clears the previous holder. Use the same pattern, with the same `ctx.userId` check, when a start, reset, rematch or seat-claim mutator makes the opening player actionable. Use `clearTurn(ctx, { all: true })` for every terminal path. A context-rich push body is preferred; omit `push` to use the generic default.
@@ -0,0 +1,14 @@
1
+ # Historical account erasure
2
+
3
+ `await isUserErased(ctx, userId)` from `joiner-sdk/v1/backend.js` reads
4
+ positive account-erasure evidence for this store. Use it in server-side data
5
+ migrations to repair app-owned roster rows that predate your `onAnonymizeUser`
6
+ hook. Keep that hook for future erasures.
7
+
8
+ The helper returns `false` on optimistic clients and when this store has no
9
+ erasure record. A missing `$users` row alone is not evidence of erasure: a live
10
+ parent-room member may not be mirrored here yet. Erasures that predate the
11
+ platform's erasure records cannot be inferred from this helper. Do not remove
12
+ those ambiguous rows automatically. Evidence is scoped to this store instance;
13
+ it is not a global account lookup.
14
+
@@ -0,0 +1,166 @@
1
+ # Vite Plugin
2
+
3
+ The `poeTile()` Vite plugin handles the platform build concerns that every bundled iframe app needs. Import it from `joiner-sdk/vite`.
4
+
5
+ ```typescript
6
+ import { defineConfig } from "vite";
7
+ import react from "@vitejs/plugin-react";
8
+ import { poeTile } from "joiner-sdk/vite";
9
+
10
+ export default defineConfig({
11
+ root: "tile",
12
+ build: {
13
+ outDir: "../dist",
14
+ emptyOutDir: true,
15
+ rollupOptions: {
16
+ output: {
17
+ entryFileNames: "tile-frontend.js",
18
+ assetFileNames: "[name][extname]",
19
+ },
20
+ },
21
+ },
22
+ plugins: [react(), poeTile()],
23
+ });
24
+ ```
25
+
26
+ The plugin handles:
27
+
28
+ - **Externals** — Prevents bundling platform-provided modules (`joiner-sdk/v1/client.js`) since these are provided at runtime via import map. The build writes the import-map name, poe-tiles-sdk/v1/client.js, for either SDK name.
29
+ - **Code splitting** — Rewrites dynamic `import()` calls to load chunks from the bundle as blob URLs, which work in sandboxed iframes.
30
+ - **Vendor extraction** — Shared dependencies (from `node_modules`) are automatically extracted into a `vendor` chunk so they aren't duplicated across lazy chunks.
31
+ - **Web Workers** — Fails the build on `new Worker(new URL(…, import.meta.url))` and on a `?worker` import missing `&inline`, neither of which can load in a sandboxed iframe. Use `?worker&inline`, which works with no help from the plugin. See [Web Workers](#web-workers) below.
32
+ - **Backend building** — Optionally builds the synced-store backend config as part of the Vite build.
33
+
34
+ The plugin does **not** set `root`, `outDir`, `entryFileNames`, or `assetFileNames` — consumers control their own directory structure and output naming via standard Vite config.
35
+
36
+ ## Minimum SDK Version
37
+
38
+ When a tile requires a runtime method or named export with a documented minimum SDK version, set that exact numeric literal in `poeTile({ minSdkVersion })` in `vite.config.ts`. Preserve an existing minimum, raise it when a new required API needs a later version, and never guess a version. Omit the option when the tile has no documented requirement. It accepts a positive safe integer and cannot be combined with `rootTile: true`.
39
+
40
+ Raising the minimum does not mean waiting for players to update. The SDK version is the web runtime the platform serves, not the native app, so players never need to update their app and the creator can publish right away. Do not tell the creator to wait before publishing or that players must update their app; just set the minimum. The one exception: right after a new SDK version is released, publish can refuse with HTTP 409 `kernel_not_deployed` while the platform finishes deploying that runtime. Publish again in a few minutes.
41
+
42
+ Production builds automatically infer SDK 34 when emitted chunks import `createNativeResults`, or SDK 31 for `completeRound`, from `joiner-sdk/v1/client.js`. Namespace and dynamic imports of that module require SDK 34 because they can access either export. The inferred minimum never lowers an explicit minimum. Root tiles are exempt; development mode still uses the explicit option.
43
+
44
+ The plugin checks the injected kernel version before importing the tile's entry module. An incompatible tile shows refresh instructions and requests the manager's update flow on hosts that support it. The check runs again after reload; if an automatic update did not help, the manager offers manual retry. `Poe.has(...)` only guards optional calls after the SDK has loaded; it cannot protect a missing named import because module linking happens first.
45
+
46
+ ## Backend Config Building
47
+
48
+ Pass `backendEntryPoint` to build the synced-store backend config automatically after the Vite build:
49
+
50
+ ```typescript
51
+ export default defineConfig({
52
+ root: "tile",
53
+ build: { outDir: "../dist" },
54
+ plugins: [
55
+ react(),
56
+ poeTile({ backendEntryPoint: "src/backend.ts" }),
57
+ ],
58
+ });
59
+ ```
60
+
61
+ The path is resolved relative to the Vite root directory. The output (`synced-store-backend-config.js`) is placed in the Vite output directory. This eliminates the need for a separate `buildBackend()` call in your build script.
62
+
63
+ ## Code Splitting
64
+
65
+ Dynamic `import()` calls are rewritten so that chunks are loaded from the bundle as blob URLs. This is more reliable than normal browser-cached imports — the browser's HTTP cache may evict entries at any time, so lazy-loaded chunks fetched over the network can fail offline. Assets loaded from the bundle are stored in IndexedDB by the top document, so they remain available even without a network connection.
66
+
67
+ ## Web Workers
68
+
69
+ Import your worker with Vite's `?worker&inline` suffix:
70
+
71
+ ```typescript
72
+ // worker.ts
73
+ self.onmessage = (event) => {
74
+ self.postMessage(expensiveWork(event.data));
75
+ };
76
+
77
+ // entry.tsx
78
+ import MyWorker from "./worker.ts?worker&inline";
79
+
80
+ const worker = new MyWorker();
81
+ worker.onmessage = (event) => setResult(event.data);
82
+ worker.postMessage(input);
83
+ ```
84
+
85
+ `&inline` is required — it is the whole reason this works. It bundles the worker
86
+ into your code and starts it from a blob URL, the only form the sandboxed iframe
87
+ allows. Two near-misses fail instead:
88
+
89
+ - `new Worker(new URL("./worker.ts", import.meta.url))` resolves against
90
+ `import.meta.url`, which is a `blob:` URL in a tile, so the call throws
91
+ `TypeError: Invalid URL`.
92
+ - A plain `?worker` (or `?sharedworker`) import compiles to
93
+ `new Worker("/assets/worker-hash.js")` — a path nothing serves here, since the
94
+ iframe makes no network requests.
95
+
96
+ **`poeTile()` fails the build on both**, with a message pointing at the fix, so
97
+ forgetting `&inline` is caught before you ship rather than breaking at runtime.
98
+
99
+ Constraints that come from the iframe sandbox:
100
+
101
+ - **Keep worker code statically imported.** A dynamic `import()` *inside* a worker
102
+ will not resolve. Regular top-level `import` statements are fine — they get
103
+ bundled into the worker.
104
+ - **Don't set `worker.format: "es"`** in `vite.config.ts`. It makes Vite's inline
105
+ wrapper request a module worker, which a blob URL cannot serve. The default
106
+ (`iife`) is what you want, and `poeTile()` pins it.
107
+ - **`SharedWorker` does not work at all** — shared workers are keyed by origin and
108
+ the iframe's origin is opaque, so the browser denies it (`Access to shared
109
+ workers is denied to origin 'null'`). `&inline` does not help. Use one regular
110
+ worker per frame.
111
+ - **No `localStorage`, `IndexedDB`, or direct network access** in the worker — it
112
+ inherits the tile's sandbox. Keep workers pure-compute (physics, pathfinding,
113
+ parsing, image processing) and do I/O on the main thread via `Poe`.
114
+ - **Big workers ride in your bundle.** The source is inlined into your code. If it
115
+ is large enough to matter for first paint, load it on demand instead:
116
+ `new Worker((await Poe.bundle.loadAsset("/workers/heavy.js")).url)` — classic scripts
117
+ only, and the file must end in `.js`.
118
+
119
+ ### Without a bundler
120
+
121
+ No-build apps can't use `?worker&inline`, but the underlying primitive — a
122
+ **classic** worker started from a blob URL minted inside the iframe — is available
123
+ directly. Two recipes.
124
+
125
+ Worker source as a string:
126
+
127
+ ```js
128
+ const workerSource = `
129
+ self.onmessage = (event) => {
130
+ self.postMessage(event.data.a + event.data.b);
131
+ };
132
+ `;
133
+
134
+ // The MIME type is required: the browser refuses to run a worker whose blob is
135
+ // text/plain or application/octet-stream.
136
+ const url = URL.createObjectURL(
137
+ new Blob([workerSource], { type: "text/javascript" }),
138
+ );
139
+
140
+ const worker = new Worker(url); // classic — do NOT pass { type: "module" }
141
+ worker.onmessage = (event) => console.log("sum:", event.data);
142
+ worker.postMessage({ a: 1, b: 2 });
143
+ ```
144
+
145
+ Or keep the worker in its own file and ask the host for it:
146
+
147
+ ```js
148
+ // worker.js must ship in your app directory and end in .js — the host derives
149
+ // the blob's MIME type from the extension.
150
+ const { url } = await Poe.bundle.loadAsset("/worker.js");
151
+ const worker = new Worker(url); // classic only
152
+ ```
153
+
154
+ The second form costs one round-trip on first use but keeps the worker out of your
155
+ initial HTML. Both require classic worker syntax (`importScripts`, no
156
+ `import`/`export`); a module script cannot be fetched from a blob URL here. A
157
+ `data:` URL is the one exception that does allow `{ type: "module" }`.
158
+
159
+ ## No-Build vs Bundled
160
+
161
+ | | No-Build | Bundled |
162
+ |---|---|---|
163
+ | Import | poe-tiles-sdk/v1/client.js (the import-map name) | `joiner-sdk/v1/client.js` |
164
+ | Schema | Inline mutators | `defineSchema()` + `defineClientConfig()` |
165
+ | Config | `{ mutators, schemaVersion }` | Pre-built client config object |
166
+ | Types | None (plain JS) | Full type inference from Zod schema |
@@ -0,0 +1,72 @@
1
+ # Workspace retention and expiry
2
+
3
+ **This page applies to managed Creator workspaces** — the hosted sandbox some
4
+ products provide for building a tile. If the creator builds locally with
5
+ the CLI on their own machine, their files are their own and nothing here
6
+ applies.
7
+
8
+ A managed workspace holds the tile's source files, unpublished changes,
9
+ the session transcript, and rollback archives. It is durable but not
10
+ permanent; these are the retention rules, stated up front so none of them is a
11
+ surprise.
12
+
13
+ ## While you work
14
+
15
+ - The workspace auto-backs up on a 60-second cadence, and recovery restores
16
+ the last **successful** backup. Normally that means about a minute of work
17
+ at risk if the sandbox is interrupted — but a backup that fails (for
18
+ example, a workspace whose archive exceeds the 2 GiB backup cap) leaves
19
+ everything since the last good backup unprotected until backups succeed
20
+ again.
21
+ - Rollback archives are kept on a ladder — the most recent saves at fine
22
+ grain, then 10-minute, hourly, and daily tiers — so recent states can be
23
+ restored precisely and older ones more coarsely.
24
+
25
+ ## Running workspaces
26
+
27
+ - An account can have at most **8 managed workspaces running at the same
28
+ time**. A workspace counts as running while its sandbox is awake; a
29
+ workspace that has gone to sleep does not count, and its files are kept.
30
+ - Starting a ninth workspace is refused with a message that says so. Nothing
31
+ in that workspace is changed or lost. It starts once another workspace of
32
+ the same account stops: close one, or wait for an idle one to sleep.
33
+
34
+ ## Inactivity expiry
35
+
36
+ - A workspace untouched for **180 days** is deleted: its container, source
37
+ files, rollback archives, and session transcript are all destroyed.
38
+ - A deletion warning is delivered into the workspace's session at **166 days**
39
+ of inactivity. Deletion never proceeds until that warning has actually been
40
+ delivered and at least **13 further days** have passed — a warning that
41
+ could not be delivered leaves the workspace alive.
42
+ - Returning to the workspace at any point before deletion cancels it and
43
+ resets the inactivity clock.
44
+
45
+ ## What survives expiry
46
+
47
+ - The **published tile keeps running** for its players, and the source
48
+ uploaded with its most recent publish or preview upload is retained. Editing
49
+ or remixing the tile after expiry seeds a fresh workspace from that
50
+ retained source.
51
+ - Only what the uploaded source bundle actually contained is retained: the
52
+ bundle honors ignore rules (`.gitignore` and any configured exclusions), so
53
+ files sitting in an ignored or excluded path are not preserved even after a
54
+ successful upload.
55
+ - Everything unpublished is lost: work-in-progress changes since the last
56
+ upload, the session transcript, and the rollback history.
57
+
58
+ ## The practical rule
59
+
60
+ **Publish to preserve — and verify what was uploaded.** Before a long absence,
61
+ anything worth keeping should be uploaded; a preview upload is enough, since
62
+ previews stay unlisted and the uploaded source is what outlives the workspace.
63
+ Before assuring a creator that their work will survive expiry, confirm that a
64
+ source-carrying upload succeeded and that the files they care about are inside
65
+ it (not excluded by ignore rules). How an upload happens is your HOST's rule:
66
+ a host that records versions automatically needs no extra upload from you —
67
+ starting one yourself can record a duplicate version — while a host that
68
+ leaves publishing to you should be offered an upload before a long absence
69
+ (see [publishing.md](publishing.md) only when your host states no
70
+ publishing rules). When a creator asks how long their work is kept, or a
71
+ deletion warning appears in a session, state these rules plainly.
72
+
@@ -0,0 +1,28 @@
1
+ // owner: aaronroe
2
+ import type { components } from "./api.generated";
3
+ export interface ConversionIdentity {
4
+ instanceId: string;
5
+ conversionId: string;
6
+ }
7
+ export function createAdminConversionsClient(transport: {
8
+ get<T>(path: string): Promise<T>;
9
+ post<T>(path: string, body: unknown): Promise<T>;
10
+ }) {
11
+ return {
12
+ inspect(
13
+ input: ConversionIdentity,
14
+ ): Promise<components["schemas"]["AdminCreatorV2AbandonmentSummary"]> {
15
+ return transport.get(
16
+ `/api/v1/admin/creator-v2/conversion?${new URLSearchParams({ ...input })}`,
17
+ );
18
+ },
19
+ abandon(
20
+ input: ConversionIdentity & { allowLocalOnlyQuarantine: true },
21
+ ): Promise<components["schemas"]["AdminCreatorV2AbandonmentSummary"]> {
22
+ return transport.post(
23
+ "/api/v1/admin/creator-v2/abandon-conversion",
24
+ input,
25
+ );
26
+ },
27
+ };
28
+ }
@@ -0,0 +1,36 @@
1
+ // owner: aaronroe
2
+ import type { components } from "./api.generated";
3
+
4
+ export type TileReviewScope =
5
+ | "full"
6
+ | "moderation"
7
+ | "quality"
8
+ | "classification";
9
+
10
+ export function createAdminReviewsClient(transport: {
11
+ get<T>(path: string): Promise<T>;
12
+ post<T>(
13
+ path: string,
14
+ body: { expectedGeneration: number; scope?: TileReviewScope },
15
+ ): Promise<T>;
16
+ }) {
17
+ const path = (reportId: string) =>
18
+ `/api/v1/admin/tile-reviews/${encodeURIComponent(reportId)}`;
19
+ return {
20
+ inspect(
21
+ reportId: string,
22
+ ): Promise<components["schemas"]["AdminTileReviewSuccess"]> {
23
+ return transport.get(path(reportId));
24
+ },
25
+ rerun(input: {
26
+ reportId: string;
27
+ expectedGeneration: number;
28
+ scope?: TileReviewScope;
29
+ }): Promise<components["schemas"]["AdminTileReviewSuccess"]> {
30
+ return transport.post(`${path(input.reportId)}/rerun`, {
31
+ expectedGeneration: input.expectedGeneration,
32
+ ...(input.scope === undefined ? {} : { scope: input.scope }),
33
+ });
34
+ },
35
+ };
36
+ }