# DISPATCH — worker_remediation_client

## Identity
- Role: Cocos Client Remediation Worker
- Subagent Type: teamwork_preview_worker
- Working Directory: c:\Projects\FreeExile\.agents\teamwork\worker_remediation_client
- Parent: orchestrator_20

## Mission
Remediate the client TypeScript defects reported by `reviewer_client_code` and `challenger_kinematics_stress` in Iteration 1.

## Feedback Reports to Remediate
- Read `c:\Projects\FreeExile\.agents\teamwork\reviewer_client_code\handoff.md`
- Read `c:\Projects\FreeExile\.agents\teamwork\challenger_kinematics_stress\handoff.md`

## Specific Defect Fixes Required
1. `client/cocos/assets/scripts/core/KinematicsEngine.ts:114-117`:
   - Compute `this.velX = (resolution.nextWx - this.wx) / dt` and `this.velY = (resolution.nextWy - this.wy) / dt` BEFORE updating `this.wx = resolution.nextWx` and `this.wy = resolution.nextWy`.
2. `client/cocos/assets/scripts/core/AStarPathfinder.ts`:
   - Support negative coordinates by introducing a coordinate offset (e.g. `const GRID_OFFSET = 32; const GRID_SIZE = 64;` so `[-18..18]` maps to `[14..50]`).
   - Fix `hasLineOfSight`: If 120-step loop terminates without reaching destination, return `false`! Prevent diagonal corner-cutting through non-walkable adjacent tiles.
3. `client/cocos/assets/scripts/animation/SpriteAtlasRenderer.ts:68-78`:
   - Use `targetClipName` to correctly map animation state to the corresponding sprite row index (`idle`: row 0, `run`: row 1, `attack`: row 2, `hurt`: row 3, `dodge`: row 4).
4. `client/cocos/assets/scripts/animation/AnimationFSM.ts`:
   - Use delta time accumulator (`accumulatedTime += dt`) and advance frames based on clip frame rate rather than a single frame tick.
5. `client/cocos/tsconfig.json`:
   - Fix TS5102 error by removing or adjusting `'baseUrl'` under `moduleResolution: bundler`.

## Verification Tasks
- Run TypeScript typecheck: `npx tsc --noEmit --project client/cocos/tsconfig.json` (must pass with 0 errors).
- Run stress test suite: `npx tsx tests/unit/test_challenger_cocos_kinematics_stress.ts` (all 27 checks must PASS).
- Run `python tools/lint/check_code_and_doc_hygiene.py` (ensure <= 350 lines per file).

## Deliverable
Deliver `handoff.md` detailing all fixes, verification command outputs, and notify parent.


## 2026-10-03T08:42:00Z
Received dispatch message:
You are worker_remediation_client. Working directory is c:\Projects\FreeExile\.agents\teamwork\worker_remediation_client. Read your DISPATCH.md at c:\Projects\FreeExile\.agents\teamwork\worker_remediation_client\DISPATCH.md and reviews in reviewer_client_code and challenger_kinematics_stress handoff reports. Fix the 5 defects in KinematicsEngine.ts, AStarPathfinder.ts, SpriteAtlasRenderer.ts, AnimationFSM.ts, and tsconfig.json. Run typecheck and stress tests to verify all 27 pass, write handoff.md, and notify parent.
