import type { Plugin } from '@moxxy/sdk'; import type { PluginHostOptions } from './host-options.js'; /** * The per-registry record of the names a loaded plugin contributed. Keyed by * the {@link LoadedRecord} field each kind writes to. PluginHost stores one * `LoadedRecord` per loaded plugin so `unload` knows exactly which names to * unregister from each registry. */ export interface RegistryNameRecord { readonly toolNames: ReadonlyArray; readonly providerNames: ReadonlyArray; readonly modeNames: ReadonlyArray; readonly compactorNames: ReadonlyArray; readonly cacheStrategyNames: ReadonlyArray; readonly viewRendererNames: ReadonlyArray; readonly tunnelProviderNames: ReadonlyArray; readonly channelNames: ReadonlyArray; readonly surfaceNames: ReadonlyArray; readonly agentNames: ReadonlyArray; readonly commandNames: ReadonlyArray; readonly transcriberNames: ReadonlyArray; readonly synthesizerNames: ReadonlyArray; readonly embedderNames: ReadonlyArray; readonly isolatorNames: ReadonlyArray; readonly workflowExecutorNames: ReadonlyArray; readonly eventStoreNames: ReadonlyArray; readonly auditSinkNames: ReadonlyArray; readonly auditExporterNames: ReadonlyArray; readonly secretProviderNames: ReadonlyArray; readonly reflectorNames: ReadonlyArray; } /** * A single contribution kind, mapping a plugin field + registry to the * register / unregister / name-extraction operations PluginHost performs for * it. Driving register and unregister from this one table keeps the two sides * in lockstep — adding a registry kind is one entry, not edits to two parallel * 16-line lists. * * `TDef` is the contribution def type for this kind. The table is declared with * heterogeneous defs, so it is widened to `RegistryKind` for iteration; * each entry's closures stay individually type-checked against their own def. */ export interface RegistryKind { /** Stable identifier for the kind (used by tests/diagnostics). */ readonly kind: string; /** {@link RegistryNameRecord} field this kind writes its names to. */ readonly recordField: keyof RegistryNameRecord; /** The defs this plugin contributes for this kind. */ readonly defs: (plugin: Plugin) => ReadonlyArray; /** Extract the registry key from a def (mostly `.name`; surfaces use `.kind`). */ readonly nameOf: (def: TDef) => string; /** * Register a single def into its registry (uses `register` or `replace`). * `trusted` is true for statically-registered builtins and false for * discovered (untrusted) plugins; most kinds ignore it, but the isolator * registry uses it to refuse letting a discovered plugin shadow a builtin. * * Returns `false` when the registration was REFUSED without taking effect * (currently only the isolator registry, when an untrusted plugin tries to * shadow a trusted name). PluginHost must NOT track a refused registration * for rollback — unregistering it on a later mid-`applyPlugin` failure would * delete a name this plugin never actually owned. `void`/`true` means applied. */ readonly register: (opts: PluginHostOptions, def: TDef, trusted: boolean) => void | boolean; /** Remove a previously-registered name from its registry. */ readonly unregister: (opts: PluginHostOptions, name: string) => void; /** * True when `register` is an override (`replace`) rather than a throw-on- * duplicate insert. Such kinds are last-wins and may clobber a name seeded by * core or another plugin, so PluginHost must NOT roll them back when a later * kind throws mid-`applyPlugin` (unregistering would delete a def this plugin * didn't actually own). */ readonly overrideOnRegister?: boolean; } /** * The authoritative ordered list of contribution kinds. The ORDER here is the * exact register order `applyPlugin` used and the exact unregister order * `unload` used; preserve it when editing. */ export declare const REGISTRY_KINDS: ReadonlyArray>; //# sourceMappingURL=registry-kinds.d.ts.map