/** * `registerSystemOfUse` — runtime extension point for the E9 system-of-use * taxonomy (T11751 · AC1). * * ## Why a runtime registry * * {@link BUILTIN_SYSTEMS_OF_USE} is the static, closed-axis registry of the * well-known systems (orchestration tiers + roles + aux subsystems). Plugins, * extensions, and downstream packages need to declare NEW systems-of-use (e.g. * a `tool:my-search` or a bespoke `aux`-like subsystem) and give each a default * provider/model binding — WITHOUT editing the contracts SSoT. * * `registerSystemOfUse(key, displayName, defaults)` adds such a system to a * process-level registry. The registered default binding is consulted by the * single E9 resolution chokepoint (`resolveLLMForSystem` → `resolveLLMForRole`) * **strictly BELOW user config** — after `llm.systems[key]`, `llm.default`, and * `llm.defaultProfile` — so the user ALWAYS wins (AC1). A registered default * only supplies a binding when the user has configured nothing for that key. * * ## Import-time purity * * This module performs NO registration at import time — the registry starts * empty and is populated only by explicit `registerSystemOfUse(...)` calls. It * holds no I/O, no config reads, and no side effects on load (so importing it * is always safe). It is the runtime half intentionally split out of the * type-only `@cleocode/contracts` (Gate 10). * * @module llm/system-of-use-registry * @task T11751 * @epic T11745 */ import { type RegisteredSystemOfUse, type SystemOfUseDefaults, type SystemOfUseKind, type SystemOfUsePickerEntry } from '@cleocode/contracts'; import { formatSystemKey } from './system-key.js'; /** * A registered system-of-use whose `defaults` carry neither a `profile` nor a * complete `provider`+`model` tuple is structurally incomplete: it can declare * presence in the picker but cannot supply a resolution binding. Such a default * is skipped at resolution time (the chain falls through) — never an error. * * @param defaults - The candidate default binding. * @returns `true` when the default can actually bind a provider/model. * @task T11751 */ export declare function isResolvableSystemDefault(defaults: SystemOfUseDefaults): boolean; /** * Register a new system-of-use with a default provider/model binding (AC1). * * The registration is merged UNDER user config: the resolver consults * `defaults` only when the user has configured nothing more specific for `key` * (no `llm.systems[key]`, no `llm.default`, no `llm.defaultProfile`). Re-calling * with the same `key` REPLACES the prior registration (last-write-wins) so a * package can update its own default idempotently. * * `key` MAY be a flat label (e.g. `'sentient'`) or an open-axis encoded key * (`'tool:web-search'`). Passing a structured `SystemOfUse` descriptor is also * supported via {@link registerSystemOfUseDescriptor}. * * @param key - Encoded system-of-use key (non-empty). * @param displayName - Human-readable name for the picker surface (non-empty). * @param defaults - Default binding consulted strictly below user config. * @returns The stored {@link RegisteredSystemOfUse} record. * @throws {RangeError} When `key` or `displayName` is empty. * @task T11751 * @epic T11745 */ export declare function registerSystemOfUse(key: string, displayName: string, defaults: SystemOfUseDefaults): RegisteredSystemOfUse; /** * Register a system-of-use from a structured {@link SystemOfUse} descriptor, * encoding it to its canonical string key via {@link formatSystemKey}. * * Convenience wrapper over {@link registerSystemOfUse} for callers that already * hold a `{ kind, id }` descriptor (e.g. plugin-declared tools/skills). * * @param system - The structured descriptor to register. * @param displayName - Human-readable name for the picker surface. * @param defaults - Default binding consulted strictly below user config. * @returns The stored {@link RegisteredSystemOfUse} record. * @task T11751 */ export declare function registerSystemOfUseDescriptor(system: Parameters[0], displayName: string, defaults: SystemOfUseDefaults): RegisteredSystemOfUse; /** * Look up the runtime-registered default binding for an encoded system key. * * Returns `undefined` when no system is registered under `key` OR when its * default is structurally incomplete (so the resolver falls through). This is * the read surface the E9 resolver calls AFTER exhausting all user-config tiers. * * @param key - Encoded system-of-use key (may be undefined — returns undefined). * @returns The resolvable {@link SystemOfUseDefaults}, or `undefined`. * @task T11751 */ export declare function getRegisteredSystemDefault(key: string | undefined): SystemOfUseDefaults | undefined; /** * Enumerate every system-of-use for the TUI / Studio profile picker (AC2): * the static {@link BUILTIN_SYSTEMS_OF_USE} table followed by every * runtime-registered system, de-duplicated by key (a registration for a builtin * key overrides the builtin entry — "user/runtime wins" for the picker label). * * Each entry carries its encoded `key`, a `displayName`, the discriminant * `kind`, and its `source` (`'builtin'` | `'registered'`) so the picker can * render and group them. Registered entries also surface their `defaults`. * * @param kind - Optional kind filter — when set, only that axis is returned. * @returns The merged, ordered picker entries. * @task T11751 * @epic T11745 */ export declare function listSystemsOfUse(kind?: SystemOfUseKind): SystemOfUsePickerEntry[]; /** * Clear all runtime registrations. * * Intended for test isolation — production code never needs to un-register a * system. Builtins are unaffected (they live in the contracts SSoT, not here). * * @internal * @task T11751 */ export declare function clearRegisteredSystemsOfUse(): void; //# sourceMappingURL=system-of-use-registry.d.ts.map