import type { CordisContext, HostAdapterConfig } from '../types.js'; export declare const supports = ">=0.1.0-rc.1 <2.0.0"; export declare const name = "dsh-1-x"; export declare const BRIDGE_PREFIX = "/api/dshloader"; export declare const hostPackageAliases: Record; export declare const clientModuleAliases: Record; export declare const clientPackageAliases: Record; /** * Ensure the single Module._resolveFilename hook exists and merge `aliases` * into its shared map. Never adds a wrapper: repeat calls (runtime * `registerPackageAlias`, HMR re-apply) only mutate the map. When the chain * top was replaced without chaining into us (the mapping silently stops * applying), the hook is re-pointed at the current top — still the same * single wrapper, no growth. * * Returns a dispose function that rolls back exactly the entries this call * set (when unchanged since) and restores the original resolver once the * last registrant disposes. */ export declare function installHostPackageAliases(aliases: Record): Promise<() => void>; /** * @param ctx cordis context * @param config */ export declare function create(ctx: CordisContext, config?: HostAdapterConfig): HostAdapterType; interface HostAdapterType { supports: string; name: string; apply: () => Promise; dispose: () => void; } /** * Restore the pre-0.1.2 `Session.events` read-only accessor. * * dsh-session 0.1.2(随 dsh 0.1.2-alpha.2 起捆绑进 meta 包)把 `Session` 的 * `events` 只读访问器换成了 `snapshotEvents(fromSeq?, toSeqExclusive?)` 方法 * (无参全量调用复用宿主自身的缓存快照,语义与旧访问器一致)。直接迭代 * `session.events` 的旧插件(dsh-code-review 等)会在 `agent/created` 同步 * 监听器里抛 `session.events is not iterable`,被创建路径包装后整个 * session/create 失败。 * * 这里按特性探测在 Session 原型上补回访问器(委托 snapshotEvents()): * 访问器已存在(旧版 dsh)或 snapshotEvents 缺失(更远的未来版本)时都不 * 安装。已存活会话立即补齐(live reload 场景);之后创建的会话经 * `session/created` 钩子补齐——创建流程中 session/created 先于 * agent/created 派发(agent-loop 的 enter → sessions.announce → * agents.announce),因此 agent/created 监听器读到的是旧契约。 * * 返回的 disposer 摘除监听器并移除我们安装的访问器(identity 校验, * 不碰他人后来覆盖的实现)。 */ export declare function installSessionEventsAccessor(ctx: CordisContext): () => void; export {};