feat(bridge): Phase 2.3 — wire GameSession to real Forge IPC subprocess (issue #83)

Replaces synthetic stub loop with a live Forge process:
- Spawns Forge with --policy + --policyServer flags so Forge calls
  back to /api/policy/decide at each AI decision point
- Reads Forge stdout line-by-line and parses zone/phase/life updates
  via the same regex patterns used in BatchRunner
- Syncs full board state (battlefield, hand, graveyard, exile,
  command zone, stack) on every Forge state-change line
- Routes human input from humanActionQueue via a side-channel
  HTTP POST to /api/policy/override on the policy server
- Handles activePlayer + priorityPlayer correctly for 3-4 player pods
- Falls back to synthetic stub loop if Forge subprocess fails to start
- Watchdog thread kills stalled Forge process after 10 min
This commit is contained in:
KoalaTrapLord committed 2026-03-29 04:31:49 -04:00
1 parent 882e2370c1
commit 126684bb94
1 file changed
+641 -385
File diff suppressed because it is too large. Load diff