dsh-plugin-subscriptions 0.5.3 → 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/README.md +45 -6
- package/README.zh.md +43 -4
- package/lib/auth/rpc.d.ts +36 -2
- package/lib/auth/rpc.js +47 -5
- package/lib/client/ImageGenerateToolview.d.ts +1 -1
- package/lib/client/SpeedSelect.d.ts +25 -2
- package/lib/client/SpeedSelect.js +10 -6
- package/lib/client/SubscriptionsSection.d.ts +74 -0
- package/lib/client/SubscriptionsSection.js +325 -4
- package/lib/client/VideoGenerateToolview.d.ts +1 -1
- package/lib/client/index.d.ts +1 -9
- package/lib/client/index.js +7 -4
- package/lib/client/locales.d.ts +28 -0
- package/lib/client/locales.js +28 -0
- package/lib/client.js +458 -10
- package/lib/client.js.map +1 -1
- package/lib/compat.d.ts +36 -0
- package/lib/compat.js +20 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.js +865 -111
- package/lib/model-defaults.d.ts +23 -0
- package/lib/model-defaults.js +237 -0
- package/lib/providers/claude.d.ts +24 -3
- package/lib/providers/claude.js +35 -24
- package/lib/providers/codex.d.ts +21 -0
- package/lib/providers/codex.js +37 -10
- package/lib/providers/common.d.ts +70 -6
- package/lib/providers/common.js +118 -19
- package/lib/providers/copilot.d.ts +10 -0
- package/lib/providers/copilot.js +21 -8
- package/lib/providers/grok.d.ts +21 -0
- package/lib/providers/grok.js +37 -7
- package/lib/providers/pool-usage.d.ts +23 -2
- package/lib/providers/pool-usage.js +70 -15
- package/lib/providers/rate-limit.d.ts +192 -0
- package/lib/providers/rate-limit.js +338 -0
- package/lib/translate/anthropic.js +5 -4
- package/lib/translate/chat-completions.js +5 -4
- package/lib/translate/responses.js +5 -4
- package/package.json +21 -21
- package/lib/providers/antigravity.d.ts +0 -90
- package/lib/providers/antigravity.js +0 -392
- package/lib/translate/antigravity.d.ts +0 -110
- package/lib/translate/antigravity.js +0 -303
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["SUBSCRIPTIONS_AUTH_CHANNEL","POLL_INTERVAL_MS","PROVIDERS: readonly { id: SubscriptionProvider; name: string }[]","result: RpcResult<unknown>","fallbackTranslate","text: string","styles: Record<string, CSSProperties>","window","response: StatusResponse","styles","styles: Record<string, CSSProperties>","styles","SUBSCRIPTIONS_AUTH_CHANNEL","PROMPT_MAX_LENGTH","callSubscriptionsAuth","result: RpcResult<unknown>","fallbackTranslate","text: string","derivePrompt","parsed: unknown","prompt: string | undefined","resultText","parts: string[]","images: { attachment: ImageAttachmentRef }[]","styles: Record<string, CSSProperties>","labels: MessageImageLabels","styles","IconSparkle16","result: RpcResult<unknown>","fallbackTranslate","text: string","parsed: unknown","prompt: string | undefined","parts: string[]","styles: Record<string, CSSProperties>","objectUrl: string | undefined","styles","IconSparkle16","TIERS: readonly SpeedTier[]","styles: Record<string, CSSProperties>"],"sources":["../src/client/locales.ts","../src/client/SubscriptionsSection.tsx","../src/client/ImageGallery.tsx","../src/client/ImageGenerateToolview.tsx","../src/client/VideoGenerateToolview.tsx","../src/client/SpeedSelect.tsx","../src/client/index.ts"],"sourcesContent":["/** Copy dictionaries for the Subscriptions settings section. */\n\n/** English strings (the key-set source of truth for this pair). */\nexport const en = {\n nav: 'Subscriptions',\n intro: 'Log a subscription provider in or out. Login opens the provider’s authorization page in a new tab; headless setups can paste the callback URL or code instead.',\n unavailable: 'Connection unavailable; subscription status cannot be loaded.',\n checking: 'Checking…',\n loginInProgress: 'Login in progress…',\n notLoggedIn: 'Not logged in',\n loggedInCount: '{count} account(s) connected',\n accountExpires: 'expires {date}',\n defaultBadge: 'Default',\n setDefault: 'Set as default',\n addAccount: 'Add account',\n addAccountOAuth: 'Browser authorization',\n addAccountKeychain: 'Import Claude Code',\n addAccountHint: 'Browser authorization signs in whichever account the browser currently uses — switch accounts there first (or use an incognito window with the manual code below) to add a different one.',\n login: 'Log in',\n cancel: 'Cancel',\n logout: 'Log out',\n logoutAccountConfirm: 'Log out {account} of {provider}?',\n manualSummary: 'Browser flow not working? Paste the callback URL or code',\n manualPlaceholder: 'Paste the callback URL or code',\n submit: 'Submit',\n loginMissingUrl: 'login answered without an authorizeUrl',\n deviceCodePrompt: 'Enter this code on the GitHub verification page:',\n deviceCodeCopy: 'Copy code',\n deviceCodeCopied: 'Copied',\n deviceCodeOpenPage: 'Open GitHub verification page',\n usageTitle: 'Usage',\n usageRefresh: 'Refresh',\n usageLoading: 'Loading usage…',\n usageEmpty: 'No usage windows reported.',\n usageError: 'Usage lookup failed: {message}',\n usageSession: '5-hour window',\n usageWeekly: 'Weekly',\n usageWindow: 'Window',\n usageResets: 'resets {date}',\n usagePlan: 'Plan: {plan}',\n generating: 'Generating image…',\n image: 'image',\n viewImage: 'View image',\n viewImageNamed: 'View {name}',\n imageLoading: 'Loading…',\n imageLoadFailed: 'Retry',\n imagePreview: 'Image preview',\n imageClose: 'Close',\n generatingVideo: 'Generating video…',\n videoLoading: 'Loading video…',\n videoLoadFailed: 'Video failed to load: {message}',\n speed: 'Speed',\n speedStandard: 'Standard',\n speedStandardDescription: 'Default speed',\n speedFast: 'Fast',\n speedFastDescription: '1.5x speed, more usage',\n commandFast: 'Switch the Codex speed tier (Standard/Fast)',\n commandFastUnavailable: 'The current model has no fast tier; /fast only works on Codex models whose catalog advertises one',\n proxyTitle: 'Proxy',\n proxyStatusNone: 'Not configured — subscription requests go direct.',\n proxyStatusEnabled: 'Enabled · {url}',\n proxyStatusError: 'Config error: {message}',\n proxyConfigure: 'Configure…',\n proxyDialogTitle: 'Proxy settings',\n proxyDialogClose: 'Close',\n proxyEnabled: 'Route subscription requests through a proxy',\n proxyUrl: 'Proxy URL',\n proxyUrlPlaceholder: 'http://localhost:7890',\n proxyUrlHint: 'HTTP or HTTPS proxy only (Clash/mihomo, v2rayN…); socks is not supported.',\n proxyUsername: 'Username (optional)',\n proxyUsernamePlaceholder: 'Proxy username',\n proxyPassword: 'Password',\n proxyPasswordPlaceholder: 'Leave blank to keep the saved password',\n proxyClearPassword: 'Clear the saved password',\n proxyBypass: 'Bypass hosts',\n proxyBypassPlaceholder: '127.0.0.1, localhost, *.example.com',\n proxyBypassHint: 'Comma-separated hostnames that keep going direct.',\n proxyTest: 'Test',\n proxyTesting: 'Testing…',\n proxyTestOk: 'OK · HTTP {status} · {ms} ms',\n proxyTestOkDirect: 'OK (direct, bypassed) · HTTP {status} · {ms} ms',\n proxyTestFail: 'Failed: {message}',\n proxySave: 'Save',\n proxyCancel: 'Cancel',\n proxySaving: 'Saving…',\n proxyLoading: 'Loading proxy settings…',\n proxyLoadFailed: 'Failed to load proxy settings: {message}',\n proxySaved: 'Saved — new requests use the proxy.',\n proxySaveFailed: 'Save failed: {message}',\n proxyNote: 'Applies to token exchange, model APIs, usage lookups, image/video generation and x_search. The OAuth authorization page opens in your browser and follows the browser/system proxy, not this setting.',\n} satisfies Record<string, string>\n\n/** zh strings, one per {@link en} key. */\nexport const zh = {\n nav: '订阅',\n intro: '在此登录或退出订阅服务商。点击登录会在新标签页打开服务商的授权页面;无浏览器环境可改为粘贴回调 URL 或授权码。',\n unavailable: '连接不可用,无法加载订阅状态。',\n checking: '查询中…',\n loginInProgress: '登录中…',\n notLoggedIn: '未登录',\n loggedInCount: '已连接 {count} 个账号',\n accountExpires: '过期时间 {date}',\n defaultBadge: '默认',\n setDefault: '设为默认',\n addAccount: '添加账号',\n addAccountOAuth: '浏览器授权',\n addAccountKeychain: '导入 Claude Code',\n addAccountHint: '浏览器授权以浏览器当前登录的账号为准;要添加不同账号,请先在浏览器里切换账号,或用无痕窗口走下方手动授权码。',\n login: '登录',\n cancel: '取消',\n logout: '退出登录',\n logoutAccountConfirm: '确定退出 {provider} 的账号 {account} 吗?',\n manualSummary: '浏览器流程无法完成?粘贴回调 URL 或授权码',\n manualPlaceholder: '粘贴回调 URL 或授权码',\n submit: '提交',\n loginMissingUrl: 'login 响应缺少 authorizeUrl',\n deviceCodePrompt: '在 GitHub 验证页面输入此验证码:',\n deviceCodeCopy: '复制验证码',\n deviceCodeCopied: '已复制',\n deviceCodeOpenPage: '打开 GitHub 验证页面',\n usageTitle: '用量',\n usageRefresh: '刷新',\n usageLoading: '用量加载中…',\n usageEmpty: '服务商未返回任何用量窗口。',\n usageError: '用量查询失败:{message}',\n usageSession: '5 小时窗口',\n usageWeekly: '每周',\n usageWindow: '窗口',\n usageResets: '{date} 重置',\n usagePlan: '计划:{plan}',\n generating: '正在生成图片…',\n image: '图片',\n viewImage: '查看图片',\n viewImageNamed: '查看 {name}',\n imageLoading: '加载中…',\n imageLoadFailed: '重试',\n imagePreview: '图片预览',\n imageClose: '关闭',\n generatingVideo: '正在生成视频…',\n videoLoading: '视频加载中…',\n videoLoadFailed: '视频加载失败:{message}',\n speed: '速度',\n speedStandard: '标准',\n speedStandardDescription: '默认速度',\n speedFast: '快速',\n speedFastDescription: '约 1.5 倍速度,消耗更多用量',\n commandFast: '切换 Codex 速度档(标准/快速)',\n commandFastUnavailable: '当前模型不支持快速档;/fast 仅对目录声明了 fast tier 的 Codex 模型可用',\n proxyTitle: '代理',\n proxyStatusNone: '未配置 —— 订阅请求直连。',\n proxyStatusEnabled: '已启用 · {url}',\n proxyStatusError: '配置错误:{message}',\n proxyConfigure: '配置…',\n proxyDialogTitle: '代理设置',\n proxyDialogClose: '关闭',\n proxyEnabled: '让订阅相关请求走代理',\n proxyUrl: '代理地址',\n proxyUrlPlaceholder: 'http://localhost:7890',\n proxyUrlHint: '仅支持 HTTP/HTTPS 代理(Clash/mihomo、v2rayN 等);不支持 socks。',\n proxyUsername: '用户名(可选)',\n proxyUsernamePlaceholder: '代理用户名',\n proxyPassword: '密码',\n proxyPasswordPlaceholder: '留空则保留已保存的密码',\n proxyClearPassword: '清除已保存的密码',\n proxyBypass: '绕过主机',\n proxyBypassPlaceholder: '127.0.0.1, localhost, *.example.com',\n proxyBypassHint: '逗号分隔的主机名,这些主机保持直连。',\n proxyTest: '测试',\n proxyTesting: '测试中…',\n proxyTestOk: '成功 · HTTP {status} · {ms} ms',\n proxyTestOkDirect: '成功(直连,已绕过)· HTTP {status} · {ms} ms',\n proxyTestFail: '失败:{message}',\n proxySave: '保存',\n proxyCancel: '取消',\n proxySaving: '保存中…',\n proxyLoading: '代理设置加载中…',\n proxyLoadFailed: '代理设置加载失败:{message}',\n proxySaved: '已保存 —— 后续请求将走代理。',\n proxySaveFailed: '保存失败:{message}',\n proxyNote: '作用于 token 交换、模型 API、用量查询、图片/视频生成与 x_search。OAuth 授权页在浏览器中打开,走的是浏览器/系统代理,不受此设置影响。',\n} satisfies Record<keyof typeof en, string>\n\n/** The Subscriptions namespace key union (en is the key-set source of truth). */\nexport type SubscriptionsKey = keyof typeof en\n","/**\n * Subscriptions settings section: one card per subscription provider with an\n * OAuth login/logout flow driven by the node half's `/subscriptions-auth` RPC\n * channel. Login state lives server-side; the page polls `status` only while\n * a login attempt is busy, so an idle page never polls. All state is local\n * React state — the page has no store.\n *\n * Every color resolves through a `--dsw-alias-*` design token (the ui-theme\n * design-platform.css values flip under `body[data-ds-dark-theme]`), and\n * every user-visible string goes through the locale-bound `t` of the\n * 'settings.subscriptions' namespace. Buttons and inputs take the\n * ModelsSection vocabulary minus hover rules, which inline styles cannot\n * express.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport type { CSSProperties } from 'react'\nimport type { ConnectionHandle, RpcResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** Logical RPC channel served by the node half of this plugin. */\nconst SUBSCRIPTIONS_AUTH_CHANNEL = '/subscriptions-auth'\n\n/** Poll cadence while a provider login attempt is busy. */\nconst POLL_INTERVAL_MS = 2000\n\n/** Subscription provider ids, fixed by the node half's OAuth adapters. */\nexport type SubscriptionProvider = 'codex' | 'claude' | 'grok' | 'copilot'\n\n/** One logged-in account as answered by the `status` endpoint. */\nexport interface AccountStatus {\n key: string\n account?: string\n expiresAt?: number\n plan?: string\n isDefault: boolean\n}\n\n/** One provider's login state as answered by the `status` endpoint. */\nexport interface ProviderStatus {\n busy: boolean\n accounts: AccountStatus[]\n detail?: string\n}\n\n/** `status` endpoint value: the node half owns this shape. */\ninterface StatusResponse {\n providers: Record<SubscriptionProvider, ProviderStatus>\n}\n\n/** One rate-limit window as answered by the `usage` endpoint. */\nexport interface UsageWindow {\n kind: 'session' | 'weekly' | 'other'\n scope?: string\n usedPercent: number\n resetsAt?: number\n}\n\n/** `usage` endpoint value: the node half owns this shape. */\nexport interface ProviderUsage {\n supported: boolean\n windows?: UsageWindow[]\n plan?: string\n}\n\n/** `proxyGet` endpoint value: the node half owns this shape (no secrets). */\nexport interface ProxyConfigView {\n enabled: boolean\n url: string\n username?: string\n passwordSet: boolean\n bypass: string[]\n error?: string\n}\n\n/** `proxyTest` endpoint value. */\nexport interface ProxyTestResult {\n ok: boolean\n viaProxy: boolean\n status?: number\n latencyMs?: number\n error?: string\n}\n\n/** `login` endpoint value: the URL the user completes OAuth at. */\ninterface LoginResponse {\n authorizeUrl: string\n /** Device-flow providers (copilot): the code the user types at authorizeUrl. */\n userCode?: string\n}\n\n/** Injected dependencies of {@link SubscriptionsSection} (slot `inject`). */\nexport interface SubscriptionsSectionInjected {\n /** Generic logical-RPC caller over the Connection transport. */\n rpc: ConnectionHandle['rpc']\n /** Section copy: translate a 'settings.subscriptions' key with `{name}` template params. */\n t: (key: SubscriptionsKey, params?: Record<string, unknown>) => string\n}\n\n/**\n * Props delivered by the slot outlet: the inject face spread flat (the\n * renderer erases the share boundary at the render call).\n */\nexport type SubscriptionsSectionProps = Partial<SubscriptionsSectionInjected>\n\n/** Card display metadata, in page order (names are brand names, not translated). */\nconst PROVIDERS: readonly { id: SubscriptionProvider; name: string }[] = [\n { id: 'codex', name: 'Codex (ChatGPT)' },\n { id: 'claude', name: 'Claude' },\n { id: 'grok', name: 'Grok (X Premium)' },\n { id: 'copilot', name: 'GitHub Copilot' },\n]\n\n/** Business error returned by the `/subscriptions-auth` channel (error branch message). */\nclass SubscriptionsAuthError extends Error {}\n\n/**\n * Call one `/subscriptions-auth` endpoint and unwrap the business result.\n * Shared by the settings section and the composer Speed toggle.\n * @param rpc - Connection RPC caller.\n * @param endpoint - channel-relative endpoint.\n * @param payload - channel-owned request payload.\n * @returns the success value, cast by the caller to the endpoint's shape.\n */\nexport async function callSubscriptionsAuth<T>(rpc: ConnectionHandle['rpc'], endpoint: string, payload: unknown): Promise<T> {\n let result: RpcResult<unknown>\n try {\n result = await rpc.call(SUBSCRIPTIONS_AUTH_CHANNEL, endpoint, payload)\n } catch (error) {\n // The transport rejected rather than answering; surface the same way.\n throw new SubscriptionsAuthError(error instanceof Error ? error.message : String(error))\n }\n if (!result.ok) throw new SubscriptionsAuthError(result.error.message)\n return result.value as T\n}\n\n/** Human text of an action failure, SubscriptionsAuthError or not. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/** Copy a keyed map without the entries whose key is not in `live`. */\nfunction dropStale<T>(map: Record<string, T>, live: ReadonlySet<string>): Record<string, T> {\n const stale = Object.keys(map).filter(key => !live.has(key))\n if (stale.length === 0) return map\n const next = { ...map }\n for (const key of stale) delete next[key]\n return next\n}\n\n/**\n * English-dictionary fallback for a missing inject `t` (standalone renders);\n * the slot inject always supplies the locale-bound one.\n * @param key - dictionary key.\n * @param params - `{name}` template params.\n * @returns the template with params substituted.\n */\nfunction fallbackTranslate(key: SubscriptionsKey, params?: Record<string, unknown>): string {\n let text: string = en[key]\n for (const [name, value] of Object.entries(params ?? {})) {\n text = text.replaceAll(`{${name}}`, String(value))\n }\n return text\n}\n\nconst styles: Record<string, CSSProperties> = {\n section: {\n display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 560,\n color: 'var(--dsw-alias-label-primary)',\n },\n intro: { margin: 0, color: 'var(--dsw-alias-label-tertiary)', fontSize: 14, lineHeight: '22px' },\n card: {\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 12,\n padding: '12px 14px', display: 'flex', flexDirection: 'column', gap: 6,\n },\n proxyCard: {\n padding: '12px 14px', display: 'flex', flexDirection: 'column', gap: 6,\n },\n separator: { borderTop: '1px solid var(--dsw-alias-border-l2)' },\n cardHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n dot: { width: 8, height: 8, borderRadius: '50%', flexShrink: 0 },\n name: { fontWeight: 500, fontSize: 14, lineHeight: '22px', color: 'var(--dsw-alias-label-primary)' },\n statusLine: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n errorLine: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-state-error-primary)' },\n actions: { display: 'flex', gap: 8, marginTop: 4, alignItems: 'center', flexWrap: 'wrap' },\n button: {\n boxSizing: 'border-box', display: 'inline-flex', alignItems: 'center', justifyContent: 'center',\n height: 28, padding: '0 10px', borderRadius: 14,\n border: '1px solid var(--dsw-alias-border-l2)', background: 'transparent',\n color: 'var(--dsw-alias-label-primary)', font: 'inherit', fontSize: 12, lineHeight: '18px',\n cursor: 'pointer',\n },\n usage: {\n display: 'flex', flexDirection: 'column', gap: 6, marginTop: 4,\n borderTop: '1px solid var(--dsw-alias-border-l2)', paddingTop: 8,\n },\n usageHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n usageTitle: { fontSize: 12, lineHeight: '18px', fontWeight: 500, color: 'var(--dsw-alias-label-secondary)' },\n usagePlan: { fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n usageRefresh: {\n boxSizing: 'border-box', display: 'inline-flex', alignItems: 'center', justifyContent: 'center',\n height: 22, padding: '0 8px', borderRadius: 11, marginLeft: 'auto',\n border: '1px solid var(--dsw-alias-border-l2)', background: 'transparent',\n color: 'var(--dsw-alias-label-secondary)', font: 'inherit', fontSize: 12, lineHeight: '18px',\n cursor: 'pointer',\n },\n usageRow: { display: 'flex', flexDirection: 'column', gap: 3 },\n usageMeta: {\n display: 'flex', justifyContent: 'space-between', gap: 8,\n fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)',\n },\n accountRow: {\n display: 'flex', flexDirection: 'column', gap: 6,\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '8px 10px', marginTop: 4,\n },\n accountHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n accountName: { fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)', userSelect: 'all' },\n starButton: {\n border: 'none', background: 'transparent', padding: 0,\n font: 'inherit', fontSize: 14, lineHeight: '20px', cursor: 'pointer',\n color: 'var(--dsw-alias-state-warn-label)',\n },\n usageTrack: {\n height: 6, borderRadius: 3, overflow: 'hidden',\n background: 'var(--dsw-alias-bg-layer-1)', border: '1px solid var(--dsw-alias-border-l2)',\n },\n usageFill: { height: '100%', borderRadius: 3 },\n manual: { marginTop: 4, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)' },\n manualRow: { display: 'flex', gap: 8, marginTop: 6 },\n manualInput: {\n flex: 1, height: 32, boxSizing: 'border-box',\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '0 10px', font: 'inherit', fontSize: 14, lineHeight: '22px',\n background: 'var(--dsw-alias-bg-layer-1)', color: 'var(--dsw-alias-label-primary)',\n },\n deviceCode: {\n marginTop: 4, display: 'flex', flexDirection: 'column', gap: 6,\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '10px 12px', background: 'var(--dsw-alias-bg-layer-1)',\n },\n deviceCodeText: {\n fontFamily: 'monospace', fontSize: 18, lineHeight: '24px', letterSpacing: 2,\n color: 'var(--dsw-alias-label-primary)', userSelect: 'all',\n },\n proxyField: { display: 'flex', flexDirection: 'column', gap: 4 },\n proxyLabel: { fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)' },\n proxyInput: {\n height: 32, width: '100%', boxSizing: 'border-box',\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '0 10px', font: 'inherit', fontSize: 14, lineHeight: '22px',\n background: 'var(--dsw-alias-bg-layer-1)', color: 'var(--dsw-alias-label-primary)',\n },\n proxyHint: {\n margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)',\n },\n proxyCheck: {\n display: 'flex', alignItems: 'center', gap: 8,\n fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)', cursor: 'pointer',\n },\n proxyMessage: { margin: 0, fontSize: 12, lineHeight: '18px' },\n proxyActions: { display: 'flex', gap: 8, alignItems: 'center', justifyContent: 'flex-end', marginTop: 2 },\n modalOverlay: {\n position: 'fixed', inset: 0, zIndex: 1000,\n display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16,\n background: 'rgba(0, 0, 0, 0.45)',\n },\n modal: {\n width: 460, maxWidth: '100%', maxHeight: '90vh', overflowY: 'auto',\n boxSizing: 'border-box', display: 'flex', flexDirection: 'column', gap: 12,\n padding: '16px 18px', borderRadius: 12,\n background: 'var(--dsw-alias-bg-layer-1)', border: '1px solid var(--dsw-alias-border-l2)',\n },\n modalHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n modalTitle: { fontWeight: 600, fontSize: 15, lineHeight: '22px', color: 'var(--dsw-alias-label-primary)' },\n}\n\n/** Status dot color for one provider state. */\nfunction dotColor(status: ProviderStatus | undefined): string {\n if (status?.busy === true) return 'var(--dsw-alias-state-warn-label)'\n if ((status?.accounts.length ?? 0) > 0) return 'var(--dsw-alias-state-success-primary)'\n return 'var(--dsw-alias-label-dimmed)'\n}\n\n/**\n * One-line status text for one provider state.\n * @param t - section translate.\n * @param status - the provider's last reported state.\n * @returns the localized status line.\n */\nfunction statusText(t: SubscriptionsSectionInjected['t'], status: ProviderStatus | undefined): string {\n if (status === undefined) return t('checking')\n if (status.busy) return t('loginInProgress')\n if (status.accounts.length > 0) return t('loggedInCount', { count: status.accounts.length })\n return t('notLoggedIn')\n}\n\n/**\n * Localized label of one usage window (kind, plus the model scope when named).\n * @param t - section translate.\n * @param window - the reported window.\n * @returns e.g. \"5-hour window\" or \"Weekly · Opus\".\n */\nfunction usageWindowLabel(t: SubscriptionsSectionInjected['t'], window: UsageWindow): string {\n const base = window.kind === 'session'\n ? t('usageSession')\n : window.kind === 'weekly' ? t('usageWeekly') : t('usageWindow')\n return window.scope !== undefined && window.scope !== '' ? `${base} · ${window.scope}` : base\n}\n\n/** Bar fill color: success normally, warn from 80%, error from 95%. */\nfunction usageBarColor(usedPercent: number): string {\n if (usedPercent >= 95) return 'var(--dsw-alias-state-error-primary)'\n if (usedPercent >= 80) return 'var(--dsw-alias-state-warn-label)'\n return 'var(--dsw-alias-state-success-primary)'\n}\n\n/** One-line status text of the proxy config card. */\nfunction proxyStatusText(\n t: SubscriptionsSectionInjected['t'],\n proxy: ProxyConfigView | undefined,\n loadError: string | undefined,\n): string {\n if (loadError !== undefined) return t('proxyLoadFailed', { message: loadError })\n if (proxy === undefined) return t('proxyLoading')\n if (proxy.error !== undefined) return t('proxyStatusError', { message: proxy.error })\n if (proxy.enabled) return t('proxyStatusEnabled', { url: proxy.url })\n return t('proxyStatusNone')\n}\n\n/** Feedback-line color of the proxy dialog. */\nfunction messageColor(tone: 'success' | 'error'): string {\n return tone === 'error'\n ? 'var(--dsw-alias-state-error-primary)'\n : 'var(--dsw-alias-state-success-primary)'\n}\n\n/**\n * The Subscriptions settings page component.\n * @param props - the slot inject face ({@link SubscriptionsSectionInjected}).\n * @returns the section body, or a notice while the RPC face is absent.\n */\nexport function SubscriptionsSection(props: SubscriptionsSectionProps) {\n const { rpc } = props\n const t = props.t ?? fallbackTranslate\n const [statuses, setStatuses] = useState<Partial<Record<SubscriptionProvider, ProviderStatus>>>({})\n const [errors, setErrors] = useState<Partial<Record<SubscriptionProvider, string>>>({})\n const [manualDrafts, setManualDrafts] = useState<Record<SubscriptionProvider, string>>({\n codex: '', claude: '', grok: '', copilot: '',\n })\n /** Pending device-flow codes (copilot), shown while the attempt polls. */\n const [deviceCodes, setDeviceCodes] = useState<Partial<Record<SubscriptionProvider, { userCode: string; verificationUrl: string }>>>({})\n const [copiedCode, setCopiedCode] = useState<SubscriptionProvider | undefined>(undefined)\n /** Usage snapshots keyed `${provider}:${accountKey}` — every account tracks its own windows. */\n const [usages, setUsages] = useState<Record<string, ProviderUsage>>({})\n const [usageErrors, setUsageErrors] = useState<Record<string, string>>({})\n const [usageLoading, setUsageLoading] = useState<Record<string, boolean>>({})\n const mountedRef = useRef(true)\n const pollersRef = useRef(new Map<SubscriptionProvider, ReturnType<typeof setInterval>>())\n /** Accounts with a `usage` call in flight; guards the auto-fetch effect against re-entry. */\n const usageInflightRef = useRef(new Set<string>())\n /** Proxy config as last answered by `proxyGet`/`proxySet`. */\n const [proxy, setProxy] = useState<ProxyConfigView | undefined>(undefined)\n const [proxyLoadError, setProxyLoadError] = useState<string | undefined>(undefined)\n /** Proxy dialog state (draft fields; the password never pre-fills). */\n const [proxyOpen, setProxyOpen] = useState(false)\n const [proxyEnabled, setProxyEnabled] = useState(false)\n const [proxyUrl, setProxyUrl] = useState('')\n const [proxyUsername, setProxyUsername] = useState('')\n const [proxyPassword, setProxyPassword] = useState('')\n const [proxyClearPassword, setProxyClearPassword] = useState(false)\n const [proxyBypass, setProxyBypass] = useState('')\n const [proxySaving, setProxySaving] = useState(false)\n const [proxyTesting, setProxyTesting] = useState(false)\n const [proxyMessage, setProxyMessage] = useState<{ tone: 'success' | 'error'; text: string } | undefined>(undefined)\n const [proxyTestResult, setProxyTestResult] = useState<ProxyTestResult | undefined>(undefined)\n\n const setProviderError = useCallback((provider: SubscriptionProvider, message: string | undefined): void => {\n if (!mountedRef.current) return\n setErrors((prev) => {\n const next = { ...prev }\n if (message === undefined) delete next[provider]\n else next[provider] = message\n return next\n })\n }, [])\n\n const stopPolling = useCallback((provider: SubscriptionProvider): void => {\n const poller = pollersRef.current.get(provider)\n if (poller !== undefined) {\n clearInterval(poller)\n pollersRef.current.delete(provider)\n }\n }, [])\n\n /** Refetch every provider's status; stop a provider's poller once its attempt settles. */\n const refresh = useCallback(async (): Promise<void> => {\n if (rpc === undefined) return\n let response: StatusResponse\n try {\n response = await callSubscriptionsAuth<StatusResponse>(rpc, 'status', {})\n } catch {\n // A failed poll must not kill the page; busy providers keep polling and\n // the action paths report their own errors.\n return\n }\n if (!mountedRef.current) return\n setStatuses(response.providers)\n for (const { id } of PROVIDERS) {\n const status = response.providers[id]\n if (status.accounts.length > 0 || !status.busy) {\n stopPolling(id)\n // The attempt settled (success, timeout, or cancel): drop the code card.\n setDeviceCodes((prev) => {\n if (prev[id] === undefined) return prev\n const next = { ...prev }\n delete next[id]\n return next\n })\n }\n }\n }, [rpc, stopPolling])\n\n const startPolling = useCallback((provider: SubscriptionProvider): void => {\n if (pollersRef.current.has(provider)) return\n pollersRef.current.set(provider, setInterval(() => { void refresh() }, POLL_INTERVAL_MS))\n }, [refresh])\n\n // Initial load; every busy provider (e.g. an attempt started before a page\n // reload) resumes polling. Teardown clears pollers and the mounted guard.\n useEffect(() => {\n mountedRef.current = true\n void refresh().then(() => {\n if (!mountedRef.current) return\n setStatuses((current) => {\n for (const { id } of PROVIDERS) {\n if (current[id]?.busy === true) startPolling(id)\n }\n return current\n })\n })\n return () => {\n mountedRef.current = false\n for (const poller of pollersRef.current.values()) clearInterval(poller)\n pollersRef.current.clear()\n }\n }, [refresh, startPolling])\n\n const loadUsage = useCallback(async (provider: SubscriptionProvider, account: string): Promise<void> => {\n const key = `${provider}:${account}`\n if (rpc === undefined || usageInflightRef.current.has(key)) return\n usageInflightRef.current.add(key)\n setUsageLoading(prev => ({ ...prev, [key]: true }))\n try {\n const usage = await callSubscriptionsAuth<ProviderUsage>(rpc, 'usage', { provider, account })\n if (!mountedRef.current) return\n setUsages(prev => ({ ...prev, [key]: usage }))\n setUsageErrors((prev) => {\n const next = { ...prev }\n delete next[key]\n return next\n })\n } catch (error) {\n if (mountedRef.current) setUsageErrors(prev => ({ ...prev, [key]: messageOf(error) }))\n } finally {\n usageInflightRef.current.delete(key)\n if (mountedRef.current) setUsageLoading(prev => ({ ...prev, [key]: false }))\n }\n }, [rpc])\n\n // Fetch usage once an account is logged in; drop the snapshots of accounts\n // that vanished so a re-login refetches. A failed lookup does not auto-retry\n // — the per-account Refresh button is the retry path.\n useEffect(() => {\n const live = new Set<string>()\n for (const { id } of PROVIDERS) {\n for (const account of statuses[id]?.accounts ?? []) {\n const key = `${id}:${account.key}`\n live.add(key)\n if (usages[key] === undefined && usageErrors[key] === undefined) void loadUsage(id, account.key)\n }\n }\n setUsages(prev => dropStale(prev, live))\n setUsageErrors(prev => dropStale(prev, live))\n }, [statuses, usages, usageErrors, loadUsage])\n\n const login = useCallback(async (provider: SubscriptionProvider, method?: 'oauth' | 'keychain'): Promise<void> => {\n if (rpc === undefined) return\n setProviderError(provider, undefined)\n try {\n const response = await callSubscriptionsAuth<LoginResponse>(rpc, 'login', {\n provider,\n ...method === undefined ? {} : { method },\n })\n if (typeof response.authorizeUrl === 'string' && response.authorizeUrl === '') {\n // Instant login (e.g. imported from Claude Code credentials)\n await refresh()\n return\n }\n if (typeof response.authorizeUrl !== 'string') {\n throw new SubscriptionsAuthError(t('loginMissingUrl'))\n }\n if (!mountedRef.current) return\n // Optimistic busy so Cancel and the manual fallback appear before the first poll tick.\n setStatuses(prev => ({\n ...prev,\n [provider]: { accounts: prev[provider]?.accounts ?? [], ...prev[provider], busy: true },\n }))\n if (typeof response.userCode === 'string' && response.userCode.length > 0) {\n // Device flow: show the code card instead of opening the page blind —\n // the user copies the code first, then opens the verification page.\n setDeviceCodes(prev => ({ ...prev, [provider]: { userCode: response.userCode as string, verificationUrl: response.authorizeUrl } }))\n } else {\n window.open(response.authorizeUrl, '_blank', 'noopener')\n }\n startPolling(provider)\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n }, [rpc, t, setProviderError, startPolling])\n\n const cancel = useCallback(async (provider: SubscriptionProvider): Promise<void> => {\n if (rpc === undefined) return\n stopPolling(provider)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'cancel', { provider })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, stopPolling, setProviderError, refresh])\n\n const submitManual = useCallback(async (provider: SubscriptionProvider): Promise<void> => {\n if (rpc === undefined) return\n const input = manualDrafts[provider].trim()\n if (input === '') return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'manual', { provider, input })\n if (mountedRef.current) setManualDrafts(prev => ({ ...prev, [provider]: '' }))\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, manualDrafts, setProviderError, refresh])\n\n const logout = useCallback(async (provider: SubscriptionProvider, account: string, display: string, name: string): Promise<void> => {\n if (rpc === undefined) return\n if (!window.confirm(t('logoutAccountConfirm', { provider: name, account: display }))) return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'logout', { provider, account })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, t, setProviderError, refresh])\n\n const setDefault = useCallback(async (provider: SubscriptionProvider, account: string): Promise<void> => {\n if (rpc === undefined) return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'setDefault', { provider, account })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, setProviderError, refresh])\n\n const copyDeviceCode = useCallback((provider: SubscriptionProvider, userCode: string): void => {\n void navigator.clipboard?.writeText(userCode).then(() => {\n if (!mountedRef.current) return\n setCopiedCode(provider)\n setTimeout(() => {\n if (mountedRef.current) {\n setCopiedCode(current => current === provider ? undefined : current)\n }\n }, 1500)\n }).catch(() => undefined)\n }, [])\n\n // Proxy configuration: load once on mount; the dialog drives proxySet/proxyTest.\n useEffect(() => {\n if (rpc === undefined) return\n let alive = true\n void callSubscriptionsAuth<ProxyConfigView>(rpc, 'proxyGet', {}).then((view) => {\n if (!alive) return\n setProxy(view)\n setProxyLoadError(undefined)\n }).catch((error) => {\n if (alive) setProxyLoadError(messageOf(error))\n })\n return () => { alive = false }\n }, [rpc])\n\n useEffect(() => {\n if (!proxyOpen) return\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') setProxyOpen(false)\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [proxyOpen])\n\n const openProxyDialog = useCallback((): void => {\n if (proxy === undefined) return\n setProxyEnabled(proxy.enabled)\n setProxyUrl(proxy.url)\n setProxyUsername(proxy.username ?? '')\n setProxyPassword('')\n setProxyClearPassword(false)\n setProxyBypass(proxy.bypass.join(', '))\n setProxyMessage(undefined)\n setProxyTestResult(undefined)\n setProxyOpen(true)\n }, [proxy])\n\n const saveProxy = useCallback(async (): Promise<void> => {\n if (rpc === undefined) return\n setProxySaving(true)\n setProxyMessage(undefined)\n try {\n const view = await callSubscriptionsAuth<ProxyConfigView>(rpc, 'proxySet', {\n enabled: proxyEnabled,\n url: proxyUrl.trim(),\n username: proxyUsername,\n ...proxyClearPassword ? { password: null } : proxyPassword !== '' ? { password: proxyPassword } : {},\n bypass: proxyBypass.split(/[,\\n]/).map(entry => entry.trim()).filter(entry => entry !== ''),\n })\n setProxy(view)\n setProxyLoadError(undefined)\n setProxyMessage({ tone: 'success', text: t('proxySaved') })\n setProxyOpen(false)\n } catch (error) {\n setProxyMessage({ tone: 'error', text: t('proxySaveFailed', { message: messageOf(error) }) })\n } finally {\n setProxySaving(false)\n }\n }, [rpc, proxyEnabled, proxyUrl, proxyUsername, proxyPassword, proxyClearPassword, proxyBypass, t])\n\n const testProxy = useCallback(async (): Promise<void> => {\n if (rpc === undefined || proxyTesting) return\n setProxyTesting(true)\n setProxyTestResult(undefined)\n try {\n // Test the dialog's current inputs (they do not need to be saved first);\n // the host builds a throwaway agent for the probe.\n setProxyTestResult(await callSubscriptionsAuth<ProxyTestResult>(rpc, 'proxyTest', {\n proxy: {\n url: proxyUrl.trim(),\n ...proxyUsername.trim() !== '' ? { username: proxyUsername.trim() } : {},\n ...proxyPassword !== '' ? { password: proxyPassword } : {},\n },\n }))\n } catch (error) {\n setProxyTestResult({ ok: false, viaProxy: false, error: messageOf(error) })\n } finally {\n setProxyTesting(false)\n }\n }, [rpc, proxyTesting, proxyUrl, proxyUsername, proxyPassword])\n\n if (rpc === undefined) {\n return <p style={styles.intro}>{t('unavailable')}</p>\n }\n\n return (\n <div style={styles.section}>\n <p style={styles.intro}>{t('intro')}</p>\n <div style={styles.proxyCard}>\n <div style={styles.cardHeader}>\n <span style={{\n ...styles.dot,\n background: proxy?.enabled === true\n ? 'var(--dsw-alias-state-success-primary)'\n : 'var(--dsw-alias-label-dimmed)',\n }} />\n <span style={styles.name}>{t('proxyTitle')}</span>\n <button\n type=\"button\"\n style={{ ...styles.button, marginLeft: 'auto', flexShrink: 0 }}\n onClick={openProxyDialog}\n >\n {t('proxyConfigure')}\n </button>\n </div>\n <p style={styles.statusLine}>{proxyStatusText(t, proxy, proxyLoadError)}</p>\n </div>\n <div style={styles.separator} />\n {PROVIDERS.map(({ id, name }) => {\n const status = statuses[id]\n const busy = status?.busy === true\n const deviceCode = deviceCodes[id]\n const accounts = status?.accounts ?? []\n return (\n <div key={id} style={styles.card}>\n <div style={styles.cardHeader}>\n <span style={{ ...styles.dot, background: dotColor(status) }} />\n <span style={styles.name}>{name}</span>\n </div>\n <p style={styles.statusLine}>{statusText(t, status)}</p>\n {status?.detail !== undefined && status.detail !== '' && (\n <p style={styles.statusLine}>{status.detail}</p>\n )}\n {errors[id] !== undefined && <p style={styles.errorLine}>{errors[id]}</p>}\n {accounts.map((account) => {\n const usageKey = `${id}:${account.key}`\n const usage = usages[usageKey]\n const usageError = usageErrors[usageKey]\n const display = account.account ?? account.key\n // Providers without a usage endpoint answer supported:false — no block.\n const showUsage = usage?.supported !== false\n && (usage !== undefined || usageError !== undefined || usageLoading[usageKey] === true)\n return (\n <div key={account.key} style={styles.accountRow}>\n <div style={styles.accountHeader}>\n <button\n type=\"button\"\n style={styles.starButton}\n title={account.isDefault ? t('defaultBadge') : t('setDefault')}\n onClick={() => {\n if (!account.isDefault) void setDefault(id, account.key)\n }}\n >\n {account.isDefault ? '★' : '☆'}\n </button>\n <span style={styles.accountName}>{display}</span>\n {account.plan !== undefined && (\n <span style={styles.usagePlan}>{account.plan}</span>\n )}\n {account.expiresAt !== undefined && (\n <span style={styles.statusLine}>\n {t('accountExpires', { date: new Date(account.expiresAt).toLocaleString() })}\n </span>\n )}\n <button\n type=\"button\"\n style={{ ...styles.button, marginLeft: 'auto', flexShrink: 0 }}\n onClick={() => { void logout(id, account.key, display, name) }}\n >\n {t('logout')}\n </button>\n </div>\n {showUsage && (\n <div style={styles.usage}>\n <div style={styles.usageHeader}>\n <span style={styles.usageTitle}>{t('usageTitle')}</span>\n {usage?.plan !== undefined && (\n <span style={styles.usagePlan}>{t('usagePlan', { plan: usage.plan })}</span>\n )}\n <button\n type=\"button\"\n style={{ ...styles.usageRefresh, ...usageLoading[usageKey] === true ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={usageLoading[usageKey] === true}\n onClick={() => { void loadUsage(id, account.key) }}\n >\n {t('usageRefresh')}\n </button>\n </div>\n {usage === undefined && usageError === undefined && (\n <p style={styles.statusLine}>{t('usageLoading')}</p>\n )}\n {usageError !== undefined && (\n <p style={styles.errorLine}>{t('usageError', { message: usageError })}</p>\n )}\n {usage?.windows !== undefined && usage.windows.length === 0 && (\n <p style={styles.statusLine}>{t('usageEmpty')}</p>\n )}\n {(usage?.windows ?? []).map((window, index) => {\n const percent = Math.min(100, Math.max(0, window.usedPercent))\n return (\n <div key={index} style={styles.usageRow}>\n <div style={styles.usageMeta}>\n <span>{usageWindowLabel(t, window)}</span>\n <span>\n {`${String(Math.round(percent))}%`}\n {window.resetsAt !== undefined\n && ` · ${t('usageResets', { date: new Date(window.resetsAt).toLocaleString() })}`}\n </span>\n </div>\n <div style={styles.usageTrack}>\n <div style={{ ...styles.usageFill, width: `${String(percent)}%`, background: usageBarColor(percent) }} />\n </div>\n </div>\n )\n })}\n </div>\n )}\n </div>\n )\n })}\n <div style={styles.actions}>\n {!busy && accounts.length === 0 && (\n <button type=\"button\" style={styles.button} onClick={() => { void login(id) }}>\n {t('login')}\n </button>\n )}\n {!busy && accounts.length > 0 && id === 'claude' && (\n <>\n <button type=\"button\" style={styles.button} onClick={() => { void login(id, 'oauth') }}>\n {t('addAccountOAuth')}\n </button>\n <button type=\"button\" style={styles.button} onClick={() => { void login(id, 'keychain') }}>\n {t('addAccountKeychain')}\n </button>\n </>\n )}\n {!busy && accounts.length > 0 && id !== 'claude' && (\n <button type=\"button\" style={styles.button} onClick={() => { void login(id) }}>\n {t('addAccount')}\n </button>\n )}\n {busy && (\n <button type=\"button\" style={styles.button} onClick={() => { void cancel(id) }}>\n {t('cancel')}\n </button>\n )}\n </div>\n {!busy && accounts.length > 0 && (\n <p style={styles.statusLine}>{t('addAccountHint')}</p>\n )}\n {busy && deviceCode !== undefined && (\n <div style={styles.deviceCode}>\n <span style={styles.statusLine}>{t('deviceCodePrompt')}</span>\n <span style={styles.deviceCodeText}>{deviceCode.userCode}</span>\n <div style={styles.actions}>\n <button type=\"button\" style={styles.button} onClick={() => { copyDeviceCode(id, deviceCode.userCode) }}>\n {copiedCode === id ? t('deviceCodeCopied') : t('deviceCodeCopy')}\n </button>\n <button\n type=\"button\"\n style={styles.button}\n onClick={() => { window.open(deviceCode.verificationUrl, '_blank', 'noopener') }}\n >\n {t('deviceCodeOpenPage')}\n </button>\n </div>\n </div>\n )}\n {busy && deviceCode === undefined && (\n <details style={styles.manual}>\n <summary>{t('manualSummary')}</summary>\n <div style={styles.manualRow}>\n <input\n style={styles.manualInput}\n value={manualDrafts[id]}\n placeholder={t('manualPlaceholder')}\n onChange={event => setManualDrafts(prev => ({ ...prev, [id]: event.target.value }))}\n />\n <button type=\"button\" style={styles.button} onClick={() => { void submitManual(id) }}>\n {t('submit')}\n </button>\n </div>\n </details>\n )}\n </div>\n )\n })}\n {proxyOpen && (\n <div style={styles.modalOverlay} onClick={() => setProxyOpen(false)}>\n <div style={styles.modal} onClick={event => event.stopPropagation()}>\n <div style={styles.modalHeader}>\n <span style={styles.modalTitle}>{t('proxyDialogTitle')}</span>\n <button type=\"button\" style={{ ...styles.button, marginLeft: 'auto' }} onClick={() => setProxyOpen(false)}>\n {t('proxyDialogClose')}\n </button>\n </div>\n <label style={styles.proxyCheck}>\n <input type=\"checkbox\" checked={proxyEnabled} onChange={event => setProxyEnabled(event.target.checked)} />\n <span>{t('proxyEnabled')}</span>\n </label>\n <label style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyUrl')}</span>\n <input\n style={styles.proxyInput}\n value={proxyUrl}\n placeholder={t('proxyUrlPlaceholder')}\n onChange={event => setProxyUrl(event.target.value)}\n />\n <p style={styles.proxyHint}>{t('proxyUrlHint')}</p>\n </label>\n <label style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyUsername')}</span>\n <input\n style={styles.proxyInput}\n value={proxyUsername}\n placeholder={t('proxyUsernamePlaceholder')}\n onChange={event => setProxyUsername(event.target.value)}\n />\n </label>\n <div style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyPassword')}</span>\n <input\n type=\"password\"\n style={styles.proxyInput}\n value={proxyPassword}\n placeholder={t('proxyPasswordPlaceholder')}\n onChange={event => setProxyPassword(event.target.value)}\n />\n <label style={styles.proxyCheck}>\n <input\n type=\"checkbox\"\n checked={proxyClearPassword}\n onChange={event => setProxyClearPassword(event.target.checked)}\n />\n <span>{t('proxyClearPassword')}</span>\n </label>\n </div>\n <label style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyBypass')}</span>\n <input\n style={styles.proxyInput}\n value={proxyBypass}\n placeholder={t('proxyBypassPlaceholder')}\n onChange={event => setProxyBypass(event.target.value)}\n />\n <p style={styles.proxyHint}>{t('proxyBypassHint')}</p>\n </label>\n <p style={styles.proxyHint}>{t('proxyNote')}</p>\n {proxyMessage !== undefined && (\n <p style={{ ...styles.proxyMessage, color: messageColor(proxyMessage.tone) }}>{proxyMessage.text}</p>\n )}\n {proxyTestResult !== undefined && (\n <p style={{\n ...styles.proxyMessage,\n color: proxyTestResult.ok\n ? 'var(--dsw-alias-state-success-primary)'\n : 'var(--dsw-alias-state-error-primary)',\n }}>\n {proxyTestResult.ok\n ? (proxyTestResult.viaProxy\n ? t('proxyTestOk', { status: String(proxyTestResult.status), ms: String(proxyTestResult.latencyMs) })\n : t('proxyTestOkDirect', { status: String(proxyTestResult.status), ms: String(proxyTestResult.latencyMs) }))\n : t('proxyTestFail', { message: proxyTestResult.error ?? '' })}\n </p>\n )}\n <div style={styles.proxyActions}>\n <button\n type=\"button\"\n style={{ ...styles.button, ...proxyTesting ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={proxyTesting}\n onClick={() => { void testProxy() }}\n >\n {proxyTesting ? t('proxyTesting') : t('proxyTest')}\n </button>\n <button\n type=\"button\"\n style={{ ...styles.button, ...proxySaving ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={proxySaving}\n onClick={() => { void saveProxy() }}\n >\n {proxySaving ? t('proxySaving') : t('proxySave')}\n </button>\n <button type=\"button\" style={styles.button} onClick={() => setProxyOpen(false)}>\n {t('proxyCancel')}\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n )\n}\n","/**\n * Plugin-local image gallery for generated-image toolviews.\n *\n * Since web-app rc.8, `@deepseek-ai/dsh-client-ui-attachment`'s browser module\n * exports only its cordis plugin surface (`apply`/`inject`) — the React\n * components are no longer package values, so importing `ImageGallery` from it\n * yields `undefined` at runtime and crashes the toolview inside the slot error\n * boundary (the whole call row disappears). This module re-implements the\n * gallery contract the toolview needs (loader-driven thumbnails, retry on\n * failure, click-to-open lightbox) with the same sizing rules as the platform\n * component, keeping this plugin independent of harness component exports.\n */\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport type { CSSProperties } from 'react'\n\n/**\n * Mirror of ImageAttachmentRef (packages/attachment/attachment/src/types.ts);\n * the brand on attachmentId is compile-time only, so string suffices here.\n */\nexport interface ImageAttachmentRef {\n attachmentId: string\n mediaType: string\n bytes: number\n width: number\n height: number\n name?: string\n}\n\n/** Loads a session-authorized durable image URL (resolves to a data/blob URL). */\nexport type ImageLoader = (attachment: ImageAttachmentRef) => Promise<string>\n\n/** Lightbox strings forwarded to the opened preview. */\nexport interface ImageLightboxLabels {\n dialog: string\n close: string\n}\n\n/** Message-image strings the owner resolves from its own locale namespace. */\nexport interface MessageImageLabels {\n /** Fallback display name for an unnamed image. */\n image: string\n /** Thumbnail tooltip inviting the original-image preview. */\n open: string\n /** Accessible thumbnail label; receives the image's display name. */\n openNamed: (label: string) => string\n /** Loading placeholder shown until bytes resolve. */\n loading: string\n /** Retry-control label shown when the load fails. */\n loadFailed: string\n /** Lightbox strings forwarded to the opened preview. */\n lightbox: ImageLightboxLabels\n}\n\n/** Display box for a lone image (platform rule): long edge 240px with the\n * rendered aspect ratio clamped to [0.25, 4] — the overflow is cropped by\n * `object-fit: cover` — and never upscaled past the image's natural size. The\n * crop anchor keeps the top of very tall images and the left of very wide\n * ones, where the informative content usually starts. */\nfunction singleFit(attachment: ImageAttachmentRef): { width: number; height: number; objectPosition: string } {\n const natural = attachment.width / attachment.height\n const ratio = Math.min(4, Math.max(0.25, natural))\n const box = ratio >= 1 ? { width: 240, height: 240 / ratio } : { width: 240 * ratio, height: 240 }\n const scale = Math.min(1, attachment.width / box.width, attachment.height / box.height)\n return {\n width: Math.max(1, Math.round(box.width * scale)),\n height: Math.max(1, Math.round(box.height * scale)),\n objectPosition: natural < 0.25 ? 'center top' : natural > 4 ? 'left center' : 'center',\n }\n}\n\nconst styles: Record<string, CSSProperties> = {\n gallery: { display: 'flex', flexWrap: 'wrap', gap: 8, justifyContent: 'flex-start' },\n frame: {\n display: 'grid', placeItems: 'center', overflow: 'hidden', padding: 0,\n border: '1px solid var(--dsw-alias-border-l2-darkmode-thin)', borderRadius: 8,\n background: 'var(--dsw-alias-interactive-bg-hover-solid)', cursor: 'zoom-in',\n },\n tile: { width: 64, height: 64 },\n img: { width: '100%', height: '100%', objectFit: 'cover', display: 'block' },\n loading: { fontSize: 12, color: 'var(--dsw-alias-label-tertiary)', padding: '0 8px' },\n error: {\n fontSize: 12, color: 'var(--dsw-alias-state-error-primary)', cursor: 'pointer',\n border: '1px solid var(--dsw-alias-border-l2-darkmode-thin)', borderRadius: 8,\n background: 'transparent', padding: '6px 10px',\n },\n overlay: {\n position: 'fixed', inset: 0, zIndex: 1000, display: 'grid', placeItems: 'center',\n background: 'rgba(0, 0, 0, 0.72)', padding: 24,\n },\n overlayImg: { maxWidth: '92vw', maxHeight: '92vh', objectFit: 'contain', borderRadius: 4 },\n close: {\n position: 'absolute', top: 12, right: 12, width: 32, height: 32, display: 'grid',\n placeItems: 'center', border: 'none', borderRadius: '50%', cursor: 'pointer',\n background: 'rgba(255, 255, 255, 0.16)', color: '#fff', fontSize: 16, lineHeight: 1,\n },\n}\n\n/**\n * Full-viewport original-image preview: backdrop or close-control click and\n * Escape all dismiss; the image itself is inert so a click on it does not\n * fall through to the backdrop dismissal.\n */\nfunction ImageLightbox({ src, alt, labels, onClose }: {\n src: string\n alt: string\n labels: ImageLightboxLabels\n onClose: () => void\n}) {\n useEffect(() => {\n const onKey = (event: KeyboardEvent) => { if (event.key === 'Escape') onClose() }\n window.addEventListener('keydown', onKey)\n return () => { window.removeEventListener('keydown', onKey) }\n }, [onClose])\n return (\n <div role=\"dialog\" aria-label={labels.dialog} style={styles.overlay} onClick={onClose}>\n <img src={src} alt={alt} style={styles.overlayImg} onClick={event => { event.stopPropagation() }} />\n <button type=\"button\" aria-label={labels.close} style={styles.close} onClick={onClose}>×</button>\n </div>\n )\n}\n\n/**\n * Compact history renderer with retryable loading and click-to-open original\n * preview. A lone image renders at its `singleFit` size; an image among\n * several renders as a fixed 64px square tile.\n */\nexport function MessageImage({ attachment, load, variant, labels }: {\n attachment: ImageAttachmentRef\n load: ImageLoader\n variant: 'single' | 'tile'\n labels: MessageImageLabels\n}) {\n const [src, setSrc] = useState<string | null>(null)\n const [error, setError] = useState(false)\n const [open, setOpen] = useState(false)\n // Retry re-arms the one load effect below, so every attempt — first load or\n // retry — runs under the same liveness guard and the same reset.\n const [attempt, setAttempt] = useState(0)\n const retry = useCallback(() => { setAttempt(a => a + 1) }, [])\n const close = useCallback(() => { setOpen(false) }, [])\n const fit = useMemo(\n () => (variant === 'single' ? singleFit(attachment) : undefined),\n [attachment, variant],\n )\n\n useEffect(() => {\n let live = true\n setError(false)\n setSrc(null)\n void load(attachment).then((url) => { if (live) setSrc(url) }).catch(() => { if (live) setError(true) })\n return () => { live = false }\n }, [attachment, load, attempt])\n\n const label = attachment.name ?? labels.image\n if (error) {\n return <button type=\"button\" style={styles.error} onClick={retry}>{labels.loadFailed}</button>\n }\n const box = fit === undefined ? styles.tile : { width: fit.width, height: fit.height }\n return (\n <>\n <button\n type=\"button\"\n style={{ ...styles.frame, ...box }}\n title={labels.open}\n aria-label={labels.openNamed(label)}\n onClick={() => { if (src !== null) setOpen(true) }}\n >\n {src === null\n ? <span style={styles.loading}>{labels.loading}</span>\n : <img src={src} alt={label} style={{ ...styles.img, objectPosition: fit?.objectPosition }} />}\n </button>\n {open && src !== null && <ImageLightbox src={src} alt={label} labels={labels.lightbox} onClose={close} />}\n </>\n )\n}\n\n/** Wrapping image group: a lone image renders large, several render as 64px\n * square tiles (same rule as the platform gallery). */\nexport function ImageGallery({ images, load, labels }: {\n images: readonly { attachment: ImageAttachmentRef }[]\n load: ImageLoader\n labels: MessageImageLabels\n}) {\n if (images.length === 0) return null\n const variant = images.length === 1 ? 'single' : 'tile'\n return (\n <div style={styles.gallery}>\n {images.map((image, index) => (\n <MessageImage key={`${image.attachment.attachmentId}:${index}`} attachment={image.attachment} load={load} variant={variant} labels={labels} />\n ))}\n </div>\n )\n}\n","/**\n * Keyed toolview for the `image_generate` tool: renders generated images\n * inline in the conversation. The row shows the call's prompt while running\n * and after settling; a settled result with image blocks renders them through\n * this plugin's own ImageGallery (harness rc.8 stopped exporting the platform\n * one as a package value), whose bytes load through the node half's\n * `/subscriptions-auth` RPC channel (the durable ImageAttachmentRef is never\n * a fetchable URL on its own). A text-only settled result (degraded route)\n * renders its text; an error result renders the first error line.\n *\n * The 'tool.call.toolview' slot contract is owned by ui-tool\n * (packages/client/ui-tool/src/client/contract/slots.ts), which this package\n * does not resolve; the SlotMap merge and ToolCallOwnerProps below mirror it\n * structurally (same discipline as platform-modules.d.ts).\n */\nimport type { CSSProperties } from 'react'\nimport type { ConnectionHandle, RpcResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport type { ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client'\nimport { IconSparkle16 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { ImageGallery } from './ImageGallery.js'\nimport type { ImageAttachmentRef, ImageLoader, MessageImageLabels } from './ImageGallery.js'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** Logical RPC channel served by the node half of this plugin. */\nconst SUBSCRIPTIONS_AUTH_CHANNEL = '/subscriptions-auth'\n\n/** Title prompt truncation budget (characters). */\nconst PROMPT_MAX_LENGTH = 60\n\n/** Mirror of ui-tool's ToolCallOwnerProps (see the module header). */\ninterface ToolCallOwnerProps {\n callId: string\n toolName: string\n block: ToolCallBlock\n cwd?: string | undefined\n openFile: (path: string) => void\n inspect?: (() => void) | undefined\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface SlotMap {\n /** Mirror of ui-tool's keyed atomic Tool view declaration (see the module header). */\n 'tool.call.toolview': { kind: 'keyed'; scope: 'session'; owner: ToolCallOwnerProps }\n }\n}\n\n/** Injected dependencies of {@link ImageGenerateToolview} (slot `inject`). */\nexport interface ImageGenerateToolviewInjected {\n /** Session-authorized image URL loader riding the `/subscriptions-auth` channel. */\n load: ImageLoader\n}\n\n/**\n * Props delivered by the toolview outlet: the owner share plus the inject\n * face and the framework locale seat, spread flat.\n */\nexport type ImageGenerateToolviewProps =\n Partial<ToolCallOwnerProps>\n & Partial<ImageGenerateToolviewInjected>\n & { t?: ((key: SubscriptionsKey, params?: Record<string, unknown>) => string) | undefined }\n\n/** `image` endpoint result: the node half owns this shape. */\ninterface ImageEndpointResult {\n mediaType: string\n dataBase64: string\n}\n\n/**\n * Call one `/subscriptions-auth` endpoint and unwrap the business result.\n * @param rpc - Connection RPC caller.\n * @param endpoint - channel-relative endpoint.\n * @param payload - channel-owned request payload.\n * @returns the success value, cast by the caller to the endpoint's shape.\n */\nasync function callSubscriptionsAuth<T>(rpc: ConnectionHandle['rpc'], endpoint: string, payload: unknown): Promise<T> {\n const result: RpcResult<unknown> = await rpc.call(SUBSCRIPTIONS_AUTH_CHANNEL, endpoint, payload)\n if (!result.ok) throw new Error(result.error.message)\n return result.value as T\n}\n\n/**\n * Build the ImageGallery loader over the `image` endpoint.\n * @param rpc - Connection RPC caller.\n * @returns loader resolving an attachment ref to a data URL.\n */\nexport function createImageLoader(rpc: ConnectionHandle['rpc']): ImageLoader {\n // The host validates a full ImageAttachmentRef payload (readImage takes the\n // whole ref), so forward the attachment verbatim.\n return attachment =>\n callSubscriptionsAuth<ImageEndpointResult>(rpc, 'image', { ...attachment })\n .then(result => `data:${result.mediaType};base64,${result.dataBase64}`)\n}\n\n/**\n * English-dictionary fallback for a missing locale seat (standalone renders);\n * the framework always supplies the namespace-bound one.\n * @param key - dictionary key.\n * @param params - `{name}` template params.\n * @returns the template with params substituted.\n */\nfunction fallbackTranslate(key: SubscriptionsKey, params?: Record<string, unknown>): string {\n let text: string = en[key]\n for (const [name, value] of Object.entries(params ?? {})) {\n text = text.replaceAll(`{${name}}`, String(value))\n }\n return text\n}\n\n/** Extract the prompt from the call's raw args JSON; falls back to the first string value, then the raw line. */\nfunction derivePrompt(argsRaw: string): string {\n let parsed: unknown\n try {\n parsed = JSON.parse(argsRaw)\n } catch {\n // Non-JSON args (mid-stream truncation): fall back to the raw string below.\n parsed = undefined\n }\n let prompt: string | undefined\n if (typeof parsed === 'object' && parsed !== null) {\n const args = parsed as Record<string, unknown>\n if (typeof args.prompt === 'string' && args.prompt !== '') prompt = args.prompt\n else {\n for (const value of Object.values(args)) {\n if (typeof value === 'string' && value !== '') { prompt = value; break }\n }\n }\n }\n const line = (prompt ?? argsRaw).split('\\n', 1)[0] ?? ''\n return line.length > PROMPT_MAX_LENGTH ? `${line.slice(0, PROMPT_MAX_LENGTH)}…` : line\n}\n\n/** Flatten a settled result's text blocks (the degraded text-only route and the error line). */\nfunction resultText(block: ToolCallBlock): string {\n if (!('kind' in block)) return ''\n const parts: string[] = []\n for (const part of block.content) {\n if (part.type === 'text') parts.push(part.text)\n }\n if (parts.length === 0 && block.error !== undefined) parts.push(`${block.error.name}: ${block.error.code}`)\n return parts.join('\\n')\n}\n\n/** Image attachments of a settled result; empty while running or on the text-only route. */\nfunction resultImages(block: ToolCallBlock): { attachment: ImageAttachmentRef }[] {\n if (!('kind' in block)) return []\n const images: { attachment: ImageAttachmentRef }[] = []\n for (const part of block.content) {\n if (part.type === 'image') images.push({ attachment: part.attachment as ImageAttachmentRef })\n }\n return images\n}\n\nconst styles: Record<string, CSSProperties> = {\n container: { display: 'flex', flexDirection: 'column', gap: 6, padding: '4px 0' },\n row: { display: 'flex', alignItems: 'center', gap: 6, minWidth: 0 },\n icon: { display: 'inline-flex', flexShrink: 0, color: 'var(--dsw-alias-label-tertiary)' },\n title: {\n fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)',\n overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',\n },\n subtle: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n output: {\n margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)',\n whiteSpace: 'pre-wrap', overflowWrap: 'anywhere',\n },\n error: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-state-error-primary)' },\n}\n\n/**\n * The `image_generate` keyed toolview component.\n * @param props - owner share, inject face, and locale seat (spread flat).\n * @returns the call row plus, once settled, the gallery / text / error body.\n */\nexport function ImageGenerateToolview(props: ImageGenerateToolviewProps) {\n const { block, load } = props\n const t = props.t ?? fallbackTranslate\n if (block === undefined) return null\n const settled = 'kind' in block\n const argsRaw = (settled ? block.call?.argsRaw : block.argsRaw) ?? ''\n const title = `image_generate: ${derivePrompt(argsRaw)}`\n const images = resultImages(block)\n const text = settled ? resultText(block) : ''\n const labels: MessageImageLabels = {\n image: t('image'),\n open: t('viewImage'),\n openNamed: name => t('viewImageNamed', { name }),\n loading: t('imageLoading'),\n loadFailed: t('imageLoadFailed'),\n lightbox: { dialog: t('imagePreview'), close: t('imageClose') },\n }\n return (\n <div style={styles.container}>\n <div style={styles.row}>\n <span style={styles.icon}><IconSparkle16 size={14} /></span>\n <span style={styles.title}>{title}</span>\n </div>\n {!settled && <p style={styles.subtle}>{t('generating')}</p>}\n {settled && block.isError && text !== '' && (\n <p style={styles.error}>{text.split('\\n', 1)[0]}</p>\n )}\n {settled && !block.isError && images.length > 0 && load !== undefined && (\n <ImageGallery images={images} load={load} labels={labels} />\n )}\n {settled && !block.isError && images.length === 0 && text !== '' && (\n <p style={styles.output}>{text}</p>\n )}\n </div>\n )\n}\n","/**\n * Keyed toolview for the `video_generate` tool: renders the generated video\n * inline in the conversation. The row shows the call's prompt while running\n * and after settling; a settled success loads the MP4 bytes through the node\n * half's `/subscriptions-auth` `video` endpoint (by bare file name), builds a\n * Blob URL, and plays it in a native `<video controls>` element. The file\n * name comes from the result's presentation meta when the dispatch was\n * top-level, and is recovered from the \"Saved video to …\" text line for\n * nested (Code Mode) dispatches, where the harness computes no meta. A result\n * with neither renders its text; an error result renders the first error line.\n *\n * The 'tool.call.toolview' SlotMap entry is declared by\n * ImageGenerateToolview.tsx in this same package (one declaration per\n * augmentation), so this file only mirrors the owner-props shape.\n */\nimport { useEffect, useState } from 'react'\nimport type { CSSProperties } from 'react'\nimport type { ConnectionHandle, RpcResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport type { ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client'\nimport { IconSparkle16 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** Logical RPC channel served by the node half of this plugin. */\nconst SUBSCRIPTIONS_AUTH_CHANNEL = '/subscriptions-auth'\n\n/** Title prompt truncation budget (characters). */\nconst PROMPT_MAX_LENGTH = 60\n\n/** Mirror of ui-tool's ToolCallOwnerProps (see ImageGenerateToolview). */\ninterface ToolCallOwnerProps {\n callId: string\n toolName: string\n block: ToolCallBlock\n cwd?: string | undefined\n openFile: (path: string) => void\n inspect?: (() => void) | undefined\n}\n\n/** Decoded video bytes as the node half's `video` endpoint answers them. */\nexport interface VideoBytes {\n mediaType: string\n dataBase64: string\n}\n\n/** Injected dependencies of {@link VideoGenerateToolview} (slot `inject`). */\nexport interface VideoGenerateToolviewInjected {\n /** Loads one generated video's bytes by bare file name. */\n loadVideo: (name: string) => Promise<VideoBytes>\n}\n\n/**\n * Props delivered by the toolview outlet: the owner share plus the inject\n * face and the framework locale seat, spread flat.\n */\nexport type VideoGenerateToolviewProps =\n Partial<ToolCallOwnerProps>\n & Partial<VideoGenerateToolviewInjected>\n & { t?: ((key: SubscriptionsKey, params?: Record<string, unknown>) => string) | undefined }\n\n/**\n * Build the video loader over the `/subscriptions-auth` `video` endpoint.\n * @param rpc - Connection RPC caller.\n * @returns loader resolving a bare file name to the decoded bytes.\n */\nexport function createVideoLoader(rpc: ConnectionHandle['rpc']): (name: string) => Promise<VideoBytes> {\n return async (name) => {\n const result: RpcResult<unknown> = await rpc.call(SUBSCRIPTIONS_AUTH_CHANNEL, 'video', { name })\n if (!result.ok) throw new Error(result.error.message)\n return result.value as VideoBytes\n }\n}\n\n/**\n * English-dictionary fallback for a missing locale seat (standalone renders);\n * the framework always supplies the namespace-bound one.\n */\nfunction fallbackTranslate(key: SubscriptionsKey, params?: Record<string, unknown>): string {\n let text: string = en[key]\n for (const [name, value] of Object.entries(params ?? {})) {\n text = text.replaceAll(`{${name}}`, String(value))\n }\n return text\n}\n\n/** Extract the prompt from the call's raw args JSON; falls back to the first string value, then the raw line. */\nfunction derivePrompt(argsRaw: string): string {\n let parsed: unknown\n try {\n parsed = JSON.parse(argsRaw)\n } catch {\n // Non-JSON args (mid-stream truncation): fall back to the raw string below.\n parsed = undefined\n }\n let prompt: string | undefined\n if (typeof parsed === 'object' && parsed !== null) {\n const args = parsed as Record<string, unknown>\n if (typeof args.prompt === 'string' && args.prompt !== '') prompt = args.prompt\n else {\n for (const value of Object.values(args)) {\n if (typeof value === 'string' && value !== '') { prompt = value; break }\n }\n }\n }\n const line = (prompt ?? argsRaw).split('\\n', 1)[0] ?? ''\n return line.length > PROMPT_MAX_LENGTH ? `${line.slice(0, PROMPT_MAX_LENGTH)}…` : line\n}\n\n/** Flatten a settled result's text blocks (the fallback body and the error line). */\nfunction resultText(block: ToolCallBlock): string {\n if (!('kind' in block)) return ''\n const parts: string[] = []\n for (const part of block.content) {\n if (part.type === 'text') parts.push(part.text)\n }\n if (parts.length === 0 && block.error !== undefined) parts.push(`${block.error.name}: ${block.error.code}`)\n return parts.join('\\n')\n}\n\n/**\n * The generated video's bare file name: presentation meta first (top-level\n * dispatches), then the render text's \"Saved video to …\" line (nested\n * dispatches compute no meta).\n */\nfunction resolveFileName(block: ToolCallBlock): string | undefined {\n if (!('kind' in block)) return undefined\n const meta = block.meta\n if (typeof meta === 'object' && meta !== null) {\n const fileName = (meta as Record<string, unknown>).fileName\n if (typeof fileName === 'string' && fileName.length > 0) return fileName\n }\n const match = /^Saved video to (.+\\.mp4)/m.exec(resultText(block))\n if (match === null) return undefined\n const path = match[1]\n return path.slice(path.lastIndexOf('/') + 1)\n}\n\n/** Decode a base64 payload into bytes (browser-side; no Buffer). */\nfunction base64Bytes(dataBase64: string): Uint8Array {\n const binary = atob(dataBase64)\n const bytes = new Uint8Array(binary.length)\n for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index)\n return bytes\n}\n\n/** Loading lifecycle of the Blob URL. */\ntype LoadState =\n | { phase: 'loading' }\n | { phase: 'ready'; url: string }\n | { phase: 'failed'; message: string }\n\nconst styles: Record<string, CSSProperties> = {\n container: { display: 'flex', flexDirection: 'column', gap: 6, padding: '4px 0' },\n row: { display: 'flex', alignItems: 'center', gap: 6, minWidth: 0 },\n icon: { display: 'inline-flex', flexShrink: 0, color: 'var(--dsw-alias-label-tertiary)' },\n title: {\n fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)',\n overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',\n },\n subtle: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n output: {\n margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)',\n whiteSpace: 'pre-wrap', overflowWrap: 'anywhere',\n },\n error: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-state-error-primary)' },\n video: {\n display: 'block', maxWidth: 480, width: '100%', borderRadius: 8,\n backgroundColor: 'var(--dsw-alias-fill-tertiary)',\n },\n}\n\n/**\n * The `video_generate` keyed toolview component.\n * @param props - owner share, inject face, and locale seat (spread flat).\n * @returns the call row plus, once settled, the player / text / error body.\n */\nexport function VideoGenerateToolview(props: VideoGenerateToolviewProps) {\n const { block, loadVideo } = props\n const t = props.t ?? fallbackTranslate\n const settled = block !== undefined && 'kind' in block\n const isError = settled && block.isError\n const fileName = block !== undefined && settled && !isError ? resolveFileName(block) : undefined\n const [load, setLoad] = useState<LoadState>({ phase: 'loading' })\n\n useEffect(() => {\n if (fileName === undefined || loadVideo === undefined) return\n let cancelled = false\n let objectUrl: string | undefined\n setLoad({ phase: 'loading' })\n loadVideo(fileName).then(\n (video) => {\n if (cancelled) return\n // Uint8Array#slice detaches a plain ArrayBuffer view for BlobPart.\n objectUrl = URL.createObjectURL(new Blob([base64Bytes(video.dataBase64).slice()], { type: video.mediaType }))\n setLoad({ phase: 'ready', url: objectUrl })\n },\n (error: unknown) => {\n if (cancelled) return\n setLoad({ phase: 'failed', message: error instanceof Error ? error.message : String(error) })\n },\n )\n return () => {\n cancelled = true\n if (objectUrl !== undefined) URL.revokeObjectURL(objectUrl)\n }\n }, [fileName, loadVideo])\n\n if (block === undefined) return null\n const argsRaw = (settled ? block.call?.argsRaw : block.argsRaw) ?? ''\n const title = `video_generate: ${derivePrompt(argsRaw)}`\n const text = settled ? resultText(block) : ''\n return (\n <div style={styles.container}>\n <div style={styles.row}>\n <span style={styles.icon}><IconSparkle16 size={14} /></span>\n <span style={styles.title}>{title}</span>\n </div>\n {!settled && <p style={styles.subtle}>{t('generatingVideo')}</p>}\n {settled && isError && text !== '' && (\n <p style={styles.error}>{text.split('\\n', 1)[0]}</p>\n )}\n {settled && !isError && fileName !== undefined && load.phase === 'loading' && (\n <p style={styles.subtle}>{t('videoLoading')}</p>\n )}\n {settled && !isError && fileName !== undefined && load.phase === 'failed' && (\n <p style={styles.error}>{t('videoLoadFailed', { message: load.message })}</p>\n )}\n {settled && !isError && fileName !== undefined && load.phase === 'ready' && (\n // eslint-disable-next-line jsx-a11y/media-has-caption -- generated clip; no caption track exists.\n <video style={styles.video} src={load.url} controls preload=\"metadata\" />\n )}\n {settled && !isError && fileName === undefined && text !== '' && (\n <p style={styles.output}>{text}</p>\n )}\n </div>\n )\n}\n","/**\n * Codex Speed toggle: one small control in the composer's right tool row\n * (`conversation.input.right`), switching the session between standard routing\n * and the fast (priority) service tier — the Codex desktop app's Speed menu.\n * The choice is per session and lives in the node half (in-memory); this\n * component holds only viewing state. The control renders nothing until the\n * first load proves the session's current model is a codex model whose catalog\n * advertises the fast tier.\n *\n * Every color resolves through a `--dsw-alias-*` design token and every\n * user-visible string goes through the locale `t` of the\n * 'settings.subscriptions' namespace, same as the settings section.\n */\nimport { useEffect, useRef, useState } from 'react'\nimport type { CSSProperties } from 'react'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ConnectionHandle, SessionId } from '@deepseek-ai/dsh-api-remotes/client'\nimport { callSubscriptionsAuth } from './SubscriptionsSection.js'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** One session's speed choice: standard routing or the fast (priority) tier. */\nexport type SpeedTier = 'standard' | 'fast'\n\n/** `speed` endpoint value, mirrored from the node half. */\nexport interface SpeedState {\n tier: SpeedTier\n fastModels: string[]\n}\n\n/** What {@link SpeedSelect} renders from: visibility plus the current tier. */\nexport interface SpeedSelectState {\n visible: boolean\n tier: SpeedTier\n}\n\n/** Injected dependencies of {@link SpeedSelect} (slot `inject`, session-bound). */\nexport interface SpeedSelectInjected {\n /** Load the session's speed state; `visible` false keeps the control hidden. */\n loadSpeed: () => Promise<SpeedSelectState>\n /** Set the session's speed tier; resolves false when the write failed. */\n setSpeed: (tier: SpeedTier) => Promise<boolean>\n}\n\n/**\n * Props delivered by the slot outlet: the framework session kit and InputZone\n * owner share (unused — everything arrives session-bound through the inject\n * face), the injected callbacks, and the locale seat.\n */\nexport type SpeedSelectProps = PropsRuntime<'conversation.input.right'>\n & Partial<SpeedSelectInjected>\n & Partial<PropsLocale<'settings.subscriptions'>>\n\n/**\n * The `loadSpeed` half of the inject face: the plugin's own speed state plus\n * the host's current model selection (the visibility gate). A model-RPC\n * failure throws rather than answering \"hidden\" — the caller keeps its last\n * known state, so a transient failure never locks the toggle away.\n *\n * `sessionId` is a plain string: slot and command contexts brand it through\n * different dsh-session copies, and only the API-client boundary needs one.\n */\nexport function createSpeedLoader(\n connection: ConnectionHandle,\n sessionId: string,\n): SpeedSelectInjected['loadSpeed'] {\n return async () => {\n const state = await callSubscriptionsAuth<SpeedState>(connection.rpc, 'speed', { sessionId })\n const { result } = await connection.api.sessions.models({ sessionId: sessionId as SessionId })\n if (!result.ok) throw new Error(`session.models failed: ${result.error.code}: ${result.error.message}`)\n const current = result.value.current\n const visible = current !== null && current.provider === 'codex'\n && state.fastModels.includes(current.model)\n return { visible, tier: state.tier }\n }\n}\n\n/** The `setSpeed` half of the inject face: boolean outcome for the component's busy state. */\nexport function createSpeedSetter(\n connection: ConnectionHandle,\n sessionId: string,\n): SpeedSelectInjected['setSpeed'] {\n return tier => callSubscriptionsAuth(connection.rpc, 'setSpeed', { sessionId, tier })\n .then(() => true, () => false)\n}\n\n/** English-dictionary fallback for a missing inject `t` (standalone renders). */\nfunction fallbackTranslate(key: SubscriptionsKey): string {\n return en[key]\n}\n\nconst TIERS: readonly SpeedTier[] = ['standard', 'fast']\n\n/**\n * The composer Speed control: a trigger reading `速度 · 快速`/`速度 · 标准`\n * that opens a two-row menu (standard/fast with descriptions, check mark on\n * the current tier). Mount and every open reload the host state so a model\n * switch made since the last open self-corrects.\n */\n/** How often the control re-reads the host state (model switches arrive only by asking). */\nconst POLL_INTERVAL_MS = 3000\n\n/**\n * The composer Speed control: a trigger reading `速度 · 快速`/`速度 · 标准`\n * that opens a two-row menu (standard/fast with descriptions, check mark on\n * the current tier). The host pushes nothing on a model switch, so the\n * control re-reads on a slow poll with a single-flight guard; a failed read\n * keeps the last known state, so a transient RPC failure can never lock the\n * toggle away (the earlier mount-only load had no recovery path).\n */\nexport function SpeedSelect({ loadSpeed, setSpeed, t }: SpeedSelectProps) {\n const translate = t ?? fallbackTranslate\n const [state, setState] = useState<SpeedSelectState | null>(null)\n const [open, setOpen] = useState(false)\n const [busy, setBusy] = useState(false)\n const rootRef = useRef<HTMLDivElement | null>(null)\n // The inject face may be re-evaluated (new callback identities) on re-render;\n // the poll effect mounts once and reads through this ref, so identity churn\n // neither resets the interval nor multiplies in-flight loads.\n const loadRef = useRef(loadSpeed)\n loadRef.current = loadSpeed\n\n useEffect(() => {\n if (loadRef.current === undefined) return\n let cancelled = false\n let inflight = false\n const reload = (): void => {\n const load = loadRef.current\n if (load === undefined || inflight) return\n inflight = true\n void load().then(\n (loaded) => { if (!cancelled) setState(loaded) },\n () => { /* keep the last known state; the next tick retries */ },\n ).finally(() => { inflight = false })\n }\n reload()\n const timer = setInterval(reload, POLL_INTERVAL_MS)\n return () => {\n cancelled = true\n clearInterval(timer)\n }\n }, [])\n\n useEffect(() => {\n if (!open) return\n const closeOutside = (event: MouseEvent): void => {\n if (!rootRef.current?.contains(event.target as Node)) setOpen(false)\n }\n document.addEventListener('mousedown', closeOutside)\n return () => { document.removeEventListener('mousedown', closeOutside) }\n }, [open])\n\n if (loadSpeed === undefined || setSpeed === undefined || state === null || !state.visible) {\n return null\n }\n\n const choose = (tier: SpeedTier): void => {\n if (busy) return\n if (tier === state.tier) {\n setOpen(false)\n return\n }\n setBusy(true)\n void setSpeed(tier).then((ok) => {\n setBusy(false)\n if (ok) {\n setState({ visible: true, tier })\n setOpen(false)\n }\n })\n }\n\n const show = (): void => {\n setOpen(true)\n const load = loadRef.current\n if (load === undefined) return\n void load().then(setState, () => { /* keep showing the last good state */ })\n }\n\n const tierName = (tier: SpeedTier): string =>\n translate(tier === 'fast' ? 'speedFast' : 'speedStandard')\n const tierDescription = (tier: SpeedTier): string =>\n translate(tier === 'fast' ? 'speedFastDescription' : 'speedStandardDescription')\n const triggerLabel = `${translate('speed')} · ${tierName(state.tier)}`\n\n return (\n <div\n ref={rootRef}\n style={styles.root}\n onKeyDown={(event) => {\n if (event.key === 'Escape' && open) {\n event.preventDefault()\n setOpen(false)\n }\n }}\n >\n {open && (\n <div style={styles.menu} role=\"menu\" aria-label={translate('speed')}>\n {TIERS.map(tier => (\n <button\n key={tier}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={tier === state.tier}\n style={styles.item}\n disabled={busy}\n onClick={() => { choose(tier) }}\n >\n <span style={styles.itemCheck}>{tier === state.tier ? '✓' : ''}</span>\n <span style={styles.itemText}>\n <span style={styles.itemName}>{tierName(tier)}</span>\n <span style={styles.itemDescription}>{tierDescription(tier)}</span>\n </span>\n </button>\n ))}\n </div>\n )}\n <button\n type=\"button\"\n style={styles.trigger}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n title={triggerLabel}\n disabled={busy}\n onClick={() => {\n if (open) setOpen(false)\n else show()\n }}\n >\n {triggerLabel}\n </button>\n </div>\n )\n}\n\nconst styles: Record<string, CSSProperties> = {\n root: { position: 'relative', display: 'inline-flex' },\n trigger: {\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n background: 'transparent', color: 'var(--dsw-alias-label-secondary)',\n font: 'inherit', fontSize: 12, lineHeight: '18px',\n padding: '2px 8px', cursor: 'pointer', whiteSpace: 'nowrap',\n },\n menu: {\n position: 'absolute', bottom: '100%', right: 0, marginBottom: 4,\n minWidth: 180, padding: 4, zIndex: 20,\n background: 'var(--dsw-alias-bg-layer-1)', border: '1px solid var(--dsw-alias-border-l2)',\n borderRadius: 8, display: 'flex', flexDirection: 'column', gap: 2,\n },\n item: {\n display: 'flex', alignItems: 'flex-start', gap: 6, width: '100%',\n border: 'none', borderRadius: 6, background: 'transparent',\n padding: '6px 8px', cursor: 'pointer', font: 'inherit', textAlign: 'left',\n },\n itemCheck: {\n width: 14, flexShrink: 0, fontSize: 12, lineHeight: '18px',\n color: 'var(--dsw-alias-label-primary)',\n },\n itemText: { display: 'flex', flexDirection: 'column' },\n itemName: { fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-primary)' },\n itemDescription: { fontSize: 11, lineHeight: '16px', color: 'var(--dsw-alias-label-tertiary)' },\n}\n","/**\n * Subscription OAuth login page, browser half. Registers the Subscriptions\n * settings section; every login state fact arrives through the node half's\n * `/subscriptions-auth` RPC channel — this plugin holds no credential state of its\n * own. Section copy rides the client locale service: one 'settings.subscriptions'\n * namespace with zh/en dictionaries, rebound per read so the nav label and\n * page text follow the active locale.\n */\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { ConnectionHandle, SessionId } from '@deepseek-ai/dsh-api-remotes/client'\n// Type-only: pulls the shell's SlotMap merge (the 'settings.section' entry).\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls ui-conversation's SlotMap merge (the 'conversation.input.right' entry).\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: the slash-command registry contract (the /fast contribution).\nimport type { CommandUiContract } from '@deepseek-ai/dsh-client-ui-commands/client'\n// `.js` extension: this package's tsconfig lacks the reference repo's\n// allowImportingTsExtensions/rewriteRelativeImportExtensions pair; under\n// nodenext the .js specifier resolves to the .tsx source (see README note).\nimport { SubscriptionsSection } from './SubscriptionsSection.js'\nimport type { SubscriptionsSectionInjected } from './SubscriptionsSection.js'\nimport { ImageGenerateToolview, createImageLoader } from './ImageGenerateToolview.js'\nimport type { ImageGenerateToolviewInjected } from './ImageGenerateToolview.js'\nimport { VideoGenerateToolview, createVideoLoader } from './VideoGenerateToolview.js'\nimport type { VideoGenerateToolviewInjected } from './VideoGenerateToolview.js'\nimport { SpeedSelect, createSpeedLoader, createSpeedSetter } from './SpeedSelect.js'\nimport type { SpeedSelectInjected } from './SpeedSelect.js'\nimport { en, zh } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\nexport type { SubscriptionsSectionInjected, SubscriptionsSectionProps } from './SubscriptionsSection.js'\nexport type { ImageGenerateToolviewInjected, ImageGenerateToolviewProps } from './ImageGenerateToolview.js'\nexport type { VideoGenerateToolviewInjected, VideoGenerateToolviewProps } from './VideoGenerateToolview.js'\nexport type { SpeedSelectInjected, SpeedSelectProps, SpeedState, SpeedTier } from './SpeedSelect.js'\nexport type { SubscriptionsKey } from './locales.js'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The Subscriptions settings page copy. */\n 'settings.subscriptions': SubscriptionsKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'settings.subscriptions'\n\n/**\n * Required services (cordis fiber inject): `slots` carries the registration\n * seat, `connection` the `/subscriptions-auth` RPC caller, and `locale` the copy\n * dictionaries.\n */\nexport const inject = ['slots', 'connection', 'locale']\n\n/**\n * Register the Subscriptions section once the `settings.section` declaration\n * is on the ledger (the shell's apply order relative to this one is NOT\n * constrained; registration depends on the slot through `slots.inject()`).\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-plugin-subscriptions: copy dictionaries')\n // Settings-shell nudge: the panel (nav title + header row + section body)\n // sits flush against the panel's top edge; push it down a little to leave\n // breathing room. Scoped by the settings panel's own dialog role + nav child\n // so other aria-modal dialogs (e.g. the attachment lightbox) are untouched.\n ctx.effect(() => {\n const style = document.createElement('style')\n style.setAttribute('data-plugin', 'dsh-plugin-subscriptions')\n style.textContent = 'div[role=\"dialog\"][aria-modal=\"true\"]:has(> nav) { padding-top: 14px; }'\n document.head.appendChild(style)\n return () => style.remove()\n }, 'dsh-plugin-subscriptions: settings panel breathing room')\n // The client-runtime Context merge types `connection` as the host handle;\n // in the browser shell the same key holds the full client ConnectionHandle.\n const connection = ctx.get('connection') as unknown as ConnectionHandle\n const t = ctx.locale.bind(NS) as SubscriptionsSectionInjected['t']\n const injected = (): SubscriptionsSectionInjected => ({ rpc: connection.rpc, t })\n ctx.slots.inject('settings.section', () => ctx.slots.register({\n name: 'settings.section',\n id: 'subscriptions',\n order: 90,\n // A thunk re-evaluated per read, so the nav label follows the active locale.\n label: () => t('nav'),\n inject: injected,\n }, SubscriptionsSection))\n\n // The image_generate keyed toolview owns how image calls render inline; its\n // gallery bytes ride the same channel through the injected loader. The\n // framework synthesizes the toolview's own `t` seat from `locale: NS`.\n const toolviewInjected = (): ImageGenerateToolviewInjected => ({ load: createImageLoader(connection.rpc) })\n ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({\n name: 'tool.call.toolview',\n key: 'image_generate',\n locale: NS,\n inject: toolviewInjected,\n }, ImageGenerateToolview))\n\n // The video_generate keyed toolview plays the saved MP4 inline; its bytes\n // ride the same channel's `video` endpoint through the injected loader.\n const videoToolviewInjected = (): VideoGenerateToolviewInjected => ({ loadVideo: createVideoLoader(connection.rpc) })\n ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({\n name: 'tool.call.toolview',\n key: 'video_generate',\n locale: NS,\n inject: videoToolviewInjected,\n }, VideoGenerateToolview))\n\n // The composer Speed toggle (codex fast tier) sits in the right tool row,\n // just left of the model selector; the framework synthesizes its `t` seat\n // from `locale: NS`, and the inject face binds each session's RPC calls.\n ctx.slots.inject('conversation.input.right', () => ctx.slots.register({\n name: 'conversation.input.right',\n id: 'codex-speed',\n order: 0,\n locale: NS,\n inject: (sessionId: SessionId): SpeedSelectInjected => ({\n loadSpeed: createSpeedLoader(connection, sessionId),\n setSpeed: createSpeedSetter(connection, sessionId),\n }),\n }, SpeedSelect))\n\n // The /fast slash command offers the same Standard/Fast choice as a popup.\n // `available` is synchronous and sees only the session id, so the command\n // stays listed everywhere; `options` throws the friendly gate when the\n // session's current model is not a fast-capable codex model (the same\n // in-popup error posture the /model contribution uses for its guards).\n ctx.inject(['commandUi'], (scope) => {\n const command = scope.get('commandUi') as CommandUiContract\n scope.effect(() => command.register({\n name: 'fast',\n description: t('commandFast'),\n available: () => true,\n ui: {\n kind: 'popupSelect',\n options: async (session) => {\n const state = await createSpeedLoader(connection, session.sessionId)()\n if (!state.visible) throw new Error(t('commandFastUnavailable'))\n return ([\n { id: 'standard', label: t('speedStandard'), detail: t('speedStandardDescription') },\n { id: 'fast', label: t('speedFast'), detail: t('speedFastDescription') },\n ] as const).map(option => ({ ...option, active: option.id === state.tier }))\n },\n onSelect: async (option, session) => {\n await createSpeedSetter(connection, session.sessionId)(option.id as 'standard' | 'fast')\n },\n },\n }), 'dsh-plugin-subscriptions: /fast contribution')\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAa,KAAK;CAChB,KAAK;CACL,OAAO;CACP,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KAC1B,MAAM,QAAQ,MAAM,kBAAkB,YAAY,QAAQ,UAAU,EAAE;AACtE,SAAI,CAAC,MAAM,QAAS,OAAM,IAAI,MAAM,EAAE,yBAAyB,CAAC;AAChE,YAAQ,CACN;MAAE,IAAI;MAAY,OAAO,EAAE,gBAAgB;MAAE,QAAQ,EAAE,2BAA2B;MAAE,EACpF;MAAE,IAAI;MAAQ,OAAO,EAAE,YAAY;MAAE,QAAQ,EAAE,uBAAuB;MAAE,CACzE,CAAW,KAAI,YAAW;MAAE,GAAG;MAAQ,QAAQ,OAAO,OAAO,MAAM;MAAM,EAAE;;IAE9E,UAAU,OAAO,QAAQ,YAAY;AACnC,WAAM,kBAAkB,YAAY,QAAQ,UAAU,CAAC,OAAO,GAA0B;;IAE3F;GACF,CAAC,EAAE,+CAA+C;GACnD"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["SUBSCRIPTIONS_AUTH_CHANNEL","POLL_INTERVAL_MS","PROVIDERS: readonly { id: SubscriptionProvider; name: string }[]","result: RpcResult<unknown>","fallbackTranslate","text: string","styles: Record<string, CSSProperties>","window","response: StatusResponse","next: Partial<Record<SubscriptionProvider, ModelDefaultsCatalog>>","styles","styles: Record<string, CSSProperties>","styles","SUBSCRIPTIONS_AUTH_CHANNEL","PROMPT_MAX_LENGTH","callSubscriptionsAuth","result: RpcResult<unknown>","fallbackTranslate","text: string","derivePrompt","parsed: unknown","prompt: string | undefined","resultText","parts: string[]","images: { attachment: ImageAttachmentRef }[]","styles: Record<string, CSSProperties>","labels: MessageImageLabels","styles","IconSparkle16","result: RpcResult<unknown>","fallbackTranslate","text: string","parsed: unknown","prompt: string | undefined","parts: string[]","styles: Record<string, CSSProperties>","objectUrl: string | undefined","styles","IconSparkle16","TIERS: readonly SpeedTier[]","styles: Record<string, CSSProperties>"],"sources":["../src/client/locales.ts","../src/client/SubscriptionsSection.tsx","../src/client/ImageGallery.tsx","../src/client/ImageGenerateToolview.tsx","../src/client/VideoGenerateToolview.tsx","../src/client/SpeedSelect.tsx","../src/client/index.ts"],"sourcesContent":["/** Copy dictionaries for the Subscriptions settings section. */\n\n/** English strings (the key-set source of truth for this pair). */\nexport const en = {\n nav: 'Subscriptions',\n intro: 'Log a subscription provider in or out. Login opens the provider’s authorization page in a new tab; headless setups can paste the callback URL or code instead.',\n unavailable: 'Connection unavailable; subscription status cannot be loaded.',\n checking: 'Checking…',\n loginInProgress: 'Login in progress…',\n notLoggedIn: 'Not logged in',\n loggedInCount: '{count} account(s) connected',\n accountExpires: 'expires {date}',\n defaultBadge: 'Default',\n setDefault: 'Set as default',\n addAccount: 'Add account',\n addAccountOAuth: 'Browser authorization',\n addAccountKeychain: 'Import Claude Code',\n addAccountHint: 'Browser authorization signs in whichever account the browser currently uses — switch accounts there first (or use an incognito window with the manual code below) to add a different one.',\n login: 'Log in',\n cancel: 'Cancel',\n logout: 'Log out',\n logoutAccountConfirm: 'Log out {account} of {provider}?',\n manualSummary: 'Browser flow not working? Paste the callback URL or code',\n manualPlaceholder: 'Paste the callback URL or code',\n submit: 'Submit',\n loginMissingUrl: 'login answered without an authorizeUrl',\n deviceCodePrompt: 'Enter this code on the GitHub verification page:',\n deviceCodeCopy: 'Copy code',\n deviceCodeCopied: 'Copied',\n deviceCodeOpenPage: 'Open GitHub verification page',\n usageTitle: 'Usage',\n usageRefresh: 'Refresh',\n usageLoading: 'Loading usage…',\n usageEmpty: 'No usage windows reported.',\n usageError: 'Usage lookup failed: {message}',\n usageSession: '5-hour window',\n usageWeekly: 'Weekly',\n usageWindow: 'Window',\n usageResets: 'resets {date}',\n usagePlan: 'Plan: {plan}',\n modelDefaultsTitle: 'Default reasoning effort',\n modelDefaultsHint: 'The model picker preselects this level when you switch to the model; models without levels always follow the provider.',\n modelDefaultsFollowProvider: 'Follow provider',\n modelDefaultsNoLevels: '{count} model(s) advertise no reasoning levels and always follow the provider.',\n modelDefaultsLoading: 'Loading models…',\n modelDefaultsLoadFailed: 'Failed to load models: {message}',\n modelDefaultsRetry: 'Retry',\n modelDefaultsSaving: 'Saving…',\n modelDefaultsSaveFailedNamed: 'Save failed for {model}: {message}',\n modelDefaultsSummary: '{total} model(s) · {configured} overridden',\n modelDefaultsSummaryNone: '{total} model(s) · following the provider',\n modelDefaultsSummaryEmpty: 'No model advertises reasoning levels',\n modelDefaultsFilterPlaceholder: 'Filter models',\n modelDefaultsFilterEmpty: 'No model matches “{query}”.',\n generating: 'Generating image…',\n image: 'image',\n viewImage: 'View image',\n viewImageNamed: 'View {name}',\n imageLoading: 'Loading…',\n imageLoadFailed: 'Retry',\n imagePreview: 'Image preview',\n imageClose: 'Close',\n generatingVideo: 'Generating video…',\n videoLoading: 'Loading video…',\n videoLoadFailed: 'Video failed to load: {message}',\n speed: 'Speed',\n speedStandard: 'Standard',\n speedStandardDescription: 'Default speed',\n speedFast: 'Fast',\n speedFastDescription: '1.5x speed, more usage',\n commandFast: 'Switch the Codex speed tier (Standard/Fast)',\n commandFastUnavailable: 'The current model has no fast tier; /fast only works on Codex models whose catalog advertises one',\n proxyTitle: 'Proxy',\n proxyStatusNone: 'Not configured — subscription requests go direct.',\n proxyStatusEnabled: 'Enabled · {url}',\n proxyStatusError: 'Config error: {message}',\n proxyConfigure: 'Configure…',\n proxyDialogTitle: 'Proxy settings',\n proxyDialogClose: 'Close',\n proxyEnabled: 'Route subscription requests through a proxy',\n proxyUrl: 'Proxy URL',\n proxyUrlPlaceholder: 'http://localhost:7890',\n proxyUrlHint: 'HTTP or HTTPS proxy only (Clash/mihomo, v2rayN…); socks is not supported.',\n proxyUsername: 'Username (optional)',\n proxyUsernamePlaceholder: 'Proxy username',\n proxyPassword: 'Password',\n proxyPasswordPlaceholder: 'Leave blank to keep the saved password',\n proxyClearPassword: 'Clear the saved password',\n proxyBypass: 'Bypass hosts',\n proxyBypassPlaceholder: '127.0.0.1, localhost, *.example.com',\n proxyBypassHint: 'Comma-separated hostnames that keep going direct.',\n proxyTest: 'Test',\n proxyTesting: 'Testing…',\n proxyTestOk: 'OK · HTTP {status} · {ms} ms',\n proxyTestOkDirect: 'OK (direct, bypassed) · HTTP {status} · {ms} ms',\n proxyTestFail: 'Failed: {message}',\n proxySave: 'Save',\n proxyCancel: 'Cancel',\n proxySaving: 'Saving…',\n proxyLoading: 'Loading proxy settings…',\n proxyLoadFailed: 'Failed to load proxy settings: {message}',\n proxySaved: 'Saved — new requests use the proxy.',\n proxySaveFailed: 'Save failed: {message}',\n proxyNote: 'Applies to token exchange, model APIs, usage lookups, image/video generation and x_search. The OAuth authorization page opens in your browser and follows the browser/system proxy, not this setting.',\n} satisfies Record<string, string>\n\n/** zh strings, one per {@link en} key. */\nexport const zh = {\n nav: '订阅',\n intro: '在此登录或退出订阅服务商。点击登录会在新标签页打开服务商的授权页面;无浏览器环境可改为粘贴回调 URL 或授权码。',\n unavailable: '连接不可用,无法加载订阅状态。',\n checking: '查询中…',\n loginInProgress: '登录中…',\n notLoggedIn: '未登录',\n loggedInCount: '已连接 {count} 个账号',\n accountExpires: '过期时间 {date}',\n defaultBadge: '默认',\n setDefault: '设为默认',\n addAccount: '添加账号',\n addAccountOAuth: '浏览器授权',\n addAccountKeychain: '导入 Claude Code',\n addAccountHint: '浏览器授权以浏览器当前登录的账号为准;要添加不同账号,请先在浏览器里切换账号,或用无痕窗口走下方手动授权码。',\n login: '登录',\n cancel: '取消',\n logout: '退出登录',\n logoutAccountConfirm: '确定退出 {provider} 的账号 {account} 吗?',\n manualSummary: '浏览器流程无法完成?粘贴回调 URL 或授权码',\n manualPlaceholder: '粘贴回调 URL 或授权码',\n submit: '提交',\n loginMissingUrl: 'login 响应缺少 authorizeUrl',\n deviceCodePrompt: '在 GitHub 验证页面输入此验证码:',\n deviceCodeCopy: '复制验证码',\n deviceCodeCopied: '已复制',\n deviceCodeOpenPage: '打开 GitHub 验证页面',\n usageTitle: '用量',\n usageRefresh: '刷新',\n usageLoading: '用量加载中…',\n usageEmpty: '服务商未返回任何用量窗口。',\n usageError: '用量查询失败:{message}',\n usageSession: '5 小时窗口',\n usageWeekly: '每周',\n usageWindow: '窗口',\n usageResets: '{date} 重置',\n usagePlan: '计划:{plan}',\n modelDefaultsTitle: '默认推理档',\n modelDefaultsHint: '切换到该模型时,模型选择器会预选此档位;没有推理档的模型始终跟随服务商默认。',\n modelDefaultsFollowProvider: '跟随服务商',\n modelDefaultsNoLevels: '{count} 个模型未声明推理档,始终跟随服务商默认。',\n modelDefaultsLoading: '加载模型中…',\n modelDefaultsLoadFailed: '模型加载失败:{message}',\n modelDefaultsRetry: '重试',\n modelDefaultsSaving: '保存中…',\n modelDefaultsSaveFailedNamed: '{model} 保存失败:{message}',\n modelDefaultsSummary: '{total} 个模型 · {configured} 个已覆盖',\n modelDefaultsSummaryNone: '{total} 个模型 · 全部跟随服务商',\n modelDefaultsSummaryEmpty: '没有模型声明推理档',\n modelDefaultsFilterPlaceholder: '筛选模型',\n modelDefaultsFilterEmpty: '没有匹配「{query}」的模型。',\n generating: '正在生成图片…',\n image: '图片',\n viewImage: '查看图片',\n viewImageNamed: '查看 {name}',\n imageLoading: '加载中…',\n imageLoadFailed: '重试',\n imagePreview: '图片预览',\n imageClose: '关闭',\n generatingVideo: '正在生成视频…',\n videoLoading: '视频加载中…',\n videoLoadFailed: '视频加载失败:{message}',\n speed: '速度',\n speedStandard: '标准',\n speedStandardDescription: '默认速度',\n speedFast: '快速',\n speedFastDescription: '约 1.5 倍速度,消耗更多用量',\n commandFast: '切换 Codex 速度档(标准/快速)',\n commandFastUnavailable: '当前模型不支持快速档;/fast 仅对目录声明了 fast tier 的 Codex 模型可用',\n proxyTitle: '代理',\n proxyStatusNone: '未配置 —— 订阅请求直连。',\n proxyStatusEnabled: '已启用 · {url}',\n proxyStatusError: '配置错误:{message}',\n proxyConfigure: '配置…',\n proxyDialogTitle: '代理设置',\n proxyDialogClose: '关闭',\n proxyEnabled: '让订阅相关请求走代理',\n proxyUrl: '代理地址',\n proxyUrlPlaceholder: 'http://localhost:7890',\n proxyUrlHint: '仅支持 HTTP/HTTPS 代理(Clash/mihomo、v2rayN 等);不支持 socks。',\n proxyUsername: '用户名(可选)',\n proxyUsernamePlaceholder: '代理用户名',\n proxyPassword: '密码',\n proxyPasswordPlaceholder: '留空则保留已保存的密码',\n proxyClearPassword: '清除已保存的密码',\n proxyBypass: '绕过主机',\n proxyBypassPlaceholder: '127.0.0.1, localhost, *.example.com',\n proxyBypassHint: '逗号分隔的主机名,这些主机保持直连。',\n proxyTest: '测试',\n proxyTesting: '测试中…',\n proxyTestOk: '成功 · HTTP {status} · {ms} ms',\n proxyTestOkDirect: '成功(直连,已绕过)· HTTP {status} · {ms} ms',\n proxyTestFail: '失败:{message}',\n proxySave: '保存',\n proxyCancel: '取消',\n proxySaving: '保存中…',\n proxyLoading: '代理设置加载中…',\n proxyLoadFailed: '代理设置加载失败:{message}',\n proxySaved: '已保存 —— 后续请求将走代理。',\n proxySaveFailed: '保存失败:{message}',\n proxyNote: '作用于 token 交换、模型 API、用量查询、图片/视频生成与 x_search。OAuth 授权页在浏览器中打开,走的是浏览器/系统代理,不受此设置影响。',\n} satisfies Record<keyof typeof en, string>\n\n/** The Subscriptions namespace key union (en is the key-set source of truth). */\nexport type SubscriptionsKey = keyof typeof en\n","/**\n * Subscriptions settings section: one card per subscription provider with an\n * OAuth login/logout flow driven by the node half's `/subscriptions-auth` RPC\n * channel. Login state lives server-side; the page polls `status` only while\n * a login attempt is busy, so an idle page never polls. All state is local\n * React state — the page has no store.\n *\n * Every color resolves through a `--dsw-alias-*` design token (the ui-theme\n * design-platform.css values flip under `body[data-ds-dark-theme]`), and\n * every user-visible string goes through the locale-bound `t` of the\n * 'settings.subscriptions' namespace. Buttons and inputs take the\n * ModelsSection vocabulary minus hover rules, which inline styles cannot\n * express.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport type { CSSProperties } from 'react'\nimport type { ConnectionHandle, RpcResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** Logical RPC channel served by the node half of this plugin. */\nconst SUBSCRIPTIONS_AUTH_CHANNEL = '/subscriptions-auth'\n\n/** Poll cadence while a provider login attempt is busy. */\nconst POLL_INTERVAL_MS = 2000\n\n/**\n * Model count above which the expanded default-effort list also offers a name\n * filter; below it the list is short enough to scan.\n */\nconst MODEL_FILTER_THRESHOLD = 8\n\n/**\n * Height cap of the expanded default-effort list, in px. Past it the list\n * scrolls internally so a provider with dozens of models cannot stretch the\n * card (roughly 7 rows, which keeps the next card's header on screen).\n */\nconst MODEL_LIST_MAX_HEIGHT = 260\n\n/** Subscription provider ids, fixed by the node half's OAuth adapters. */\nexport type SubscriptionProvider = 'codex' | 'claude' | 'grok' | 'copilot'\n\n/** One logged-in account as answered by the `status` endpoint. */\nexport interface AccountStatus {\n key: string\n account?: string\n expiresAt?: number\n plan?: string\n isDefault: boolean\n}\n\n/** One provider's login state as answered by the `status` endpoint. */\nexport interface ProviderStatus {\n busy: boolean\n accounts: AccountStatus[]\n detail?: string\n}\n\n/** `status` endpoint value: the node half owns this shape. */\ninterface StatusResponse {\n providers: Record<SubscriptionProvider, ProviderStatus>\n}\n\n/** One rate-limit window as answered by the `usage` endpoint. */\nexport interface UsageWindow {\n kind: 'session' | 'weekly' | 'other'\n scope?: string\n usedPercent: number\n resetsAt?: number\n}\n\n/** `usage` endpoint value: the node half owns this shape. */\nexport interface ProviderUsage {\n supported: boolean\n windows?: UsageWindow[]\n plan?: string\n}\n\n/** One model's default-effort picker state as answered by `modelDefaults`. */\nexport interface ModelDefaultView {\n id: string\n name: string\n /** Advertised effort levels, in catalog order (empty when the model has no reasoning). */\n efforts: { id: string; name: string }[]\n /** The user-configured default effort, when set. */\n configured?: string\n}\n\n/** `modelDefaults` endpoint value: one provider's picker state. */\nexport interface ModelDefaultsCatalog {\n provider: SubscriptionProvider\n models: ModelDefaultView[]\n}\n\n/** `proxyGet` endpoint value: the node half owns this shape (no secrets). */\nexport interface ProxyConfigView {\n enabled: boolean\n url: string\n username?: string\n passwordSet: boolean\n bypass: string[]\n error?: string\n}\n\n/** `proxyTest` endpoint value. */\nexport interface ProxyTestResult {\n ok: boolean\n viaProxy: boolean\n status?: number\n latencyMs?: number\n error?: string\n}\n\n/** `login` endpoint value: the URL the user completes OAuth at. */\ninterface LoginResponse {\n authorizeUrl: string\n /** Device-flow providers (copilot): the code the user types at authorizeUrl. */\n userCode?: string\n}\n\n/** Injected dependencies of {@link SubscriptionsSection} (slot `inject`). */\nexport interface SubscriptionsSectionInjected {\n /** Generic logical-RPC caller over the Connection transport. */\n rpc: ConnectionHandle['rpc']\n /** Section copy: translate a 'settings.subscriptions' key with `{name}` template params. */\n t: (key: SubscriptionsKey, params?: Record<string, unknown>) => string\n}\n\n/**\n * Props delivered by the slot outlet: the inject face spread flat (the\n * renderer erases the share boundary at the render call).\n */\nexport type SubscriptionsSectionProps = Partial<SubscriptionsSectionInjected>\n\n/** Card display metadata, in page order (names are brand names, not translated). */\nconst PROVIDERS: readonly { id: SubscriptionProvider; name: string }[] = [\n { id: 'codex', name: 'Codex (ChatGPT)' },\n { id: 'claude', name: 'Claude' },\n { id: 'grok', name: 'Grok (X Premium)' },\n { id: 'copilot', name: 'GitHub Copilot' },\n]\n\n/** Business error returned by the `/subscriptions-auth` channel (error branch message). */\nclass SubscriptionsAuthError extends Error {}\n\n/**\n * Call one `/subscriptions-auth` endpoint and unwrap the business result.\n * Shared by the settings section and the composer Speed toggle.\n * @param rpc - Connection RPC caller.\n * @param endpoint - channel-relative endpoint.\n * @param payload - channel-owned request payload.\n * @returns the success value, cast by the caller to the endpoint's shape.\n */\nexport async function callSubscriptionsAuth<T>(rpc: ConnectionHandle['rpc'], endpoint: string, payload: unknown): Promise<T> {\n let result: RpcResult<unknown>\n try {\n result = await rpc.call(SUBSCRIPTIONS_AUTH_CHANNEL, endpoint, payload)\n } catch (error) {\n // The transport rejected rather than answering; surface the same way.\n throw new SubscriptionsAuthError(error instanceof Error ? error.message : String(error))\n }\n if (!result.ok) throw new SubscriptionsAuthError(result.error.message)\n return result.value as T\n}\n\n/** Human text of an action failure, SubscriptionsAuthError or not. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error)\n}\n\n/** Copy a keyed map without the entries whose key is not in `live`. */\nfunction dropStale<T>(map: Record<string, T>, live: ReadonlySet<string>): Record<string, T> {\n const stale = Object.keys(map).filter(key => !live.has(key))\n if (stale.length === 0) return map\n const next = { ...map }\n for (const key of stale) delete next[key]\n return next\n}\n\n/**\n * English-dictionary fallback for a missing inject `t` (standalone renders);\n * the slot inject always supplies the locale-bound one.\n * @param key - dictionary key.\n * @param params - `{name}` template params.\n * @returns the template with params substituted.\n */\nfunction fallbackTranslate(key: SubscriptionsKey, params?: Record<string, unknown>): string {\n let text: string = en[key]\n for (const [name, value] of Object.entries(params ?? {})) {\n text = text.replaceAll(`{${name}}`, String(value))\n }\n return text\n}\n\nconst styles: Record<string, CSSProperties> = {\n section: {\n display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 560,\n color: 'var(--dsw-alias-label-primary)',\n },\n intro: { margin: 0, color: 'var(--dsw-alias-label-tertiary)', fontSize: 14, lineHeight: '22px' },\n card: {\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 12,\n padding: '12px 14px', display: 'flex', flexDirection: 'column', gap: 6,\n },\n proxyCard: {\n padding: '12px 14px', display: 'flex', flexDirection: 'column', gap: 6,\n },\n separator: { borderTop: '1px solid var(--dsw-alias-border-l2)' },\n cardHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n dot: { width: 8, height: 8, borderRadius: '50%', flexShrink: 0 },\n name: { fontWeight: 500, fontSize: 14, lineHeight: '22px', color: 'var(--dsw-alias-label-primary)' },\n statusLine: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n errorLine: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-state-error-primary)' },\n actions: { display: 'flex', gap: 8, marginTop: 4, alignItems: 'center', flexWrap: 'wrap' },\n button: {\n boxSizing: 'border-box', display: 'inline-flex', alignItems: 'center', justifyContent: 'center',\n height: 28, padding: '0 10px', borderRadius: 14,\n border: '1px solid var(--dsw-alias-border-l2)', background: 'transparent',\n color: 'var(--dsw-alias-label-primary)', font: 'inherit', fontSize: 12, lineHeight: '18px',\n cursor: 'pointer',\n },\n usage: {\n display: 'flex', flexDirection: 'column', gap: 6, marginTop: 4,\n borderTop: '1px solid var(--dsw-alias-border-l2)', paddingTop: 8,\n },\n usageHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n usageTitle: { fontSize: 12, lineHeight: '18px', fontWeight: 500, color: 'var(--dsw-alias-label-secondary)' },\n usagePlan: { fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n usageRefresh: {\n boxSizing: 'border-box', display: 'inline-flex', alignItems: 'center', justifyContent: 'center',\n height: 22, padding: '0 8px', borderRadius: 11, marginLeft: 'auto',\n border: '1px solid var(--dsw-alias-border-l2)', background: 'transparent',\n color: 'var(--dsw-alias-label-secondary)', font: 'inherit', fontSize: 12, lineHeight: '18px',\n cursor: 'pointer',\n },\n usageRow: { display: 'flex', flexDirection: 'column', gap: 3 },\n usageMeta: {\n display: 'flex', justifyContent: 'space-between', gap: 8,\n fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)',\n },\n accountRow: {\n display: 'flex', flexDirection: 'column', gap: 6,\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '8px 10px', marginTop: 4,\n },\n accountHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n accountName: { fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)', userSelect: 'all' },\n starButton: {\n border: 'none', background: 'transparent', padding: 0,\n font: 'inherit', fontSize: 14, lineHeight: '20px', cursor: 'pointer',\n color: 'var(--dsw-alias-state-warn-label)',\n },\n usageTrack: {\n height: 6, borderRadius: 3, overflow: 'hidden',\n background: 'var(--dsw-alias-bg-layer-1)', border: '1px solid var(--dsw-alias-border-l2)',\n },\n usageFill: { height: '100%', borderRadius: 3 },\n defaultEffort: {\n display: 'flex', flexDirection: 'column', gap: 6, marginTop: 4,\n borderTop: '1px solid var(--dsw-alias-border-l2)', paddingTop: 8,\n },\n /** The always-visible disclosure header: title, summary, chevron. */\n defaultEffortToggle: {\n boxSizing: 'border-box', display: 'flex', alignItems: 'center', gap: 8,\n width: '100%', padding: 0, border: 'none', background: 'transparent',\n font: 'inherit', textAlign: 'left', cursor: 'pointer',\n },\n defaultEffortChevron: {\n marginLeft: 'auto', flexShrink: 0, fontSize: 10, lineHeight: '18px',\n color: 'var(--dsw-alias-label-tertiary)',\n },\n /** Body of the expanded disclosure: bounded height so a long catalog scrolls. */\n defaultEffortList: {\n display: 'flex', flexDirection: 'column', gap: 6,\n maxHeight: MODEL_LIST_MAX_HEIGHT, overflowY: 'auto', paddingRight: 2,\n },\n defaultEffortRow: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 },\n defaultEffortName: {\n fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-primary)',\n overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',\n },\n defaultEffortSaving: {\n marginLeft: 'auto', flexShrink: 0,\n fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)',\n },\n defaultEffortSelect: {\n maxWidth: 220, flexShrink: 0, height: 28, boxSizing: 'border-box',\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '0 8px', font: 'inherit', fontSize: 12, lineHeight: '18px',\n background: 'var(--dsw-alias-bg-layer-1)', color: 'var(--dsw-alias-label-primary)',\n },\n defaultEffortFilter: {\n height: 28, width: '100%', boxSizing: 'border-box',\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '0 8px', font: 'inherit', fontSize: 12, lineHeight: '18px',\n background: 'var(--dsw-alias-bg-layer-1)', color: 'var(--dsw-alias-label-primary)',\n },\n manual: { marginTop: 4, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)' },\n manualRow: { display: 'flex', gap: 8, marginTop: 6 },\n manualInput: {\n flex: 1, height: 32, boxSizing: 'border-box',\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '0 10px', font: 'inherit', fontSize: 14, lineHeight: '22px',\n background: 'var(--dsw-alias-bg-layer-1)', color: 'var(--dsw-alias-label-primary)',\n },\n deviceCode: {\n marginTop: 4, display: 'flex', flexDirection: 'column', gap: 6,\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '10px 12px', background: 'var(--dsw-alias-bg-layer-1)',\n },\n deviceCodeText: {\n fontFamily: 'monospace', fontSize: 18, lineHeight: '24px', letterSpacing: 2,\n color: 'var(--dsw-alias-label-primary)', userSelect: 'all',\n },\n proxyField: { display: 'flex', flexDirection: 'column', gap: 4 },\n proxyLabel: { fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)' },\n proxyInput: {\n height: 32, width: '100%', boxSizing: 'border-box',\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n padding: '0 10px', font: 'inherit', fontSize: 14, lineHeight: '22px',\n background: 'var(--dsw-alias-bg-layer-1)', color: 'var(--dsw-alias-label-primary)',\n },\n proxyHint: {\n margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)',\n },\n proxyCheck: {\n display: 'flex', alignItems: 'center', gap: 8,\n fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)', cursor: 'pointer',\n },\n proxyMessage: { margin: 0, fontSize: 12, lineHeight: '18px' },\n proxyActions: { display: 'flex', gap: 8, alignItems: 'center', justifyContent: 'flex-end', marginTop: 2 },\n modalOverlay: {\n position: 'fixed', inset: 0, zIndex: 1000,\n display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16,\n background: 'rgba(0, 0, 0, 0.45)',\n },\n modal: {\n width: 460, maxWidth: '100%', maxHeight: '90vh', overflowY: 'auto',\n boxSizing: 'border-box', display: 'flex', flexDirection: 'column', gap: 12,\n padding: '16px 18px', borderRadius: 12,\n background: 'var(--dsw-alias-bg-layer-1)', border: '1px solid var(--dsw-alias-border-l2)',\n },\n modalHeader: { display: 'flex', alignItems: 'center', gap: 8 },\n modalTitle: { fontWeight: 600, fontSize: 15, lineHeight: '22px', color: 'var(--dsw-alias-label-primary)' },\n}\n\n/** Status dot color for one provider state. */\nfunction dotColor(status: ProviderStatus | undefined): string {\n if (status?.busy === true) return 'var(--dsw-alias-state-warn-label)'\n if ((status?.accounts.length ?? 0) > 0) return 'var(--dsw-alias-state-success-primary)'\n return 'var(--dsw-alias-label-dimmed)'\n}\n\n/**\n * Whether a provider has at least one connected account. Multi-account made\n * \"logged in\" a property of the account list rather than a flag, so every\n * logged-in test goes through this one predicate.\n * @param status - the provider's last reported state, possibly absent.\n * @returns true when the provider serves at least one account.\n */\nfunction hasAccount(status: ProviderStatus | undefined): boolean {\n return (status?.accounts.length ?? 0) > 0\n}\n\n/**\n * One-line status text for one provider state.\n * @param t - section translate.\n * @param status - the provider's last reported state.\n * @returns the localized status line.\n */\nfunction statusText(t: SubscriptionsSectionInjected['t'], status: ProviderStatus | undefined): string {\n if (status === undefined) return t('checking')\n if (status.busy) return t('loginInProgress')\n if (status.accounts.length > 0) return t('loggedInCount', { count: status.accounts.length })\n return t('notLoggedIn')\n}\n\n/**\n * Localized label of one usage window (kind, plus the model scope when named).\n * @param t - section translate.\n * @param window - the reported window.\n * @returns e.g. \"5-hour window\" or \"Weekly · Opus\".\n */\nfunction usageWindowLabel(t: SubscriptionsSectionInjected['t'], window: UsageWindow): string {\n const base = window.kind === 'session'\n ? t('usageSession')\n : window.kind === 'weekly' ? t('usageWeekly') : t('usageWindow')\n return window.scope !== undefined && window.scope !== '' ? `${base} · ${window.scope}` : base\n}\n\n/** Bar fill color: success normally, warn from 80%, error from 95%. */\nfunction usageBarColor(usedPercent: number): string {\n if (usedPercent >= 95) return 'var(--dsw-alias-state-error-primary)'\n if (usedPercent >= 80) return 'var(--dsw-alias-state-warn-label)'\n return 'var(--dsw-alias-state-success-primary)'\n}\n\n/** One-line status text of the proxy config card. */\nfunction proxyStatusText(\n t: SubscriptionsSectionInjected['t'],\n proxy: ProxyConfigView | undefined,\n loadError: string | undefined,\n): string {\n if (loadError !== undefined) return t('proxyLoadFailed', { message: loadError })\n if (proxy === undefined) return t('proxyLoading')\n if (proxy.error !== undefined) return t('proxyStatusError', { message: proxy.error })\n if (proxy.enabled) return t('proxyStatusEnabled', { url: proxy.url })\n return t('proxyStatusNone')\n}\n\n/** Feedback-line color of the proxy dialog. */\nfunction messageColor(tone: 'success' | 'error'): string {\n return tone === 'error'\n ? 'var(--dsw-alias-state-error-primary)'\n : 'var(--dsw-alias-state-success-primary)'\n}\n\n/** What one provider's collapsible default-effort section renders. */\nexport interface ModelDefaultsView {\n /** Models with reasoning levels, after the name filter — one row each. */\n shown: ModelDefaultView[]\n /** Models with reasoning levels before filtering (the header total). */\n total: number\n /** How many of those carry a user override (the header count). */\n overridden: number\n /** Models without reasoning levels: one count line, never a row each. */\n withoutEfforts: number\n /** Whether the list is long enough to deserve a filter box. */\n showFilter: boolean\n}\n\n/**\n * Derive one provider's default-effort section from its catalog and filter.\n * Pure so the collapsed-header counts and the filter stay testable without a\n * DOM: rows come only from models that advertise levels, the count of the rest\n * rides as one line, and the filter matches display name or model id.\n * @param models - the provider's catalog models, or undefined while loading.\n * @param filter - the raw filter input (trimmed and lowercased here).\n * @returns the section's rows and header counts.\n */\nexport function deriveModelDefaultsView(\n models: readonly ModelDefaultView[] | undefined,\n filter: string,\n): ModelDefaultsView {\n const all = models ?? []\n const withEfforts = all.filter(model => model.efforts.length > 0)\n const query = filter.trim().toLowerCase()\n const shown = query === ''\n ? withEfforts\n : withEfforts.filter(model => model.name.toLowerCase().includes(query)\n || model.id.toLowerCase().includes(query))\n return {\n shown,\n total: withEfforts.length,\n overridden: withEfforts.filter(model => model.configured !== undefined).length,\n withoutEfforts: all.length - withEfforts.length,\n showFilter: withEfforts.length > MODEL_FILTER_THRESHOLD,\n }\n}\n\n/** Inputs of the default-effort fetch decision (see {@link shouldFetchModelDefaults}). */\nexport interface ModelDefaultsFetchInput {\n /** Providers that currently have at least one account. */\n loggedIn: readonly SubscriptionProvider[]\n /** Providers whose disclosure is open. */\n open: readonly SubscriptionProvider[]\n /** The account signature the last completed fetch was answered for. */\n loadedFor: string | undefined\n /** The account signature of the current status snapshot. */\n signature: string\n /** Whether the last attempt failed (a failure latches until Retry). */\n failed: boolean\n}\n\n/**\n * Whether the default-effort catalog needs (re)fetching.\n *\n * Fetching is gated on an *attempt* signature rather than on the payload\n * being empty: an empty answer is a legitimate result (a narrowed\n * `config.providers`, or a catalog that is momentarily unavailable), and\n * treating it as \"not loaded yet\" re-ran this effect forever. The signature\n * also covers the accounts, so logging a second provider in refetches\n * instead of leaving that card on the previous answer.\n * @param input - the decision inputs.\n * @returns true when the caller should start a fetch.\n */\nexport function shouldFetchModelDefaults(input: ModelDefaultsFetchInput): boolean {\n if (input.failed) return false\n if (input.loggedIn.length === 0) return false\n // Only an open disclosure pays for the per-model live resolve.\n if (!input.open.some(provider => input.loggedIn.includes(provider))) return false\n return input.loadedFor !== input.signature\n}\n\n/**\n * Stable signature of the accounts a catalog answer depends on. A change\n * means a previous answer is stale (an account arrived or left), so the next\n * open disclosure refetches.\n * @param statuses - the per-provider status snapshot.\n * @returns a signature string, stable across renders with equal accounts.\n */\nexport function modelDefaultsSignature(\n statuses: Partial<Record<SubscriptionProvider, ProviderStatus>>,\n): string {\n return PROVIDERS\n .map(({ id }) => `${id}:${(statuses[id]?.accounts ?? []).map(account => account.key).sort().join(',')}`)\n .join('|')\n}\n\n/**\n * The Subscriptions settings page component.\n * @param props - the slot inject face ({@link SubscriptionsSectionInjected}).\n * @returns the section body, or a notice while the RPC face is absent.\n */\nexport function SubscriptionsSection(props: SubscriptionsSectionProps) {\n const { rpc } = props\n const t = props.t ?? fallbackTranslate\n const [statuses, setStatuses] = useState<Partial<Record<SubscriptionProvider, ProviderStatus>>>({})\n const [errors, setErrors] = useState<Partial<Record<SubscriptionProvider, string>>>({})\n const [manualDrafts, setManualDrafts] = useState<Record<SubscriptionProvider, string>>({\n codex: '', claude: '', grok: '', copilot: '',\n })\n /** Pending device-flow codes (copilot), shown while the attempt polls. */\n const [deviceCodes, setDeviceCodes] = useState<Partial<Record<SubscriptionProvider, { userCode: string; verificationUrl: string }>>>({})\n const [copiedCode, setCopiedCode] = useState<SubscriptionProvider | undefined>(undefined)\n /** Usage snapshots keyed `${provider}:${accountKey}` — every account tracks its own windows. */\n const [usages, setUsages] = useState<Record<string, ProviderUsage>>({})\n const [usageErrors, setUsageErrors] = useState<Record<string, string>>({})\n const [usageLoading, setUsageLoading] = useState<Record<string, boolean>>({})\n const mountedRef = useRef(true)\n const pollersRef = useRef(new Map<SubscriptionProvider, ReturnType<typeof setInterval>>())\n /** Accounts with a `usage` call in flight; guards the auto-fetch effect against re-entry. */\n const usageInflightRef = useRef(new Set<string>())\n /** Proxy config as last answered by `proxyGet`/`proxySet`. */\n const [proxy, setProxy] = useState<ProxyConfigView | undefined>(undefined)\n const [proxyLoadError, setProxyLoadError] = useState<string | undefined>(undefined)\n /** Proxy dialog state (draft fields; the password never pre-fills). */\n const [proxyOpen, setProxyOpen] = useState(false)\n const [proxyEnabled, setProxyEnabled] = useState(false)\n const [proxyUrl, setProxyUrl] = useState('')\n const [proxyUsername, setProxyUsername] = useState('')\n const [proxyPassword, setProxyPassword] = useState('')\n const [proxyClearPassword, setProxyClearPassword] = useState(false)\n const [proxyBypass, setProxyBypass] = useState('')\n const [proxySaving, setProxySaving] = useState(false)\n const [proxyTesting, setProxyTesting] = useState(false)\n const [proxyMessage, setProxyMessage] = useState<{ tone: 'success' | 'error'; text: string } | undefined>(undefined)\n const [proxyTestResult, setProxyTestResult] = useState<ProxyTestResult | undefined>(undefined)\n /** Per-model default-effort picker state as answered by `modelDefaults`. */\n const [modelDefaults, setModelDefaults] = useState<Partial<Record<SubscriptionProvider, ModelDefaultsCatalog>>>({})\n const [modelDefaultsLoading, setModelDefaultsLoading] = useState(false)\n const [modelDefaultsLoadError, setModelDefaultsLoadError] = useState<string | undefined>(undefined)\n /** One set in flight: the `${provider}/${model}` key. */\n const [modelDefaultsSaving, setModelDefaultsSaving] = useState<string | undefined>(undefined)\n /** Per-model save failures, keyed `${provider}/${model}`. */\n const [modelDefaultsSaveErrors, setModelDefaultsSaveErrors] = useState<Record<string, string>>({})\n /** Providers whose default-effort disclosure is open (collapsed by default). */\n const [modelDefaultsOpen, setModelDefaultsOpen] = useState<Partial<Record<SubscriptionProvider, boolean>>>({})\n /** Per-provider name filter of the expanded list. */\n const [modelDefaultsFilters, setModelDefaultsFilters] = useState<Partial<Record<SubscriptionProvider, string>>>({})\n /** Account signature the last completed catalog fetch was answered for. */\n const [modelDefaultsLoadedFor, setModelDefaultsLoadedFor] = useState<string | undefined>(undefined)\n /** Optimistic in-flight selections, keyed `${provider}/${model}` ('' = follow provider). */\n const [modelDefaultsPending, setModelDefaultsPending] = useState<Record<string, string>>({})\n /** Guard the catalog effect against concurrent loads. */\n const modelDefaultsInflightRef = useRef(false)\n\n const setProviderError = useCallback((provider: SubscriptionProvider, message: string | undefined): void => {\n if (!mountedRef.current) return\n setErrors((prev) => {\n const next = { ...prev }\n if (message === undefined) delete next[provider]\n else next[provider] = message\n return next\n })\n }, [])\n\n const stopPolling = useCallback((provider: SubscriptionProvider): void => {\n const poller = pollersRef.current.get(provider)\n if (poller !== undefined) {\n clearInterval(poller)\n pollersRef.current.delete(provider)\n }\n }, [])\n\n /** Refetch every provider's status; stop a provider's poller once its attempt settles. */\n const refresh = useCallback(async (): Promise<void> => {\n if (rpc === undefined) return\n let response: StatusResponse\n try {\n response = await callSubscriptionsAuth<StatusResponse>(rpc, 'status', {})\n } catch {\n // A failed poll must not kill the page; busy providers keep polling and\n // the action paths report their own errors.\n return\n }\n if (!mountedRef.current) return\n setStatuses(response.providers)\n for (const { id } of PROVIDERS) {\n const status = response.providers[id]\n if (status.accounts.length > 0 || !status.busy) {\n stopPolling(id)\n // The attempt settled (success, timeout, or cancel): drop the code card.\n setDeviceCodes((prev) => {\n if (prev[id] === undefined) return prev\n const next = { ...prev }\n delete next[id]\n return next\n })\n }\n }\n }, [rpc, stopPolling])\n\n const startPolling = useCallback((provider: SubscriptionProvider): void => {\n if (pollersRef.current.has(provider)) return\n pollersRef.current.set(provider, setInterval(() => { void refresh() }, POLL_INTERVAL_MS))\n }, [refresh])\n\n // Initial load; every busy provider (e.g. an attempt started before a page\n // reload) resumes polling. Teardown clears pollers and the mounted guard.\n useEffect(() => {\n mountedRef.current = true\n void refresh().then(() => {\n if (!mountedRef.current) return\n setStatuses((current) => {\n for (const { id } of PROVIDERS) {\n if (current[id]?.busy === true) startPolling(id)\n }\n return current\n })\n })\n return () => {\n mountedRef.current = false\n for (const poller of pollersRef.current.values()) clearInterval(poller)\n pollersRef.current.clear()\n }\n }, [refresh, startPolling])\n\n const loadUsage = useCallback(async (provider: SubscriptionProvider, account: string, force = false): Promise<void> => {\n const key = `${provider}:${account}`\n if (rpc === undefined || usageInflightRef.current.has(key)) return\n usageInflightRef.current.add(key)\n setUsageLoading(prev => ({ ...prev, [key]: true }))\n try {\n const usage = await callSubscriptionsAuth<ProviderUsage>(rpc, 'usage', { provider, account, ...force ? { force: true } : {} })\n if (!mountedRef.current) return\n setUsages(prev => ({ ...prev, [key]: usage }))\n setUsageErrors((prev) => {\n const next = { ...prev }\n delete next[key]\n return next\n })\n } catch (error) {\n if (mountedRef.current) setUsageErrors(prev => ({ ...prev, [key]: messageOf(error) }))\n } finally {\n usageInflightRef.current.delete(key)\n if (mountedRef.current) setUsageLoading(prev => ({ ...prev, [key]: false }))\n }\n }, [rpc])\n\n // Fetch usage once an account is logged in; drop the snapshots of accounts\n // that vanished so a re-login refetches. A failed lookup does not auto-retry\n // — the per-account Refresh button is the retry path.\n useEffect(() => {\n const live = new Set<string>()\n for (const { id } of PROVIDERS) {\n for (const account of statuses[id]?.accounts ?? []) {\n const key = `${id}:${account.key}`\n live.add(key)\n if (usages[key] === undefined && usageErrors[key] === undefined) void loadUsage(id, account.key)\n }\n }\n setUsages(prev => dropStale(prev, live))\n setUsageErrors(prev => dropStale(prev, live))\n }, [statuses, usages, usageErrors, loadUsage])\n\n const loadModelDefaultsData = useCallback(async (signature: string): Promise<void> => {\n if (rpc === undefined || modelDefaultsInflightRef.current) return\n modelDefaultsInflightRef.current = true\n setModelDefaultsLoading(true)\n try {\n const catalog = await callSubscriptionsAuth<ModelDefaultsCatalog[]>(rpc, 'modelDefaults', {})\n if (!mountedRef.current) return\n const next: Partial<Record<SubscriptionProvider, ModelDefaultsCatalog>> = {}\n for (const entry of catalog) next[entry.provider] = entry\n setModelDefaults(next)\n setModelDefaultsLoadError(undefined)\n // Latch the answered signature, empty answer included: an empty catalog\n // is a result, not a missing load, and re-deriving \"loaded\" from the\n // payload re-triggered this fetch on every render.\n setModelDefaultsLoadedFor(signature)\n // The shown state is now authoritative; stale per-row failures would\n // otherwise linger next to rows that are correct again.\n setModelDefaultsSaveErrors({})\n } catch (error) {\n if (mountedRef.current) setModelDefaultsLoadError(messageOf(error))\n } finally {\n modelDefaultsInflightRef.current = false\n if (mountedRef.current) setModelDefaultsLoading(false)\n }\n }, [rpc])\n\n // Fetch the default-effort catalogs only once a card's list is expanded: the\n // node half resolves live model info per model, so a collapsed page must not\n // pay for it. One fetch covers every logged-in provider (the node half\n // answers them together), and the levels follow the picker's catalog union\n // across that provider's accounts. The account signature drives refetching,\n // so connecting another provider or account does not leave an open card on\n // the previous answer. Everything resets once the last account logs out.\n useEffect(() => {\n const loggedIn = PROVIDERS.filter(({ id }) => hasAccount(statuses[id])).map(({ id }) => id)\n const signature = modelDefaultsSignature(statuses)\n if (loggedIn.length > 0) {\n const open = PROVIDERS.filter(({ id }) => modelDefaultsOpen[id] === true).map(({ id }) => id)\n if (shouldFetchModelDefaults({\n loggedIn,\n open,\n loadedFor: modelDefaultsLoadedFor,\n signature,\n failed: modelDefaultsLoadError !== undefined,\n })) {\n void loadModelDefaultsData(signature)\n }\n } else if (modelDefaultsLoadedFor !== undefined\n || Object.keys(modelDefaults).length > 0\n || Object.keys(modelDefaultsOpen).length > 0) {\n setModelDefaults({})\n setModelDefaultsSaveErrors({})\n setModelDefaultsLoadError(undefined)\n setModelDefaultsLoadedFor(undefined)\n setModelDefaultsLoading(false)\n setModelDefaultsOpen({})\n setModelDefaultsFilters({})\n }\n }, [\n statuses,\n modelDefaults,\n modelDefaultsOpen,\n modelDefaultsLoadError,\n modelDefaultsLoadedFor,\n loadModelDefaultsData,\n ])\n\n /** Open or close one provider's default-effort disclosure. */\n const toggleModelDefaults = useCallback((provider: SubscriptionProvider): void => {\n setModelDefaultsOpen(prev => ({ ...prev, [provider]: prev[provider] !== true }))\n }, [])\n\n const setModelDefault = useCallback(async (provider: SubscriptionProvider, model: string, effort: string | undefined): Promise<void> => {\n if (rpc === undefined) return\n const key = `${provider}/${model}`\n setModelDefaultsSaving(key)\n // Hold the picked level locally for the duration of the save: the select\n // is controlled by server state, which only updates after the round trip,\n // so without this the row visibly snaps back to \"Follow provider\" (greyed\n // out) mid-save and reads as a rejected change.\n setModelDefaultsPending(prev => ({ ...prev, [key]: effort ?? '' }))\n setModelDefaultsSaveErrors((prev) => {\n const next = { ...prev }\n delete next[key]\n return next\n })\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'setModelDefault', {\n provider,\n model,\n ...(effort === undefined ? {} : { effort }),\n })\n if (!mountedRef.current) return\n setModelDefaults((prev) => {\n const section = prev[provider]\n if (section === undefined) return prev\n return {\n ...prev,\n [provider]: {\n ...section,\n models: section.models.map((entry) => {\n if (entry.id !== model) return entry\n if (effort !== undefined) return { ...entry, configured: effort }\n // Cleared: drop the key rather than keep the stale level, or the\n // select would snap back and the header would keep counting it.\n const { configured: _cleared, ...rest } = entry\n return rest\n }),\n },\n }\n })\n } catch (error) {\n if (mountedRef.current) setModelDefaultsSaveErrors((prev) => ({ ...prev, [key]: messageOf(error) }))\n } finally {\n if (mountedRef.current) {\n setModelDefaultsSaving(current => current === key ? undefined : current)\n // Drop the optimistic value: on success the server state now carries\n // it, on failure the row must fall back to the real stored level\n // rather than keep showing a change that did not land.\n setModelDefaultsPending((prev) => {\n const next = { ...prev }\n delete next[key]\n return next\n })\n }\n }\n }, [rpc])\n\n const login = useCallback(async (provider: SubscriptionProvider, method?: 'oauth' | 'keychain'): Promise<void> => {\n if (rpc === undefined) return\n setProviderError(provider, undefined)\n try {\n const response = await callSubscriptionsAuth<LoginResponse>(rpc, 'login', {\n provider,\n ...method === undefined ? {} : { method },\n })\n if (typeof response.authorizeUrl === 'string' && response.authorizeUrl === '') {\n // Instant login (e.g. imported from Claude Code credentials)\n await refresh()\n return\n }\n if (typeof response.authorizeUrl !== 'string') {\n throw new SubscriptionsAuthError(t('loginMissingUrl'))\n }\n if (!mountedRef.current) return\n // Optimistic busy so Cancel and the manual fallback appear before the first poll tick.\n setStatuses(prev => ({\n ...prev,\n [provider]: { accounts: prev[provider]?.accounts ?? [], ...prev[provider], busy: true },\n }))\n if (typeof response.userCode === 'string' && response.userCode.length > 0) {\n // Device flow: show the code card instead of opening the page blind —\n // the user copies the code first, then opens the verification page.\n setDeviceCodes(prev => ({ ...prev, [provider]: { userCode: response.userCode as string, verificationUrl: response.authorizeUrl } }))\n } else {\n window.open(response.authorizeUrl, '_blank', 'noopener')\n }\n startPolling(provider)\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n }, [rpc, t, setProviderError, startPolling])\n\n const cancel = useCallback(async (provider: SubscriptionProvider): Promise<void> => {\n if (rpc === undefined) return\n stopPolling(provider)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'cancel', { provider })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, stopPolling, setProviderError, refresh])\n\n const submitManual = useCallback(async (provider: SubscriptionProvider): Promise<void> => {\n if (rpc === undefined) return\n const input = manualDrafts[provider].trim()\n if (input === '') return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'manual', { provider, input })\n if (mountedRef.current) setManualDrafts(prev => ({ ...prev, [provider]: '' }))\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, manualDrafts, setProviderError, refresh])\n\n const logout = useCallback(async (provider: SubscriptionProvider, account: string, display: string, name: string): Promise<void> => {\n if (rpc === undefined) return\n if (!window.confirm(t('logoutAccountConfirm', { provider: name, account: display }))) return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'logout', { provider, account })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, t, setProviderError, refresh])\n\n const setDefault = useCallback(async (provider: SubscriptionProvider, account: string): Promise<void> => {\n if (rpc === undefined) return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'setDefault', { provider, account })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, setProviderError, refresh])\n\n const copyDeviceCode = useCallback((provider: SubscriptionProvider, userCode: string): void => {\n void navigator.clipboard?.writeText(userCode).then(() => {\n if (!mountedRef.current) return\n setCopiedCode(provider)\n setTimeout(() => {\n if (mountedRef.current) {\n setCopiedCode(current => current === provider ? undefined : current)\n }\n }, 1500)\n }).catch(() => undefined)\n }, [])\n\n // Proxy configuration: load once on mount; the dialog drives proxySet/proxyTest.\n useEffect(() => {\n if (rpc === undefined) return\n let alive = true\n void callSubscriptionsAuth<ProxyConfigView>(rpc, 'proxyGet', {}).then((view) => {\n if (!alive) return\n setProxy(view)\n setProxyLoadError(undefined)\n }).catch((error) => {\n if (alive) setProxyLoadError(messageOf(error))\n })\n return () => { alive = false }\n }, [rpc])\n\n useEffect(() => {\n if (!proxyOpen) return\n const onKey = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') setProxyOpen(false)\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [proxyOpen])\n\n const openProxyDialog = useCallback((): void => {\n if (proxy === undefined) return\n setProxyEnabled(proxy.enabled)\n setProxyUrl(proxy.url)\n setProxyUsername(proxy.username ?? '')\n setProxyPassword('')\n setProxyClearPassword(false)\n setProxyBypass(proxy.bypass.join(', '))\n setProxyMessage(undefined)\n setProxyTestResult(undefined)\n setProxyOpen(true)\n }, [proxy])\n\n const saveProxy = useCallback(async (): Promise<void> => {\n if (rpc === undefined) return\n setProxySaving(true)\n setProxyMessage(undefined)\n try {\n const view = await callSubscriptionsAuth<ProxyConfigView>(rpc, 'proxySet', {\n enabled: proxyEnabled,\n url: proxyUrl.trim(),\n username: proxyUsername,\n ...proxyClearPassword ? { password: null } : proxyPassword !== '' ? { password: proxyPassword } : {},\n bypass: proxyBypass.split(/[,\\n]/).map(entry => entry.trim()).filter(entry => entry !== ''),\n })\n setProxy(view)\n setProxyLoadError(undefined)\n setProxyMessage({ tone: 'success', text: t('proxySaved') })\n setProxyOpen(false)\n } catch (error) {\n setProxyMessage({ tone: 'error', text: t('proxySaveFailed', { message: messageOf(error) }) })\n } finally {\n setProxySaving(false)\n }\n }, [rpc, proxyEnabled, proxyUrl, proxyUsername, proxyPassword, proxyClearPassword, proxyBypass, t])\n\n const testProxy = useCallback(async (): Promise<void> => {\n if (rpc === undefined || proxyTesting) return\n setProxyTesting(true)\n setProxyTestResult(undefined)\n try {\n // Test the dialog's current inputs (they do not need to be saved first);\n // the host builds a throwaway agent for the probe.\n setProxyTestResult(await callSubscriptionsAuth<ProxyTestResult>(rpc, 'proxyTest', {\n proxy: {\n url: proxyUrl.trim(),\n ...proxyUsername.trim() !== '' ? { username: proxyUsername.trim() } : {},\n ...proxyPassword !== '' ? { password: proxyPassword } : {},\n },\n }))\n } catch (error) {\n setProxyTestResult({ ok: false, viaProxy: false, error: messageOf(error) })\n } finally {\n setProxyTesting(false)\n }\n }, [rpc, proxyTesting, proxyUrl, proxyUsername, proxyPassword])\n\n if (rpc === undefined) {\n return <p style={styles.intro}>{t('unavailable')}</p>\n }\n\n return (\n <div style={styles.section}>\n <p style={styles.intro}>{t('intro')}</p>\n <div style={styles.proxyCard}>\n <div style={styles.cardHeader}>\n <span style={{\n ...styles.dot,\n background: proxy?.enabled === true\n ? 'var(--dsw-alias-state-success-primary)'\n : 'var(--dsw-alias-label-dimmed)',\n }} />\n <span style={styles.name}>{t('proxyTitle')}</span>\n <button\n type=\"button\"\n style={{ ...styles.button, marginLeft: 'auto', flexShrink: 0 }}\n onClick={openProxyDialog}\n >\n {t('proxyConfigure')}\n </button>\n </div>\n <p style={styles.statusLine}>{proxyStatusText(t, proxy, proxyLoadError)}</p>\n </div>\n <div style={styles.separator} />\n {PROVIDERS.map(({ id, name }) => {\n const status = statuses[id]\n const busy = status?.busy === true\n const deviceCode = deviceCodes[id]\n const accounts = status?.accounts ?? []\n return (\n <div key={id} style={styles.card}>\n <div style={styles.cardHeader}>\n <span style={{ ...styles.dot, background: dotColor(status) }} />\n <span style={styles.name}>{name}</span>\n </div>\n <p style={styles.statusLine}>{statusText(t, status)}</p>\n {status?.detail !== undefined && status.detail !== '' && (\n <p style={styles.statusLine}>{status.detail}</p>\n )}\n {errors[id] !== undefined && <p style={styles.errorLine}>{errors[id]}</p>}\n {accounts.map((account) => {\n const usageKey = `${id}:${account.key}`\n const usage = usages[usageKey]\n const usageError = usageErrors[usageKey]\n const display = account.account ?? account.key\n // Providers without a usage endpoint answer supported:false — no block.\n const showUsage = usage?.supported !== false\n && (usage !== undefined || usageError !== undefined || usageLoading[usageKey] === true)\n return (\n <div key={account.key} style={styles.accountRow}>\n <div style={styles.accountHeader}>\n <button\n type=\"button\"\n style={styles.starButton}\n title={account.isDefault ? t('defaultBadge') : t('setDefault')}\n onClick={() => {\n if (!account.isDefault) void setDefault(id, account.key)\n }}\n >\n {account.isDefault ? '★' : '☆'}\n </button>\n <span style={styles.accountName}>{display}</span>\n {account.plan !== undefined && (\n <span style={styles.usagePlan}>{account.plan}</span>\n )}\n {account.expiresAt !== undefined && (\n <span style={styles.statusLine}>\n {t('accountExpires', { date: new Date(account.expiresAt).toLocaleString() })}\n </span>\n )}\n <button\n type=\"button\"\n style={{ ...styles.button, marginLeft: 'auto', flexShrink: 0 }}\n onClick={() => { void logout(id, account.key, display, name) }}\n >\n {t('logout')}\n </button>\n </div>\n {showUsage && (\n <div style={styles.usage}>\n <div style={styles.usageHeader}>\n <span style={styles.usageTitle}>{t('usageTitle')}</span>\n {usage?.plan !== undefined && (\n <span style={styles.usagePlan}>{t('usagePlan', { plan: usage.plan })}</span>\n )}\n <button\n type=\"button\"\n style={{ ...styles.usageRefresh, ...usageLoading[usageKey] === true ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={usageLoading[usageKey] === true}\n onClick={() => { void loadUsage(id, account.key, true) }}\n >\n {t('usageRefresh')}\n </button>\n </div>\n {usage === undefined && usageError === undefined && (\n <p style={styles.statusLine}>{t('usageLoading')}</p>\n )}\n {usageError !== undefined && (\n <p style={styles.errorLine}>{t('usageError', { message: usageError })}</p>\n )}\n {usage?.windows !== undefined && usage.windows.length === 0 && (\n <p style={styles.statusLine}>{t('usageEmpty')}</p>\n )}\n {(usage?.windows ?? []).map((window, index) => {\n const percent = Math.min(100, Math.max(0, window.usedPercent))\n return (\n <div key={index} style={styles.usageRow}>\n <div style={styles.usageMeta}>\n <span>{usageWindowLabel(t, window)}</span>\n <span>\n {`${String(Math.round(percent))}%`}\n {window.resetsAt !== undefined\n && ` · ${t('usageResets', { date: new Date(window.resetsAt).toLocaleString() })}`}\n </span>\n </div>\n <div style={styles.usageTrack}>\n <div style={{ ...styles.usageFill, width: `${String(percent)}%`, background: usageBarColor(percent) }} />\n </div>\n </div>\n )\n })}\n </div>\n )}\n </div>\n )\n })}\n <div style={styles.actions}>\n {!busy && accounts.length === 0 && (\n <button type=\"button\" style={styles.button} onClick={() => { void login(id) }}>\n {t('login')}\n </button>\n )}\n {!busy && accounts.length > 0 && id === 'claude' && (\n <>\n <button type=\"button\" style={styles.button} onClick={() => { void login(id, 'oauth') }}>\n {t('addAccountOAuth')}\n </button>\n <button type=\"button\" style={styles.button} onClick={() => { void login(id, 'keychain') }}>\n {t('addAccountKeychain')}\n </button>\n </>\n )}\n {!busy && accounts.length > 0 && id !== 'claude' && (\n <button type=\"button\" style={styles.button} onClick={() => { void login(id) }}>\n {t('addAccount')}\n </button>\n )}\n {busy && (\n <button type=\"button\" style={styles.button} onClick={() => { void cancel(id) }}>\n {t('cancel')}\n </button>\n )}\n </div>\n {!busy && accounts.length > 0 && (\n <p style={styles.statusLine}>{t('addAccountHint')}</p>\n )}\n {accounts.length > 0 && (() => {\n // Collapsed by default: providers with a large catalog (Copilot\n // lists dozens of models) must not push the page down. The\n // header carries the summary so the collapsed state still says\n // how many models are overridden. The section is per provider,\n // not per account: the override keys off the model id, which the\n // pool shares across a provider's accounts.\n const open = modelDefaultsOpen[id] === true\n const catalog = modelDefaults[id]\n const filter = modelDefaultsFilters[id] ?? ''\n const view = deriveModelDefaultsView(catalog?.models, filter)\n const saveErrors = Object.entries(modelDefaultsSaveErrors).filter(([key]) => key.startsWith(`${id}/`))\n return (\n <div style={styles.defaultEffort}>\n <button\n type=\"button\"\n style={styles.defaultEffortToggle}\n aria-expanded={open}\n onClick={() => { toggleModelDefaults(id) }}\n >\n <span style={styles.usageTitle}>{t('modelDefaultsTitle')}</span>\n <span style={styles.usagePlan}>\n {catalog === undefined\n ? (modelDefaultsLoading ? t('modelDefaultsLoading') : '')\n : view.total === 0\n ? t('modelDefaultsSummaryEmpty')\n : view.overridden === 0\n ? t('modelDefaultsSummaryNone', { total: view.total })\n : t('modelDefaultsSummary', { total: view.total, configured: view.overridden })}\n </span>\n {/* Decoration: `aria-expanded` on the button already\n carries the state, and labelling the glyph only\n appended it to the button's accessible name. */}\n <span style={styles.defaultEffortChevron} aria-hidden=\"true\">\n {open ? '▲' : '▼'}\n </span>\n </button>\n {/* Save failures stay visible while collapsed: a row the user\n cannot see must not swallow its own error. */}\n {saveErrors.map(([key, message]) => (\n // Named: the failing row may be scrolled out of the\n // bounded list, and several anonymous \"Save failed\" lines\n // cannot be told apart.\n <p key={key} style={styles.errorLine} role=\"alert\">\n {t('modelDefaultsSaveFailedNamed', {\n model: catalog?.models.find(entry => `${id}/${entry.id}` === key)?.name\n ?? key.slice(id.length + 1),\n message,\n })}\n </p>\n ))}\n {open && (\n <>\n <p style={styles.statusLine}>{t('modelDefaultsHint')}</p>\n {modelDefaultsLoadError !== undefined && (\n <>\n <p style={styles.errorLine}>{t('modelDefaultsLoadFailed', { message: modelDefaultsLoadError })}</p>\n <div style={styles.actions}>\n <button\n type=\"button\"\n style={styles.button}\n onClick={() => {\n // Clearing the latch lets the effect pick the\n // fetch back up on the next render.\n setModelDefaultsLoadError(undefined)\n }}\n >\n {t('modelDefaultsRetry')}\n </button>\n </div>\n </>\n )}\n {modelDefaultsLoadError === undefined && catalog === undefined && (\n <p style={styles.statusLine}>{t('modelDefaultsLoading')}</p>\n )}\n {view.showFilter && (\n <input\n style={styles.defaultEffortFilter}\n value={filter}\n placeholder={t('modelDefaultsFilterPlaceholder')}\n // The placeholder disappears once the user types, so\n // the name has to live somewhere permanent too.\n aria-label={t('modelDefaultsFilterPlaceholder')}\n onChange={(event) => {\n setModelDefaultsFilters(prev => ({ ...prev, [id]: event.target.value }))\n }}\n />\n )}\n {view.shown.length > 0 && (\n <div style={styles.defaultEffortList}>\n {view.shown.map((model) => {\n const rowKey = `${id}/${model.id}`\n const saving = modelDefaultsSaving === rowKey\n // Ids carry the provider: a model id alone repeats\n // across cards, and duplicate ids break the label\n // association the select relies on.\n const labelId = `dsh-model-default-${id}-${model.id}`\n return (\n <div key={model.id} style={styles.defaultEffortRow}>\n <span id={labelId} style={styles.defaultEffortName} title={model.id}>{model.name}</span>\n {saving && (\n <span style={styles.defaultEffortSaving}>{t('modelDefaultsSaving')}</span>\n )}\n <select\n style={styles.defaultEffortSelect}\n // The row's only accessible name: a sibling\n // span is not associated by adjacency, which\n // left every select announced identically.\n aria-labelledby={labelId}\n value={modelDefaultsPending[rowKey] ?? model.configured ?? ''}\n disabled={saving}\n onChange={(event) => {\n void setModelDefault(id, model.id, event.target.value === '' ? undefined : event.target.value)\n }}\n >\n <option value=\"\">{t('modelDefaultsFollowProvider')}</option>\n {model.efforts.map(effort => (\n <option key={effort.id} value={effort.id}>{effort.name}</option>\n ))}\n </select>\n </div>\n )\n })}\n </div>\n )}\n {catalog !== undefined && view.shown.length === 0 && filter.trim() !== '' && (\n <p style={styles.statusLine}>{t('modelDefaultsFilterEmpty', { query: filter.trim() })}</p>\n )}\n {/* Models without reasoning levels collapse into one\n count line instead of one dead row each. */}\n {view.withoutEfforts > 0 && (\n <p style={styles.statusLine}>{t('modelDefaultsNoLevels', { count: view.withoutEfforts })}</p>\n )}\n </>\n )}\n </div>\n )\n })()}\n {busy && deviceCode !== undefined && (\n <div style={styles.deviceCode}>\n <span style={styles.statusLine}>{t('deviceCodePrompt')}</span>\n <span style={styles.deviceCodeText}>{deviceCode.userCode}</span>\n <div style={styles.actions}>\n <button type=\"button\" style={styles.button} onClick={() => { copyDeviceCode(id, deviceCode.userCode) }}>\n {copiedCode === id ? t('deviceCodeCopied') : t('deviceCodeCopy')}\n </button>\n <button\n type=\"button\"\n style={styles.button}\n onClick={() => { window.open(deviceCode.verificationUrl, '_blank', 'noopener') }}\n >\n {t('deviceCodeOpenPage')}\n </button>\n </div>\n </div>\n )}\n {busy && deviceCode === undefined && (\n <details style={styles.manual}>\n <summary>{t('manualSummary')}</summary>\n <div style={styles.manualRow}>\n <input\n style={styles.manualInput}\n value={manualDrafts[id]}\n placeholder={t('manualPlaceholder')}\n onChange={event => setManualDrafts(prev => ({ ...prev, [id]: event.target.value }))}\n />\n <button type=\"button\" style={styles.button} onClick={() => { void submitManual(id) }}>\n {t('submit')}\n </button>\n </div>\n </details>\n )}\n </div>\n )\n })}\n {proxyOpen && (\n <div style={styles.modalOverlay} onClick={() => setProxyOpen(false)}>\n <div style={styles.modal} onClick={event => event.stopPropagation()}>\n <div style={styles.modalHeader}>\n <span style={styles.modalTitle}>{t('proxyDialogTitle')}</span>\n <button type=\"button\" style={{ ...styles.button, marginLeft: 'auto' }} onClick={() => setProxyOpen(false)}>\n {t('proxyDialogClose')}\n </button>\n </div>\n <label style={styles.proxyCheck}>\n <input type=\"checkbox\" checked={proxyEnabled} onChange={event => setProxyEnabled(event.target.checked)} />\n <span>{t('proxyEnabled')}</span>\n </label>\n <label style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyUrl')}</span>\n <input\n style={styles.proxyInput}\n value={proxyUrl}\n placeholder={t('proxyUrlPlaceholder')}\n onChange={event => setProxyUrl(event.target.value)}\n />\n <p style={styles.proxyHint}>{t('proxyUrlHint')}</p>\n </label>\n <label style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyUsername')}</span>\n <input\n style={styles.proxyInput}\n value={proxyUsername}\n placeholder={t('proxyUsernamePlaceholder')}\n onChange={event => setProxyUsername(event.target.value)}\n />\n </label>\n <div style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyPassword')}</span>\n <input\n type=\"password\"\n style={styles.proxyInput}\n value={proxyPassword}\n placeholder={t('proxyPasswordPlaceholder')}\n onChange={event => setProxyPassword(event.target.value)}\n />\n <label style={styles.proxyCheck}>\n <input\n type=\"checkbox\"\n checked={proxyClearPassword}\n onChange={event => setProxyClearPassword(event.target.checked)}\n />\n <span>{t('proxyClearPassword')}</span>\n </label>\n </div>\n <label style={styles.proxyField}>\n <span style={styles.proxyLabel}>{t('proxyBypass')}</span>\n <input\n style={styles.proxyInput}\n value={proxyBypass}\n placeholder={t('proxyBypassPlaceholder')}\n onChange={event => setProxyBypass(event.target.value)}\n />\n <p style={styles.proxyHint}>{t('proxyBypassHint')}</p>\n </label>\n <p style={styles.proxyHint}>{t('proxyNote')}</p>\n {proxyMessage !== undefined && (\n <p style={{ ...styles.proxyMessage, color: messageColor(proxyMessage.tone) }}>{proxyMessage.text}</p>\n )}\n {proxyTestResult !== undefined && (\n <p style={{\n ...styles.proxyMessage,\n color: proxyTestResult.ok\n ? 'var(--dsw-alias-state-success-primary)'\n : 'var(--dsw-alias-state-error-primary)',\n }}>\n {proxyTestResult.ok\n ? (proxyTestResult.viaProxy\n ? t('proxyTestOk', { status: String(proxyTestResult.status), ms: String(proxyTestResult.latencyMs) })\n : t('proxyTestOkDirect', { status: String(proxyTestResult.status), ms: String(proxyTestResult.latencyMs) }))\n : t('proxyTestFail', { message: proxyTestResult.error ?? '' })}\n </p>\n )}\n <div style={styles.proxyActions}>\n <button\n type=\"button\"\n style={{ ...styles.button, ...proxyTesting ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={proxyTesting}\n onClick={() => { void testProxy() }}\n >\n {proxyTesting ? t('proxyTesting') : t('proxyTest')}\n </button>\n <button\n type=\"button\"\n style={{ ...styles.button, ...proxySaving ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={proxySaving}\n onClick={() => { void saveProxy() }}\n >\n {proxySaving ? t('proxySaving') : t('proxySave')}\n </button>\n <button type=\"button\" style={styles.button} onClick={() => setProxyOpen(false)}>\n {t('proxyCancel')}\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n )\n}\n","/**\n * Plugin-local image gallery for generated-image toolviews.\n *\n * Since web-app rc.8, `@deepseek-ai/dsh-client-ui-attachment`'s browser module\n * exports only its cordis plugin surface (`apply`/`inject`) — the React\n * components are no longer package values, so importing `ImageGallery` from it\n * yields `undefined` at runtime and crashes the toolview inside the slot error\n * boundary (the whole call row disappears). This module re-implements the\n * gallery contract the toolview needs (loader-driven thumbnails, retry on\n * failure, click-to-open lightbox) with the same sizing rules as the platform\n * component, keeping this plugin independent of harness component exports.\n */\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport type { CSSProperties } from 'react'\n\n/**\n * Mirror of ImageAttachmentRef (packages/attachment/attachment/src/types.ts);\n * the brand on attachmentId is compile-time only, so string suffices here.\n */\nexport interface ImageAttachmentRef {\n attachmentId: string\n mediaType: string\n bytes: number\n width: number\n height: number\n name?: string\n}\n\n/** Loads a session-authorized durable image URL (resolves to a data/blob URL). */\nexport type ImageLoader = (attachment: ImageAttachmentRef) => Promise<string>\n\n/** Lightbox strings forwarded to the opened preview. */\nexport interface ImageLightboxLabels {\n dialog: string\n close: string\n}\n\n/** Message-image strings the owner resolves from its own locale namespace. */\nexport interface MessageImageLabels {\n /** Fallback display name for an unnamed image. */\n image: string\n /** Thumbnail tooltip inviting the original-image preview. */\n open: string\n /** Accessible thumbnail label; receives the image's display name. */\n openNamed: (label: string) => string\n /** Loading placeholder shown until bytes resolve. */\n loading: string\n /** Retry-control label shown when the load fails. */\n loadFailed: string\n /** Lightbox strings forwarded to the opened preview. */\n lightbox: ImageLightboxLabels\n}\n\n/** Display box for a lone image (platform rule): long edge 240px with the\n * rendered aspect ratio clamped to [0.25, 4] — the overflow is cropped by\n * `object-fit: cover` — and never upscaled past the image's natural size. The\n * crop anchor keeps the top of very tall images and the left of very wide\n * ones, where the informative content usually starts. */\nfunction singleFit(attachment: ImageAttachmentRef): { width: number; height: number; objectPosition: string } {\n const natural = attachment.width / attachment.height\n const ratio = Math.min(4, Math.max(0.25, natural))\n const box = ratio >= 1 ? { width: 240, height: 240 / ratio } : { width: 240 * ratio, height: 240 }\n const scale = Math.min(1, attachment.width / box.width, attachment.height / box.height)\n return {\n width: Math.max(1, Math.round(box.width * scale)),\n height: Math.max(1, Math.round(box.height * scale)),\n objectPosition: natural < 0.25 ? 'center top' : natural > 4 ? 'left center' : 'center',\n }\n}\n\nconst styles: Record<string, CSSProperties> = {\n gallery: { display: 'flex', flexWrap: 'wrap', gap: 8, justifyContent: 'flex-start' },\n frame: {\n display: 'grid', placeItems: 'center', overflow: 'hidden', padding: 0,\n border: '1px solid var(--dsw-alias-border-l2-darkmode-thin)', borderRadius: 8,\n background: 'var(--dsw-alias-interactive-bg-hover-solid)', cursor: 'zoom-in',\n },\n tile: { width: 64, height: 64 },\n img: { width: '100%', height: '100%', objectFit: 'cover', display: 'block' },\n loading: { fontSize: 12, color: 'var(--dsw-alias-label-tertiary)', padding: '0 8px' },\n error: {\n fontSize: 12, color: 'var(--dsw-alias-state-error-primary)', cursor: 'pointer',\n border: '1px solid var(--dsw-alias-border-l2-darkmode-thin)', borderRadius: 8,\n background: 'transparent', padding: '6px 10px',\n },\n overlay: {\n position: 'fixed', inset: 0, zIndex: 1000, display: 'grid', placeItems: 'center',\n background: 'rgba(0, 0, 0, 0.72)', padding: 24,\n },\n overlayImg: { maxWidth: '92vw', maxHeight: '92vh', objectFit: 'contain', borderRadius: 4 },\n close: {\n position: 'absolute', top: 12, right: 12, width: 32, height: 32, display: 'grid',\n placeItems: 'center', border: 'none', borderRadius: '50%', cursor: 'pointer',\n background: 'rgba(255, 255, 255, 0.16)', color: '#fff', fontSize: 16, lineHeight: 1,\n },\n}\n\n/**\n * Full-viewport original-image preview: backdrop or close-control click and\n * Escape all dismiss; the image itself is inert so a click on it does not\n * fall through to the backdrop dismissal.\n */\nfunction ImageLightbox({ src, alt, labels, onClose }: {\n src: string\n alt: string\n labels: ImageLightboxLabels\n onClose: () => void\n}) {\n useEffect(() => {\n const onKey = (event: KeyboardEvent) => { if (event.key === 'Escape') onClose() }\n window.addEventListener('keydown', onKey)\n return () => { window.removeEventListener('keydown', onKey) }\n }, [onClose])\n return (\n <div role=\"dialog\" aria-label={labels.dialog} style={styles.overlay} onClick={onClose}>\n <img src={src} alt={alt} style={styles.overlayImg} onClick={event => { event.stopPropagation() }} />\n <button type=\"button\" aria-label={labels.close} style={styles.close} onClick={onClose}>×</button>\n </div>\n )\n}\n\n/**\n * Compact history renderer with retryable loading and click-to-open original\n * preview. A lone image renders at its `singleFit` size; an image among\n * several renders as a fixed 64px square tile.\n */\nexport function MessageImage({ attachment, load, variant, labels }: {\n attachment: ImageAttachmentRef\n load: ImageLoader\n variant: 'single' | 'tile'\n labels: MessageImageLabels\n}) {\n const [src, setSrc] = useState<string | null>(null)\n const [error, setError] = useState(false)\n const [open, setOpen] = useState(false)\n // Retry re-arms the one load effect below, so every attempt — first load or\n // retry — runs under the same liveness guard and the same reset.\n const [attempt, setAttempt] = useState(0)\n const retry = useCallback(() => { setAttempt(a => a + 1) }, [])\n const close = useCallback(() => { setOpen(false) }, [])\n const fit = useMemo(\n () => (variant === 'single' ? singleFit(attachment) : undefined),\n [attachment, variant],\n )\n\n useEffect(() => {\n let live = true\n setError(false)\n setSrc(null)\n void load(attachment).then((url) => { if (live) setSrc(url) }).catch(() => { if (live) setError(true) })\n return () => { live = false }\n }, [attachment, load, attempt])\n\n const label = attachment.name ?? labels.image\n if (error) {\n return <button type=\"button\" style={styles.error} onClick={retry}>{labels.loadFailed}</button>\n }\n const box = fit === undefined ? styles.tile : { width: fit.width, height: fit.height }\n return (\n <>\n <button\n type=\"button\"\n style={{ ...styles.frame, ...box }}\n title={labels.open}\n aria-label={labels.openNamed(label)}\n onClick={() => { if (src !== null) setOpen(true) }}\n >\n {src === null\n ? <span style={styles.loading}>{labels.loading}</span>\n : <img src={src} alt={label} style={{ ...styles.img, objectPosition: fit?.objectPosition }} />}\n </button>\n {open && src !== null && <ImageLightbox src={src} alt={label} labels={labels.lightbox} onClose={close} />}\n </>\n )\n}\n\n/** Wrapping image group: a lone image renders large, several render as 64px\n * square tiles (same rule as the platform gallery). */\nexport function ImageGallery({ images, load, labels }: {\n images: readonly { attachment: ImageAttachmentRef }[]\n load: ImageLoader\n labels: MessageImageLabels\n}) {\n if (images.length === 0) return null\n const variant = images.length === 1 ? 'single' : 'tile'\n return (\n <div style={styles.gallery}>\n {images.map((image, index) => (\n <MessageImage key={`${image.attachment.attachmentId}:${index}`} attachment={image.attachment} load={load} variant={variant} labels={labels} />\n ))}\n </div>\n )\n}\n","/**\n * Keyed toolview for the `image_generate` tool: renders generated images\n * inline in the conversation. The row shows the call's prompt while running\n * and after settling; a settled result with image blocks renders them through\n * this plugin's own ImageGallery (harness rc.8 stopped exporting the platform\n * one as a package value), whose bytes load through the node half's\n * `/subscriptions-auth` RPC channel (the durable ImageAttachmentRef is never\n * a fetchable URL on its own). A text-only settled result (degraded route)\n * renders its text; an error result renders the first error line.\n *\n * The 'tool.call.toolview' slot contract is owned by ui-tool\n * (packages/client/ui-tool/src/client/contract/slots.ts), which this package\n * does not resolve; the SlotMap merge and ToolCallOwnerProps below mirror it\n * structurally (same discipline as platform-modules.d.ts).\n */\nimport type { CSSProperties } from 'react'\nimport type { ConnectionHandle, RpcResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport type { ToolCallBlock } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { IconSparkle16 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { ImageGallery } from './ImageGallery.js'\nimport type { ImageAttachmentRef, ImageLoader, MessageImageLabels } from './ImageGallery.js'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** Logical RPC channel served by the node half of this plugin. */\nconst SUBSCRIPTIONS_AUTH_CHANNEL = '/subscriptions-auth'\n\n/** Title prompt truncation budget (characters). */\nconst PROMPT_MAX_LENGTH = 60\n\n/** Mirror of ui-tool's ToolCallOwnerProps (see the module header). */\ninterface ToolCallOwnerProps {\n callId: string\n toolName: string\n block: ToolCallBlock\n cwd?: string | undefined\n openFile: (path: string) => void\n inspect?: (() => void) | undefined\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface SlotMap {\n /** Mirror of ui-tool's keyed atomic Tool view declaration (see the module header). */\n 'tool.call.toolview': { kind: 'keyed'; scope: 'session'; owner: ToolCallOwnerProps }\n }\n}\n\n/** Injected dependencies of {@link ImageGenerateToolview} (slot `inject`). */\nexport interface ImageGenerateToolviewInjected {\n /** Session-authorized image URL loader riding the `/subscriptions-auth` channel. */\n load: ImageLoader\n}\n\n/**\n * Props delivered by the toolview outlet: the owner share plus the inject\n * face and the framework locale seat, spread flat.\n */\nexport type ImageGenerateToolviewProps =\n Partial<ToolCallOwnerProps>\n & Partial<ImageGenerateToolviewInjected>\n & { t?: ((key: SubscriptionsKey, params?: Record<string, unknown>) => string) | undefined }\n\n/** `image` endpoint result: the node half owns this shape. */\ninterface ImageEndpointResult {\n mediaType: string\n dataBase64: string\n}\n\n/**\n * Call one `/subscriptions-auth` endpoint and unwrap the business result.\n * @param rpc - Connection RPC caller.\n * @param endpoint - channel-relative endpoint.\n * @param payload - channel-owned request payload.\n * @returns the success value, cast by the caller to the endpoint's shape.\n */\nasync function callSubscriptionsAuth<T>(rpc: ConnectionHandle['rpc'], endpoint: string, payload: unknown): Promise<T> {\n const result: RpcResult<unknown> = await rpc.call(SUBSCRIPTIONS_AUTH_CHANNEL, endpoint, payload)\n if (!result.ok) throw new Error(result.error.message)\n return result.value as T\n}\n\n/**\n * Build the ImageGallery loader over the `image` endpoint.\n * @param rpc - Connection RPC caller.\n * @returns loader resolving an attachment ref to a data URL.\n */\nexport function createImageLoader(rpc: ConnectionHandle['rpc']): ImageLoader {\n // The host validates a full ImageAttachmentRef payload (readImage takes the\n // whole ref), so forward the attachment verbatim.\n return attachment =>\n callSubscriptionsAuth<ImageEndpointResult>(rpc, 'image', { ...attachment })\n .then(result => `data:${result.mediaType};base64,${result.dataBase64}`)\n}\n\n/**\n * English-dictionary fallback for a missing locale seat (standalone renders);\n * the framework always supplies the namespace-bound one.\n * @param key - dictionary key.\n * @param params - `{name}` template params.\n * @returns the template with params substituted.\n */\nfunction fallbackTranslate(key: SubscriptionsKey, params?: Record<string, unknown>): string {\n let text: string = en[key]\n for (const [name, value] of Object.entries(params ?? {})) {\n text = text.replaceAll(`{${name}}`, String(value))\n }\n return text\n}\n\n/** Extract the prompt from the call's raw args JSON; falls back to the first string value, then the raw line. */\nfunction derivePrompt(argsRaw: string): string {\n let parsed: unknown\n try {\n parsed = JSON.parse(argsRaw)\n } catch {\n // Non-JSON args (mid-stream truncation): fall back to the raw string below.\n parsed = undefined\n }\n let prompt: string | undefined\n if (typeof parsed === 'object' && parsed !== null) {\n const args = parsed as Record<string, unknown>\n if (typeof args.prompt === 'string' && args.prompt !== '') prompt = args.prompt\n else {\n for (const value of Object.values(args)) {\n if (typeof value === 'string' && value !== '') { prompt = value; break }\n }\n }\n }\n const line = (prompt ?? argsRaw).split('\\n', 1)[0] ?? ''\n return line.length > PROMPT_MAX_LENGTH ? `${line.slice(0, PROMPT_MAX_LENGTH)}…` : line\n}\n\n/** Flatten a settled result's text blocks (the degraded text-only route and the error line). */\nfunction resultText(block: ToolCallBlock): string {\n if (!('kind' in block)) return ''\n const parts: string[] = []\n for (const part of block.content) {\n if (part.type === 'text') parts.push(part.text)\n }\n if (parts.length === 0 && block.error !== undefined) parts.push(`${block.error.name}: ${block.error.code}`)\n return parts.join('\\n')\n}\n\n/** Image attachments of a settled result; empty while running or on the text-only route. */\nfunction resultImages(block: ToolCallBlock): { attachment: ImageAttachmentRef }[] {\n if (!('kind' in block)) return []\n const images: { attachment: ImageAttachmentRef }[] = []\n for (const part of block.content) {\n if (part.type === 'image') images.push({ attachment: part.attachment as ImageAttachmentRef })\n }\n return images\n}\n\nconst styles: Record<string, CSSProperties> = {\n container: { display: 'flex', flexDirection: 'column', gap: 6, padding: '4px 0' },\n row: { display: 'flex', alignItems: 'center', gap: 6, minWidth: 0 },\n icon: { display: 'inline-flex', flexShrink: 0, color: 'var(--dsw-alias-label-tertiary)' },\n title: {\n fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)',\n overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',\n },\n subtle: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n output: {\n margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)',\n whiteSpace: 'pre-wrap', overflowWrap: 'anywhere',\n },\n error: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-state-error-primary)' },\n}\n\n/**\n * The `image_generate` keyed toolview component.\n * @param props - owner share, inject face, and locale seat (spread flat).\n * @returns the call row plus, once settled, the gallery / text / error body.\n */\nexport function ImageGenerateToolview(props: ImageGenerateToolviewProps) {\n const { block, load } = props\n const t = props.t ?? fallbackTranslate\n if (block === undefined) return null\n const settled = 'kind' in block\n const argsRaw = (settled ? block.call?.argsRaw : block.argsRaw) ?? ''\n const title = `image_generate: ${derivePrompt(argsRaw)}`\n const images = resultImages(block)\n const text = settled ? resultText(block) : ''\n const labels: MessageImageLabels = {\n image: t('image'),\n open: t('viewImage'),\n openNamed: name => t('viewImageNamed', { name }),\n loading: t('imageLoading'),\n loadFailed: t('imageLoadFailed'),\n lightbox: { dialog: t('imagePreview'), close: t('imageClose') },\n }\n return (\n <div style={styles.container}>\n <div style={styles.row}>\n <span style={styles.icon}><IconSparkle16 size={14} /></span>\n <span style={styles.title}>{title}</span>\n </div>\n {!settled && <p style={styles.subtle}>{t('generating')}</p>}\n {settled && block.isError && text !== '' && (\n <p style={styles.error}>{text.split('\\n', 1)[0]}</p>\n )}\n {settled && !block.isError && images.length > 0 && load !== undefined && (\n <ImageGallery images={images} load={load} labels={labels} />\n )}\n {settled && !block.isError && images.length === 0 && text !== '' && (\n <p style={styles.output}>{text}</p>\n )}\n </div>\n )\n}\n","/**\n * Keyed toolview for the `video_generate` tool: renders the generated video\n * inline in the conversation. The row shows the call's prompt while running\n * and after settling; a settled success loads the MP4 bytes through the node\n * half's `/subscriptions-auth` `video` endpoint (by bare file name), builds a\n * Blob URL, and plays it in a native `<video controls>` element. The file\n * name comes from the result's presentation meta when the dispatch was\n * top-level, and is recovered from the \"Saved video to …\" text line for\n * nested (Code Mode) dispatches, where the harness computes no meta. A result\n * with neither renders its text; an error result renders the first error line.\n *\n * The 'tool.call.toolview' SlotMap entry is declared by\n * ImageGenerateToolview.tsx in this same package (one declaration per\n * augmentation), so this file only mirrors the owner-props shape.\n */\nimport { useEffect, useState } from 'react'\nimport type { CSSProperties } from 'react'\nimport type { ConnectionHandle, RpcResult } from '@deepseek-ai/dsh-api-remotes/client'\nimport type { ToolCallBlock } from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport { IconSparkle16 } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** Logical RPC channel served by the node half of this plugin. */\nconst SUBSCRIPTIONS_AUTH_CHANNEL = '/subscriptions-auth'\n\n/** Title prompt truncation budget (characters). */\nconst PROMPT_MAX_LENGTH = 60\n\n/** Mirror of ui-tool's ToolCallOwnerProps (see ImageGenerateToolview). */\ninterface ToolCallOwnerProps {\n callId: string\n toolName: string\n block: ToolCallBlock\n cwd?: string | undefined\n openFile: (path: string) => void\n inspect?: (() => void) | undefined\n}\n\n/** Decoded video bytes as the node half's `video` endpoint answers them. */\nexport interface VideoBytes {\n mediaType: string\n dataBase64: string\n}\n\n/** Injected dependencies of {@link VideoGenerateToolview} (slot `inject`). */\nexport interface VideoGenerateToolviewInjected {\n /** Loads one generated video's bytes by bare file name. */\n loadVideo: (name: string) => Promise<VideoBytes>\n}\n\n/**\n * Props delivered by the toolview outlet: the owner share plus the inject\n * face and the framework locale seat, spread flat.\n */\nexport type VideoGenerateToolviewProps =\n Partial<ToolCallOwnerProps>\n & Partial<VideoGenerateToolviewInjected>\n & { t?: ((key: SubscriptionsKey, params?: Record<string, unknown>) => string) | undefined }\n\n/**\n * Build the video loader over the `/subscriptions-auth` `video` endpoint.\n * @param rpc - Connection RPC caller.\n * @returns loader resolving a bare file name to the decoded bytes.\n */\nexport function createVideoLoader(rpc: ConnectionHandle['rpc']): (name: string) => Promise<VideoBytes> {\n return async (name) => {\n const result: RpcResult<unknown> = await rpc.call(SUBSCRIPTIONS_AUTH_CHANNEL, 'video', { name })\n if (!result.ok) throw new Error(result.error.message)\n return result.value as VideoBytes\n }\n}\n\n/**\n * English-dictionary fallback for a missing locale seat (standalone renders);\n * the framework always supplies the namespace-bound one.\n */\nfunction fallbackTranslate(key: SubscriptionsKey, params?: Record<string, unknown>): string {\n let text: string = en[key]\n for (const [name, value] of Object.entries(params ?? {})) {\n text = text.replaceAll(`{${name}}`, String(value))\n }\n return text\n}\n\n/** Extract the prompt from the call's raw args JSON; falls back to the first string value, then the raw line. */\nfunction derivePrompt(argsRaw: string): string {\n let parsed: unknown\n try {\n parsed = JSON.parse(argsRaw)\n } catch {\n // Non-JSON args (mid-stream truncation): fall back to the raw string below.\n parsed = undefined\n }\n let prompt: string | undefined\n if (typeof parsed === 'object' && parsed !== null) {\n const args = parsed as Record<string, unknown>\n if (typeof args.prompt === 'string' && args.prompt !== '') prompt = args.prompt\n else {\n for (const value of Object.values(args)) {\n if (typeof value === 'string' && value !== '') { prompt = value; break }\n }\n }\n }\n const line = (prompt ?? argsRaw).split('\\n', 1)[0] ?? ''\n return line.length > PROMPT_MAX_LENGTH ? `${line.slice(0, PROMPT_MAX_LENGTH)}…` : line\n}\n\n/** Flatten a settled result's text blocks (the fallback body and the error line). */\nfunction resultText(block: ToolCallBlock): string {\n if (!('kind' in block)) return ''\n const parts: string[] = []\n for (const part of block.content) {\n if (part.type === 'text') parts.push(part.text)\n }\n if (parts.length === 0 && block.error !== undefined) parts.push(`${block.error.name}: ${block.error.code}`)\n return parts.join('\\n')\n}\n\n/**\n * The generated video's bare file name: presentation meta first (top-level\n * dispatches), then the render text's \"Saved video to …\" line (nested\n * dispatches compute no meta).\n */\nfunction resolveFileName(block: ToolCallBlock): string | undefined {\n if (!('kind' in block)) return undefined\n const meta = block.meta\n if (typeof meta === 'object' && meta !== null) {\n const fileName = (meta as Record<string, unknown>).fileName\n if (typeof fileName === 'string' && fileName.length > 0) return fileName\n }\n const match = /^Saved video to (.+\\.mp4)/m.exec(resultText(block))\n if (match === null) return undefined\n const path = match[1]\n return path.slice(path.lastIndexOf('/') + 1)\n}\n\n/** Decode a base64 payload into bytes (browser-side; no Buffer). */\nfunction base64Bytes(dataBase64: string): Uint8Array {\n const binary = atob(dataBase64)\n const bytes = new Uint8Array(binary.length)\n for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index)\n return bytes\n}\n\n/** Loading lifecycle of the Blob URL. */\ntype LoadState =\n | { phase: 'loading' }\n | { phase: 'ready'; url: string }\n | { phase: 'failed'; message: string }\n\nconst styles: Record<string, CSSProperties> = {\n container: { display: 'flex', flexDirection: 'column', gap: 6, padding: '4px 0' },\n row: { display: 'flex', alignItems: 'center', gap: 6, minWidth: 0 },\n icon: { display: 'inline-flex', flexShrink: 0, color: 'var(--dsw-alias-label-tertiary)' },\n title: {\n fontSize: 13, lineHeight: '20px', color: 'var(--dsw-alias-label-primary)',\n overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',\n },\n subtle: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-tertiary)' },\n output: {\n margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-secondary)',\n whiteSpace: 'pre-wrap', overflowWrap: 'anywhere',\n },\n error: { margin: 0, fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-state-error-primary)' },\n video: {\n display: 'block', maxWidth: 480, width: '100%', borderRadius: 8,\n backgroundColor: 'var(--dsw-alias-fill-tertiary)',\n },\n}\n\n/**\n * The `video_generate` keyed toolview component.\n * @param props - owner share, inject face, and locale seat (spread flat).\n * @returns the call row plus, once settled, the player / text / error body.\n */\nexport function VideoGenerateToolview(props: VideoGenerateToolviewProps) {\n const { block, loadVideo } = props\n const t = props.t ?? fallbackTranslate\n const settled = block !== undefined && 'kind' in block\n const isError = settled && block.isError\n const fileName = block !== undefined && settled && !isError ? resolveFileName(block) : undefined\n const [load, setLoad] = useState<LoadState>({ phase: 'loading' })\n\n useEffect(() => {\n if (fileName === undefined || loadVideo === undefined) return\n let cancelled = false\n let objectUrl: string | undefined\n setLoad({ phase: 'loading' })\n loadVideo(fileName).then(\n (video) => {\n if (cancelled) return\n // Uint8Array#slice detaches a plain ArrayBuffer view for BlobPart.\n objectUrl = URL.createObjectURL(new Blob([base64Bytes(video.dataBase64).slice()], { type: video.mediaType }))\n setLoad({ phase: 'ready', url: objectUrl })\n },\n (error: unknown) => {\n if (cancelled) return\n setLoad({ phase: 'failed', message: error instanceof Error ? error.message : String(error) })\n },\n )\n return () => {\n cancelled = true\n if (objectUrl !== undefined) URL.revokeObjectURL(objectUrl)\n }\n }, [fileName, loadVideo])\n\n if (block === undefined) return null\n const argsRaw = (settled ? block.call?.argsRaw : block.argsRaw) ?? ''\n const title = `video_generate: ${derivePrompt(argsRaw)}`\n const text = settled ? resultText(block) : ''\n return (\n <div style={styles.container}>\n <div style={styles.row}>\n <span style={styles.icon}><IconSparkle16 size={14} /></span>\n <span style={styles.title}>{title}</span>\n </div>\n {!settled && <p style={styles.subtle}>{t('generatingVideo')}</p>}\n {settled && isError && text !== '' && (\n <p style={styles.error}>{text.split('\\n', 1)[0]}</p>\n )}\n {settled && !isError && fileName !== undefined && load.phase === 'loading' && (\n <p style={styles.subtle}>{t('videoLoading')}</p>\n )}\n {settled && !isError && fileName !== undefined && load.phase === 'failed' && (\n <p style={styles.error}>{t('videoLoadFailed', { message: load.message })}</p>\n )}\n {settled && !isError && fileName !== undefined && load.phase === 'ready' && (\n // eslint-disable-next-line jsx-a11y/media-has-caption -- generated clip; no caption track exists.\n <video style={styles.video} src={load.url} controls preload=\"metadata\" />\n )}\n {settled && !isError && fileName === undefined && text !== '' && (\n <p style={styles.output}>{text}</p>\n )}\n </div>\n )\n}\n","/**\n * Codex Speed toggle: one small control in the composer's right tool row\n * (`conversation.input.right`), switching the session between standard routing\n * and the fast (priority) service tier — the Codex desktop app's Speed menu.\n * The choice is per session and lives in the node half (in-memory); this\n * component holds only viewing state. The control renders nothing until the\n * first load proves the session's current model is a codex model whose catalog\n * advertises the fast tier.\n *\n * Every color resolves through a `--dsw-alias-*` design token and every\n * user-visible string goes through the locale `t` of the\n * 'settings.subscriptions' namespace, same as the settings section.\n */\nimport { useEffect, useRef, useState } from 'react'\nimport type { CSSProperties } from 'react'\nimport type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-api-remotes/client'\nimport { callSubscriptionsAuth } from './SubscriptionsSection.js'\nimport { en } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\n/** One session's speed choice: standard routing or the fast (priority) tier. */\nexport type SpeedTier = 'standard' | 'fast'\n\n/** `speed` endpoint value, mirrored from the node half. */\nexport interface SpeedState {\n tier: SpeedTier\n fastModels: string[]\n}\n\n/** What {@link SpeedSelect} renders from: visibility plus the current tier. */\nexport interface SpeedSelectState {\n visible: boolean\n tier: SpeedTier\n}\n\n/**\n * Minimal structural face of ui-model-selection's `ctx.modelDirectories`\n * service (the sanctioned cross-plugin channel: cordis services, not value\n * imports — same mirroring discipline as ToolCallOwnerProps). Both dsh lines\n * ship it with this shape; it replaces rc.2's `connection.api.sessions.models`\n * read, which the 0.1.2-alpha removed along with the whole `.api` face.\n */\nexport interface ModelDirectoriesLike {\n /** Resolve one session's shared model directory (throws for unknown sessions). */\n directoryFor(sessionId: string): {\n /** Load the directory; `current` is the session's effective model selection. */\n load(): Promise<{ current: { provider: string; model: string } | null }>\n }\n}\n\n/** Injected dependencies of {@link SpeedSelect} (slot `inject`, session-bound). */\nexport interface SpeedSelectInjected {\n /** Load the session's speed state; `visible` false keeps the control hidden. */\n loadSpeed: () => Promise<SpeedSelectState>\n /** Set the session's speed tier; resolves false when the write failed. */\n setSpeed: (tier: SpeedTier) => Promise<boolean>\n}\n\n/**\n * Props delivered by the slot outlet: the framework session kit and InputZone\n * owner share (unused — everything arrives session-bound through the inject\n * face), the injected callbacks, and the locale seat.\n */\nexport type SpeedSelectProps = PropsRuntime<'conversation.input.right'>\n & Partial<SpeedSelectInjected>\n & Partial<PropsLocale<'settings.subscriptions'>>\n\n/**\n * The `loadSpeed` half of the inject face: the plugin's own speed state plus\n * the host's current model selection (the visibility gate). A model-RPC\n * failure throws rather than answering \"hidden\" — the caller keeps its last\n * known state, so a transient failure never locks the toggle away.\n *\n * `sessionId` is a plain string: slot and command contexts brand it through\n * different dsh-session copies, and only the service boundary needs one.\n *\n * `models` resolves lazily per call: the ui-model-selection service may\n * register after this plugin applies, and a shell without it (no model seat\n * at all) simply keeps the toggle hidden.\n */\nexport function createSpeedLoader(\n connection: ConnectionHandle,\n models: () => ModelDirectoriesLike | undefined,\n sessionId: string,\n): SpeedSelectInjected['loadSpeed'] {\n return async () => {\n const state = await callSubscriptionsAuth<SpeedState>(connection.rpc, 'speed', { sessionId })\n const directories = models()\n if (directories === undefined) return { visible: false, tier: state.tier }\n const { current } = await directories.directoryFor(sessionId).load()\n const visible = current !== null && current.provider === 'codex'\n && state.fastModels.includes(current.model)\n return { visible, tier: state.tier }\n }\n}\n\n/** The `setSpeed` half of the inject face: boolean outcome for the component's busy state. */\nexport function createSpeedSetter(\n connection: ConnectionHandle,\n sessionId: string,\n): SpeedSelectInjected['setSpeed'] {\n return tier => callSubscriptionsAuth(connection.rpc, 'setSpeed', { sessionId, tier })\n .then(() => true, () => false)\n}\n\n/** English-dictionary fallback for a missing inject `t` (standalone renders). */\nfunction fallbackTranslate(key: SubscriptionsKey): string {\n return en[key]\n}\n\nconst TIERS: readonly SpeedTier[] = ['standard', 'fast']\n\n/**\n * The composer Speed control: a trigger reading `速度 · 快速`/`速度 · 标准`\n * that opens a two-row menu (standard/fast with descriptions, check mark on\n * the current tier). Mount and every open reload the host state so a model\n * switch made since the last open self-corrects.\n */\n/** How often the control re-reads the host state (model switches arrive only by asking). */\nconst POLL_INTERVAL_MS = 3000\n\n/**\n * The composer Speed control: a trigger reading `速度 · 快速`/`速度 · 标准`\n * that opens a two-row menu (standard/fast with descriptions, check mark on\n * the current tier). The host pushes nothing on a model switch, so the\n * control re-reads on a slow poll with a single-flight guard; a failed read\n * keeps the last known state, so a transient RPC failure can never lock the\n * toggle away (the earlier mount-only load had no recovery path).\n */\nexport function SpeedSelect({ loadSpeed, setSpeed, t }: SpeedSelectProps) {\n const translate = t ?? fallbackTranslate\n const [state, setState] = useState<SpeedSelectState | null>(null)\n const [open, setOpen] = useState(false)\n const [busy, setBusy] = useState(false)\n const rootRef = useRef<HTMLDivElement | null>(null)\n // The inject face may be re-evaluated (new callback identities) on re-render;\n // the poll effect mounts once and reads through this ref, so identity churn\n // neither resets the interval nor multiplies in-flight loads.\n const loadRef = useRef(loadSpeed)\n loadRef.current = loadSpeed\n\n useEffect(() => {\n if (loadRef.current === undefined) return\n let cancelled = false\n let inflight = false\n const reload = (): void => {\n const load = loadRef.current\n if (load === undefined || inflight) return\n inflight = true\n void load().then(\n (loaded) => { if (!cancelled) setState(loaded) },\n () => { /* keep the last known state; the next tick retries */ },\n ).finally(() => { inflight = false })\n }\n reload()\n const timer = setInterval(reload, POLL_INTERVAL_MS)\n return () => {\n cancelled = true\n clearInterval(timer)\n }\n }, [])\n\n useEffect(() => {\n if (!open) return\n const closeOutside = (event: MouseEvent): void => {\n if (!rootRef.current?.contains(event.target as Node)) setOpen(false)\n }\n document.addEventListener('mousedown', closeOutside)\n return () => { document.removeEventListener('mousedown', closeOutside) }\n }, [open])\n\n if (loadSpeed === undefined || setSpeed === undefined || state === null || !state.visible) {\n return null\n }\n\n const choose = (tier: SpeedTier): void => {\n if (busy) return\n if (tier === state.tier) {\n setOpen(false)\n return\n }\n setBusy(true)\n void setSpeed(tier).then((ok) => {\n setBusy(false)\n if (ok) {\n setState({ visible: true, tier })\n setOpen(false)\n }\n })\n }\n\n const show = (): void => {\n setOpen(true)\n const load = loadRef.current\n if (load === undefined) return\n void load().then(setState, () => { /* keep showing the last good state */ })\n }\n\n const tierName = (tier: SpeedTier): string =>\n translate(tier === 'fast' ? 'speedFast' : 'speedStandard')\n const tierDescription = (tier: SpeedTier): string =>\n translate(tier === 'fast' ? 'speedFastDescription' : 'speedStandardDescription')\n const triggerLabel = `${translate('speed')} · ${tierName(state.tier)}`\n\n return (\n <div\n ref={rootRef}\n style={styles.root}\n onKeyDown={(event) => {\n if (event.key === 'Escape' && open) {\n event.preventDefault()\n setOpen(false)\n }\n }}\n >\n {open && (\n <div style={styles.menu} role=\"menu\" aria-label={translate('speed')}>\n {TIERS.map(tier => (\n <button\n key={tier}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={tier === state.tier}\n style={styles.item}\n disabled={busy}\n onClick={() => { choose(tier) }}\n >\n <span style={styles.itemCheck}>{tier === state.tier ? '✓' : ''}</span>\n <span style={styles.itemText}>\n <span style={styles.itemName}>{tierName(tier)}</span>\n <span style={styles.itemDescription}>{tierDescription(tier)}</span>\n </span>\n </button>\n ))}\n </div>\n )}\n <button\n type=\"button\"\n style={styles.trigger}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n title={triggerLabel}\n disabled={busy}\n onClick={() => {\n if (open) setOpen(false)\n else show()\n }}\n >\n {triggerLabel}\n </button>\n </div>\n )\n}\n\nconst styles: Record<string, CSSProperties> = {\n root: { position: 'relative', display: 'inline-flex' },\n trigger: {\n border: '1px solid var(--dsw-alias-border-l2)', borderRadius: 8,\n background: 'transparent', color: 'var(--dsw-alias-label-secondary)',\n font: 'inherit', fontSize: 12, lineHeight: '18px',\n padding: '2px 8px', cursor: 'pointer', whiteSpace: 'nowrap',\n },\n menu: {\n position: 'absolute', bottom: '100%', right: 0, marginBottom: 4,\n minWidth: 180, padding: 4, zIndex: 20,\n background: 'var(--dsw-alias-bg-layer-1)', border: '1px solid var(--dsw-alias-border-l2)',\n borderRadius: 8, display: 'flex', flexDirection: 'column', gap: 2,\n },\n item: {\n display: 'flex', alignItems: 'flex-start', gap: 6, width: '100%',\n border: 'none', borderRadius: 6, background: 'transparent',\n padding: '6px 8px', cursor: 'pointer', font: 'inherit', textAlign: 'left',\n },\n itemCheck: {\n width: 14, flexShrink: 0, fontSize: 12, lineHeight: '18px',\n color: 'var(--dsw-alias-label-primary)',\n },\n itemText: { display: 'flex', flexDirection: 'column' },\n itemName: { fontSize: 12, lineHeight: '18px', color: 'var(--dsw-alias-label-primary)' },\n itemDescription: { fontSize: 11, lineHeight: '16px', color: 'var(--dsw-alias-label-tertiary)' },\n}\n","/**\n * Subscription OAuth login page, browser half. Registers the Subscriptions\n * settings section; every login state fact arrives through the node half's\n * `/subscriptions-auth` RPC channel — this plugin holds no credential state of its\n * own. Section copy rides the client locale service: one 'settings.subscriptions'\n * namespace with zh/en dictionaries, rebound per read so the nav label and\n * page text follow the active locale.\n */\n// Type-only: pulls the `ctx.slots` Context merge (dsh-client-runtime owned it\n// on rc.2; ui-renderer's augmentation carries it on the 0.1.2-alpha line).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type { ConnectionHandle } from '@deepseek-ai/dsh-api-remotes/client'\n// Type-only: pulls the shell's SlotMap merge (the 'settings.section' entry).\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\n// Type-only: pulls ui-conversation's SlotMap merge (the 'conversation.input.right' entry).\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: the slash-command registry contract (the /fast contribution).\nimport type { CommandUiContract } from '@deepseek-ai/dsh-client-ui-commands/client'\n// `.js` extension: this package's tsconfig lacks the reference repo's\n// allowImportingTsExtensions/rewriteRelativeImportExtensions pair; under\n// nodenext the .js specifier resolves to the .tsx source (see README note).\nimport { SubscriptionsSection } from './SubscriptionsSection.js'\nimport type { SubscriptionsSectionInjected } from './SubscriptionsSection.js'\nimport { ImageGenerateToolview, createImageLoader } from './ImageGenerateToolview.js'\nimport type { ImageGenerateToolviewInjected } from './ImageGenerateToolview.js'\nimport { VideoGenerateToolview, createVideoLoader } from './VideoGenerateToolview.js'\nimport type { VideoGenerateToolviewInjected } from './VideoGenerateToolview.js'\nimport { SpeedSelect, createSpeedLoader, createSpeedSetter } from './SpeedSelect.js'\nimport type { ModelDirectoriesLike, SpeedSelectInjected } from './SpeedSelect.js'\nimport { en, zh } from './locales.js'\nimport type { SubscriptionsKey } from './locales.js'\n\nexport type { SubscriptionsSectionInjected, SubscriptionsSectionProps } from './SubscriptionsSection.js'\nexport type { ImageGenerateToolviewInjected, ImageGenerateToolviewProps } from './ImageGenerateToolview.js'\nexport type { VideoGenerateToolviewInjected, VideoGenerateToolviewProps } from './VideoGenerateToolview.js'\nexport type { SpeedSelectInjected, SpeedSelectProps, SpeedState, SpeedTier } from './SpeedSelect.js'\nexport type { SubscriptionsKey } from './locales.js'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** The Subscriptions settings page copy. */\n 'settings.subscriptions': SubscriptionsKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'settings.subscriptions'\n\n/**\n * Required services (cordis fiber inject): `slots` carries the registration\n * seat, `connection` the `/subscriptions-auth` RPC caller, and `locale` the copy\n * dictionaries.\n */\nexport const inject = ['slots', 'connection', 'locale']\n\n/**\n * Register the Subscriptions section once the `settings.section` declaration\n * is on the ledger (the shell's apply order relative to this one is NOT\n * constrained; registration depends on the slot through `slots.inject()`).\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-plugin-subscriptions: copy dictionaries')\n // Settings-shell nudge: the panel (nav title + header row + section body)\n // sits flush against the panel's top edge; push it down a little to leave\n // breathing room. Scoped by the settings panel's own dialog role + nav child\n // so other aria-modal dialogs (e.g. the attachment lightbox) are untouched.\n ctx.effect(() => {\n const style = document.createElement('style')\n style.setAttribute('data-plugin', 'dsh-plugin-subscriptions')\n style.textContent = 'div[role=\"dialog\"][aria-modal=\"true\"]:has(> nav) { padding-top: 14px; }'\n document.head.appendChild(style)\n return () => style.remove()\n }, 'dsh-plugin-subscriptions: settings panel breathing room')\n // The shell's Context merge types `connection` as the host handle; in the\n // browser shell the same key holds the full client ConnectionHandle.\n const connection = ctx.get('connection') as unknown as ConnectionHandle\n const t = ctx.locale.bind(NS) as SubscriptionsSectionInjected['t']\n const injected = (): SubscriptionsSectionInjected => ({ rpc: connection.rpc, t })\n ctx.slots.inject('settings.section', () => ctx.slots.register({\n name: 'settings.section',\n id: 'subscriptions',\n order: 90,\n // A thunk re-evaluated per read, so the nav label follows the active locale.\n label: () => t('nav'),\n inject: injected,\n }, SubscriptionsSection))\n\n // The image_generate keyed toolview owns how image calls render inline; its\n // gallery bytes ride the same channel through the injected loader. The\n // framework synthesizes the toolview's own `t` seat from `locale: NS`.\n const toolviewInjected = (): ImageGenerateToolviewInjected => ({ load: createImageLoader(connection.rpc) })\n ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({\n name: 'tool.call.toolview',\n key: 'image_generate',\n locale: NS,\n inject: toolviewInjected,\n }, ImageGenerateToolview))\n\n // The video_generate keyed toolview plays the saved MP4 inline; its bytes\n // ride the same channel's `video` endpoint through the injected loader.\n const videoToolviewInjected = (): VideoGenerateToolviewInjected => ({ loadVideo: createVideoLoader(connection.rpc) })\n ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({\n name: 'tool.call.toolview',\n key: 'video_generate',\n locale: NS,\n inject: videoToolviewInjected,\n }, VideoGenerateToolview))\n\n // The composer Speed toggle (codex fast tier) sits in the right tool row,\n // just left of the model selector; the framework synthesizes its `t` seat\n // from `locale: NS`, and the inject face binds each session's RPC calls.\n // The current-model read rides ui-model-selection's `modelDirectories`\n // service, resolved lazily so registration order never matters.\n const models = (): ModelDirectoriesLike | undefined =>\n ctx.get('modelDirectories') as ModelDirectoriesLike | undefined\n ctx.slots.inject('conversation.input.right', () => ctx.slots.register({\n name: 'conversation.input.right',\n id: 'codex-speed',\n order: 0,\n locale: NS,\n inject: (sessionId: string): SpeedSelectInjected => ({\n loadSpeed: createSpeedLoader(connection, models, sessionId),\n setSpeed: createSpeedSetter(connection, sessionId),\n }),\n }, SpeedSelect))\n\n // The /fast slash command offers the same Standard/Fast choice as a popup.\n // `available` is synchronous and sees only the session id, so the command\n // stays listed everywhere; `options` throws the friendly gate when the\n // session's current model is not a fast-capable codex model (the same\n // in-popup error posture the /model contribution uses for its guards).\n ctx.inject(['commandUi'], (scope: ClientContext) => {\n const command = scope.get('commandUi') as CommandUiContract\n scope.effect(() => command.register({\n name: 'fast',\n description: t('commandFast'),\n available: () => true,\n ui: {\n kind: 'popupSelect',\n options: async (session) => {\n const state = await createSpeedLoader(connection, models, session.sessionId)()\n if (!state.visible) throw new Error(t('commandFastUnavailable'))\n return ([\n { id: 'standard', label: t('speedStandard'), detail: t('speedStandardDescription') },\n { id: 'fast', label: t('speedFast'), detail: t('speedFastDescription') },\n ] as const).map(option => ({ ...option, active: option.id === state.tier }))\n },\n onSelect: async (option, session) => {\n await createSpeedSetter(connection, session.sessionId)(option.id as 'standard' | 'fast')\n },\n },\n }), 'dsh-plugin-subscriptions: /fast contribution')\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAa,KAAK;CAChB,KAAK;CACL,OAAO;CACP,aAAa;CACb,UAAU;CACV,iBAAiB;CACjB,aAAa;CACb,eAAe;CACf,gBAAgB;CAChB,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,iBAAiB;CACjB,oBAAoB;CACpB,gBAAgB;CAChB,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,sBAAsB;CACtB,eAAe;CACf,mBAAmB;CACnB,QAAQ;CACR,iBAAiB;CACjB,kBAAkB;CAClB,gBAAgB;CAChB,kBAAkB;CAClB,oBAAoB;CACpB,YAAY;CACZ,cAAc;CACd,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,aAAa;CACb,aAAa;CACb,aAAa;CACb,WAAW;CACX,oBAAoB;CACpB,mBAAmB;CACnB,6BAA6B;CAC7B,uBAAuB;CACvB,sBAAsB;CACtB,yBAAyB;CACzB,oBAAoB;CACpB,qBAAqB;CACrB,8BAA8B;CAC9B,sBAAsB;CACtB,0BAA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