Commit Graph

51 Commits

Author SHA1 Message Date
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
6c96ab68c8 refactor(scroll): move trainer/models/collector to tools/scroll/ 2026-05-12 00:34:05 +08:00
ba52c49edf refactor: move trainer/models/utils/config to tools/ 2026-05-12 00:30:55 +08:00
c89025047c chore: scaffold tools/ directory 2026-05-12 00:23:03 +08:00
e3d4626031 test: capture scroll generate() golden output (pre-migration) 2026-05-12 00:20:13 +08:00
98daef54ca test: capture mouse generate() golden output (pre-migration) 2026-05-12 00:19:39 +08:00
99f7ae29cb chore(scroll): train initial scroll model from scroll_traces.jsonl 2026-05-12 00:17:12 +08:00
8003ae657a docs: implementation plan for ai_mouse library refactor
Expands the 2026-05-11 design spec into ~40 bite-sized tasks across 6
phases (pre-flight golden capture, tools/ extraction, src layout switch,
ONNX export, NumPy/ORT rewrite, docs cleanup). Each task is self-contained
with full code blocks, exact file paths, and verification commands. TDD
where applicable; pure-move tasks use shorter scaffolding.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 00:01:37 +08:00
74d6c5c7ff docs: design spec for ai_mouse library refactor (ONNX + src-layout)
Captures the decisions made in brainstorming for 0.2.0:
- Split src/ai_mouse/ (pure-inference, numpy+onnxruntime only) from
  tools/ (training/server/eval, torch+fastapi+...)
- Bundled ONNX weights via importlib.resources
- Public API: MouseModel/ScrollModel classes + cached generate() helpers
- ONNX export script with PyTorch parity check
- Golden tests to lock semantics during NumPy rewrite of post-processing
- 5-stage migration plan, git URL install, no PyPI

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 23:40:21 +08:00
8b0447b949 docs: add CLAUDE.md guide for future Claude Code sessions 2026-05-10 13:54:12 +08:00
e3bfd031d8 feat: unified CLI (python -m ai_mouse {train,eval,balabit-adapter})
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 13:39:20 +08:00
9c4c7f6f0c feat(eval): CLI for generating evaluation reports
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 13:39:16 +08:00
05be116cde feat(eval): Markdown report builder with matplotlib plots
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 13:39:13 +08:00
dc38f031b8 feat(eval): kinematics metrics, FFT spectrum, KL divergence
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 13:33:19 +08:00
3fb4d3a8c0 feat(generator): add 5-point gaussian smoothing on lateral 2026-05-10 13:27:15 +08:00
50dbf40709 refactor(generator): remove deterministic speed_profile and hard log_dt clip
These post-processing hacks were added to compensate for small-data
training. With Balabit pretraining they suppress the multimodal
timing distribution and cause the template-y Δt curves seen in the
verify UI.
2026-05-10 13:22:57 +08:00
b01f6512c0 feat(server): auto-resume from pretrained checkpoint when available 2026-05-10 13:17:24 +08:00
1d9dff4f2a fix(trainer): rename _LOG_1_1 → _LOG_INV_0_9, add tests for aug_ids 2-5 2026-05-10 13:11:27 +08:00
e992823aef feat(trainer): add resume_from for two-stage training 2026-05-10 13:08:37 +08:00
bba8fc567b feat(trainer): replace eager _augment with streaming TrajectoryDataset
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 12:51:52 +08:00
0b1d18d15c feat(adapter): implement process_session and CLI 2026-05-10 12:42:43 +08:00
cc855e0ae2 feat(adapter): implement segment quality filters 2026-05-10 12:38:17 +08:00
82f803403c feat(adapter): implement click-anchored segmentation 2026-05-10 12:35:43 +08:00
1559f7ab11 feat(adapter): implement Balabit CSV parser 2026-05-10 12:32:20 +08:00
97a835769e feat(adapter): scaffold balabit data adapter package 2026-05-10 12:29:11 +08:00