@kradle/challenges-sdk 0.9.0 → 0.11.0
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/CHANGELOG.md +50 -1
- package/LLM_README.md +235 -2340
- package/README.md +151 -571
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/runtime/examples/capture-the-flag.d.ts +33 -0
- package/dist/runtime/examples/capture-the-flag.d.ts.map +1 -0
- package/dist/runtime/examples/capture-the-flag.js +79 -0
- package/dist/runtime/examples/capture-the-flag.js.map +1 -0
- package/dist/runtime/examples/climb.d.ts +34 -0
- package/dist/runtime/examples/climb.d.ts.map +1 -0
- package/dist/runtime/examples/climb.js +54 -0
- package/dist/runtime/examples/climb.js.map +1 -0
- package/dist/runtime/examples/four-bridges.d.ts +107 -0
- package/dist/runtime/examples/four-bridges.d.ts.map +1 -0
- package/dist/runtime/examples/four-bridges.js +294 -0
- package/dist/runtime/examples/four-bridges.js.map +1 -0
- package/dist/runtime/examples/herding.d.ts +59 -0
- package/dist/runtime/examples/herding.d.ts.map +1 -0
- package/dist/runtime/examples/herding.js +181 -0
- package/dist/runtime/examples/herding.js.map +1 -0
- package/dist/runtime/examples/skywars.d.ts +116 -0
- package/dist/runtime/examples/skywars.d.ts.map +1 -0
- package/dist/runtime/examples/skywars.js +253 -0
- package/dist/runtime/examples/skywars.js.map +1 -0
- package/dist/runtime/harness.d.ts +176 -0
- package/dist/runtime/harness.d.ts.map +1 -0
- package/dist/runtime/harness.js +441 -0
- package/dist/runtime/harness.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +18 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/sandbox-registry.d.ts +7 -0
- package/dist/runtime/sandbox-registry.d.ts.map +1 -0
- package/dist/runtime/sandbox-registry.js +16 -0
- package/dist/runtime/sandbox-registry.js.map +1 -0
- package/dist/runtime/sandbox.d.ts +29 -0
- package/dist/runtime/sandbox.d.ts.map +1 -0
- package/dist/runtime/sandbox.js +70 -0
- package/dist/runtime/sandbox.js.map +1 -0
- package/dist/runtime/sdk.d.ts +1038 -0
- package/dist/runtime/sdk.d.ts.map +1 -0
- package/dist/runtime/sdk.js +1271 -0
- package/dist/runtime/sdk.js.map +1 -0
- package/dist/runtime/world.d.ts +141 -0
- package/dist/runtime/world.d.ts.map +1 -0
- package/dist/runtime/world.js +344 -0
- package/dist/runtime/world.js.map +1 -0
- package/package.json +76 -39
- package/dist/actions.d.ts +0 -901
- package/dist/actions.d.ts.map +0 -1
- package/dist/actions.js +0 -1155
- package/dist/actions.js.map +0 -1
- package/dist/api_utils.d.ts +0 -25
- package/dist/api_utils.d.ts.map +0 -1
- package/dist/api_utils.js +0 -48
- package/dist/api_utils.js.map +0 -1
- package/dist/challenge.d.ts +0 -58
- package/dist/challenge.d.ts.map +0 -1
- package/dist/challenge.js +0 -578
- package/dist/challenge.js.map +0 -1
- package/dist/commands.d.ts +0 -57
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -200
- package/dist/commands.js.map +0 -1
- package/dist/constants.d.ts +0 -72
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -109
- package/dist/constants.js.map +0 -1
- package/dist/testmode.d.ts +0 -3
- package/dist/testmode.d.ts.map +0 -1
- package/dist/testmode.js +0 -19
- package/dist/testmode.js.map +0 -1
- package/dist/types.d.ts +0 -197
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -38
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -17
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -22
- package/dist/utils.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,53 @@ also hand-edit this file or the [Unreleased] section at any time.
|
|
|
17
17
|
|
|
18
18
|
## [Unreleased]
|
|
19
19
|
|
|
20
|
+
## [0.11.0] - 2026-09-15
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- The runtime SDK: a challenge is one `defineChallenge(config, spec)` call that returns a reducer, `reduce(state, event) -> { state, actions }`. Kradle feeds it the facts the server reports and applies the effects it returns; the reducer decides the scores, the zones, the votes and the end state. State types come from the initializers (`game()`, `player()`, per-role players) and `ContextOf` types the helpers, so you never write a type argument. Observations are frozen and applied whole per tick, so every player's zone membership is complete before a tick's handlers run. A throw in one of your callbacks ends the run as `error_challenge` and never loses `game_over`. See the runtime chapters of `README.md` and `LLM_README.md`.
|
|
25
|
+
- The world mirror in the state: a palette of block states, sparse chunk sections, entities with rotation and equipment, and the other players. A rule reads blocks and entities without asking the server.
|
|
26
|
+
- The test harness (`@kradle/challenges-sdk/runtime/harness`): `Game` feeds events, checks that `reduce` does not mutate its input, and replays a game from its start on request; `Fake` scripts a player; `terrain`, `setBlocks`, `spawnEntity`, `moveEntities` and `other` feed the mirror.
|
|
27
|
+
- The sandbox for tests (`@kradle/challenges-sdk/runtime/sandbox`): `lockdownOnce()` applies the SES lockdown, `loadBundle()`/`loadBundleFile()` evaluate a built bundle in an empty `Compartment` and return the challenge, and `sandboxed(challenge)` swaps an imported challenge for the bundle named by `KRADLE_CHALLENGE_BUNDLE`. With that variable set, a `Game` on the imported source throws, so `kradle challenge test` proves your tests ran on the built bundle (no clock, no random, no timers). The loaders are async.
|
|
28
|
+
- Reference challenges with tests: Climb, Capture the Flag, Four Bridges, Skywars and Herding.
|
|
29
|
+
- Durations: `addDuration`, `subtractDuration`, `asSeconds`, `asMinutes`; `seconds()`, `minutes()`, `ticks()` and `toTicks()` reject a negative or non-finite value and round a fraction to the nearest tick.
|
|
30
|
+
- `onOver(g, result)`: `result.winnerPlayers` and `result.isWinner(p)` next to the names; `result.endState` is typed (a declared end state, an SDK error state, or "").
|
|
31
|
+
- `ContextOfChallenge<typeof challenge>`: the context type of a built challenge, for tests.
|
|
32
|
+
- Harness: `begin` takes a position per roster entry (`{ role, at }`) so `start` sees it; `sample(players, entities?)` is one tick with several samples; `after`/`at` land on the exact tick; `walkResult` selects a pending walk by player or id; `replay()` starts from the checkpoint after `resume`; a fake player's item slots belong to one game.
|
|
33
|
+
- Declared containers: `containers: { [name]: Vec3 }` in the spec, `g.contents(name | at)` for the item counts, `on.container({ at, items, changes, by? })` on every change, `Game.container(at, items, opts?)` in the harness. The engine reports the contents (capability `containers`); a delivery rule reads the chest instead of guessing from an inventory decrease. A report for a position that is not declared is ignored. Each half of a double chest is its own container; a broken container reports its slots as emptied.
|
|
34
|
+
- `g.store(name, value, player?)`: a stored variable whose last value reaches the run result (`customVars`) and the `runs get` columns.
|
|
35
|
+
- `on.gamemode(g, { player, gamemode })`, and joins that carry `uuid` and `gamemode`. New capabilities `lifecycle` and `requests`: `configured.online` is the operational roster, and `requests` names the `/kradle give|trade|vote` commands for humans.
|
|
36
|
+
- The player vote: `votes: { player: {...} }` opens the vote `skills.voteForPlayer` casts in; its options are the other participants (`PLAYER_VOTE`, `OptionFor`).
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- `@kradle/challenges-sdk` (the main entry) is the reducer API, the same as `@kradle/challenges-sdk/runtime`. Both imports work.
|
|
41
|
+
- The options of a vote are typed by its id: after `if (voteId === "room")`, `option`, `g.votes("room")` and `g.vote(p, "room")` carry that vote's options only (`OptionFor`, `g.votes<V>`, `g.vote<V>`).
|
|
42
|
+
- Every SDK field on a player except `score`, every entity and every other player are read-only for a rule (the engine writes them).
|
|
43
|
+
- **Breaking:** `g.goTo` of a phase that is not declared throws (the run ends as `error_challenge`) instead of an unknown phase state.
|
|
44
|
+
|
|
45
|
+
### Removed
|
|
46
|
+
|
|
47
|
+
- **Breaking:** The Sandstone datapack API (`createChallenge`, `Actions`, `forEveryPlayer`, the `sandstone` peer dependency, the datapack chapters of the docs). Kradle runs reducer challenges only. A challenge that still imports the old API fails `kradle challenge build` with a message; the Kradle team migrates existing challenges.
|
|
48
|
+
- **Breaking:** `world.clearInventory`: players start with an empty inventory, so the start no longer sends a `clear` effect.
|
|
49
|
+
|
|
50
|
+
## [0.10.0] - 2026-07-17
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- `start_challenge` now performs all setup in a single tick. The separate `init_participants` function that ran one second later is removed; its handler (if defined) runs in the same tick, immediately after the `start_challenge` handler.
|
|
55
|
+
- The implicit inventory clear now runs before user events, so items given in `start_challenge` survive it.
|
|
56
|
+
|
|
57
|
+
### Deprecated
|
|
58
|
+
|
|
59
|
+
- `init_participants` event. Use `start_challenge` instead. Using `init_participants` logs a build-time deprecation warning.
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
- `.end_condition()` now defers callback evaluation to `build()`, fixing the documented bridge pattern where a variable captured from an event handler was always `undefined` at chain time.
|
|
64
|
+
- **Breaking:** `.end_condition()` callbacks that return `undefined` now throw at build time instead of silently falling back to the tick-limit end condition. Either omit `.end_condition()` entirely or return a `ConditionType`.
|
|
65
|
+
- `LLM_README.md` now documents that the `.end_condition()` callback must return a `ConditionType`.
|
|
66
|
+
|
|
20
67
|
## [0.9.0] - 2026-07-16
|
|
21
68
|
|
|
22
69
|
### Removed
|
|
@@ -71,7 +118,9 @@ also hand-edit this file or the [Unreleased] section at any time.
|
|
|
71
118
|
- Voting primitives (`votedFor`, `promptVote`, `allVotesIn`, `assignDefaultVotes`) for challenges that use discuss-then-vote-then-act phases as an alternative to pad-based voting.
|
|
72
119
|
- Build-time validation of vote IDs and options against `KRADLE_CHALLENGE_VOTING_OPTIONS` (when set), matching the existing `getLocation`/`setEndState` pattern. `promptVote` also validates each announced option against the declared `votingOptions`.
|
|
73
120
|
|
|
74
|
-
[Unreleased]: https://github.com/Kradle-ai/challenges-sdk/compare/v0.
|
|
121
|
+
[Unreleased]: https://github.com/Kradle-ai/challenges-sdk/compare/v0.11.0...HEAD
|
|
122
|
+
[0.11.0]: https://github.com/Kradle-ai/challenges-sdk/compare/v0.10.0...v0.11.0
|
|
123
|
+
[0.10.0]: https://github.com/Kradle-ai/challenges-sdk/compare/v0.9.0...v0.10.0
|
|
75
124
|
[0.9.0]: https://github.com/Kradle-ai/challenges-sdk/compare/v0.8.1...v0.9.0
|
|
76
125
|
[0.8.1]: https://github.com/Kradle-ai/challenges-sdk/compare/v0.8.0...v0.8.1
|
|
77
126
|
[0.8.0]: https://github.com/Kradle-ai/challenges-sdk/compare/v0.7.2...v0.8.0
|