@crowdedkingdoms/ckx-kit 0.0.0-stage → 0.1.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/LICENSE-APACHE +176 -0
  2. package/LICENSE-MIT +21 -0
  3. package/README.md +76 -2
  4. package/checks/compute-toolchain/host-catalog.json +68 -0
  5. package/crates/ckx-sdk/Cargo.toml +17 -0
  6. package/crates/ckx-sdk/LICENSE-APACHE +176 -0
  7. package/crates/ckx-sdk/LICENSE-MIT +21 -0
  8. package/crates/ckx-sdk/README.md +47 -0
  9. package/crates/ckx-sdk/src/abi.rs +115 -0
  10. package/crates/ckx-sdk/src/cron.rs +717 -0
  11. package/crates/ckx-sdk/src/emit.rs +140 -0
  12. package/crates/ckx-sdk/src/lib.rs +588 -0
  13. package/crates/ckx-sdk/src/model.rs +482 -0
  14. package/crates/ckx-sdk/src/node.rs +942 -0
  15. package/crates/ckx-sdk/src/rt.rs +519 -0
  16. package/crates/crowdy-client-sdk/Cargo.toml +15 -0
  17. package/crates/crowdy-client-sdk/LICENSE-APACHE +176 -0
  18. package/crates/crowdy-client-sdk/LICENSE-MIT +21 -0
  19. package/crates/crowdy-client-sdk/README.md +25 -0
  20. package/crates/crowdy-client-sdk/src/lib.rs +698 -0
  21. package/dist/checks/src/build/client-capabilities.js +123 -0
  22. package/dist/checks/src/build/exec-source.js +343 -0
  23. package/dist/checks/src/build/rust-source-guard.js +165 -0
  24. package/dist/checks/src/build/wasm-inspect.js +249 -0
  25. package/dist/cli/src/build.js +99 -0
  26. package/dist/cli/src/crate.js +64 -0
  27. package/dist/cli/src/doctor.js +51 -0
  28. package/dist/cli/src/kit.js +66 -0
  29. package/dist/cli/src/main.js +109 -0
  30. package/dist/cli/src/new.js +74 -0
  31. package/dist/cli/src/tools.js +104 -0
  32. package/kit.pin +9 -0
  33. package/package.json +81 -4
  34. package/rust-toolchain.toml +6 -0
  35. package/starters/ckx.json +9 -0
  36. package/starters/grid-mod/Cargo.toml +13 -0
  37. package/starters/grid-mod/src/lib.rs +82 -0
  38. package/starters/matchmaker/Cargo.toml +13 -0
  39. package/starters/matchmaker/src/lib.rs +362 -0
  40. package/starters/npc-mobs/Cargo.toml +14 -0
  41. package/starters/npc-mobs/src/lib.rs +469 -0
  42. package/starters/session/Cargo.toml +13 -0
  43. package/starters/session/src/lib.rs +395 -0
  44. package/starters/world-tick/Cargo.toml +14 -0
  45. package/starters/world-tick/src/lib.rs +346 -0
  46. package/templates/client/Cargo.toml +16 -0
  47. package/templates/client/src/lib.rs +31 -0
  48. package/templates/hub/Cargo.toml +11 -0
  49. package/templates/hub/src/lib.rs +73 -0
  50. package/templates/spoke/Cargo.toml +11 -0
  51. package/templates/spoke/src/lib.rs +53 -0
  52. package/tools/instrument/Cargo.lock +140 -0
  53. package/tools/instrument/Cargo.toml +11 -0
  54. package/tools/instrument/src/main.rs +165 -0
  55. package/vendor.lock +167 -0
package/LICENSE-APACHE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CrowdedKingdoms
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,77 @@
1
- # Temporary Holding Version
1
+ # ckx-kit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Build, check and test [ck-exec](https://docs.crowdedkingdoms.com/exec/intro) mods, hubs and spokes
4
+ for Crowded Kingdoms on your own machine, as the platform builds them, without deploying anything.
5
+
6
+ The kit is the public half of the platform's compute toolchain: the SDKs your crate compiles
7
+ against, the checks the platform runs before and after it compiles, the tool that meters a mod's
8
+ CLIENT half, the starters, and the Rust release the platform pins. Its `ckx-kit` command runs
9
+ those same checks, so a crate that passes here builds on the platform. What you deploy is still
10
+ built by the platform from its source.
11
+
12
+ ## What you need
13
+
14
+ - [rustup](https://rustup.rs). Projects pin the Rust release the platform builds with
15
+ (`rust-toolchain.toml`); install it with
16
+ `rustup toolchain install <that version> --target wasm32-unknown-unknown`.
17
+ - Node.js 20 or later.
18
+ - [binaryen](https://github.com/WebAssembly/binaryen) (`wasm-opt`), for a mod's CLIENT half only:
19
+ `apt install binaryen` or `brew install binaryen`.
20
+
21
+ `npx @crowdedkingdoms/ckx-kit doctor` says what is missing.
22
+
23
+ ## Start a mod
24
+
25
+ ```bash
26
+ npx @crowdedkingdoms/ckx-kit new mod my-mod
27
+ cd my-mod
28
+ cargo test # your logic, natively
29
+ npx @crowdedkingdoms/ckx-kit build --mod # the platform's build and checks
30
+ ```
31
+
32
+ `build` writes the module to `target/ckx-kit/`. When it passes, build and deploy the same sources
33
+ on the platform: Crowdy Studio, or `execModBuild` then `execModDeploy` (see
34
+ [mods](https://docs.crowdedkingdoms.com/exec/mods)).
35
+
36
+ ## Commands
37
+
38
+ | Command | What it does |
39
+ |---|---|
40
+ | `ckx-kit new <template> <name>` | A crate to start from: `mod`, `client` (a mod's CLIENT half), `hub`, `spoke`, or a starter pack crate (`world-tick`, `matchmaker`, `session`, `npc-mobs`). |
41
+ | `ckx-kit check [dir]` | The platform's source checks, on exactly the files it takes (`Cargo.toml`, `README.md`, `.rs` files under `src/`). Lists what it would not send. |
42
+ | `ckx-kit build [dir]` | The checks, then the pinned Rust for `wasm32-unknown-unknown` with the platform's release profile and the platform's dependency versions, then the module check. `--mod` adds the mod limits. A CLIENT half is metered and optimized as the platform does it, and its capability summary, the list visitors are asked to agree to, is printed with its hash. `--json` prints a report. |
43
+ | `ckx-kit doctor` | What a build here needs, and which platform toolchain this kit matches. |
44
+
45
+ `CKX_KIT_TARGET_DIR` shares one cargo target directory between crates, so their dependencies
46
+ compile once.
47
+
48
+ ## What it does not check
49
+
50
+ Fuel, memory and deadlines are measured only where the module runs: on the platform. Your
51
+ crate's native `cargo test` runs your logic, not the platform's limits. The platform also rebuilds
52
+ from your source, so its module's digest differs from yours (the build paths embedded in it
53
+ differ); the checks and the CLIENT capability hash do not.
54
+
55
+ ## Versions
56
+
57
+ Crowded Kingdoms runs three environments, and each has its own builds:
58
+
59
+ | Environment | npm | `ckx-sdk` and `crowdy-client-sdk` on crates.io |
60
+ |---|---|---|
61
+ | dev | `@crowdedkingdoms/ckx-kit@dev` | `X.Y.Z-dev.N` |
62
+ | test | `@crowdedkingdoms/ckx-kit@test` | `X.Y.Z-test.N` |
63
+ | production | `@crowdedkingdoms/ckx-kit` (`latest`) | `X.Y.Z` |
64
+
65
+ Use the kit of the environment you deploy to. A plain requirement such as `ckx-sdk = "0.8"` only
66
+ ever matches production builds; `ckx-kit new` writes the exact version its environment uses.
67
+ `kit.pin` names the platform toolchain release a kit was copied from.
68
+
69
+ ## Contributing
70
+
71
+ Issues and pull requests are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). The paths `kit.pin`
72
+ lists are copies of the platform's own and change upstream.
73
+
74
+ ## License
75
+
76
+ Licensed under either of the [MIT license](LICENSE-MIT) or the
77
+ [Apache License, Version 2.0](LICENSE-APACHE), at your option.
@@ -0,0 +1,68 @@
1
+ {
2
+ "catalogVersion": 1,
3
+ "description": "Every compute host function, once. Server dispatchers, the capability summary, the SDK parity gate and the CrowdyJS browser broker are all checked against this file (DN-10: grid scope = app scope intersected with grid confinement).",
4
+ "groups": {
5
+ "model": "Game Model containers, properties, edges and function invocation",
6
+ "state": "Durable user / avatar / grid state blobs",
7
+ "sessions": "Game Model sessions",
8
+ "world_read": "Chunk, voxel and actor reads",
9
+ "world_write": "Voxel writes",
10
+ "egress": "Replication and event egress",
11
+ "present": "Client HUD / overlay presentation",
12
+ "input": "Client input drains",
13
+ "meta": "Permission checks and binding metadata"
14
+ },
15
+ "functions": [
16
+ { "name": "container_create", "group": "model", "targets": ["server", "client"], "app": "Any container in the app", "grid": "Created on the player tier, owned by the executing identity and tagged with the grid" },
17
+ { "name": "container_get", "group": "model", "targets": ["server", "client"], "app": "Any container in the app", "grid": "Only containers the executing identity owns on this grid; others are unavailable" },
18
+ { "name": "container_get_batch", "group": "model", "targets": ["server", "client"], "app": "Up to 32 containers in the app", "grid": "Up to 32 owned containers on this grid; foreign ids are silently absent" },
19
+ { "name": "container_get_by_key", "group": "model", "targets": ["server"], "app": "One container by type, session and binding key", "grid": "Not offered; player grids have no binding keys" },
20
+ { "name": "containers_list", "group": "model", "targets": ["server", "client"], "app": "Filtered list over the app", "grid": "Owned containers on this grid" },
21
+ { "name": "container_delete", "group": "model", "targets": ["server", "client"], "app": "Any container in the app", "grid": "Owned containers on this grid" },
22
+ { "name": "property_set", "group": "model", "targets": ["server", "client"], "app": "Any container in the app", "grid": "Owned containers on this grid" },
23
+ { "name": "model_invoke", "group": "model", "targets": ["server", "client"], "app": "Trusted automation path, optional worldWrites", "grid": "Ordinary player path as the executing identity; no worldWrites" },
24
+ { "name": "edge_add", "group": "model", "targets": ["server", "client"], "app": "Any two containers in the app", "grid": "Both endpoints owned on this grid" },
25
+ { "name": "edge_delete", "group": "model", "targets": ["server", "client"], "app": "Any edge in the app", "grid": "Edges between owned containers on this grid" },
26
+ { "name": "sessions_list", "group": "sessions", "targets": ["server", "client"], "app": "Every session in the app", "grid": "Sessions whose gridId is this grid" },
27
+ { "name": "user_state_get", "group": "state", "targets": ["server", "client"], "app": "Any user in the app", "grid": "The executing identity only" },
28
+ { "name": "user_state_set", "group": "state", "targets": ["server", "client"], "app": "Any user in the app", "grid": "The executing identity only" },
29
+ { "name": "avatar_state_get", "group": "state", "targets": ["server", "client"], "app": "Any avatar in the app", "grid": "Avatars whose live actor is inside the grid" },
30
+ { "name": "grid_state_get", "group": "state", "targets": ["server", "client"], "app": "Any grid in the app", "grid": "This grid only" },
31
+ { "name": "grid_state_set", "group": "state", "targets": ["server", "client"], "app": "Any grid in the app", "grid": "This grid only" },
32
+ { "name": "chunk_get", "group": "world_read", "targets": ["server", "client"], "app": "Any chunk in the app", "grid": "Chunks inside the grid box" },
33
+ { "name": "voxels_list", "group": "world_read", "targets": ["server", "client"], "app": "Any chunk in the app", "grid": "Chunks inside the grid box" },
34
+ { "name": "actors_list", "group": "world_read", "targets": ["server", "client"], "app": "Any chunk in the app", "grid": "Chunks inside the grid box" },
35
+ { "name": "actors_list_radius", "group": "world_read", "targets": ["server", "client"], "app": "Chunk box around a centre", "grid": "Centre inside the grid box; the box is clipped to the grid" },
36
+ { "name": "voxel_set", "group": "world_write", "targets": ["server", "client"], "app": "System writer, any chunk", "grid": "Chunks inside the grid box, and update_voxel_data on the grid" },
37
+ { "name": "grid_permission_check", "group": "meta", "targets": ["server", "client"], "app": "Any user and grid in the app", "grid": "The executing identity on this grid" },
38
+ { "name": "grid_info", "group": "meta", "targets": ["client"], "app": "Not offered", "grid": "The binding's own grid id and box, answered locally" },
39
+ { "name": "emit_spatial", "group": "egress", "targets": ["server", "client"], "app": "Any origin chunk", "grid": "Origin chunk inside the grid box; reach is min(distance, 8, spatial_max_distance)", "egress": true },
40
+ { "name": "emit_channel", "group": "egress", "targets": ["server", "client"], "app": "Any channel in the app", "grid": "Channels of this grid (channel_egress='grid'), or channels the owner may send_messages on (channel_egress='send_messages')", "egress": true },
41
+ { "name": "emit_event", "group": "egress", "targets": ["server", "client"], "app": "The app compute event bus", "grid": "The grid event bus: modules on this grid, and app modules with a grid_event trigger", "egress": true },
42
+ { "name": "hud_set", "group": "present", "targets": ["client"], "app": "Not offered", "grid": "The player's own HUD" },
43
+ { "name": "overlay_draw", "group": "present", "targets": ["client"], "app": "Not offered", "grid": "The player's own overlay" },
44
+ { "name": "pointer_clicks", "group": "input", "targets": ["client"], "app": "Refused on the server", "grid": "Refused on the server" },
45
+ { "name": "input_axes", "group": "input", "targets": ["client"], "app": "Refused on the server", "grid": "The player's own movement axes (WASD / stick), drained by the page" },
46
+ { "name": "input_look", "group": "input", "targets": ["client"], "app": "Refused on the server", "grid": "The player's own pointer-look delta since the last poll" },
47
+ { "name": "input_key", "group": "input", "targets": ["client"], "app": "Refused on the server", "grid": "Whether one named key is held by the player" },
48
+ { "name": "clock", "group": "meta", "targets": ["client"], "app": "Refused on the server", "grid": "The page's wall clock in milliseconds, answered locally" },
49
+ { "name": "pose_get", "group": "world_read", "targets": ["client"], "app": "Refused on the server", "grid": "The player's own body pose (held by the mod, or the walker)" },
50
+ { "name": "pose_set", "group": "world_write", "targets": ["client"], "app": "Refused on the server", "grid": "The player's own body, positions inside the grid box only" },
51
+ { "name": "pose_release", "group": "world_write", "targets": ["client"], "app": "Refused on the server", "grid": "Hand the player's own body back to the walker" },
52
+ { "name": "teleport_request", "group": "world_write", "targets": ["client"], "app": "Refused on the server", "grid": "The player's own body, destinations inside the grid box only" },
53
+ { "name": "actor_spawn", "group": "world_write", "targets": ["client"], "app": "Refused on the server", "grid": "A mod-owned actor placed inside the grid box, replicated from the player's session" },
54
+ { "name": "actor_pose", "group": "world_write", "targets": ["client"], "app": "Refused on the server", "grid": "A mod-owned actor of this session, positions inside the grid box only" },
55
+ { "name": "actor_despawn", "group": "world_write", "targets": ["client"], "app": "Refused on the server", "grid": "A mod-owned actor of this session" },
56
+ { "name": "scene_catalog", "group": "present", "targets": ["client"], "app": "Refused on the server", "grid": "The mod's construct.scene.v1 templates, kept in the page" },
57
+ { "name": "scene_instances", "group": "present", "targets": ["client"], "app": "Refused on the server", "grid": "Template instances inside the grid box, drawn locally" },
58
+ { "name": "avatar_appearance", "group": "present", "targets": ["client"], "app": "Refused on the server", "grid": "The player's own avatar tint" },
59
+ { "name": "avatar_state_set", "group": "state", "targets": ["client"], "app": "Refused on the server", "grid": "The player's own avatar state blob" },
60
+ { "name": "voice_set", "group": "present", "targets": ["client"], "app": "Refused on the server", "grid": "Start or stop the player's own microphone; the page still asks the browser" },
61
+ { "name": "video_set", "group": "present", "targets": ["client"], "app": "Refused on the server", "grid": "Start or stop the player's own camera; the page still asks the browser" },
62
+ { "name": "send_client_event", "group": "egress", "targets": ["client"], "app": "Refused on the server", "grid": "A ClientEvent on the UDP fan-out from the player's own chunk, inside the grid box", "egress": true },
63
+ { "name": "events_poll", "group": "egress", "targets": ["client"], "app": "Refused on the server", "grid": "ClientEvents received by the player's session since the last poll" },
64
+ { "name": "send_text", "group": "egress", "targets": ["client"], "app": "Refused on the server", "grid": "A spatial text packet from the player's own chunk, as the player", "egress": true },
65
+ { "name": "send_actor_message", "group": "egress", "targets": ["client"], "app": "Refused on the server", "grid": "A single-actor message from the player's session to one actor inside the grid box", "egress": true },
66
+ { "name": "send_channel_message", "group": "egress", "targets": ["client"], "app": "Refused on the server", "grid": "A channel message as the player, on channels the player may send on", "egress": true }
67
+ ]
68
+ }
@@ -0,0 +1,17 @@
1
+ [package]
2
+ name = "ckx-sdk"
3
+ version = "0.8.0-dev.1"
4
+ edition = "2024"
5
+ description = "Write ck-exec hubs, spokes and mods for Crowded Kingdoms in Rust, compiled to wasm32-unknown-unknown"
6
+ license = "MIT OR Apache-2.0"
7
+ homepage = "https://docs.crowdedkingdoms.com/exec/intro"
8
+ repository = "https://github.com/CrowdedKingdoms/ckx-kit"
9
+ readme = "README.md"
10
+ keywords = ["crowded-kingdoms", "ck-exec", "wasm", "gamedev", "sdk"]
11
+ categories = ["game-development", "wasm"]
12
+
13
+ [dependencies]
14
+ base64 = "0.22"
15
+ rmp-serde = "1"
16
+ serde = { version = "1", features = ["derive"] }
17
+ serde_json = "1"
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CrowdedKingdoms
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,47 @@
1
+ # ckx-sdk
2
+
3
+ Write [ck-exec](https://docs.crowdedkingdoms.com/exec/intro) hubs, spokes and mods for Crowded
4
+ Kingdoms in Rust. A hub owns state and runs one handler at a time; a spoke holds no authoritative
5
+ state and scales out; a [mod](https://docs.crowdedkingdoms.com/exec/mods) is a player's code on a
6
+ grid they own, run as a hub. Each is a plain Rust type exported with `export_hub!` or
7
+ `export_spoke!` and built for `wasm32-unknown-unknown`.
8
+
9
+ ```rust
10
+ use ckx_sdk::prelude::*;
11
+
12
+ #[derive(Default, Serialize, Deserialize)]
13
+ struct Counter { total: i64 }
14
+
15
+ impl Hub for Counter {
16
+ fn spawn(_ctx: &Ctx, _seed: &[u8]) -> Result<Self> { Ok(Self::default()) }
17
+ fn load(_ctx: &Ctx, snapshot: &[u8], _from_version: u64) -> Result<Self> { decode(snapshot) }
18
+ fn persist(&mut self, _ctx: &Ctx) -> Result<Vec<u8>> { encode(self) }
19
+ fn handle(&mut self, _ctx: &Ctx, call: Call<'_>) -> Result<Vec<u8>> {
20
+ match call.method {
21
+ "add" => { self.total += call.decode::<i64>()?; encode(&self.total) }
22
+ other => Err(Error::unknown_method(other)),
23
+ }
24
+ }
25
+ }
26
+
27
+ ckx_sdk::export_hub!(Counter);
28
+ ```
29
+
30
+ ## Building
31
+
32
+ The platform builds your crate from its source (`execBuild`, `execModBuild`, or Crowdy Studio)
33
+ against its own copy of this crate, so the version you name here is for building, testing and
34
+ editing on your machine. [`@crowdedkingdoms/ckx-kit`](https://www.npmjs.com/package/@crowdedkingdoms/ckx-kit)
35
+ runs the platform's checks and build locally.
36
+
37
+ ## Versions
38
+
39
+ Each Crowded Kingdoms environment has its own builds: `X.Y.Z-dev.N` for dev, `X.Y.Z-test.N` for
40
+ test, and plain `X.Y.Z` for production. A plain requirement such as `ckx-sdk = "0.7"` only ever
41
+ matches production builds; name a dev or test build exactly, for example
42
+ `ckx-sdk = "=0.7.0-dev.1"`.
43
+
44
+ ## License
45
+
46
+ Licensed under either of the [MIT license](LICENSE-MIT) or the
47
+ [Apache License, Version 2.0](LICENSE-APACHE), at your option.