* Deterministic string ordering. The workspace inventory is placed in the * prompt-cache prefix (mothership), so its bytes must be identical for identical * workspace state regardless of DB row order — otherwise the cache silently * busts every turn. `localeCompare` with a pinned locale gives sta
(a: string, b: string)
| 97 | * ordering across Sim instances (all run the same Node/ICU build). |
| 98 | */ |
| 99 | function stableCompare(a: string, b: string): number { |
| 100 | return a.localeCompare(b, 'en') |
| 101 | } |
| 102 | |
| 103 | /** Stable order by display name, tie-broken by id, for inventory listings. */ |
| 104 | function byNameThenId(a: { name: string; id: string }, b: { name: string; id: string }): number { |
no outgoing calls
no test coverage detected