Logo FSBarV1_Archived

ProxyInstaller Module

 Installs (and re-verifies) the bundled HighBarV2 skirmish AI into
 the user's BAR data directory (feature 035-central-gui-hub US2).

 Three discrete steps, each idempotent and independently observable
 via `HubEvents.ProxyInstallProgress`:

   1. `CopyAiFiles` → copy `libSkirmishAI.so` + `AIInfo.lua` +
      `AIOptions.lua` from the repo's `proxy/bundled//` into
      `/AI/Skirmish/HighBarV2//`.
   2. `TouchDevMode` → ensure `/devmode.txt` exists.
   3. `ToggleSimpleAiList` → targeted per-key rewrite of
      `/LuaMenu/Config/IGL_data.lua` to set
      `simpleAiList = false` without reformatting the file.

 FR-010: refuses to touch any path under `packages/` or `pool/`.

 The installer never raises on recoverable conditions — every
 failure mode becomes a `StepOutcome.StepFailed reason` event and
 contributes an entry to the returned error list. Unrecoverable
 bugs (null refs, arithmetic overflow, etc.) still propagate.

Types

Type Description

ProxyHealth

Operator-facing health projection over `ProxyInstallStatus`.

ProxyInstallStatus

On-disk snapshot of one engine's proxy-install state. Produced by `checkStatus`; consumed by `health` and by the Settings tab status display.

Functions and values

Function or value Description

checkStatus install bundled

Full Usage: checkStatus install bundled

Parameters:
Returns: ProxyInstallStatus

Reads the filesystem and assembles a `ProxyInstallStatus` for the given engine. No writes.

install : BarInstall
bundled : BundledProxyInfo
Returns: ProxyInstallStatus

formatHealth arg1

Full Usage: formatHealth arg1

Parameters:
Returns: string

Human-readable rendering of a `ProxyHealth`. Used by the Settings tab's status row and diagnostics logs.

arg0 : ProxyHealth
Returns: string

health status

Full Usage: health status

Parameters:
Returns: ProxyHealth

Pure projection: `ProxyInstallStatus → ProxyHealth`.

status : ProxyInstallStatus
Returns: ProxyHealth

install install bundled events force

Full Usage: install install bundled events force

Parameters:
Returns: Result<ProxyInstallStatus, string list>

Runs the three install steps in order, emitting a `HubEvents.ProxyInstallProgress` per step per outcome. Returns the post-install `ProxyInstallStatus` on success, or the list of step-level failure reasons on partial failure. **Idempotent**: if every step's precondition is already satisfied, every emitted event is `Skipped`, no file mtime changes, and the `Ok` status equals the pre-call status byte-for-byte (SC-008). **Force flag**: when the on-disk `libSkirmishAI.so` has a later mtime than the bundled copy — i.e. the user built a newer proxy locally — the copy step is `Skipped` with a warning message and `force = false`. Pass `force = true` to overwrite in that case (spec.md Edge Cases).

install : BarInstall
bundled : BundledProxyInfo
events : IHubEventSink
force : bool
Returns: Result<ProxyInstallStatus, string list>

rewriteSimpleAiList contents

Full Usage: rewriteSimpleAiList contents

Parameters:
    contents : string

Returns: string option

Pure helper: applies the `simpleAiList` rewrite to the given file contents. Returns `Some new` when a write would change the byte content, `None` when the key is already `false` or absent entirely (caller skips the write in both cases). Regex per research.md R5 — anchored multiline, group 4 is the boolean token. Surrounding whitespace, comments, and key order are preserved byte-for-byte.

contents : string
Returns: string option

Type something to start searching.