@crowdedkingdoms/crowdyjs 18.1.0-dev.1 → 18.2.0-test.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,25 @@ 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.2.0: `ChunkStore` keeps the voxel edits it hydrated
124
+
125
+ No API change. Every voxel write but a chunk write-back lands only in the chunk's edit log: a
126
+ hub's or mod's `world.set_voxels`, `updateVoxel`, and realtime voxel updates. Since ck-api
127
+ `dev/v2.33.0` (cks-game-api #445) `getChunk` returns each recorded edit as a `voxelStates` entry
128
+ with its type, over a stored `voxels` that holds none of them. `ChunkStore` applies them when it
129
+ hydrates a loaded chunk: set `hydrateVoxelStates: true` unless you configure a
130
+ `voxelStateCodec` (the-construct does since construct 0.3.6), or a reload shows none of them.
131
+ (OI-2026-10-02-006)
132
+
133
+ - `ensureAround` no longer applies a chunk it has already loaded when the bulk load returns it
134
+ again: the cube around a new center overlaps the old one, and the stored `voxels` put back
135
+ over the cache wiped the hydrated edits (a hub's block vanished the moment the player crossed
136
+ into a new chunk) and every realtime merge, and the chunk was never hydrated again. To load a
137
+ chunk afresh, `pruneBeyond` it first, or call `hydrate(coord)`.
138
+ - `hydrate` puts the entries on a chunk stored with `voxels: null` (a zero grid under them); it
139
+ used to drop their types. An entry without a state clears the state cached at its voxel, as a
140
+ realtime merge without one does.
141
+
123
142
  ## 18.1.0: open grids, and where a connect token may go
124
143
 
125
144
  Additive, except that `client.exec.connect` refuses a gateway it would once have dialed (below).
package/README.md CHANGED
@@ -12,19 +12,23 @@ 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
  CrowdyJS targets browsers by default and uses native `fetch`, `WebSocket`,
29
33
  `crypto`, `btoa`, and `atob`. Node tools can still use the SDK, but must
30
34
  provide browser-compatible globals when opening realtime connections (e.g.
@@ -171,8 +175,8 @@ Notes:
171
175
  - Use `client.auth.setToken(token)` to seed a token externally (e.g. when
172
176
  restoring auth from a non-default storage).
173
177
 
174
- Deeper reading: [Portals & app-scoped tokens](https://docs.crowdedkingdoms.com/management-api/portals-and-app-tokens)
175
- and [Sign in](https://docs.crowdedkingdoms.com/management-api/authentication).
178
+ Deeper reading: [Portals & app-scoped tokens](https://docs.dev.crowdedkingdoms.com/management-api/portals-and-app-tokens)
179
+ and [Sign in](https://docs.dev.crowdedkingdoms.com/management-api/authentication).
176
180
 
177
181
  ### Token refresh during gameplay
178
182
 
@@ -228,7 +232,7 @@ never told about, so a native refresh without it is a re-placement.
228
232
  | `client.host` | Game-host election (`get`, `amIHost`) + actor liveness `heartbeat`. `amIHost` is UI convenience only — a hub decides host-only actions from its caller. |
229
233
  | `client.teleport` | Teleport requests. |
230
234
  | `client.channels`, `client.teams` | Messaging channels and app-scoped player teams (membership + roles). |
231
- | `client.exec` | **ck-exec (dev-tier preview):** an app's server code as hubs and spokes. `connect(appId, { nodeType, key })` opens a player's connection to an execution host; the `ExecConnection` it returns has `call`, `callRaw`, `subscribe`, `ping`, `onReconnect` and `close`, with MessagePack payloads, and it reconnects and renews subscriptions by itself. `starters` / `build` / `deploy` build and deploy an app (`manage_compute`); `logs`, `instances`, `versions`, `activateVersion` and `setEnabled` operate it; `mod*` are players' mods on grids they own, and `modClient*`, `gridClientMods`, `consentClientMod`, `trustAuthor`, `revokeClientModConsent` and `revokeAuthorTrust` their CLIENT halves. See [ck-exec](#ck-exec-dev-tier-preview). |
235
+ | `client.exec` | **ck-exec:** an app's server code as hubs and spokes. `connect(appId, { nodeType, key })` opens a player's connection to an execution host; the `ExecConnection` it returns has `call`, `callRaw`, `subscribe`, `ping`, `onReconnect` and `close`, with MessagePack payloads, and it reconnects and renews subscriptions by itself. `starters` / `build` / `deploy` build and deploy an app (`manage_compute`); `logs`, `instances`, `versions`, `activateVersion` and `setEnabled` operate it; `mod*` are players' mods on grids they own, and `modClient*`, `gridClientMods`, `consentClientMod`, `trustAuthor`, `revokeClientModConsent` and `revokeAuthorTrust` their CLIENT halves. See [ck-exec](#ck-exec). |
232
236
  | `client.playerWallet` | Player spend: balance, ledger, hourly charges, spend caps, card setup, auto-recharge. A ck-exec mod's compute is billed here, to its owner. |
233
237
  | `client.marketplace` | Player-authorized grid claims (`claimGridOwnership`, `claimGridChunk`, `releaseClaimedGrid`, requests and invites) and studio moderation of player code (admission queue, listing administration, claim policy). Mods publish and install through `client.exec`. |
234
238
  | `client.crowdyStudio` | Cloud project, personal-library, and common-file APIs for Crowdy Studio: target-scoped files, metadata/module names, optimistic revisions, copy-by-value imports, atomic saves. |
@@ -295,7 +299,7 @@ query AppForRouting($appId: BigInt!) {
295
299
  `CrowdyClient` with `httpUrl: gameApiUrl` (and the matching `wsUrl`) holding
296
300
  that app's app-scoped token, then drive gameplay through that client. Apps
297
301
  with no `gameApiUrl` keep working against the default `httpUrl` you
298
- configured. See [Loading an app's Game API](https://docs.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
302
+ configured. See [Loading an app's Game API](https://docs.dev.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
299
303
 
300
304
  ## Realtime notifications
301
305
 
@@ -587,6 +591,11 @@ write-back), `channelInbox` / `actorInbox` (message inboxes), `events` (typed
587
591
  event router), `host` (host tracking), and `save` / `avatar` (typed durable
588
592
  state).
589
593
 
594
+ A voxel edit that is not a chunk write-back (a hub's or mod's `world.set_voxels`, `updateVoxel`,
595
+ another player's realtime voxel update) reaches a reload only through hydration: `getChunk`
596
+ returns it in `voxelStates`, and the bulk load's `voxels` never hold it. The store hydrates when
597
+ it has a `voxelStateCodec`; without one, set `chunks: { hydrateVoxelStates: true }`.
598
+
590
599
  A chunk write-back the server refuses (a visitor on someone else's plot, a safe zone, a closed
591
600
  wilderness) is dropped, not retried; one that fails for a reason that can clear is tried five
592
601
  times. Listen with `session.chunks.onWriteBackFailed(...)` to undo or flag the edit (18.0.4).
@@ -599,7 +608,7 @@ reach your bundle. Reads are synchronous snapshots and writes happen on
599
608
  WebSocket events (not `requestAnimationFrame`), so render loops read freely
600
609
  and a backgrounded tab keeps ingesting updates; pass `workerTicker()` to also
601
610
  keep timer-driven sends at full rate while hidden. See the
602
- [World Stores guide](https://docs.crowdedkingdoms.com/crowdyjs/stores).
611
+ [World Stores guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/stores).
603
612
 
604
613
  ## Game Kit
605
614
 
@@ -623,11 +632,11 @@ and `runOptimisticAction`, which applies an action locally, asks a referee
623
632
  `kit.deploy`, the engines and the model-backed helpers went with the game
624
633
  model in 18.0.0; see [MIGRATION.md](MIGRATION.md).
625
634
 
626
- ## ck-exec (dev-tier preview)
635
+ ## ck-exec
627
636
 
628
637
  ck-exec runs an app's server code as **hubs** (stateful, one instance per key) and **spokes**
629
- (stateless, replicated) on execution hosts, on the dev environment only for now. A player
630
- connects to one host and calls any node of the app through it:
638
+ (stateless, replicated) on execution hosts. A player connects to one host and calls any node
639
+ of the app through it:
631
640
 
632
641
  ```ts
633
642
  // The session token is the app's app-scoped token (client.portal.mintAppToken).
@@ -873,7 +882,7 @@ CLIENT project needs ck-api `v2.25.1` or later. A CLIENT crate still on the lega
873
882
  on legacy player compute since 18.0.0.
874
883
 
875
884
  See [CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.dev.crowdedkingdoms.com/exec/mods)
876
- and [Embed Crowdy Studio in your game](https://docs.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
885
+ and [Embed Crowdy Studio in your game](https://docs.dev.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
877
886
 
878
887
  ### The Studio agent (DeepSeek Harness in the browser)
879
888
 
@@ -1051,7 +1060,7 @@ no other repositories and no network access required:
1051
1060
  - `src/generated/graphql.ts` — generated TypeScript operation types.
1052
1061
 
1053
1062
  Schema refresh is explicit, from the published
1054
- [SDL](https://docs.crowdedkingdoms.com/schema/game-api.graphql):
1063
+ [SDL](https://docs.dev.crowdedkingdoms.com/schema/game-api.graphql):
1055
1064
 
1056
1065
  ```bash
1057
1066
  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 dev` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier test` 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 'dev'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'test'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export declare const CROWDY_DEFAULT_TIER = "dev";
16
+ export declare const CROWDY_DEFAULT_TIER = "test";
17
17
  /** The public CK API origin for that tier. */
18
- export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.dev.crowdedkingdoms.com";
18
+ export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.test.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.dev.crowdedkingdoms.com";
20
+ export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.test.crowdedkingdoms.com";
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export declare const CROWDY_DEFAULT_HOST = "ck.dev.crowdedkingdoms.com";
22
+ export declare const CROWDY_DEFAULT_HOST = "ck.test.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,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
+ {"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,6 +1,6 @@
1
1
  /**
2
2
  * GENERATED — do not edit. The operator tooling's
3
- * `sync-client-origins.mjs --write --tier dev` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier test` 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 'dev'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'test'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export const CROWDY_DEFAULT_TIER = 'dev';
16
+ export const CROWDY_DEFAULT_TIER = 'test';
17
17
  /** The public CK API origin for that tier. */
18
- export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.dev.crowdedkingdoms.com';
18
+ export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.test.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.dev.crowdedkingdoms.com';
20
+ export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.test.crowdedkingdoms.com';
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export const CROWDY_DEFAULT_HOST = 'ck.dev.crowdedkingdoms.com';
22
+ export const CROWDY_DEFAULT_HOST = 'ck.test.crowdedkingdoms.com';
@@ -17,8 +17,8 @@ import type { GameAppsAPI } from './gameApps.js';
17
17
  * instances also reachable at the top level (e.g. `client.billing`), grouped
18
18
  * here for discoverability.
19
19
  *
20
- * Operator-only platform operations live separately under `client.operator`
21
- * (requires `is_operator`).
20
+ * Platform-operator operations are not in the SDK; it wraps only what a studio
21
+ * or a player may call.
22
22
  *
23
23
  * @example
24
24
  * ```ts
@@ -8,8 +8,8 @@
8
8
  * instances also reachable at the top level (e.g. `client.billing`), grouped
9
9
  * here for discoverability.
10
10
  *
11
- * Operator-only platform operations live separately under `client.operator`
12
- * (requires `is_operator`).
11
+ * Platform-operator operations are not in the SDK; it wraps only what a studio
12
+ * or a player may call.
13
13
  *
14
14
  * @example
15
15
  * ```ts
@@ -4,7 +4,7 @@ import { CrowdyError } from '../errors.js';
4
4
  import { type ExecAppStatusFieldsFragment, type ExecBuildFieldsFragment, type ExecEndpointStatsQuery, type ExecGridClientModFieldsFragment, type ExecInstancesQuery, type ExecLogsQuery, type ExecModClientArtifactQuery, type ExecModClientFieldsFragment, type ExecModFieldsFragment, type ExecModListingFieldsFragment, ExecModScope, type ExecModSwitchFieldsFragment, type ExecVersionsQuery } from '../generated/graphql.js';
5
5
  export { ExecModScope };
6
6
  /**
7
- * ck-exec, the hub-and-spoke execution service (dev-tier preview).
7
+ * ck-exec, the hub-and-spoke execution service.
8
8
  *
9
9
  * An app's code runs as **hubs** (stateful nodes, one per key, one handler at a
10
10
  * time) and **spokes** (stateless, replicated) on execution hosts. A player
@@ -5,7 +5,7 @@ import { CrowdyError, CrowdyProtocolError } from '../errors.js';
5
5
  import { ExecActivateVersionDocument, ExecAppStatusDocument, ExecBuildDocument, ExecBuildStatusDocument, ExecConnectAsDeveloperDocument, ExecConnectDocument, ExecConsentClientModDocument, ExecDeployDocument, ExecEndpointStatsDocument, ExecGridClientModsDocument, ExecInstancesDocument, ExecLogsDocument, ExecAppModsDocument, ExecModBuildDocument, ExecModBuildStatusDocument, ExecModClientArtifactDocument, ExecModClientBuildDocument, ExecModClientDeleteDocument, ExecModClientDeployDocument, ExecModDeleteDocument, ExecModDeployDocument, ExecModInstallDocument, ExecModListingsDocument, ExecModLogsDocument, ExecModPublishDocument, ExecModScope, ExecModSetEnabledDocument, ExecModSetSwitchDocument, ExecModStarterDocument, ExecModSwitchesDocument, ExecModUnpublishDocument, ExecModsDocument, ExecMyModsDocument, ExecRevokeAuthorTrustDocument, ExecRevokeClientModConsentDocument, ExecSetEnabledDocument, ExecStartersDocument, ExecTrustAuthorDocument, ExecVersionsDocument, } from '../generated/graphql.js';
6
6
  export { ExecModScope };
7
7
  /**
8
- * ck-exec, the hub-and-spoke execution service (dev-tier preview).
8
+ * ck-exec, the hub-and-spoke execution service.
9
9
  *
10
10
  * An app's code runs as **hubs** (stateful nodes, one per key, one handler at a
11
11
  * time) and **spokes** (stateless, replicated) on execution hosts. A player