Wire together server manager + bot compiler/launcher + result parser into the single runBattle() API call. Handle the full lifecycle: ensure server is up, compile bots, generate bot JSON configs (with InitialPosition if specified), start battle, wait for completion, parse results, return BattleResult.
Server connection: BattleRunner connects to external server via serverUrl("ws://localhost:PORT"). BotEntry.of(directory) works in external mode — Booter launches bots locally.
timeout: Duration — default timeout, kills battle on expiry
outputFlags: seq[string] — raw passthrough to Java runner (@["--positions", "--scanned"] etc.)
Process model: startProcess for server (long-lived singleton), execCmdEx for runner (blocking, captures stdout+exitcode). Stdout parsed into BattleResult, stderr passes through to terminal.
**Wayfinder child of:** #126
Wire together server manager + bot compiler/launcher + result parser into the single `runBattle()` API call. Handle the full lifecycle: ensure server is up, compile bots, generate bot JSON configs (with InitialPosition if specified), start battle, wait for completion, parse results, return BattleResult.
**Blocked by:** #127, #128, #129
### Grilling Revisions
**Server connection**: `BattleRunner` connects to external server via `serverUrl("ws://localhost:PORT")`. `BotEntry.of(directory)` works in external mode — Booter launches bots locally.
**API parameters:**
- `bots: seq[string]` — paths to .nim source files
- `rounds: int` — number of rounds (default 1)
- `initialPositions: Table[string, InitialPosition]` — optional per-bot positions (keyed by source path)
- `timeout: Duration` — default timeout, kills battle on expiry
- `outputFlags: seq[string]` — raw passthrough to Java runner (`@["--positions", "--scanned"]` etc.)
**Process model**: `startProcess` for server (long-lived singleton), `execCmdEx` for runner (blocking, captures stdout+exitcode). Stdout parsed into BattleResult, stderr passes through to terminal.
runBattle() must use defer blocks to clean up bot processes and BattleRunner process on any exception.
Overall timeout: 120s hard ceiling per runBattle() call.
Battle execution timeout: 60s per round.
Timeouts should be optional params with sensible defaults.
## Spec additions from grilling
- `runBattle()` must use `defer` blocks to clean up bot processes and BattleRunner process on any exception.
- Overall timeout: **120s** hard ceiling per `runBattle()` call.
- Battle execution timeout: **60s** per round.
- Timeouts should be optional params with sensible defaults.
Blocked by: #127, #128, #129, #134 (adding #134 — BattleRunner process lifecycle must be implemented before the orchestrator can wire it in).
## Dependency addition
Blocked by: #127, #128, #129, #134 (adding #134 — BattleRunner process lifecycle must be implemented before the orchestrator can wire it in).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Wayfinder child of: #126
Wire together server manager + bot compiler/launcher + result parser into the single
runBattle()API call. Handle the full lifecycle: ensure server is up, compile bots, generate bot JSON configs (with InitialPosition if specified), start battle, wait for completion, parse results, return BattleResult.Blocked by: #127, #128, #129
Grilling Revisions
Server connection:
BattleRunnerconnects to external server viaserverUrl("ws://localhost:PORT").BotEntry.of(directory)works in external mode — Booter launches bots locally.API parameters:
bots: seq[string]— paths to .nim source filesrounds: int— number of rounds (default 1)initialPositions: Table[string, InitialPosition]— optional per-bot positions (keyed by source path)timeout: Duration— default timeout, kills battle on expiryoutputFlags: seq[string]— raw passthrough to Java runner (@["--positions", "--scanned"]etc.)Process model:
startProcessfor server (long-lived singleton),execCmdExfor runner (blocking, captures stdout+exitcode). Stdout parsed into BattleResult, stderr passes through to terminal.Spec additions from grilling
runBattle()must usedeferblocks to clean up bot processes and BattleRunner process on any exception.runBattle()call.Dependency addition
Blocked by: #127, #128, #129, #134 (adding #134 — BattleRunner process lifecycle must be implemented before the orchestrator can wire it in).
Implemented in commit
57a1915.