@kradle/challenges-sdk 0.10.0 → 0.12.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/LLM_README.md +235 -2333
  3. package/README.md +150 -570
  4. package/dist/index.d.ts +1 -4
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -6
  7. package/dist/index.js.map +1 -1
  8. package/dist/runtime/examples/capture-the-flag.d.ts +33 -0
  9. package/dist/runtime/examples/capture-the-flag.d.ts.map +1 -0
  10. package/dist/runtime/examples/capture-the-flag.js +79 -0
  11. package/dist/runtime/examples/capture-the-flag.js.map +1 -0
  12. package/dist/runtime/examples/climb.d.ts +34 -0
  13. package/dist/runtime/examples/climb.d.ts.map +1 -0
  14. package/dist/runtime/examples/climb.js +54 -0
  15. package/dist/runtime/examples/climb.js.map +1 -0
  16. package/dist/runtime/examples/four-bridges.d.ts +107 -0
  17. package/dist/runtime/examples/four-bridges.d.ts.map +1 -0
  18. package/dist/runtime/examples/four-bridges.js +294 -0
  19. package/dist/runtime/examples/four-bridges.js.map +1 -0
  20. package/dist/runtime/examples/herding.d.ts +59 -0
  21. package/dist/runtime/examples/herding.d.ts.map +1 -0
  22. package/dist/runtime/examples/herding.js +181 -0
  23. package/dist/runtime/examples/herding.js.map +1 -0
  24. package/dist/runtime/examples/skywars.d.ts +116 -0
  25. package/dist/runtime/examples/skywars.d.ts.map +1 -0
  26. package/dist/runtime/examples/skywars.js +253 -0
  27. package/dist/runtime/examples/skywars.js.map +1 -0
  28. package/dist/runtime/sandbox-registry.d.ts +7 -0
  29. package/dist/runtime/sandbox-registry.d.ts.map +1 -0
  30. package/dist/runtime/sandbox-registry.js +16 -0
  31. package/dist/runtime/sandbox-registry.js.map +1 -0
  32. package/dist/runtime/sandbox.d.ts +29 -0
  33. package/dist/runtime/sandbox.d.ts.map +1 -0
  34. package/dist/runtime/sandbox.js +70 -0
  35. package/dist/runtime/sandbox.js.map +1 -0
  36. package/dist/runtime/sdk.d.ts +1038 -0
  37. package/dist/runtime/sdk.d.ts.map +1 -0
  38. package/dist/runtime/sdk.js +1271 -0
  39. package/dist/runtime/sdk.js.map +1 -0
  40. package/dist/runtime/world.d.ts +141 -0
  41. package/dist/runtime/world.d.ts.map +1 -0
  42. package/dist/runtime/world.js +344 -0
  43. package/dist/runtime/world.js.map +1 -0
  44. package/dist/test/harness.d.ts +176 -0
  45. package/dist/test/harness.d.ts.map +1 -0
  46. package/dist/test/harness.js +441 -0
  47. package/dist/test/harness.js.map +1 -0
  48. package/dist/test/helpers.d.ts +7 -0
  49. package/dist/test/helpers.d.ts.map +1 -0
  50. package/dist/test/helpers.js +12 -0
  51. package/dist/test/helpers.js.map +1 -0
  52. package/dist/test/index.d.ts +3 -0
  53. package/dist/test/index.d.ts.map +1 -0
  54. package/dist/test/index.js +20 -0
  55. package/dist/test/index.js.map +1 -0
  56. package/package.json +69 -40
  57. package/dist/actions.d.ts +0 -901
  58. package/dist/actions.d.ts.map +0 -1
  59. package/dist/actions.js +0 -1155
  60. package/dist/actions.js.map +0 -1
  61. package/dist/api_utils.d.ts +0 -25
  62. package/dist/api_utils.d.ts.map +0 -1
  63. package/dist/api_utils.js +0 -48
  64. package/dist/api_utils.js.map +0 -1
  65. package/dist/challenge.d.ts +0 -58
  66. package/dist/challenge.d.ts.map +0 -1
  67. package/dist/challenge.js +0 -582
  68. package/dist/challenge.js.map +0 -1
  69. package/dist/commands.d.ts +0 -57
  70. package/dist/commands.d.ts.map +0 -1
  71. package/dist/commands.js +0 -200
  72. package/dist/commands.js.map +0 -1
  73. package/dist/constants.d.ts +0 -78
  74. package/dist/constants.d.ts.map +0 -1
  75. package/dist/constants.js +0 -109
  76. package/dist/constants.js.map +0 -1
  77. package/dist/testmode.d.ts +0 -3
  78. package/dist/testmode.d.ts.map +0 -1
  79. package/dist/testmode.js +0 -19
  80. package/dist/testmode.js.map +0 -1
  81. package/dist/types.d.ts +0 -195
  82. package/dist/types.d.ts.map +0 -1
  83. package/dist/types.js +0 -38
  84. package/dist/types.js.map +0 -1
  85. package/dist/utils.d.ts +0 -17
  86. package/dist/utils.d.ts.map +0 -1
  87. package/dist/utils.js +0 -22
  88. package/dist/utils.js.map +0 -1
package/dist/types.d.ts DELETED
@@ -1,195 +0,0 @@
1
- import type { Score, SelectorClass } from "sandstone";
2
- import type { OBJECTIVE_CRITERION } from "sandstone/arguments/generated";
3
- import type { AdvancementTriggers } from "sandstone/arguments/resources/AdvancementTriggers";
4
- import type { BUILTIN_VARIABLE_NAMES, POSSIBLE_SCENARIO_EVENTS } from "./constants";
5
- export { Actions } from "./actions";
6
- /**
7
- * Represents a spawn point location, either as explicit coordinates or as an entity selector.
8
- * When using an entity selector, it should target a single entity (e.g., a location marker).
9
- */
10
- export type SpawnPoint = {
11
- x: number;
12
- y: number;
13
- z: number;
14
- } | SelectorClass<true, false>;
15
- export type _SpecificObjectiveVariable<VARIABLE_NAMES extends string = string> = {
16
- type: "individual";
17
- objective_type: OBJECTIVE_CRITERION;
18
- /** The default value for the variable. 0 if undefined. */
19
- default?: number;
20
- /** The updater function is used to dynamically compute the value of the variable. */
21
- updater?: (value: Score, variables: Record<VARIABLE_NAMES, Score>) => void;
22
- };
23
- export type _DummyGlobalVariable<VARIABLE_NAMES extends string = string> = {
24
- type: "global";
25
- /** Whether the value should be displayed in-game. */
26
- hidden?: boolean;
27
- /** The default value for the variable. 0 if undefined. */
28
- default?: number;
29
- /** The updater function is used to dynamically compute the value of the variable. */
30
- updater?: (value: Score, variables: Record<VARIABLE_NAMES, Score>) => void;
31
- };
32
- export type _DummyIndividualVariable<VARIABLE_NAMES extends string = string> = {
33
- type: "individual";
34
- /** The default value for the variable. 0 if undefined. */
35
- default?: number;
36
- /** The updater function is used to dynamically compute the value of the variable. */
37
- updater?: (value: Score, variables: Record<VARIABLE_NAMES, Score>) => void;
38
- };
39
- /**
40
- * A custom variable defined for the whole challenge.
41
- */
42
- export type _InputVariableType<VARIABLE_NAMES extends string = string> = _SpecificObjectiveVariable<VARIABLE_NAMES> | _DummyGlobalVariable<VARIABLE_NAMES> | _DummyIndividualVariable<VARIABLE_NAMES>;
43
- export declare function isSpecificObjectiveVariable(variable: _InputVariableType<string>): variable is _SpecificObjectiveVariable<string>;
44
- /**
45
- * The base configuration necessary to define events, end conditions, and win conditions for a challenge.
46
- */
47
- export type _BaseConfig<ROLE_NAMES extends string, VARIABLE_NAMES extends string> = {
48
- /**
49
- * Name of the datapack that will be created for this challenge.
50
- */
51
- name: string;
52
- /**
53
- * @deprecated Ignored. The datapack output path is managed by the CLI, which
54
- * injects `KRADLE_CHALLENGES_PATH`; the SDK resolves the location from it
55
- * (falling back to `DEFAULT_CHALLENGE_PATH` for standalone use). Any value
56
- * passed here is ignored and logs a warning at build time. Kept optional only
57
- * for backward compatibility — remove it from your config.
58
- */
59
- kradle_challenge_path?: string;
60
- /**
61
- * Game duration in ticks.
62
- *
63
- * If not specified (or set to 0), the game will run indefinitely until
64
- * an explicit end condition is met.
65
- *
66
- * @default undefined (no time limit)
67
- */
68
- GAME_DURATION?: number;
69
- roles: ROLE_NAMES[];
70
- custom_variables: Record<VARIABLE_NAMES, _InputVariableType<VARIABLE_NAMES | BUILTIN_VARIABLE_NAMES>>;
71
- /**
72
- * The world spawn point for the challenge.
73
- * Can be either explicit coordinates `{ x, y, z }` or an entity selector
74
- * (e.g., from `Actions.getLocation({ name: "spawn" })`).
75
- * When using an entity selector, `setworldspawn` will be executed at the entity's location.
76
- */
77
- spawnPoint?: SpawnPoint;
78
- /**
79
- * Per-challenge overrides for the implicit setup the SDK applies inside
80
- * `start_challenge`, before user event handlers run. Defaults are sensible
81
- * for most challenges, so this can usually be omitted entirely.
82
- *
83
- * Pass partial overrides to disable individual rules — e.g.
84
- * `{ mobSpawning: true }` for a wave-defense challenge that needs
85
- * natural mob spawns.
86
- *
87
- * Pass `false` to disable everything — the user is responsible for
88
- * setting up time, gamerules, and per-player init themselves.
89
- *
90
- * @default { time: "day", daylightCycle: false, mobSpawning: false, naturalRegeneration: true, clearInventory: true, maxHealth: 20 }
91
- */
92
- defaults?: ChallengeDefaults | false;
93
- };
94
- /**
95
- * Knobs for the implicit setup the SDK runs inside `start_challenge`,
96
- * before user event handlers. Each field is optional and falls back to the
97
- * SDK-level default; pass `false` for a boolean field to disable that rule.
98
- */
99
- export type ChallengeDefaults = {
100
- /**
101
- * Initial in-game time. `false` to leave time alone (server-default;
102
- * clock continues based on world save).
103
- * @default "day"
104
- */
105
- time?: "day" | "noon" | "night" | "midnight" | false;
106
- /**
107
- * `gamerule doDaylightCycle`.
108
- * @default false (sun stays at noon → consistent visibility for the run)
109
- */
110
- daylightCycle?: boolean;
111
- /**
112
- * `gamerule doMobSpawning`. Override to `true` for wave-defense or
113
- * boss-summon challenges that depend on natural spawns.
114
- * @default false
115
- */
116
- mobSpawning?: boolean;
117
- /**
118
- * `gamerule naturalRegeneration`. Override to `false` for tight
119
- * combat-tuned challenges where healing-on-idle would mask agent skill.
120
- * @default true
121
- */
122
- naturalRegeneration?: boolean;
123
- /**
124
- * Clear every participant's inventory. Runs before user event handlers,
125
- * so items given in the `start_challenge` handler survive it.
126
- * @default true
127
- */
128
- clearInventory?: boolean;
129
- /**
130
- * `setAttribute generic.max_health` per participant. Pass `false` to
131
- * leave health alone (vanilla 20 HP). Pass a number to set a non-default
132
- * cap (e.g. 40 for a longer-form survival challenge).
133
- * @default 20
134
- */
135
- maxHealth?: number | false;
136
- };
137
- /** Resolved defaults — every field present, no `undefined` fallthroughs. */
138
- export type ResolvedDefaults = {
139
- time: "day" | "noon" | "night" | "midnight" | false;
140
- daylightCycle: boolean;
141
- mobSpawning: boolean;
142
- naturalRegeneration: boolean;
143
- clearInventory: boolean;
144
- maxHealth: number | false;
145
- };
146
- export declare const DEFAULT_CHALLENGE_DEFAULTS: ResolvedDefaults;
147
- /**
148
- * Resolve a partial `ChallengeDefaults` (or `false` for "skip all setup")
149
- * against the SDK-level defaults. Returns a fully-populated config the
150
- * SDK can read without optional-chaining everywhere.
151
- */
152
- export declare function resolveChallengeDefaults(input: ChallengeDefaults | false | undefined): ResolvedDefaults | null;
153
- export type _ScenarioEvents = Partial<Record<POSSIBLE_SCENARIO_EVENTS, () => void>>;
154
- export type Roles<ROLES_NAMES extends string = string> = {
155
- [role in ROLES_NAMES]: role;
156
- };
157
- export type FullVariable<VARIABLE_NAMES extends string = string> = {
158
- type: "individual" | "global";
159
- score: Score;
160
- default: number | undefined;
161
- updater: ((value: Score, variables: Record<VARIABLE_NAMES, Score>) => void) | undefined;
162
- };
163
- /**
164
- * "Full" variables are the variables the challenges passes to the user in events/other variable updaters.
165
- */
166
- export type FullVariables<VARIABLE_NAMES extends string = string> = Record<VARIABLE_NAMES | BUILTIN_VARIABLE_NAMES, FullVariable<VARIABLE_NAMES>>;
167
- export type Variables<VARIABLE_NAMES extends string = string> = Record<VARIABLE_NAMES | BUILTIN_VARIABLE_NAMES, Score>;
168
- type _InputEventCommonProperties = {
169
- /** The target score to reach to trigger the event */
170
- target?: number | undefined;
171
- /** The mode of the event, either fire once or fire every time the score reaches the target */
172
- mode: "fire_once" | "repeatable";
173
- /** Actions to execute when the event is triggered */
174
- actions: () => void;
175
- };
176
- export type _InputScoreCustomEventType = {
177
- /** The target score to reach to trigger the event */
178
- score: Score;
179
- } & _InputEventCommonProperties;
180
- export type _InputAdvancementCustomEventType = {
181
- /** A list of criteria that must be met to trigger the event */
182
- criteria: AdvancementTriggers[];
183
- } & _InputEventCommonProperties;
184
- export type _InputCustomEventType = _InputScoreCustomEventType | _InputAdvancementCustomEventType;
185
- export type CustomScoreEvent = {
186
- /** The input event that defines the conditions for the custom event */
187
- inputEvent: _InputScoreCustomEventType;
188
- /** The score that counts how many times the event has been triggered */
189
- counter: Score;
190
- /** The type of the event */
191
- type: "global" | "individual";
192
- /** A name used for debugging purposes */
193
- debugName: string;
194
- };
195
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1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_DEFAULTS = exports.Actions = void 0;
4
- exports.isSpecificObjectiveVariable = isSpecificObjectiveVariable;
5
- exports.resolveChallengeDefaults = resolveChallengeDefaults;
6
- var actions_1 = require("./actions");
7
- Object.defineProperty(exports, "Actions", { enumerable: true, get: function () { return actions_1.Actions; } });
8
- function isSpecificObjectiveVariable(variable) {
9
- return variable.type === "individual" && !!variable.objective_type;
10
- }
11
- exports.DEFAULT_CHALLENGE_DEFAULTS = {
12
- time: "day",
13
- daylightCycle: false,
14
- mobSpawning: false,
15
- naturalRegeneration: true,
16
- clearInventory: true,
17
- maxHealth: 20,
18
- };
19
- /**
20
- * Resolve a partial `ChallengeDefaults` (or `false` for "skip all setup")
21
- * against the SDK-level defaults. Returns a fully-populated config the
22
- * SDK can read without optional-chaining everywhere.
23
- */
24
- function resolveChallengeDefaults(input) {
25
- if (input === false)
26
- return null;
27
- if (input === undefined)
28
- return exports.DEFAULT_CHALLENGE_DEFAULTS;
29
- return {
30
- time: input.time === undefined ? exports.DEFAULT_CHALLENGE_DEFAULTS.time : input.time,
31
- daylightCycle: input.daylightCycle ?? exports.DEFAULT_CHALLENGE_DEFAULTS.daylightCycle,
32
- mobSpawning: input.mobSpawning ?? exports.DEFAULT_CHALLENGE_DEFAULTS.mobSpawning,
33
- naturalRegeneration: input.naturalRegeneration ?? exports.DEFAULT_CHALLENGE_DEFAULTS.naturalRegeneration,
34
- clearInventory: input.clearInventory ?? exports.DEFAULT_CHALLENGE_DEFAULTS.clearInventory,
35
- maxHealth: input.maxHealth === undefined ? exports.DEFAULT_CHALLENGE_DEFAULTS.maxHealth : input.maxHealth,
36
- };
37
- }
38
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAqDA,kEAIC;AAgID,4DAWC;AA9LD,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AA+ChB,SAAgB,2BAA2B,CAC1C,QAAoC;IAEpC,OAAO,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,CAAE,QAAgB,CAAC,cAAc,CAAC;AAC7E,CAAC;AAkHY,QAAA,0BAA0B,GAAqB;IAC3D,IAAI,EAAE,KAAK;IACX,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,KAAK;IAClB,mBAAmB,EAAE,IAAI;IACzB,cAAc,EAAE,IAAI;IACpB,SAAS,EAAE,EAAE;CACb,CAAC;AAEF;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,KAA4C;IACpF,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACjC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,kCAA0B,CAAC;IAC3D,OAAO;QACN,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,kCAA0B,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI;QAC7E,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,kCAA0B,CAAC,aAAa;QAC9E,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,kCAA0B,CAAC,WAAW;QACxE,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,IAAI,kCAA0B,CAAC,mBAAmB;QAChG,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,kCAA0B,CAAC,cAAc;QACjF,SAAS,EAAE,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,kCAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS;KACjG,CAAC;AACH,CAAC"}
package/dist/utils.d.ts DELETED
@@ -1,17 +0,0 @@
1
- export type LiteralStringUnion<LiteralType> = LiteralType | (string & Record<never, never>);
2
- /**
3
- * Generates a unique child function name based on the given name & the current context.
4
- *
5
- * For example, if you're inside a MCFunction named "test",
6
- * getChildFunctionName("myFunction") will return "test/myFunction".
7
- *
8
- * This is useful to get meaningful names for child functions, instead of the standard "execute_as_1/2/3...".
9
- *
10
- * 👉 This brings more clarity to the generated functions tree, without impacting the datapack behavior.
11
- *
12
- * @param name The base name for the child function.
13
- *
14
- * @returns A meaningful child function name that is unique within the current context.
15
- */
16
- export declare function getChildFunctionName(name: string): string;
17
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,CAAC,WAAW,IAAI,WAAW,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAE5F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD"}
package/dist/utils.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChildFunctionName = getChildFunctionName;
4
- const init_1 = require("sandstone/init");
5
- /**
6
- * Generates a unique child function name based on the given name & the current context.
7
- *
8
- * For example, if you're inside a MCFunction named "test",
9
- * getChildFunctionName("myFunction") will return "test/myFunction".
10
- *
11
- * This is useful to get meaningful names for child functions, instead of the standard "execute_as_1/2/3...".
12
- *
13
- * 👉 This brings more clarity to the generated functions tree, without impacting the datapack behavior.
14
- *
15
- * @param name The base name for the child function.
16
- *
17
- * @returns A meaningful child function name that is unique within the current context.
18
- */
19
- function getChildFunctionName(name) {
20
- return init_1.dataPack.getUniqueChildName(name).fullName;
21
- }
22
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAmBA,oDAEC;AArBD,yCAA0C;AAK1C;;;;;;;;;;;;;GAaG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAChD,OAAO,eAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;AACnD,CAAC"}