Repository navigation
feat(sim): discovery file and simulation start options for local companions - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small additions so local companion tools (an MCP server, a test harness, an accessibility companion) can work alongside the desktop app without changing how it binds or what it exposes.
Backend discovery file
The embedded backend binds
127.0.0.1:0, so nothing outside the process could find it. The desktop now writes<data_dir>/server.json(url,pid,started_at) via stage-and-rename right after the backend binds, and removes it on graceful shutdown. Removal is guarded bypid, so an older instance shutting down never deletes a newer instance's record. The file holds no credentials; readers must confirm withGET /healthzsince a crash leaves it behind. The bind stays loopback-only. Documented in the README under "Data and settings".Simulation start options and speed route
POST /api/sessions/{key}/live-simulation/startaccepts an optional JSON body{ "start_t" | "start_lap", "speed" }. Without a body, behaviour is unchanged.start_lapresolves to the first persisted frame of that leader lap by bisecting the frame index;start_tis clamped to the replay bounds. Both selectors at once, a lap beyond the replay, or a non-positive speed return400.POST /api/sessions/{key}/live-simulation/speedwith{ "speed" }changes a running simulation's speed using the existing clock rebase, socurrent_tstays continuous.404when nothing is running. The?speed=query on/streambehaves as before.shared/contracts/replay-api.md.Tests
desktop-gpui: discovery round-trip and removal; foreign-pid record left alone.backend: start_t clamping, start_lap resolution and out-of-range rejection, conflicting selectors and invalid speed, speed continuity, plus an API test for all three routes. Full backend suite passes (219).