Files
db42330da5 feat(ts): shrink core modules and add autonomous snake example (#274)
Shrinks (no behavior change):
- agent.ts: inline single-use sorted() into checkQuestion error path
- agent.ts: drop dead try/catch around Number() in temperature validation (Number never throws on JSON-derived config)
- common.ts: replace manual meta key-copy loop with rest destructuring in collateItems
- tokenizer.ts: use Response.json() instead of TextDecoder+arrayBuffer+JSON.parse in loadTokenizerJson
- router.ts: simplify matchTypedDecisionsWorkflow set-equality to every()
- router.ts: remove redundant task dash-normalization; normaliseName already covers aliases and case

Example:
- laya-ts/examples/snake.mjs: autonomous terminal snake. Zero-dep ANSI renderer with live HUD (per-direction danger bars, food pull, confidence, veto flag, score/best). Brain asks the model one systemOne call per tick with 4 noul danger questions, fused with Manhattan food pull; rule-based veto overrides lethal picks. Heuristic fallback when model unavailable; --ticks N headless CI smoke.
- README: document snake demo command.

Verified: tsc clean, vitest 42/42, node --check clean.

Co-authored-by: nnlgsakib <[email protected]>
2026-09-23 23:17:24 +05:30
..