dsh-thinking-levels 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["useSyncExternalStore"],"sources":["../src/client/locales.ts","../src/client/card.tsx","../src/client/index.ts"],"sourcesContent":["/** `thinking-levels` client dictionaries. */\r\n\r\n/** Dictionary namespace owned by this plugin. */\r\nexport const NS = 'thinking-levels'\r\n\r\n/** Simplified Chinese dictionary (the key-set source of truth). */\r\nexport const zh = {\r\n 'card.title': '思考档位',\r\n 'card.description': '在模型选择器中可选 Auto(mask):按工具调用历史自动在 low / high / max 间调度后提交 API。此处配置默认档位与调度边界。',\r\n 'card.level': '默认档位',\r\n 'card.level.off': 'off — 关闭思考(仅手动,永不自动选择)',\r\n 'card.level.low': 'low — 低(简单任务,廉价轮保持廉价)',\r\n 'card.level.high': 'high — 高(官方默认)',\r\n 'card.level.max': 'max — 最大(重任务)',\r\n 'card.level.auto': 'auto — 按工具历史自动调度(默认)',\r\n 'card.enabled': '启用',\r\n 'card.allowDowngrade': '允许降档(auto 可降至 low)',\r\n 'card.allowUpgrade': '允许升档(auto 可升至 max)',\r\n 'card.unavailable': '设置命名空间不可用:请确认 dsh-thinking-levels 已装配进 profile。',\r\n 'card.readonly': '只读',\r\n} satisfies Record<string, string>\r\n\r\n/** English dictionary (keys mirror zh). */\r\nexport const en: Record<keyof typeof zh, string> = {\r\n 'card.title': 'Thinking Levels',\r\n 'card.description': 'Pick Auto in the model selector: the plugin schedules low / high / max per tool round before submitting the API effort. Here you configure the default level and scheduler bounds.',\r\n 'card.level': 'Default level',\r\n 'card.level.off': 'off — disable thinking (manual only, never auto-picked)',\r\n 'card.level.low': 'low — cheap rounds stay cheap',\r\n 'card.level.high': 'high — the official default',\r\n 'card.level.max': 'max — heavy work',\r\n 'card.level.auto': 'auto — schedule from tool history (default)',\r\n 'card.enabled': 'Enabled',\r\n 'card.allowDowngrade': 'Allow downgrade (auto may drop to low)',\r\n 'card.allowUpgrade': 'Allow upgrade (auto may lift to max)',\r\n 'card.unavailable': 'Settings namespace unavailable: make sure dsh-thinking-levels is assembled into this profile.',\r\n 'card.readonly': 'Read-only',\r\n}\r\n","/**\r\n * Thinking-levels settings card — the `settings.plugin.item` face of the\r\n * dsh-thinking-levels plugin.\r\n *\r\n * The card binds the `thinking-levels` settings namespace through the\r\n * `settingsScope` cordis service and renders its four fields: the level picker\r\n * (off / low / high / max / auto) plus the three scheduler toggles. Every\r\n * change commits immediately through the scope (no staged form): the decision\r\n * is read per model request, so a committed change applies to the next request\r\n * without a restart.\r\n *\r\n * Kept dependency-free beyond react: the scope is subscribed with\r\n * `useSyncExternalStore`, and the controls are plain HTML so the client bundle\r\n * needs no CSS modules and no primitives value import.\r\n */\r\nimport { useSyncExternalStore } from 'react'\r\nimport type { CSSProperties, JSX } from 'react'\r\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\r\nimport type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { EffortId } from '../thinking-level.ts'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\n\r\n/** One injected face: the bound settings scope for the `thinking-levels` namespace. */\r\nexport interface ThinkingLevelsCardInjected {\r\n scope: SettingsScope<ThinkingLevelsConfig>\r\n}\r\n\r\n/** Full props: locale seat + the injected scope. */\r\nexport type ThinkingLevelsCardProps = PropsLocale<'thinking-levels'> & ThinkingLevelsCardInjected\r\n\r\n/** The five user-facing levels, in picker order. */\r\nconst EFFORT_OPTIONS: readonly EffortId[] = ['off', 'low', 'high', 'max', 'auto']\r\n\r\n/** Minimal shared row styling (inline; keeps the client bundle CSS-free). */\r\nconst rowStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'space-between',\r\n gap: '12px',\r\n padding: '6px 0',\r\n fontSize: '13px',\r\n lineHeight: '20px',\r\n}\r\n\r\nconst labelStyle: CSSProperties = { margin: 0, color: 'var(--dsw-alias-label-primary)' }\r\n\r\nconst controlStyle: CSSProperties = {\r\n background: 'var(--dsw-alias-bg-surface, #fff)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '4px',\r\n padding: '3px 8px',\r\n fontSize: '13px',\r\n}\r\n\r\n/** One boolean field row (checkbox) bound to the scope. */\r\nfunction ToggleRow(props: {\r\n id: string\r\n label: string\r\n checked: boolean\r\n disabled: boolean\r\n onChange: (next: boolean) => void\r\n}): JSX.Element {\r\n const { id, label, checked, disabled, onChange } = props\r\n return (\r\n <div style={rowStyle}>\r\n <label htmlFor={id} style={labelStyle}>{label}</label>\r\n <input\r\n id={id}\r\n type=\"checkbox\"\r\n checked={checked}\r\n disabled={disabled}\r\n onChange={(event) => onChange(event.currentTarget.checked)}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\n/**\r\n * The card body.\r\n * @param props - locale copy and the injected settings scope.\r\n */\r\nexport function ThinkingLevelsCard({ t, scope }: ThinkingLevelsCardProps): JSX.Element {\r\n const snapshot = useSyncExternalStore(\r\n (listener) => scope.subscribe(listener),\r\n () => scope.getSnapshot(),\r\n )\r\n const unavailable = snapshot.status === 'unavailable'\r\n const readonly = unavailable || !snapshot.writable\r\n const value = (snapshot.value ?? {}) as Partial<ThinkingLevelsConfig>\r\n const level = EFFORT_OPTIONS.includes(value.level as EffortId) ? value.level as EffortId : 'auto'\r\n\r\n if (unavailable) {\r\n return (\r\n <div style={{ padding: '12px 16px', fontSize: '13px', color: 'var(--dsw-alias-label-tertiary)' }}>\r\n {t('card.unavailable')}\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div style={{ padding: '12px 16px' }}>\r\n <div style={rowStyle}>\r\n <label htmlFor=\"plugin-config-thinking-levels-level\" style={labelStyle}>{t('card.level')}</label>\r\n <select\r\n id=\"plugin-config-thinking-levels-level\"\r\n value={level}\r\n disabled={readonly}\r\n style={controlStyle}\r\n onChange={(event) => { void scope.set('level', event.currentTarget.value as EffortId) }}\r\n >\r\n {EFFORT_OPTIONS.map((option) => (\r\n <option key={option} value={option}>{t(`card.level.${option}`)}</option>\r\n ))}\r\n </select>\r\n </div>\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-enabled\"\r\n label={t('card.enabled')}\r\n checked={value.enabled ?? true}\r\n disabled={readonly}\r\n onChange={(next) => { void scope.set('enabled', next) }}\r\n />\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-downgrade\"\r\n label={t('card.allowDowngrade')}\r\n checked={value.allowDowngrade ?? true}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(next) => { void scope.set('allowDowngrade', next) }}\r\n />\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-upgrade\"\r\n label={t('card.allowUpgrade')}\r\n checked={value.allowUpgrade ?? false}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(next) => { void scope.set('allowUpgrade', next) }}\r\n />\r\n {!snapshot.writable && <p style={{ margin: '8px 0 0', fontSize: '12px', color: 'var(--dsw-alias-label-tertiary)' }}>{t('card.readonly')}</p>}\r\n </div>\r\n )\r\n}\r\n","/**\r\n * dsh-thinking-levels — browser half.\r\n *\r\n * Registers the `thinking-levels` dictionaries and one `settings.plugin.item`\r\n * card keyed by the plugin's settings namespace, so the shared Plugins\r\n * settings tab renders an editable card: the level picker (off / low / high /\r\n * max / auto) plus the scheduler toggles.\r\n *\r\n * All @deepseek-ai/* imports are type-only: collaboration happens through\r\n * cordis services (`settingsScope`) and slot registration only (client bundle\r\n * purity).\r\n */\r\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\r\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\r\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\nimport { NS, en, zh } from './locales.ts'\r\nimport { ThinkingLevelsCard, type ThinkingLevelsCardInjected } from './card.tsx'\r\n\r\n/** The settings namespace the host half registers (kept in lockstep with src/index.ts). */\r\nconst THINKING_LEVELS_NS = 'thinking-levels'\r\n\r\n/** Services required by the browser half. */\r\nexport const inject = ['slots', 'locale', 'settingsScope']\r\n\r\n/**\r\n * Client plugin body: dictionaries plus the settings card registration.\r\n * @param ctx - client root context.\r\n */\r\nexport function apply(ctx: ClientContext): void {\r\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-thinking-levels: dictionaries')\r\n\r\n ctx.slots.inject('settings.plugin.item', function* () {\r\n yield ctx.slots.register({\r\n name: 'settings.plugin.item',\r\n // Both keys are supplied: CLI dsh declares this slot `keyed` (needs\r\n // `key`) while DSH Desktop's bundled version declares it `list` (needs\r\n // `id`) — the slots service validates only its kind's field, so the\r\n // pair keeps the card working in both environments.\r\n id: THINKING_LEVELS_NS,\r\n key: THINKING_LEVELS_NS,\r\n locale: NS,\r\n inject: (): ThinkingLevelsCardInjected => {\r\n const scope = ctx.settingsScope.bind<ThinkingLevelsConfig>({ namespace: THINKING_LEVELS_NS })\r\n return { scope }\r\n },\r\n }, ThinkingLevelsCard)\r\n })\r\n}\r\n"],"mappings":";;;;;;;;;;;EAGA,MAAa,KAAK;;EAGlB,MAAa,KAAK;GAChB,cAAc;GACd,oBAAoB;GACpB,cAAc;GACd,kBAAkB;GAClB,kBAAkB;GAClB,mBAAmB;GACnB,kBAAkB;GAClB,mBAAmB;GACnB,gBAAgB;GAChB,uBAAuB;GACvB,qBAAqB;GACrB,oBAAoB;GACpB,iBAAiB;EACnB;;EAGA,MAAa,KAAsC;GACjD,cAAc;GACd,oBAAoB;GACpB,cAAc;GACd,kBAAkB;GAClB,kBAAkB;GAClB,mBAAmB;GACnB,kBAAkB;GAClB,mBAAmB;GACnB,gBAAgB;GAChB,uBAAuB;GACvB,qBAAqB;GACrB,oBAAoB;GACpB,iBAAiB;EACnB;;;;;;;;;;;;;;;;;;;ECNA,MAAM,iBAAsC;GAAC;GAAO;GAAO;GAA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AM,qBAAqB;;EAG3B,MAAa,SAAS;GAAC;GAAS;GAAU;EAAe;;;;;EAMzD,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa,IAAI,OAAO,SAAS,IAAI;IAAE;IAAI;GAAG,CAAC,GAAG,mCAAmC;GAEzF,IAAI,MAAM,OAAO,wBAAwB,aAAa;IACpD,MAAM,IAAI,MAAM,SAAS;KACvB,MAAM;KAKN,IAAI;KACJ,KAAK;KACL,QAAQ;KACR,cAA0C;MAExC,OAAO,EAAE,OADK,IAAI,cAAc,KAA2B,EAAE,WAAW,mBAAmB,CAC9E,EAAE;KACjB;IACF,GAAG,kBAAkB;GACvB,CAAC;EACH"}
1
+ {"version":3,"file":"client.js","names":["useSyncExternalStore","useState"],"sources":["../src/client/locales.ts","../src/client/card.tsx","../src/client/index.ts"],"sourcesContent":["/** `thinking-levels` client dictionaries (zh / en / ja / ko). */\r\n\r\n/** Dictionary namespace owned by this plugin. */\r\nexport const NS = 'thinking-levels'\r\n\r\n/** Simplified Chinese dictionary (the key-set source of truth). */\r\nexport const zh = {\r\n 'card.title': '思考档位',\r\n 'card.description': '在模型选择器中可选 Auto(mask):按工具调用历史自动在 low / high / max 间调度后提交 API。此处配置默认档位、调度边界与模型能力(档位 → 网关线上值映射)。',\r\n 'card.level': '默认档位',\r\n 'card.level.off': 'off — 关闭思考(仅手动,永不自动选择)',\r\n 'card.level.on': 'on — 开启思考(仅 toggle 型模型;只发 enable_thinking,不发 effort)',\r\n 'card.level.minimal': 'minimal — 最低(极轻任务)',\r\n 'card.level.low': 'low — 低(简单任务,廉价轮保持廉价)',\r\n 'card.level.medium': 'medium — 中',\r\n 'card.level.high': 'high — 高(官方默认)',\r\n 'card.level.xhigh': 'xhigh — 特高',\r\n 'card.level.max': 'max — 最大(重任务)',\r\n 'card.level.auto': 'auto — 按工具历史自动调度(默认)',\r\n 'card.enabled': '启用',\r\n 'card.allowDowngrade': '允许降档(auto 可降至 low)',\r\n 'card.allowUpgrade': '允许升档(auto 可升至 max)',\r\n 'card.unavailable': '设置命名空间不可用:请确认 dsh-thinking-levels 已装配进 profile。',\r\n 'card.readonly': '只读',\r\n 'card.capabilities': '模型能力(llm-pi-ai 自定义提供方)',\r\n 'card.capabilities.hint': '直接读写 llm-pi-ai 配置:勾选档位并填写发送给网关的线上值(例如 high → ultra);off 留空表示不发送。视觉决定图片输入;思考开关决定 enable_thinking 置位;thinkingFormat 决定 wire 序列化格式。',\r\n 'card.capabilities.empty': '短路名单(llm-openai-completions)中没有 provider,或名单内 provider 未在 llm-pi-ai 配置模型。请先在「设置 → 模型」添加提供方与模型,并把要编辑的自定义网关加入短路名单。',\r\n 'card.capabilities.unavailable': 'llm-pi-ai 设置命名空间不可用。',\r\n 'card.capabilities.none': '(无模型)',\r\n 'card.capabilities.search': '搜索模型(名称或 ID)…',\r\n 'card.capabilities.noMatches': '没有匹配的模型',\r\n 'card.capabilities.quickSettings': '一键设置',\r\n 'card.capabilities.presetOfficial': '应用到全部:Off / High / Max(官方 DeepSeek 风格)',\r\n 'card.capabilities.presetGeneric': '应用到全部:Off / Low / Medium / High(通用)',\r\n 'card.capabilities.vendor': '提供方',\r\n 'card.capabilities.takeover': '短路接管',\r\n 'card.capabilities.notTakenOver': '未启用短路接管:该 provider 由 pi-ai 原生服务。开启「短路接管」后才能编辑此处的思考/effort 配置。',\r\n 'card.capabilities.expandProvider': '展开提供方',\r\n 'card.capabilities.collapseProvider': '收起提供方',\r\n 'card.capabilities.openModelSettings': '打开模型设置',\r\n 'card.capabilities.closeModelSettings': '收起模型设置',\r\n 'card.capabilities.vision': '视觉模型',\r\n 'card.capabilities.thinking': '思考模型',\r\n 'card.capabilities.supportsEffort': '支持 think effort',\r\n 'card.capabilities.efforts': '思考档位(勾选后填写线上值)',\r\n 'card.capabilities.wirePlaceholder': '线上值,如 ultra',\r\n 'card.capabilities.offPlaceholder': '留空 = 不发送',\r\n 'card.capabilities.atLeastThinking': '至少需要一个思考档位(off 除外)',\r\n 'card.capabilities.applyLevel': '应用此档位',\r\n 'card.capabilities.restoreDefault': '恢复默认档位',\r\n 'card.capabilities.unsaved': '未保存',\r\n 'card.capabilities.saveChanges': '保存更改',\r\n 'card.capabilities.saved': '已保存',\r\n 'card.capabilities.thinkingFormat': '思考格式',\r\n 'card.capabilities.thinkingFormat.inherit': '继承',\r\n 'card.capabilities.failed': '保存失败:配置被拒绝或冲突,请检查值。',\r\n} satisfies Record<string, string>\r\n\r\n/** English dictionary (keys mirror zh). */\r\nexport const en: Record<keyof typeof zh, string> = {\r\n 'card.title': 'Thinking Levels',\r\n 'card.description': 'Pick Auto in the model selector: the plugin schedules low / high / max per tool round before submitting the API effort. Here you configure the default level, scheduler bounds, and per-model capabilities (level → gateway wire value mapping).',\r\n 'card.level': 'Default level',\r\n 'card.level.off': 'off — disable thinking (manual only, never auto-picked)',\r\n 'card.level.on': 'on — enable thinking (toggle-only models only; sends enable_thinking, never an effort)',\r\n 'card.level.minimal': 'minimal — least (very light tasks)',\r\n 'card.level.low': 'low — cheap rounds stay cheap',\r\n 'card.level.medium': 'medium — medium',\r\n 'card.level.high': 'high — the official default',\r\n 'card.level.xhigh': 'xhigh — extra high',\r\n 'card.level.max': 'max — heavy work',\r\n 'card.level.auto': 'auto — schedule from tool history (default)',\r\n 'card.enabled': 'Enabled',\r\n 'card.allowDowngrade': 'Allow downgrade (auto may drop to low)',\r\n 'card.allowUpgrade': 'Allow upgrade (auto may lift to max)',\r\n 'card.unavailable': 'Settings namespace unavailable: make sure dsh-thinking-levels is assembled into this profile.',\r\n 'card.readonly': 'Read-only',\r\n 'card.capabilities': 'Model capabilities (llm-pi-ai custom providers)',\r\n 'card.capabilities.hint': 'Reads and writes the llm-pi-ai config directly: tick a level and enter the exact value sent to the gateway (e.g. high → ultra); leaving off empty means “do not send”. Vision gates image input; the thinking toggle drives enable_thinking; thinkingFormat picks the wire serialization.',\r\n 'card.capabilities.empty': 'No provider is in the takeover list (llm-openai-completions), or the listed providers have no models configured in llm-pi-ai. Add a provider and models under Settings → Models first, and put the custom gateway you want to edit into the takeover list.',\r\n 'card.capabilities.unavailable': 'The llm-pi-ai settings namespace is unavailable.',\r\n 'card.capabilities.none': '(no models)',\r\n 'card.capabilities.search': 'Search models by name or ID…',\r\n 'card.capabilities.noMatches': 'No matching models',\r\n 'card.capabilities.quickSettings': 'Quick settings',\r\n 'card.capabilities.presetOfficial': 'Apply to all: Off / High / Max (official DeepSeek style)',\r\n 'card.capabilities.presetGeneric': 'Apply to all: Off / Low / Medium / High (generic)',\r\n 'card.capabilities.vendor': 'Provider',\r\n 'card.capabilities.takeover': 'Short-circuit takeover',\r\n 'card.capabilities.notTakenOver': 'Takeover is off: this provider is served by pi-ai natively. Enable \"Short-circuit takeover\" to edit its thinking/effort configuration here.',\r\n 'card.capabilities.expandProvider': 'Expand provider',\r\n 'card.capabilities.collapseProvider': 'Collapse provider',\r\n 'card.capabilities.openModelSettings': 'Open model settings',\r\n 'card.capabilities.closeModelSettings': 'Collapse model settings',\r\n 'card.capabilities.vision': 'Vision model',\r\n 'card.capabilities.thinking': 'Thinking model',\r\n 'card.capabilities.supportsEffort': 'Supports think effort',\r\n 'card.capabilities.efforts': 'Thinking effort levels (tick, then enter the wire value)',\r\n 'card.capabilities.wirePlaceholder': 'Wire value, e.g. ultra',\r\n 'card.capabilities.offPlaceholder': 'Empty = do not send',\r\n 'card.capabilities.atLeastThinking': 'Select at least one thinking level (other than off)',\r\n 'card.capabilities.applyLevel': 'Apply levels',\r\n 'card.capabilities.restoreDefault': 'Restore defaults',\r\n 'card.capabilities.unsaved': 'Unsaved',\r\n 'card.capabilities.saveChanges': 'Save changes',\r\n 'card.capabilities.saved': 'Saved',\r\n 'card.capabilities.thinkingFormat': 'Thinking format',\r\n 'card.capabilities.thinkingFormat.inherit': 'Inherit',\r\n 'card.capabilities.failed': 'Save failed: the value was rejected or conflicted. Check it.',\r\n}\r\n\r\n/** Japanese dictionary (keys mirror zh). */\r\nexport const ja: Record<keyof typeof zh, string> = {\r\n 'card.title': '思考レベル',\r\n 'card.description': 'モデルセレクターで Auto(マスク)を選択すると、ツール呼び出し履歴から low / high / max を自動スケジュールして API に送信します。ここでは既定レベル、スケジューラーの境界、モデル能力(レベル → ゲートウェイ送信値のマッピング)を設定します。',\r\n 'card.level': '既定レベル',\r\n 'card.level.off': 'off — 思考を無効化(手動のみ、自動選択はされません)',\r\n 'card.level.on': 'on — 思考を有効化(トグルのみのモデル向け。enable_thinking のみ送信、effort は送信しません)',\r\n 'card.level.minimal': 'minimal — 最小(非常に軽いタスク)',\r\n 'card.level.low': 'low — 低(軽いラウンドは軽いまま)',\r\n 'card.level.medium': 'medium — 中',\r\n 'card.level.high': 'high — 高(公式既定値)',\r\n 'card.level.xhigh': 'xhigh — 特高',\r\n 'card.level.max': 'max — 最大(重いタスク)',\r\n 'card.level.auto': 'auto — ツール履歴から自動スケジュール(既定)',\r\n 'card.enabled': '有効',\r\n 'card.allowDowngrade': '降格を許可(auto は low まで下げられる)',\r\n 'card.allowUpgrade': '昇格を許可(auto は max まで上げられる)',\r\n 'card.unavailable': '設定名前空間が利用できません:dsh-thinking-levels が profile に組み込まれているか確認してください。',\r\n 'card.readonly': '読み取り専用',\r\n 'card.capabilities': 'モデル能力(llm-pi-ai カスタムプロバイダー)',\r\n 'card.capabilities.hint': 'llm-pi-ai 設定を直接読み書きします:レベルにチェックを入れ、ゲートウェイに送信する値を入力(例:high → ultra)。off を空欄にすると送信しません。視覚は画像入力を決定、思考トグルは enable_thinking を制御、thinkingFormat は wire シリアライズ形式を選択します。',\r\n 'card.capabilities.empty': '引き継ぎリスト(llm-openai-completions)にプロバイダーがないか、リスト内プロバイダーに llm-pi-ai のモデル設定がありません。先に「設定 → モデル」でプロバイダーとモデルを追加し、編集したいカスタムゲートウェイを引き継ぎリストに入れてください。',\r\n 'card.capabilities.unavailable': 'llm-pi-ai の設定名前空間が利用できません。',\r\n 'card.capabilities.none': '(モデルなし)',\r\n 'card.capabilities.search': 'モデル名または ID で検索…',\r\n 'card.capabilities.noMatches': '一致するモデルがありません',\r\n 'card.capabilities.quickSettings': 'クイック設定',\r\n 'card.capabilities.presetOfficial': 'すべてに適用:Off / High / Max(公式 DeepSeek 形式)',\r\n 'card.capabilities.presetGeneric': 'すべてに適用:Off / Low / Medium / High(汎用)',\r\n 'card.capabilities.vendor': 'プロバイダー',\r\n 'card.capabilities.takeover': 'ショートサーキット引き継ぎ',\r\n 'card.capabilities.notTakenOver': '引き継ぎが無効です:このプロバイダーは pi-ai がネイティブに提供します。「ショートサーキット引き継ぎ」を有効にしてから、ここで思考/effort 設定を編集してください。',\r\n 'card.capabilities.expandProvider': 'プロバイダーを展開',\r\n 'card.capabilities.collapseProvider': 'プロバイダーを折りたたむ',\r\n 'card.capabilities.openModelSettings': 'モデル設定を開く',\r\n 'card.capabilities.closeModelSettings': 'モデル設定を折りたたむ',\r\n 'card.capabilities.vision': '視覚モデル',\r\n 'card.capabilities.thinking': '思考モデル',\r\n 'card.capabilities.supportsEffort': 'think effort をサポート',\r\n 'card.capabilities.efforts': '思考レベル(チェック後、送信値を入力)',\r\n 'card.capabilities.wirePlaceholder': '送信値(例:ultra)',\r\n 'card.capabilities.offPlaceholder': '空欄 = 送信しない',\r\n 'card.capabilities.atLeastThinking': '思考レベルを 1 つ以上選択してください(off 以外)',\r\n 'card.capabilities.applyLevel': 'レベルを適用',\r\n 'card.capabilities.restoreDefault': '既定値に戻す',\r\n 'card.capabilities.unsaved': '未保存',\r\n 'card.capabilities.saveChanges': '変更を保存',\r\n 'card.capabilities.saved': '保存済み',\r\n 'card.capabilities.thinkingFormat': '思考形式',\r\n 'card.capabilities.thinkingFormat.inherit': '継承',\r\n 'card.capabilities.failed': '保存に失敗しました:値が拒否されたか競合しています。確認してください。',\r\n}\r\n\r\n/** Korean dictionary (keys mirror zh). */\r\nexport const ko: Record<keyof typeof zh, string> = {\r\n 'card.title': '사고 수준',\r\n 'card.description': '모델 선택기에서 Auto(마스크)를 선택하면 도구 호출 기록을 기반으로 low / high / max 를 자동 스케줄링하여 API에 제출합니다. 여기서 기본 수준, 스케줄러 경계, 모델 기능(수준 → 게이트웨이 전송 값 매핑)을 구성합니다.',\r\n 'card.level': '기본 수준',\r\n 'card.level.off': 'off — 사고 비활성화(수동 전용, 자동 선택 안 됨)',\r\n 'card.level.on': 'on — 사고 활성화(토글 전용 모델용. enable_thinking만 전송, effort는 전송하지 않음)',\r\n 'card.level.minimal': 'minimal — 최소(매우 가벼운 작업)',\r\n 'card.level.low': 'low — 낮음(가벼운 라운드는 가볍게 유지)',\r\n 'card.level.medium': 'medium — 중간',\r\n 'card.level.high': 'high — 높음(공식 기본값)',\r\n 'card.level.xhigh': 'xhigh — 특별히 높음',\r\n 'card.level.max': 'max — 최대(무거운 작업)',\r\n 'card.level.auto': 'auto — 도구 기록에서 자동 스케줄링(기본값)',\r\n 'card.enabled': '활성화',\r\n 'card.allowDowngrade': '다운그레이드 허용(auto가 low까지 내릴 수 있음)',\r\n 'card.allowUpgrade': '업그레이드 허용(auto가 max까지 올릴 수 있음)',\r\n 'card.unavailable': '설정 네임스페이스를 사용할 수 없습니다: dsh-thinking-levels가 이 profile에 조립되었는지 확인하세요.',\r\n 'card.readonly': '읽기 전용',\r\n 'card.capabilities': '모델 기능(llm-pi-ai 사용자 지정 제공자)',\r\n 'card.capabilities.hint': 'llm-pi-ai 설정을 직접 읽고 씁니다: 수준을 체크하고 게이트웨이에 보낼 값을 입력(예: high → ultra). off를 비워 두면 전송하지 않습니다. 시각은 이미지 입력을 결정하고, 사고 토글은 enable_thinking을 제어하며, thinkingFormat은 wire 직렬화 형식을 선택합니다.',\r\n 'card.capabilities.empty': '인계 목록(llm-openai-completions)에 제공자가 없거나, 목록 내 제공자에 llm-pi-ai 모델 설정이 없습니다. 먼저 「설정 → 모델」에서 제공자와 모델을 추가하고, 편집할 사용자 지정 게이트웨이를 인계 목록에 넣으세요.',\r\n 'card.capabilities.unavailable': 'llm-pi-ai 설정 네임스페이스를 사용할 수 없습니다.',\r\n 'card.capabilities.none': '(모델 없음)',\r\n 'card.capabilities.search': '모델 이름 또는 ID로 검색…',\r\n 'card.capabilities.noMatches': '일치하는 모델이 없습니다',\r\n 'card.capabilities.quickSettings': '빠른 설정',\r\n 'card.capabilities.presetOfficial': '전체에 적용: Off / High / Max(공식 DeepSeek 방식)',\r\n 'card.capabilities.presetGeneric': '전체에 적용: Off / Low / Medium / High(일반 방식)',\r\n 'card.capabilities.vendor': '제공자',\r\n 'card.capabilities.takeover': '단락 인계',\r\n 'card.capabilities.notTakenOver': '인계가 꺼져 있습니다: 이 제공자는 pi-ai가 기본 제공합니다. 「단락 인계」를 켠 후 여기서 사고/effort 구성을 편집하세요.',\r\n 'card.capabilities.expandProvider': '제공자 펼치기',\r\n 'card.capabilities.collapseProvider': '제공자 접기',\r\n 'card.capabilities.openModelSettings': '모델 설정 열기',\r\n 'card.capabilities.closeModelSettings': '모델 설정 접기',\r\n 'card.capabilities.vision': '시각 모델',\r\n 'card.capabilities.thinking': '사고 모델',\r\n 'card.capabilities.supportsEffort': 'think effort 지원',\r\n 'card.capabilities.efforts': '사고 수준(체크 후 전송 값 입력)',\r\n 'card.capabilities.wirePlaceholder': '전송 값(예: ultra)',\r\n 'card.capabilities.offPlaceholder': '비워 둠 = 전송하지 않음',\r\n 'card.capabilities.atLeastThinking': '사고 수준을 하나 이상 선택하세요(off 제외)',\r\n 'card.capabilities.applyLevel': '수준 적용',\r\n 'card.capabilities.restoreDefault': '기본값 복원',\r\n 'card.capabilities.unsaved': '저장되지 않음',\r\n 'card.capabilities.saveChanges': '변경 사항 저장',\r\n 'card.capabilities.saved': '저장됨',\r\n 'card.capabilities.thinkingFormat': '사고 형식',\r\n 'card.capabilities.thinkingFormat.inherit': '상속',\r\n 'card.capabilities.failed': '저장 실패: 값이 거부되었거나 충돌합니다. 확인하세요.',\r\n}\r\n","/**\r\n * Thinking-levels settings card — the `settings.plugin.item` face of the\r\n * dsh-thinking-levels plugin.\r\n *\r\n * The card binds the `thinking-levels` settings namespace through the\r\n * `settingsScope` cordis service and renders its fields: the level picker\r\n * (off / on / minimal / low / medium / high / xhigh / max / auto) plus the\r\n * scheduler toggles. Every change commits immediately through the scope (no\r\n * staged form): the decision is read per model request, so a committed change\r\n * applies to the next request without a restart.\r\n *\r\n * Below the scheduler rows, a \"model capabilities\" block edits the\r\n * `llm-pi-ai` namespace directly (read + write through the same settings\r\n * transport), borrowing dsh-thinking-effort's presentation: providers group\r\n * their models, each model row shows capability badges and expands into a\r\n * per-level editor where a level is ticked and its gateway wire value entered\r\n * (e.g. `high` → `ultra`); `off` left empty means \"do not send\". A search box\r\n * filters models and one-click presets apply official/generic level sets to\r\n * every thinking model.\r\n *\r\n * Kept dependency-free beyond react: the scopes are subscribed with\r\n * `useSyncExternalStore`, and the controls are plain HTML so the client bundle\r\n * needs no CSS modules and no primitives value import.\r\n */\r\nimport { useState, useSyncExternalStore } from 'react'\r\nimport type { CSSProperties, JSX } from 'react'\r\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\r\nimport type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { EffortId } from '../thinking-level.ts'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\n\r\n/** One injected face: the plugin's own scope plus the llm-pi-ai namespace scope. */\r\nexport interface ThinkingLevelsCardInjected {\r\n scope: SettingsScope<ThinkingLevelsConfig>\r\n /** The `llm-pi-ai` settings namespace, read and written for model capabilities. */\r\n piAiScope: SettingsScope<unknown>\r\n /**\r\n * The `llm-openai-completions` takeover list, read so the model editor\r\n * surfaces only routes the openai-completions adapter actually serves.\r\n */\r\n takeoverScope: SettingsScope<unknown>\r\n}\r\n\r\n/** Full props: locale seat + the injected scopes. */\r\nexport type ThinkingLevelsCardProps = PropsLocale<'thinking-levels'> & ThinkingLevelsCardInjected\r\n\r\n/** The user-facing levels, in picker order: eight standard levels plus the auto scheduler sentinel. */\r\nconst EFFORT_OPTIONS: readonly EffortId[] = [\r\n 'off', 'on', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'auto',\r\n]\r\n\r\n/**\r\n * The levels the capability editor offers. This is the llm-pi-ai\r\n * `reasoningEfforts` table-key space — pi-ai's fixed seven levels (schema\r\n * rejects any other key). `on` (the enable-thinking toggle) is a selector /\r\n * injection-level concept, expressed here by the `off` + `high` pair\r\n * (enable_thinking false/true), so it has no table key of its own.\r\n */\r\nconst CAPABILITY_LEVELS: readonly EffortId[] = [\r\n 'off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max',\r\n] as const\r\n\r\n/** One-click presets, mirroring dsh-thinking-effort: official DeepSeek style and a generic set. */\r\nconst PRESETS: readonly { key: 'official' | 'generic'; levels: Record<string, unknown> }[] = [\r\n { key: 'official', levels: { off: null, high: 'high', max: 'max' } },\r\n { key: 'generic', levels: { off: null, low: 'low', medium: 'medium', high: 'high' } },\r\n]\r\n\r\n/** The wire thinking formats offered (llm-pi-ai's nameable set, incl. qwen-chat-template). */\r\nconst THINKING_FORMATS = [\r\n 'openai', 'deepseek', 'openrouter', 'together', 'zai', 'qwen',\r\n 'qwen-chat-template', 'string-thinking', 'ant-ling',\r\n] as const\r\n\r\n/* ── shared row styling (inline; keeps the client bundle CSS-free) ──────── */\r\n\r\nconst rowStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'space-between',\r\n gap: '12px',\r\n padding: '6px 0',\r\n fontSize: '13px',\r\n lineHeight: '20px',\r\n}\r\n\r\nconst labelStyle: CSSProperties = { margin: 0, color: 'var(--dsw-alias-label-primary)' }\r\n\r\nconst controlStyle: CSSProperties = {\r\n background: 'var(--dsw-alias-bg-surface, #fff)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '4px',\r\n padding: '3px 8px',\r\n fontSize: '13px',\r\n}\r\n\r\nconst sectionStyle: CSSProperties = {\r\n marginTop: '14px',\r\n paddingTop: '12px',\r\n borderTop: '1px solid var(--dsw-alias-border-l2)',\r\n}\r\n\r\nconst fieldStyle: CSSProperties = { display: 'flex', flexDirection: 'column', gap: '4px' }\r\n\r\nconst fieldLabelStyle: CSSProperties = { margin: 0, fontSize: '12px', lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' }\r\n\r\nconst hintStyle: CSSProperties = { margin: '6px 0 0', fontSize: '12px', lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' }\r\n\r\n/** Provider group shell: an outlined row grouping its models. */\r\nconst providerStyle: CSSProperties = {\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '8px',\r\n margin: '8px 0 0',\r\n overflow: 'hidden',\r\n}\r\n\r\nconst providerHeadStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: '8px',\r\n padding: '7px 10px',\r\n background: 'var(--dsw-alias-bg-layer-2, rgba(127,127,127,0.06))',\r\n}\r\n\r\nconst providerNameStyle: CSSProperties = {\r\n margin: 0,\r\n flex: '1 1 auto',\r\n minWidth: 0,\r\n fontFamily: 'var(--ds-font-family-code, monospace)',\r\n fontSize: '12px',\r\n lineHeight: '18px',\r\n fontWeight: 600,\r\n color: 'var(--dsw-alias-label-primary)',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\nconst providerBadgeStyle: CSSProperties = {\r\n margin: 0,\r\n fontSize: '10px',\r\n lineHeight: '16px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '4px',\r\n padding: '0 5px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\nconst iconButtonStyle: CSSProperties = {\r\n background: 'none',\r\n border: 'none',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n cursor: 'pointer',\r\n padding: '2px 4px',\r\n display: 'inline-flex',\r\n alignItems: 'center',\r\n}\r\n\r\n/** One model row inside a provider group. */\r\nconst modelRowStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: '8px',\r\n padding: '7px 10px',\r\n borderTop: '1px solid var(--dsw-alias-border-l2)',\r\n}\r\n\r\nconst modelIdStyle: CSSProperties = {\r\n margin: 0,\r\n flex: '1 1 auto',\r\n minWidth: 0,\r\n fontFamily: 'var(--ds-font-family-code, monospace)',\r\n fontSize: '12px',\r\n lineHeight: '18px',\r\n color: 'var(--dsw-alias-label-secondary)',\r\n overflowWrap: 'anywhere',\r\n}\r\n\r\n/** Capability badge chips (text / image / context). */\r\nconst badgeStyle: CSSProperties = {\r\n fontSize: '10px',\r\n lineHeight: '16px',\r\n color: 'var(--dsw-alias-label-tertiary)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '4px',\r\n padding: '0 5px',\r\n whiteSpace: 'nowrap',\r\n}\r\n\r\n/** The per-level editor grid: one row per level with a toggle, a label and a wire input. */\r\nconst levelRowStyle: CSSProperties = {\r\n display: 'grid',\r\n gridTemplateColumns: 'auto 92px minmax(0, 1fr)',\r\n alignItems: 'center',\r\n gap: '8px',\r\n padding: '4px 0',\r\n fontSize: '13px',\r\n}\r\n\r\nconst levelNameStyle: CSSProperties = { margin: 0, fontSize: '12px', lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)' }\r\n\r\nconst wireInputStyle: CSSProperties = {\r\n background: 'var(--dsw-alias-bg-surface, #fff)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '4px',\r\n padding: '3px 8px',\r\n fontSize: '12px',\r\n width: '100%',\r\n boxSizing: 'border-box',\r\n}\r\n\r\n/* ── helpers over the llm-pi-ai user layer ─────────────────────────────── */\r\n\r\n/** A row's `reasoningEfforts` as stored in the user layer. */\r\nfunction effortsOf(model: Record<string, unknown>): false | Record<string, unknown> | undefined {\r\n const value = model['reasoningEfforts']\r\n if (value === false) return false\r\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\r\n return value as Record<string, unknown>\r\n }\r\n return undefined\r\n}\r\n\r\n/**\r\n * Build a `reasoningEfforts` table from a level→wire draft. `off` maps to\r\n * `null` (omit the reasoning option → enable_thinking false) unless the user\r\n * typed a wire value; every other ticked level keeps its typed wire value.\r\n * pi-ai rejects a table offering nothing beyond `off`, so a selection of only\r\n * `off` falls back to the default `high` level.\r\n */\r\nfunction effortTableOf(draft: Record<string, string | null>): Record<string, unknown> {\r\n const table: Record<string, unknown> = {}\r\n for (const level of CAPABILITY_LEVELS) {\r\n const wire = draft[level]\r\n if (wire === undefined || wire === null) continue\r\n const trimmed = typeof wire === 'string' ? wire.trim() : ''\r\n if (level === 'off') table[level] = trimmed === '' ? null : trimmed\r\n else if (trimmed !== '') table[level] = trimmed\r\n }\r\n if (Object.keys(table).length === 0 || Object.keys(table).every(level => table[level] === null)) {\r\n return { ...table, high: 'high' }\r\n }\r\n return table\r\n}\r\n\r\n/** The `compat.thinkingFormat` a row declares, or `undefined` when it declares none. */\r\nfunction formatOf(model: Record<string, unknown>): string | undefined {\r\n const compat = model['compat']\r\n if (typeof compat !== 'object' || compat === null || Array.isArray(compat)) return undefined\r\n const format = (compat as Record<string, unknown>)['thinkingFormat']\r\n return typeof format === 'string' ? format : undefined\r\n}\r\n\r\n/** Whether a row declares `compat.supportsReasoningEffort` (the wire sends reasoning_effort). */\r\nfunction supportsEffortOf(model: Record<string, unknown>): boolean {\r\n const compat = model['compat']\r\n if (typeof compat !== 'object' || compat === null || Array.isArray(compat)) return false\r\n return (compat as Record<string, unknown>)['supportsReasoningEffort'] === true\r\n}\r\n\r\n/** Patch one row's `compat` object, merging rather than replacing sibling fields. */\r\nfunction patchCompat(\r\n row: Record<string, unknown>,\r\n patch: (compat: Record<string, unknown>) => void,\r\n): void {\r\n const compat = typeof row['compat'] === 'object' && row['compat'] !== null && !Array.isArray(row['compat'])\r\n ? { ...(row['compat'] as Record<string, unknown>) }\r\n : {}\r\n patch(compat)\r\n if (Object.keys(compat).length === 0) delete row['compat']\r\n else row['compat'] = compat\r\n}\r\n\r\n/** The user-layer `providers` value of the llm-pi-ai namespace, when present. */\r\nfunction providersOf(snapshot: unknown): Record<string, unknown> {\r\n if (typeof snapshot !== 'object' || snapshot === null) return {}\r\n const user = (snapshot as { user?: unknown }).user\r\n if (typeof user !== 'object' || user === null || Array.isArray(user)) return {}\r\n const providers = (user as Record<string, unknown>)['providers']\r\n return typeof providers === 'object' && providers !== null && !Array.isArray(providers)\r\n ? providers as Record<string, unknown>\r\n : {}\r\n}\r\n\r\n/** The provider ids the openai-completions adapter is set up to serve. */\r\nfunction takeoverListOf(snapshot: unknown): string[] {\r\n if (typeof snapshot !== 'object' || snapshot === null) return []\r\n const value = (snapshot as { value?: unknown }).value\r\n if (typeof value !== 'object' || value === null) return []\r\n const section = value as { enabled?: unknown; providers?: unknown }\r\n if (section.enabled !== true || !Array.isArray(section.providers)) return []\r\n return section.providers.filter((id): id is string => typeof id === 'string')\r\n}\r\n\r\n/** One flattened capability entry: a provider's model at an array index. */\r\ninterface CapabilityEntry {\r\n providerId: string\r\n index: number\r\n model: Record<string, unknown>\r\n modelId: string\r\n}\r\n\r\n/** Flatten the user-layer providers into capability entries (models arrays only). */\r\nfunction entriesOf(providers: Record<string, unknown>): CapabilityEntry[] {\r\n return Object.entries(providers).flatMap(([providerId, profile]) => {\r\n const models = (profile as Record<string, unknown>)['models']\r\n if (!Array.isArray(models)) return []\r\n return models.map((model, index) => ({\r\n providerId,\r\n index,\r\n model: (typeof model === 'object' && model !== null && !Array.isArray(model)\r\n ? model as Record<string, unknown>\r\n : {}),\r\n modelId: typeof model === 'object' && model !== null && typeof (model as Record<string, unknown>)['id'] === 'string'\r\n ? (model as Record<string, unknown>)['id'] as string\r\n : `#${index + 1}`,\r\n }))\r\n })\r\n}\r\n\r\n/** Human-readable capability summary of one entry (input modalities + declared context window). */\r\nfunction summaryOf(entry: CapabilityEntry): { text: boolean; image: boolean; context: string | null } {\r\n const input = entry.model['input']\r\n const text = !Array.isArray(input) || input.length === 0 || input.includes('text')\r\n const image = Array.isArray(input) && input.includes('image')\r\n const contextWindow = entry.model['contextWindow']\r\n let context: string | null = null\r\n if (typeof contextWindow === 'number' && Number.isFinite(contextWindow) && contextWindow > 0) {\r\n context = contextWindow >= 1024\r\n ? `${Math.round(contextWindow / 1024)}K`\r\n : String(contextWindow)\r\n }\r\n return { text, image, context }\r\n}\r\n\r\n/** A tiny inline chevron icon (no CSS modules). */\r\nfunction ChevronIcon({ open }: { open: boolean }): JSX.Element {\r\n return (\r\n <svg\r\n width=\"12\" height=\"12\" viewBox=\"0 0 16 16\" aria-hidden\r\n style={{ transform: open ? 'rotate(180deg)' : 'none', transition: 'transform 0.16s' }}\r\n >\r\n <path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\r\n </svg>\r\n )\r\n}\r\n\r\n/**\r\n * The llm-pi-ai model-capability editor block (dsh-thinking-effort style:\r\n * provider groups, model rows with badges, per-level wire editors, search and\r\n * one-click presets).\r\n * @param scope - the `llm-pi-ai` namespace scope.\r\n * @param t - copy lookup.\r\n * @param readonly - whether writes are forbidden.\r\n * @returns the capabilities block, or a placeholder when nothing is configured.\r\n */\r\nfunction ModelCapabilities(props: {\r\n scope: SettingsScope<unknown>\r\n takeoverScope: SettingsScope<unknown>\r\n t: (key: string) => string\r\n readonly: boolean\r\n}): JSX.Element {\r\n const { scope, takeoverScope, t, readonly } = props\r\n const snapshot = useSyncExternalStore(\r\n (listener) => scope.subscribe(listener),\r\n () => scope.getSnapshot(),\r\n )\r\n const takeover = useSyncExternalStore(\r\n (listener) => takeoverScope.subscribe(listener),\r\n () => takeoverScope.getSnapshot(),\r\n )\r\n const unavailable = snapshot.status === 'unavailable'\r\n const providers = snapshot.status === 'ready' ? providersOf(snapshot) : {}\r\n // Every llm-pi-ai provider is listed, each with a takeover switch; only\r\n // routes currently in the takeover list get the model editor below. A\r\n // provider that pi-ai serves natively (e.g. mimo via xiaomi) stays visible\r\n // with its takeover switch OFF — flip it to hand the route to the\r\n // openai-completions adapter and unlock its model editor.\r\n const takeoverList = takeover.status === 'ready'\r\n ? takeoverListOf(takeover)\r\n : []\r\n const allEntries = entriesOf(providers)\r\n\r\n // UI-only state: provider/model expansion, the wire drafts, and the query.\r\n const [query, setQuery] = useState('')\r\n const [expandedProviders, setExpandedProviders] = useState<Record<string, boolean>>({})\r\n const [expandedModels, setExpandedModels] = useState<Record<string, boolean>>({})\r\n const [drafts, setDrafts] = useState<Record<string, Record<string, string | null>>>({})\r\n const [busy, setBusy] = useState(false)\r\n\r\n const entryKey = (entry: CapabilityEntry): string => `${entry.providerId}\\u0000${entry.index}`\r\n\r\n /** Commit one patch over the user-layer providers. */\r\n const commitProviders = (mutate: (current: Record<string, unknown>) => Record<string, unknown>): void => {\r\n if (snapshot.status !== 'ready' || readonly) return\r\n setBusy(true)\r\n void scope.set('providers', mutate(structuredClone(providers)))\r\n .then(() => { setBusy(false) })\r\n .catch(() => { setBusy(false) })\r\n }\r\n\r\n /** Toggle whether the openai-completions adapter takes over one provider. */\r\n const toggleTakeover = (providerId: string): void => {\r\n if (takeover.status !== 'ready' || readonly) return\r\n const current = takeoverListOf(takeover)\r\n const next = current.includes(providerId)\r\n ? current.filter(id => id !== providerId)\r\n : [...current, providerId]\r\n setBusy(true)\r\n void takeoverScope.set('providers', next)\r\n .then(() => takeoverScope.set('enabled', next.length > 0))\r\n .then(() => { setBusy(false) })\r\n .catch(() => { setBusy(false) })\r\n }\r\n\r\n /** Patch one model row of one provider. */\r\n const patchModel = (\r\n providerId: string,\r\n index: number,\r\n patch: (model: Record<string, unknown>) => void,\r\n ): void => {\r\n commitProviders((current) => {\r\n const profile = current[providerId] as { models?: unknown[] } | undefined\r\n if (profile === undefined || !Array.isArray(profile.models)) return current\r\n const model = profile.models[index]\r\n if (typeof model !== 'object' || model === null) return current\r\n patch(model as Record<string, unknown>)\r\n return current\r\n })\r\n }\r\n\r\n /** Toggle whether a model is a thinking model (reasoningEfforts table vs false). */\r\n const toggleThinking = (entry: CapabilityEntry, next: boolean): void => {\r\n patchModel(entry.providerId, entry.index, (row) => {\r\n if (next) {\r\n // Thinking on: a table must exist so the wire drives enable_thinking /\r\n // reasoning_effort. Start from the persisted table or the default high\r\n // set; a toggle model (no effort) keeps supportsReasoningEffort false.\r\n const effortCapable = supportsEffortOf(row)\r\n row['reasoningEfforts'] = effortCapable\r\n ? effortTableOf({ high: 'high' })\r\n : { off: null, high: 'high' }\r\n } else {\r\n // Thinking off: a non-reasoning model never takes an effort.\r\n row['reasoningEfforts'] = false\r\n }\r\n })\r\n }\r\n\r\n /** Toggle whether a model accepts reasoning_effort levels. */\r\n const toggleEffortCapable = (entry: CapabilityEntry, next: boolean): void => {\r\n patchModel(entry.providerId, entry.index, (row) => {\r\n patchCompat(row, (compat) => {\r\n compat['supportsReasoningEffort'] = next\r\n })\r\n })\r\n }\r\n\r\n /** Apply one model's wire draft as its `reasoningEfforts` table. */\r\n const applyDraft = (entry: CapabilityEntry): void => {\r\n const key = entryKey(entry)\r\n const draft = drafts[key]\r\n if (draft === undefined) return\r\n const table = effortTableOf(draft)\r\n patchModel(entry.providerId, entry.index, (row) => {\r\n row['reasoningEfforts'] = table\r\n // Mark effort support only when the model already had it or the user\r\n // ticked a reasoning_effort-only level (minimal/low/medium/xhigh/max).\r\n // A toggle-only model (Qwen3.6: off/high = enable_thinking) must keep\r\n // supportsReasoningEffort false — flipping it would make the adapter\r\n // send a reasoning_effort the gateway rejects (400).\r\n const extended = Object.keys(table).some(level => level !== 'off' && level !== 'on' && level !== 'high')\r\n if (supportsEffortOf(row) || extended) {\r\n patchCompat(row, (compat) => {\r\n compat['supportsReasoningEffort'] = true\r\n })\r\n }\r\n })\r\n }\r\n\r\n /** Reset a model's draft to its persisted table (or the default high set). */\r\n const resetDraft = (entry: CapabilityEntry): void => {\r\n const key = entryKey(entry)\r\n setDrafts(current => {\r\n const next = { ...current }\r\n const table = effortsOf(entry.model)\r\n if (typeof table === 'object' && table !== null) {\r\n next[key] = Object.fromEntries(CAPABILITY_LEVELS.map(level => [\r\n level,\r\n table[level] === undefined ? null : (table[level] === null ? '' : String(table[level])),\r\n ]))\r\n } else {\r\n next[key] = { off: '', high: 'high' }\r\n }\r\n return next\r\n })\r\n }\r\n\r\n /** Seed a model's draft when it is first expanded. */\r\n const ensureDraft = (entry: CapabilityEntry): void => {\r\n const key = entryKey(entry)\r\n setDrafts(current => {\r\n if (current[key] !== undefined) return current\r\n const next = { ...current }\r\n const table = effortsOf(entry.model)\r\n if (typeof table === 'object' && table !== null) {\r\n next[key] = Object.fromEntries(CAPABILITY_LEVELS.map(level => [\r\n level,\r\n table[level] === undefined ? null : (table[level] === null ? '' : String(table[level])),\r\n ]))\r\n } else {\r\n next[key] = { off: '', high: 'high' }\r\n }\r\n return next\r\n })\r\n }\r\n\r\n /** Apply a one-click preset to every thinking model. */\r\n const applyPreset = (levels: Record<string, unknown>): void => {\r\n commitProviders((current) => {\r\n for (const entry of entriesOf(current)) {\r\n const profile = current[entry.providerId] as { models?: unknown[] } | undefined\r\n if (profile === undefined || !Array.isArray(profile.models)) continue\r\n const model = profile.models[entry.index]\r\n if (typeof model !== 'object' || model === null) continue\r\n const row = model as Record<string, unknown>\r\n if (effortsOf(row) === undefined) continue // only thinking models\r\n // Replace the table but never touch supportsReasoningEffort: a\r\n // toggle-only model (Qwen3.6) must stay Off/On (enable_thinking), so\r\n // the request guard keeps clamping any injected level to its default\r\n // strength instead of sending a reasoning_effort the gateway rejects.\r\n row['reasoningEfforts'] = levels\r\n }\r\n return current\r\n })\r\n }\r\n\r\n if (unavailable) {\r\n return (\r\n <div style={sectionStyle}>\r\n <p style={hintStyle}>{t('card.capabilities.unavailable')}</p>\r\n </div>\r\n )\r\n }\r\n if (allEntries.length === 0) {\r\n return (\r\n <div style={sectionStyle}>\r\n <p style={fieldLabelStyle}>{t('card.capabilities')}</p>\r\n <p style={hintStyle}>{t('card.capabilities.empty')}</p>\r\n </div>\r\n )\r\n }\r\n\r\n const needle = query.trim().toLowerCase()\r\n const visible = needle === ''\r\n ? allEntries\r\n : allEntries.filter(entry =>\r\n entry.modelId.toLowerCase().includes(needle)\r\n || entry.providerId.toLowerCase().includes(needle))\r\n const providerIds = [...new Set(visible.map(entry => entry.providerId))]\r\n\r\n return (\r\n <div style={sectionStyle}>\r\n <p style={fieldLabelStyle}>{t('card.capabilities')}</p>\r\n <p style={hintStyle}>{t('card.capabilities.hint')}</p>\r\n\r\n {/* Search + one-click presets */}\r\n <div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap', alignItems: 'center', margin: '8px 0 2px' }}>\r\n <input\r\n type=\"text\"\r\n value={query}\r\n placeholder={t('card.capabilities.search')}\r\n disabled={readonly || busy}\r\n style={{ ...controlStyle, flex: '1 1 160px', minWidth: '140px' }}\r\n onChange={(event) => setQuery(event.currentTarget.value)}\r\n />\r\n {PRESETS.map(preset => (\r\n <button\r\n key={preset.key}\r\n type=\"button\"\r\n disabled={readonly || busy}\r\n onClick={() => applyPreset(preset.levels)}\r\n style={{\r\n ...controlStyle,\r\n cursor: readonly || busy ? 'default' : 'pointer',\r\n opacity: readonly || busy ? 0.5 : 1,\r\n }}\r\n >\r\n {t(`card.capabilities.preset${preset.key === 'official' ? 'Official' : 'Generic'}`)}\r\n </button>\r\n ))}\r\n </div>\r\n\r\n {visible.length === 0\r\n ? <p style={hintStyle}>{t('card.capabilities.noMatches')}</p>\r\n : providerIds.map(providerId => {\r\n const providerEntries = visible.filter(entry => entry.providerId === providerId)\r\n const providerOpen = expandedProviders[providerId] === true || needle !== ''\r\n return (\r\n <div key={providerId} style={providerStyle}>\r\n <div style={providerHeadStyle}>\r\n <button\r\n type=\"button\"\r\n aria-expanded={providerOpen}\r\n disabled={readonly || busy}\r\n onClick={() => setExpandedProviders(current => ({\r\n ...current,\r\n [providerId]: current[providerId] !== true,\r\n }))}\r\n style={{\r\n ...iconButtonStyle,\r\n cursor: readonly || busy ? 'default' : 'pointer',\r\n }}\r\n title={providerOpen ? t('card.capabilities.collapseProvider') : t('card.capabilities.expandProvider')}\r\n >\r\n <ChevronIcon open={providerOpen} />\r\n </button>\r\n <p style={providerNameStyle}>{providerId}</p>\r\n <label style={{ display: 'inline-flex', alignItems: 'center', gap: '5px', fontSize: '11px', whiteSpace: 'nowrap', color: 'var(--dsw-alias-label-secondary)' }}>\r\n <input\r\n type=\"checkbox\"\r\n checked={takeoverList.includes(providerId)}\r\n disabled={readonly || busy}\r\n onChange={() => toggleTakeover(providerId)}\r\n />\r\n <span>{t('card.capabilities.takeover')}</span>\r\n </label>\r\n <p style={providerBadgeStyle}>{providerEntries.length}</p>\r\n </div>\r\n {providerOpen\r\n ? (takeoverList.includes(providerId)\r\n ? providerEntries.map(entry => {\r\n const key = entryKey(entry)\r\n const modelOpen = expandedModels[key] === true\r\n const efforts = effortsOf(entry.model)\r\n const thinking = typeof efforts === 'object'\r\n const supportsEffort = supportsEffortOf(entry.model)\r\n const meta = summaryOf(entry)\r\n const format = formatOf(entry.model)\r\n return (\r\n <div key={key}>\r\n <div style={modelRowStyle}>\r\n <button\r\n type=\"button\"\r\n aria-expanded={modelOpen}\r\n disabled={readonly || busy}\r\n onClick={() => {\r\n const next = expandedModels[key] !== true\r\n setExpandedModels(current => ({ ...current, [key]: next }))\r\n if (next) ensureDraft(entry)\r\n }}\r\n style={{\r\n ...iconButtonStyle,\r\n cursor: readonly || busy ? 'default' : 'pointer',\r\n }}\r\n title={modelOpen ? t('card.capabilities.closeModelSettings') : t('card.capabilities.openModelSettings')}\r\n >\r\n <ChevronIcon open={modelOpen} />\r\n </button>\r\n <p style={modelIdStyle}>{entry.modelId}</p>\r\n <span style={badgeStyle} title=\"text\">{meta.text ? 'T' : '–'}</span>\r\n <span style={badgeStyle} title=\"image\">{meta.image ? 'IMG' : '–'}</span>\r\n {meta.context !== null && <span style={badgeStyle}>{meta.context}</span>}\r\n {thinking && !supportsEffort && <span style={badgeStyle}>On/Off</span>}\r\n </div>\r\n {modelOpen\r\n ? (\r\n <div style={{ padding: '4px 10px 10px', borderTop: '1px solid var(--dsw-alias-border-l2)' }}>\r\n {/* Capability switches first: is it a thinking model?\r\n Does it take effort levels? Only after both are\r\n confirmed does the effort editor appear. */}\r\n <div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', margin: '2px 0 8px' }}>\r\n <label style={{ display: 'inline-flex', alignItems: 'center', gap: '6px', fontSize: '12px' }}>\r\n <input\r\n type=\"checkbox\"\r\n checked={thinking}\r\n disabled={readonly || busy}\r\n onChange={(event) => toggleThinking(entry, event.currentTarget.checked)}\r\n />\r\n <span>{t('card.capabilities.thinking')}</span>\r\n </label>\r\n {thinking\r\n ? (\r\n <label style={{ display: 'inline-flex', alignItems: 'center', gap: '6px', fontSize: '12px' }}>\r\n <input\r\n type=\"checkbox\"\r\n checked={supportsEffort}\r\n disabled={readonly || busy}\r\n onChange={(event) => toggleEffortCapable(entry, event.currentTarget.checked)}\r\n />\r\n <span>{t('card.capabilities.supportsEffort')}</span>\r\n </label>\r\n )\r\n : null}\r\n </div>\r\n {thinking && supportsEffort\r\n ? (\r\n <>\r\n {/* Per-level wire editor — only for effort-capable thinking models */}\r\n <p style={fieldLabelStyle}>{t('card.capabilities.efforts')}</p>\r\n <div style={{ margin: '4px 0 6px' }}>\r\n {CAPABILITY_LEVELS.map(level => {\r\n const wire = drafts[key]?.[level]\r\n const on = wire !== undefined && wire !== null\r\n return (\r\n <div key={level} style={levelRowStyle}>\r\n <label style={{ display: 'inline-flex', alignItems: 'center', gap: '6px', fontSize: '12px' }}>\r\n <input\r\n type=\"checkbox\"\r\n checked={on}\r\n disabled={readonly || busy}\r\n onChange={(event) => {\r\n const checked = event.currentTarget.checked\r\n setDrafts(current => {\r\n const draft = { ...(current[key] ?? {}) }\r\n draft[level] = checked\r\n ? (level === 'off' ? '' : level)\r\n : null\r\n return { ...current, [key]: draft }\r\n })\r\n }}\r\n />\r\n <span>{level}</span>\r\n </label>\r\n <span style={levelNameStyle}>{level === 'off' ? t('card.capabilities.offPlaceholder') : '→'}</span>\r\n <input\r\n type=\"text\"\r\n value={wire ?? ''}\r\n disabled={readonly || busy || !on}\r\n placeholder={t('card.capabilities.wirePlaceholder')}\r\n style={wireInputStyle}\r\n onChange={(event) => {\r\n setDrafts(current => {\r\n const draft = { ...(current[key] ?? {}) }\r\n draft[level] = event.currentTarget.value\r\n return { ...current, [key]: draft }\r\n })\r\n }}\r\n />\r\n </div>\r\n )\r\n })}\r\n </div>\r\n <div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>\r\n <button\r\n type=\"button\"\r\n disabled={readonly || busy}\r\n onClick={() => applyDraft(entry)}\r\n style={{\r\n ...controlStyle,\r\n cursor: readonly || busy ? 'default' : 'pointer',\r\n opacity: readonly || busy ? 0.5 : 1,\r\n }}\r\n >\r\n {t('card.capabilities.applyLevel')}\r\n </button>\r\n <button\r\n type=\"button\"\r\n disabled={readonly || busy}\r\n onClick={() => resetDraft(entry)}\r\n style={{\r\n ...controlStyle,\r\n cursor: readonly || busy ? 'default' : 'pointer',\r\n opacity: readonly || busy ? 0.5 : 1,\r\n }}\r\n >\r\n {t('card.capabilities.restoreDefault')}\r\n </button>\r\n </div>\r\n </>\r\n )\r\n : null}\r\n {/* Vision toggle + thinking format */}\r\n <div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', marginTop: '10px' }}>\r\n <label style={{ display: 'inline-flex', alignItems: 'center', gap: '6px', fontSize: '12px' }}>\r\n <input\r\n type=\"checkbox\"\r\n checked={meta.image}\r\n disabled={readonly || busy}\r\n onChange={(event) => {\r\n patchModel(entry.providerId, entry.index, (row) => {\r\n // Image input implies text input; the pair is written together.\r\n row['input'] = event.currentTarget.checked ? ['text', 'image'] : ['text']\r\n })\r\n }}\r\n />\r\n <span>{t('card.capabilities.vision')}</span>\r\n </label>\r\n <label style={fieldStyle}>\r\n <span style={fieldLabelStyle}>{t('card.capabilities.thinkingFormat')}</span>\r\n <select\r\n style={controlStyle}\r\n value={format ?? 'inherit'}\r\n disabled={readonly || busy}\r\n onChange={(event) => {\r\n const next = event.currentTarget.value\r\n patchModel(entry.providerId, entry.index, (row) => {\r\n patchCompat(row, (compat) => {\r\n if (next === 'inherit') delete compat['thinkingFormat']\r\n else compat['thinkingFormat'] = next\r\n })\r\n })\r\n }}\r\n >\r\n <option value=\"inherit\">{t('card.capabilities.thinkingFormat.inherit')}</option>\r\n {THINKING_FORMATS.map(formatOption => (\r\n <option key={formatOption} value={formatOption}>{formatOption}</option>\r\n ))}\r\n </select>\r\n </label>\r\n </div>\r\n </div>\r\n )\r\n : null}\r\n </div>\r\n )\r\n })\r\n : (\r\n <p style={{ ...hintStyle, padding: '8px 10px' }}>\r\n {t('card.capabilities.notTakenOver')}\r\n </p>\r\n ))\r\n : null}\r\n </div>\r\n )\r\n })}\r\n {readonly ? <p style={hintStyle}>{t('card.readonly')}</p> : null}\r\n </div>\r\n )\r\n}\r\n\r\n/**\r\n * The card body, wrapped in a disclosure shell like every peer settings card:\r\n * a header (name + description + chevron) that toggles the body, collapsed by\r\n * default so the plugin tab stays a tidy list of drawers.\r\n * @param props - locale copy and the injected scopes.\r\n */\r\nexport function ThinkingLevelsCard({ t, scope, piAiScope, takeoverScope }: ThinkingLevelsCardProps): JSX.Element {\r\n const [open, setOpen] = useState(false)\r\n const snapshot = useSyncExternalStore(\r\n (listener) => scope.subscribe(listener),\r\n () => scope.getSnapshot(),\r\n )\r\n const unavailable = snapshot.status === 'unavailable'\r\n const readonly = unavailable || !snapshot.writable\r\n const value = (snapshot.value ?? {}) as Partial<ThinkingLevelsConfig>\r\n const level = EFFORT_OPTIONS.includes(value.level as EffortId) ? value.level as EffortId : 'auto'\r\n\r\n return (\r\n <div style={{\r\n border: '1px solid var(--dsw-alias-border-l2, rgba(127,127,127,0.35))',\r\n background: 'var(--dsw-alias-bg-layer-3, rgba(127,127,127,0.05))',\r\n borderRadius: '12px',\r\n transition: 'border-color 0.16s, background 0.16s',\r\n }}>\r\n <button\r\n type=\"button\"\r\n aria-expanded={open}\r\n style={{\r\n appearance: 'none',\r\n width: '100%',\r\n font: 'inherit',\r\n color: 'inherit',\r\n textAlign: 'left',\r\n cursor: 'pointer',\r\n background: 'none',\r\n border: 0,\r\n borderRadius: '12px',\r\n display: 'flex',\r\n alignItems: 'center',\r\n gap: '12px',\r\n padding: '14px 16px',\r\n }}\r\n onClick={() => { setOpen(current => !current) }}\r\n >\r\n <span style={{ flex: '1 1 0%', minWidth: 0 }}>\r\n <div style={{ fontSize: '14px', fontWeight: 600, color: 'var(--dsw-alias-label-primary)' }}>{t('card.title')}</div>\r\n <div style={{ color: 'var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))', fontSize: '13px', lineHeight: 1.5 }}>{t('card.description')}</div>\r\n </span>\r\n <svg\r\n width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden\r\n style={{\r\n color: 'var(--dsw-alias-label-tertiary, rgba(127,127,127,0.8))',\r\n flex: '0 0 auto',\r\n transition: 'transform 0.16s',\r\n transform: open ? 'rotate(180deg)' : 'none',\r\n }}\r\n >\r\n <path d=\"M4 6l4 4 4-4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\r\n </svg>\r\n </button>\r\n {open\r\n ? (\r\n <div style={{ padding: '12px 16px' }}>\r\n {unavailable\r\n ? (\r\n <div style={{ fontSize: '13px', color: 'var(--dsw-alias-label-tertiary)' }}>\r\n {t('card.unavailable')}\r\n </div>\r\n )\r\n : (\r\n <>\r\n <div style={rowStyle}>\r\n <label htmlFor=\"plugin-config-thinking-levels-level\" style={labelStyle}>{t('card.level')}</label>\r\n <select\r\n id=\"plugin-config-thinking-levels-level\"\r\n value={level}\r\n disabled={readonly}\r\n style={controlStyle}\r\n onChange={(event) => { void scope.set('level', event.currentTarget.value as EffortId) }}\r\n >\r\n {EFFORT_OPTIONS.map((option) => (\r\n <option key={option} value={option}>{t(`card.level.${option}`)}</option>\r\n ))}\r\n </select>\r\n </div>\r\n <div style={rowStyle}>\r\n <label htmlFor=\"plugin-config-thinking-levels-enabled\" style={labelStyle}>{t('card.enabled')}</label>\r\n <input\r\n id=\"plugin-config-thinking-levels-enabled\"\r\n type=\"checkbox\"\r\n checked={value.enabled ?? true}\r\n disabled={readonly}\r\n onChange={(event) => { void scope.set('enabled', event.currentTarget.checked) }}\r\n />\r\n </div>\r\n <div style={rowStyle}>\r\n <label htmlFor=\"plugin-config-thinking-levels-downgrade\" style={labelStyle}>{t('card.allowDowngrade')}</label>\r\n <input\r\n id=\"plugin-config-thinking-levels-downgrade\"\r\n type=\"checkbox\"\r\n checked={value.allowDowngrade ?? true}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(event) => { void scope.set('allowDowngrade', event.currentTarget.checked) }}\r\n />\r\n </div>\r\n <div style={rowStyle}>\r\n <label htmlFor=\"plugin-config-thinking-levels-upgrade\" style={labelStyle}>{t('card.allowUpgrade')}</label>\r\n <input\r\n id=\"plugin-config-thinking-levels-upgrade\"\r\n type=\"checkbox\"\r\n checked={value.allowUpgrade ?? false}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(event) => { void scope.set('allowUpgrade', event.currentTarget.checked) }}\r\n />\r\n </div>\r\n {!snapshot.writable\r\n && <p style={{ margin: '8px 0 0', fontSize: '12px', color: 'var(--dsw-alias-label-tertiary)' }}>{t('card.readonly')}</p>}\r\n <ModelCapabilities scope={piAiScope} takeoverScope={takeoverScope} t={t} readonly={readonly} />\r\n </>\r\n )}\r\n </div>\r\n )\r\n : null}\r\n </div>\r\n )\r\n}\r\n","/**\r\n * dsh-thinking-levels — browser half.\r\n *\r\n * Registers the `thinking-levels` dictionaries and one `settings.plugin.item`\r\n * card keyed by the plugin's settings namespace, so the shared Plugins\r\n * settings tab renders an editable card: the level picker (off / low / high /\r\n * max / auto) plus the scheduler toggles.\r\n *\r\n * All @deepseek-ai/* imports are type-only: collaboration happens through\r\n * cordis services (`settingsScope`) and slot registration only (client bundle\r\n * purity).\r\n */\r\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\r\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\r\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\nimport { NS, en, ja, ko, zh } from './locales.ts'\r\nimport { ThinkingLevelsCard, type ThinkingLevelsCardInjected } from './card.tsx'\r\n\r\n/** The settings namespace the host half registers (kept in lockstep with src/index.ts). */\r\nconst THINKING_LEVELS_NS = 'thinking-levels'\r\n\r\n/** Services required by the browser half. */\r\nexport const inject = ['slots', 'locale', 'settingsScope']\r\n\r\n/**\r\n * Client plugin body: dictionaries plus the settings card registration.\r\n * @param ctx - client root context.\r\n */\r\nexport function apply(ctx: ClientContext): void {\r\n ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, ko }), 'dsh-thinking-levels: dictionaries')\r\n\r\n ctx.slots.inject('settings.plugin.item', function* () {\r\n yield ctx.slots.register({\r\n name: 'settings.plugin.item',\r\n // Both keys are supplied: CLI dsh declares this slot `keyed` (needs\r\n // `key`) while DSH Desktop's bundled version declares it `list` (needs\r\n // `id`) — the slots service validates only its kind's field, so the\r\n // pair keeps the card working in both environments.\r\n id: THINKING_LEVELS_NS,\r\n key: THINKING_LEVELS_NS,\r\n locale: NS,\r\n inject: (): ThinkingLevelsCardInjected => {\r\n const scope = ctx.settingsScope.bind<ThinkingLevelsConfig>({ namespace: THINKING_LEVELS_NS })\r\n // The llm-pi-ai namespace is bound read/write so the card can surface\r\n // and edit custom-provider model capabilities (vision / thinking /\r\n // effort levels / thinking format) without touching any official\r\n // package — llm-pi-ai's own schema validates every write.\r\n const piAiScope = ctx.settingsScope.bind<unknown>({ namespace: 'llm-pi-ai' })\r\n // The llm-openai-completions takeover list, read so the model editor\r\n // shows only routes the openai-completions adapter actually serves.\r\n const takeoverScope = ctx.settingsScope.bind<unknown>({ namespace: 'llm-openai-completions' })\r\n return { scope, piAiScope, takeoverScope }\r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,SAAD;QACE,IAAG;QACH,MAAK;QACL,SAAS,MAAM,gBAAgB;QAC/B,UAAU,YAAY,MAAM,UAAU;QACtC,WAAW,UAAU;SAAE,MAAW,IAAI,gBAAgB,MAAM,cAAc,OAAO;QAAE;OACpF,CAAA,CACE;;MACJ,CAAC,SAAS,YACN,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;OAAG,OAAO;QAAE,QAAQ;QAAW,UAAU;QAAQ,OAAO;OAAkC;OAAI,UAAA,EAAE,eAAe;MAAK,CAAA;MACzH,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;OAAmB,OAAO;OAA0B;OAAkB;OAAa;MAAW,CAAA;KAC9F,EAAA,CAAA;IAEH,CAAA,IAEL,IACD;;EAET;;;;ECz6BA,MAAM,qBAAqB;;EAG3B,MAAa,SAAS;GAAC;GAAS;GAAU;EAAe;;;;;EAMzD,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa,IAAI,OAAO,SAAS,IAAI;IAAE;IAAI;IAAI;IAAI;GAAG,CAAC,GAAG,mCAAmC;GAEjG,IAAI,MAAM,OAAO,wBAAwB,aAAa;IACpD,MAAM,IAAI,MAAM,SAAS;KACvB,MAAM;KAKN,IAAI;KACJ,KAAK;KACL,QAAQ;KACR,cAA0C;MAUxC,OAAO;OAAE,OATK,IAAI,cAAc,KAA2B,EAAE,WAAW,mBAAmB,CAS9E;OAAG,WAJE,IAAI,cAAc,KAAc,EAAE,WAAW,YAAY,CAInD;OAAG,eADL,IAAI,cAAc,KAAc,EAAE,WAAW,yBAAyB,CACrD;MAAE;KAC3C;IACF,GAAG,kBAAkB;GACvB,CAAC;EACH"}
package/lib/index.d.ts CHANGED
@@ -1,7 +1,23 @@
1
1
  /**
2
2
  * dsh-thinking-levels host plugin: injects a user-selected or auto-scheduled
3
- * `reasoning_effort` into every `agent/request` waterfall (levels: off / low /
4
- * high / max / auto), and records per-tool wall-clock durations for telemetry.
3
+ * `reasoning_effort` into every `agent/request` waterfall (levels: off / on /
4
+ * minimal / low / medium / high / xhigh / max / auto), and records per-tool
5
+ * wall-clock durations for telemetry.
6
+ *
7
+ * Model-aware since v0.5.0:
8
+ * - A model that does not advertise reasoning metadata (custom
9
+ * openai-completions routes such as Qwen3.6 without `reasoningEfforts`)
10
+ * NEVER receives a `reasoningEffort` — dsh rejects unsupported efforts per
11
+ * request (UNSUPPORTED_REASONING_EFFORT). Unsupported fields are stripped.
12
+ * - Manual selections pass through unchanged, including `low` on dsh rc.7+
13
+ * where the level is native. `on` (the enable-thinking toggle) is never a
14
+ * wire level: on a toggle-only model it injects the advertised `high`
15
+ * (serialized as enable_thinking, no reasoning_effort); elsewhere it is
16
+ * stripped.
17
+ * - The auto scheduler never picks `low` (no surprise low injection).
18
+ * - On rc.6-era adapters (efforts without `low`) a configurer-confirmed model
19
+ * override may advertise `low` so the selector shows it and the passthrough
20
+ * is admitted by request validation.
5
21
  *
6
22
  * Extension points used (verified in deepseek-ai/deepseek-harness):
7
23
  * - `agent/request` waterfall (packages/core/agent-loop/src/agent.ts
@@ -14,15 +30,31 @@
14
30
  import type { Context } from '@deepseek-ai/cordis';
15
31
  import z from '@deepseek-ai/schemastery';
16
32
  import { type EffortId } from './thinking-level.ts';
33
+ /** One configurer-confirmed capability override for a `provider/model` key. */
34
+ export interface ModelCapabilityOverride {
35
+ /** Manual override of the vision-model classification (auto: inputModalities). */
36
+ vision?: boolean;
37
+ /** Manual override of the thinking-model classification. */
38
+ thinking?: boolean;
39
+ /**
40
+ * Manual confirmation of the supported effort levels. `false` marks a
41
+ * non-reasoning model; a list names the levels the API accepts (rc.6-era
42
+ * adapters may then advertise missing ones, e.g. `low`). Absent keeps the
43
+ * adapter-advertised list.
44
+ */
45
+ efforts?: false | Exclude<EffortId, 'auto'>[];
46
+ }
17
47
  /** Plugin settings. */
18
48
  export interface ThinkingLevelsConfig {
19
49
  enabled: boolean;
20
- /** User-selected level: off / low / high / max fix the wire level; `auto` schedules per step. */
50
+ /** User-selected level: off / on / minimal / low / medium / high / xhigh / max fix the wire level; `auto` schedules per step. */
21
51
  level: EffortId;
22
52
  /** Scheduler preference: allow dropping below the `high` hub. */
23
53
  allowDowngrade: boolean;
24
54
  /** Scheduler preference: allow lifting above the `high` hub to `max`. */
25
55
  allowUpgrade: boolean;
56
+ /** Configurer-confirmed capability overrides, keyed `provider/model`. */
57
+ models: Record<string, ModelCapabilityOverride>;
26
58
  }
27
59
  /**
28
60
  * Composition-entry schema: what a dsh profile may configure at assembly