@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.
- package/README.md +30 -2
- package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
- package/bundled-resources/poe-tile-templates/base/README.md +7 -0
- package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
- package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
- package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
- package/bundled-resources/poe-tile-templates/base/package.json +36 -0
- package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
- package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
- package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
- package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
- package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
- package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
- package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
- package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
- package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
- package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
- package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
- package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
- package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
- package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
- package/bundled-resources/poe-tile-templates/index.ts +27 -0
- package/bundled-resources/poe-tile-templates/package.json +31 -0
- package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
- package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
- package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
- package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
- package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
- package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
- package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
- package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
- package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
- package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
- package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
- package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
- package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
- package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
- package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
- package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
- package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
- package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
- package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
- package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
- package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
- package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
- package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
- package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
- package/cli.ts +134 -0
- package/index.ts +96 -0
- package/package.json +48 -5
- package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/audio-generation/SKILL.md +125 -0
- package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/finish-prototype/SKILL.md +22 -0
- package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
- package/skills/help-me-build/SKILL.md +56 -0
- package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/image-generation/SKILL.md +128 -0
- package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
- package/skills/one-shot/SKILL.md +22 -0
- package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-prototype/SKILL.md +60 -0
- package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-subagent/SKILL.md +16 -0
- package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
- package/skills/poe-tiles-cli/SKILL.md +609 -0
- package/skills/poe-tiles-cli/references/device-motion.md +40 -0
- package/skills/poe-tiles-cli/references/player-updates.md +41 -0
- package/skills/prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/prototype/SKILL.md +148 -0
- package/skills/publish/.generated-by-poe-templated-docs +0 -0
- package/skills/publish/SKILL.md +73 -0
- package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
- package/skills/synced-store/SKILL.md +583 -0
- package/skills/synced-store/references/actions.md +85 -0
- package/skills/synced-store/references/api-patterns.md +245 -0
- package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
- package/skills/synced-store/references/client-api-reference.md +263 -0
- package/skills/synced-store/references/data-visibility.md +95 -0
- package/skills/synced-store/references/external-stores.md +162 -0
- package/skills/synced-store/references/file-uploads.md +216 -0
- package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
- package/skills/synced-store/references/limitations.md +72 -0
- package/skills/synced-store/references/live-data-limit-hook.md +131 -0
- package/skills/synced-store/references/mutator-rules.md +169 -0
- package/skills/synced-store/references/platform.md +49 -0
- package/skills/synced-store/references/schema-and-bindings.md +85 -0
- package/skills/synced-store/references/schema-libraries.md +57 -0
- package/skills/synced-store/references/schema-migrations.md +119 -0
- package/skills/synced-store/references/searchable-tables.md +27 -0
- package/skills/synced-store/references/server-forking.md +115 -0
- package/skills/synced-store/references/singleton-tables.md +61 -0
- package/skills/synced-store/references/sort-keys.md +253 -0
- package/skills/synced-store/references/ui-patterns.md +95 -0
- package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
- package/skills/tile-creator/SKILL.md +196 -0
- package/skills/tile-creator/references/assets.md +124 -0
- package/skills/tile-creator/references/backend-api.md +308 -0
- package/skills/tile-creator/references/cli-limitations.md +64 -0
- package/skills/tile-creator/references/cli.md +604 -0
- package/skills/tile-creator/references/client-api.md +2407 -0
- package/skills/tile-creator/references/composing-apps.md +166 -0
- package/skills/tile-creator/references/e2e-tests.md +55 -0
- package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
- package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
- package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
- package/skills/tile-creator/references/native-results.md +100 -0
- package/skills/tile-creator/references/platform-integration.md +201 -0
- package/skills/tile-creator/references/power-report.md +199 -0
- package/skills/tile-creator/references/publish-rollout.md +166 -0
- package/skills/tile-creator/references/publishing.md +33 -0
- package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
- package/skills/tile-creator/references/render-check.md +266 -0
- package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
- package/skills/tile-creator/references/safe-area-insets.md +79 -0
- package/skills/tile-creator/references/sandbox-limitations.md +32 -0
- package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
- package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
- package/skills/tile-creator/references/simulations.md +125 -0
- package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
- package/skills/tile-creator/references/troubleshooting.md +22 -0
- package/skills/tile-creator/references/turn-based-mutator.md +43 -0
- package/skills/tile-creator/references/user-erasure.md +14 -0
- package/skills/tile-creator/references/vite-plugin.md +166 -0
- package/skills/tile-creator/references/workspace-retention.md +72 -0
- package/src/admin-conversions-client.ts +28 -0
- package/src/admin-reviews-client.ts +36 -0
- package/src/api.generated.ts +1527 -0
- package/src/auth-token.ts +198 -0
- package/src/bounded-read.ts +35 -0
- package/src/bun-version.ts +33 -0
- package/src/checkout-base.ts +207 -0
- package/src/cli-bun-version.ts +16 -0
- package/src/cli-env.ts +28 -0
- package/src/cli-name.ts +23 -0
- package/src/client.ts +2474 -0
- package/src/collect-files.ts +226 -0
- package/src/commands/accounts.ts +55 -0
- package/src/commands/admin-abandon-conversion.ts +60 -0
- package/src/commands/admin-reviews.ts +66 -0
- package/src/commands/admin.ts +219 -0
- package/src/commands/auth.ts +89 -0
- package/src/commands/checkout-prototype.ts +67 -0
- package/src/commands/creator-source-capability.ts +11 -0
- package/src/commands/doctor-bun.ts +145 -0
- package/src/commands/doctor-command.ts +64 -0
- package/src/commands/doctor-package-json.ts +47 -0
- package/src/commands/doctor-sdk-pin.ts +156 -0
- package/src/commands/doctor-store-keys-lexer.ts +213 -0
- package/src/commands/doctor-store-keys-scan.ts +262 -0
- package/src/commands/doctor-store-keys.ts +196 -0
- package/src/commands/doctor.ts +371 -0
- package/src/commands/init/blank-scaffold-templates.ts +397 -0
- package/src/commands/init/index.ts +170 -0
- package/src/commands/init/internal-toolchain.ts +49 -0
- package/src/commands/init/manager-test-template.ts +107 -0
- package/src/commands/init/multiplayer-test-template.ts +217 -0
- package/src/commands/init/name-input.tsx +167 -0
- package/src/commands/init/no-store-scaffold-templates.ts +281 -0
- package/src/commands/init/no-store-scaffold.ts +134 -0
- package/src/commands/init/package-json-scripts.ts +72 -0
- package/src/commands/init/scaffold.ts +960 -0
- package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
- package/src/commands/init/sdk-tarball-url.ts +31 -0
- package/src/commands/init/template-picker.tsx +147 -0
- package/src/commands/inspect-child-entry.ts +107 -0
- package/src/commands/inspect-contract.ts +87 -0
- package/src/commands/inspect-freshness.ts +217 -0
- package/src/commands/inspect-lock.ts +201 -0
- package/src/commands/inspect-options.ts +360 -0
- package/src/commands/inspect-orchestrate.ts +375 -0
- package/src/commands/inspect-process.ts +172 -0
- package/src/commands/inspect-ready.ts +65 -0
- package/src/commands/inspect-report.ts +235 -0
- package/src/commands/inspect-run-state.ts +296 -0
- package/src/commands/inspect-run.ts +157 -0
- package/src/commands/inspect-watchdog.ts +74 -0
- package/src/commands/install-joiner.ts +208 -0
- package/src/commands/login.ts +308 -0
- package/src/commands/models.ts +40 -0
- package/src/commands/parse-options.ts +36 -0
- package/src/commands/remix-package-json.ts +64 -0
- package/src/commands/remix.ts +379 -0
- package/src/commands/sdk-url.ts +141 -0
- package/src/commands/simulations.ts +133 -0
- package/src/commands/skills.ts +108 -0
- package/src/commands/store-files.ts +92 -0
- package/src/commands/stores.ts +703 -0
- package/src/commands/tiles-channel-commands.ts +115 -0
- package/src/commands/tiles-checkout.ts +351 -0
- package/src/commands/tiles-gallery-command.ts +95 -0
- package/src/commands/tiles-get-helpers.ts +27 -0
- package/src/commands/tiles-inspect.ts +276 -0
- package/src/commands/tiles-power-command.ts +308 -0
- package/src/commands/tiles-power-format.ts +396 -0
- package/src/commands/tiles-power-versions.ts +299 -0
- package/src/commands/tiles-publish-helpers.ts +145 -0
- package/src/commands/tiles-upload-command.ts +277 -0
- package/src/commands/tiles-version-commands.ts +201 -0
- package/src/commands/tiles-visibility-command.ts +103 -0
- package/src/commands/tiles.ts +257 -0
- package/src/commands/upgrade.ts +307 -0
- package/src/commit-in-progress.ts +42 -0
- package/src/creator-source-context.ts +97 -0
- package/src/creator-source-publish.ts +52 -0
- package/src/deferred-assets.ts +125 -0
- package/src/distribution.ts +28 -0
- package/src/errors.ts +61 -0
- package/src/install-command.ts +43 -0
- package/src/output.ts +62 -0
- package/src/poe-tile-config-files.ts +100 -0
- package/src/poe-tile-config-players.ts +168 -0
- package/src/poe-tile-config-remix.ts +166 -0
- package/src/poe-tile-config.ts +831 -0
- package/src/power-report-client.ts +55 -0
- package/src/prototype-startup.ts +21 -0
- package/src/publish-change-summary.ts +55 -0
- package/src/publish-overrides-validation.ts +49 -0
- package/src/publish-pack.ts +167 -0
- package/src/publish-phases.ts +57 -0
- package/src/publish-retry.ts +51 -0
- package/src/publish-tile-from-config.ts +434 -0
- package/src/recorder-stream.ts +169 -0
- package/src/remix-provenance.ts +156 -0
- package/src/resolve-client-credential.ts +71 -0
- package/src/resolve-media-uploads.ts +147 -0
- package/src/sdk-dependency.ts +54 -0
- package/src/sdk-skills.ts +85 -0
- package/src/should-skip-client-setup.ts +20 -0
- package/src/simulation-snapshot.ts +123 -0
- package/src/simulation-types.ts +74 -0
- package/src/simulations-client.ts +112 -0
- package/src/source-bundle.ts +466 -0
- package/src/staged-publish-cleanup.ts +44 -0
- package/src/staged-publish-deferred.ts +160 -0
- package/src/staged-publish.ts +401 -0
- package/src/store-file-upload.ts +268 -0
- package/src/store-request.ts +168 -0
- package/src/tar-canonical.ts +41 -0
- package/src/tar-extensions.ts +159 -0
- package/src/tar-extract.ts +193 -0
- package/src/tar-parse.ts +224 -0
- package/src/tar.ts +231 -0
- package/src/template-check-scripts.ts +18 -0
- package/src/tile-gallery-client.ts +82 -0
- package/src/types.ts +258 -0
- package/src/upload-concurrency.ts +54 -0
- package/src/whole-tile.ts +52 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Reusable native round results
|
|
2
|
+
|
|
3
|
+
`createNativeResults` and `completeRound` are shared SDK exports, not copied
|
|
4
|
+
scaffold files. They work with React, Preact, SolidJS, Vanilla JS, and Phaser.
|
|
5
|
+
Game rules, rendering, animations, and styles remain app-owned.
|
|
6
|
+
|
|
7
|
+
## Runtime requirement
|
|
8
|
+
|
|
9
|
+
Use an SDK version that exports these helpers. The current Vite plugin infers
|
|
10
|
+
SDK 34 for `createNativeResults` (31 for `completeRound`) from emitted imports
|
|
11
|
+
in production builds, preserving any higher configured minimum. For development or older build tooling, set
|
|
12
|
+
`minSdkVersion: 34` (or a higher existing requirement) in `poeTile({ ... })`.
|
|
13
|
+
The host supplies `v1/client.js` at runtime. SDK 31 has the helpers but lacks
|
|
14
|
+
the error `message` field; earlier hosts lack the named exports.
|
|
15
|
+
Deploy SDK/kernel support before publishing an app that imports them.
|
|
16
|
+
|
|
17
|
+
## Commit completion in the game mutator
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { completeRound } from "joiner-sdk/v1/client.js";
|
|
21
|
+
|
|
22
|
+
// Inside the validated move mutator, after writing the terminal round state:
|
|
23
|
+
await completeRound(ctx, {
|
|
24
|
+
board: {
|
|
25
|
+
leaderboardId: "current-round",
|
|
26
|
+
players: scoresByUserId, // complete board, including non-winners
|
|
27
|
+
bestScore: "highest",
|
|
28
|
+
label: "Round result",
|
|
29
|
+
},
|
|
30
|
+
participantUserIds: playerIds,
|
|
31
|
+
outcomeText,
|
|
32
|
+
eventId: input.eventId,
|
|
33
|
+
now: input.now,
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The same export exists in `v1/backend.js`. The helper overwrites this board,
|
|
38
|
+
clears every current turn-holder, and sends completion activity, push (with the
|
|
39
|
+
SDK's normal sender suppression), and a containing-chat announcement. It
|
|
40
|
+
includes the actor in activity recipients and deduplicates participant IDs.
|
|
41
|
+
|
|
42
|
+
**The mutator still validates membership, actor, phase and expected round.**
|
|
43
|
+
Derive scores and participants from game state. Call only once on the transition
|
|
44
|
+
to completion, in the same transaction as the final move. The helper does not
|
|
45
|
+
provide authorization or duplicate-completion protection; reusing a chat message
|
|
46
|
+
ID alone is not a guard. For cumulative/high-score boards, compose the existing
|
|
47
|
+
leaderboard and activity APIs instead of overwriting a complete round board.
|
|
48
|
+
This helper does not send activity for ordinary moves; retain those updates.
|
|
49
|
+
|
|
50
|
+
## Present results from the live subscription
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { createNativeResults } from "joiner-sdk/v1/client.js";
|
|
54
|
+
|
|
55
|
+
const results = createNativeResults({
|
|
56
|
+
room: Poe.room,
|
|
57
|
+
restart: async (expectedRound) => {
|
|
58
|
+
await (await store.mutate.restart({ expectedRound })).confirmed;
|
|
59
|
+
},
|
|
60
|
+
onErrorChange: (failure) => {
|
|
61
|
+
// null clears the message AND retry control. Otherwise render failure.message
|
|
62
|
+
// as text and wire Retry to failure.retry (one-shot; stale retries are inert).
|
|
63
|
+
renderResultsError(failure);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const unsubscribe = store.subscribe(readState, (snapshot) => {
|
|
68
|
+
renderGame(snapshot); // readable in-game outcome first
|
|
69
|
+
results.update(snapshot.finished
|
|
70
|
+
? { round: snapshot.roundId, leaderboardId: "current-round" }
|
|
71
|
+
: null);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Component/scene cleanup:
|
|
75
|
+
// unsubscribe(); results.dispose();
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Create one controller per mounted tile. Feed **every** snapshot, including
|
|
79
|
+
rollback, shared restart and new rounds. Round IDs must remain unique across
|
|
80
|
+
rounds and reloads. Do not mount the controller only inside a finished-results
|
|
81
|
+
component. Use the same round/leaderboard pair while the completed round remains
|
|
82
|
+
visible; repeated snapshots do not reopen a dismissed result.
|
|
83
|
+
|
|
84
|
+
By default presentation waits 600ms. Optional `schedule(run)` returns a cancel
|
|
85
|
+
function; use it to coordinate with an app's own result animation. The controller
|
|
86
|
+
cancels obsolete work, dismisses obsolete overlays, ignores stale responses,
|
|
87
|
+
and calls `restart(expectedRound)` only for the current `playAgain` response.
|
|
88
|
+
Close never restarts. The restart mutator must authorize the actor and check
|
|
89
|
+
expected round and phase; `.confirmed` alone is not proof of acceptance.
|
|
90
|
+
|
|
91
|
+
`onErrorChange` receives `{ message, error, retry }` on a current open/restart/dismiss
|
|
92
|
+
failure, and `null` when retry begins, the round changes, or the controller is
|
|
93
|
+
disposed. Retry calls are one-shot. No automatic retry loop runs in the background.
|
|
94
|
+
Remounting a finished tile may present its result again; suppression is local
|
|
95
|
+
to one mount, not persisted game state.
|
|
96
|
+
|
|
97
|
+
`message` is a plain-text string for your error UI; `error` retains the original
|
|
98
|
+
cause for diagnostics. Render it as text, never HTML. Restart rejection must be
|
|
99
|
+
surfaced through the store's background-error handling and live game state; the
|
|
100
|
+
controller can only report errors actually thrown by your restart callback.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Platform integration reference
|
|
2
|
+
|
|
3
|
+
Use these exact SDK shapes with the scaffold's pin. This reference consolidates
|
|
4
|
+
schema/bindings, multiplayer sections 1–5, and native results; it does not add or
|
|
5
|
+
remove features. Keep the active workflow's requirements.
|
|
6
|
+
Read a full reference or the pinned declaration only for an uncovered capability,
|
|
7
|
+
blocking ambiguity, or concrete type/runtime discrepancy; scope it to that symbol.
|
|
8
|
+
|
|
9
|
+
## Schema, handlers and configuration
|
|
10
|
+
|
|
11
|
+
Adapt names to the scaffold. Keep named Zod row/input validators and the existing
|
|
12
|
+
client-safe schema version constant. Backend-only schema values never enter the
|
|
13
|
+
browser; browser code imports the schema **type**. Preserve other config fields,
|
|
14
|
+
actions, migrations and hooks. Both configs use the **same browser-safe handlers**.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
// synced-store/schema.ts
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
import { defineSchema, table } from "joiner-sdk/v1/backend.js";
|
|
20
|
+
import { TILE_SCHEMA_VERSION } from "./tile-schema-version";
|
|
21
|
+
const recordRow = z.object({ text: z.string().max(500) });
|
|
22
|
+
const updateRecordInput = z.object({ id: z.string().min(1).max(100), text: z.string().max(500) });
|
|
23
|
+
export const tileSchema = defineSchema({
|
|
24
|
+
schemaVersion: TILE_SCHEMA_VERSION,
|
|
25
|
+
tables: { records: { schema: table(recordRow) } },
|
|
26
|
+
mutators: { updateRecord: { input: updateRecordInput } },
|
|
27
|
+
});
|
|
28
|
+
export type TileSchema = typeof tileSchema;
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Import `InferMutatorHandlers<TileSchema>`, `InferSystemHooks<TileSchema>` and
|
|
32
|
+
`InferReadContext<TileSchema>` from `joiner-sdk/v1/client.js` to type mutators,
|
|
33
|
+
hooks and shared readers. Hooks' context knows app and system tables without casts.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// client-config.ts (merge with existing config)
|
|
37
|
+
import { defineClientConfig } from "joiner-sdk/v1/client.js";
|
|
38
|
+
import type { TileSchema } from "./schema";
|
|
39
|
+
import { TILE_SCHEMA_VERSION } from "./tile-schema-version";
|
|
40
|
+
import { tileMutators } from "./mutators";
|
|
41
|
+
import { tileHooks } from "./hooks";
|
|
42
|
+
export const tileClientConfig = defineClientConfig<TileSchema>({
|
|
43
|
+
schemaVersion: TILE_SCHEMA_VERSION, mutators: tileMutators, hooks: tileHooks,
|
|
44
|
+
});
|
|
45
|
+
// backend-config.ts (separate file, not imported by UI)
|
|
46
|
+
import { defineBackendConfig } from "joiner-sdk/v1/backend.js";
|
|
47
|
+
import { tileSchema } from "./schema";
|
|
48
|
+
// Import the same tileMutators and tileHooks here.
|
|
49
|
+
export const tileBackendConfig = defineBackendConfig({
|
|
50
|
+
schema: tileSchema, mutators: tileMutators, hooks: tileHooks,
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Table operation shapes (separate examples):
|
|
55
|
+
`await ctx.table("records").get(input.id)`;
|
|
56
|
+
`await ctx.table("records").set({ itemKey: input.id, value: { text: input.text } })`;
|
|
57
|
+
`await ctx.table("records").delete(input.id)`;
|
|
58
|
+
`await ctx.table("records").scan().values().toArray()`.
|
|
59
|
+
Keys cannot contain `:`. Zod defaults do not make output-row fields optional:
|
|
60
|
+
keep affected fixtures, seed rows and UI props compatible. Choose bounded/public,
|
|
61
|
+
per-user-private or server-only storage before designing tables; UI filtering is
|
|
62
|
+
not privacy. For persisted-shape changes or accumulating ordered history, use the
|
|
63
|
+
full [schema migrations](../../synced-store/references/schema-migrations.md),
|
|
64
|
+
[visibility](../../synced-store/SKILL.md) and [sort keys](../../synced-store/references/sort-keys.md) references.
|
|
65
|
+
|
|
66
|
+
## Client, membership and seats
|
|
67
|
+
|
|
68
|
+
Create `Poe` and `Poe.setupStore(clientConfig)` once in the entry point. Show loading,
|
|
69
|
+
await `store.waitForBootstrap()`, then render live subscribed state. Never reset
|
|
70
|
+
saved progress on mount/reload. Persist gameplay in synced-store; only disposable
|
|
71
|
+
presentation state lives in memory. Browser storage is unavailable in the iframe.
|
|
72
|
+
Pass the real `Poe` object to UI needing host surfaces.
|
|
73
|
+
|
|
74
|
+
- `$users` contains membership tombstones: active means `removedAt === undefined`.
|
|
75
|
+
Never write system tables; retained app-owned seats are not proof of membership.
|
|
76
|
+
- Names/avatars come from `$userInfo`. Import `type PoeUserInfo, usableDisplayName`
|
|
77
|
+
from `joiner-sdk/v1/shared.js`; use `usableDisplayName(profile) || "Player"`
|
|
78
|
+
for `profile: PoeUserInfo | undefined`. Profile fields and `profilePicture` are
|
|
79
|
+
optional; provide fallbacks, no raw IDs. Profile action:
|
|
80
|
+
`await Poe.users.openProfile({ userId })`; handle failures.
|
|
81
|
+
- Shared `onAddUsersV2(ctx, { users })` runs **once per batch** with every admitted
|
|
82
|
+
user in admission order. Each entry's optional `addedBatchUserIds` is invitation
|
|
83
|
+
context, not a `$users` field. Deterministically seat admitted users; repeated
|
|
84
|
+
admission must not reset play or duplicate seats. `onAddUsers` (per user) is
|
|
85
|
+
deprecated; define one or the other.
|
|
86
|
+
- Offline presence preserves seats/progress. `onRemoveUser(ctx, { userId })` handles
|
|
87
|
+
explicit removal: repair or visibly pause play, clear obsolete turns and retain
|
|
88
|
+
an authorized recovery path. Store seats/roles/phase/board/turns in app tables.
|
|
89
|
+
|
|
90
|
+
## Assignment and committing actions
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
const picked = await Poe.room.pickMembers({
|
|
94
|
+
title: "Choose player", selection: { max: 1 },
|
|
95
|
+
excludeUserIds: [currentUserId], playingUserIds: seatedUserIds,
|
|
96
|
+
});
|
|
97
|
+
const user = picked?.users[0];
|
|
98
|
+
if (user) await store.mutate.assignSeat({ seatId, userId: user.userId, now: Date.now() });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Picker values are input, not authorization. In the mutator validate `ctx.userId`
|
|
102
|
+
(the authenticated actor, **not** `store.userId`), membership/role, phase, expected
|
|
103
|
+
round and legality. Call `assertRoomMember(ctx, { userId: input.userId })` for a
|
|
104
|
+
chosen room member; it checks the tile's own `$users`, which `Poe.room.pickMembers()`
|
|
105
|
+
waits on before resolving, so the pick need not have opened the tile. Check seat
|
|
106
|
+
availability, write the assignment, then `notifyUsersAddedToTile(ctx, {
|
|
107
|
+
targetUserIds: [input.userId], appName, reason: "assigned", previewTimestamp: input.now
|
|
108
|
+
})`. Both helpers import from `joiner-sdk/v1/client.js`. Admission is host-owned;
|
|
109
|
+
preserve the seat pending join. Expected conflicts should early-return or produce
|
|
110
|
+
visible status, not throw background errors. Apply the same actor/round checks to
|
|
111
|
+
moves and restart. Reject stale/replayed actions without duplicate side effects.
|
|
112
|
+
Generate times/IDs at callers, pass explicit next values, and read before merging.
|
|
113
|
+
|
|
114
|
+
These attention helpers also import from `joiner-sdk/v1/client.js`:
|
|
115
|
+
|
|
116
|
+
| Operation | Exact call shape and meaning |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| Next player | `await setTurn(ctx, { userIds: [nextUserId], push: { body } })`. Optional `replace` defaults to true, replacing prior turns; no timestamp property. Updates next player's turn, unread, Activity tab and optional push. |
|
|
119
|
+
| Clear turns | `await clearTurn(ctx, { all: true })` or `await clearTurn(ctx, { userIds: [userId] })`. Use the appropriate form on paused/unfinished recovery paths; completion below clears all current turns. |
|
|
120
|
+
| Actor's meaningful action | `` await notifyActivity(ctx, { preview: `You ${actionText}`, previewTimestamp: input.now, targetUserIds: [ctx.userId], recency: "bump" }) ``. The actor reads "You …"; other members' calls use the display name, never a bare verb phrase. Required whenever a person acted; a shared fan-out that includes the actor satisfies the bump only when its preview names no human actor. Next player's `setTurn` does not bump the actor. |
|
|
121
|
+
|
|
122
|
+
Avoid duplicate next-player unread/push. Preferences/no-ops and pointer/animation
|
|
123
|
+
frames are not shared activity. Subscriptions may fire optimistically and again
|
|
124
|
+
on confirmation: deduplicate presentation effects by event/previous state.
|
|
125
|
+
|
|
126
|
+
## Terminal commit and native results
|
|
127
|
+
|
|
128
|
+
In the **same validated mutator** as the final state transition:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
await completeRound(ctx, {
|
|
132
|
+
board: { leaderboardId: "current-round", players: scoresByUserId,
|
|
133
|
+
bestScore: "highest", label: "Round result", unit: { singular: "point", plural: "points" } },
|
|
134
|
+
participantUserIds: playerIds, outcomeText, eventId: input.eventId, now: input.now,
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`completeRound` imports from `v1/client.js` (also backend). It overwrites the complete
|
|
139
|
+
current-round board (`Record<string, number>`, including non-winners), clears all
|
|
140
|
+
current turns, sends completion activity/push/containing-chat announcement, includes
|
|
141
|
+
the actor and deduplicates participant IDs. `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). Retain sender suppression and unread
|
|
142
|
+
defaults. Derive participants, scores and result from validated state. Guard the
|
|
143
|
+
terminal transition; a reused event ID alone does not deduplicate chat or authorize
|
|
144
|
+
action. It does not send ordinary-move activity. For cumulative/high-score boards,
|
|
145
|
+
compose `setLeaderboard`/`setLeaderboardScore` (`merge`/`replace`), `clearTurn` and
|
|
146
|
+
`notifyActivity` instead; see full [native results](native-results.md).
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { createNativeResults } from "joiner-sdk/v1/client.js";
|
|
150
|
+
const results = createNativeResults({
|
|
151
|
+
room: Poe.room,
|
|
152
|
+
restart: async (expectedRound) => {
|
|
153
|
+
await (await store.mutate.restart({ expectedRound })).confirmed;
|
|
154
|
+
},
|
|
155
|
+
onErrorChange: (failure) => renderResultsError(failure),
|
|
156
|
+
});
|
|
157
|
+
const unsubscribe = store.subscribe(readState, (snapshot) => {
|
|
158
|
+
renderGame(snapshot); // decisive in-game result first
|
|
159
|
+
results.update(snapshot.finished
|
|
160
|
+
? { round: snapshot.roundId, leaderboardId: "current-round" } : null);
|
|
161
|
+
});
|
|
162
|
+
// On unmount: unsubscribe(); results.dispose();
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
One controller per mount, fed **every snapshot**, including rollback/restart and
|
|
166
|
+
unfinished `null`. Round IDs stay unique across rounds/reloads; the round ID does
|
|
167
|
+
not partition leaderboard storage. Default opening delay is 600ms; optional
|
|
168
|
+
`schedule(run)` returns cancellation. The controller cancels/dismisses obsolete
|
|
169
|
+
results, ignores stale responses, does not reopen a dismissed result on repeated
|
|
170
|
+
snapshots, and calls restart only for current `playAgain`. Close is not restart.
|
|
171
|
+
Authorize expected-round restart in the mutator. Remount can present results again.
|
|
172
|
+
|
|
173
|
+
`onErrorChange` gives `{ message, error, retry }` for open/restart/dismiss failures,
|
|
174
|
+
and `null` when retry starts, round changes or disposal occurs. Render `message`
|
|
175
|
+
as text with a Retry control using `retry`; clear both on null. Retry is one-shot,
|
|
176
|
+
stale retries inert; no background retry loop. `.confirmed` means processing
|
|
177
|
+
finished, not acceptance. Preserve SDK background error handling and render live
|
|
178
|
+
authoritative state; use `onFailedMutation` for app-specific pending-state recovery.
|
|
179
|
+
The controller only catches errors actually thrown by its callback.
|
|
180
|
+
|
|
181
|
+
`createNativeResults` needs SDK 34 (`completeRound`: 31). Production Vite imports
|
|
182
|
+
infer minimum versions. For development/older tooling use
|
|
183
|
+
`poeTile({ minSdkVersion: 34 })`, preserving a higher existing minimum.
|
|
184
|
+
|
|
185
|
+
## UI adapter
|
|
186
|
+
|
|
187
|
+
Keep shared readers stable at module scope, typed with `AppReadContext`.
|
|
188
|
+
|
|
189
|
+
| Scaffold | Binding |
|
|
190
|
+
| --- | --- |
|
|
191
|
+
| React | `useLiveQuery(store, readState)` from `joiner-sdk/v1/react` returns `{ data, isLoading, error }`; data starts undefined and `error` holds what a throwing query threw. Outer loading + narrowed ready component helps async handlers. Keep hook ordering stable. |
|
|
192
|
+
| Preact | `useEffect(() => store.subscribe(readState, setState), [store])` returns cleanup. |
|
|
193
|
+
| SolidJS | `createLiveQueryResource(() => props.store, () => readState)`; use `subscribeToTable` and `onCleanup` for keyed table-diff animation. |
|
|
194
|
+
| Vanilla JS | One subscription in `mountApp`; update existing nodes; unsubscribe on destruction. |
|
|
195
|
+
| Phaser | DOM shell owns subscription/latest snapshot; dynamically import scene with `getSnapshot()` and semantic callbacks. No per-frame store mutations. |
|
|
196
|
+
|
|
197
|
+
React/Preact/Solid scaffolds include Tailwind; Vanilla/Phaser use CSS unless
|
|
198
|
+
Tailwind configured. Choose the game's own layout and visual identity. Full
|
|
199
|
+
[multiplayer recipe](multiplayer-api-recipe.md) and
|
|
200
|
+
[schema/bindings](../../synced-store/references/schema-and-bindings.md) remain
|
|
201
|
+
available.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Battery and heat report
|
|
2
|
+
|
|
3
|
+
`joiner tiles power` reads the platform's 7-day battery and heat report for
|
|
4
|
+
a tile you own: a verdict, the reason codes behind it, and the measurements it
|
|
5
|
+
rests on. It is the same report the creator sees on the tile's dashboard as
|
|
6
|
+
"Battery and heat", so read it before you explain or fix a battery finding.
|
|
7
|
+
|
|
8
|
+
## When to run it
|
|
9
|
+
|
|
10
|
+
- The creator says their phone gets hot or the battery drains while playing,
|
|
11
|
+
asks whether the tile is efficient, or arrives with a battery finding from the
|
|
12
|
+
dashboard.
|
|
13
|
+
- Before a performance fix, to know which reason to chase, and on a later turn,
|
|
14
|
+
to see whether the published fix moved the current build.
|
|
15
|
+
|
|
16
|
+
Do not run it to decide how to build a new tile: the build-time rules are the
|
|
17
|
+
render-budget and motion rules in the skill, and a new tile has no sessions to
|
|
18
|
+
report on.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# In a Creator session (POE_TILES_PUBLISH_TOKEN is set): the session's own tile.
|
|
22
|
+
joiner tiles power
|
|
23
|
+
joiner --json tiles power
|
|
24
|
+
joiner tiles power --version 12 # one published version on its own
|
|
25
|
+
joiner tiles power --all-versions # the newest versions, one row each
|
|
26
|
+
|
|
27
|
+
# Anywhere else, signed in: one tile you own, or every tile you own.
|
|
28
|
+
joiner tiles power myuser/my-tile
|
|
29
|
+
joiner tiles power myuser/my-tile --version 12
|
|
30
|
+
joiner tiles power myuser/my-tile --all-versions
|
|
31
|
+
joiner tiles power
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
In a Creator session the command reads only the tile the session publishes; it
|
|
35
|
+
needs a published preview first, and naming any other tile is refused as "not
|
|
36
|
+
one of your tiles". Use `--json` when you need a measurement the human output
|
|
37
|
+
leaves out, such as `auto_share`, `override_share`, or the render-loop context
|
|
38
|
+
numbers.
|
|
39
|
+
|
|
40
|
+
## What the default report measures
|
|
41
|
+
|
|
42
|
+
A report is keyed per published version, and a version says nothing on its
|
|
43
|
+
own until it has 30 Android or 30 iPhone phone sessions in the last 7 days.
|
|
44
|
+
A tile that publishes often never gets there one version at a time, so the
|
|
45
|
+
default report measures the tile's **newest published versions that together
|
|
46
|
+
reach the floor**, walked back from the live version: the live version's own
|
|
47
|
+
sessions first, then the version before it, whole, and so on until the set
|
|
48
|
+
has enough sessions to judge. The `Measured` row names the set: `v1703` when
|
|
49
|
+
the live version was judged on its own, `v1690 to v1703, 5 builds` when the
|
|
50
|
+
set reaches back past it. The sessions, the iPhone warm-up share, the verdict
|
|
51
|
+
and its reasons are for that set; the Android figure is the newest version in
|
|
52
|
+
the set that was measured on its own, and the row says which (`· version
|
|
53
|
+
1698`) when that is not the newest.
|
|
54
|
+
|
|
55
|
+
A `hot` or `watch` verdict on the default report carries a qualifier:
|
|
56
|
+
|
|
57
|
+
- `hot, based on latest version`: the live version was judged on its own.
|
|
58
|
+
This is the per-version report it always was.
|
|
59
|
+
- `hot, based on recent versions`: the set reaches back past the live
|
|
60
|
+
version. The live version's sessions **are counted**, but it is not yet
|
|
61
|
+
judged alone. **Do not start another fix on this verdict**: it still
|
|
62
|
+
includes the code the creator just replaced, and the `Current build` line
|
|
63
|
+
says how far the live version is from being judged on its own. Wait, or
|
|
64
|
+
read the versions on their own (below).
|
|
65
|
+
|
|
66
|
+
A fix is confirmed only when the `Current build` line reads measured on its
|
|
67
|
+
own and its numbers moved, as before.
|
|
68
|
+
|
|
69
|
+
## Reading versions on their own
|
|
70
|
+
|
|
71
|
+
`--version <n>` reads one published version's own report, with no qualifier
|
|
72
|
+
and no `Current build` line. In a Creator session it needs no tile argument.
|
|
73
|
+
|
|
74
|
+
`--all-versions` reads the tile's newest published versions in one command:
|
|
75
|
+
the default report in full, then one row per version, newest first, with that
|
|
76
|
+
version's own verdict, reasons, sessions and Android and iPhone readings, and
|
|
77
|
+
`[LIVE]` beside the version players get. When a creator asks when something started, run it and read down
|
|
78
|
+
the rows: a version with no verdict simply had too few sessions on its own
|
|
79
|
+
(its row says `insufficient_data` with the count toward the floor), so read
|
|
80
|
+
the run, not one row, and name the first version where the reading changes.
|
|
81
|
+
Then use `--version <n>` on that version for its full measurements.
|
|
82
|
+
|
|
83
|
+
It reads the newest 20 versions; `--limit <n>` reads up to 50, and the output
|
|
84
|
+
says when the tile has older ones. Each version is one read of a report that
|
|
85
|
+
allows the creator's account 60 reads a minute, shared with their dashboard
|
|
86
|
+
and other sessions, so do not run it in a loop: if it reports a rate limit it
|
|
87
|
+
prints no rows, so wait a minute and run it again. If it says the hourly
|
|
88
|
+
report was rebuilt while it read, run it again before comparing rows. For a
|
|
89
|
+
version older than the newest 50, list the versions with
|
|
90
|
+
`joiner tiles versions <tile>` (the report prints the `Tile ID` to use) and
|
|
91
|
+
read it with `--version`. Outside a Creator session `--all-versions` needs the
|
|
92
|
+
tile named.
|
|
93
|
+
|
|
94
|
+
## Reading the verdict
|
|
95
|
+
|
|
96
|
+
| Verdict | Meaning |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `hot` | An outcome is well above the typical tile: Android current at least 1.5× the typical tile's, or the iPhone warm-up share at least 5 points above it. |
|
|
99
|
+
| `watch` | An outcome is above the typical tile (1.2×, or 2 points), or a structural reason fired. |
|
|
100
|
+
| `ok` | At least one outcome is measured and none is above the typical tile. |
|
|
101
|
+
| `insufficient_data` | No outcome can be judged yet: each one is under its sample floor, waiting for the typical tile's baseline, or counted but not computed yet. A tile played only in a browser, on a phone or a desktop, never gets an outcome: the battery outcomes come from the Joiner phone apps alone. Render measurements count browser sessions too, so such a tile can still read `watch` from a structural reason. |
|
|
102
|
+
| `not_computed` | The tile has enough sessions, but the hourly refresh has not computed its numbers yet. Check again in an hour. |
|
|
103
|
+
|
|
104
|
+
The verdict compares the tile with the typical tile across the platform, on
|
|
105
|
+
whatever phones each was played on, at whatever brightness and starting
|
|
106
|
+
temperature. It is a signal to investigate, not a measurement of the tile
|
|
107
|
+
alone. Confirm a cause in the code before you claim one.
|
|
108
|
+
|
|
109
|
+
## Reason codes
|
|
110
|
+
|
|
111
|
+
Each reason is a finding about this tile. Fix the cause the code points at;
|
|
112
|
+
never fix a reason by lowering quality the creator did not ask to lower.
|
|
113
|
+
|
|
114
|
+
| Reason | What it measured | What to inspect | Fix |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| `android_current_high` | The Android phone's median current draw while running the tile, against the typical tile's. | A render loop that runs on menus, game-over, and pause screens; a loop that runs while the tile is hidden; per-frame canvas cost; a drawing buffer above the budget's pixel ratio; timers and CSS animations that never stop. | Adopt the render budget, go idle on static screens, pause on the foreground signal, and keep frames cheap, as the skill's render-budget and motion rules say. |
|
|
117
|
+
| `ios_thermal_escalation` | Of iPhone sessions that started cool, the share that warmed up (thermal state fair or worse), against the typical tile's. | Sustained GPU or CPU load: the same causes as above, held for long sessions. | The same fixes. Sustained load matters more than peaks here. |
|
|
118
|
+
| `uncapped_pixel_ratio` | The median drawing-buffer pixel ratio on phones is above 1.6, while the platform's mobile cap is 1.5. | A canvas sized by `window.devicePixelRatio` rather than the budget's resolved `pixelRatio`; a `maxPixelRatio` override; an engine's resolution setting not driven by `resolveRenderBudgetDefaults()`. | Size every buffer by the budget's `pixelRatio`. If the tile raised `maxPixelRatio` on purpose, that explains the finding: ask the creator whether the sharper image is worth the battery, and keep their answer. |
|
|
119
|
+
| `missed_frames_high` | On the render budget, at least a quarter of sessions (the p75) miss at least a quarter of their frames. | Expensive frames: per-fill `shadowBlur`, full-screen `globalCompositeOperation` passes, paths rebuilt every frame, many draw calls. | Cache static art, bake effects into an offscreen layer, and draw shadows and glows as plain shapes. Do not lower `targetFps` on your own. |
|
|
120
|
+
|
|
121
|
+
`uncapped_pixel_ratio` and `missed_frames_high` are structural: they describe
|
|
122
|
+
the tile's own buffer and frame budget, can raise `watch` but never `hot`, and
|
|
123
|
+
appear before the battery outcomes have enough sessions. Unlike the battery
|
|
124
|
+
outcomes, they count browser sessions as well as the phone apps: pixel ratio
|
|
125
|
+
counts every phone-sized session, and missed frames every session whose frame
|
|
126
|
+
rate the render budget caps: phones by default, and desktop only when the tile
|
|
127
|
+
sets `targetFps` itself.
|
|
128
|
+
Phones in Low Power Mode are left out of missed frames: iOS then holds
|
|
129
|
+
animation near 30 fps whatever the tile does.
|
|
130
|
+
|
|
131
|
+
## Context codes
|
|
132
|
+
|
|
133
|
+
Context codes never change the verdict. They narrow down where to look.
|
|
134
|
+
|
|
135
|
+
| Context | What it says | What it cannot say |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `unbudgeted_render_loop` | Most sessions ran without the render budget and redrew a large area at a high pixel rate. | Whether the loop is needed. A static canvas with a live loop reads high too; that is the case to fix. |
|
|
138
|
+
| `quality_override` | Most sessions on the render budget overrode a quality setting (`maxPixelRatio`, `antialias`, or `targetFps`). | Overrides in an engine-owned tile (Phaser, for example) are not recorded, so the absence of this code does not rule one out. |
|
|
139
|
+
| `dom_animation_suspected` | An outcome reason fired and the tile draws no canvas. | Which animation. Run `bun run render-check` with the tile's persistent screens classified `idle` and reached in the fullest state a player can own, read its `frames/tick` and `anims` columns and the `many_running_animations` finding, then list `document.getAnimations()` on that screen to name the loops. The cost is compositing, not script: sandbox CPU time stays low on a tile that heats phones, so do not judge a fix by it. |
|
|
140
|
+
|
|
141
|
+
## Freshness, rotation, and the typical tile
|
|
142
|
+
|
|
143
|
+
- The report covers the last 7 days and is rebuilt every hour. The header's
|
|
144
|
+
`Generated` time is when; `stale` means the hourly refresh has failed for
|
|
145
|
+
more than two hours and the numbers are older than usual.
|
|
146
|
+
- Up to 200 tile/client builds are recomputed each hour, oldest first. When the
|
|
147
|
+
header says `Rotating`, a build's `Computed` time can be older than `Generated`: its
|
|
148
|
+
numbers are carried forward from that hour. On a default report that pools
|
|
149
|
+
several versions, `Computed` is the oldest computation among the carried
|
|
150
|
+
figures, so a carried measurement never looks fresher than it is.
|
|
151
|
+
- The `Typical tile` line is the baseline every outcome is compared with. While
|
|
152
|
+
it has too few sessions itself, an outcome reads "waiting for the baseline"
|
|
153
|
+
and cannot raise a reason.
|
|
154
|
+
|
|
155
|
+
## Sample floors
|
|
156
|
+
|
|
157
|
+
- An outcome (Android current, iPhone warm-up) needs 30 sessions; a structural
|
|
158
|
+
measurement (pixel ratio, missed frames) needs 10. Below the floor the number
|
|
159
|
+
is withheld and the report shows the count toward it, such as "12 of 30
|
|
160
|
+
sessions".
|
|
161
|
+
- Both the weighted sample count and the raw row count must reach the floor, so
|
|
162
|
+
the count shown is the smaller of the two.
|
|
163
|
+
- "40 sessions, not computed yet" means the floor is met and the hourly rotation
|
|
164
|
+
has not reached the tile yet.
|
|
165
|
+
|
|
166
|
+
## After a fix: the current build
|
|
167
|
+
|
|
168
|
+
After a publish the new version's sessions join the measured set first, and
|
|
169
|
+
earlier versions drop out whole as they stop being needed, so a warning eases
|
|
170
|
+
as the new sessions take over; at 30 phone sessions the new version is judged
|
|
171
|
+
on its own and the report names only it. On the creator page, the Performance
|
|
172
|
+
tab's version picker shows any published version with the same warning rules
|
|
173
|
+
and sample floors (`--version` is the same read). Each report covers the last
|
|
174
|
+
seven days, so a version with no recent samples reads as insufficient data.
|
|
175
|
+
Versions that share a client bundle share its measurements.
|
|
176
|
+
|
|
177
|
+
The `Current build` line measures the live build:
|
|
178
|
+
|
|
179
|
+
- `published after this report; measured on the next refresh`: the fix is
|
|
180
|
+
live and the next hourly report will start counting it.
|
|
181
|
+
- `collecting, 12 of 30 sessions`: the build is being measured.
|
|
182
|
+
- `v8: Android 1.0× the typical tile over 41 sessions`: the build is measured.
|
|
183
|
+
Compare it with the older version’s report to see whether the fix worked.
|
|
184
|
+
|
|
185
|
+
Never tell the creator a fix worked until the current build reads measured and
|
|
186
|
+
its numbers moved.
|
|
187
|
+
|
|
188
|
+
## What to tell the creator
|
|
189
|
+
|
|
190
|
+
Say what the report found, in the report's comparative terms, then what you
|
|
191
|
+
found in the code and what you changed. For example: "The battery report says
|
|
192
|
+
Android phones draw 1.6× the typical tile's current running this tile. I found
|
|
193
|
+
the canvas redrawing at full rate on the title screen and made it idle there.
|
|
194
|
+
The report compares with other tiles on different phones, so it is a lead
|
|
195
|
+
rather than a measurement; the current build will show whether this helped
|
|
196
|
+
once it has 30 phone sessions."
|
|
197
|
+
|
|
198
|
+
Never state an absolute battery figure (milliamps, hours of battery): the report
|
|
199
|
+
does not measure one.
|