dsh-plugin-subscriptions 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["SUBSCRIPTIONS_AUTH_CHANNEL","PROVIDERS: readonly { id: SubscriptionProvider; name: string }[]","callSubscriptionsAuth","result: RpcResult<unknown>","fallbackTranslate","text: string","styles: Record<string, CSSProperties>","params: Record<string, unknown>","window","response: StatusResponse","styles","result: RpcResult<unknown>","text: string","parsed: unknown","prompt: string | undefined","parts: string[]","images: { attachment: ImageAttachmentRef }[]","styles: Record<string, CSSProperties>","labels: MessageImageLabels","IconSparkle16","ImageGallery"],"sources":["../src/client/locales.ts","../src/client/SubscriptionsSection.tsx","../src/client/ImageGenerateToolview.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 loggedIn: 'Logged in',\n loggedInAccount: 'Logged in as {account}',\n loggedInExpires: 'Logged in · expires {date}',\n loggedInAccountExpires: 'Logged in as {account} · expires {date}',\n notLoggedIn: 'Not logged in',\n login: 'Log in',\n cancel: 'Cancel',\n logout: 'Log out',\n logoutConfirm: 'Log out 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 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} 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 loggedIn: '已登录',\n loggedInAccount: '已登录:{account}',\n loggedInExpires: '已登录 · 过期时间 {date}',\n loggedInAccountExpires: '已登录:{account} · 过期时间 {date}',\n notLoggedIn: '未登录',\n login: '登录',\n cancel: '取消',\n logout: '退出登录',\n logoutConfirm: '确定退出 {provider} 的登录吗?',\n manualSummary: '浏览器流程无法完成?粘贴回调 URL 或授权码',\n manualPlaceholder: '粘贴回调 URL 或授权码',\n submit: '提交',\n loginMissingUrl: 'login 响应缺少 authorizeUrl',\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} 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'\n\n/** One provider's login state as answered by the `status` endpoint. */\nexport interface ProviderStatus {\n loggedIn: boolean\n busy: boolean\n expiresAt?: number\n account?: string\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/** `login` endpoint value: the URL the user completes OAuth at. */\ninterface LoginResponse {\n authorizeUrl: 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]\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 * @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 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/**\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 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 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}\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?.loggedIn === true) 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.loggedIn) {\n const params: Record<string, unknown> = {}\n if (status.account !== undefined) params.account = status.account\n if (status.expiresAt !== undefined) params.date = new Date(status.expiresAt).toLocaleString()\n if (params.account !== undefined && params.date !== undefined) return t('loggedInAccountExpires', params)\n if (params.account !== undefined) return t('loggedInAccount', params)\n if (params.date !== undefined) return t('loggedInExpires', params)\n return t('loggedIn')\n }\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/**\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: '',\n })\n const [usages, setUsages] = useState<Partial<Record<SubscriptionProvider, ProviderUsage>>>({})\n const [usageErrors, setUsageErrors] = useState<Partial<Record<SubscriptionProvider, string>>>({})\n const [usageLoading, setUsageLoading] = useState<Partial<Record<SubscriptionProvider, boolean>>>({})\n const mountedRef = useRef(true)\n const pollersRef = useRef(new Map<SubscriptionProvider, ReturnType<typeof setInterval>>())\n /** Providers with a `usage` call in flight; guards the auto-fetch effect against re-entry. */\n const usageInflightRef = useRef(new Set<SubscriptionProvider>())\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.loggedIn || !status.busy) stopPolling(id)\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): Promise<void> => {\n if (rpc === undefined || usageInflightRef.current.has(provider)) return\n usageInflightRef.current.add(provider)\n setUsageLoading(prev => ({ ...prev, [provider]: true }))\n try {\n const usage = await callSubscriptionsAuth<ProviderUsage>(rpc, 'usage', { provider })\n if (!mountedRef.current) return\n setUsages(prev => ({ ...prev, [provider]: usage }))\n setUsageErrors((prev) => {\n const next = { ...prev }\n delete next[provider]\n return next\n })\n } catch (error) {\n if (mountedRef.current) setUsageErrors(prev => ({ ...prev, [provider]: messageOf(error) }))\n } finally {\n usageInflightRef.current.delete(provider)\n if (mountedRef.current) setUsageLoading(prev => ({ ...prev, [provider]: false }))\n }\n }, [rpc])\n\n // Fetch usage once a provider is logged in; drop the cached snapshot on\n // logout so a re-login refetches. A failed lookup does not auto-retry — the\n // per-card Refresh button is the retry path.\n useEffect(() => {\n for (const { id } of PROVIDERS) {\n const status = statuses[id]\n if (status === undefined) continue\n if (status.loggedIn) {\n if (usages[id] === undefined && usageErrors[id] === undefined) void loadUsage(id)\n } else if (usages[id] !== undefined || usageErrors[id] !== undefined) {\n setUsages((prev) => {\n const next = { ...prev }\n delete next[id]\n return next\n })\n setUsageErrors((prev) => {\n const next = { ...prev }\n delete next[id]\n return next\n })\n }\n }\n }, [statuses, usages, usageErrors, loadUsage])\n\n const login = useCallback(async (provider: SubscriptionProvider): Promise<void> => {\n if (rpc === undefined) return\n setProviderError(provider, undefined)\n try {\n const response = await callSubscriptionsAuth<LoginResponse>(rpc, 'login', { provider })\n if (typeof response.authorizeUrl !== 'string' || response.authorizeUrl === '') {\n throw new SubscriptionsAuthError(t('loginMissingUrl'))\n }\n window.open(response.authorizeUrl, '_blank', 'noopener')\n if (!mountedRef.current) return\n // Optimistic busy so Cancel and the manual fallback appear before the first poll tick.\n setStatuses(prev => ({ ...prev, [provider]: { ...prev[provider], busy: true, loggedIn: false } }))\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, name: string): Promise<void> => {\n if (rpc === undefined) return\n if (!window.confirm(t('logoutConfirm', { provider: name }))) return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'logout', { provider })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, t, setProviderError, refresh])\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 {PROVIDERS.map(({ id, name }) => {\n const status = statuses[id]\n const busy = status?.busy === true\n const usage = usages[id]\n const usageError = usageErrors[id]\n // Providers without a usage endpoint answer supported:false — no block.\n const showUsage = status?.loggedIn === true && usage?.supported !== false\n && (usage !== undefined || usageError !== undefined || usageLoading[id] === true)\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 <div style={styles.actions}>\n {!busy && status?.loggedIn !== true && (\n <button type=\"button\" style={styles.button} onClick={() => { void login(id) }}>\n {t('login')}\n </button>\n )}\n {busy && (\n <button type=\"button\" style={styles.button} onClick={() => { void cancel(id) }}>\n {t('cancel')}\n </button>\n )}\n {status?.loggedIn === true && (\n <button type=\"button\" style={styles.button} onClick={() => { void logout(id, name) }}>\n {t('logout')}\n </button>\n )}\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[id] === true ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={usageLoading[id] === true}\n onClick={() => { void loadUsage(id) }}\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 {busy && (\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 </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 * the platform ImageGallery, 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 '@deepseek-ai/dsh-client-ui-attachment'\nimport type { ImageAttachmentRef, ImageLoader, MessageImageLabels } from '@deepseek-ai/dsh-client-ui-attachment'\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} align=\"start\" 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 * 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 } 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 the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/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 { 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 { 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 // 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAa,KAAK;CAChB,KAAK;CACL,OAAO;CACP,aAAa;CACb,UAAU;CACV,iBAAiB;CACjB,UAAU;CACV,iBAAiB;CACjB,iBAAiB;CACjB,wBAAwB;CACxB,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,QAAQ;CACR,iBAAiB;CACjB,YAAY;CACZ,cAAc;CACd,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,aAAa;CACb,aAAa;CACb,aAAa;CACb,WAAW;CACX,YAAY;CACZ,OAAO;CACP,WAAW;CACX,gBAAgB;CAChB,cAAc;CACd,iBAAiB;CACjB,cAAc;CACd,YAAY;CACb;;AAGD,MAAa,KAAK;CAChB,KAAK;CACL,OAAO;CACP,aAAa;CACb,UAAU;CACV,iBAAiB;CACjB,UAAU;CACV,iBAAiB;CACjB,iBAAiB;CACjB,wBAAwB;CACxB,aAAa;CACb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,eAAe;CACf,eAAe;CACf,mBAAmB;CACnB,QAAQ;CACR,iBAAiB;CACjB,YAAY;CACZ,cAAc;CACd,cAAc;CACd,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,aAAa;CACb,aAAa;CACb,aAAa;CACb,WAAW;CACX,YAAY;CACZ,OAAO;CACP,WAAW;CACX,gBAAgB;CAChB,cAAc;CACd,iBAAiB;CACjB,cAAc;CACd,YAAY;CACb;;;;;AC3DD,MAAMA,+BAA6B;;AAGnC,MAAM,mBAAmB;;AAsDzB,MAAMC,YAAmE;CACvE;EAAE,IAAI;EAAS,MAAM;EAAmB;CACxC;EAAE,IAAI;EAAU,MAAM;EAAU;CAChC;EAAE,IAAI;EAAQ,MAAM;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IAAI;EACJ,OAAO;EAEP,aAAa,EAAE,MAAM;EACrB,QAAQ;EACT,EAAE,qBAAqB,CAAC;CAKzB,MAAM,0BAAyD,EAAE,MAAM,kBAAkB,WAAW,IAAI,EAAE;AAC1G,KAAI,MAAM,OAAO,4BAA4B,IAAI,MAAM,SAAS;EAC9D,MAAM;EACN,KAAK;EACL,QAAQ;EACR,QAAQ;EACT,EAAE,sBAAsB,CAAC"}
1
+ {"version":3,"file":"client.js","names":["SUBSCRIPTIONS_AUTH_CHANNEL","PROVIDERS: readonly { id: SubscriptionProvider; name: string }[]","callSubscriptionsAuth","result: RpcResult<unknown>","fallbackTranslate","text: string","styles: Record<string, CSSProperties>","params: Record<string, unknown>","window","response: StatusResponse","styles","SUBSCRIPTIONS_AUTH_CHANNEL","PROMPT_MAX_LENGTH","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","ImageGallery","result: RpcResult<unknown>","text: string","parsed: unknown","prompt: string | undefined","parts: string[]","styles: Record<string, CSSProperties>","objectUrl: string | undefined","IconSparkle16"],"sources":["../src/client/locales.ts","../src/client/SubscriptionsSection.tsx","../src/client/ImageGenerateToolview.tsx","../src/client/VideoGenerateToolview.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 loggedIn: 'Logged in',\n loggedInAccount: 'Logged in as {account}',\n loggedInExpires: 'Logged in · expires {date}',\n loggedInAccountExpires: 'Logged in as {account} · expires {date}',\n notLoggedIn: 'Not logged in',\n login: 'Log in',\n cancel: 'Cancel',\n logout: 'Log out',\n logoutConfirm: 'Log out 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 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} 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 loggedIn: '已登录',\n loggedInAccount: '已登录:{account}',\n loggedInExpires: '已登录 · 过期时间 {date}',\n loggedInAccountExpires: '已登录:{account} · 过期时间 {date}',\n notLoggedIn: '未登录',\n login: '登录',\n cancel: '取消',\n logout: '退出登录',\n logoutConfirm: '确定退出 {provider} 的登录吗?',\n manualSummary: '浏览器流程无法完成?粘贴回调 URL 或授权码',\n manualPlaceholder: '粘贴回调 URL 或授权码',\n submit: '提交',\n loginMissingUrl: 'login 响应缺少 authorizeUrl',\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} 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'\n\n/** One provider's login state as answered by the `status` endpoint. */\nexport interface ProviderStatus {\n loggedIn: boolean\n busy: boolean\n expiresAt?: number\n account?: string\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/** `login` endpoint value: the URL the user completes OAuth at. */\ninterface LoginResponse {\n authorizeUrl: 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]\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 * @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 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/**\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 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 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}\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?.loggedIn === true) 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.loggedIn) {\n const params: Record<string, unknown> = {}\n if (status.account !== undefined) params.account = status.account\n if (status.expiresAt !== undefined) params.date = new Date(status.expiresAt).toLocaleString()\n if (params.account !== undefined && params.date !== undefined) return t('loggedInAccountExpires', params)\n if (params.account !== undefined) return t('loggedInAccount', params)\n if (params.date !== undefined) return t('loggedInExpires', params)\n return t('loggedIn')\n }\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/**\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: '',\n })\n const [usages, setUsages] = useState<Partial<Record<SubscriptionProvider, ProviderUsage>>>({})\n const [usageErrors, setUsageErrors] = useState<Partial<Record<SubscriptionProvider, string>>>({})\n const [usageLoading, setUsageLoading] = useState<Partial<Record<SubscriptionProvider, boolean>>>({})\n const mountedRef = useRef(true)\n const pollersRef = useRef(new Map<SubscriptionProvider, ReturnType<typeof setInterval>>())\n /** Providers with a `usage` call in flight; guards the auto-fetch effect against re-entry. */\n const usageInflightRef = useRef(new Set<SubscriptionProvider>())\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.loggedIn || !status.busy) stopPolling(id)\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): Promise<void> => {\n if (rpc === undefined || usageInflightRef.current.has(provider)) return\n usageInflightRef.current.add(provider)\n setUsageLoading(prev => ({ ...prev, [provider]: true }))\n try {\n const usage = await callSubscriptionsAuth<ProviderUsage>(rpc, 'usage', { provider })\n if (!mountedRef.current) return\n setUsages(prev => ({ ...prev, [provider]: usage }))\n setUsageErrors((prev) => {\n const next = { ...prev }\n delete next[provider]\n return next\n })\n } catch (error) {\n if (mountedRef.current) setUsageErrors(prev => ({ ...prev, [provider]: messageOf(error) }))\n } finally {\n usageInflightRef.current.delete(provider)\n if (mountedRef.current) setUsageLoading(prev => ({ ...prev, [provider]: false }))\n }\n }, [rpc])\n\n // Fetch usage once a provider is logged in; drop the cached snapshot on\n // logout so a re-login refetches. A failed lookup does not auto-retry — the\n // per-card Refresh button is the retry path.\n useEffect(() => {\n for (const { id } of PROVIDERS) {\n const status = statuses[id]\n if (status === undefined) continue\n if (status.loggedIn) {\n if (usages[id] === undefined && usageErrors[id] === undefined) void loadUsage(id)\n } else if (usages[id] !== undefined || usageErrors[id] !== undefined) {\n setUsages((prev) => {\n const next = { ...prev }\n delete next[id]\n return next\n })\n setUsageErrors((prev) => {\n const next = { ...prev }\n delete next[id]\n return next\n })\n }\n }\n }, [statuses, usages, usageErrors, loadUsage])\n\n const login = useCallback(async (provider: SubscriptionProvider): Promise<void> => {\n if (rpc === undefined) return\n setProviderError(provider, undefined)\n try {\n const response = await callSubscriptionsAuth<LoginResponse>(rpc, 'login', { provider })\n if (typeof response.authorizeUrl !== 'string' || response.authorizeUrl === '') {\n throw new SubscriptionsAuthError(t('loginMissingUrl'))\n }\n window.open(response.authorizeUrl, '_blank', 'noopener')\n if (!mountedRef.current) return\n // Optimistic busy so Cancel and the manual fallback appear before the first poll tick.\n setStatuses(prev => ({ ...prev, [provider]: { ...prev[provider], busy: true, loggedIn: false } }))\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, name: string): Promise<void> => {\n if (rpc === undefined) return\n if (!window.confirm(t('logoutConfirm', { provider: name }))) return\n setProviderError(provider, undefined)\n try {\n await callSubscriptionsAuth<{ ok: true }>(rpc, 'logout', { provider })\n } catch (error) {\n setProviderError(provider, messageOf(error))\n }\n await refresh()\n }, [rpc, t, setProviderError, refresh])\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 {PROVIDERS.map(({ id, name }) => {\n const status = statuses[id]\n const busy = status?.busy === true\n const usage = usages[id]\n const usageError = usageErrors[id]\n // Providers without a usage endpoint answer supported:false — no block.\n const showUsage = status?.loggedIn === true && usage?.supported !== false\n && (usage !== undefined || usageError !== undefined || usageLoading[id] === true)\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 <div style={styles.actions}>\n {!busy && status?.loggedIn !== true && (\n <button type=\"button\" style={styles.button} onClick={() => { void login(id) }}>\n {t('login')}\n </button>\n )}\n {busy && (\n <button type=\"button\" style={styles.button} onClick={() => { void cancel(id) }}>\n {t('cancel')}\n </button>\n )}\n {status?.loggedIn === true && (\n <button type=\"button\" style={styles.button} onClick={() => { void logout(id, name) }}>\n {t('logout')}\n </button>\n )}\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[id] === true ? { opacity: 0.5, cursor: 'default' } : {} }}\n disabled={usageLoading[id] === true}\n onClick={() => { void loadUsage(id) }}\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 {busy && (\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 </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 * the platform ImageGallery, 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 '@deepseek-ai/dsh-client-ui-attachment'\nimport type { ImageAttachmentRef, ImageLoader, MessageImageLabels } from '@deepseek-ai/dsh-client-ui-attachment'\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} align=\"start\" 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 * 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 } 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 the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/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 { 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 { 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 // 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAa,KAAK;CAChB,KAAK;CACL,OAAO;CACP,aAAa;CACb,UAAU;CACV,iBAAiB;CACjB,UAAU;CACV,iBAAiB;CACjB,iBAA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