How mymtgo/sidecar works
MTGO Sidecar is a Windows helper that observes a live MTGO client through MTGOSDK and produces an NDJSON event stream and status file for the app’s PHP ingester. The main workflow is supervisor startup and version gating, SDK attachment and probing, match/game tracking, snapshot-to-event folding, and durable output. The graph includes documented status, logging, and cache capabilities. Some adapter and supervisor wiring is based on README descriptions because the supplied excerpts are partial.
Main entry points: Program.cs Supervisor Loop · SessionRunner.cs Session Runner · SdkGameRecorder.cs Game Recorder · EventWriter.cs Event Writer
Components 29
Supervision
- CLI Options
MyMtgo.Sidecar.Core/Host/SidecarOptions.cs - Supervisor Loop
MyMtgo.Sidecar/Program.cs - Parent Watch
MyMtgo.Sidecar.Core/Host/ParentWatch.cs - Version Gate
MyMtgo.Sidecar.Core/Gate/VersionGate.cs - Known-Good Cache
MyMtgo.Sidecar.Core/Gate/KnownGoodCache.cs
MTGO Adapter
- SDK Attachment
MyMtgo.Sidecar/Sdk/SdkAttachment.cs - Health Probe
MyMtgo.Sidecar/Sdk/Probe.cs - Session Runner
MyMtgo.Sidecar/Sdk/SessionRunner.cs - Snapshot Reader
MyMtgo.Sidecar/Sdk/SnapshotReader.cs - Snapshot Mapper
MyMtgo.Sidecar/Sdk/SnapshotMapper.cs - Catalog Resolver
MyMtgo.Sidecar/Sdk/CatalogResolver.cs
Game Tracking
- Game Recorder
MyMtgo.Sidecar/Sdk/SdkGameRecorder.cs - Match Tracker
MyMtgo.Sidecar/Sdk/SdkMatchTracker.cs - Game Snapshot
MyMtgo.Sidecar.Core/Model/GameSnapshot.cs - Event Folding
MyMtgo.Sidecar.Core/Fold/GameRecorder.cs - Snapshot Differ
MyMtgo.Sidecar.Core/Fold/SnapshotDiffer.cs - Keyframe Builder
MyMtgo.Sidecar.Core/Fold/KeyframeBuilder.cs
Events and Output
- Pending Events
MyMtgo.Sidecar.Core/Writer/PendingEvent.cs - Event Writer
MyMtgo.Sidecar.Core/Writer/EventWriter.cs - Event Envelope
MyMtgo.Sidecar.Core/Envelope/EventEnvelope.cs - NDJSON Stream
Status and Diagnostics
- Status Writer
MyMtgo.Sidecar.Core/Status/StatusWriter.cs - Status JSON
- Rolling Logger
MyMtgo.Sidecar.Core/Logging/RollingFileLogger.cs - Diagnostic Log
Other components
- Parent App
- MTGO Client
- PHP Ingester
- Remote Config
Connections 33
- Parent App → Supervisor Loop: starts with PID
- Supervisor Loop → CLI Options: parses arguments
- Supervisor Loop → Parent Watch: watches parent
- Supervisor Loop → Version Gate: checks version
- Version Gate → Remote Config: fetches versions
- Version Gate → Known-Good Cache: reads and refreshes
- Supervisor Loop → SDK Attachment: attaches to MTGO
- SDK Attachment → MTGO Client: connects to
- Supervisor Loop → Session Runner: runs session
- Session Runner → MTGO Client: subscribes to hooks
- Session Runner → Health Probe: runs probes
- Session Runner → Game Recorder: creates per game
- Session Runner → Match Tracker: tracks match state
- Game Recorder → Snapshot Reader: reads game state
- Snapshot Reader → Snapshot Mapper: maps SDK data
- Snapshot Mapper → Catalog Resolver: resolves cards
- Snapshot Mapper → Game Snapshot: produces snapshot
- Game Recorder → Event Folding: records snapshots
- Event Folding → Snapshot Differ: diffs ticks
- Event Folding → Keyframe Builder: builds keyframes
- Snapshot Differ → Pending Events: emits changes
- Keyframe Builder → Pending Events: emits keyframes
- Match Tracker → Pending Events: emits match events
- Game Recorder → Event Writer: submits events
- Match Tracker → Event Writer: submits events
- Event Writer → Event Envelope: stamps events
- Event Writer → NDJSON Stream: appends lines
- PHP Ingester → NDJSON Stream: ingests events
- PHP Ingester → Status JSON: reads state
- Supervisor Loop → Status Writer: updates status
- Status Writer → Status JSON: writes atomically
- Supervisor Loop → Rolling Logger: logs diagnostics
- Rolling Logger → Diagnostic Log: writes rolling log