Commit Graph

75 Commits

Author SHA1 Message Date
23084f77d6 ci: remove Gitea workflow (no runner, solo repo)
The workflow never executed: git.vercanti.com (Gitea 1.24.4) has no
registered act_runner, so it produced 0 runs. Its one check that is not
easily reproduced locally (clean-env import of src/ai_mouse/ to guard the
numpy+onnxruntime-only boundary) can be run by hand before release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 17:26:54 +08:00
dog
43d28b6254 test: tighten wall-check to consecutive run; add warp_endpoints no-mutation test
Some checks failed
CI / Library tests (no torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Library tests (no torch) (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.13) (push) Has been cancelled
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
v0.2.0
2026-07-09 18:16:23 +08:00
dog
241a4a41c7 docs: record amended tail-quality threshold (<=1 overshoot reversal) in spec
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 18:15:29 +08:00
dog
9e529d3951 docs: record empirical rejection of Heun sampling in spec
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 18:10:49 +08:00
dog
76581a210e test: quality guard for endpoint artifacts; re-baseline mouse goldens
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 18:07:06 +08:00
dog
7c33c13a87 Revert "feat: switch flow ODE sampling from Euler to Heun (10 steps, NFE 20)"
This reverts commit adc46a445f.
2026-07-09 18:03:01 +08:00
dog
adc46a445f feat: switch flow ODE sampling from Euler to Heun (10 steps, NFE 20)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:55:45 +08:00
dog
441e6f3dfe feat: rework mouse post-processing pipeline (soft monotonic, global endpoint warp)
Golden mouse baselines temporarily failing; re-captured in follow-up commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:48:22 +08:00
dog
556f7f861d feat: add warp_endpoints (global residual correction, shape-preserving)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:44:07 +08:00
dog
d1f70e5753 fix: remove duplicate soften_forward definition (cherry-pick artifact)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:37:01 +08:00
dog
94c52bd3be feat: add damp_start (smoothstep lateral damping, no release kink)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:31:24 +08:00
dog
c2ed7b3cb9 feat: add soften_forward (backtrack tolerance + tanh overshoot compression)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:25:50 +08:00
dog
12d70fe137 docs: implementation plan for mouse post-processing rework
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:16:20 +08:00
dog
3e7a194356 docs: spec for mouse post-processing rework + Heun sampling
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 17:11:07 +08:00
7890b07a01 ci: drop windows-latest from matrix
Some checks failed
CI / Library tests (no torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Library tests (no torch) (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.13) (push) Has been cancelled
Self-hosted Gitea Actions has no Windows runner; the four Windows jobs
sat in 'Waiting' indefinitely. Linux-only matrix keeps CI green on a
single act_runner.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 01:42:46 +08:00
1c60763037 Merge branch 'worktree-lib-refactor': ai_mouse 0.2.0 library refactor
Some checks failed
CI / Library tests (no torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Library tests (no torch) (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Library tests (no torch) (windows-latest, 3.12) (push) Has been cancelled
CI / Library tests (no torch) (windows-latest, 3.13) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.12) (push) Has been cancelled
CI / Full dev suite (with torch) (ubuntu-latest, 3.13) (push) Has been cancelled
CI / Full dev suite (with torch) (windows-latest, 3.12) (push) Has been cancelled
CI / Full dev suite (with torch) (windows-latest, 3.13) (push) Has been cancelled
Pure-inference ONNX Runtime SDK; src/ layout; bundled weights;
training/server/eval moved to tools/; new public API
(MouseModel/ScrollModel + cached generate/generate_scroll helpers).
See CHANGELOG.md for details.
2026-05-12 20:31:06 +08:00
566adda920 chore: remove legacy JointCVAE 2026-05-12 01:34:59 +08:00
984890515f ci: add GitHub Actions workflow (library + dev jobs) 2026-05-12 01:33:51 +08:00
1105026831 docs: update CLAUDE.md for new src/tools layout 2026-05-12 01:33:36 +08:00
0413769dd2 docs: add examples/quickstart.py 2026-05-12 01:33:12 +08:00
4f55000c05 docs: add CHANGELOG with 0.2.0 entry 2026-05-12 01:32:50 +08:00
2d8017b089 docs: rewrite README from SDK-consumer perspective 2026-05-12 01:32:35 +08:00
31fd884dfd refactor(lib): remove legacy generator.py / coord.py / scroll module
Drop the pre-migration PyTorch inference pipeline now that the ONNX-backed
MouseModel/ScrollModel in mouse.py and scroll.py are wired up through the
public ai_mouse API.

Deleted:
  * src/ai_mouse/generator.py        (legacy torch flow ODE + post-processing)
  * src/ai_mouse/coord.py            (legacy public coord transforms,
                                      superseded by ai_mouse._coord)
  * src/ai_mouse/_scroll_legacy.py   (legacy torch scroll VAE inference)
  * scripts/build_golden_*.py        (one-shot capture scripts, no longer
                                      needed once goldens are committed)
  * tests/unit/test_generator.py     (legacy module gone)
  * tests/unit/test_scroll_generator.py (legacy module gone)
  * tests/unit/test_coord.py         (legacy module gone; ai_mouse._coord is
                                      tested by test__coord.py)
  * scripts/                         (empty, removed)

Tools migrations:
  * tools/trainer.py: import encode_trajectory from ai_mouse._coord
    instead of the deleted ai_mouse.coord
  * tools/server/routes_verify.py, tools/server/routes_scroll.py: route to
    the public ai_mouse.generate / generate_scroll. They no longer accept
    a model_dir override — the bundled ONNX is the source of truth, and a
    fresh export goes through `python -m tools.export_onnx`.
  * tools/eval/__main__.py: same migration; model_dir CLI arg retained as
    a deprecation shim but ignored.

Final src/ai_mouse/ layout (matches plan):
  __init__.py, _assets.py, _coord.py, _model_cache.py, _postprocess.py,
  errors.py, mouse.py, py.typed, scroll.py, assets/

Test suite: 188 passed (was 188 before deletion; obsolete suites cleaned
out alongside the modules they covered).
2026-05-12 01:23:52 +08:00
525e555884 test(lib): add golden regression suite for mouse + scroll
64 parametrised cases (8 routes/scrolls x 4 seeds each) compare the
rewritten ORT/NumPy pipeline against captures from the pre-migration
PyTorch implementation.

The pre-migration captures used torch.manual_seed + torch.randn for the
flow-ODE noise; the rewrite uses np.random.default_rng. These RNGs
produce different random numbers for the same seed, so the per-point
trajectories cannot match bit-for-bit. The suite therefore guards
*structural* equivalence:

  * mouse: identical shape, start/end snapping, xy diff within
    max(30 px, 20% of move distance), timestamp diff within 700 ms
  * scroll: identical shape (skip with reason on quantum boundary
    drift), identical deltaMode, identical total signed scroll
    distance, per-event delta within 2 wheel quanta, timestamp diff
    within 700 ms

Observed worst-case in this run: ~170 px xy diff on a 1681 px move
(~10% of distance, well under the 20% envelope) and ~600 ms timestamp
drift. All 64 cases pass; 0 skipped.

Goldens stored as compressed .npz under tests/unit/data/ and tracked
via Git LFS-free vanilla blobs (each file is ~kB).
2026-05-12 01:19:58 +08:00
5b4f693098 feat(lib): add py.typed marker (PEP 561) 2026-05-12 01:16:13 +08:00
d39db46170 feat(lib): switch __init__ to ONNX-backed generate/generate_scroll 2026-05-12 01:16:03 +08:00
4e69ecc963 feat(lib): add ScrollModel (numpy + ONNX Runtime); rename legacy scroll module 2026-05-12 01:14:37 +08:00
bae9a93ffa feat(lib): add MouseModel (numpy + ONNX Runtime) 2026-05-12 01:13:06 +08:00
2231e4e24b feat(lib): add sample_duration, truncnorm_sample (no scipy) 2026-05-12 01:09:22 +08:00
b93d240641 feat(lib): add resample_arc, build_timestamps 2026-05-12 01:08:39 +08:00
6cfcb6d1a4 feat(lib): add smooth_start, enforce_forward_monotonic 2026-05-12 01:07:58 +08:00
09e8ebee4a feat(lib): add snap_endpoints to _postprocess 2026-05-12 01:07:19 +08:00
6d848dc23d feat(lib): add gaussian_smooth to _postprocess 2026-05-12 01:06:42 +08:00
3c1cf171a7 feat(lib): add _assets module for bundled-weight resolution
Provide bundled_path() and resolve() helpers that locate ONNX
weights and JSON metadata via importlib.resources, falling back to
a user-supplied directory. Missing assets raise ModelLoadError.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 01:04:37 +08:00
8182bb1a01 feat(lib): add errors module
Introduce AiMouseError base class plus ModelLoadError and
GenerationError subclasses so downstream consumers can catch the
umbrella or specific failure modes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 01:02:57 +08:00
17b406c28b feat(lib): add private _coord.py with numpy transforms
Copy of coord.py (which is already pure numpy) into the private
underscored module to be consumed by upcoming mouse.py rewrite.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 01:02:25 +08:00
3f1f8090ec build: drop redundant force-include; add onnxscript to dev deps
Hatchling's  already picks up assets/;
force-include duplicated each asset and emitted a build warning once
real ONNX files landed. onnxscript is a transitive runtime dep of
torch.onnx.export (PyTorch 2.11+) — make it explicit.
2026-05-12 01:00:45 +08:00
6702269494 test(tools): cover export_onnx with tiny synthetic models 2026-05-12 00:57:32 +08:00
7b5a2ac677 feat: export ONNX weights and metadata into src/ai_mouse/assets/ 2026-05-12 00:57:11 +08:00
4274b174e9 feat(tools): add ORT vs PyTorch parity check for exports 2026-05-12 00:56:08 +08:00
edbf934c90 feat(tools): add export_scroll_decoder for ONNX export 2026-05-12 00:55:40 +08:00
0ef25480cf feat(tools): add export_flow_model for ONNX export 2026-05-12 00:55:15 +08:00
a724ecf878 build: switch to hatchling + src layout; tighten runtime deps 2026-05-12 00:51:28 +08:00
9ecb9ebf5f refactor: switch to src/ layout 2026-05-12 00:49:42 +08:00
fc7b2bd236 refactor(tests): split into tests/unit and tests/tools 2026-05-12 00:47:00 +08:00
b0f0d6db11 refactor: move web entry main.py to tools/serve.py 2026-05-12 00:44:06 +08:00
31ad47dc0b refactor: move CLI dispatcher to tools/__main__.py 2026-05-12 00:42:18 +08:00
3507fdc202 refactor: move eval/ and data_adapters/ to tools/ 2026-05-12 00:40:33 +08:00
d1ecb13175 refactor: move server/ to tools/server/ 2026-05-12 00:37:47 +08:00
e0b3b012e7 refactor: move collector to tools/ 2026-05-12 00:35:46 +08:00