mirror of
https://github.com/stablyai/orca.git
synced 2026-10-12 08:02:37 +00:00
* fix(cli): migrate managed WSL launchers to native exe * refactor(cli): reconcile managed WSL registrations * fix(cli): harden WSL registration reconciliation * fix(cli): serialize and harden WSL CLI registration lifecycle - Cap per-distro concurrent repairs and add a filesystem lock so two Orca installs can't race the same distro's launcher/bridge files - Skip re-adopting a legacy managed launcher when its bridge is user- owned, avoiding a doomed install retried on every startup - Track per-distro reconciliation against launcher target + app version so unchanged registrations aren't re-probed each boot - Replace command install with a single atomic rename instead of a move-based backup, closing a window where no orca-ide exists - Remove the registry invalidate-on-persist-failure path now that writes are atomic and repair is disk-authoritative - Add brief negative caching to WSL distro discovery to bound wsl.exe respawns on persistently broken hosts - Extract keyed-promise-queue as a shared serialization primitive
24 lines
837 B
TypeScript
24 lines
837 B
TypeScript
import { runKeyedSerializedOperation } from './keyed-promise-queue'
|
|
|
|
const operationQueues = new Map<string, Promise<void>>()
|
|
|
|
/**
|
|
* Canonical key for a WSL distro name. The operation queue and the
|
|
* registration registry must agree on this to serialize against each other.
|
|
*/
|
|
export function normalizeWslDistroKey(distro: string): string {
|
|
return distro.trim().toLowerCase()
|
|
}
|
|
|
|
/**
|
|
* Serializes registration reads and mutations for one WSL distro.
|
|
*/
|
|
export function runSerializedWslCliRegistrationOperation<T>(
|
|
distro: string,
|
|
operation: () => Promise<T>
|
|
): Promise<T> {
|
|
// Why: startup repair continues in the background and can otherwise undo a
|
|
// concurrent Settings install/remove or overwrite its ownership metadata.
|
|
return runKeyedSerializedOperation(operationQueues, normalizeWslDistroKey(distro), operation)
|
|
}
|