Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/downstream-patch-provenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
| `@deepseek-ai+dsh-client-ui-deliverables+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
| `@deepseek-ai+dsh-client-ui-input-trigger+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
| `@deepseek-ai+dsh-client-ui-layout+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
| `@deepseek-ai+dsh-client-ui-model-selection+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
| `@deepseek-ai+dsh-client-ui-primitives+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
| `@deepseek-ai+dsh-client-ui-settings+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
| `@deepseek-ai+dsh-client-ui-settings-general+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
Expand Down Expand Up @@ -54,7 +55,7 @@
| `@deepseek-ai+dsh-http-proxy+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |
| `@deepseek-ai+dsh-subprocess-local+0.2.2-rc.5.patch` | `upstream/V0.14.1` | 字节一致,按同步补丁处理 |

共 49 个 patch,当前相对 `upstream/V0.14.1` 的 patch 文件差异为 0。
共 50 个 patch,当前相对 `upstream/V0.14.1` 的 patch 文件差异为 0。

本地开发功能不依赖修改这些 patch 文件。公共源码覆盖登记在 `scripts/downstream-public-overrides.mjs`,门禁按 blob hash 精确校验,未登记的底座改动仍会失败。

Expand Down
2 changes: 1 addition & 1 deletion ops/ci/upstream-baseline.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"repository": "https://github.com/dataelement/dsh-desktop.git",
"ref": "V0.14.1",
"commit": "e5a81e6c7e885240f0c1a61ef5db99f94fed4893"
"commit": "dba7c61f2c83a942e7a83aac9cfec8e4986de692"
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/shell/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- 壳可以导入 `profile/` 的复制、投影、插件维护和 desktop storage,`recovery/` 的致命入口、安全模式 profile、插件列表和维修会话,`desktop-service/` 的登录项诊断和故障上报,`desktop-protocol`,`mobile/` 的配对桥,`security` 的窗口约束,`update/update-manager`,`repair-agent`、`repair-drafts`、`repair-navigation`,`shell/backend/electron-node-executable`,`sidebar-browser` 的客人策略,以及 `@deepseek-ai/dsh-client-shortcuts` 的协议。快捷键偏好写在 `userData/keybindings.json`。不导入官方强制更新。
- 普通启动在复制 `profiles/web` 之前询问是否导入网页版家目录。只在桌面家目录还没有用户数据时询问。跳过会写下决定;关闭窗口不写决定,也不改网页版目录。Safe Mode 不询问。
- 启动页使用现有的 `build/splash.html` 鲸鱼页,Host 就绪后再进入应用页。不使用官方欢迎窗。网页版导入询问会暂时盖住启动页,决定之后回到鲸鱼页。
- macOS 应用菜单跟随桌面端已选语言,不跟随系统语言。页面切换语言后重画菜单。前三项依次是「关于 DSH Desktop」、「检查更新…」和「了解企业版」。企业页地址是 `https://dshdesktop.com/zh/enterprise/`。应用页上关于使用现有对话框;启动页等其它页面使用系统对话框。设置页底部的企业入口由 `dsh-desktop-client-ui` 提供。普通启动时,企业入口下面有「重启」,它先打开鲸鱼等待页,再重新启动当前 Host,就绪后回到原来的应用页;再下面是「以安全模式重启…」,它带上 `--safe-mode` 重新启动,进入已有的 `desktop-safe-mode`。再下面是「显示 Harness 日志」,它在应用日志目录里定位 `harness.log`。已经在 Safe Mode 时不显示安全模式项,日志项仍留在「重启」后面。关于和检查更新弹窗使用同一份桌面语言,同时只显示一个,右上角可以关闭。已经在 Safe Mode 时不显示这一项。启动失败对话框也提供同一次重启。Safe Mode 启动后,现有 `safe-mode.html` 盖在应用页上,管理普通 `desktop` profile 的第三方插件:可以停用或重新启用,再用一次不带 `--safe-mode` 的重启退出。普通 profile 启动失败且错误点名已安装的第三方插件时,现有 `plugin-recovery.html` 使用原来的恢复页模型:没有升级候选时这一轮停用,主按钮是「一键修复」。Safe Mode 的启动失败仍用原来的短对话框。修复代理已接到当前 Host:侧边栏可以打开维修会话,Safe Mode 页的修复入口也会打开,草稿放进输入框,不会自动发送。Safe Mode 页可以按市场检查结果把插件升级到 `desktop` profile 的 generation,也可以打开、恢复或删除卸载备份。macOS 窗口使用 `hiddenInset`,红绿灯画在侧边栏那一行,收起按钮与关闭按钮同一行。快捷键已接到当前窗口:页面标记 `data-platform`,不标记网页快捷键;文件菜单跟在应用菜单后面,提供“关闭页面或窗口”。侧边栏浏览器使用现有客人策略:每个工作区一个隔离分区,不能打开 Harness 端口,也不能下载或要权限。匹配的快捷键会送到已打开的浏览器页。文件拖放已接到当前窗口:页面只能拖出 Host 授权过的会话文件,或壳临时写下的字节副本。渲染进程不能直接给一个本机路径。应用页挂上现有的更新卡片:同意后才下载,可以跳过一个版本,也可以选择历史版本。手机连接不在这个菜单里。普通启动在 Host 就绪后启动现有配对桥,侧边栏宽时由 `dsh-desktop-client-ui` 打开连接页。桥使用壳已经换到的 Host cookie,配对页展示 web frontend 里的品牌图,Harness 留在回环。添加工作区时使用 Electron 原生文件夹面板。macOS 在启动 Host 前按有效语言目标与实际 locale 比较(显式偏好直接解析,缺省或 `auto` 按系统语言列表解析,与添加工作区确认共用规则),必要时用 `-AppleLanguages` 尝试完整重启一次,不写系统全局语言;失败必须降级继续启动。日常界面支持 Harness 内置八语言,恢复与独立页面在展示边界回退中英文,不改写真实偏好。运行中切换语言后,添加工作区可提示完整重启;选择“稍后重启”则继续打开原生面板,标题沿用本次原生语言,同一目标在当前进程内不重复提示。原生控件语言及安装包重启链路仍须平台实机验收。不用 `osascript`。Safe Mode 不暴露这个入口,也不监听配对端口。自动检查只在已安装的 macOS 或 Windows 包里进行。
- macOS 应用菜单跟随桌面端已选语言,不跟随系统语言。页面切换语言后重画菜单。前三项依次是「关于 DSH Desktop」、「检查更新…」和「了解企业版」。企业页地址是 `https://dshdesktop.com/zh/enterprise/`。应用页上关于使用现有对话框;启动页等其它页面使用系统对话框。设置页底部的企业入口由 `dsh-desktop-client-ui` 提供。普通启动时,企业入口下面有「重启」,它先打开鲸鱼等待页,再重新启动当前 Host,就绪后回到原来的应用页;再下面是「以安全模式重启…」,它带上 `--safe-mode` 重新启动,进入已有的 `desktop-safe-mode`。再下面是「显示 Harness 日志」,它在应用日志目录里定位 `harness.log`。已经在 Safe Mode 时不显示安全模式项,日志项仍留在「重启」后面。关于和检查更新弹窗使用同一份桌面语言,同时只显示一个,右上角可以关闭。已经在 Safe Mode 时不显示这一项。启动失败对话框也提供同一次重启。Safe Mode 启动后,现有 `safe-mode.html` 盖在应用页上,管理普通 `desktop` profile 的第三方插件:可以停用或重新启用,再用一次不带 `--safe-mode` 的重启退出。普通 profile 启动失败且错误点名已安装的第三方插件时,现有 `plugin-recovery.html` 使用原来的恢复页模型:没有升级候选时这一轮停用,主按钮是「一键修复」。Safe Mode 的启动失败仍用原来的短对话框。修复代理已接到当前 Host:侧边栏可以打开维修会话,Safe Mode 页的修复入口也会打开,草稿放进输入框,不会自动发送。Safe Mode 页可以按市场检查结果把插件升级到 `desktop` profile 的 generation,也可以打开、恢复或删除卸载备份。macOS 窗口使用 `hiddenInset`,红绿灯画在侧边栏那一行,收起按钮与关闭按钮同一行。快捷键已接到当前窗口:页面标记 `data-platform`,不标记网页快捷键;文件菜单跟在应用菜单后面,提供“关闭页面或窗口”。视图菜单提供重新加载、开发者工具、缩放和全屏;Command+R 重新加载当前页,Command+Shift+R 仍是重启 Harness,不注册强制刷新。侧边栏浏览器使用现有客人策略:每个工作区一个隔离分区,不能打开 Harness 端口,也不能下载或要权限。匹配的快捷键会送到已打开的浏览器页。文件拖放已接到当前窗口:页面只能拖出 Host 授权过的会话文件,或壳临时写下的字节副本。渲染进程不能直接给一个本机路径。应用页挂上现有的更新卡片:同意后才下载,可以跳过一个版本,也可以选择历史版本。手机连接不在这个菜单里。普通启动在 Host 就绪后启动现有配对桥,侧边栏宽时由 `dsh-desktop-client-ui` 打开连接页。桥使用壳已经换到的 Host cookie,配对页展示 web frontend 里的品牌图,Harness 留在回环。添加工作区时使用 Electron 原生文件夹面板。macOS 在启动 Host 前按有效语言目标与实际 locale 比较(显式偏好直接解析,缺省或 `auto` 按系统语言列表解析,与添加工作区确认共用规则),必要时用 `-AppleLanguages` 尝试完整重启一次,不写系统全局语言;失败必须降级继续启动。日常界面支持 Harness 内置八语言,恢复与独立页面在展示边界回退中英文,不改写真实偏好。运行中切换语言后,添加工作区可提示完整重启;选择“稍后重启”则继续打开原生面板,标题沿用本次原生语言,同一目标在当前进程内不重复提示。原生控件语言及安装包重启链路仍须平台实机验收。不用 `osascript`。Safe Mode 不暴露这个入口,也不监听配对端口。自动检查只在已安装的 macOS 或 Windows 包里进行。
- 启动配置对话框、macOS 与 Windows 关闭后留在后台、进程恢复和主窗口渲染重试由 `stability-session.ts` 接到当前窗口。Host 失败时先给出可修复的启动配置;macOS 关闭窗口只隐藏进程,再点 Dock 图标显示,Dock 右键退出或 Cmd+Q 才结束;Windows 关闭窗口只隐藏进程,托盘可以重新显示或退出;渲染进程丢失时有限重试,内存耗尽和用尽的图形降级走原生恢复对话框。上一份图形模式写在 `userData/gpu-fallback.json`,并在 Chromium 启动前生效。主窗口的大小、位置、最大化和应用页缩放写在 `userData/window-state.json`。
- 致命失败先写入 `DSH_HOME/fatal-report.json`,再在应用日志目录写一份 `crash-*.log`。这份本地文件仍只给短对话框用。正式包另外在用户同意后 POST 与 0.13.2 相同的故障 JSON,`lines` 来自 `harness.log`,不以这份 `crash-*.log` 代替。写完后按 64 KiB 和 500 毫秒上限,把 `userData/plugin-operations` 里的最近操作附进同一份本地文件。短对话框会写出这份日志的路径。恢复页本身不改。普通 profile 的错误如果点名已安装的第三方插件,就打开现有 `plugin-recovery.html`,文案和修复方案用 `buildPluginRecoveryViewModel`,不另写摘要,也不把 `userData/plugin-operations` 写进页面。市场里有还没试过的兼容版本时这一轮升级,否则停用。已试过的版本记在 `DSH_HOME/repair-journal.json`。主按钮是「一键修复」。其它失败仍显示一条不含认证参数的短对话框。不使用官方 `DesktopFatalRecovery`。这一页不打开修复代理,也不编造升级版本或回退版本。最近插件操作仍只附在崩溃日志里。修复代理从侧边栏或 Safe Mode 页进入当前 Host。
- 第一次启动 Host 前读取 POSIX 登录 shell 环境,和启动页重叠。用账号记录里的 login shell,然后是 `/bin/zsh`、`/bin/bash`、`/bin/sh`。Windows 使用进程已经继承的注册表环境,不运行 PowerShell。读到的 `DSH_*` 和 `ELECTRON_*` 不覆盖桌面进程。失败时用原环境启动,不把变量值写进日志。
Expand Down
46 changes: 33 additions & 13 deletions src/main/shell/enterprise-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,37 @@ export function standardMenuLabels(locale: string) {
return { edit, undo, redo, cut, copy, paste, pasteAndMatchStyle, selectAll, window, minimize, close }
}

/**
* View roles shared by the macOS menu bar and the hidden Windows menu.
* Reload keeps Electron's default chord (Command+R / Ctrl+R).
* On Windows and Linux the menu bar stays hidden, so that role does not receive
* Ctrl+R; the shortcut controller reloads the page for that chord instead.
* forceReload is omitted: Command+Shift+R / Ctrl+Shift+R already restarts the Host.
*/
function viewMenu(text: {
view: string
reload: string
devtools: string
actualSize: string
zoomIn: string
zoomOut: string
fullscreen: string
}): DesktopMenuItem {
return {
label: text.view,
submenu: [
{ role: 'reload', label: text.reload },
{ role: 'toggleDevTools', label: text.devtools },
{ type: 'separator' },
{ role: 'resetZoom', label: text.actualSize },
{ role: 'zoomIn', label: text.zoomIn },
{ role: 'zoomOut', label: text.zoomOut },
{ type: 'separator' },
{ role: 'togglefullscreen', label: text.fullscreen }
]
}
}

/** Keep About first. The file menu follows the application menu when shortcuts are installed. */
export function insertFileMenu(items: readonly DesktopMenuItem[], fileMenu: DesktopMenuItem | undefined): DesktopMenuItem[] {
if (fileMenu === undefined) return [...items]
Expand Down Expand Up @@ -147,6 +178,7 @@ export function buildDarwinDesktopMenu(options: {
{ role: 'selectAll', label: standard.selectAll }
]
},
viewMenu(text),
{
label: standard.window,
submenu: [
Expand Down Expand Up @@ -212,19 +244,7 @@ export function buildWindowsApplicationMenu(options: {
{ role: 'selectAll', label: standard.selectAll }
]
},
{
label: text.view,
submenu: [
{ role: 'reload', label: text.reload },
{ role: 'toggleDevTools', label: text.devtools },
{ type: 'separator' },
{ role: 'resetZoom', label: text.actualSize },
{ role: 'zoomIn', label: text.zoomIn },
{ role: 'zoomOut', label: text.zoomOut },
{ type: 'separator' },
{ role: 'togglefullscreen', label: text.fullscreen }
]
},
viewMenu(text),
{
label: standard.window,
submenu: [
Expand Down
53 changes: 51 additions & 2 deletions src/main/shell/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface ShortcutContents {
mainFrame: ShortcutFrame
focusedFrame: ShortcutFrame | null
isDestroyed(): boolean
reload(): void
setIgnoreMenuShortcuts(ignore: boolean): void
send(channel: string, payload: unknown): void
focus(): void
Expand Down Expand Up @@ -166,13 +167,24 @@ export function installDesktopShortcuts(
contents.setIgnoreMenuShortcuts(true)
return
}
if (window !== getWindow() || !window.isFocused() || !window.isEnabled() || revision === undefined
if (window !== getWindow() || !window.isFocused() || !window.isEnabled()
|| (guestName !== undefined && contents.isFocused?.() !== true)) {
contents.setIgnoreMenuShortcuts(false)
held.clear()
consumed.clear()
return
}
if (revision === undefined) {
if (!recording && isHiddenMenuBarReload(platform, input)) {
event.preventDefault()
if (!contents.isDestroyed()) contents.reload()
return
}
contents.setIgnoreMenuShortcuts(false)
held.clear()
consumed.clear()
return
}
const modifiers = (['control', 'alt', 'shift', 'meta'] as const).filter(modifier => input[modifier])
const key = bindingKey({ code: input.code, modifiers })
const match = keys.has(key)
Expand All @@ -182,7 +194,19 @@ export function installDesktopShortcuts(
const frame = contents.focusedFrame
const composing = input.isComposing || input.key === 'Dead' || deadKey || input.modifiers.includes('altgr')
if (input.type === 'keyDown') deadKey = input.key === 'Dead'
if (recording || composing || frame === null) {
if (recording || composing) {
held.clear()
consumed.clear()
return
}
// The caption menu shows Ctrl+R but does not register it. The hidden menu's
// reload role also does not arrive while that menu bar stays hidden.
if (!match && isHiddenMenuBarReload(platform, input)) {
event.preventDefault()
if (!contents.isDestroyed()) contents.reload()
return
}
if (frame === null) {
held.clear()
consumed.clear()
return
Expand Down Expand Up @@ -330,6 +354,31 @@ export function installDesktopShortcuts(
}
}

/**
* Ctrl+R on Windows and Linux. The visible caption item only labels this chord,
* and the hidden application menu does not deliver the reload role.
*/
export function isHiddenMenuBarReload(platform: ShortcutPlatform, input: {
type: string
code: string
control: boolean
alt: boolean
shift: boolean
meta: boolean
isAutoRepeat?: boolean
isComposing?: boolean
}): boolean {
return (platform === 'windows' || platform === 'linux')
&& input.type === 'keyDown'
&& input.isAutoRepeat !== true
&& input.isComposing !== true
&& input.code === 'KeyR'
&& input.control
&& !input.alt
&& !input.shift
&& !input.meta
}

/** The protocol brands the accepted revision string. Callers already require a string. */
function shortcutRevision(value: unknown): ShortcutRevision {
if (typeof value !== 'string' || value.length === 0 || value.length > 256) {
Expand Down
Loading
Loading