/** * IO seam for evolution providers. * @module @lmzhen/dsh-evolution-io */ import { Context, Service } from '@deepseek-ai/cordis'; import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core'; /** * The family's IO seam. Everything except `transact` is single-sourced from * core `EvolutionIoLike` (0.3.23 G1.3, F-340): the seam no longer redeclares * `size`/`isSymlink`/`mtime` or their `this: void` and null-vs-undefined * contracts, so a drift between seam and core in those fields is impossible by * construction. `name` stays seam-only and is added here. * * `transact` stays intentionally narrower than core: seam backends (e.g. * `nodeEvolutionIo`) are uniformly async, so the task may return only a * `Promise`. Core additionally allows a sync return (0.3.16 S1.14 X-1); the * bidirectional-await-compatible consumers live in `transactIo` and the * evolution IO adapter. */ export type EvolutionIo = Omit & { readonly name: string; transact?(this: void, path: string, task: (current: string | null) => Promise): Promise; }; declare module '@deepseek-ai/cordis' { interface Context { evolutionIo: EvolutionIoRegistry; } } export declare class EvolutionIoRegistry extends Service { private readonly providers; /** Name of the provider that declared itself the default (P2-7, v14). */ private defaultName; /** P2-3 (v15): per-name dispose — the idempotent re-registration returns * the SAME function instance, so double-dispose is a single removal. */ private readonly disposals; constructor(ctx: Context); /** * @param options.default - mark this provider as the one a nameless * `provider()` resolves. The first explicit default wins; without any * default the registry keeps its historical registration-order fallback. * * P2-3 (v15): re-registering the IDENTICAL provider object is idempotent — * it returns the original dispose and does not throw. This is what lets a * backend (io-node) re-apply (HMR / re-mounted row) without the silent * `hasProvider` early-return the v14 fix used, which had made the * fail-loud-below unreachable for a FOREIGN provider under the same name. * A different object under a registered name still throws. */ registerProvider(provider: EvolutionIo, options?: { default?: boolean; }): () => void; provider(name?: string): EvolutionIo; } export default EvolutionIoRegistry; //# sourceMappingURL=index.d.ts.map