/** * The one owner of this frontend's Harness settings namespace. * * Harness owns the document, the layering, the validation, and the change feed. * This module owns one namespace — `dshline` — and turns what Harness publishes * into what each consumer needs: what a preference is now, when it changed, and * a way to store the reader's choice. * * `dshline` is the profile ENTRY ID the settings service addresses, not a * section this frontend hands it. There is no registration call left to make: * the service derives one form per active profile entry from that entry's own * `Config`, keeps only its `.volatile()` fields editable, and addresses it by * the id the bundle patch inserts. The three keys' schema therefore belongs to * this row's configuration and not to this module, and the values in force are * the ones Harness committed into the running row. * * Layering is still Harness's, not this frontend's: schema default, then this * row's own composed config, then the profile patch a write lands in. There is * no second document, no parser, and no state machine. * * **One owner, because the row is one.** A profile entry is addressed by a * single id, so its keys have a single resolved source and a single writer; a * second registration would have been a competing section for the same * namespace, with two sources, two change fans, and two schemas each * validating away the other's key. So the row has exactly one owner here, and * consumers receive narrow per-key facets rather than a settings object they * could reach past. That is the whole of the abstraction: no key registry, no * dynamic schema, no generic settings framework for two preferences. * @module dshline/settings */ import type { Context, Volatile } from '@deepseek-ai/cordis'; import type { BusyEnter } from './delivery.ts'; /** * The reader preferences this row's own configuration carries, as Harness * hands them to the row. * * `Volatile` references rather than values, and that is what keeps `/theme`, * `/enter` and the attention bell writable without a remount: Harness commits a * stored value by mutating the live reference in place, so reading through * `.get()` is the whole change feed on the read side. A plain value here would * freeze the preference at mount and make persistence a launch-time-only fact. */ export interface DshlinePreferences { readonly theme: Volatile | undefined; readonly busyEnter: Volatile | undefined; readonly attentionBell: Volatile | undefined; } /** One preference's resolved value set, as a consumer reads it. */ export interface DshlineSection { /** The theme id currently in force. */ readonly theme: string; /** What plain `enter` means while a turn is running. */ readonly busyEnter: BusyEnter; /** Whether this frontend emits terminal BEL for live human interaction. */ readonly attentionBell: boolean; } /** * One preference, as its consumer sees it. * * Narrow on purpose: a facet can read and store its own key and cannot reach the * namespace, the provider, or another key. The window takes the theme facet and * still has no way to write the input preference through it. */ export interface PreferenceSetting { /** The value in force right now, across every layer Harness resolves. */ readonly current: () => T; /** * Observe a committed change to THIS preference, from any source — including * `settings.yaml` edited by hand while the session runs. * * Scoped to the key, not to the document. The namespace is one section, so * Harness reports one change for a write to any of its keys, and republishing * that to every facet was a correctness bug rather than a nuisance: both * preferences deliberately keep a live choice whose write FAILED, so an * unrelated key's successful write would wake this facet, resolve the value * still on disk, and silently roll the reader's live choice back. Each facet * therefore remembers what it last published and stays quiet unless its own * resolved value actually moved. * @param listener - called after this preference's resolved value changes. * @returns the disposer removing this listener. */ readonly watch: (listener: () => void) => () => void; /** * Store a choice in the user layer. * * A path op rather than a whole-section write, so a key this frontend does not * know about — one a newer version added — is never deleted by an older one, * and neither facet can clobber the other's key. * @param value - the value to store. * @returns a phrase to append to the command's report, or nothing to add. */ readonly save: (value: T) => Promise; } /** The facets this namespace publishes. */ export interface DshlineSettings { /** The palette this frontend draws with. */ readonly theme: PreferenceSetting; /** What plain `enter` means while a turn is running. */ readonly busyEnter: PreferenceSetting; /** Whether this frontend emits terminal BEL for live human interaction. */ readonly attentionBell: PreferenceSetting; } /** * Expose one facet per key of this row's own configuration. * @param ctx - the plugin context owning the registration. * @param entry - this row's own live configuration references, the layer below anything stored. * @returns the readers and writers this frontend's consumers use. */ export declare function installDshlineSettings(ctx: Context, entry: DshlinePreferences): DshlineSettings; //# sourceMappingURL=settings.d.ts.map