@joiner-platform/cli 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +149 -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 +197 -0
- package/skills/tile-creator/references/assets.md +124 -0
- package/skills/tile-creator/references/backend-api.md +354 -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,79 @@
|
|
|
1
|
+
# Safe-area-inset CSS variables
|
|
2
|
+
|
|
3
|
+
The platform exposes four CSS variables on every iframe's `:root`:
|
|
4
|
+
|
|
5
|
+
| Variable | Default | Notes |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `--poe-safe-area-inset-top` | `env(safe-area-inset-top)` | Notch / status bar clearance |
|
|
8
|
+
| `--poe-safe-area-inset-bottom` | `env(safe-area-inset-bottom)` | Home indicator clearance |
|
|
9
|
+
| `--poe-safe-area-inset-left` | `env(safe-area-inset-left)` | Left-edge clearance — notch / cutout (e.g. phone in landscape); 0 on most screens |
|
|
10
|
+
| `--poe-safe-area-inset-right` | `env(safe-area-inset-right)` | Right-edge clearance — notch / cutout (e.g. phone in landscape); 0 on most screens |
|
|
11
|
+
|
|
12
|
+
**Use these in place of raw `env(safe-area-inset-*)` whenever you pad against the viewport edge.** The kernel injects the defaults automatically. When the parent app overlays UI on top of the iframe (e.g. a top bar, bottom tab bar, split-view divider), it overrides the relevant variables so the child does not double-pad behind the parent's chrome.
|
|
13
|
+
|
|
14
|
+
## Consuming the variables
|
|
15
|
+
|
|
16
|
+
Always include an `env(...)` fallback for non-platform hosts (third-party embedders, dev servers):
|
|
17
|
+
|
|
18
|
+
```css
|
|
19
|
+
.bottom-bar {
|
|
20
|
+
padding-bottom: var(
|
|
21
|
+
--poe-safe-area-inset-bottom,
|
|
22
|
+
env(safe-area-inset-bottom)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.top-header {
|
|
27
|
+
padding-top: var(--poe-safe-area-inset-top, env(safe-area-inset-top));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Inside a tailwind arbitrary value */
|
|
31
|
+
class="bottom-[calc(1rem+var(--poe-safe-area-inset-bottom,env(safe-area-inset-bottom)))]"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Wrap with `max(..., 0px)` only when you already wrapped the bare `env(...)` value that way — `var(...)` may evaluate to a negative computed value in pathological browser bugs and `max(.., 0px)` guards against that. Most apps just need the bare `var(...)`.
|
|
35
|
+
|
|
36
|
+
**Don't stop at top/bottom — left/right insets are real too.** They're 0 on most screens, but a notch / camera cutout on a *vertical* edge makes them nonzero. The common case is a phone in landscape, where the notch / Dynamic Island rotates into a ~59px side inset mid-screen — exactly where a composer row sits when the keyboard lifts it. Any control pinned near a horizontal viewport edge (send buttons, side toolbars, FABs) needs the same treatment:
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
.composer {
|
|
40
|
+
padding-left: calc(1rem + var(--poe-safe-area-inset-left, env(safe-area-inset-left)));
|
|
41
|
+
padding-right: calc(1rem + var(--poe-safe-area-inset-right, env(safe-area-inset-right)));
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The host zeroes whichever sides its own chrome already covers (e.g. the top bar, or the sidebar in wide two-column layouts), so consuming all four variables is always safe — sides you don't touch cost nothing on devices without obstructions. The app scaffold's `#root` rule already pads all four sides; this matters when you hand-roll layout or pin chrome outside `#root`.
|
|
46
|
+
|
|
47
|
+
## Declaring overrides for a child app
|
|
48
|
+
|
|
49
|
+
If your app nests another app via `<poe-tile>` and draws chrome on top of its iframe, declare the corresponding insets so the child does not pad behind your chrome.
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<!-- Initial value at mount: pass as JSON in an HTML attribute -->
|
|
53
|
+
<poe-tile
|
|
54
|
+
type-id="chat"
|
|
55
|
+
instance-id="123"
|
|
56
|
+
safe-area-insets='{"top":48,"bottom":56}'
|
|
57
|
+
></poe-tile>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// Update at runtime via the JS property — beats the HTML attribute.
|
|
62
|
+
const el = document.querySelector<HTMLElement>("poe-tile")!;
|
|
63
|
+
(el as any).safeAreaInsets = { top: 48, bottom: 56 };
|
|
64
|
+
// Or use the convenience setter exported from the SDK:
|
|
65
|
+
import { setChildSafeAreaInsets } from "joiner-sdk/v1/client.js";
|
|
66
|
+
setChildSafeAreaInsets(el, { top: 48, bottom: 56 });
|
|
67
|
+
// Clear the override (child resumes device env() defaults):
|
|
68
|
+
setChildSafeAreaInsets(el, null);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Each side is a CSS px length (number). Sides omitted from the object fall through to the device `env(safe-area-inset-<side>)` default — partial overrides are supported. Values are validated at the platform boundary: non-finite, negative, or values above 2000px are dropped.
|
|
72
|
+
|
|
73
|
+
Runtime updates are applied without remounting the child iframe — they flow as a `poe:safe-area-insets` postMessage to the child's `contentWindow`, which the child SDK applies inline. Use this for chrome that changes during the session (sidebar open/close, keyboard transitions, orientation flips).
|
|
74
|
+
|
|
75
|
+
## What not to do
|
|
76
|
+
|
|
77
|
+
- ❌ `padding-bottom: env(safe-area-inset-bottom);` — ignores parent-app overlays.
|
|
78
|
+
- ❌ Setting per-side `0` and the others omitted to "force" no inset — omitted sides already fall through to the device default. Set `0` only when you specifically want to override that side to zero.
|
|
79
|
+
- ❌ Posting `poe:safe-area-insets` messages directly from app code — use the `<poe-tile>` setter or `setChildSafeAreaInsets`. The element knows which iframe `contentWindow` to target.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Sandbox restrictions
|
|
2
|
+
|
|
3
|
+
Tiles run in a blob-URL iframe sandboxed with `allow-scripts allow-forms allow-downloads` only. Same-origin, popups, and top-navigation are off, the iframe inherits the host page's Content Security Policy, and the host delegates no permissions-policy feature to it other than `clipboard-write`. Several browser APIs therefore throw, silently fail, or never fire:
|
|
4
|
+
|
|
5
|
+
- **Storage APIs blocked.** `localStorage`, `sessionStorage`, `IndexedDB`, and cookies all throw — there is no `allow-same-origin`. Don't reach for `localStorage` to survive refresh; it won't work. Persist per-user state in a `privateOfUser(self)` table and shared state in a public table.
|
|
6
|
+
- **No requests to third-party hosts, from the client or the server.** See [Network access](#network-access) below. A tile cannot `fetch()` a third-party API, open a WebSocket to a creator-owned server, or load a script, font, or image from an arbitrary host. Outbound work goes through the platform APIs the SDK documents.
|
|
7
|
+
- **Motion and orientation sensors are gated, not blocked.** See [Device sensors](#device-sensors) below: tilt and shake work in the Joiner apps and on mobile web behind the browser's own permission where it has one, never on desktop, so touch controls come first.
|
|
8
|
+
- **No top-level URL navigation.** `window.location.href = …`, `location.assign`, top-level `window.open`, `target="_top"`, and cross-origin `history.pushState` all fail. To switch apps, call `Poe.open({ typeId, instanceId, openProps? })` from `joiner-sdk`. To open an outside web page, call `Poe.openExternalUrl({ url })`; `window.open` and `<a target="_blank">` are blocked because the sandbox has no `allow-popups`.
|
|
9
|
+
- **`window.location.origin` is `"null"`.** Use `Poe.topOrigin` for an absolute host URL.
|
|
10
|
+
- **No cross-frame DOM access.** Reading the parent document or any other frame is blocked. Talk to the host via the SDK's `postMessage` wrappers.
|
|
11
|
+
- **Web Workers work, but only from a blob or data URL.** A worker script has to be embedded in your code, not loaded by path — there is no origin or server behind the iframe, so `new Worker("./worker.js")` and `new Worker(new URL("./worker.ts", import.meta.url))` both fail (the latter with `TypeError: Invalid URL`, and `poeTile()` rejects it at build time). Bundled apps: `import MyWorker from "./worker.ts?worker&inline"` — the `&inline` matters, since a plain `?worker` import compiles to a path nothing serves here (`poeTile()` rejects that at build time too). No-build apps: blob your worker source yourself, or `new Worker((await Poe.bundle.loadAsset("/worker.js")).url)`. Recipes for both are in [Vite Plugin → Web Workers](./vite-plugin.md#web-workers). Use **classic** worker syntax; a module script cannot be fetched from a blob URL here. `SharedWorker` is denied to the opaque origin outright, and `navigator.serviceWorker.register` is blocked. A worker inherits the sandbox, so it has no storage or network of its own. Keep the visible canvas on the main thread and move only the heavy work into the worker: on some Android WebViews, a canvas given to a worker with `transferControlToOffscreen()` intermittently shows nothing. If the drawing must run in a worker, keep the main thread's render-budget loop as the only clock. On each `requestAnimationFrame` tick the main thread calls `budget.shouldRenderFrame(now)` (or `shouldRenderFrame(now, { idle: true })` on a screen where nothing moves, as for any canvas loop); when it returns `true` and no frame is in flight, it posts a draw request to the worker with the buffer size (CSS size times the budget's resolved `pixelRatio`). The worker has no `requestAnimationFrame` loop of its own (in a WebView one can stop firing without an error): on each request it draws to a standalone `new OffscreenCanvas(w, h)` and posts `canvas.transferToImageBitmap()` back in the transfer list. The main thread shows the bitmap inside `budget.renderFrame(() => ctx.transferFromImageBitmap(image))`, where `ctx` is the visible canvas's `getContext("bitmaprenderer")`, and only then may it request the next frame.
|
|
12
|
+
|
|
13
|
+
## Network access
|
|
14
|
+
|
|
15
|
+
A tile cannot reach a host the creator chooses, anywhere its code runs. Direct access to creator-chosen external services is unsupported; use the documented platform APIs instead. This is a deliberate platform boundary, not a missing feature to work around.
|
|
16
|
+
|
|
17
|
+
**Client code (the iframe).** The host page's Content Security Policy applies to the tile frame, and `connect-src` allows only origins the platform itself names (its own pages, `blob:`, `data:`, and a few path-scoped platform services). `fetch()`, `XMLHttpRequest`, `navigator.sendBeacon`, `WebSocket`, `EventSource`, cross-origin form posts, and `<script>`/`<link>`/`<img>` loads are all blocked by the browser when the target is a third-party host. `fetch()` still works against `blob:` URLs from `Poe.bundle.loadAsset()` and against platform URLs such as `store.files.url(...)`. It also works against `data:` URLs, which includes a Vite `?url` import inlined under `assetsInlineLimit`, and `<img>`, `<audio>`, and `<video>` can load one too. Keep inlined files small; load music, video and large bytes with `Poe.bundle.loadAsset()` (see [assets.md](./assets.md)). Bundle every asset the tile needs (see [assets.md](./assets.md)); the only remote images that load are platform-served ones such as `$userInfo` profile pictures and `store.files.url(...)` URLs.
|
|
18
|
+
|
|
19
|
+
**Server code (mutators, actions, hooks).** The backend runtime has no `WebSocket` or `XMLHttpRequest`, and `fetch` is a stub that throws `fetch is unavailable in the QuickJS backend runtime. Use an explicit ctx.platform.call(...) capability instead.` Server code uses `ctx.platform.call(...)` for platform services and synced-store's cross-store APIs to talk to other stores. Neither provides general-purpose HTTP access.
|
|
20
|
+
|
|
21
|
+
| Need | Use |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| Talk to another tile's store | `ctx.externalStore({ storeTypeId, instanceId })` for reads and, in actions, `.action(name, input)`; `ctx.mutateExternal(...)` for writes from mutators (see [external stores](../../synced-store/references/external-stores.md)) |
|
|
24
|
+
| Read deployment settings | `env.get` |
|
|
25
|
+
| Open a web page for the user | `Poe.openExternalUrl({ url })` from client code (the user confirms any destination outside the platform) |
|
|
26
|
+
|
|
27
|
+
There is no fetch proxy, webhook, or allowlist for creator-chosen hosts. A tile that needs a live external data feed (weather, a scoreboard service, a creator's own backend) cannot be built on the platform today. Say so when a creator asks, and offer the closest platform-native design: keep the data in the synced store, bundle a snapshot or let players enter it.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Device sensors
|
|
31
|
+
|
|
32
|
+
The host delegates the `accelerometer`, `gyroscope`, and `magnetometer` permissions-policy features to every tile frame, so `deviceorientation` and `devicemotion` reach a tile in the Joiner apps and on mobile web. They remain gated: iOS requires a permission granted from a tap (the Joiner iOS app grants it for its own pages once its release with that grant ships; an older shell shows WebKit's own prompt once per app launch, and iOS Safari prompts per site), and desktop has no sensors at all. Read the shared [device motion reference](../../poe-tiles-cli/references/device-motion.md) before designing input: touch first, tilt opt-in, and the recipe that treats every gated outcome as "no usable sensor". The apps' native shake-to-report stands down while an integrated tile holds `Poe.motion.claim()` (see [client-api.md](./client-api.md#device-motion)). The Screen Wake Lock API is not delegated, so `navigator.wakeLock.request()` is refused in a tile; the same claim is what keeps the screen on while the player tilts. Vibration feedback is available through `Poe.haptics` (see [client-api.md](./client-api.md#poe-haptics)).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Scaffolded tile folder structure
|
|
2
|
+
|
|
3
|
+
`joiner tiles init` creates this layout. Vite builds `tile/` into `dist/`,
|
|
4
|
+
and `dist/` is the bundle that players download.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
<name>/
|
|
8
|
+
├── tile/ # Vite root: entry point + backend wiring
|
|
9
|
+
│ ├── index.html
|
|
10
|
+
│ ├── public/ # copied to the bundle root as is
|
|
11
|
+
│ │ ├── assets/ # /assets/hero.png; load with Poe.bundle.loadAsset
|
|
12
|
+
│ │ └── deferred/ # optional; large lazy files, uploaded outside the bundle
|
|
13
|
+
│ └── src/
|
|
14
|
+
│ ├── entry.tsx # Poe.setupStore(clientConfig); await store.waitForBootstrap(); render UI
|
|
15
|
+
│ └── backend.ts # re-exports tileBackendConfig as default
|
|
16
|
+
├── assets/ # icon.png from init, plus generated images and audio; copy what ships into tile/public/
|
|
17
|
+
├── dist/ # build output: the tile bundle (gitignored)
|
|
18
|
+
├── synced-store/ # store contract
|
|
19
|
+
│ ├── data/
|
|
20
|
+
│ │ └── items.ts # shared read helpers + table/read ctx types
|
|
21
|
+
│ ├── schema.ts
|
|
22
|
+
│ ├── mutators/
|
|
23
|
+
│ │ ├── index.ts # compose exported mutator map
|
|
24
|
+
│ │ ├── remove-todo.ts
|
|
25
|
+
│ │ ├── set-todo.ts
|
|
26
|
+
│ │ └── types.ts
|
|
27
|
+
│ ├── mutators.test.ts # colocated unit tests
|
|
28
|
+
│ ├── hooks.ts # deterministic membership hooks, shared by client + backend
|
|
29
|
+
│ ├── client-config.ts
|
|
30
|
+
│ └── backend-config.ts
|
|
31
|
+
├── ui/ # store-agnostic components
|
|
32
|
+
│ ├── App.{tsx,ts}
|
|
33
|
+
│ └── App.test.happydom.tsx # colocated UI tests
|
|
34
|
+
├── tests/ # Happy DOM setup/matchers + optional skipped browser examples
|
|
35
|
+
├── scripts/doctor.sh # toolchain health check
|
|
36
|
+
├── client.ts # client-safe re-exports
|
|
37
|
+
├── package.json
|
|
38
|
+
├── tsconfig.json
|
|
39
|
+
├── vite.config.ts
|
|
40
|
+
└── playwright.config.ts
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`init` creates `assets/` with `icon.png`, an optional starter profile picture;
|
|
44
|
+
`.poe-tile.json` has no `profilePicture` until the creator sets one. Image and
|
|
45
|
+
audio generation add files to `assets/`. The creator makes `tile/public/` when
|
|
46
|
+
copying in the first file the tile loads at runtime. See
|
|
47
|
+
[assets.md](./assets.md) for where each kind of asset goes and how to load it,
|
|
48
|
+
and [scaffolding-a-new-app.md](./scaffolding-a-new-app.md) for creating a tile.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Scaffolding a new Joiner tile
|
|
2
|
+
|
|
3
|
+
End-to-end workflow for creating a new app from a natural-language prompt. Scaffold → schema → UI → ship.
|
|
4
|
+
|
|
5
|
+
<a id="scaffolding-a-new-poe-tile"></a>
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1: Scaffold
|
|
10
|
+
|
|
11
|
+
Pass both `<name>` and `--template <t>` explicitly when scaffolding with an agent. Omitting either opens an interactive picker that a non-interactive session cannot answer. Reuse an existing project instead of scaffolding over it; install dependencies inside the scaffolded directory.
|
|
12
|
+
|
|
13
|
+
Pick a template: `react`, `preact`, `solidjs`, `vanilla-js`, `phaserjs`. Pick `phaserjs` for real-time 2D games with sprites, world coordinates, or arcade physics — it ships with the Phaser 3 dep, vite configured to inline assets and dynamic imports for the platform sandbox iframe, and a dynamic-import seam so happy-dom unit tests stay Phaser-free.
|
|
14
|
+
|
|
15
|
+
For a new small interface naturally expressed with ordinary DOM elements, prefer the existing `vanilla-js` template. Use a framework when the interaction benefits from it or the user requests it, and preserve the framework of existing work. Keep all platform behavior, accessibility and visual identity requirements.
|
|
16
|
+
|
|
17
|
+
The `react`, `preact`, and `solidjs` templates ship Tailwind v4 preconfigured (`tailwindcss` + `@tailwindcss/postcss` deps, `postcss.config.js`, `@import "tailwindcss"` in `tile/styles.css`) — utility classes work out of the box. `vanilla-js` and `phaserjs` do not; if you need Tailwind there, wire it up the same way (deps + postcss config + `@import "tailwindcss"` in `tile/styles.css`) before relying on utility classes, otherwise they will silently render as no-op strings.
|
|
18
|
+
|
|
19
|
+
Where Tailwind is already configured, prefer its utilities for routine layout, spacing, typography, responsive styling and theme colors. Keep complete class names visible in source; reserve custom CSS for behavior or visuals utilities do not express clearly. Preserve the setup, safe areas, root scrolling, native gestures, focus states and touch targets. Choose the tile's own palette, typography and composition; this is reuse of styling tools, not a shared visual template. Use existing CSS when Tailwind is absent rather than adding it just for this preference.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
joiner tiles init <name> --template <t>
|
|
24
|
+
cd <name> && bun install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`<name>` becomes the publish handle, which is unique per creator and hard to change once a session is bound to it — so use the kebab-case base derived from the prompt plus a short random suffix (`zombie-runner-k4x7`). A bare descriptive handle collides with, or silently republishes over, an earlier tile from a similar prompt. The handle never has to be pretty: `displayName` (Step 5.5) replaces it on every user-facing surface.
|
|
28
|
+
|
|
29
|
+
### Generated files
|
|
30
|
+
|
|
31
|
+
See [scaffolded-tile-folder-structure.md](./scaffolded-tile-folder-structure.md)
|
|
32
|
+
for the layout the scaffold creates and where assets go.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Step 2: Schema and mutators
|
|
38
|
+
|
|
39
|
+
Read `@../synced-store/SKILL.md` **now** before continuing — Step 2 depends on it.
|
|
40
|
+
|
|
41
|
+
**Walk every cross-turn / cross-player handoff and pick a visibility tier per piece of state.** Skipping this is the #1 cause of mid-implementation rewrites.
|
|
42
|
+
|
|
43
|
+
Tiers:
|
|
44
|
+
- **Public** (`ctx.table(...)`) — synced to everyone in the instance.
|
|
45
|
+
- **Per-user private** (`ctx.privateOfUser(userId).table(...)`) — role/user-specific (active player's input, in-flight LLM prompt, drafts).
|
|
46
|
+
- **Server-only** (`ctx.serverOnly().table(...)`) — secrets the server uses but never exposes (answer keys, RNG seeds).
|
|
47
|
+
|
|
48
|
+
Don't design around tiers with client-side hiding/encryption — synced-store enforces at the server boundary.
|
|
49
|
+
|
|
50
|
+
**Before writing schema, classify every table as bounded or unbounded and state its primary read shape.** When unbounded data is mostly presented as one ordered list (for example, chronological message/activity history or a newest-first social/photo feed), every accumulating row must have a nonempty `sortKey`; choose its namespace and ordering direction now even if the first UI does not yet paginate. A safety cap or quota does not make a naturally accumulating history bounded for this decision. Keep small always-needed rows at the empty sort key (`sortKey: ""`) so they load eagerly. Eager rows and lazily loaded sort-key rows can always coexist in the same store. Read [@../../synced-store/references/sort-keys.md](../../synced-store/references/sort-keys.md) for generation and pull windows.
|
|
51
|
+
|
|
52
|
+
**Before writing schema**, list every table with its tier AND every cross-player handoff with the table backing it; state the design to the user for confirmation. For turn-based games answer:
|
|
53
|
+
- Active player's view this turn? → typically `privateOfUser(activePlayer)` written by the prior player's mutator.
|
|
54
|
+
- Mid-turn state surviving refresh (e.g. in-flight bot call)? → `privateOfUser(self)`, NOT sessionStorage / component state.
|
|
55
|
+
- Hidden during play, revealed at end? → `serverOnly()` during play, copied to public on reveal.
|
|
56
|
+
- Stalled turn policy? → ask whether the game should wait indefinitely or let another player activate a skip after an inactivity deadline. If skippable, confirm the tile-specific duration and result of skipping before designing the schema; do not assume that a seconds-long party game and a many-hours asynchronous game share a timeout.
|
|
57
|
+
- Player leaves the room? → distinguish explicit membership removal from closing the tile or disconnecting, which must preserve resumable state. Decide whether `onRemoveUser` can remove the seat and repair turn order, teams, and win conditions without breaking fairness. If not, model a durable resolution state where the remaining players choose a new match or a game-specific alternative; do not silently choose for them.
|
|
58
|
+
|
|
59
|
+
If any answer is "figure out later," figure it out now.
|
|
60
|
+
|
|
61
|
+
Either keep generic `app*` names (simplest) or rename across `synced-store/*` + `client.ts` + `tile/src/entry.{tsx,ts}` + `tile/src/backend.ts` + `ui/App.{tsx,ts}` together.
|
|
62
|
+
|
|
63
|
+
Lift **patterns** from a reference app, not code: lobby+slot shape, add/remove hooks (wired in `backend-config.ts`; reference apps still use the deprecated `onAddUsers`, so write `onAddUsersV2` instead), turn-validation order (throw BEFORE `if (!ctx.isServer) return`), `entries().toArray()` returning `[EntryKey, T]` with `EntryKey.itemKey: string`, `store.query(tx => tx.userId)` for user id.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Step 3: UI
|
|
68
|
+
|
|
69
|
+
Replace the stub in `ui/App.{tsx,ts}`.
|
|
70
|
+
|
|
71
|
+
- `App` receives `{ store }` prop. `store.subscribe()` for reads, `store.mutate.<name>()` for writes.
|
|
72
|
+
- For the framework-specific React, Preact, SolidJS, Vanilla JS, and Phaser binding, follow the [compact multiplayer API recipe](./multiplayer-api-recipe.md#5-bind-the-shared-reader-to-the-scaffold).
|
|
73
|
+
- Do not create another Poe client in the UI. Pass `store` and, when host RPCs
|
|
74
|
+
are needed, the entry point's real `Poe` object as props. Import only the
|
|
75
|
+
scaffold's framework adapter (`v1/react` or `v1/solid`) directly in UI code.
|
|
76
|
+
- `store.userId` is not exposed at the top level. Read via `store.query(async (tx) => tx.userId)`.
|
|
77
|
+
- `store.subscribe(tx => tx.table("foo").entries().toArray(), entries => ...)` returns `Array<[EntryKey, T]>`. Destructure as `[k, v]`, key is `k.itemKey` (NOT `as string`).
|
|
78
|
+
- Subscription queries track only exact keys and scan prefixes read through `tx`; changing a value captured outside `tx` does not invalidate the query. Keep the returned `SubscriptionControl`, call `await subscription.refresh()` after such a change, and call `subscription()` to unsubscribe during cleanup. `subscribeToTable()` returns the same control shape.
|
|
79
|
+
- Keep the scaffold's `applyNativeAppGestureOverrides()` startup call for every player-facing tile. Remove it only when free text selection is a primary feature of a document-like or text-heavy tile.
|
|
80
|
+
- No tile may show the iOS magnifier loupe. Before choosing interaction handlers, inventory every non-scrolling surface where a finger may pause or drag (board, canvas, rack, card/piece field, joystick, control pad, HUD, buttons, menus, overlays). Apply `suppressLongPressMagnifier(element)` even if the tile has no explicit hold gesture: slow taps enter the same iOS WebKit selection gesture. Use `{ preserveTaps: true }` only when descendant taps depend on `click`; never suppress a native scroller, form field, or navigation link.
|
|
81
|
+
- **Avatars + names from `$userInfo`.** Pull from the `$userInfo` system table — never raw user IDs. Pair `$users` membership with `$userInfo` lookup. Subscribe once, build `Map<userId, PoeUserInfo>`:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
// PoeUserInfo (from @poe/synced-store-system-mutators): { userId, username, displayName, profilePicture, isDev? }
|
|
85
|
+
// displayName / profilePicture are required strings but may be EMPTY — always fall back.
|
|
86
|
+
store.subscribe(
|
|
87
|
+
(tx) => tx.table("$userInfo").entries().toArray(),
|
|
88
|
+
(entries) => {
|
|
89
|
+
const next = new Map<string, PoeUserInfo>();
|
|
90
|
+
for (const [, v] of entries) next.set((v as PoeUserInfo).userId, v as PoeUserInfo);
|
|
91
|
+
setUserInfo(next);
|
|
92
|
+
},
|
|
93
|
+
);
|
|
94
|
+
// <img src={info.profilePicture || PLACEHOLDER} alt={info.displayName || info.username} />
|
|
95
|
+
// Name fallback: displayName, then username, then a NEUTRAL label ("Player") —
|
|
96
|
+
// never the raw userId. A not-yet-resolved member profile can carry internal
|
|
97
|
+
// ids (`u_<hex>` / `private-...`) in displayName/username; skip those too:
|
|
98
|
+
// const usable = [info?.displayName, info?.username].find(
|
|
99
|
+
// (v) => v && !/^u_[0-9a-f]{32}$/.test(v) && !v.startsWith("private-"),
|
|
100
|
+
// );
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Use `||` not `??` so empty strings fall through.
|
|
104
|
+
|
|
105
|
+
Once the UI is functionally complete, finish required listing metadata and
|
|
106
|
+
publish immediately. There is no authorization step and nothing to carry
|
|
107
|
+
across from one: a publish always creates an unlisted tile, and listing it
|
|
108
|
+
publicly is a separate step you mention in one sentence beside the preview
|
|
109
|
+
link, never a question you ask. The profile picture is part of that first
|
|
110
|
+
publish; gallery screenshots and video are the only separate gate, deferred
|
|
111
|
+
in Step 5.5 until the user is ready to present the tile as finished.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Step 5.5: Fill in app metadata
|
|
116
|
+
|
|
117
|
+
Complete text metadata. `displayName` is a nonempty string of at most 80 characters and `shortDescription` is a nonempty string of at most 140. Player-count keys are `players.min` and `players.max`; use positive integers and omit an unbounded maximum. `instancing` is the string `"per-launch"` for separate launches or `"per-context"` for reuse within the launch context, not an object. Preserve the generated handle and SDK pin unless the host or requested change requires otherwise.
|
|
118
|
+
|
|
119
|
+
**Fill in the listing-page metadata yourself — do not ask the user.** The scaffold ships text fields as `TODO` placeholders and cannot infer the supported player count. Derive every value from what the app actually does (its `synced-store/schema.ts`, `ui/App.*`, and the original prompt). After this step there must be zero literal `TODO` strings in the text metadata.
|
|
120
|
+
|
|
121
|
+
1. **`.poe-tile.json` → `displayName`** — a **placeholder summary name**, not a final title: "New" plus the kind of tile the prompt asked for — `"New Zombie Tile"`, `"New Strategy Tile"`, or plain `"New Tile"` when the prompt names no theme. Do not invent a real name here: the user names the tile only when they ask to list it publicly — that is the moment you propose a real title (see Step 6) — and a name they supplied at any point always wins over the placeholder. The placeholder is what the launch-link preview shows, so it should still summarize the tile; it need not be unique — the handle and tile ID carry uniqueness.
|
|
122
|
+
|
|
123
|
+
2. **`README.md`** — long description rendered on the app's landing page. Rewrite the scaffold stub as a **short, player-facing description**: 2–4 sentences of prose, written for someone deciding whether to play, derived from the app's actual behaviour (schema/UI). Just the title + the paragraph — **no** `## What you can do` bullet list and **no** `## Built on Synced-Store` section. Keep under 16 KiB UTF-8.
|
|
124
|
+
|
|
125
|
+
3. **`.poe-tile.json` → `shortDescription`** — replace the placeholder with one specific sentence (≤140 chars). Say what the user does in the app, not what the app "is for". Examples: *"Online chess for two players."*, *"Shared todo list synced across devices."*, *"Real-time multiplayer draw-and-guess party game."* Avoid leading filler like *"An app to…"*.
|
|
126
|
+
|
|
127
|
+
4. **`.poe-tile.json` → `players`** — for every game or participant-count-sensitive tile, declare the supported player-count facet. Count total seats, including humans and AI; derive the values from the rules and capacity the app actually implements, not the number of people currently in the room or a test fixture.
|
|
128
|
+
|
|
129
|
+
- Set `min` to the fewest participants needed for a meaningful session.
|
|
130
|
+
- Set `max` only when the rules, board, seats, or validated performance impose a real creator-declared upper bound. For an exact two-player game, use `{ "min": 2, "max": 2 }`. When the implementation has no upper bound, omit `max`: `{ "players": { "min": 1 } }` is shown as `1+`. Never substitute the schema or platform ceiling, which would turn an uncapped tile into a misleading finite range.
|
|
131
|
+
- Add `recommended: { min, max }` only when a narrower range is materially better than the full supported range (for example, a party game that supports 3–12 but plays best with 5–8). Keep it within the supported range.
|
|
132
|
+
- Omit `players` for utilities where participant count does not describe the experience. Do not publish `players: null` for a new tile; `null` is only the explicit clear sentinel when republishing an existing tile.
|
|
133
|
+
- This field also decides testability, not just the listing page: a tile the range calls multiplayer gets a **multiplayer simulation** link in upload output and in the Creator chat receipt, opening `recommended.min` (else `min`) dev-user phones already inside the tile. See [cli.md](cli.md#tiles-upload-output).
|
|
134
|
+
|
|
135
|
+
5. **Leave discovery categories to the platform.** Do not add a `categories` field to `.poe-tile.json`. Use schema v10; when editing older source, remove the obsolete top-level field before publishing. Single-player / Multiplayer remain derived from the supported `players` range.
|
|
136
|
+
|
|
137
|
+
Generate the profile picture automatically before the first publish; do not ask for permission or wait for public-publish authorization. Keep an existing icon during edit drafts; when finalizing an update to an already-public tile, regenerate it automatically only when it is missing or materially stale.
|
|
138
|
+
|
|
139
|
+
In a Creator session, where the `generate_image` tool is present, make the icon with the `image-generation` skill's **Icon** section before you end any turn that invites public listing — for an integrated prototype, in staging before `promote_conversion` — so the creator sees it before they publish, and do not run `regenerate-screenshot` for it. That section replaces item 6's image work, and `publish` checks it again at listing. When finalizing an update to a tile that is already public, make a missing or materially stale icon with `generate_image` and the recipe in the `image-generation` skill's **Icon** section. Outside a Creator session, item 6 applies as written.
|
|
140
|
+
|
|
141
|
+
Create screenshots only when the user is ready to present the tile as finished, or when finalizing an update to an established tile. Visibility does not mark this boundary: the gate is the user's readiness to present the tile as finished. At that point, ask whether they want the optional, more expensive video work before starting it.
|
|
142
|
+
|
|
143
|
+
In a Creator session, the `publish` skill owns the gallery screenshots of item 7. It captures missing ones when it lists or promotes the tile, and asks before it replaces ones that look stale. Do not capture them at readiness there unless the creator asks. Outside a Creator session, item 7 applies as written.
|
|
144
|
+
|
|
145
|
+
6. **`.poe-tile.json` → `profilePicture`** — before the first publish, commit a square image that reflects the tile's actual theme and visual identity, then point `profilePicture` at the committed PNG/JPG/WEBP file (≤512 KB). Do not leave the scaffold's starter image or omit the field.
|
|
146
|
+
|
|
147
|
+
The scaffold ships a generator for this — **do not hand-roll a screenshot script**. `bun run regenerate-screenshot` builds the app, boots it in a square 360×360 viewport at 2× DPR, and writes a 720×720 `assets/screenshot.png`; point `profilePicture` at that file. It drives `tests/screenshot.test.playwright.ts`, which is skipped in the normal test suite and exists only to produce this asset. It needs a Playwright browser, so run `bunx playwright install chromium` first if you have never done so in this environment.
|
|
148
|
+
|
|
149
|
+
Prefer a first frame that actually reads as the tile: set up whatever board, lobby, or start state best represents it before the capture rather than shipping an empty screen.
|
|
150
|
+
|
|
151
|
+
**The icon art must be full-bleed: a square image with opaque, edge-to-edge artwork — no baked-in rounded corners, no transparent margin, no framing border.** The listing/detail card renders the icon with `object-cover` inside an `overflow-hidden` rounded shell, so the *card* supplies the rounded corners. An icon that bakes in its own rounded background (transparent corners around a rounded rect) renders as a rounded card inside the card's rounding → a visible "double-rounded", inset look, unlike well-behaved tiles whose square art rounds cleanly at the card edge. A `regenerate-screenshot` capture is already full-bleed; just make sure the captured state fills the frame.
|
|
152
|
+
|
|
153
|
+
If the tile's UI itself is the strongest icon, generate a 720x720 square UI capture with `bun run regenerate-screenshot`, update `.poe-tile.json → profilePicture` to `./assets/screenshot.png`, and commit the file. The test loads the tile inside the iframe sandbox and writes that file. If the default `body` readiness check produces a blank or half-rendered image, edit `tests/screenshot.test.playwright.ts` to wait for a specific selector (matching what the existing `e2e.test.playwright.ts` waits for is usually the right move). For canvas/3D apps, expose a deterministic scene-ready marker after the first rendered frame and wait for that marker. Re-run after meaningful UI changes only if the screenshot is being used as `profilePicture`.
|
|
154
|
+
|
|
155
|
+
**Mobile viewport / DPR.** The scaffold sets `viewport: { width: 360, height: 360 }, deviceScaleFactor: 2`. The CSS viewport stays under Tailwind's `sm` breakpoint (640px) so apps render their true mobile layout (single column, no desktop side-panels), while the 2x DPR still produces a 720x720 PNG. Do not raise the CSS width to 720+ to "see more" — that triggers `sm:`/`md:` styles and the captured image will misrepresent the mobile app.
|
|
156
|
+
|
|
157
|
+
7. **`.poe-tile.json` → `screenshots`** — when the user is ready to present the tile as finished, capture and commit 1–3 representative gallery images (each PNG/JPG/WEBP ≤512 KB), then add their ordered paths to the manifest. At least one image must show genuine gameplay or a meaningfully populated primary state — not merely a title screen, empty lobby, pristine starting board, or first frame. Add a setup/start image only when it explains something the in-action image cannot. For an established tile, update only missing or materially stale screenshots.
|
|
158
|
+
|
|
159
|
+
8. **`.poe-tile.json` → `video` (optional)** — when the user is ready to present the tile as finished, explain that video work costs more than screenshots. Ask whether they want a preview video and poster before creating them. If they decline, continue publishing without new video work. If they accept, capture a representative 10–15 second muted gameplay loop as a local MP4 (≤8 MB), create a local poster image (PNG/JPG/WEBP, ≤512 KB), set `video` to `{ "src": "<path>", "poster": "<path>" }`, and use `$schema` v6 or later. For an already-public tile, ask only when its video is missing or materially stale; never create or regenerate it without an explicit yes.
|
|
160
|
+
|
|
161
|
+
While iterating, complete item 6 and defer items 7–8 until the user is ready to present the tile as finished — visibility does not mark this boundary, so the gate is the user's readiness to present the tile as finished. Only after that proceed to Step 6.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Step 6: Publish
|
|
166
|
+
|
|
167
|
+
**Publishing is your HOST's, not this step's.** If your system prompt says how
|
|
168
|
+
publishing works here — who uploads, when, and what the creator's buttons do —
|
|
169
|
+
follow it and skip the rest of this step; a host that publishes for you records
|
|
170
|
+
a duplicate version for every upload you run yourself. The commands below are
|
|
171
|
+
for a creator driving the CLI with no such host. See
|
|
172
|
+
[publishing.md](publishing.md) for the full mechanics.
|
|
173
|
+
|
|
174
|
+
Build + publish using a browser-login session from `joiner login`. Publish every iteration:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
cd <app-dir> && bun run publish-to-poe-tiles -- --change-summary "<concise user-facing summary>"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Publishing never sets visibility.** A tile is unlisted when first published and stays wherever it is on every publish after that, so iterating can never move it in or out of discovery.
|
|
181
|
+
|
|
182
|
+
Listing it is a separate, explicit command, never a question you ask them, and only ever run on their request:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
joiner tiles visibility <tileHandleOrId> public
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Use `unlisted` to take it back out. Unlisting removes a live tile from discovery and the user does not necessarily see it happen, so never run it as a step in ordinary iteration.
|
|
189
|
+
|
|
190
|
+
If publishing reports missing auth, run `joiner login` in the background, post the approval URL it prints as a clickable markdown link along with its `Enter code:` value, and wait for the user to approve the browser prompt. Do not ask first-time creators to paste a Poe API key into chat. `POE_TILES_SESSION_TOKEN` and legacy API keys are still supported for automation, but they are not the primary creator path.
|
|
191
|
+
|
|
192
|
+
Report the `appUrl` from the output as a clickable markdown link the user can try.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Final step: Report
|
|
200
|
+
|
|
201
|
+
Tell the user what was built and where the project lives. Hand them the preview link.
|
|
202
|
+
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Simulations from the CLI
|
|
2
|
+
|
|
3
|
+
External harnesses and creator agents can create a simulation and capture its
|
|
4
|
+
state with the same platform snapshot action used by the Creator's **Send debug
|
|
5
|
+
info to agent** flow. These commands use the signed-in creator's account; no
|
|
6
|
+
admin credential is required. Run `joiner login` first. Creator-scoped publish
|
|
7
|
+
tokens (`cst_` / `cv2_`) cannot replace a user session for these commands.
|
|
8
|
+
|
|
9
|
+
## Upload → create → capture
|
|
10
|
+
|
|
11
|
+
From your tile workspace, with Bun and `jq` installed:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
joiner login
|
|
15
|
+
bun run build
|
|
16
|
+
|
|
17
|
+
# Keep harness artifacts outside the source bundle.
|
|
18
|
+
SIM_RUN_DIR="$(mktemp -d)"
|
|
19
|
+
joiner --json tiles upload > "$SIM_RUN_DIR/upload.json"
|
|
20
|
+
|
|
21
|
+
# Pin this simulation to the exact uploaded version.
|
|
22
|
+
SIM_TYPE_ID="$(jq -er '.id + "~v-" + (.versionNumber | tostring)' "$SIM_RUN_DIR/upload.json")"
|
|
23
|
+
joiner --json simulations create "$SIM_TYPE_ID" > "$SIM_RUN_DIR/simulation.json"
|
|
24
|
+
SIM_INSTANCE_ID="$(jq -er '.instanceId' "$SIM_RUN_DIR/simulation.json")"
|
|
25
|
+
|
|
26
|
+
joiner --json simulations list "$SIM_TYPE_ID"
|
|
27
|
+
joiner simulations debug "$SIM_TYPE_ID" "$SIM_INSTANCE_ID" \
|
|
28
|
+
--out "$SIM_RUN_DIR/debug.json"
|
|
29
|
+
|
|
30
|
+
# A harness should check both flags before treating the capture as exhaustive.
|
|
31
|
+
jq -e '.complete and .store.consistent' "$SIM_RUN_DIR/debug.json"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
An upload records a version. On an existing tile, whether it also advances
|
|
35
|
+
`live` depends on Auto-Advance Live. To keep an existing live version fixed,
|
|
36
|
+
run `joiner tiles auto-advance <tileHandleOrId> off` before uploading.
|
|
37
|
+
|
|
38
|
+
`create` always creates a fresh simulation and seeds test players according to
|
|
39
|
+
the tile's declared player range. It initializes server state; it does not open
|
|
40
|
+
a browser or automatically play the tile. Your UI or external harness still
|
|
41
|
+
drives player interactions. To inspect an existing simulation, use `list` and
|
|
42
|
+
pass its `typeId` and `instanceId` to `debug`.
|
|
43
|
+
|
|
44
|
+
## Select the build and instance
|
|
45
|
+
|
|
46
|
+
All three commands take a **type ID**, not a tile handle:
|
|
47
|
+
|
|
48
|
+
| Type ID | Build selection |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `<tileId>` | The tile's live build |
|
|
51
|
+
| `<tileId>~v-<versionNumber>` | A fixed uploaded version |
|
|
52
|
+
| `<tileId>~c-<channel>` | A custom channel, such as `beta` |
|
|
53
|
+
|
|
54
|
+
Use `tiles get <tileHandleOrId>` to find a tile's ID. For a custom channel:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
joiner tiles set-channel <tileHandleOrId> beta <versionNumber> --no-auto-advance
|
|
58
|
+
joiner --json simulations create '<tileId>~c-beta'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Listing is scoped to the **exact** type ID: bare, version-scoped, and
|
|
62
|
+
channel-scoped simulations have separate lists. `debug` takes the tile's
|
|
63
|
+
`instanceId`, not its wrapping `containerId` or paired chat's `room.instanceId`.
|
|
64
|
+
The selected build must have a backend; a client-only build cannot run this
|
|
65
|
+
simulation flow.
|
|
66
|
+
|
|
67
|
+
## Debug output
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
joiner simulations debug <typeId> <instanceId> > debug.json
|
|
71
|
+
joiner --json simulations debug <typeId> <instanceId> --out debug.json
|
|
72
|
+
joiner simulations debug <typeId> <instanceId> --max-bytes 1048576 --timeout-ms 30000
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Without `--out`, stdout is the JSON document even without `--json`. With `--out`,
|
|
76
|
+
the CLI creates a new file with owner-only filesystem permissions and refuses
|
|
77
|
+
to overwrite an existing file. `--json --out` prints a receipt containing
|
|
78
|
+
`path`, `complete`, and `consistent` instead of printing the captured rows.
|
|
79
|
+
|
|
80
|
+
The document contains `version: 1`, `generatedAt`, `takenBy`, `build`, `target`,
|
|
81
|
+
`store`, `seats`, `limits`, and `complete`. Each seat has public rows and that
|
|
82
|
+
test player's private rows, labelled by visibility. The server selects seats
|
|
83
|
+
from the caller and their active test players. Server-only rows are excluded.
|
|
84
|
+
The simulation owner can capture without joining the tile instance. This
|
|
85
|
+
command does not grant access to other creators' simulations or real players'
|
|
86
|
+
private state.
|
|
87
|
+
|
|
88
|
+
`store.consistent` means the returned data was read at a consistent store and
|
|
89
|
+
schema version. `complete` means no seat was truncated by the byte budget.
|
|
90
|
+
Partial or inconsistent captures are still written, with a warning on stderr;
|
|
91
|
+
the command succeeds so a harness can inspect them. Check both flags, and
|
|
92
|
+
retry after activity settles if consistency is required. Increase the budget
|
|
93
|
+
within the supported range if the capture is incomplete.
|
|
94
|
+
|
|
95
|
+
`--max-bytes` defaults to **4,194,304 UTF-8 bytes** and accepts integers from
|
|
96
|
+
**262,144 through 4,194,304**. It bounds the server's compact snapshot JSON;
|
|
97
|
+
document metadata and stdout formatting add bytes. `--timeout-ms` defaults to
|
|
98
|
+
30,000 for each WebSocket open/response wait. Authentication, access, transport,
|
|
99
|
+
and file-write failures exit nonzero.
|
|
100
|
+
|
|
101
|
+
The state fields match the Creator snapshot document. A terminal capture has
|
|
102
|
+
no browser kernel/SDK version, user agent, console logs, or screenshot, and does
|
|
103
|
+
not send an attachment to an agent automatically. Pass the saved JSON to your
|
|
104
|
+
agent using your harness's usual attachment mechanism.
|
|
105
|
+
|
|
106
|
+
The CLI captures through the existing user-router WebSocket action protocol.
|
|
107
|
+
Use `simulations debug` for this flow: `stores action ... poeDebugSnapshot`
|
|
108
|
+
uses REST, whose current result serialization cannot carry this snapshot.
|
|
109
|
+
|
|
110
|
+
## Programmatic use
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
const simulation = await client.simulations.create(typeId);
|
|
114
|
+
const inventory = await client.simulations.list(typeId);
|
|
115
|
+
const debug = await client.simulations.debug({
|
|
116
|
+
typeId: simulation.typeId,
|
|
117
|
+
instanceId: simulation.instanceId,
|
|
118
|
+
maxBytes: 4_194_304,
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
These methods throw on failure. `create` returns the tile coordinates, paired
|
|
123
|
+
chat, container coordinates, and test-player identities. `list` returns
|
|
124
|
+
`sandboxes` and `buildHasBackend`. See [CLI overview](cli.md#programmatic-usage)
|
|
125
|
+
for client construction and authentication.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# SyncedStore Quick Reference
|
|
2
|
+
|
|
3
|
+
How the client and backend configs connect to give you a fully typed synced-store app.
|
|
4
|
+
|
|
5
|
+
## The Two Configs
|
|
6
|
+
|
|
7
|
+
Every bundled app has two configs — one for the client (runs in the browser) and one for the backend (runs on the server). Both are derived from the same schema.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
schema.ts ──→ defineBackendConfig() ──→ backend-config.ts (server)
|
|
11
|
+
│
|
|
12
|
+
└──────→ defineClientConfig() ──→ client-config.ts (browser)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### `defineBackendConfig()` — Server Side
|
|
16
|
+
|
|
17
|
+
Import from [`joiner-sdk/v1/backend.js`](./backend-api). Bundles schema + mutators + actions + hooks. Platform system tables and hooks are auto-wired.
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { defineSchema, table, defineBackendConfig } from "joiner-sdk/v1/backend.js";
|
|
21
|
+
import { z } from "zod";
|
|
22
|
+
import { TILE_SCHEMA_VERSION } from "./tile-schema-version";
|
|
23
|
+
|
|
24
|
+
const schema = defineSchema({
|
|
25
|
+
schemaVersion: TILE_SCHEMA_VERSION,
|
|
26
|
+
tables: { items: { schema: table(z.object({ text: z.string() })) } },
|
|
27
|
+
mutators: { addItem: { input: z.object({ text: z.string() }) } },
|
|
28
|
+
actions: {},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const backendConfig = defineBackendConfig({
|
|
32
|
+
schema,
|
|
33
|
+
mutators: { addItem: async (ctx, input) => { /* ... */ } },
|
|
34
|
+
actions: {},
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### `defineClientConfig()` — Client Side
|
|
39
|
+
|
|
40
|
+
Import from [`joiner-sdk/v1/client.js`](./client-api.md). Bundles mutators and client-safe system hooks (no schema or Zod at runtime). Use a **type-only** import of the schema to get full type inference without bundling Zod (~280KB).
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { defineClientConfig } from "joiner-sdk/v1/client.js";
|
|
44
|
+
import type { schema } from "./schema"; // type-only!
|
|
45
|
+
import { myMutators } from "./mutators/index";
|
|
46
|
+
import { myClientHooks } from "./hooks";
|
|
47
|
+
import { TILE_SCHEMA_VERSION } from "./tile-schema-version";
|
|
48
|
+
|
|
49
|
+
export const clientConfig = defineClientConfig<typeof schema>({
|
|
50
|
+
mutators: myMutators,
|
|
51
|
+
hooks: myClientHooks,
|
|
52
|
+
schemaVersion: TILE_SCHEMA_VERSION,
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Register every hook that the backend declares here too. `poe-tiles-kernel` only supplies optimistic startup invocations for hook names that the app exposes in its client config. If a hook has server-only effects, export a shared deterministic helper for the client and backend configs, then keep the server-only tail in `backend-config.ts` or behind `if (ctx.isServer)`.
|
|
57
|
+
|
|
58
|
+
Both sides read `TILE_SCHEMA_VERSION` from a single zero-dep file (`synced-store/tile-schema-version.ts`) so the version can never drift between client and server.
|
|
59
|
+
|
|
60
|
+
Then in your app entry:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { createPoe, PostMessageEnvironment } from "joiner-sdk/v1/client.js";
|
|
64
|
+
|
|
65
|
+
const Poe = createPoe({ environment: new PostMessageEnvironment() });
|
|
66
|
+
const store = Poe.setupStore(clientConfig);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## System Tables
|
|
70
|
+
|
|
71
|
+
Joiner tiles automatically get three system tables, accessible via `ctx.table()` in mutators and actions:
|
|
72
|
+
|
|
73
|
+
| Table | Type | Description |
|
|
74
|
+
|-------|------|-------------|
|
|
75
|
+
| `$users` | `UserMembership` | Members of the store instance |
|
|
76
|
+
| `$userInfo` | `PoeUserInfo` | Profile info (name, avatar, etc.) |
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// Read system tables like any other table
|
|
80
|
+
const members = await ctx.table("$users").entries().toArray();
|
|
81
|
+
const myInfo = await ctx.table("$userInfo").get(userId);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
These are managed by the platform — your app reads them but doesn't write to them directly. User lifecycle events are handled via [system hooks](./backend-api.md#system-hooks).
|
|
85
|
+
|
|
86
|
+
## Further Reading
|
|
87
|
+
|
|
88
|
+
- [API Patterns](../../synced-store/references/api-patterns.md) — Schema, mutators, configs, entry wiring
|
|
89
|
+
- [Mutator Rules](../../synced-store/references/mutator-rules.md) — Toggle-free writes, external IDs, read-before-write
|
|
90
|
+
- [Actions](../../synced-store/references/actions.md) — Server-only operations (cross-store calls; no direct HTTP)
|
|
91
|
+
- [Client API Reference](../../synced-store/references/client-api-reference.md) — `SyncedStoreClient` API (query, subscribe, mutate)
|
|
92
|
+
- [Platform](../../synced-store/references/platform.md) — Server-side capabilities in actions
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Error codes and failure modes you may hit while building a tile, indexed by
|
|
4
|
+
the literal string you're looking at. Each entry says what it means, what the
|
|
5
|
+
user experiences, and what your tile should do.
|
|
6
|
+
|
|
7
|
+
## "This API doesn't exist" / TypeScript can't find a method the docs describe
|
|
8
|
+
|
|
9
|
+
These docs describe the **latest** published SDK. If TypeScript (or a runtime
|
|
10
|
+
`undefined is not a function`) says a documented method doesn't exist, your
|
|
11
|
+
app's `joiner-sdk` pin predates the API — see
|
|
12
|
+
[Upgrading an existing app's SDK](cli.md#upgrading-the-sdk-in-an-existing-app).
|
|
13
|
+
Newer API sections in the [client API reference](client-api.md) carry an
|
|
14
|
+
*Added <date>* note you can compare against your pin's `publishedAt`
|
|
15
|
+
date.
|
|
16
|
+
|
|
17
|
+
## Build or publish failures on an older scaffold
|
|
18
|
+
|
|
19
|
+
If your app has no `publish-to-poe-tiles` script, your `vite.config.ts`
|
|
20
|
+
imports `poeApp` and fails to build, or publishes 404 — your app predates the
|
|
21
|
+
platform rename. Work through
|
|
22
|
+
[Migrating a pre-rename app](migrating-pre-rename-tiles.md).
|