@crowdedkingdoms/crowdyjs 18.30.0 → 18.31.0-dev.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/MIGRATION.md CHANGED
@@ -120,6 +120,39 @@ super-admin's session). There is no SDK replacement.
120
120
  `dev`'s SDL after #417 merged (`npm run schema:sync:paths -- --schema <that schema.gql>`, then
121
121
  `npm run codegen`).
122
122
 
123
+ ## 18.31.0: the ChunkStore merges by the server's time
124
+
125
+ **What it needs.** ck-api `v2.69.0` (cks-game-api #668): `chunks.get` selects each voxel state's
126
+ `updatedAt`, which an older Game API refuses. Promote the Game API before the SDK on each tier.
127
+ Buddy `v0.46.0` dates a realtime edit with the moment the server accepted it, so a catch-up's
128
+ `createdAt` and a notification's `epochMillis` come from one clock; with an older Buddy the merge
129
+ still holds, by the database's write time.
130
+
131
+ **What changes for a game using `session.chunks`.**
132
+
133
+ - **Changes merge by the server's time.** Each voxel keeps the value the server confirmed last
134
+ and when: a stored copy's write, an entry's `updatedAt`, a notification's `epochMillis`, a
135
+ recorded edit's `createdAt`. A change older than the value held is dropped, so a slow
136
+ notification or a late page no longer overwrites a newer value. A time more than 5 minutes past
137
+ this machine's clock counts as 5 minutes ahead. `confirmedAt(coord, x, y, z)` reads it.
138
+ - **A change that arrives while a chunk loads is kept.** The store tracks a chunk it is reading,
139
+ and its copy merges under what arrived meanwhile: a newer change stays, an older one gives way.
140
+ It dropped them before.
141
+ - **Another client's edit goes under this client's unanswered edit.** The voxel keeps showing your
142
+ edit until the server answers it; if the server refuses it (or it times out), the voxel shows
143
+ the other client's edit, not what it held before yours. `VoxelEditRefusal.restored` is true
144
+ whenever the voxel stopped showing the edit. It showed the other edit at once before, and your
145
+ echo put yours back.
146
+ - **An echo matches by its value too**: sender, sequence number, voxel, type and state. A change
147
+ with your uuid and sequence number but another value is another change.
148
+ - **`catchUp(since, boxes?)` covers every chunk the store tracks**, the never-stored (`missing`)
149
+ ones included, read in boxes of at most 17³; or the boxes you pass (cut to 17³; more than 64
150
+ resolves false). It covered the last `ensureAround` area. It resolves whether anything was read.
151
+ - **`evict(coord)` and `pruneIf(predicate)`** drop chunks for a view that is not a cube; a chunk
152
+ queued for write-back stays. `pruneBeyond` returns how many it dropped.
153
+ - **`hydrate(coord)` resolves whether its copy was applied**: false for a chunk never stored, or one
154
+ evicted while the read was out (it is not brought back).
155
+
123
156
  ## 18.30.0: a ChunkStore the game can stand behind
124
157
 
125
158
  **What it needs.** What 18.29.0 needs (ck-api `v2.68.0` for the GraphQL proxy); the box reads and
package/README.md CHANGED
@@ -12,24 +12,29 @@ gameplay, minted per app through `client.portal`.
12
12
 
13
13
  Start here:
14
14
 
15
- - [SDK guide](https://docs.crowdedkingdoms.com/crowdyjs/readme) — the canonical
15
+ - [SDK guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/readme) — the canonical
16
16
  walkthrough of everything in this README.
17
- - [Build a game](https://docs.crowdedkingdoms.com/build-a-game/intro) — a
17
+ - [Build a game](https://docs.dev.crowdedkingdoms.com/build-a-game/intro) — a
18
18
  hands-on tutorial from sign-in to a playable voxel game.
19
- - [Platform overview](https://docs.crowdedkingdoms.com/overview/client-workflow)
19
+ - [Platform overview](https://docs.dev.crowdedkingdoms.com/overview/client-workflow)
20
20
  — how a client session flows through the platform.
21
21
 
22
22
  ## Install
23
23
 
24
24
  ```bash
25
- npm install @crowdedkingdoms/crowdyjs
25
+ npm install @crowdedkingdoms/crowdyjs@dev
26
26
  ```
27
27
 
28
+ This README is the `dev` branch's: it documents the release on the `dev` dist-tag
29
+ (`npm view @crowdedkingdoms/crowdyjs dist-tags`), and its links go to the dev docs site. A
30
+ plain `npm install` resolves `latest`, the production release, which has no `client.exec`.
31
+
28
32
  **Server compatibility.** A release selects fields the Game API it was built against has,
29
33
  so it needs that Game API or newer; promote the Game API before the SDK on each tier.
30
34
 
31
35
  | CrowdyJS | Needs the Game API (ck-api) |
32
36
  | --- | --- |
37
+ | 18.31.0 | v2.69.0 or later (`chunks.get` selects `VoxelState.updatedAt`) |
33
38
  | 18.30.0 | as 18.29.0 (`ChunkStore` reads boxes and `since`: v2.67.0) |
34
39
  | 18.29.0 | v2.68.0 or later for the GraphQL proxy (`udpNotifications` selects `ChunkChangedNotification`) |
35
40
  | 18.28.0 | v2.67.0 or later (`gameApps.nearbyGrids` selects `permissionKeys`) |
@@ -225,8 +230,8 @@ Notes:
225
230
  - Use `client.auth.setToken(token)` to seed a token externally (e.g. when
226
231
  restoring auth from a non-default storage).
227
232
 
228
- Deeper reading: [Portals & app-scoped tokens](https://docs.crowdedkingdoms.com/management-api/portals-and-app-tokens)
229
- and [Sign in](https://docs.crowdedkingdoms.com/management-api/authentication).
233
+ Deeper reading: [Portals & app-scoped tokens](https://docs.dev.crowdedkingdoms.com/management-api/portals-and-app-tokens)
234
+ and [Sign in](https://docs.dev.crowdedkingdoms.com/management-api/authentication).
230
235
 
231
236
  ### Org-managed players
232
237
 
@@ -518,7 +523,7 @@ query AppForRouting($appId: BigInt!) {
518
523
  `CrowdyClient` with `httpUrl: gameApiUrl` (and the matching `wsUrl`) holding
519
524
  that app's app-scoped token, then drive gameplay through that client. Apps
520
525
  with no `gameApiUrl` keep working against the default `httpUrl` you
521
- configured. See [Loading an app's Game API](https://docs.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
526
+ configured. See [Loading an app's Game API](https://docs.dev.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
522
527
 
523
528
  ## Realtime notifications
524
529
 
@@ -971,7 +976,7 @@ reach your bundle. Reads are synchronous snapshots and writes happen on
971
976
  WebSocket events (not `requestAnimationFrame`), so render loops read freely
972
977
  and a backgrounded tab keeps ingesting updates; pass `workerTicker()` to also
973
978
  keep timer-driven sends at full rate while hidden. See the
974
- [World Stores guide](https://docs.crowdedkingdoms.com/crowdyjs/stores).
979
+ [World Stores guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/stores).
975
980
 
976
981
  ## Game Kit
977
982
 
@@ -1049,7 +1054,7 @@ The protocol is held to ck-exec's golden record of the starters
1049
1054
  (`test/unit/fixtures/kit-protocol.json`): every module call and topic in it is replayed in
1050
1055
  `test/unit/game-kit.test.mjs`. The blueprints, `kit.deploy`, the engines and the model-backed
1051
1056
  helpers went with the game model in 18.0.0; the hub modules replace them. See the
1052
- [Game Kit docs](https://docs.crowdedkingdoms.com/game-kit/intro) and
1057
+ [Game Kit docs](https://docs.dev.crowdedkingdoms.com/game-kit/intro) and
1053
1058
  [MIGRATION.md](MIGRATION.md).
1054
1059
 
1055
1060
  ## ck-exec
@@ -1113,7 +1118,7 @@ Integers above 2^53 decode as `number` and lose precision unless you pass
1113
1118
  `{ decode: { useBigInt64: true } }`. A call's whole numbers outside 32 bits (a timestamp in
1114
1119
  milliseconds, a player id) go out as 64-bit integers (18.11.0; before, as floats, which a
1115
1120
  hub's integer fields refuse). The wire format is in the
1116
- [ck-exec docs](https://docs.crowdedkingdoms.com/exec/intro).
1121
+ [ck-exec docs](https://docs.dev.crowdedkingdoms.com/exec/intro).
1117
1122
 
1118
1123
  ### A mod's CLIENT half
1119
1124
 
@@ -1184,7 +1189,7 @@ counts what was dropped); `invoke` sends at most 256 KiB each way and is refused
1184
1189
  module is not running. `NOT_FOUND` holds a CLIENT half back 15 s and `RATE_LIMITED` 60 s. The
1185
1190
  grid's owner is asked about their own CLIENT halves like anyone; answer yes in `confirm` when
1186
1191
  `prompt.authorId` is the player. See
1187
- [CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves).
1192
+ [CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves).
1188
1193
 
1189
1194
  ## Hosting your game
1190
1195
 
@@ -1197,7 +1202,7 @@ set response headers. Then, in Studio, open the app's
1197
1202
  origin as the app's **Launch URL**. The redirect URI is what admits the origin to CORS
1198
1203
  and to the hosted sign-in return, so `portal.signIn` works there as in the
1199
1204
  [Quick start](#quick-start).
1200
- [Host your game](https://docs.crowdedkingdoms.com/build-a-game/host-your-game)
1205
+ [Host your game](https://docs.dev.crowdedkingdoms.com/build-a-game/host-your-game)
1201
1206
  has the requirements and recipes.
1202
1207
 
1203
1208
  `client.hosting`, `uploadPublishFiles`, `publishDirectory` and `manifestForDirectory`
@@ -1293,8 +1298,8 @@ CLIENT project needs ck-api `v2.25.1` or later. A CLIENT crate still on the lega
1293
1298
  `mountCrowdyStudio` and the controller take `mods: client.exec`. Crowdy Studio runs nothing
1294
1299
  on legacy player compute since 18.0.0.
1295
1300
 
1296
- See [CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.crowdedkingdoms.com/exec/mods)
1297
- and [Embed Crowdy Studio in your game](https://docs.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
1301
+ See [CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.dev.crowdedkingdoms.com/exec/mods)
1302
+ and [Embed Crowdy Studio in your game](https://docs.dev.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
1298
1303
 
1299
1304
  ### The Studio agent (DeepSeek Harness in the browser)
1300
1305
 
@@ -1550,7 +1555,7 @@ no other repositories and no network access required:
1550
1555
  `src/generated/graphql-schema.ts`, the generated schema types.
1551
1556
 
1552
1557
  Schema refresh is explicit, from the published
1553
- [SDL](https://docs.crowdedkingdoms.com/schema/game-api.graphql):
1558
+ [SDL](https://docs.dev.crowdedkingdoms.com/schema/game-api.graphql):
1554
1559
 
1555
1560
  ```bash
1556
1561
  npm run schema:sync:prod
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * GENERATED — do not edit. The operator tooling's
3
- * `sync-client-origins.mjs --write --tier prod` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier dev` writes this file, and
4
4
  * `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
5
5
  * host that declaration does not carry. Regenerate; never hand-edit.
6
6
  *
@@ -10,14 +10,14 @@
10
10
  * than no default at all. Every fallback this SDK ever removed named a host that
11
11
  * was already dead. A generated file plus a gate is what makes this one different.
12
12
  *
13
- * Source: the operator's per-tier public CK API origin declaration, tier 'prod'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'dev'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export declare const CROWDY_DEFAULT_TIER = "prod";
16
+ export declare const CROWDY_DEFAULT_TIER = "dev";
17
17
  /** The public CK API origin for that tier. */
18
- export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.prod.crowdedkingdoms.com";
18
+ export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.dev.crowdedkingdoms.com";
19
19
  /** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
20
- export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.prod.crowdedkingdoms.com";
20
+ export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.dev.crowdedkingdoms.com";
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export declare const CROWDY_DEFAULT_HOST = "ck.prod.crowdedkingdoms.com";
22
+ export declare const CROWDY_DEFAULT_HOST = "ck.dev.crowdedkingdoms.com";
23
23
  //# sourceMappingURL=default-origin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAEhF,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,gCAAgC,CAAC"}
1
+ {"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,uCAAuC,CAAC;AAE/E,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAE3E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,+BAA+B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * GENERATED — do not edit. The operator tooling's
3
- * `sync-client-origins.mjs --write --tier prod` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier dev` writes this file, and
4
4
  * `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
5
5
  * host that declaration does not carry. Regenerate; never hand-edit.
6
6
  *
@@ -10,13 +10,13 @@
10
10
  * than no default at all. Every fallback this SDK ever removed named a host that
11
11
  * was already dead. A generated file plus a gate is what makes this one different.
12
12
  *
13
- * Source: the operator's per-tier public CK API origin declaration, tier 'prod'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'dev'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export const CROWDY_DEFAULT_TIER = 'prod';
16
+ export const CROWDY_DEFAULT_TIER = 'dev';
17
17
  /** The public CK API origin for that tier. */
18
- export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.prod.crowdedkingdoms.com';
18
+ export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.dev.crowdedkingdoms.com';
19
19
  /** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
20
- export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.prod.crowdedkingdoms.com';
20
+ export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.dev.crowdedkingdoms.com';
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export const CROWDY_DEFAULT_HOST = 'ck.prod.crowdedkingdoms.com';
22
+ export const CROWDY_DEFAULT_HOST = 'ck.dev.crowdedkingdoms.com';
@@ -10044,6 +10044,8 @@ export type VoxelState = {
10044
10044
  __typename?: 'VoxelState';
10045
10045
  /** BASE64-encoded binary state blob for this voxel (decode from base64); null/empty when the voxel has no extra state. */
10046
10046
  state: Maybe<Scalars['String']['output']>;
10047
+ /** When this entry was last written: the recorded voxel edit's time, or the chunk's own write for a state stored with it. A client that also hears realtime voxel updates keeps, per voxel, the newer of this and a notification's time (a realtime edit is recorded at the time its notification carries, replication servers v0.46.0). Null when the read did not apply recorded edits. Game API v2.69.0. */
10048
+ updatedAt: Maybe<Scalars['DateTime']['output']>;
10047
10049
  /** Voxel position within the chunk (signed 16-bit per axis, app-defined). */
10048
10050
  voxelCoord: VoxelCoordinates;
10049
10051
  /** Voxel type id at this position (signed 16-bit, app-defined). */