mons-rust 0.1.133 → 0.2.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/README.md CHANGED
@@ -1,46 +1,88 @@
1
- # mons-rust
2
-
3
- `cargo add mons-rust`
4
-
5
- or
6
-
7
- `npm install mons-rust`
8
-
9
- ## Automove
10
-
11
- Docs:
12
-
13
- - runbook: `HOW_TO_ITERATE_ON_AUTOMOVE.md`
14
- - next mechanism: `AUTOMOVE_IDEAS.md`
15
- - durable evidence and lessons: `docs/automove-knowledge.md`
16
-
17
- Shipping surface:
18
-
19
- - Fast and Normal retain shipping search; Pro uses the promoted bounded tactical policy
20
- - complete independently cold selector calls must remain below `700ms`
21
-
22
- Experiments use a small candidate-specific `#[cfg(test)]` harness:
23
-
24
- - `cargo test --release --lib <test_name> -- --ignored --nocapture --test-threads=1`
25
- - `./scripts/check-automove-hygiene.sh`
26
-
27
- ## Rules Tests
28
-
29
- Runner:
30
-
31
- - `./scripts/run-rules-tests.sh`
32
- - `./scripts/run-rules-tests.sh --limit 100`
33
- - `./scripts/run-rules-tests.sh --log /tmp/rules-tests.log`
34
-
35
- The checked-in corpus is `test-data/rules-regressions.jsonl.gz`. Its manifest records
36
- the deterministic 10,000-case selection policy, source archive hashes, coverage, and
37
- artifact hashes. The runner verifies the complete stream even when `--limit` executes
38
- only a prefix.
39
-
40
- ## Publishing
41
-
42
- - Set the release version in `Cargo.toml` and regenerate `Cargo.lock`, then commit the
43
- complete release change set. Publishing requires a clean worktree.
44
- - Run `./publish.sh --check-only` for the complete rules, Rust, release-gate, Wasm,
45
- public-surface, cold-route, and npm-size validation without publishing.
46
- - Run `./publish.sh` only after the check-only path passes and the release commit is clean.
1
+ # Mons TypeScript engine
2
+
3
+ The Mons rules engine is implemented in strict TypeScript and distributed as two
4
+ dependency-free npm packages:
5
+
6
+ - `mons-web` is an ES module for browsers and bundlers.
7
+ - `mons-rust` is the existing CommonJS package for Node.js. Its historical package
8
+ name is unchanged for compatibility.
9
+
10
+ Both packages expose the same 23 named game APIs and the same TypeScript declarations.
11
+
12
+ ```ts
13
+ import { GameVariant, MonsGameModel } from "mons-web";
14
+
15
+ const game = MonsGameModel.new(GameVariant.Classic);
16
+ const output = game.process_input_fen("l10,5;l9,4");
17
+ ```
18
+
19
+ ```js
20
+ const { GameVariant, MonsGameModel } = require("mons-rust");
21
+
22
+ const game = MonsGameModel.new(GameVariant.Classic);
23
+ ```
24
+
25
+ ## Migrating `mons-web` initialization
26
+
27
+ `mons-web` no longer has a default initializer or an `initSync` export. Remove the
28
+ default import and initialization call; named imports are ready to use immediately.
29
+ The generated `InitInput`, `SyncInitInput`, and `InitOutput` TypeScript types are
30
+ removed with those loaders.
31
+
32
+ ```diff
33
+ -import initMonsWeb, { MonsGameModel } from "mons-web";
34
+ -await initMonsWeb();
35
+ +import { MonsGameModel } from "mons-web";
36
+ ```
37
+
38
+ The named API is otherwise preserved, including enum values, FEN formats, model
39
+ classes, event ordering, random automoves, and smart-automove preferences.
40
+
41
+ Incoming strings retain the previous runtime normalization: unpaired UTF-16
42
+ surrogates become U+FFFD before parsing or echoing. One intentional error-policy
43
+ change applies to malformed data: native `RuntimeError("unreachable")` traps from
44
+ invalid UTF-8 slice boundaries or genuine board/location bounds failures are
45
+ deterministic TypeScript `RangeError`s. Wrapped location indices that resolve inside
46
+ the board remain compatible aliases.
47
+
48
+ Published JavaScript targets ES2020. The Node package uses Node's built-in performance
49
+ and cryptographic-random services directly; the browser package uses the corresponding
50
+ `globalThis` APIs. Node.js 22.13 through 22.x, or Node.js 24 or newer, is required
51
+ only for repository development and release tooling.
52
+
53
+ ## Validation
54
+
55
+ Install the workspace with Node.js 22.13 through 22.x, or Node.js 24 or newer, and
56
+ run the standard checks:
57
+
58
+ ```sh
59
+ npm ci --engine-strict
60
+ npm run format:check
61
+ npm run lint
62
+ npm run typecheck
63
+ npm run build
64
+ npm test
65
+ npm run test:automove-parity
66
+ ```
67
+
68
+ Run `./scripts/run-rules-tests.sh` with no options to replay the deterministic
69
+ compressed stream of 699,994 canonical unique rules transitions recovered from
70
+ 699,999 historical raw fixtures. The command validates and streams the corpus without
71
+ unpacking or rewriting it.
72
+
73
+ Run `node ./scripts/check-complete-games.cjs` to validate the immutable public corpus
74
+ of 1,527 complete real-player games. Run `npm run test:complete-games` to replay all
75
+ 25,185 turns and 169,480 inputs through the TypeScript engine across all 12 variants.
76
+
77
+ ## Release
78
+
79
+ Run `./publish.sh --check-only` to execute the complete Node-only validation, build
80
+ both package tarballs, and perform npm dry runs without publishing. Publishing is an
81
+ explicit release operation: run `./publish.sh` from a clean worktree only when both
82
+ packages should be released to the `latest` tag.
83
+
84
+ A real publish acquires the transient `mons-npm-publish-lock` tag on `origin`, or on
85
+ the shared remote named by `MONS_PUBLISH_LOCK_REMOTE`. All publishers must use this
86
+ script and the same remote for the lock to serialize releases across hosts. If a
87
+ process terminates without releasing the tag, the script prints inspection and
88
+ lease-protected stale-lock recovery commands.