/** * client 半边入口。注册**两个互补**的呈现: * * 1. `conversation.input.left`(list · `replaceRisk: none`)—— * **追加式**的当前模型徽章:免开菜单即可见倍率与倒计时。 * 2. `conversation.input.model`(single · shadows-shipped-ui)—— * **完整移植的官方模型选择器 + 每行倍率徽章**:展开菜单时逐行对比各模型峰谷。 * * 两者并存:原显示(工具行徽章)保留不动,菜单内**新增**逐行倍率。 * * 数据来源:只读共享的官方 `ctx.modelDirectories`(与 `/model` 弹窗同一实例), * 因此判定天然与选择器一致。 * * ⚠️ 关于第 2 项的历史教训:本插件曾用**残缺的**替换实现接管该槽位,导致用户 * 无法切换模型。现要求「**功能超集**」——官方有的交互必须全部保留(见 * `ModelSelect.tsx` 的移植纪律)。守卫测试见 `test/bundle-contract.test.ts`。 */ import * as React from 'react'; import type { Context } from '@deepseek-ai/cordis'; import type { MatchConfig, RateProfile } from '../matching.js'; /** * 已知会遮蔽自带 UI、但本插件**有意接管**的槽位(附接管理由)。 * * 守卫测试 `test/bundle-contract.test.ts` 会读取此清单:清单**之外**的 * shadowing 槽位一律禁止注册;列在这里的必须满足「功能超集」。 */ export declare const INTENTIONALLY_SHADOWED: Record; /** 注入面:构建期打包进 client 的 profile 快照。 */ interface PeakrateFace { profiles: () => RateProfile[]; config: () => MatchConfig; } /** 组件注入面:来自官方 `modelDirectories` 的**只读**句柄。 */ interface ChipProps { available: boolean; directory: { getSnapshot: () => { current: { provider: string; model: string; } | null; /** 共享模型目录的分组;用于把模型 **id** 换成用户看到的**展示名**。 */ groups?: readonly { id: string; models: readonly { id: string; name: string; }[]; }[]; }; subscribe: (fn: () => void) => () => void; }; peakrate?: PeakrateFace; /** 本地化函数(悬停详情需要按语言渲染)。 */ t?: (key: string, params?: Record) => string; } /** * 紧凑倍率徽章:显示**当前模型**的倍率与倒计时。 * 未匹配的模型**什么都不渲染**(返回 null,无占位、无灰字)。 * * @param props - 注入面 + 共享模型目录。 */ export declare function PeakrateChip(props: ChipProps): React.ReactElement | null; /** * client 插件入口:注册工具行徽章 + fork 的模型选择器。 * * 注册要点: * - 用**属性访问**取服务(`scope.slots`),不用 `ctx.get()`——cordis 服务代理 * 只在属性访问时把 `this.ctx` 绑定到调用方上下文,否则内部依赖解析不到; * - `conversation.input.left` 是 **list** 槽位 → 用 `id` 做纯追加; * - `conversation.input.model` 是 **single** 槽位 → 用 `name` 接管(有意为之)。 * * @param ctx - client cordis 上下文。 */ export declare function apply(ctx: Context): void; export { rateFor } from './rate.js'; export declare const name = "dsh-peakrate-client"; /** * 插件级 inject —— 与官方 `dsh-client-ui-model-selection` 对齐。 * * - `modelDirectories.directoryFor()` 内部依赖 **`remote.session`**,缺了它会在 * **运行时**抛 `cannot get property "remote.session" without inject` * (纯函数单测与服务端产物均正常,只有真实浏览器能暴露); * - `locale` 用于注册本插件自己的文案命名空间。 */ export declare const inject: string[];