@crowdedkingdoms/crowdyjs 18.11.0-dev.1 → 18.13.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.
Files changed (55) hide show
  1. package/MIGRATION.md +51 -0
  2. package/README.md +19 -1
  3. package/dist/generated/graphql-schema.d.ts +5 -5
  4. package/dist/generated/graphql-schema.d.ts.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/kit/index.d.ts +11 -0
  8. package/dist/kit/index.d.ts.map +1 -1
  9. package/dist/kit/index.js +11 -0
  10. package/dist/kit/kit.d.ts +99 -2
  11. package/dist/kit/kit.d.ts.map +1 -1
  12. package/dist/kit/kit.js +128 -2
  13. package/dist/kit/modules/arenas.d.ts +87 -0
  14. package/dist/kit/modules/arenas.d.ts.map +1 -0
  15. package/dist/kit/modules/arenas.js +66 -0
  16. package/dist/kit/modules/encounters.d.ts +75 -0
  17. package/dist/kit/modules/encounters.d.ts.map +1 -0
  18. package/dist/kit/modules/encounters.js +57 -0
  19. package/dist/kit/modules/instances.d.ts +78 -0
  20. package/dist/kit/modules/instances.d.ts.map +1 -0
  21. package/dist/kit/modules/instances.js +72 -0
  22. package/dist/kit/modules/leaderboards.d.ts +79 -0
  23. package/dist/kit/modules/leaderboards.d.ts.map +1 -0
  24. package/dist/kit/modules/leaderboards.js +69 -0
  25. package/dist/kit/modules/market.d.ts +159 -0
  26. package/dist/kit/modules/market.d.ts.map +1 -0
  27. package/dist/kit/modules/market.js +141 -0
  28. package/dist/kit/modules/minigames.d.ts +59 -0
  29. package/dist/kit/modules/minigames.d.ts.map +1 -0
  30. package/dist/kit/modules/minigames.js +55 -0
  31. package/dist/kit/modules/player.d.ts +264 -0
  32. package/dist/kit/modules/player.d.ts.map +1 -0
  33. package/dist/kit/modules/player.js +258 -0
  34. package/dist/kit/modules/racing.d.ts +131 -0
  35. package/dist/kit/modules/racing.d.ts.map +1 -0
  36. package/dist/kit/modules/racing.js +113 -0
  37. package/dist/kit/modules/tables.d.ts +76 -0
  38. package/dist/kit/modules/tables.d.ts.map +1 -0
  39. package/dist/kit/modules/tables.js +73 -0
  40. package/dist/kit/modules/tactics.d.ts +79 -0
  41. package/dist/kit/modules/tactics.d.ts.map +1 -0
  42. package/dist/kit/modules/tactics.js +67 -0
  43. package/dist/kit/modules/territory.d.ts +92 -0
  44. package/dist/kit/modules/territory.d.ts.map +1 -0
  45. package/dist/kit/modules/territory.js +84 -0
  46. package/dist/kit/protocol.d.ts +2 -0
  47. package/dist/kit/protocol.d.ts.map +1 -1
  48. package/dist/kit/protocol.js +2 -0
  49. package/dist/kit/runtime.d.ts.map +1 -1
  50. package/dist/kit/runtime.js +6 -1
  51. package/dist/live-coding/assets/browser-authoring-index.json +1 -1
  52. package/dist/live-coding/assets/manifest.json +1 -1
  53. package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
  54. package/dist/live-coding/browser-authoring-index.generated.js +4776 -149
  55. package/package.json +1 -1
package/MIGRATION.md CHANGED
@@ -120,6 +120,57 @@ 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.13.0: the economy
124
+
125
+ Additive. **Needs a compute toolchain whose starter pack has the `player` and `market`
126
+ starters** (ckx-sdk 0.12.1; dev's toolchain v1.15.0). The economy lives in hub state and is
127
+ not a ledger (the operator's decision HS-52): no double-entry book, no real money, transfers as
128
+ steps each hub answers once.
129
+
130
+ - **The caller's own `player` hub**, keyed by their player id (the kit needs it: `playerId` in
131
+ `client.kit()`'s options, or the identity it can ask): `kit.player` (`watch`, `me`, `rules`,
132
+ `profileOf`, `onEvent`) and its views `kit.inventory` (`items`, `count`, `discard`,
133
+ `takeMail`), `kit.wallet` (`balances`, `balance`), `kit.progression` (`progress`, `profile`,
134
+ `onLevel`), `kit.achievements` (`list`, `onUnlock`), `kit.quests` (`list`, `accept`, `claim`,
135
+ `step` for the counters the game lets a client report), `kit.crafting` (`recipes`, `craft`),
136
+ `kit.loot` (`tables`, `open`) and `kit.production` (`view`, `collect`). The inventory, wallet
137
+ and progress are read by calls only the player may make, and read again when the hub's
138
+ `changed` message names them; the profile is public.
139
+ - **Markets** by name: `kit.shops.at(key)` (`vendors`, `buy`, `sell`), `kit.market.at(key)`
140
+ (`book`, `order`, `cancel`, `orders` mirrored) and `kit.trades.at(key)` (`open`, `offer`,
141
+ `accept`, `decline`, `mine` mirrored). An order or an offer holds what it puts up in the
142
+ player's own hub; a fill or an accepted trade moves it hub to hub.
143
+ - **`unavailable`** (`KIT_CODES.UNAVAILABLE`): a hub refuses a change it could not finish
144
+ because another hub did not answer. The kit sends a call with an action id again, as it does
145
+ after a platform `Unavailable`; the hub keeps no receipt for it, so the resend finishes what
146
+ the first began.
147
+
148
+ ## 18.12.0: the genre starters
149
+
150
+ Additive. **Needs a compute toolchain whose starter pack has the genre starters** (ckx-sdk
151
+ 0.11.0); `kit.topology` lists, builds and deploys them like the others. Against an app that does
152
+ not run one, its module's calls are refused with `NotFound` (the app has no such node type).
153
+
154
+ - **Nine more kit modules**, one per new starter hub: `leaderboards.board(name)` (the top
155
+ mirrored, `top`, `around`, `me`, `season`; hubs submit the scores they decided, a client never
156
+ does), `tables.table(key)` (cards: the table mirrored and the caller's hand as private state),
157
+ `tactics.battle(key)` (grid battles in phases), `encounters.encounter(key)` (waves, towers, a
158
+ boss with phases), `minigames.duel(key)` (hidden throws revealed together), `instances.run(key)`
159
+ (a party's private run: seeded floors, permadeath, expiry), `arenas.arena(key)` (classes and
160
+ abilities in real time), `racing.race(key)` and `racing.ball(key)` (races with laps, splits
161
+ and a ghost; ball games with possession), `territory.map(key)` and `territory.zone(key)`
162
+ (control points; a shrinking circle).
163
+ - **The node types they talk to** are the starters' (`leaderboard`, `deck`, `tactics`,
164
+ `director`, `minigame`, `instance`, `arena`, `race`, `ball`, `territory`, `zone`); an app that
165
+ deploys one under another name passes it in `client.kit(appId, { nodes: { ... } })`.
166
+ - **Positions a client reports are the hub's to keep**: `arenas`, `racing` and the ball game take
167
+ `move` / `pos` reports and answer with the position the hub's movement warden kept (a move too
168
+ fast is cut short, a jump refused). Each refused report is a `violation` event, and an arena
169
+ removes a player after a run of them (`removed`). Send them a few times a second, without an
170
+ action id.
171
+ - **Event bodies never use the header's field names** (`v`, `epoch`, `seq`, `kind`): the race's
172
+ `timing` events carry their `stage`, the warden's `violation` events their `what`.
173
+
123
174
  ## 18.11.0: the Game Kit on ck-exec
124
175
 
125
176
  Additive, apart from one fix in `client.exec` (below). **Needs what 18.10.0 needs from the Game
package/README.md CHANGED
@@ -750,6 +750,17 @@ modules are the tree's starter types:
750
750
  | `kit.matchmaking.queue(name)` | `matchmaker` | `join` with a rating, alone or as a party matched whole (the leader names the members; each confirms with `leader`); `accept` / `decline`; `place` and `onMatched` with the session key |
751
751
  | `kit.sessions.open(key)` | `session` | lobby, `ready`, the host's `startGame`, `act` in turn under a time limit; the hub scores and names the winner; `state` mirrored |
752
752
  | `kit.npcs.area(key)` / `areaAt(x, z)` | `npcs` (`npc-mobs`) | an area's mobs, NPCs and pets mirrored; `attack` (the hub decides reach, cooldown, damage), `talk`; pets: `adopt`, `rename`, `summon`, `dismiss`, `release`, `myPets` |
753
+ | `kit.leaderboards.board(name)` | `leaderboard` | the top mirrored; `top`, `around`, `me`, `season`; scores come from the hubs that decided them (`submit` is for developers and hubs), seasons roll on a schedule (18.12.0) |
754
+ | `kit.tables.table(key)` | `deck` | a card table: the table mirrored, the caller's hand as private state; `join`, `start`, `play`, `draw`, `pass` in the hub's turn order |
755
+ | `kit.tactics.battle(key)` | `tactics` | a grid battle in phases: `move`, `attack`, `endTurn` for the player's units; the hub's units act when every player ended the phase |
756
+ | `kit.encounters.encounter(key)` | `director` | waves down a lane on the hub's clock, `build` towers (the lane must stay open), `hit` with a cooldown, a boss with phases |
757
+ | `kit.minigames.duel(key)` | `minigame` | two-player duels of hidden throws, revealed together; `throw`, `rematch` |
758
+ | `kit.instances.run(key)` | `instance` | a private run for one party: `open` (seeded floors), `invite`, `join`, `enter` each room, `descend`; permadeath and expiry; depth to a leaderboard |
759
+ | `kit.arenas.arena(key)` | `arena` | real-time fights: `join` as a class, `move` (the hub's warden keeps what the speed allows), `cast` (cooldown, resource, range; projectiles and areas land on the hub's ticks) |
760
+ | `kit.racing.race(key)` / `ball(key)` | `race`, `ball` (`racing`) | races (gates in order, laps, splits, places, the winner's `ghost`) and ball games (`claim`, `pass`, `shoot`, goals) on reported positions the warden keeps |
761
+ | `kit.territory.map(key)` / `zone(key)` | `territory`, `zone` (`territory`) | control points a faction captures by standing on them (the hub reads where players are), and a circle that shrinks and wears down whoever is outside |
762
+ | `kit.player` and its views: `kit.inventory`, `kit.wallet`, `kit.progression`, `kit.achievements`, `kit.quests`, `kit.crafting`, `kit.loot`, `kit.production` | `player` (keyed by the player's id) | the caller's own hub: stacks and mail, soft currencies, levels and public profiles, achievements, quests with tutorials (`step` for the counters a client may report), crafting, loot with pity, idle production; private parts read again when the hub says they changed (18.13.0) |
763
+ | `kit.shops.at(key)`, `kit.market.at(key)`, `kit.trades.at(key)` | `market` | vendors with stock and restocks (`buy`, `sell`), order books (`order`, `cancel`, `book`), trades between two players (`open`, `offer`, `accept`, `decline`); what a player puts up is held in their own hub, and a call that could not reach it is refused `unavailable` and sent again |
753
764
  | `kit.topology` | — | composes a manifest from `exec.starters` (the types picked, what they hang under and call), checks the tree, builds and deploys (developers, `manage_compute`) |
754
765
  | `kit.spectate`, `kit.emotes`, `kit.shards` | — | a viewer's heartbeat so the world's messages reach it; emotes as client events every kit client reads; shard keys as the hubs compute them |
755
766
  | `kit.social` | — | parties, guilds and chat rooms over teams and channels |
@@ -782,7 +793,11 @@ await kit.sessions.open(key).act({ points: 2 }); // sent with an action id: pl
782
793
  shape React's `useSyncExternalStore` takes. `PrivateState` reads what only its player may
783
794
  see with a call, again whenever the hub says it changed for them.
784
795
  - **Refusals** are `KitError` (a `CrowdyExecError` with status `AppError`) with a `code` to
785
- branch on: `not_your_turn`, `cooldown`, `full`, `forbidden`, ... (`KIT_CODES`).
796
+ branch on: `not_your_turn`, `cooldown`, `full`, `forbidden`, ... (`KIT_CODES`). A call with an
797
+ action id refused `unavailable` (a hub it needed did not answer) is sent again (18.13.0).
798
+ - **The economy is not a ledger.** Items and soft currency are hub state; a transfer between
799
+ players is steps each hub answers once. See the Game Kit's economy page before you put
800
+ anything of real value in it.
786
801
  - **Kit types are the hubs' MessagePack maps as they arrive**, field names and all
787
802
  (`time_of_day`, `expires_in_ms`), the same in CrowdyCPP and CrowdyPy.
788
803
  - **Realtime**: hubs show server-driven actors through the realtime tier; `kitActorCodec`,
@@ -1227,6 +1242,9 @@ is why the mint also returns `discoveryUrl`.
1227
1242
  `CROWDY_HTTP_URL` and `CROWDY_E2E_THROWAWAY_OWNER=1` it registers a throwaway org admin (its own
1228
1243
  org and app) and a player, opens and closes a grid, and checks the tier's ck-exec gateway. It
1229
1244
  leaves the org behind and archives the app, so it runs only when asked to.
1245
+ `test/e2e/game-kit.test.mjs` does the same for the Game Kit: the throwaway owner composes the
1246
+ starter hubs with `kit.topology`, builds and deploys them, and two players play them (on dev and
1247
+ test it also needs `CROWDY_PROVISIONING_TOKEN`, which their staff-only sign-up asks for).
1230
1248
 
1231
1249
  ## Maintainers: schema artifacts and fixtures
1232
1250
 
@@ -3760,14 +3760,14 @@ export type ExecStarterFile = {
3760
3760
  /** The path within the crate, as `execBuild` takes it. */
3761
3761
  path: Scalars['String']['output'];
3762
3762
  };
3763
- /** The starter packs: four crates and a manifest that deploys them as one app. */
3763
+ /** The starter packs: the starter crates, and a manifest that deploys them as one app. */
3764
3764
  export type ExecStarterPack = {
3765
3765
  __typename?: 'ExecStarterPack';
3766
- /** The manifest for `execDeploy` with the build’s id: the root `world` hub, and `matchmaker`, `session` and `npcs` under it, each naming its crate. */
3766
+ /** The manifest for `execDeploy` with the build’s id: the root `world` hub and the types under it, each naming its crate. */
3767
3767
  manifestJson: Scalars['String']['output'];
3768
3768
  /** The mod starter: a player’s code on a grid they own, built with `execModBuild` and deployed with `execModDeploy` rather than in the manifest. Null on a toolchain without it. */
3769
3769
  mod: Maybe<ExecStarter>;
3770
- /** The crates. */
3770
+ /** One entry per node type of the manifest: a crate that serves two types appears twice, so build each crate once. */
3771
3771
  starters: Array<ExecStarter>;
3772
3772
  };
3773
3773
  /** A deployed version of an app’s ck-exec topology. */
@@ -4836,7 +4836,7 @@ export type Mutation = {
4836
4836
  revokeTierAccessProvisioningToken: TierAccessProvisioningToken;
4837
4837
  /** OPERATOR: remove an entry from the list. Accounts it was admitting are refused at their next request, and their sessions and app tokens are ended. Refused on prod. */
4838
4838
  revokeTierAccessRule: TierAccessRule;
4839
- /** Reverts every voxel edit made by `userId` in `appId` between `from` and `to`, returning one RollbackVoxelEventResult per affected voxel (`applied` tells you whether each was actually changed). DEFAULTS to dryRun=true, which only PREVIEWS the planned reversions without writing; pass dryRun=false to actually apply them (DESTRUCTIVE — mutates world state). A reverted voxel’s edit-log row takes the earlier edit’s type, state and author and the ROLLBACK’s time as its createdAt, so a client reading edits `since` its last sync sees the revert. Requires a valid bearer token AND the `manage_apps` permission on the org that owns `appId` (super admins bypass). */
4839
+ /** Reverts every voxel edit made by `userId` in `appId` between `from` and `to`, returning one RollbackVoxelEventResult per affected voxel (`applied` tells you whether each was actually changed). DEFAULTS to dryRun=true, which only PREVIEWS the planned reversions without writing; pass dryRun=false to actually apply them (DESTRUCTIVE — mutates world state). A reverted voxel’s edit-log row takes the earlier edit’s type, state and author and the ROLLBACK’s time as its createdAt, so a client reading edits `since` its last sync sees the revert. When the app’s wilderness is closed (`wildernessOpen` false), an applied rollback that would write any chunk of closed, unclaimed wilderness is refused (403) before it writes anything; a dry run is not. Requires a valid bearer token AND the `manage_apps` permission on the org that owns `appId` (super admins bypass). */
4840
4840
  rollbackVoxelUpdates: Array<RollbackVoxelEventResult>;
4841
4841
  /** OPERATOR ONLY. Runs the shared-usage billing tick once. It still bills only the last CLOSED clock hour — it will not charge an open hour. Use this to prove a closed-hour debit without waiting for the ~60s cron. Backdating usage rows is a local-test fixture, not something this mutation does on a live tier. */
4842
4842
  runSharedUsageBillingTick: Scalars['Boolean']['output'];
@@ -6799,7 +6799,7 @@ export type Query = {
6799
6799
  execMods: Array<ExecMod>;
6800
6800
  /** Your mods in an app, on every grid. */
6801
6801
  execMyMods: Array<ExecMod>;
6802
- /** The starter packs, which replace the compute templates: a world tick (the root hub: clock, weather, resource nodes, liveops events), a matchmaker, game sessions (lobby, host, turns, scores) and an NPC and mob engine, as ckx-sdk crates to pass to `execBuild` and a manifest for `execDeploy`. Requires the org 'manage_compute' permission. */
6802
+ /** The starter packs, which replace the compute templates: ckx-sdk hub crates for a root world, matchmaking, game sessions, NPCs and mobs, game genres (leaderboards, cards, tactics, waves, duels, private runs, arenas, races, territory), and the economy (a player's own hub, markets), to pass to `execBuild`, with a manifest for `execDeploy`. `starters` has one entry per node type, so a crate that serves two types appears twice: build it once. Requires the org 'manage_compute' permission. */
6803
6803
  execStarters: ExecStarterPack;
6804
6804
  /** An app's deployed ck-exec versions, newest first, and which is active. Requires the org 'view_compute_diagnostics' permission. */
6805
6805
  execVersions: Array<ExecVersion>;