diff --git a/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.i18n.yaml b/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.i18n.yaml
new file mode 100644
index 0000000000..4d34ab77f7
--- /dev/null
+++ b/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.i18n.yaml
@@ -0,0 +1,19 @@
+# Bilingual-pair consistency record for 2026-11-04-deepseek-cloud-speech-recognition.md (docs/i18n/README.md): per heading
+# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
+# After editing either side, bring the other along and re-record with:
+# pnpm run verify-translation-pairing --write .agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.md
+/agent-note-deepseek-cloud-speech-recognition-with-automatic-selection:
+ en: 8207b0d1f3d81458
+ zh: 431b2eddb379d59b
+/agent-note-deepseek-cloud-speech-recognition-with-automatic-selection/problem:
+ en: 65a3a75d5e55b24f
+ zh: 1ff61a652c2336e5
+/agent-note-deepseek-cloud-speech-recognition-with-automatic-selection/decision:
+ en: b966ee0bde43b730
+ zh: c1e7fba00cea0c3b
+/agent-note-deepseek-cloud-speech-recognition-with-automatic-selection/alternatives-considered:
+ en: 9452985af8f12400
+ zh: 9e23d622f47f25c5
+/agent-note-deepseek-cloud-speech-recognition-with-automatic-selection/consequences:
+ en: e24554ebd7f99c40
+ zh: 8d82de73b3ba5c84
diff --git a/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.md b/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.md
new file mode 100644
index 0000000000..f786d06546
--- /dev/null
+++ b/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.md
@@ -0,0 +1,25 @@
+# Agent Note: DeepSeek cloud speech recognition with automatic selection
+
+Status: implemented
+
+English | [中文](2026-11-04-deepseek-cloud-speech-recognition.zh.md)
+
+## Problem
+
+Experimental voice input recognized speech only on the Host, so first use required downloading and preparing local models. Signed-in DeepSeek users should dictate without that setup, while signed-out users keep the local option. The [voice input decision](../architecture/2026-09-16-experimental-voice-input.md) forbids silently changing where recordings are processed and any fallback that uploads speech after a local failure.
+
+## Decision
+
+A separate provider package, `speech-to-text-deepseek`, registers `deepseek-asr` with `location: 'cloud'` and sends complete recordings to the One-Shot endpoint as raw PCM. It does not use the streaming WebSocket endpoint. It authenticates like the account model route, sending the token the account service releases for the endpoint, and refuses recordings without a stored DeepSeek account. The account service releases tokens to `https://harness.deepseek.com`, the default endpoint origin, but never loopback-issued grants.
+
+`speech-to-text` gains the `auto` preference and `autoOrder`. Selection happens before recording: the first registered provider that is not `unavailable` wins, and the Client sends that exact provider id with the recording. A failed recognition never re-routes audio, and signing out during a recording fails that recording rather than switching providers. One saved language serves every provider: a provider that does not list it receives `auto`, so the menu offers every language some provider recognizes and notes when the provider in use detects instead. The cloud provider sends the language as `preferred_language` and the UI language as `x-client-locale`, as the voice settings RFC specifies.
+
+Signed-in users get cloud recognition by default without an upload prompt; the user agreement and privacy policy disclose processing, and the interface names the location in the tooltip, transcription status and bundle details. The microphone stays visible whenever the plugin is enabled. Signing in uses a new optional Client service, `accountSignIn`, so the voice UI reuses the account dialog and browser flow instead of duplicating them. After sign-in the dialog closes and the user starts recording; recording never starts without a click because the sign-in tab takes focus and blur cancels capture.
+
+## Alternatives considered
+
+A first-use upload notice was rejected by product because the user agreement covers it. Falling back to cloud recognition after a local failure would violate the existing no-fallback guarantee. Calling `account.startSignIn` from the voice UI would duplicate the sign-in dialog, tab ownership and failure states. Limiting the menu to the languages of the provider in use was rejected: the saved language would appear reset whenever automatic selection switched providers.
+
+## Consequences
+
+The shipped bundle enables the cloud row against the production endpoint. Raw PCM is zero-padded to 32 bytes because the service rejects other lengths, adding at most 1 ms of silence. A rejected account token signs the account out. Verification covers automatic routing and language rules, account authentication and token rejection, retries with a stable `audio_id`, and a real-composition browser sign-in and dictation against a loopback service.
diff --git a/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.zh.md b/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.zh.md
new file mode 100644
index 0000000000..6a83adf5cc
--- /dev/null
+++ b/.agents/notes/implemented/feature/2026-11-04-deepseek-cloud-speech-recognition.zh.md
@@ -0,0 +1,25 @@
+# Agent Note:带自动选择的 DeepSeek 云端语音识别
+
+Status: implemented
+
+[English](2026-11-04-deepseek-cloud-speech-recognition.md) | 中文
+
+## 问题
+
+实验性语音输入只在 Host 上识别,首次使用必须下载并准备本地模型。已登录 DeepSeek 的用户应能免去这一步直接听写,未登录用户仍可选择本地识别。[语音输入决策](../architecture/2026-09-16-experimental-voice-input.zh.md)禁止悄悄改变录音的处理位置,也禁止本地失败后回退上传语音。
+
+## 决策
+
+独立的 Provider 包 `speech-to-text-deepseek` 以 `location: 'cloud'` 注册 `deepseek-asr`,把完整录音以裸 PCM 发送到 One-Shot 接口,不使用流式 WebSocket 接口。它与账号模型路由使用相同的鉴权,发送账号服务为该 endpoint 发放的令牌;没有已保存的 DeepSeek 账号时拒绝录音。账号服务向默认 endpoint 的 origin `https://harness.deepseek.com` 发放令牌,但从不发放本机回环签发的授权。
+
+`speech-to-text` 新增 `auto` 偏好和 `autoOrder`。选择在录音之前进行:第一个已注册且不是 `unavailable` 的 Provider 胜出,Client 随录音发送这个确切的 Provider id。识别失败绝不改投其他 Provider;录音期间退出登录时,该次录音失败,而不是换用其他 Provider。一份保存的语言适用于所有 Provider:未列出该语言的 Provider 收到 `auto`,因此菜单列出任一 Provider 支持的全部语言,并在当前 Provider 改为自动识别时给出提示。云端 Provider 按语音配置 RFC 的要求,把语言作为 `preferred_language`、把界面语言作为 `x-client-locale` 发送。
+
+已登录用户默认使用云端识别,不弹上传告知;处理方式由用户协议和隐私协议说明,界面在悬停提示、转写状态和 Bundle 详情中标明识别位置。只要插件已启用,麦克风就一直显示。登录使用新的可选 Client 服务 `accountSignIn`,语音 UI 复用账号的登录弹窗和浏览器流程,而不是重写一套。登录后弹窗关闭,由用户点击开始录音;登录标签页会夺走焦点,而失焦会取消录音,所以录音从不在没有点击的情况下自动开始。
+
+## 考虑过的方案
+
+产品否决了首次上传告知,因为用户协议已经覆盖。本地失败后回退到云端识别会破坏现有的无回退保证。在语音 UI 中直接调用 `account.startSignIn` 会重复登录弹窗、标签页所有权和失败状态。菜单只列当前 Provider 支持的语言被否决:自动选择切换 Provider 时,保存的语言看起来会被重置。
+
+## 影响
+
+发布的 Bundle 启用云端这一行,指向生产接口。服务拒绝其他长度的裸 PCM,所以补零到 32 字节,最多增加 1 毫秒静音。账号令牌被拒绝时账号退出登录。验证覆盖自动路由与语言规则、账号鉴权与令牌被拒、使用固定 `audio_id` 的重试,以及在真实组合中通过浏览器登录并对本机服务听写。
diff --git a/apps/web/tests/expected/voice-input-cloud/recording.expected.md b/apps/web/tests/expected/voice-input-cloud/recording.expected.md
new file mode 100644
index 0000000000..906df62058
--- /dev/null
+++ b/apps/web/tests/expected/voice-input-cloud/recording.expected.md
@@ -0,0 +1,5 @@
+- textbox "Describe what you want to build, / commands, @ files or sessions"
+- button "Cancel"
+- img "Recording…"
+- button "Stop and transcribe"
+- button "Send message" [disabled]
diff --git a/apps/web/tests/expected/voice-input-cloud/sign-in.expected.md b/apps/web/tests/expected/voice-input-cloud/sign-in.expected.md
new file mode 100644
index 0000000000..bdcb0efdf1
--- /dev/null
+++ b/apps/web/tests/expected/voice-input-cloud/sign-in.expected.md
@@ -0,0 +1,6 @@
+- dialog "Cloud recognition requires a DeepSeek account":
+ - heading "Cloud recognition requires a DeepSeek account" [level=2]
+ - button "Cancel"
+ - paragraph: DeepSeek cloud recognition is selected. Sign in to use it without downloading models.
+ - button "Later"
+ - button "Sign in to DeepSeek"
diff --git a/apps/web/tests/expected/voice-setup.expected.md b/apps/web/tests/expected/voice-setup.expected.md
index 1cfcd160e0..1438069981 100644
--- a/apps/web/tests/expected/voice-setup.expected.md
+++ b/apps/web/tests/expected/voice-setup.expected.md
@@ -1,6 +1,7 @@
-- dialog "Set up voice input before recording":
- - heading "Set up voice input before recording" [level=2]
+- dialog "Prepare speech recognition":
+ - heading "Prepare speech recognition" [level=2]
- button "Cancel"
- - paragraph: Voice input is enabled. First use requires downloading and preparing local recognition models. Open the plugin details to review disk space, memory and time estimates before starting setup.
+ - paragraph: Sign in to DeepSeek to use cloud recognition without downloading models. You can also download a local model so recordings stay on the machine running DSH.
- button "Later"
- - button "Go to setup"
+ - button "Download local model"
+ - button "Sign in to DeepSeek"
diff --git a/apps/web/tests/expected/voice-source-auto.expected.md b/apps/web/tests/expected/voice-source-auto.expected.md
index a64c41e080..5007a79c07 100644
--- a/apps/web/tests/expected/voice-source-auto.expected.md
+++ b/apps/web/tests/expected/voice-source-auto.expected.md
@@ -1,4 +1,4 @@
-- strong: SenseVoiceSmall (INT8)
+- strong: SenseVoiceSmall (INT8) local recognition
- paragraph: Local models will be downloaded to the machine running DSH. No Python or compiler is required.
- term: Disk space
- definition: Allow about 1 GB for models, runtime, and download caches
diff --git a/apps/web/tests/expected/voice-source-manual.expected.md b/apps/web/tests/expected/voice-source-manual.expected.md
index 1867a5bb80..c7406c3adc 100644
--- a/apps/web/tests/expected/voice-source-manual.expected.md
+++ b/apps/web/tests/expected/voice-source-manual.expected.md
@@ -1,4 +1,4 @@
-- strong: SenseVoiceSmall (INT8)
+- strong: SenseVoiceSmall (INT8) local recognition
- paragraph: Local models will be downloaded to the machine running DSH. No Python or compiler is required.
- term: Disk space
- definition: Allow about 1 GB for models, runtime, and download caches
diff --git a/apps/web/tests/fixtures/voice-input-cloud/cordis.patch.yml b/apps/web/tests/fixtures/voice-input-cloud/cordis.patch.yml
new file mode 100644
index 0000000000..0413f146d6
--- /dev/null
+++ b/apps/web/tests/fixtures/voice-input-cloud/cordis.patch.yml
@@ -0,0 +1,18 @@
+# The cloud dictation scenario points the shipped account provider and the cloud recognizer at one loopback
+# double. The scenario substitutes {{origin}} after the listener binds, so no port is ever committed here.
+- id: deepseek-account
+ config:
+ platformOrigin: "{{origin}}"
+ inferenceOrigin: "{{origin}}"
+ allowLoopbackHttp: true
+- id: ui-settings-account
+ config:
+ step: done
+ completion: completed
+# Automatic selection then has only the cloud recognizer to choose.
+- id: speech-to-text-sensevoice
+ disabled: true
+- id: speech-to-text-deepseek
+ config:
+ endpoint: "{{origin}}/api/v0/asr/transcribe"
+ allowLoopbackHttp: true
diff --git a/apps/web/tests/voice-download.e2e.ts b/apps/web/tests/voice-download.e2e.ts
index a541bef2fb..2470165299 100644
--- a/apps/web/tests/voice-download.e2e.ts
+++ b/apps/web/tests/voice-download.e2e.ts
@@ -10,6 +10,9 @@ import { expect, it, onTestFinished } from 'vitest'
import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, watchConsole, webSnapshotMode, type WebScaffold } from './scaffold.ts'
import { newEnglishPage } from './support.ts'
+/** Model download only: the shipped cloud recognizer would change automatic selection and its setup guidance. */
+const LOCAL_ONLY = '- id: speech-to-text-deepseek\n disabled: true\n'
+
const bundle = fileURLToPath(new URL('../../../packages/experimental/voice-input-bundle', import.meta.url))
const expected = fileURLToPath(new URL('./expected/voice-download.expected.md', import.meta.url))
// The input-device picker on the same page shows its own alert when headless Chromium offers no microphone.
@@ -37,7 +40,7 @@ it('shows the failed asset, actual download source and recovery advice, then ret
const address = server.address()
if (!address || typeof address === 'string') throw new Error('Expected a loopback listener')
const origin = `http://127.0.0.1:${address.port}`, overlay = join(root, 'voice.patch.yml')
- await writeFile(overlay, `- id: speech-to-text-sensevoice\n config:\n dataRoot: ${JSON.stringify(join(root, 'models'))}\n modelOrigin: ${origin}\n`)
+ await writeFile(overlay, `- id: speech-to-text-sensevoice\n config:\n dataRoot: ${JSON.stringify(join(root, 'models'))}\n modelOrigin: ${origin}\n${LOCAL_ONLY}`)
const scaffold = await launchWebScaffold({ profile: { packages: [{ dir: bundle, enabled: true }] }, extraOverlayPath: overlay })
resources.scaffold = scaffold
const browser = await chromium.launch()
@@ -98,7 +101,7 @@ it.each([{ winner: 0, manual: false }, { winner: 1, manual: false }, { winner: 0
const overlay = join(root, 'voice.patch.yml')
await writeFile(overlay, `- id: speech-to-text-sensevoice\n config: ${JSON.stringify({
dataRoot: join(root, 'models'), modelOrigins: origins, modelProbeTimeoutMs: 10_000,
- })}\n`)
+ })}\n${LOCAL_ONLY}`)
const scaffold = await launchWebScaffold({ profile: { packages: [{ dir: bundle, enabled: true }] }, extraOverlayPath: overlay })
resources.scaffold = scaffold
const browser = await chromium.launch(); resources.browser = browser
diff --git a/apps/web/tests/voice-input-cloud.e2e.ts b/apps/web/tests/voice-input-cloud.e2e.ts
new file mode 100644
index 0000000000..15703f90f5
--- /dev/null
+++ b/apps/web/tests/voice-input-cloud.e2e.ts
@@ -0,0 +1,172 @@
+// Real-composition acceptance for cloud dictation. The scaffold boots the shipped Web Loader tree with the voice
+// bundle; one loopback double plays the DeepSeek Platform for sign-in and the One-Shot recognition endpoint, so the
+// real account provider, speech service, cloud recognizer, Remote and browser UI run end to end.
+import { createServer, type Server } from 'node:http'
+import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { chromium, type Browser } from 'playwright'
+import { afterAll, beforeAll, describe, expect, it, onTestFailed, onTestFinished } from 'vitest'
+import { captureStableAria, compareOrRefreshGolden, launchWebScaffold, watchConsole, webSnapshotMode, type WebScaffold } from './scaffold.ts'
+import { connectFreshWorkspace, saveFailureShot } from './support.ts'
+
+const OVERLAY_TEMPLATE = fileURLToPath(new URL('./fixtures/voice-input-cloud/cordis.patch.yml', import.meta.url))
+const BUNDLE = fileURLToPath(new URL('../../../packages/experimental/voice-input-bundle', import.meta.url))
+const SIGN_IN_EXPECTED = fileURLToPath(new URL('./expected/voice-input-cloud/sign-in.expected.md', import.meta.url))
+const RECORDING_EXPECTED = fileURLToPath(new URL('./expected/voice-input-cloud/recording.expected.md', import.meta.url))
+const MODE = webSnapshotMode()
+const TOKEN = 'dsh_web_cloud_dictation_test'
+const CODE = 'cloud-dictation-code'
+const TEXT = 'Summarize the latest pull request'
+
+/** One recognition request as the double received it. */
+interface RecognitionRequest {
+ readonly token: string | undefined
+ readonly format: string | undefined
+ readonly audioId: string | undefined
+ readonly language: string | undefined
+ readonly locale: string | undefined
+ readonly pcmBytes: number
+}
+
+/** Loopback Platform and recognition double; `rejectNext` makes the next recognition reject the account token. */
+async function mockServices() {
+ const recognitions: RecognitionRequest[] = []
+ const control = { rejectNext: false }
+ let state: string | undefined
+ let redirectUri: string | undefined
+ const server: Server = createServer((req, res) => {
+ const url = new URL(req.url ?? '/', 'http://127.0.0.1')
+ const chunks: Buffer[] = []
+ req.on('data', (chunk: Buffer) => { chunks.push(chunk) })
+ req.on('end', () => {
+ void (async () => {
+ const body = Buffer.concat(chunks)
+ const reply = (payload: unknown, code = 0): void => {
+ res.writeHead(200, { 'content-type': 'application/json' })
+ res.end(JSON.stringify({ code, msg: '', data: code === 0 ? { biz_code: 0, biz_msg: '', biz_data: payload } : null }))
+ }
+ if (url.pathname === '/dsh/authorize') {
+ const callback = new URL(redirectUri ?? '/')
+ callback.searchParams.set('code', CODE)
+ callback.searchParams.set('state', state ?? '')
+ res.writeHead(302, { location: callback.href }).end()
+ return
+ }
+ if (url.pathname === '/dsh/authorized') { res.writeHead(200, { 'content-type': 'text/html' }).end('
Authorized'); return }
+ if (req.method === 'POST' && url.pathname === '/auth-api/v0/dsh/auth_init') {
+ const payload = JSON.parse(body.toString('utf8')) as Record
+ state = String(payload.state)
+ redirectUri = String(payload.redirect_uri)
+ reply({ authorize_url: `${origin}/dsh/authorize?authorize_id=cloud`, authorize_id: 'cloud', expires_in: 300 })
+ return
+ }
+ if (req.method === 'POST' && url.pathname === '/auth-api/v0/dsh/auth_exchange') {
+ reply({ token: TOKEN, authorized_url: `${origin}/dsh/authorized` })
+ return
+ }
+ if (req.method === 'POST' && url.pathname === '/api/v0/asr/transcribe') {
+ const form = await new Response(body, { headers: { 'content-type': req.headers['content-type'] ?? '' } }).formData()
+ const file = form.get('file'), format = form.get('format'), audioId = form.get('audio_id'), language = form.get('preferred_language')
+ const token = req.headers['x-dsh-auth-token'], locale = req.headers['x-client-locale']
+ recognitions.push({ token: typeof token === 'string' ? token : undefined, format: typeof format === 'string' ? format : undefined,
+ audioId: typeof audioId === 'string' ? audioId : undefined, language: typeof language === 'string' ? language : undefined,
+ locale: typeof locale === 'string' ? locale : undefined, pcmBytes: file instanceof File ? file.size : -1 })
+ if (control.rejectNext) { control.rejectNext = false; reply(null, 40003); return }
+ reply({ text: TEXT, audio_id: audioId })
+ return
+ }
+ if (req.headers['x-dsh-auth-token'] !== TOKEN) { res.writeHead(401).end(); return }
+ if (url.pathname === '/auth-api/v0/users/current') { reply({ id: 'cloud-user', email: '', id_profile: { name: 'Cloud User' } }); return }
+ if (url.pathname === '/api/v0/users/get_user_summary') { reply({ normal_wallets: [{ currency: 'CNY', balance: '1.00' }], bonus_wallets: [] }); return }
+ if (url.pathname === '/api/v0/users/get_unnotified_bonuses') { reply([]); return }
+ res.writeHead(404).end()
+ })()
+ })
+ })
+ await new Promise((resolve) => { server.listen(0, '127.0.0.1', resolve) })
+ const address = server.address()
+ if (address === null || typeof address === 'string') throw new Error('cloud dictation: missing mock listener')
+ const origin = `http://127.0.0.1:${String(address.port)}`
+ return {
+ origin, recognitions, control,
+ close: () => new Promise((resolve) => { server.close(() => { resolve() }); server.closeAllConnections() }),
+ }
+}
+
+describe.skipIf(MODE === 'record')('web e2e: cloud dictation after DeepSeek sign-in', () => {
+ let root: string | undefined
+ let scaffold: WebScaffold
+ let browser: Browser
+ let services: Awaited>
+ beforeAll(async () => {
+ services = await mockServices()
+ root = await mkdtemp(join(tmpdir(), 'dsh-web-voice-cloud-'))
+ const overlay = join(root, 'voice-cloud.overlay.yml')
+ await writeFile(overlay, (await readFile(OVERLAY_TEMPLATE, 'utf8')).replaceAll('{{origin}}', services.origin))
+ scaffold = await launchWebScaffold({ profile: { packages: [{ dir: BUNDLE, enabled: true }] }, extraOverlayPath: overlay })
+ browser = await chromium.launch({ args: ['--use-fake-ui-for-media-stream', '--use-fake-device-for-media-stream'] })
+ })
+ afterAll(async () => {
+ await browser?.close()
+ await scaffold?.close()
+ await services?.close()
+ if (root !== undefined) await rm(root, { recursive: true, force: true })
+ })
+
+ it('asks for sign-in, dictates through the account token, and asks again after the service rejects it', async () => {
+ const context = await browser.newContext({ viewport: { width: 1440, height: 960 }, locale: 'en-US' })
+ onTestFinished(() => context.close())
+ const page = await context.newPage()
+ const tripwire = watchConsole(page)
+ onTestFailed(() => saveFailureShot(page, 'web-e2e-voice-input-cloud'))
+ await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
+ await connectFreshWorkspace(page, scaffold.workspaceCwd)
+ const input = page.locator('[data-composer-input]')
+
+ await page.getByRole('button', { name: 'Open voice input setup', exact: true }).click()
+ const prompt = page.getByRole('dialog', { name: 'Cloud recognition requires a DeepSeek account', exact: true })
+ await prompt.waitFor()
+ await compareOrRefreshGolden(SIGN_IN_EXPECTED, await captureStableAria(page, '[role="dialog"]', scaffold.workspaceCwd), MODE)
+ const tab = context.waitForEvent('page')
+ await prompt.getByRole('button', { name: 'Sign in to DeepSeek', exact: true }).click()
+ const authorization = await tab
+ await authorization.waitForURL(url => url.pathname === '/dsh/authorized', { timeout: 30_000 })
+ await page.bringToFront()
+ expect(await prompt.count()).toBe(0)
+
+ const mic = page.getByRole('button', { name: 'Start recording', exact: true })
+ await mic.waitFor({ timeout: 30_000 })
+ await mic.hover()
+ await page.getByRole('tooltip', { name: 'Dictate · cloud recognition', exact: true }).waitFor()
+ await mic.click()
+ const stop = page.getByRole('button', { name: 'Stop and transcribe', exact: true })
+ await stop.waitFor()
+ await compareOrRefreshGolden(RECORDING_EXPECTED, await captureStableAria(page, '[data-composer-card]', scaffold.workspaceCwd), MODE)
+ // Controlled fake microphone audio occupies this recording interval; it is not a readiness wait.
+ await page.waitForTimeout(300)
+ await stop.click()
+ await expect.poll(() => input.innerText(), { timeout: 30_000 }).toBe(TEXT)
+ expect(services.recognitions).toHaveLength(1)
+ const [first] = services.recognitions
+ // The default automatic language sends no preference; the English UI is sent as the service's locale.
+ expect(first).toMatchObject({ token: TOKEN, format: 'pcm', language: undefined, locale: 'en_US' })
+ expect(first!.audioId).toMatch(/^[0-9a-f-]{36}$/)
+ expect(first!.pcmBytes % 32).toBe(0)
+ expect(first!.pcmBytes).toBeGreaterThan(0)
+
+ services.control.rejectNext = true
+ await mic.click()
+ await stop.waitFor()
+ await page.waitForTimeout(300)
+ await stop.click()
+ await page.getByText('Your DeepSeek sign-in has expired. Sign in again.', { exact: true }).waitFor({ timeout: 30_000 })
+ await page.getByRole('button', { name: 'Sign in to DeepSeek', exact: true }).waitFor()
+ expect(services.recognitions).toHaveLength(2)
+ expect(await input.innerText()).toBe(TEXT)
+ await page.getByRole('button', { name: 'Cancel', exact: true }).click()
+ await page.getByRole('button', { name: 'Open voice input setup', exact: true }).waitFor({ timeout: 30_000 })
+ expect(tripwire.pageErrors).toEqual([])
+ }, 120_000)
+})
diff --git a/apps/web/tests/voice-input.e2e.ts b/apps/web/tests/voice-input.e2e.ts
index 133bcb416a..66dbe8daa7 100644
--- a/apps/web/tests/voice-input.e2e.ts
+++ b/apps/web/tests/voice-input.e2e.ts
@@ -28,7 +28,8 @@ it.skipIf(webSnapshotMode() === 'record')('guides voice setup, records from stan
}
})
const overlay = join(scratch, 'voice.patch.yml')
- await writeFile(overlay, '- id: speech-to-text-sensevoice\n disabled: true\n')
+ // Local recording only: the shipped cloud recognizer would change automatic selection and its setup guidance.
+ await writeFile(overlay, '- id: speech-to-text-sensevoice\n disabled: true\n- id: speech-to-text-deepseek\n disabled: true\n')
const prompt = fixtureUserPrompts(await readFile(fixture, 'utf8'))[0]!
const prefix = 'Use the bash tool to '
const scaffold = await launchWebScaffold({ profile: { packages: [{ dir: bundle, enabled: true }] },
diff --git a/apps/web/tests/voice-setup.e2e.ts b/apps/web/tests/voice-setup.e2e.ts
index b592e9eb48..bf1c3c6f8e 100644
--- a/apps/web/tests/voice-setup.e2e.ts
+++ b/apps/web/tests/voice-setup.e2e.ts
@@ -1,4 +1,4 @@
-/** Empty local caches guide explicit enablement to plugin setup without starting installation. */
+/** Signed out with empty local caches, enabling voice input offers DeepSeek sign-in or local setup without starting installation. */
import { fileURLToPath } from 'node:url'
import { chromium, type Browser } from 'playwright'
import { expect, it, onTestFinished } from 'vitest'
@@ -8,7 +8,7 @@ import { newEnglishPage } from './support.ts'
const bundle = fileURLToPath(new URL('../../../packages/experimental/voice-input-bundle', import.meta.url))
const expected = fileURLToPath(new URL('./expected/voice-setup.expected.md', import.meta.url))
-it('guides a newly enabled voice plugin to installation and lets the user postpone it', async () => {
+it('offers sign-in or local setup when a signed-out user enables the voice plugin and lets the user postpone it', async () => {
const resources: { scaffold?: WebScaffold; browser?: Browser } = {}
onTestFinished(async () => {
try { await resources.browser?.close() } finally { await resources.scaffold?.close() }
@@ -23,7 +23,7 @@ it('guides a newly enabled voice plugin to installation and lets the user postpo
const toggle = page.getByRole('switch', { name: 'Enable Voice input', exact: true })
await toggle.waitFor()
expect(await toggle.getAttribute('aria-checked')).toBe('false')
- const dialog = page.getByRole('dialog', { name: 'Set up voice input before recording', exact: true })
+ const dialog = page.getByRole('dialog', { name: 'Prepare speech recognition', exact: true })
expect(await dialog.count()).toBe(0)
await toggle.click()
await dialog.waitFor()
@@ -35,7 +35,7 @@ it('guides a newly enabled voice plugin to installation and lets the user postpo
expect(await card.getByRole('status').textContent()).toBe('')
await toggle.click()
await page.getByRole('switch', { name: 'Enable Voice input', exact: true, checked: false }).click()
- await dialog.getByRole('button', { name: 'Go to setup', exact: true }).click()
+ await dialog.getByRole('button', { name: 'Download local model', exact: true }).click()
await page.getByRole('button', { name: 'Download and prepare', exact: true }).waitFor()
expect(await dialog.count()).toBe(0)
expect(await page.getByText('Local models will be downloaded to the machine running DSH. No Python or compiler is required.', { exact: true }).count()).toBe(1)
@@ -44,9 +44,9 @@ it('guides a newly enabled voice plugin to installation and lets the user postpo
expect(await source.inputValue()).toBe('')
expect(await source.getByRole('option').allTextContents()).toEqual(['Automatic (recommended)', 'Hugging Face', 'HF-Mirror (China mirror)'])
await compareOrRefreshGolden(fileURLToPath(new URL('./expected/voice-source-auto.expected.md', import.meta.url)),
- await captureStableAria(page, '[data-speech-provider]', scaffold.workspaceCwd), webSnapshotMode())
+ await captureStableAria(page, '[data-speech-provider="sensevoice-local"]', scaffold.workspaceCwd), webSnapshotMode())
await source.selectOption('https://hf-mirror.com')
await compareOrRefreshGolden(fileURLToPath(new URL('./expected/voice-source-manual.expected.md', import.meta.url)),
- await captureStableAria(page, '[data-speech-provider]', scaffold.workspaceCwd), webSnapshotMode())
+ await captureStableAria(page, '[data-speech-provider="sensevoice-local"]', scaffold.workspaceCwd), webSnapshotMode())
expect(tripwire.pageErrors).toEqual([])
})
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index ec47d94afe..aa8737fad6 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -56,6 +56,7 @@
"tests/connection-recovery.e2e.ts",
"tests/server-restart.e2e.ts",
"tests/voice-input.e2e.ts",
+ "tests/voice-input-cloud.e2e.ts",
"tests/cot-translation.e2e.ts",
"tests/cot-translation-paid.e2e.ts",
"tests/forge-panel.e2e.ts",
diff --git a/docs/config-catalog.md b/docs/config-catalog.md
index 541f35bf98..728aa9bfa1 100644
--- a/docs/config-catalog.md
+++ b/docs/config-catalog.md
@@ -859,7 +859,7 @@ export interface Config {
## `@deepseek-ai/dsh-deepseek-account-platform`
- `inject`: `credentials` · `authorization`
-- `source`: [`packages/credentials/deepseek-account-platform/src/index.ts:23`](../packages/credentials/deepseek-account-platform/src/index.ts)
+- `source`: [`packages/credentials/deepseek-account-platform/src/index.ts:41`](../packages/credentials/deepseek-account-platform/src/index.ts)
```ts config-catalog
/** Deployment-specific platform and request deadlines. */
@@ -872,6 +872,8 @@ export interface Config {
embeddedPageDist?: string
/** Exact HTTP(S) origin allowed to receive account tokens for inference and files. */
inferenceOrigin?: string
+ /** Further exact HTTP(S) origins of DeepSeek services, such as speech recognition, allowed to receive account tokens. */
+ serviceOrigins?: string[]
/** Allow HTTP only on loopback for the development Mock. */
allowLoopbackHttp?: boolean
/** Map authorization and completion pages to platformOrigin for private development proxies. */
@@ -900,7 +902,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-api-speech-to-text`
- `inject`: `speechToText` · `typert`
-- `source`: [`packages/experimental/api-speech-to-text/src/index.ts:20`](../packages/experimental/api-speech-to-text/src/index.ts)
+- `source`: [`packages/experimental/api-speech-to-text/src/index.ts:23`](../packages/experimental/api-speech-to-text/src/index.ts)
```ts config-catalog
/** Limits applied before decoding or calling a provider. */
@@ -1340,13 +1342,15 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-speech-to-text`
- `refs`: `Volatile` (`@deepseek-ai/cordis`)
-- `source`: [`packages/experimental/speech-to-text/src/index.ts:20`](../packages/experimental/speech-to-text/src/index.ts)
+- `source`: [`packages/experimental/speech-to-text/src/index.ts:27`](../packages/experimental/speech-to-text/src/index.ts)
```ts config-catalog
/** Live selection read before a transcription starts; `configure()` writes it through the profile. */
export interface Config {
- /** Registered provider selected when the caller omits an id. */
+ /** Registered provider selected when the caller omits an id, or `auto` to follow `autoOrder`. */
defaultProvider: Volatile
+ /** Provider ids considered by automatic selection, in preference order; required while `defaultProvider` is `auto`. */
+ autoOrder: string[]
/** Provider language hint selected when the caller omits one. */
language: Volatile
}
@@ -3437,6 +3441,37 @@ export interface Config {
```
+
+
+
+## `@deepseek-ai/dsh-speech-to-text-deepseek`
+
+- `inject`: `speechToText`
+- `source`: [`packages/experimental/speech-to-text-deepseek/src/config.ts:7`](../packages/experimental/speech-to-text-deepseek/src/config.ts)
+
+```ts config-catalog
+/** Endpoint and service limits; requests authenticate with the DeepSeek account token released for the endpoint. */
+export interface Config {
+ /** Unique registration id; `speech-to-text` selects this exact id. */
+ providerId: string
+ /** Complete One-Shot transcription URL. */
+ endpoint: string
+ /** Permit plain HTTP to a loopback endpoint, for local service doubles. */
+ allowLoopbackHttp: boolean
+ /** Deadline for one request attempt, including its response body. */
+ timeoutMs: number
+ /** Maximum multipart request bytes the service accepts. */
+ maxRequestBytes: number
+ /** Maximum recording duration the service accepts. */
+ maxDurationSeconds: number
+ /** Maximum response body bytes read from the service. */
+ maxResponseBytes: number
+ /** Language codes the service recognizes, sent as `preferred_language`; `auto` sends none and must be listed. */
+ languages: string[]
+}
+```
+
+
diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md
index ddb66d4024..d0c985d242 100644
--- a/docs/config-catalog.zh.md
+++ b/docs/config-catalog.zh.md
@@ -861,7 +861,7 @@ export interface Config {
## `@deepseek-ai/dsh-deepseek-account-platform`
- `inject`: `credentials` · `authorization`
-- `source`: [`packages/credentials/deepseek-account-platform/src/index.ts:23`](../packages/credentials/deepseek-account-platform/src/index.ts)
+- `source`: [`packages/credentials/deepseek-account-platform/src/index.ts:41`](../packages/credentials/deepseek-account-platform/src/index.ts)
```ts config-catalog
/** Deployment-specific platform and request deadlines. */
@@ -874,6 +874,8 @@ export interface Config {
embeddedPageDist?: string
/** Exact HTTP(S) origin allowed to receive account tokens for inference and files. */
inferenceOrigin?: string
+ /** Further exact HTTP(S) origins of DeepSeek services, such as speech recognition, allowed to receive account tokens. */
+ serviceOrigins?: string[]
/** Allow HTTP only on loopback for the development Mock. */
allowLoopbackHttp?: boolean
/** Map authorization and completion pages to platformOrigin for private development proxies. */
@@ -902,7 +904,7 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-api-speech-to-text`
- `inject`: `speechToText` · `typert`
-- `source`: [`packages/experimental/api-speech-to-text/src/index.ts:20`](../packages/experimental/api-speech-to-text/src/index.ts)
+- `source`: [`packages/experimental/api-speech-to-text/src/index.ts:23`](../packages/experimental/api-speech-to-text/src/index.ts)
```ts config-catalog
/** Limits applied before decoding or calling a provider. */
@@ -1342,13 +1344,15 @@ export interface Config {
## `@deepseek-ai/dsh-experimental-speech-to-text`
- `refs`: `Volatile` (`@deepseek-ai/cordis`)
-- `source`: [`packages/experimental/speech-to-text/src/index.ts:20`](../packages/experimental/speech-to-text/src/index.ts)
+- `source`: [`packages/experimental/speech-to-text/src/index.ts:27`](../packages/experimental/speech-to-text/src/index.ts)
```ts config-catalog
/** Live selection read before a transcription starts; `configure()` writes it through the profile. */
export interface Config {
- /** Registered provider selected when the caller omits an id. */
+ /** Registered provider selected when the caller omits an id, or `auto` to follow `autoOrder`. */
defaultProvider: Volatile
+ /** Provider ids considered by automatic selection, in preference order; required while `defaultProvider` is `auto`. */
+ autoOrder: string[]
/** Provider language hint selected when the caller omits one. */
language: Volatile
}
@@ -3439,6 +3443,37 @@ export interface Config {
```
+
+
+
+## `@deepseek-ai/dsh-speech-to-text-deepseek`
+
+- `inject`: `speechToText`
+- `source`: [`packages/experimental/speech-to-text-deepseek/src/config.ts:7`](../packages/experimental/speech-to-text-deepseek/src/config.ts)
+
+```ts config-catalog
+/** Endpoint and service limits; requests authenticate with the DeepSeek account token released for the endpoint. */
+export interface Config {
+ /** Unique registration id; `speech-to-text` selects this exact id. */
+ providerId: string
+ /** Complete One-Shot transcription URL. */
+ endpoint: string
+ /** Permit plain HTTP to a loopback endpoint, for local service doubles. */
+ allowLoopbackHttp: boolean
+ /** Deadline for one request attempt, including its response body. */
+ timeoutMs: number
+ /** Maximum multipart request bytes the service accepts. */
+ maxRequestBytes: number
+ /** Maximum recording duration the service accepts. */
+ maxDurationSeconds: number
+ /** Maximum response body bytes read from the service. */
+ maxResponseBytes: number
+ /** Language codes the service recognizes, sent as `preferred_language`; `auto` sends none and must be listed. */
+ languages: string[]
+}
+```
+
+
diff --git a/docs/module-graph.md b/docs/module-graph.md
index f58da15929..176ac5f286 100644
--- a/docs/module-graph.md
+++ b/docs/module-graph.md
@@ -311,6 +311,7 @@ flowchart TD
pkg_plugin_recommendations["plugin-recommendations"]
pkg_session_title_all_prompts_llm["session-title-all-prompts-llm"]
pkg_skill_badge["skill-badge"]
+ pkg_speech_to_text_deepseek["speech-to-text-deepseek"]
pkg_tool_ralph["tool-ralph"]
pkg_tool_session_query["tool-session-query"]
pkg_tool_terminal["tool-terminal"]
@@ -791,6 +792,8 @@ flowchart TD
pkg_experimental_worktree --> pkg_sandbox_policy
pkg_experimental_worktree --> pkg_subprocess
pkg_experimental_worktree --> pkg_working_directory
+ pkg_speech_to_text_deepseek --> pkg_deepseek_account
+ pkg_speech_to_text_deepseek --> pkg_experimental_speech_to_text
pkg_command_feedback --> pkg_anonymous_user_id
pkg_command_feedback --> pkg_commands
pkg_command_feedback --> pkg_session
@@ -1768,6 +1771,7 @@ flowchart TD
| [`deepseek-account-platform`](../packages/credentials/deepseek-account-platform) | `credentials` | [`authorization`](../packages/credentials/authorization), [`credentials`](../packages/credentials/credentials), [`deepseek-account`](../packages/credentials/deepseek-account), [`host-webserver`](../packages/host/webserver) |
| [`experimental-ptc-runtime-python`](../packages/experimental/ptc-runtime-python) | `experimental` | [`ptc-runtime`](../packages/ptc-runtime/ptc-runtime), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`timeout`](../packages/util/timeout), [`util-values`](../packages/util/values) |
| [`experimental-worktree`](../packages/experimental/worktree) | `experimental` | [`agent`](../packages/core/agent), [`fs`](../packages/fs/fs), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`subprocess`](../packages/subprocess/subprocess), [`working-directory`](../packages/session/working-directory) |
+| [`speech-to-text-deepseek`](../packages/experimental/speech-to-text-deepseek) | `experimental` | [`deepseek-account`](../packages/credentials/deepseek-account), [`experimental-speech-to-text`](../packages/experimental/speech-to-text) |
| [`command-feedback`](../packages/feedback/command-feedback) | `feedback` | [`anonymous-user-id`](../packages/identity/anonymous-user-id), [`commands`](../packages/interaction/commands), [`session`](../packages/core/session), [`typert-protocol`](../packages/typert/protocol) |
| [`permission-presets`](../packages/interaction/permission-presets) | `interaction` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`shell`](../packages/shell/shell), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval) |
| [`jobs-local`](../packages/jobs/jobs-local) | `jobs` | [`agent`](../packages/core/agent), [`jobs`](../packages/jobs/jobs), [`scope`](../packages/core/scope), [`timeout`](../packages/util/timeout) |
diff --git a/docs/module-graph.zh.md b/docs/module-graph.zh.md
index 372f734770..2e4f7413e1 100644
--- a/docs/module-graph.zh.md
+++ b/docs/module-graph.zh.md
@@ -313,6 +313,7 @@ flowchart TD
pkg_plugin_recommendations["plugin-recommendations"]
pkg_session_title_all_prompts_llm["session-title-all-prompts-llm"]
pkg_skill_badge["skill-badge"]
+ pkg_speech_to_text_deepseek["speech-to-text-deepseek"]
pkg_tool_ralph["tool-ralph"]
pkg_tool_session_query["tool-session-query"]
pkg_tool_terminal["tool-terminal"]
@@ -793,6 +794,8 @@ flowchart TD
pkg_experimental_worktree --> pkg_sandbox_policy
pkg_experimental_worktree --> pkg_subprocess
pkg_experimental_worktree --> pkg_working_directory
+ pkg_speech_to_text_deepseek --> pkg_deepseek_account
+ pkg_speech_to_text_deepseek --> pkg_experimental_speech_to_text
pkg_command_feedback --> pkg_anonymous_user_id
pkg_command_feedback --> pkg_commands
pkg_command_feedback --> pkg_session
@@ -1770,6 +1773,7 @@ flowchart TD
| [`deepseek-account-platform`](../packages/credentials/deepseek-account-platform) | `credentials` | [`authorization`](../packages/credentials/authorization), [`credentials`](../packages/credentials/credentials), [`deepseek-account`](../packages/credentials/deepseek-account), [`host-webserver`](../packages/host/webserver) |
| [`experimental-ptc-runtime-python`](../packages/experimental/ptc-runtime-python) | `experimental` | [`ptc-runtime`](../packages/ptc-runtime/ptc-runtime), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`timeout`](../packages/util/timeout), [`util-values`](../packages/util/values) |
| [`experimental-worktree`](../packages/experimental/worktree) | `experimental` | [`agent`](../packages/core/agent), [`fs`](../packages/fs/fs), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`subprocess`](../packages/subprocess/subprocess), [`working-directory`](../packages/session/working-directory) |
+| [`speech-to-text-deepseek`](../packages/experimental/speech-to-text-deepseek) | `experimental` | [`deepseek-account`](../packages/credentials/deepseek-account), [`experimental-speech-to-text`](../packages/experimental/speech-to-text) |
| [`command-feedback`](../packages/feedback/command-feedback) | `feedback` | [`anonymous-user-id`](../packages/identity/anonymous-user-id), [`commands`](../packages/interaction/commands), [`session`](../packages/core/session), [`typert-protocol`](../packages/typert/protocol) |
| [`permission-presets`](../packages/interaction/permission-presets) | `interaction` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`sandbox`](../packages/sandbox/sandbox), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`shell`](../packages/shell/shell), [`typert-protocol`](../packages/typert/protocol), [`user-approval`](../packages/interaction/user-approval) |
| [`jobs-local`](../packages/jobs/jobs-local) | `jobs` | [`agent`](../packages/core/agent), [`jobs`](../packages/jobs/jobs), [`scope`](../packages/core/scope), [`timeout`](../packages/util/timeout) |
diff --git a/docs/subsystems/credentials.md b/docs/subsystems/credentials.md
index 2a084fb29f..bcb6a205f2 100644
--- a/docs/subsystems/credentials.md
+++ b/docs/subsystems/credentials.md
@@ -338,7 +338,7 @@ abstract signOut(client: AccountClientMetadata): Promise
abstract watch(signal: AbortSignal, includeIdentityChanges?: boolean): AsyncIterable
/**
- * Resolve a credential only for the inference origin allowed by the provider.
+ * Resolve a credential only for an origin the provider allows, such as its inference and service origins.
* @param url - actual request destination or API base URL.
* @returns stored token, or undefined for other origins or a signed-out account.
*/
diff --git a/docs/subsystems/credentials.zh.md b/docs/subsystems/credentials.zh.md
index 1e9221699a..8b66881431 100644
--- a/docs/subsystems/credentials.zh.md
+++ b/docs/subsystems/credentials.zh.md
@@ -338,7 +338,7 @@ abstract signOut(client: AccountClientMetadata): Promise
abstract watch(signal: AbortSignal, includeIdentityChanges?: boolean): AsyncIterable
/**
- * Resolve a credential only for the inference origin allowed by the provider.
+ * Resolve a credential only for an origin the provider allows, such as its inference and service origins.
* @param url - actual request destination or API base URL.
* @returns stored token, or undefined for other origins or a signed-out account.
*/
diff --git a/docs/subsystems/voice-input.i18n.yaml b/docs/subsystems/voice-input.i18n.yaml
index 5d8400aa8e..3360ab1087 100644
--- a/docs/subsystems/voice-input.i18n.yaml
+++ b/docs/subsystems/voice-input.i18n.yaml
@@ -6,8 +6,8 @@
en: b21f58d0dcb90287
zh: be60807d02623a87
/voice-input/provider-selection:
- en: 3a5ec4718b839349
- zh: a8448bd6064d4c81
+ en: 5693cf0e60ba2c08
+ zh: 2a366af304dcdc74
/voice-input/browser-and-host-ownership:
en: 404d67d8276522db
zh: f653397888d2e616
diff --git a/docs/subsystems/voice-input.md b/docs/subsystems/voice-input.md
index 1d85e8226a..6b597ca1fb 100644
--- a/docs/subsystems/voice-input.md
+++ b/docs/subsystems/voice-input.md
@@ -8,6 +8,8 @@ Experimental speech recognition has three roles: the [Service Definition](../../
`SpeechProviderId` brands the registration identity. `SpeechProviderInfo` carries a display name, accepted `languages` hints and `host-local` or `cloud` processing location. `SpeechRequest` contains WAV bytes and optional provider/language selection; `resolve()` produces `SpeechSpec` with one captured provider instance. A missing provider or unsupported language fails; replacement or withdrawal invalidates resolved work. Audio never falls back to a different provider.
+`defaultProvider: auto` selects, before recording, the first registered `autoOrder` provider whose state is not `unavailable`. The bundle orders the [DeepSeek cloud provider](../../packages/experimental/speech-to-text-deepseek/README.md) before SenseVoice, so a signed-in DeepSeek account uses cloud recognition. The cloud provider stays `unavailable` with `sign-in-required` until an account is stored, authenticates like the account model route, and sends the saved language and the UI language to the service. A provider that does not list the saved language receives `auto`. Expected failures carry a `SpeechFailureCode` through the Remote for localized recovery.
+
`SpeechProvider.transcribe()` accepts one complete `SpeechInput` and an `AbortSignal`. `Transcript` returns plain `text`, `audioSeconds` and `inferenceSeconds`. Providers honor cancellation and settle their work before deregistration completes. The local provider serializes calls, bounds its queue and manages its worker lifetime independently of Sessions.
## Browser and Host ownership
@@ -124,8 +126,9 @@ async *follow(caller: AbortSignal): AsyncIterable
snapshot(): SpeechSnapshot
/**
- * Persist changed selection fields into this plugin's profile entry; the resulting language must be accepted by the selected provider.
- * @param patch - explicit provider or language changes.
+ * Persist changed selection fields into this plugin's profile entry. The language must be listed by at least one
+ * registered provider; a provider that does not list it receives `auto` when it transcribes.
+ * @param patch - explicit provider, `auto`, or language changes.
* @returns after the profile write and the live update it applies.
*/
async configure(patch: SpeechSelectionPatch): Promise
@@ -145,8 +148,9 @@ prepare(id: SpeechProviderId, options?: SpeechPreparationOptions): void
async cancelPreparation(id: SpeechProviderId): Promise
/**
- * Apply composition defaults and capture the selected provider. Missing providers and unsupported languages fail explicitly.
- * @param request - complete recording and optional selection.
+ * Apply the saved selection and capture the provider. Missing providers and hints no registered provider lists fail
+ * explicitly; the captured provider receives the hint when it lists it and `auto` otherwise.
+ * @param request - complete recording, optional selection and the client's UI language.
* @returns provider-pinned input for transcribe().
*/
resolve(request: SpeechRequest): SpeechSpec
diff --git a/docs/subsystems/voice-input.zh.md b/docs/subsystems/voice-input.zh.md
index 78a70ab9c2..b272d5f111 100644
--- a/docs/subsystems/voice-input.zh.md
+++ b/docs/subsystems/voice-input.zh.md
@@ -8,6 +8,8 @@
`SpeechProviderId` 为注册标识添加类型品牌。`SpeechProviderInfo` 携带显示名称、支持的 `languages` 语言提示及 `host-local` 或 `cloud` 处理位置。`SpeechRequest` 包含 WAV 字节和可选的 Provider、语言选择;`resolve()` 生成捕获一个 Provider 实例的 `SpeechSpec`。缺失的 Provider 或不支持的语言会报错;替换或撤销会使已解析的任务失效。音频不会回退到其他 Provider。
+`defaultProvider: auto` 在录音前选择 `autoOrder` 中第一个已注册且状态不是 `unavailable` 的 Provider。Bundle 把 [DeepSeek 云端 Provider](../../packages/experimental/speech-to-text-deepseek/README.zh.md) 排在 SenseVoice 之前,因此已登录 DeepSeek 账号时使用云端识别。云端 Provider 在保存账号之前处于带 `sign-in-required` 的 `unavailable`,鉴权方式与账号模型路由相同,并把保存的语言和界面语言发送给服务。未列出已保存语言的 Provider 收到 `auto`。可预期的失败通过 Remote 携带 `SpeechFailureCode`,供界面本地化恢复提示。
+
`SpeechProvider.transcribe()` 接收完整的 `SpeechInput` 与 `AbortSignal`。`Transcript` 返回纯文本 `text`、`audioSeconds` 和 `inferenceSeconds`。Provider 响应取消,并在注销完成前结束其任务。本地 Provider 串行执行调用、限制队列,并独立于 Session 管理工作进程生命周期。
## 浏览器与 Host 所有权
@@ -124,8 +126,9 @@ async *follow(caller: AbortSignal): AsyncIterable
snapshot(): SpeechSnapshot
/**
- * Persist changed selection fields into this plugin's profile entry; the resulting language must be accepted by the selected provider.
- * @param patch - explicit provider or language changes.
+ * Persist changed selection fields into this plugin's profile entry. The language must be listed by at least one
+ * registered provider; a provider that does not list it receives `auto` when it transcribes.
+ * @param patch - explicit provider, `auto`, or language changes.
* @returns after the profile write and the live update it applies.
*/
async configure(patch: SpeechSelectionPatch): Promise
@@ -145,8 +148,9 @@ prepare(id: SpeechProviderId, options?: SpeechPreparationOptions): void
async cancelPreparation(id: SpeechProviderId): Promise
/**
- * Apply composition defaults and capture the selected provider. Missing providers and unsupported languages fail explicitly.
- * @param request - complete recording and optional selection.
+ * Apply the saved selection and capture the provider. Missing providers and hints no registered provider lists fail
+ * explicitly; the captured provider receives the hint when it lists it and `auto` otherwise.
+ * @param request - complete recording, optional selection and the client's UI language.
* @returns provider-pinned input for transcribe().
*/
resolve(request: SpeechRequest): SpeechSpec
diff --git a/packages/client/ui-settings-account/README.i18n.yaml b/packages/client/ui-settings-account/README.i18n.yaml
index ebcb4c7149..81358aa038 100644
--- a/packages/client/ui-settings-account/README.i18n.yaml
+++ b/packages/client/ui-settings-account/README.i18n.yaml
@@ -15,8 +15,8 @@
en: c26f81e8adf0128b
zh: e11ab371f51f66bc
/deepseek-ai-dsh-client-ui-settings-account/use-this-package:
- en: 2e63a8b01d800894
- zh: 42db1f28e2ddb2a3
+ en: ec5e1aa5d0e3ae00
+ zh: 0bb340658d11656f
/deepseek-ai-dsh-client-ui-settings-account/use-this-package/desktop-onboarding:
en: 7ae4e68f9491b068
zh: f7478269bf8d28b3
diff --git a/packages/client/ui-settings-account/README.md b/packages/client/ui-settings-account/README.md
index f16fe754b3..5824aac284 100644
--- a/packages/client/ui-settings-account/README.md
+++ b/packages/client/ui-settings-account/README.md
@@ -30,6 +30,8 @@ A new account-model sign-in-required event displays “Model unavailable. Please
Desktop and plain Web clients both mount the sidebar account launcher, Account settings, the sign-in step of model onboarding, and the account-state subscription. Desktop main opens the authorization page in the system browser. A plain Web client, identified by the absent Desktop preload bridge, sends `login_source` web with its own origin as the callback origin, preopens a tab during the sign-in click, navigates it to the authorization URL with the same `theme` parameter once its attempt receives one, and closes it on failure, expiry, or cancellation; a blocked popup leaves the copy-link route. Embedded Platform pages, Desktop onboarding, and the native device reader stay Desktop-only, so Web Platform links open new tabs.
+While the Peer may watch the account, the plugin provides the Client service `accountSignIn`, whose `open()` shows the sign-in dialog and starts a browser attempt; callers invoke it from a click so a plain Web client can preopen the authorization tab. Revoking account access withdraws the service.
+
The sidebar and Account settings display circular profile images with diameters of 24px and 32px respectively. Both observe one browser image load and show the account icon while no URL is available, loading is pending, or loading failed. A rendered image failure updates the shared result, so both surfaces return to the icon and remain eligible for retry; reports from a superseded picture attempt are ignored. Each Settings entry, or return from a Settings or quota-notice top-up page, retries a failed image once even when its URL is unchanged; pending and successful loads are reused, and success updates both surfaces. A changed picture URL starts a new load; account-state replacement, sign-out, and plugin unload discard the previous picture and its callbacks. The collapsed sidebar centers the avatar in a 36 × 36 px button. Before sign-in the sidebar launcher shows a compact More row instead, leading with the ellipsis glyph and aligning its content and inset hover fill with navigation rows. Expanded buttons use border-box sizing: the signed-in row is 44px high including its 6px padding, and the signed-out More row is 32px high. The signed-in launcher retains its 24px avatar and 8px label gap and owns a 2px inline margin on its root; this inset does not move the Settings shell's adjacent status indicator horizontally.
The section registers through settings.section and uses the account Remote namespace. The stream survives carrier reconnects through the shared Remote supervisor. The page renders feature-owned English and Chinese copy and keeps API keys separate from account state.
diff --git a/packages/client/ui-settings-account/README.zh.md b/packages/client/ui-settings-account/README.zh.md
index 6599e08a22..2ccbf3c141 100644
--- a/packages/client/ui-settings-account/README.zh.md
+++ b/packages/client/ui-settings-account/README.zh.md
@@ -30,6 +30,8 @@ kind: "package-reference"
Desktop 与普通 Web 客户端都挂载侧边栏账号菜单、账号设置、模型引导中的登录步骤,并订阅账号状态。Desktop 主进程在系统浏览器中打开授权页面。普通 Web 客户端(以缺少 Desktop preload 桥接识别)以 `login_source` web 发起登录,并以自身 origin 作为回调 origin;它在点击登录时预先打开一个标签页,本次尝试获得授权 URL 后带上相同的 `theme` 参数导航该标签页,并在失败、过期或取消时关闭它;弹窗被拦截时仍可使用复制链接。内嵌 Platform 页面、Desktop 引导和原生设备信息读取器仅在 Desktop 中提供,因此 Web 中的 Platform 链接在新标签页打开。
+当前 Peer 可以观察账号时,插件提供 Client 服务 `accountSignIn`,其 `open()` 显示登录弹窗并发起一次浏览器登录;调用方应在点击处理中调用,以便普通 Web 客户端预先打开授权标签页。撤销账号访问权限时该服务随之撤回。
+
侧边栏和账号设置以正圆图片显示账号头像,直径分别为 24px 和 32px。两处共享一次浏览器图片加载,URL 缺失、加载中或加载失败时使用账号图标兜底。渲染图片失败时更新共享结果,两处一起恢复为图标,并保留重试机会;已被替换的图片加载尝试上报的失败会被忽略。每次进入设置,或从设置及余额不足提示打开的充值页面返回时,都会重试一次失败的图片,即使 URL 未变化;加载中和已成功的图片会复用,成功后两处一起展示。头像 URL 变化时开始新加载;账号状态替换、退出登录和插件卸载会丢弃旧头像及其回调。折叠侧边栏将头像居中放置在 36 × 36 px 的按钮内。登录前侧边栏入口改为紧凑的「更多」行,以三点图标开头,内容和内缩的悬停底色与导航行对齐。展开态按钮采用 border-box 尺寸:已登录行含 6px 内边距共高 44px,未登录的「更多」行高 32px。已登录入口保留 24px 头像及 8px 标签间距,并由自身根节点承担左右各 2px 外边距;该内缩不会水平移动设置外壳中相邻的状态指示器。
该页面通过 settings.section 注册,并使用 account Remote 命名空间。共享 Remote 管理器负责连接恢复后的流重连。页面使用功能自有的中英文文案,将 API Key 与账号状态分开。
diff --git a/packages/client/ui-settings-account/src/client/index.ts b/packages/client/ui-settings-account/src/client/index.ts
index 45f13a1b97..e60be33484 100644
--- a/packages/client/ui-settings-account/src/client/index.ts
+++ b/packages/client/ui-settings-account/src/client/index.ts
@@ -41,6 +41,16 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
interface LocaleNamespaceMap { 'settings.account': AccountKey }
}
+declare module '@deepseek-ai/cordis' {
+ interface Context {
+ /** Cross-plugin entry to the account sign-in dialog; present while this Peer may watch the account. */
+ accountSignIn: {
+ /** Show the sign-in dialog and start a browser attempt; call it from the user's click so the tab can preopen. */
+ open(): void
+ }
+ }
+}
+
/** Services required by account settings. */
export const inject = ['slots', 'locale', 'remote', 'remote.account', 'remote.session', 'theme', 'configForms', 'remoteAccess']
/** Register account UI in Desktop and plain Web clients. @param ctx - client plugin context. */
@@ -333,6 +343,12 @@ export function apply(ctx: Context): void {
ctx.remoteAccess.whenAccess('account/watch', () => ctx.slots.inject('settings.launcher', () => ctx.slots.register({
name: 'settings.launcher', locale: 'settings.account', inject: () => operations,
}, AccountMenu)))
+ ctx.remoteAccess.whenAccess('account/watch', () => {
+ const withdraw = ctx.reflect.provide('accountSignIn', { open: () => { void operations.start().catch((_shownInDialog: unknown) => {
+ // start() already published loginFailed, which the sign-in dialog renders for this attempt.
+ }) } })
+ return () => { void withdraw() }
+ })
ctx.remoteAccess.whenAccess('account/watch', () => ctx.slots.inject('settings.section', () => {
let unregister: (() => void) | undefined
const update = () => {
diff --git a/packages/client/ui-settings-account/tests/access-revocation.client.spec.ts b/packages/client/ui-settings-account/tests/access-revocation.client.spec.ts
index c969148d1b..1388173ede 100644
--- a/packages/client/ui-settings-account/tests/access-revocation.client.spec.ts
+++ b/packages/client/ui-settings-account/tests/access-revocation.client.spec.ts
@@ -62,6 +62,12 @@ it('withdraws every account surface and the account stream on revocation, and re
return () => { registered.set(entry.name, registered.get(entry.name)! - 1) }
},
},
+ reflect: {
+ provide: (name: string) => {
+ registered.set(name, (registered.get(name) ?? 0) + 1)
+ return () => { registered.set(name, registered.get(name)! - 1) }
+ },
+ },
remoteAccess: {
whenAccess: (action: string, install: () => AccessEffect) => {
guards.push({ action, install, installed: undefined })
@@ -88,22 +94,22 @@ it('withdraws every account surface and the account stream on revocation, and re
},
}
const surfaces = (): Record => Object.fromEntries(
- ['settings.launcher', 'shell.quota-notice', 'settings.models.sign-in', 'settings.section'].map(name => [name, registered.get(name)]),
+ ['settings.launcher', 'shell.quota-notice', 'settings.models.sign-in', 'settings.section', 'accountSignIn'].map(name => [name, registered.get(name)]),
)
try {
apply(ctx as never)
expect(new Set(guards.map(guard => guard.action))).toEqual(new Set(['account/watch']))
grant(guards)
await streams[0]!.accepted
- expect(surfaces()).toEqual({ 'settings.launcher': 1, 'shell.quota-notice': 1, 'settings.models.sign-in': 1, 'settings.section': 1 })
+ expect(surfaces()).toEqual({ 'settings.launcher': 1, 'shell.quota-notice': 1, 'settings.models.sign-in': 1, 'settings.section': 1, accountSignIn: 1 })
revoke(guards)
expect(streams[0]!.signal.aborted).toBe(true)
- expect(surfaces()).toEqual({ 'settings.launcher': 0, 'shell.quota-notice': 0, 'settings.models.sign-in': 0, 'settings.section': 0 })
+ expect(surfaces()).toEqual({ 'settings.launcher': 0, 'shell.quota-notice': 0, 'settings.models.sign-in': 0, 'settings.section': 0, accountSignIn: 0 })
grant(guards)
await streams[1]!.accepted
- expect(surfaces()).toEqual({ 'settings.launcher': 1, 'shell.quota-notice': 1, 'settings.models.sign-in': 1, 'settings.section': 1 })
+ expect(surfaces()).toEqual({ 'settings.launcher': 1, 'shell.quota-notice': 1, 'settings.models.sign-in': 1, 'settings.section': 1, accountSignIn: 1 })
} finally {
revoke(guards)
for (const dispose of lifetime.reverse()) dispose()
@@ -138,6 +144,12 @@ it('drops reads a revoked grant started, and the next grant shows no account sec
return () => { registered.set(entry.name, registered.get(entry.name)! - 1) }
},
},
+ reflect: {
+ provide: (name: string) => {
+ registered.set(name, (registered.get(name) ?? 0) + 1)
+ return () => { registered.set(name, registered.get(name)! - 1) }
+ },
+ },
remoteAccess: {
whenAccess: (action: string, install: () => AccessEffect) => {
guards.push({ action, install, installed: undefined })
@@ -228,6 +240,12 @@ function revocationHarness(scripts: StreamScript[]) {
return () => { registered.set(entry.name, registered.get(entry.name)! - 1) }
},
},
+ reflect: {
+ provide: (name: string) => {
+ registered.set(name, (registered.get(name) ?? 0) + 1)
+ return () => { registered.set(name, registered.get(name)! - 1) }
+ },
+ },
remoteAccess: {
whenAccess: (action: string, install: () => AccessEffect) => {
guards.push({ action, install, installed: undefined })
diff --git a/packages/client/ui-settings-account/tests/apply.client.spec.ts b/packages/client/ui-settings-account/tests/apply.client.spec.ts
index 300641d109..1d3aed2ca2 100644
--- a/packages/client/ui-settings-account/tests/apply.client.spec.ts
+++ b/packages/client/ui-settings-account/tests/apply.client.spec.ts
@@ -85,6 +85,20 @@ withoutAccountAccess('opens no account stream and registers no account surface w
expect(quotaNoticeEntry(c)).toBeUndefined()
expect(c.ctx.slots.entries('settings.models.sign-in')).toHaveLength(0)
expect(c.ctx.slots.entries('settings.section').some(entry => entry.options.id === 'account')).toBe(false)
+ expect(c.ctx.get('accountSignIn')).toBeUndefined()
+}, 60_000)
+
+it('lets other plugins open sign-in from a click and withdraws the entry on unload', async ({ start, mock }) => {
+ const open = vi.spyOn(window, 'open').mockReturnValue(null)
+ const c = await start()
+ mock.remote.account.startSignIn.mockResolvedValueOnce({ ok: false, error: new RemoteError('gateway/internal', 'offline', {}) })
+ c.ctx.get('accountSignIn')!.open()
+ // The tab preopens synchronously inside the caller's click, before the Host responds.
+ expect(open).toHaveBeenCalledOnce()
+ expect(operations(c).hooks.account.getSnapshot()).toMatchObject({ loginVisible: true })
+ await vi.waitFor(() => { expect(operations(c).hooks.account.getSnapshot()).toMatchObject({ loginFailed: true }) })
+ await c.unload(SELF)
+ expect(c.ctx.get('accountSignIn')).toBeUndefined()
}, 60_000)
it('claims account balance notices from the frame-wide quota chain and declines generic quota', async ({ start }) => {
diff --git a/packages/client/ui-settings-account/tests/initialization.client.spec.ts b/packages/client/ui-settings-account/tests/initialization.client.spec.ts
index a17217f0d2..993ebe61b6 100644
--- a/packages/client/ui-settings-account/tests/initialization.client.spec.ts
+++ b/packages/client/ui-settings-account/tests/initialization.client.spec.ts
@@ -44,6 +44,7 @@ it.each(['accepted', 'refused', 'disconnected', 'pending'] as const)('initialize
return () => {}
},
},
+ reflect: { provide: () => () => {} },
remoteAccess: {
whenAccess: (_action: string, install: () => (() => void) | Iterable<() => void> | undefined) => {
const effect = install()
diff --git a/packages/credentials/deepseek-account-platform/README.i18n.yaml b/packages/credentials/deepseek-account-platform/README.i18n.yaml
index 9e6ffe9905..8cfb8473d6 100644
--- a/packages/credentials/deepseek-account-platform/README.i18n.yaml
+++ b/packages/credentials/deepseek-account-platform/README.i18n.yaml
@@ -15,8 +15,8 @@
en: af856ba79fe31b8e
zh: 15b7d1a5d1856de2
/deepseek-ai-dsh-deepseek-account-platform/use-this-package:
- en: 56bee240f50c293a
- zh: 6c4c5de6088c9d79
+ en: a502409a77cb0cca
+ zh: 0950a4ac2989a5ad
/deepseek-ai-dsh-deepseek-account-platform/understand-the-implementation:
en: 76d2da2dab100ac3
zh: 2c9404f27915daab
diff --git a/packages/credentials/deepseek-account-platform/README.md b/packages/credentials/deepseek-account-platform/README.md
index 104b597c9a..cffd00a02f 100644
--- a/packages/credentials/deepseek-account-platform/README.md
+++ b/packages/credentials/deepseek-account-platform/README.md
@@ -65,6 +65,8 @@ Host diagnostics use `console.error` with the `[deepseek-account]` prefix on sta
inferenceOrigin defaults to `https://api.deepseek.com`. A private deployment patch may replace it with one exact HTTP(S) origin, including its port, for inference and file authentication through x-dsh-auth-token. Paths, URL credentials, queries and fragments are invalid configuration. Alternate origins require a grant issued by the configured platformOrigin; mock tokens remain excluded. Loopback grants cannot authenticate the official production API. Deployment addresses belong in private patches, not shipped configuration.
+`serviceOrigins` lists further exact origins of DeepSeek services that receive the account token, and defaults to `https://harness.deepseek.com` for speech recognition. Each entry follows the `inferenceOrigin` validation. The official origins `https://api.deepseek.com` and `https://harness.deepseek.com` never receive a loopback-issued grant; any other origin requires a grant issued by the configured platformOrigin. Set `serviceOrigins: []` to release tokens only to `inferenceOrigin`.
+
At provider initialization, a valid stored grant whose issuer differs from platformOrigin is deleted locally before consumers read account state. Startup continues signed out without a remote logout request; API keys and device identity remain stored. Storage failures remain explicit, and account HTTP or response-validation failures do not delete a matching grant.
diff --git a/packages/credentials/deepseek-account-platform/README.zh.md b/packages/credentials/deepseek-account-platform/README.zh.md
index 7e9b181868..082e5a26c9 100644
--- a/packages/credentials/deepseek-account-platform/README.zh.md
+++ b/packages/credentials/deepseek-account-platform/README.zh.md
@@ -65,6 +65,8 @@ Host 诊断仅在请求、响应校验或登录失败时,通过 `console.error
inferenceOrigin 默认为 `https://api.deepseek.com`。私有部署 patch 可将其替换为一个精确的 HTTP(S) 来源(含端口),让推理及文件请求通过 x-dsh-auth-token 认证。配置不得包含路径、URL 凭证、查询或片段。其他来源要求授权由配置的 platformOrigin 签发;仍拒绝 Mock token。本机授权不能认证官方生产 API。部署地址保存在私有 patch 中,不随默认配置发布。
+`serviceOrigins` 列出另外可以接收账号 token 的 DeepSeek 服务的精确来源,默认是用于语音识别的 `https://harness.deepseek.com`。每一项都按 `inferenceOrigin` 的规则校验。官方来源 `https://api.deepseek.com` 和 `https://harness.deepseek.com` 永远不会收到本机签发的授权;其他来源要求授权由配置的 platformOrigin 签发。设为 `serviceOrigins: []` 时只向 `inferenceOrigin` 发放 token。
+
提供者初始化时,若有效的已存授权 issuer 与 platformOrigin 不同,会在使用方读取账号状态前删除该本地授权,以未登录态继续启动,不发送远端退登请求;API Key 和设备标识保留。存储错误仍明确报错,账号 HTTP 或响应校验失败不会删除来源匹配的授权。
diff --git a/packages/credentials/deepseek-account-platform/src/index.ts b/packages/credentials/deepseek-account-platform/src/index.ts
index 0319a553c3..ef38622639 100644
--- a/packages/credentials/deepseek-account-platform/src/index.ts
+++ b/packages/credentials/deepseek-account-platform/src/index.ts
@@ -17,6 +17,24 @@ import { AccountUnauthorizedError, PlatformAuthError, platformHeaders, platformO
const KEY = credentialKey('deepseek-account-platform', 'default')
const DEVICE = credentialKey('deepseek-account-platform', 'device')
const grant = z.object({ version: z.literal(1), token: z.string().min(1), issuer: z.url() })
+/** Production DeepSeek origins; they never receive a grant issued by a loopback development platform. */
+const OFFICIAL_TOKEN_ORIGINS: ReadonlySet = new Set(['https://api.deepseek.com', 'https://harness.deepseek.com'])
+const LOOPBACK_HOSTS: ReadonlySet = new Set(['localhost', '127.0.0.1', '[::1]'])
+
+/**
+ * Validate one exact token destination.
+ * @param value - configured origin.
+ * @param field - configuration field named in the error.
+ * @returns the normalized origin.
+ */
+function tokenOrigin(value: string, field: string): string {
+ const origin = new URL(value)
+ if (!['http:', 'https:'].includes(origin.protocol) || origin.username || origin.password
+ || origin.pathname !== '/' || origin.search || origin.hash) {
+ throw new Error(`account: ${field} must be an HTTP(S) origin without credentials, path, query or fragment`)
+ }
+ return origin.origin
+}
const device = z.object({ id: z.uuid() })
/** Deployment-specific platform and request deadlines. */
@@ -29,6 +47,8 @@ export interface Config {
embeddedPageDist?: string
/** Exact HTTP(S) origin allowed to receive account tokens for inference and files. */
inferenceOrigin?: string
+ /** Further exact HTTP(S) origins of DeepSeek services, such as speech recognition, allowed to receive account tokens. */
+ serviceOrigins?: string[]
/** Allow HTTP only on loopback for the development Mock. */
allowLoopbackHttp?: boolean
/** Map authorization and completion pages to platformOrigin for private development proxies. */
@@ -54,6 +74,7 @@ export const Config = Schema.object({
desktopPlatform: Schema.union([Schema.const('darwin'), Schema.const('win32'), Schema.const(null)]).default(null),
embeddedPageDist: Schema.string().default(''),
inferenceOrigin: Schema.string().default('https://api.deepseek.com'),
+ serviceOrigins: Schema.array(Schema.string()).default(['https://harness.deepseek.com']),
allowLoopbackHttp: Schema.boolean().default(false),
rewriteBrowserOrigin: Schema.boolean().default(false),
requestHeaders: Schema.dict(Schema.string().role('secret')).default({}),
@@ -86,7 +107,8 @@ export class PlatformAccount extends DeepSeekAccount {
static Config = Config
private readonly origin: string
private readonly embeddedPageDist: string
- private readonly inferenceOrigin: string
+ /** Exact origins that receive account tokens: the inference origin followed by the service origins. */
+ private readonly tokenOrigins: ReadonlySet
private readonly rewriteBrowserOrigin: boolean
private readonly platform: 'darwin' | 'win32' | null
private readonly requestHeaders: Record
@@ -115,12 +137,8 @@ export class PlatformAccount extends DeepSeekAccount {
const resolved = Config(config)
this.embeddedPageDist = resolved.embeddedPageDist
this.origin = platformOrigin(resolved.platformOrigin, resolved.allowLoopbackHttp)
- const inference = new URL(resolved.inferenceOrigin)
- if (!['http:', 'https:'].includes(inference.protocol) || inference.username || inference.password
- || inference.pathname !== '/' || inference.search || inference.hash) {
- throw new Error('account: inferenceOrigin must be an HTTP(S) origin without credentials, path, query or fragment')
- }
- this.inferenceOrigin = inference.origin
+ this.tokenOrigins = new Set([tokenOrigin(resolved.inferenceOrigin, 'inferenceOrigin'),
+ ...resolved.serviceOrigins.map(origin => tokenOrigin(origin, 'serviceOrigins'))])
this.rewriteBrowserOrigin = resolved.rewriteBrowserOrigin
this.platform = resolved.desktopPlatform
this.requestHeaders = platformHeaders(resolved.requestHeaders)
@@ -384,17 +402,17 @@ export class PlatformAccount extends DeepSeekAccount {
override async resolveToken(url: string): Promise {
if (this.closed || this.removing !== undefined) return undefined
const destination = new URL(url)
- if (destination.origin !== this.inferenceOrigin || destination.username || destination.password) return undefined
+ if (!this.tokenOrigins.has(destination.origin) || destination.username || destination.password) return undefined
const record = await this.ctx.credentials.readRecord(KEY)
if (record === undefined) return undefined
if (record.kind !== 'grant') throw new PlatformAuthError('storage')
const result = grant.safeParse(record.payload)
if (!result.success) throw new PlatformAuthError('storage')
- // Development grants cannot authenticate production model or file requests.
+ // Development grants cannot authenticate production requests; other origins accept only this platform's grants.
const issuer = new URL(result.data.issuer)
if (result.data.token.startsWith('dsh_mock_')) return undefined
- if (this.inferenceOrigin === 'https://api.deepseek.com') {
- if (['localhost', '127.0.0.1', '[::1]'].includes(issuer.hostname)) return undefined
+ if (OFFICIAL_TOKEN_ORIGINS.has(destination.origin)) {
+ if (LOOPBACK_HOSTS.has(issuer.hostname)) return undefined
} else if (issuer.origin !== this.origin) return undefined
return result.data.token
}
diff --git a/packages/credentials/deepseek-account-platform/tests/account.spec.ts b/packages/credentials/deepseek-account-platform/tests/account.spec.ts
index 590fb0b7be..61a01ea4ec 100644
--- a/packages/credentials/deepseek-account-platform/tests/account.spec.ts
+++ b/packages/credentials/deepseek-account-platform/tests/account.spec.ts
@@ -35,6 +35,7 @@ async function fixture(
embeddedPageDist = '',
desktopPlatform: 'darwin' | 'win32' | null = null,
balanceTimeoutMs = 30_000,
+ serviceOrigins?: string[],
) {
const home = await mkdtemp(join(tmpdir(), 'dsh-account-'))
cleanups.push(() => rm(home, { recursive: true, force: true }))
@@ -160,7 +161,7 @@ async function fixture(
const provider = ctx.plugin(PlatformAccount, {
platformOrigin: origin, inferenceOrigin, embeddedPageDist, desktopPlatform,
allowLoopbackHttp: true, requestHeaders, accountRequestHeaders,
- rewriteBrowserOrigin, logoutRetryDelayMs: 1, balanceTimeoutMs,
+ rewriteBrowserOrigin, logoutRetryDelayMs: 1, balanceTimeoutMs, ...serviceOrigins === undefined ? {} : { serviceOrigins },
})
await provider
cleanups.push(async () => { await provider.dispose(); await authorization.dispose(); await credentials.dispose(); await web.dispose() })
@@ -306,6 +307,39 @@ it('allows real account credentials only on the exact official HTTPS origin', as
}
})
+it('also releases a production grant to the exact official speech service origin', async () => {
+ const f = await fixture()
+ await f.ctx.credentials.modifyRecord(credentialKey('deepseek-account-platform', 'default'), () => Promise.resolve({
+ kind: 'grant', payload: { version: 1, issuer: 'https://platform.deepseek.com', token: 'test-account-token' },
+ }))
+ expect(await f.account.resolveToken('https://harness.deepseek.com/api/v0/asr/transcribe')).toBe('test-account-token')
+ for (const url of ['http://harness.deepseek.com/api', 'https://harness.deepseek.com.evil.test', 'https://harness.deepseek.com:8443',
+ 'https://user@harness.deepseek.com', 'https://chat.deepseek.com/api']) {
+ expect(await f.account.resolveToken(url)).toBeUndefined()
+ }
+})
+
+it('sends service origins only grants allowed for them and supports removing the default', async () => {
+ const f = await fixture(undefined, {}, false, {}, 'https://api.deepseek.com', undefined, '', null, 30_000,
+ ['https://harness.deepseek.com', 'https://speech.private.example'])
+ await f.ctx.credentials.modifyRecord(credentialKey('deepseek-account-platform', 'default'), () => Promise.resolve({
+ kind: 'grant', payload: { version: 1, issuer: f.origin, token: 'loopback-token' },
+ }))
+ expect(await f.account.resolveToken('https://harness.deepseek.com/api')).toBeUndefined()
+ expect(await f.account.resolveToken('https://api.deepseek.com/v1')).toBeUndefined()
+ expect(await f.account.resolveToken('https://speech.private.example/asr')).toBe('loopback-token')
+ await f.ctx.credentials.modifyRecord(credentialKey('deepseek-account-platform', 'default'), () => Promise.resolve({
+ kind: 'grant', payload: { version: 1, issuer: 'https://platform.deepseek.com', token: 'production-token' },
+ }))
+ expect(await f.account.resolveToken('https://speech.private.example/asr')).toBeUndefined()
+ const none = await fixture(undefined, {}, false, {}, 'https://api.deepseek.com', undefined, '', null, 30_000, [])
+ await none.ctx.credentials.modifyRecord(credentialKey('deepseek-account-platform', 'default'), () => Promise.resolve({
+ kind: 'grant', payload: { version: 1, issuer: 'https://platform.deepseek.com', token: 'production-token' },
+ }))
+ expect(await none.account.resolveToken('https://harness.deepseek.com/api')).toBeUndefined()
+ expect(await none.account.resolveToken('https://api.deepseek.com/v1')).toBe('production-token')
+})
+
it('restricts platform destinations to the configured origin and route', () => {
expect(() => platformOrigin('http://localhost:8081', false)).toThrow()
expect(platformOrigin('http://localhost:8081', true)).toBe('http://localhost:8081')
@@ -1154,6 +1188,8 @@ it.each([{ kind: 'api-key' as const, key: 'wrong-kind' }, { kind: 'grant' as con
it.each(['ftp://api.example', 'https://user:password@api.example', 'https://api.example/path',
'https://api.example/?query=1', 'https://api.example/#fragment'])('rejects invalid inference origin %s', async (inferenceOrigin) => {
expect(() => new PlatformAccount(new Context(), { inferenceOrigin })).toThrow('account: inferenceOrigin')
+ expect(() => new PlatformAccount(new Context(), { serviceOrigins: ['https://harness.deepseek.com', inferenceOrigin] }))
+ .toThrow('account: serviceOrigins')
})
it('rejects authorization begun without a local account attempt', async () => {
diff --git a/packages/credentials/deepseek-account/README.i18n.yaml b/packages/credentials/deepseek-account/README.i18n.yaml
index 7ac8b46fac..503cc26bd1 100644
--- a/packages/credentials/deepseek-account/README.i18n.yaml
+++ b/packages/credentials/deepseek-account/README.i18n.yaml
@@ -3,14 +3,14 @@
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write packages/credentials/deepseek-account/README.md
/:
- en: 30a2d1a634d60f4a
- zh: 9fbf972d342f8ba2
+ en: 86719c0f727b11c1
+ zh: 55ccd4a8467cecfc
/deepseek-ai-dsh-deepseek-account:
en: 4333ad7e5c2d257f
zh: 1f1acbb68131d328
/deepseek-ai-dsh-deepseek-account/summary:
- en: 26e77d24d904dd48
- zh: abc2d141826091f9
+ en: 3258c8314650221a
+ zh: 642234db90b47134
/deepseek-ai-dsh-deepseek-account/table-of-contents:
en: af856ba79fe31b8e
zh: 15b7d1a5d1856de2
diff --git a/packages/credentials/deepseek-account/README.md b/packages/credentials/deepseek-account/README.md
index 16cdf91af5..509803cca1 100644
--- a/packages/credentials/deepseek-account/README.md
+++ b/packages/credentials/deepseek-account/README.md
@@ -1,5 +1,5 @@
---
-description: "Account consumers read stored login state, start or cancel a browser login, and sign out without editing API keys. Host model consumers resolve account credentials only for the provider-configured inference origin."
+description: "Account consumers read stored login state, start or cancel a browser login, and sign out without editing API keys. Host consumers resolve account credentials only for the origins the provider allows: its inference origin and its service origins."
kind: "package-reference"
---
@@ -19,7 +19,7 @@ getUnnotifiedBonuses returns the granted bonuses Platform has not yet recorded a
## Summary
-Account consumers read stored login state, start or cancel a browser login, and sign out without editing API keys. Host model consumers resolve account credentials only for the provider-configured inference origin.
+Account consumers read stored login state, start or cancel a browser login, and sign out without editing API keys. Host consumers resolve account credentials only for the origins the provider allows: its inference origin and its service origins.
`SignInErrorCode` distinguishes `no-response` (fetch returned no Response) from HTTP and response-validation failures so clients can offer network troubleshooting.
diff --git a/packages/credentials/deepseek-account/README.zh.md b/packages/credentials/deepseek-account/README.zh.md
index 2ef0d01d89..5e16c60624 100644
--- a/packages/credentials/deepseek-account/README.zh.md
+++ b/packages/credentials/deepseek-account/README.zh.md
@@ -1,5 +1,5 @@
---
-description: "账号使用方可读取本地登录状态、发起或取消浏览器登录,并在保留 API Key 的情况下退出。Host 模型使用方仅能为提供者配置的推理来源解析账号凭证。"
+description: "账号使用方可读取本地登录状态、发起或取消浏览器登录,并在保留 API Key 的情况下退出。Host 使用方仅能为提供者允许的来源解析账号凭证:推理来源和服务来源。"
kind: "package-reference"
---
@@ -19,7 +19,7 @@ getUnnotifiedBonuses 返回平台尚未记录为已展示的赠金及其所属
## 概述
-账号使用方可读取本地登录状态、发起或取消浏览器登录,并在保留 API Key 的情况下退出。Host 模型使用方仅能为提供者配置的推理来源解析账号凭证。
+账号使用方可读取本地登录状态、发起或取消浏览器登录,并在保留 API Key 的情况下退出。Host 使用方仅能为提供者允许的来源解析账号凭证:推理来源和服务来源。
`SignInErrorCode` 将 `no-response`(fetch 未返回 Response)与 HTTP 和响应校验失败区分开,使客户端可以提示检查网络。
diff --git a/packages/credentials/deepseek-account/src/index.ts b/packages/credentials/deepseek-account/src/index.ts
index 20b0a8b81d..a8e8368995 100644
--- a/packages/credentials/deepseek-account/src/index.ts
+++ b/packages/credentials/deepseek-account/src/index.ts
@@ -93,7 +93,7 @@ export abstract class DeepSeekAccount extends Service {
*/
abstract watch(signal: AbortSignal, includeIdentityChanges?: boolean): AsyncIterable
/**
- * Resolve a credential only for the inference origin allowed by the provider.
+ * Resolve a credential only for an origin the provider allows, such as its inference and service origins.
* @param url - actual request destination or API base URL.
* @returns stored token, or undefined for other origins or a signed-out account.
*/
diff --git a/packages/experimental/api-speech-to-text/README.i18n.yaml b/packages/experimental/api-speech-to-text/README.i18n.yaml
index 1db635bcd9..5cd1974971 100644
--- a/packages/experimental/api-speech-to-text/README.i18n.yaml
+++ b/packages/experimental/api-speech-to-text/README.i18n.yaml
@@ -15,8 +15,8 @@
en: d152484eb41ac6b4
zh: 364c80ee00a374ff
/deepseek-ai-dsh-experimental-api-speech-to-text/use-this-package:
- en: 23efd2789fe70cd9
- zh: 3edd559ee5975742
+ en: e259a2bbb6b1086e
+ zh: e91346ace8f6a239
/deepseek-ai-dsh-experimental-api-speech-to-text/understand-the-implementation:
en: cffe2ab0b7cd0b8b
zh: 5fd4f71cb083de80
diff --git a/packages/experimental/api-speech-to-text/README.md b/packages/experimental/api-speech-to-text/README.md
index 226df827ad..67cc923b3e 100644
--- a/packages/experimental/api-speech-to-text/README.md
+++ b/packages/experimental/api-speech-to-text/README.md
@@ -27,6 +27,8 @@ The `speech` Remote connects browser recordings to `ctx.speechToText`. It expose
Compose with the speech Service Definition and Typert. `maxAudioBytes` and `maxDurationSeconds` limit accepted recordings. The browser UI mounts this package’s generated `/remote` contribution when enabled.
+A provider failure becomes `speech/transcription-failed`; when the provider throws `SpeechTranscriptionError`, the details carry its `SpeechFailureCode` as `code`, and `reason` keeps the Host diagnostic. An optional `locale` carries the Client's UI language; a value that is not a language tag fails as `gateway/bad-request` before recognition.
+
`prepare(providerId, { downloadSource })` forwards one advertised source to the provider; omission keeps its configured policy. The catalog carries `downloadSources` for the picker. The provider rejects unavailable choices and changes to an active task’s source.
-----
diff --git a/packages/experimental/api-speech-to-text/README.zh.md b/packages/experimental/api-speech-to-text/README.zh.md
index 27927b922f..fdb709aeb6 100644
--- a/packages/experimental/api-speech-to-text/README.zh.md
+++ b/packages/experimental/api-speech-to-text/README.zh.md
@@ -27,6 +27,8 @@ kind: "package-reference"
与语音服务定义和 Typert 组合。`maxAudioBytes` 与 `maxDurationSeconds` 限制接收的录音。浏览器 UI 启用时挂载本包生成的 `/remote` 贡献。
+Provider 失败时返回 `speech/transcription-failed`;Provider 抛出 `SpeechTranscriptionError` 时,详情的 `code` 携带其 `SpeechFailureCode`,`reason` 保留 Host 诊断信息。可选的 `locale` 携带 Client 的界面语言;不是语言标签的值在识别前以 `gateway/bad-request` 失败。
+
`prepare(providerId, { downloadSource })` 将公布的一个下载源转发给提供方,省略时保留其配置策略。目录通过 `downloadSources` 提供选择器选项。提供方拒绝不可用的源,以及对进行中任务的源变更。
-----
diff --git a/packages/experimental/api-speech-to-text/src/index.ts b/packages/experimental/api-speech-to-text/src/index.ts
index 4d19d7c5af..3cae3a7697 100644
--- a/packages/experimental/api-speech-to-text/src/index.ts
+++ b/packages/experimental/api-speech-to-text/src/index.ts
@@ -2,13 +2,16 @@
import { Context } from '@deepseek-ai/cordis'
import z from '@deepseek-ai/schemastery'
import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'
-import type {} from '@deepseek-ai/dsh-experimental-speech-to-text'
+import { SpeechTranscriptionError } from '@deepseek-ai/dsh-experimental-speech-to-text'
import type { SpeechPreparationOptions, SpeechProviderId, SpeechSelectionPatch, Transcript } from '@deepseek-ai/dsh-experimental-speech-to-text/types'
import type { SpeechCatalog, TranscriptionRequest } from './types.ts'
import { validateWave } from '@deepseek-ai/dsh-experimental-speech-to-text/wave'
export type * from './types.ts'
+/** Language tag accepted from the Client; anything else could not be forwarded safely as a request header. */
+const LOCALE_TAG = /^[A-Za-z]{2,3}(?:[-_][A-Za-z0-9]{1,8}){0,3}$/
+
declare module '@deepseek-ai/cordis' {
interface Context {
/** Experimental speech Remote controller. */
@@ -88,6 +91,9 @@ export default class SpeechController extends TypertRemoteService {
@Remote
async transcribe(request: TranscriptionRequest, signal: AbortSignal): Promise {
signal.throwIfAborted()
+ if (request.locale !== undefined && !LOCALE_TAG.test(request.locale)) {
+ throw new RemoteError('gateway/bad-request', 'The client locale is not a language tag', {})
+ }
const encoded = request.audioBase64
if (encoded.length > Math.ceil(this.config.maxAudioBytes / 3) * 4) {
throw new RemoteError('speech/invalid-audio', 'Audio is invalid or exceeds the configured byte limit', { reason: 'encoding-or-size' })
@@ -100,12 +106,14 @@ export default class SpeechController extends TypertRemoteService {
const spec = this.ctx.speechToText.resolve({ audio,
...request.providerId === undefined ? {} : { providerId: request.providerId },
...request.language === undefined ? {} : { language: request.language },
+ ...request.locale === undefined ? {} : { locale: request.locale },
})
return await this.ctx.speechToText.transcribe(spec, signal)
} catch (error) {
signal.throwIfAborted()
const reason = error instanceof Error ? error.message : String(error)
- throw new RemoteError('speech/transcription-failed', reason, { reason })
+ throw new RemoteError('speech/transcription-failed', reason,
+ error instanceof SpeechTranscriptionError ? { reason, code: error.code } : { reason })
}
}
}
diff --git a/packages/experimental/api-speech-to-text/src/types.ts b/packages/experimental/api-speech-to-text/src/types.ts
index d7436e7a62..a0311bdc8a 100644
--- a/packages/experimental/api-speech-to-text/src/types.ts
+++ b/packages/experimental/api-speech-to-text/src/types.ts
@@ -1,13 +1,13 @@
/** JSON-safe inputs and results of the experimental speech Remote namespace. */
-import type { SpeechProviderId, SpeechSnapshot } from '@deepseek-ai/dsh-experimental-speech-to-text/types'
+import type { SpeechFailureCode, SpeechProviderId, SpeechSnapshot } from '@deepseek-ai/dsh-experimental-speech-to-text/types'
import type {} from '@deepseek-ai/dsh-typert-protocol'
declare module '@deepseek-ai/dsh-typert-protocol' {
interface RemoteErrorDetailsMap {
/** Audio encoding or intake limits prevented transcription. */
'speech/invalid-audio': { readonly reason: string }
- /** The selected provider rejected transcription. */
- 'speech/transcription-failed': { readonly reason: string }
+ /** The selected provider rejected transcription; `code` is present when the provider classified the failure. */
+ 'speech/transcription-failed': { readonly reason: string; readonly code?: SpeechFailureCode }
}
}
@@ -16,6 +16,8 @@ export interface TranscriptionRequest {
readonly audioBase64: string
readonly providerId?: SpeechProviderId
readonly language?: string
+ /** Active UI language as a BCP 47 tag such as `zh` or `pt-BR`; cloud providers forward it to the service. */
+ readonly locale?: string
}
/** Current provider choices and audio intake limits. */
diff --git a/packages/experimental/api-speech-to-text/tests/controller.spec.ts b/packages/experimental/api-speech-to-text/tests/controller.spec.ts
index caa2145ea2..f7a93cf2eb 100644
--- a/packages/experimental/api-speech-to-text/tests/controller.spec.ts
+++ b/packages/experimental/api-speech-to-text/tests/controller.spec.ts
@@ -1,8 +1,8 @@
/** Authenticated speech domain methods validate audio before selecting a recognizer. */
import { Context } from '@deepseek-ai/cordis'
import { afterEach, expect, it, vi } from 'vitest'
-import SpeechToText from '@deepseek-ai/dsh-experimental-speech-to-text'
-import type { SpeechProviderId } from '@deepseek-ai/dsh-experimental-speech-to-text/types'
+import SpeechToText, { SpeechTranscriptionError } from '@deepseek-ai/dsh-experimental-speech-to-text'
+import type { SpeechInput, SpeechProviderId } from '@deepseek-ai/dsh-experimental-speech-to-text/types'
import SpeechController from '../src/index.ts'
const roots: Context[] = []
@@ -11,7 +11,7 @@ const id = 'sensevoice-local' as SpeechProviderId
function fixture(maxAudioBytes = 32044, maxDurationSeconds = 1) {
const ctx = new Context(); roots.push(ctx)
const speech = new SpeechToText(ctx, SpeechToText.Config({ defaultProvider: id, language: 'auto' }))
- const recognize = vi.fn(async () => ({ text: '你好', audioSeconds: 1, inferenceSeconds: 0.1 }))
+ const recognize = vi.fn(async (_input: SpeechInput, _signal: AbortSignal) => ({ text: '你好', audioSeconds: 1, inferenceSeconds: 0.1 }))
speech.register({ info: { id, name: 'test', location: 'host-local', languages: ['auto', 'zh', 'en', 'ja'] }, transcribe: recognize })
return { api: new SpeechController(ctx, { maxAudioBytes, maxDurationSeconds }), recognize }
}
@@ -65,6 +65,18 @@ it('rejects oversized, noncanonical, malformed and overlong audio without infere
expect(recognize).not.toHaveBeenCalled()
})
+it('forwards a well-formed client locale and rejects malformed tags before recognition', async () => {
+ const { api, recognize } = fixture()
+ await api.transcribe({ audioBase64: recording(), locale: 'pt-BR' }, new AbortController().signal)
+ const [input] = recognize.mock.lastCall!
+ expect([input.language, input.locale]).toEqual(['auto', 'pt-BR'])
+ for (const locale of ['zh\r\nx-injected: 1', '', 'chinese-simplified-script-x-y']) {
+ await expect(api.transcribe({ audioBase64: recording(), locale }, new AbortController().signal))
+ .rejects.toMatchObject({ code: 'gateway/bad-request' })
+ }
+ expect(recognize).toHaveBeenCalledOnce()
+})
+
it('preserves cancellation and reports recognizer failures', async () => {
const { api, recognize } = fixture()
await expect(api.configure({ language: 'zh' })).rejects.toThrow('settings service')
@@ -73,4 +85,8 @@ it('preserves cancellation and reports recognizer failures', async () => {
await expect(api.transcribe({ audioBase64: recording() }, new AbortController().signal)).rejects.toMatchObject({ code: 'speech/transcription-failed', message: 'offline' })
recognize.mockRejectedValueOnce('failed')
await expect(api.transcribe({ audioBase64: recording() }, new AbortController().signal)).rejects.toMatchObject({ message: 'failed' })
+ recognize.mockRejectedValueOnce(new SpeechTranscriptionError('rate-limited', 'HTTP 429'))
+ await expect(api.transcribe({ audioBase64: recording() }, new AbortController().signal)).rejects.toMatchObject({
+ code: 'speech/transcription-failed', message: 'HTTP 429', details: { reason: 'HTTP 429', code: 'rate-limited' },
+ })
})
diff --git a/packages/experimental/client-ui-voice-input/README.i18n.yaml b/packages/experimental/client-ui-voice-input/README.i18n.yaml
index 6aa37a6ef0..b5a214fd94 100644
--- a/packages/experimental/client-ui-voice-input/README.i18n.yaml
+++ b/packages/experimental/client-ui-voice-input/README.i18n.yaml
@@ -15,8 +15,8 @@
en: d152484eb41ac6b4
zh: 364c80ee00a374ff
/deepseek-ai-dsh-experimental-client-ui-voice-input/use-this-package:
- en: b7a99b656839e8a0
- zh: 5c6e2635eb20fc11
+ en: 48572dd712956323
+ zh: c667080b2e9a36bd
/deepseek-ai-dsh-experimental-client-ui-voice-input/understand-the-implementation:
en: 8fe96eeef9afe7d7
zh: 11936f647ded39eb
diff --git a/packages/experimental/client-ui-voice-input/README.md b/packages/experimental/client-ui-voice-input/README.md
index 2aa4fdd707..ecca044990 100644
--- a/packages/experimental/client-ui-voice-input/README.md
+++ b/packages/experimental/client-ui-voice-input/README.md
@@ -27,6 +27,8 @@ This optional browser plugin adds an outline microphone icon between the model s
Enable the [voice input bundle](../voice-input-bundle/README.md) from Plugins. After cache inspection, missing models trigger a setup prompt with Go to setup and Later actions. Go to setup opens bundle details; Download and prepare starts installation there. Intact cached models need no prompt or repeated installation. Before recognition is ready, guidance appears only on click, with no microphone tooltip. Clicking the microphone opens the same guidance dialog; its action opens the voice bundle details without recording or downloading. Cache inspection, preparation in progress, failures and disconnected services instead offer navigation to status, progress or error details. The dialog moves focus to its navigation action and keeps Tab traversal inside it; Later or Escape restores the previous focus without changing or submitting the draft. Before preparation, local providers can show their estimated disk, memory and setup-time requirements. The preparation summary starts collapsed; expand it to inspect completed, current and pending steps. Once ready, click the microphone, allow access and click Stop to transcribe. Cancel or Escape discards capture. Recognition feedback stays inside the toolbar. Provider and language preferences are saved from bundle details through the Settings service. Browser microphone access requires HTTPS or loopback and operating-system permission.
+With a signed-in DeepSeek account, automatic selection uses cloud recognition without a prompt; the microphone tooltip and the transcription status name cloud recognition. When automatic selection falls back to an unprepared local model and signing in would enable cloud recognition, the prompt makes Sign in to DeepSeek the primary action beside Download local model and Later. A signed-out user who chose cloud recognition explicitly is asked to sign in or use local recognition. Sign-in actions call the optional `accountSignIn` service and appear only while it is present; otherwise the dialog points to the Account page in Settings. Classified failures show localized messages in the toolbar, with Sign in to DeepSeek after an expired account and Use local recognition after a cloud outage or an exhausted daily allowance. Bundle details offer Automatic and name the provider in use. An explicit choice shows only that provider's card; Automatic lists cloud providers before local ones. The language menu lists every language some provider recognizes; when the provider in use does not list the saved language, a note says it detects the language automatically. Each transcription sends the active UI language as `locale`.
+
Use the native **Input device** selector in bundle details to follow the system default or select a browser microphone. System default shows the current device name when available. While bundle details are active, the selected input's live level remains visible at the right of the field; selecting another input restarts the preview for that device. Hiding or leaving the page, or disabling the plugin, releases the preview, including late permission grants. The browser remembers the device for subsequent recordings independently of Host recognition settings. Device insertion and removal refresh the options without interrupting an available selected input. A disconnected selection retains its name and position as a disabled option with an Unavailable label. Reconnecting while the page is active restores its preview; choosing another input removes the unavailable option. Interrupted recordings require an explicit restart. Permission denial keeps other choices accessible; an explicitly selected device never silently falls back to another input.
Before downloading or retrying, **Model download source** offers Automatic and the origins advertised by the Host. SenseVoice normally offers Hugging Face and HF-Mirror; a fixed private deployment exposes only its configured origin. Manual selection uses only that source, while Automatic preserves the provider’s comparison and fallback policy. The choice is retained for retries in the current card, without changing deployment configuration or recognition preferences. Source controls are unavailable during preparation and hidden when resources are ready.
diff --git a/packages/experimental/client-ui-voice-input/README.zh.md b/packages/experimental/client-ui-voice-input/README.zh.md
index 3dadc0d92d..2a11a1669a 100644
--- a/packages/experimental/client-ui-voice-input/README.zh.md
+++ b/packages/experimental/client-ui-voice-input/README.zh.md
@@ -27,6 +27,8 @@ kind: "package-reference"
在插件管理页启用[语音输入 Bundle](../voice-input-bundle/README.zh.md)。缓存检查后,缺少模型时弹出安装引导,可选择“前往安装”或“稍后”。“前往安装”打开 Bundle 详情,再点击“下载并准备”才开始安装。缓存完整时不弹引导,也无需重复安装。识别未就绪时不显示麦克风悬停提示,点击后才打开同一个引导弹窗;点击引导按钮进入语音 Bundle 详情,不会录音或下载。缓存检查、正在准备、准备失败或服务断连时,弹窗改为引导查看状态、进度或错误详情。弹窗将焦点移到导航按钮,并将 Tab 切换约束在弹窗内;选择“稍后”或按 Escape 关闭时恢复此前焦点,不改变或提交草稿。准备前,本地 Provider 可展示磁盘、内存与安装时间的估算。准备摘要默认折叠;展开后可查看已完成、当前和未开始的步骤。就绪后点击麦克风,允许访问,再点击停止以转写。取消或 Escape 丢弃录音。识别反馈留在工具栏内部。Provider 和语言偏好在 Bundle 详情中通过 Settings 服务保存。浏览器麦克风访问需要 HTTPS 或环回地址,以及操作系统权限。
+已登录 DeepSeek 账号时,自动选择直接使用云端识别,不弹引导;麦克风悬停提示和转写状态会标明云端识别。自动选择回退到尚未下载的本地模型、而登录即可使用云端识别时,引导弹窗以“登录 DeepSeek”为主按钮,并提供“下载本地模型”和“稍后”。手动选择云端识别但未登录时,弹窗提示登录或改用本地识别。登录按钮调用可选的 `accountSignIn` 服务,只在该服务存在时显示;否则弹窗提示在设置的账号页登录。可分类的失败在工具栏内显示本地化提示:账号失效时提供“登录 DeepSeek”,云端不可用或当日额度用完时提供“改用本地识别”。Bundle 详情提供“自动”选项并显示当前使用的服务。手动选择某个服务时只显示该服务的卡片;选择“自动”时,云端服务的卡片排在本地服务之前。识别语言菜单列出任一服务支持的全部语言;当前服务不支持已保存的语言时,提示将自动识别语言。每次转写都把当前界面语言作为 `locale` 发送。
+
在 Bundle 详情中使用原生**输入设备**选择器,跟随系统默认设备或选择浏览器可用的麦克风。系统默认在名称可用时显示当前设备名。Bundle 详情处于活动状态时,已选输入的实时电平持续显示在字段右侧;切换设备会为该设备重新启动预览。隐藏或离开页面、禁用插件时会释放预览,包括随后才批准的麦克风授权。浏览器会记住设备选择并用于后续录音,与 Host 的识别设置分别保存。插入和拔出设备会刷新选项,不打断仍然可用的已选输入。已选设备断开后会作为禁用选项保留名称和位置,并显示“不可用”。页面处于活动状态时,重新连接会恢复预览;改选其他输入后移除不可用选项。录音中断后需要手动重新开始。权限被拒绝时仍可选择其他设备;明确指定的设备不会静默回退到其他输入。
下载或重试前,**模型下载源**提供自动选择及 Host 公布的源。SenseVoice 默认提供 Hugging Face 和 HF-Mirror;固定私有部署仅显示配置的源。手动选择只使用指定源,自动选择沿用提供方的比较与回退策略。当前卡片中的重试会保留选择,不修改部署配置或识别偏好。准备期间不能改源,资源就绪后隐藏源选择器。
diff --git a/packages/experimental/client-ui-voice-input/package.json b/packages/experimental/client-ui-voice-input/package.json
index 20b4649e56..700ee08b2d 100644
--- a/packages/experimental/client-ui-voice-input/package.json
+++ b/packages/experimental/client-ui-voice-input/package.json
@@ -57,7 +57,8 @@
"@testing-library/react": "^16.3.3",
"@deepseek-ai/dsh-api-gateway": "workspace:*",
"@deepseek-ai/dsh-client-store": "workspace:*",
- "@deepseek-ai/dsh-client-ui-plugin-manager": "workspace:*"
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "workspace:*",
+ "@deepseek-ai/dsh-client-ui-settings-account": "workspace:*"
},
"dsh": {
"client": {
diff --git a/packages/experimental/client-ui-voice-input/src/client/PreparationCard.tsx b/packages/experimental/client-ui-voice-input/src/client/PreparationCard.tsx
index f279d2bc99..c3c1a95a21 100644
--- a/packages/experimental/client-ui-voice-input/src/client/PreparationCard.tsx
+++ b/packages/experimental/client-ui-voice-input/src/client/PreparationCard.tsx
@@ -4,18 +4,24 @@ import { Button, DisclosureRow, IconChevronDownOutlineRegular, StateDot, type St
import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
import type { SpeechPreparationState, SpeechProviderId, SpeechProviderView, SpeechSelectionPatch } from '@deepseek-ai/dsh-experimental-speech-to-text/types'
import type { VoiceInputInjected } from './VoiceInput.tsx'
+import { offeredLanguages, providerLabel, selectedProvider } from './guidance.ts'
import { MicrophonePicker } from './MicrophonePicker.tsx'
import { NS } from './locales.ts'
import css from './VoiceInput.module.css'
/** One recognizer's resource readiness and explicit preparation controls. */
export type PreparationCardProps = Pick, 'prepare' | 'cancelPreparation'>
- & PropsLocale & { readonly provider: SpeechProviderView; readonly connected: boolean }
+ & PropsLocale & {
+ readonly provider: SpeechProviderView
+ readonly connected: boolean
+ /** Open account sign-in; absent while the account UI offers no entry. */
+ readonly signIn?: (() => void) | undefined
+ }
function preparationTone(state: SpeechPreparationState): StateDotState {
if (state.phase === 'ready' || state.phase === 'standby') return 'done'
if (state.phase === 'failed') return 'error'
- if (state.phase === 'unprepared' || state.phase === 'cancelled') return 'idle'
+ if (state.phase === 'unprepared' || state.phase === 'cancelled' || state.phase === 'unavailable') return 'idle'
return 'ongoing'
}
@@ -42,7 +48,7 @@ function PreparationFailure({ state, t }: { state: Extract
- {provider.name}
+ {providerLabel(provider, t)}
{state.phase === 'unprepared' && provider.location === 'host-local' && provider.setupEstimate &&