The server compares session.directory with strict equality, but call sites
could silently pick the wrong path formatter (normalizeDirectoryQueryPath
vs toSessionTransportDirectory) — producing forward-slash paths on Windows
where the server stores native backslashes.
Changes:
- Add TransportDirectory branded type so the compiler rejects raw strings
where a transport-formatted directory is expected.
- Fix connections/store.ts: switch path discovery from normalizeDirectoryQueryPath
to toSessionTransportDirectory — this value feeds mcp.status/disconnect calls
that use the same exact-match semantics (latent Windows bug).
- Fix workspace.ts: remote directory discovery now goes through
toSessionTransportDirectory (caught by the branded type at compile time).
- Mark normalizeDirectoryQueryPath with JSDoc deprecation for server-query use.
- Add round-trip invariant and idempotency tests that assert create-path
equals list-path for both Unix and Windows directory formats.
Use one slash-normalized directory format for local session create, delete, and sidebar client scope so Windows worker switches query the same session directory they were created under. Add a focused regression check for Windows-style transport parity.
Use the active workspace root instead of stale engine directories when reloading local sessions so workspace creation, switching, and restart flows do not hide another workspace's history. Add a regression check for stale session loads overwriting sidebar and route state.