# MCSJ AgentV6 — fast deterministic JavaFX operator

## Status

- Live database verified: `chestervillagenydb`
- MCSJ PID at validation: `4732` (discover dynamically; do not hard-code)
- Agent port: `9806`
- Main launcher: `python C:/MCSJAgent/mcsj-fast-fx.py ...`
- Agent jar: `C:/MCSJAgent/SwingBridge/AgentV6.jar`
- Client: `C:/MCSJAgent/SwingBridge/mcsj-swing-bridge-client.py`

The launcher checks a cached, previously JAB-verified MCSJ PID against the live TCP port owner and `PING`. If the PID changes or the listener disappears, it retrieves the new PID from the JAB daemon, attaches AgentV6 with `jattach32.exe`, verifies port ownership and health, then refreshes the cache.

## Fast commands

```bash
# Full JAB/PID/port ownership verification; attaches if needed
python C:/MCSJAgent/mcsj-fast-fx.py ensure

# Compact semantic state
python C:/MCSJAgent/mcsj-fast-fx.py state

# Exact nested-module lookup
python C:/MCSJAgent/mcsj-fast-fx.py find \
  --panel-class util.client.fx.EFXUtadjbatchPanel \
  --class misc.components.fx.EFXTextField \
  --id EFXTextField --text '' --limit 10 --pretty

# Guarded text edit; expected old value is mandatory
python C:/MCSJAgent/mcsj-fast-fx.py edit \
  --panel-class util.client.fx.EFXUtadjbatchPanel \
  --class misc.components.fx.EFXTextField \
  --id EFXTextField --text '' --node-nth 0 \
  --expected '' --new 'VALUE' --pretty

# Exact table cell selection/edit/double-click; expected value is mandatory
python C:/MCSJAgent/mcsj-fast-fx.py cell \
  --panel-class util.client.fx.EFXUtadjbatchPanel \
  --header Descript --table-nth 0 --row 0 --column 11 \
  --action select --expected '' --pretty
```

## Protocol guarantees

- `FXSTATE`: compact in-agent semantic state, including visible controls and table rows.
- `FXFIND`: scopes to an exact outer root or unique nested module-class anchor.
- `FXEDITTEXT`: checks visible/enabled/editable, requires expected old value, performs user-style `replaceText`, and returns before/requested/actual.
- `FXTABLECELL`: scopes by nested module class and exact table header, validates row/column and expected cell value, then selects, edits, or fires a real JavaFX double-click on the realized cell.
- Stale values return `STALE`; disabled/ambiguous/missing targets fail closed.

## Verified tests

Disposable JavaFX harness:

- 6 AgentV6 protocol tests passed.
- 4 Python client tests passed.
- Nested-module anchoring, guarded edit/restore, exact row/column selection, and synthetic double-click passed.

Live MCSJ:

- AgentV6 attached on port `9806`, owned by the current MCSJ PID.
- `util.client.fx.EFXUtadjbatchPanel` correctly resolved the nested `EFXUtadjbatchPanel$1` module anchor.
- Unique focused Utility adjustment editor changed from empty to `MICHEL_SPEED_TEST`, read back exactly, then restored to empty.
- Draft row remained unchanged: account `601-2`, service `Water`, code `100`, year/period `2026/1`, principal `0.00`, description empty.
- Exact live table selection and synthetic double-click passed for row `0`, `Descript` column `11`, expected empty.
- No Save or Update action was invoked.

Measured cached-path timings on this host:

- Compact state: approximately `0.48 s`.
- Exact table-cell selection: approximately `0.63 s`.
- Full ensure/JAB verification: approximately `0.92 s`.

## Proof

- `C:/MCSJAgent/proof/agentv6-live-state.json`
- `C:/MCSJAgent/proof/agentv6-utadj-anchor.json`
- `C:/MCSJAgent/proof/agentv6-after-restore-state.json`
- `C:/MCSJAgent/proof/agentv6-after-restore.png`
