mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-31 13:42:50 +00:00
* fix(agents): preserve Claude thinking selections Model switches now resolve thinking against the target model's saved preference instead of resetting to the catalog default. Claude owns its configured-model defaults and legacy Fable alias handling, while persisted permission modes remain unchanged. * chore(claude): tag Fable compatibility shim * fix(app): resolve persisted model aliases * fix(models): preserve aliases for older clients * fix(models): hide compatibility aliases from listings * fix(settings): hide compatibility model aliases * test(claude): cover legacy catalog entry * test(app): expect mock thinking controls in schedules * fix(app): preserve queued thinking preferences * fix(app): reconcile schedule provider snapshots * fix(app): preserve schedule model selections * fix(claude): preserve exact configured model ids * fix(app): preserve committed thinking preferences * fix(app): preserve aliased schedule thinking
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import type { FormPreferences } from "./preferences";
|
|
import type { FormPreferenceUpdate } from "./service";
|
|
|
|
type PendingUpdateId = number;
|
|
|
|
export class OptimisticFormPreferences {
|
|
private committed: FormPreferences;
|
|
private readonly pending = new Map<PendingUpdateId, FormPreferenceUpdate>();
|
|
private nextId = 0;
|
|
|
|
constructor(initial: FormPreferences) {
|
|
this.committed = initial;
|
|
}
|
|
|
|
current(): FormPreferences {
|
|
let current = this.committed;
|
|
for (const update of this.pending.values()) {
|
|
current = typeof update === "function" ? update(current) : { ...current, ...update };
|
|
}
|
|
return current;
|
|
}
|
|
|
|
begin(update: FormPreferenceUpdate): PendingUpdateId {
|
|
const id = this.nextId++;
|
|
this.pending.set(id, update);
|
|
return id;
|
|
}
|
|
|
|
commit(id: PendingUpdateId, persisted: FormPreferences): void {
|
|
this.pending.delete(id);
|
|
this.committed = persisted;
|
|
}
|
|
|
|
reject(id: PendingUpdateId): void {
|
|
this.pending.delete(id);
|
|
}
|
|
|
|
reconcile(preferences: FormPreferences): void {
|
|
if (this.pending.size === 0) {
|
|
this.committed = preferences;
|
|
}
|
|
}
|
|
}
|