@clunkyard/sdk 0.0.0-stage → 2.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Clunkyard contributors
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
+ # Clunkyard robot SDK for Node.js
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
+ Write a Clunkyard robot in JavaScript or TypeScript. This package contains the
4
+ robot API, TypeScript declarations and the shared WebAssembly core. It needs
5
+ Node 20 or later, with no native compiler, platform library or install script.
6
+ It runs in Node; a browser bundle is not supplied.
7
+
8
+ ## Use the same import as the arena
9
+
10
+ Clunkyard's hosted JavaScript and TypeScript starters import `clunkyard`.
11
+ Install this package under that name to keep the same source locally and online:
12
+
13
+ ```sh
14
+ npm install clunkyard@npm:@clunkyard/sdk@2.0.0
15
+ ```
16
+
17
+ ```javascript
18
+ const cy = require('clunkyard');
19
+
20
+ class Scout extends cy.Robot {
21
+ onTurn() {
22
+ const target = this.sensors.nearest;
23
+ this.drive.set({ throttle: 0.5, turn: 0.2 });
24
+ this.scanner.set({ heading: target ? target.bearing : this.me.heading,
25
+ arc: target ? 12 : 40 });
26
+ if (target) {
27
+ const power = 0.5;
28
+ const aim = this.gun.lead(target, power);
29
+ this.gun.aim({ heading: aim ? aim.heading : target.bearing,
30
+ pitch: aim ? aim.pitch : target.elevation });
31
+ if (this.gun.canFire(power, 10)) this.gun.fire({ power });
32
+ }
33
+ }
34
+ }
35
+
36
+ cy.run(new Scout());
37
+ ```
38
+
39
+ The same alias works with `import * as cy from 'clunkyard'` in TypeScript.
40
+ Keep `package.json` and your lock file in the local project. The arena supplies
41
+ the matching binding when it builds your bot; do not upload `node_modules`.
42
+
43
+ For a standalone Node application, install `@clunkyard/sdk@2.0.0` directly and
44
+ use `require('@clunkyard/sdk')`. A scoped import is not currently available in
45
+ the hosted build environment; use the alias above for arena bot source.
46
+
47
+ ## Run and test a robot
48
+
49
+ `cy.run(robot)` reads protocol 2 observations from standard input and writes
50
+ the robot's replies. A robot is not a match engine: running `node bot.js` without
51
+ input waits for observations. Use the [language starter](https://github.com/clunkyard/starter-javascript)
52
+ and its `make match` / `make replay` commands for real local opponents and replays.
53
+ No account is needed for those local trials.
54
+
55
+ `cy.play(robot, lines)` accepts recorded protocol lines and returns reply lines
56
+ in memory, which is useful for focused tests. It uses the same core parser,
57
+ tracking, geometry and control serialization as `cy.run`.
58
+
59
+ Facts are properties of `robot.me`, `robot.sensors`, `robot.battery` and the other
60
+ subsystems. Controls take objects; later calls replace only the fields supplied.
61
+ An absent optional result is `null`. Throw `new cy.Forfeit(code, message)` to
62
+ forfeit deliberately. Other callback exceptions are logged to standard error;
63
+ the current turn still sends its accumulated controls.
64
+
65
+ Send diagnostics to standard error and keep top-level output away from the
66
+ protocol stream. The language starter provides the arena's normal launcher.
67
+
68
+ [Complete API](https://clunkyard.com/sdk/javascript) ·
69
+ [C API and adapters](https://clunkyard.com/sdk) ·
70
+ [Local development](https://clunkyard.com/sdk/player-kit) ·
71
+ [Private Git](https://clunkyard.com/sdk/private-git)
72
+
73
+ SDK 2.0.0 uses protocol 2. The WebAssembly core is included in this package;
74
+ there is no network request or download when the module loads. The local
75
+ match engine, replay viewer and other languages' toolchains are separate.
76
+ The [core source](https://github.com/clunkyard/sdk/tree/main/sdk/core) is available
77
+ for review; bundled dependency and toolchain notices accompany the package.
@@ -0,0 +1,31 @@
1
+ Third-party notices for the Clunkyard JavaScript/TypeScript SDK
2
+
3
+ The bundled WebAssembly core is built from the public sdk/core source.
4
+
5
+ libm 0.2.16
6
+ licenses/libm/LICENSE.txt
7
+
8
+ serde_core 1.0.229
9
+ licenses/serde_core/LICENSE-APACHE
10
+ licenses/serde_core/LICENSE-MIT
11
+
12
+ serde_json 1.0.154
13
+ licenses/serde_json/LICENSE-APACHE
14
+ licenses/serde_json/LICENSE-MIT
15
+
16
+ itoa 1.0.19
17
+ licenses/itoa/LICENSE-APACHE
18
+ licenses/itoa/LICENSE-MIT
19
+
20
+ memchr 2.8.3
21
+ licenses/memchr/COPYING
22
+ licenses/memchr/LICENSE-MIT
23
+ licenses/memchr/UNLICENSE
24
+
25
+ zmij 1.0.23
26
+ licenses/zmij/LICENSE-MIT
27
+
28
+ Rust standard library 1.96.0
29
+ licenses/rust-stdlib-1.96.0.html contains the toolchain library copyright
30
+ and licence inventory, including platform alternatives that need not be
31
+ linked into this WebAssembly target. MIT and Apache texts accompany it.