@genex-ai/cli-demo 1.34.8-dev.721 → 1.34.9-dev.723

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "1.34.8-dev.721",
3
+ "version": "1.34.9-dev.723",
4
4
  "description": "Set up your project's agent workspace (.claude/.codex/.cursor in the game folder), authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -130,13 +130,13 @@ Durable state + leaderboards (all six are safe to call from boot — they wait
130
130
  for identity internally, never throw for guests, and reject only when the
131
131
  session is blocked):
132
132
 
133
- - `loadPlayerState()` → `Promise<{ data, version, guest? }>` — THIS player's
134
- own save (per-player, per-game; other players can never read or overwrite
135
- it). `{ data: null, version: 0 }` when they never saved.
133
+ - `loadPlayerState()` → `Promise<{ data, version, guest?, staging? }>` — THIS
134
+ player's own save (per-player, per-game; other players can never read or
135
+ overwrite it). `{ data: null, version: 0 }` when they never saved.
136
136
  - `savePlayerState(data, { ifVersion? }?)` → `Promise<{ saved, version?,
137
- conflict?, guest?, queued? }>` — save any JSON ≤ 256KB to their slot. For
138
- guests the value is QUEUED in memory and auto-flushed if they sign in
139
- mid-game — no extra code. Small saves survive tab close automatically.
137
+ conflict?, guest?, queued?, staging? }>` — save any JSON ≤ 256KB to their
138
+ slot. For guests the value is QUEUED in memory and auto-flushed if they sign
139
+ in mid-game — no extra code. Small saves survive tab close automatically.
140
140
  - `loadWorldState()` / `saveWorldState(data, { ifVersion? }?)` — the game's
141
141
  ONE shared world slot (≤ 1MB, every player reads/writes the same blob) —
142
142
  level layouts, persistent-world object positions. Multiplayer games: only
@@ -156,6 +156,17 @@ Server write limits (per player, per minute): **60 player-saves, 120
156
156
  world-saves, 30 score submits**. A debounced ~1/sec checkpoint never gets near
157
157
  them — only a save-per-frame loop does (it surfaces as HTTP 429).
158
158
 
159
+ **The preview channel has no server saves.** The owner's draft workspace and
160
+ every `preview--<slug>` URL play the STAGING build, and the API refuses loads
161
+ and saves there by design (a staging build with a changed save schema must
162
+ never overwrite the save of the game people are playing). The helpers resolve
163
+ `{ staging: true }` — `loadPlayerState()` → `{ data: null, version: 0,
164
+ staging: true }`, `savePlayerState()` → `{ saved: false, staging: true }` —
165
+ and never throw or fire `"error"` for it. Keep a localStorage fallback for
166
+ progress, and if the game says anything about it, say "Preview build —
167
+ progress isn't saved to your account". Never "offline" or "unavailable": the
168
+ owner is testing their own game, and Genex is up.
169
+
159
170
 
160
171
  ## Saving progress (per-player — every player has their own slot)
161
172
 
@@ -166,7 +177,8 @@ inventory, unlocks — anything about ONE player — goes in their player slot:
166
177
  import { loadPlayerState, savePlayerState } from "@genex-ai/embed-sdk";
167
178
 
168
179
  // boot: load whatever this player saved last time (fine for guests — resolves
169
- // { data: null, guest: true } instead of failing)
180
+ // { data: null, guest: true } and on the preview channel — { data: null,
181
+ // staging: true } — instead of failing)
170
182
  const { data } = await loadPlayerState();
171
183
  applyProgress(data ?? defaultProgress());
172
184
 
@@ -348,6 +360,10 @@ Rules:
348
360
  header (401), a guest token (403 `guest_no_save`), or the token belongs to a
349
361
  different game (403). All three mean the code bypassed the SDK helpers —
350
362
  switch to `savePlayerState`/`saveWorldState`, which handle every case.
363
+ - **Saves/loads resolve `{ staging: true }`** — the build is on the preview
364
+ channel (the draft workspace, `preview--<slug>`), where server saves are off
365
+ by design. Not an outage: keep the localStorage fallback and tell the player
366
+ "Preview build — progress isn't saved to your account", never "offline".
351
367
  - **Saves or score submits return 429** — writing too often (per-player limits:
352
368
  60 player-saves/min, 120 world-saves/min, 30 score submits/min). Debounce to
353
369
  ~1 write/sec at checkpoints and never save in the render loop; back off a