@michengai/dsh-codex-ui 2.3.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/CHANGELOG.zh-CN.md +17 -0
- package/README.de.md +1 -0
- package/README.en.md +1 -0
- package/README.es.md +1 -0
- package/README.fr.md +1 -0
- package/README.ja.md +1 -0
- package/README.md +1 -0
- package/README.pt.md +1 -0
- package/README.ru.md +1 -0
- package/README.zh-CN.md +1 -0
- package/lib/client.js +650 -19
- package/lib/session-title-plugin.mjs +64 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.1] - 2026-11-20
|
|
4
|
+
|
|
5
|
+
- **Fix Network Noise and Continuous Error Logs When Theme Feature is Disabled (Issue #107)**:
|
|
6
|
+
- Fixed an issue where disabling the theme feature in configuration caused the client to continuously request theme status and log 404 network errors in DevTools;
|
|
7
|
+
- Improved the status probing behavior so failed probes back off and stop polling indefinitely, keeping the network panel and error count clean without background noise.
|
|
8
|
+
|
|
9
|
+
## [2.4.0] - 2026-11-20
|
|
10
|
+
|
|
11
|
+
- **Searchable, keyboard-friendly workspace menu on the new-session page (PR #106)**:
|
|
12
|
+
- The hero workspace menu is now a Codex-style project picker: type to filter by project name or path, move with the arrow keys, pick with Enter, dismiss with Escape;
|
|
13
|
+
- The keyboard highlight keeps itself scrolled into view, and closing the picker returns focus to the workspace chip;
|
|
14
|
+
- Same-named projects show the shortest path suffix that tells them apart;
|
|
15
|
+
- The current workspace carries a check mark, so the project in use is obvious at a glance;
|
|
16
|
+
- A "New project" row at the bottom picks a directory, registers it as a workspace and switches to it;
|
|
17
|
+
- While the system directory dialog is open the row stays disabled, so a double click cannot open two dialogs;
|
|
18
|
+
- Note: creating a project now opens the system directory dialog; the hero no longer offers the in-app directory browsing flow, and hosts without a native directory dialog (remote connections, SSH launches, non-loopback binds) hide the "New project" row.
|
|
19
|
+
|
|
3
20
|
## [2.3.0] - 2026-11-19
|
|
4
21
|
|
|
5
22
|
- **Host Compatibility Baseline Upgraded to DeepSeek Harness 0.2.2 Series**:
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [2.4.1] - 2026-11-20
|
|
4
|
+
|
|
5
|
+
- **修复主题子插件停用时的网络异常与持续报错(Issue #107)**:
|
|
6
|
+
- 修复了在配置中停用主题功能后,桌面端和网页端仍会持续尝试请求主题状态并产生 404 错误日志的问题;
|
|
7
|
+
- 优化了插件状态探活机制,探测失败时有界退避并自动终止轮询,避免在控制台和开发者工具网络面板中持续产生红色错误记录,保持网络请求和错误徽标干净。
|
|
8
|
+
|
|
9
|
+
## [2.4.0] - 2026-11-20
|
|
10
|
+
|
|
11
|
+
- **欢迎页工作区菜单支持搜索与键盘挑选(PR #106)**:
|
|
12
|
+
- 新建会话页的工作区菜单改为 Codex 风格项目选择器:打开即可直接输入,按项目名或路径实时过滤,方向键上下移动、回车选中、Esc 关闭;
|
|
13
|
+
- 项目较多时键盘高亮始终跟随滚动,关闭后焦点回到工作区胶囊,键盘操作不再丢失位置;
|
|
14
|
+
- 同名项目后面会附带最短可区分的路径后缀,两个同名目录不再看起来一模一样;
|
|
15
|
+
- 当前工作区在列表里带对勾标记,一眼能看出正在使用哪个项目;
|
|
16
|
+
- 列表底部新增「新建项目」,选好目录后自动注册为工作区并切换过去;
|
|
17
|
+
- 打开系统目录选择框期间「新建项目」保持禁用,连点不会弹出两个对话框;
|
|
18
|
+
- 说明:新建项目改为调用系统的目录选择框,欢迎页不再提供应用内的目录浏览与新建文件夹入口;在没有原生目录对话框的宿主(远程连接、SSH 启动、非本机绑定)上不显示「新建项目」入口。
|
|
19
|
+
|
|
3
20
|
## [2.3.0] - 2026-11-19
|
|
4
21
|
|
|
5
22
|
- **宿主兼容性基线升级至 DeepSeek Harness 0.2.2 全系列**:
|
package/README.de.md
CHANGED
|
@@ -188,6 +188,7 @@ Nach der Installation DSH Web neu starten und den Browser mit `Strg + Umschalt +
|
|
|
188
188
|
| **Design & Weichzeichnung** | Unter **Einstellungen → Codex UI** aus 14 Paletten wählen und zwischen Flat- und Mica-Karten sowie Unschärfe-Stufen wechseln. |
|
|
189
189
|
| **Seitenleiste sortieren** | Elemente vertikal ziehen; blaue Linien signalisieren die genaue Ablageposition innerhalb oder außerhalb des Mehr-Fachs. |
|
|
190
190
|
| **Arbeitsbereich im Abschnitt hinzufügen** | Über den Titel eines beliebigen Abschnitts (Angeheftet, Projekte oder benutzerdefiniert) fahren oder fokussieren und rechts neben `···` auf „Arbeitsbereich hinzufügen“ klicken (sichtbar bei verfügbarer Host-Ordnerauswahl); der neue Arbeitsbereich wird dort automatisch einsortiert und aufgeklappt. |
|
|
191
|
+
| **Projekte auf der Startseite suchen und wechseln** | Auf der Seite für neue Sitzungen auf den Arbeitsbereich-Chip klicken und tippen, um nach Projektname oder Pfad zu filtern; `↑` / `↓` bewegt, `Enter` wählt, `Esc` schließt. Das aktuelle Projekt trägt ein Häkchen, gleichnamige Projekte zeigen den kürzesten unterscheidenden Pfad, und **Neues Projekt** erscheint nur, wenn der Host einen System-Ordnerdialog anbietet (Remote- oder SSH-Hosts blenden ihn aus). |
|
|
191
192
|
| **Seitenleiste einklappen** | Oben auf der Seitenleiste auf Einklappen klicken, um zum offiziellen 56px-Symbolstreifen zu wechseln. |
|
|
192
193
|
| **Plugins aktualisieren** | In **Einstellungen → Codex UI** auf der Karte für Begleit-Plugins auf **Alle installieren/aktualisieren** klicken. |
|
|
193
194
|
|
package/README.en.md
CHANGED
|
@@ -193,6 +193,7 @@ Once installed, restart your DSH Web instance and hard-refresh your browser (`Ct
|
|
|
193
193
|
| **Switch Themes & Blur** | Navigate to **Settings → Codex UI**, choose from 14 palettes, and toggle Stock/Mica or blur presets. |
|
|
194
194
|
| **Reorder Sidebar Items** | Drag any item vertically; blue indicators guide drop positions into or out of the More drawer. |
|
|
195
195
|
| **Add Workspace from Section** | Hover or focus any section header (Pinned, Projects, or custom) and click the **Add workspace** icon beside `···` (shown when host directory-picking is available); the new workspace is placed into that section and expanded automatically. |
|
|
196
|
+
| **Search & Switch Projects from the Welcome Page** | Click the workspace chip on the new-session page and type to filter by project name or path; `↑` / `↓` moves, `Enter` picks, `Esc` closes. The current project carries a check mark, same-named projects show the shortest distinguishing path, and **New project** appears only where the host offers a system directory dialog (remote or SSH hosts hide it). |
|
|
196
197
|
| **Collapse Sidebar** | Click the collapse button on top of the sidebar to switch to the official 56px native icon rail. |
|
|
197
198
|
| **Batch Upgrade Plugins** | In **Settings → Codex UI**, click **Update All** on the Companion Plugins card. |
|
|
198
199
|
|
package/README.es.md
CHANGED
|
@@ -188,6 +188,7 @@ Una vez instalado, reinicie su entorno DSH Web y fuerce la recarga del navegador
|
|
|
188
188
|
| **Cambiar temas y desenfoque** | Vaya a **Configuración → Codex UI**, seleccione una de las 14 paletas y alterne entre los modos de cristal Plano y Mica Flotante. |
|
|
189
189
|
| **Reordenar barra lateral** | Arrastre verticalmente los elementos; las guías azules indican la posición exacta para ingresar o extraer del cajón «Más». |
|
|
190
190
|
| **Agregar espacio de trabajo desde una sección** | Pase el cursor o enfoque el título de cualquier sección (Fijados, Proyectos o personalizada) y pulse el icono «Agregar espacio de trabajo» junto a `···` (visible cuando el selector de directorios del host está disponible); el nuevo espacio se colocará y expandirá automáticamente dentro de esa sección. |
|
|
191
|
+
| **Buscar y cambiar de proyecto desde la bienvenida** | Pulse la píldora de espacio de trabajo en la página de nueva sesión y escriba para filtrar por nombre o ruta; `↑` / `↓` desplaza, `Enter` elige, `Esc` cierra. El proyecto actual lleva una marca de verificación, los proyectos homónimos muestran la ruta distintiva más corta, y **Nuevo proyecto** solo aparece cuando el host ofrece el diálogo de carpetas del sistema (los hosts remotos o vía SSH lo ocultan). |
|
|
191
192
|
| **Plegar barra lateral** | Haga clic en el botón superior de la barra para cambiar al riel oficial compacto de 56px. |
|
|
192
193
|
| **Actualizar complementos** | En **Configuración → Codex UI**, pulse **Instalar/actualizar todo** dentro de la tarjeta de complementos. |
|
|
193
194
|
|
package/README.fr.md
CHANGED
|
@@ -188,6 +188,7 @@ Une fois installé, redémarrez votre instance DSH Web et rechargez complètemen
|
|
|
188
188
|
| **Changer de thème et de verre** | Dans **Paramètres → Codex UI**, choisissez parmi les 14 palettes et basculez entre les modes Plat et Cartes Mica. |
|
|
189
189
|
| **Réorganiser la barre latérale** | Glissez verticalement les éléments ; les repères bleus indiquent l'emplacement exact d'insertion ou de retrait. |
|
|
190
190
|
| **Ajouter un espace de travail depuis une section** | Survolez ou focalisez l'en-tête de n'importe quelle section (Épinglés, Projets ou personnalisée) puis cliquez sur l'icône « Ajouter un espace de travail » à côté de `···` (affichée si le sélecteur de dossiers de l'hôte est actif) ; le nouvel espace s'y classe et s'ouvre automatiquement. |
|
|
191
|
+
| **Rechercher et changer de projet depuis l'accueil** | Cliquez sur la puce d'espace de travail de la page de nouvelle session et saisissez pour filtrer par nom ou par chemin ; `↑` / `↓` déplace, `Enter` valide, `Esc` ferme. Le projet courant porte une coche, les projets homonymes affichent le suffixe de chemin le plus court, et **Nouveau projet** n'apparaît que si l'hôte propose la boîte de dialogue système (les hôtes distants ou via SSH le masquent). |
|
|
191
192
|
| **Replier la barre latérale** | Cliquez sur le bouton de réduction en haut de la barre pour passer au rail officiel de 56px. |
|
|
192
193
|
| **Mettre à jour les extensions** | Dans **Paramètres → Codex UI**, cliquez sur **Tout installer/mettre à jour** dans la carte des dépendances. |
|
|
193
194
|
|
package/README.ja.md
CHANGED
|
@@ -188,6 +188,7 @@ dsh --profile web --dump-config
|
|
|
188
188
|
| **テーマとぼかし切り替え** | **設定 → Codex UI** で 14 種類の配色やマイカ/オリジナルモード、マテリアルのぼかし度合いを選択します。 |
|
|
189
189
|
| **サイドバーの並べ替え** | アイコンを垂直方向にドラッグします。青いインジケーターに従って「その他」ドロワーへの出し入れが可能です。 |
|
|
190
190
|
| **セクションからワークスペースを追加** | サイドバーの各セクション見出し(ピン留め、プロジェクト、またはカスタムセクション)にカーソルを合わせるかフォーカスし、`···` の隣に表示される「ワークスペースを追加」アイコン(ホストのディレクトリ選択機能が有効な場合に表示)をクリックすると、新しいワークスペースがそのセクションへ自動追加されて展開されます。 |
|
|
191
|
+
| **ようこそ画面でプロジェクトを検索・切り替え** | 新規セッション画面のワークスペースチップをクリックするとそのまま入力でき、プロジェクト名またはパスで即時絞り込み。`↑` / `↓` で移動、`Enter` で決定、`Esc` で閉じます。現在のプロジェクトには行末にチェックが付き、同名プロジェクトには最短の区別用パスが添えられます。下部の「新しいプロジェクト」はホストがシステムのディレクトリダイアログを提供する場合のみ表示されます(リモート接続や SSH 起動のホストでは自動的に非表示)。 |
|
|
191
192
|
| **サイドバーの折りたたみ** | サイドバー上部のトグルボタンをクリックすると、公式の 56px ネイティブレールに切り替わります。 |
|
|
192
193
|
| **プラグイン一括更新** | **設定 → Codex UI** の「連携管理プラグイン」カードで「すべてインストール/更新」をクリックします。 |
|
|
193
194
|
|
package/README.md
CHANGED
|
@@ -193,6 +193,7 @@ dsh --profile web --dump-config
|
|
|
193
193
|
| **切换主题与质感** | 打开「设置 → Codex UI」,在「界面外观与换肤」卡片单选 14 款主题,直选原版/云母模式与材质预设。 |
|
|
194
194
|
| **调整侧栏图标顺序** | 鼠标按住展开侧栏中的任意插件条目拖拽上下移动,蓝线指示放置位置,支持拖入/拖出「更多」手风琴。 |
|
|
195
195
|
| **从分区直接添加工作区** | 悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
|
|
196
|
+
| **在欢迎页搜索并切换项目** | 点击新建会话页的工作区胶囊即可直接输入,按项目名或路径即时过滤;`↑` / `↓` 移动、`Enter` 选中、`Esc` 关闭。当前项目行尾带对勾,同名项目附带最短区分路径;底部「新建项目」只在宿主提供系统目录对话框时出现(远程连接 / SSH 启动的宿主会自动隐藏)。 |
|
|
196
197
|
| **折叠/收起侧边栏** | 点击侧栏顶部折叠按钮;收缩后自动切换为 56px 原生导轨,单手盲点所有功能图标。 |
|
|
197
198
|
| **生态插件批量更新** | 在「设置 → Codex UI」底部「配套管理插件」卡片,点击「全部更新」自动安装最新配套依赖。 |
|
|
198
199
|
|
package/README.pt.md
CHANGED
|
@@ -188,6 +188,7 @@ Após a instalação, reinicie a instância do DSH Web e force a atualização d
|
|
|
188
188
|
| **Alternar temas e desfoque** | Em **Configurações → Codex UI**, selecione uma das 14 paletas e alterne entre os modos de vidro Plano e Mica Flutuante. |
|
|
189
189
|
| **Reordenar barra lateral** | Arraste verticalmente os itens; os guias azuis indicam o ponto exato para mover para dentro ou fora do menu «Mais». |
|
|
190
190
|
| **Adicionar espaço de trabalho pela seção** | Passe o mouse ou foque no título de qualquer seção (Fixados, Projetos ou personalizada) e clique no ícone «Adicionar espaço de trabalho» ao lado de `···` (exibido quando o seletor de diretórios do host está disponível); o novo espaço é inserido e expandido nela automaticamente. |
|
|
191
|
+
| **Pesquisar e trocar de projeto na tela de boas-vindas** | Clique na pílula de espaço de trabalho da página de nova sessão e digite para filtrar por nome ou caminho; `↑` / `↓` move, `Enter` escolhe, `Esc` fecha. O projeto atual leva uma marca de seleção, projetos homônimos mostram o caminho distintivo mais curto, e **Novo projeto** só aparece quando o host oferece a caixa de diálogo do sistema (hosts remotos ou via SSH a ocultam). |
|
|
191
192
|
| **Recolher barra lateral** | Clique no botão no topo da barra para alternar para o trilho oficial compacto de 56px. |
|
|
192
193
|
| **Atualizar plugins em lote** | Em **Configurações → Codex UI**, clique em **Instalar/atualizar tudo** no cartão de extensões complementares. |
|
|
193
194
|
|
package/README.ru.md
CHANGED
|
@@ -188,6 +188,7 @@ dsh --profile web --dump-config
|
|
|
188
188
|
| **Смена тем и размытия** | В **Настройки → Codex UI** выберите одну из 14 палитр и настройте силу матового эффекта. |
|
|
189
189
|
| **Сортировка боковой панели** | Перетаскивайте элементы по вертикали; синие маркеры подскажут точное место для добавления в меню «Еще». |
|
|
190
190
|
| **Добавить рабочую область в секцию** | Наведите курсор или сфокусируйтесь на заголовке любой секции («Закреплённые», «Проекты» или пользовательской) и нажмите значок «Добавить рабочую область» рядом с `···` (отображается при доступном выборе папок хостом); новая область автоматически попадёт в эту секцию и раскроет её. |
|
|
191
|
+
| **Поиск и переключение проектов на стартовом экране** | Нажмите на плашку рабочей области на странице новой сессии и начните вводить — фильтр по названию проекта или пути работает сразу. `↑` / `↓` — перемещение, `Enter` — выбор, `Esc` — закрытие. Текущий проект отмечен галочкой, у одноимённых проектов показан кратчайший различающий путь, а «Новый проект» появляется только там, где хост предоставляет системный диалог выбора папки (на удалённых хостах и при запуске по SSH он скрыт). |
|
|
191
192
|
| **Сворачивание панели** | Нажмите на кнопку вверху боковой панели для перехода к компактному режиму 56px. |
|
|
192
193
|
| **Обновление плагинов** | В **Настройки → Codex UI** нажмите **Установить/обновить все** в карточке сопутствующих расширений. |
|
|
193
194
|
|
package/README.zh-CN.md
CHANGED
|
@@ -193,6 +193,7 @@ dsh --profile web --dump-config
|
|
|
193
193
|
| **切换主题与质感** | 打开「设置 → Codex UI」,在「界面外观与换肤」卡片单选 14 款主题,直选原版/云母模式与材质预设。 |
|
|
194
194
|
| **调整侧栏图标顺序** | 鼠标按住展开侧栏中的任意插件条目拖拽上下移动,蓝线指示放置位置,支持拖入/拖出「更多」手风琴。 |
|
|
195
195
|
| **从分区直接添加工作区** | 悬停或键盘聚焦到任意侧栏分区(「置顶」、「项目」或自定义分区)标题,点击右侧 `···` 旁的「添加工作区」图标(随宿主目录选择能力显隐),新建的工作区会自动归入该分区并展开。 |
|
|
196
|
+
| **在欢迎页搜索并切换项目** | 点击新建会话页的工作区胶囊即可直接输入,按项目名或路径即时过滤;`↑` / `↓` 移动、`Enter` 选中、`Esc` 关闭。当前项目行尾带对勾,同名项目附带最短区分路径;底部「新建项目」只在宿主提供系统目录对话框时出现(远程连接 / SSH 启动的宿主会自动隐藏)。 |
|
|
196
197
|
| **折叠/收起侧边栏** | 点击侧栏顶部折叠按钮;收缩后自动切换为 56px 原生导轨,单手盲点所有功能图标。 |
|
|
197
198
|
| **生态插件批量更新** | 在「设置 → Codex UI」底部「配套管理插件」卡片,点击「全部更新」自动安装最新配套依赖。 |
|
|
198
199
|
|
package/lib/client.js
CHANGED
|
@@ -3681,20 +3681,30 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
3681
3681
|
//#region src/client/theme/index.ts
|
|
3682
3682
|
let globalThemeRuntime;
|
|
3683
3683
|
/**
|
|
3684
|
-
*
|
|
3685
|
-
*
|
|
3684
|
+
* 读取主题子插件在 Host 侧的状态。
|
|
3685
|
+
* 返回 enabled(是否激活)和 explicitlyDisabled(是否为服务端明确回报的停用)。
|
|
3686
3686
|
*/
|
|
3687
|
-
async function
|
|
3687
|
+
async function fetchThemeSubPluginStatus() {
|
|
3688
3688
|
try {
|
|
3689
3689
|
const base = typeof document !== "undefined" && document.baseURI ? document.baseURI : "http://localhost";
|
|
3690
3690
|
const normalizedBase = base.endsWith("/") ? base : `${base}/`;
|
|
3691
3691
|
const path = CODEX_UI_API_ENDPOINTS.theme.startsWith("/") ? CODEX_UI_API_ENDPOINTS.theme.slice(1) : CODEX_UI_API_ENDPOINTS.theme;
|
|
3692
3692
|
const url = new URL(path, normalizedBase).href;
|
|
3693
3693
|
const res = await fetch(url);
|
|
3694
|
-
if (!res.ok) return
|
|
3695
|
-
|
|
3694
|
+
if (!res.ok) return {
|
|
3695
|
+
enabled: false,
|
|
3696
|
+
explicitlyDisabled: false
|
|
3697
|
+
};
|
|
3698
|
+
const data = await res.json();
|
|
3699
|
+
return {
|
|
3700
|
+
enabled: data?.enabled === true,
|
|
3701
|
+
explicitlyDisabled: data?.enabled === false
|
|
3702
|
+
};
|
|
3696
3703
|
} catch {
|
|
3697
|
-
return
|
|
3704
|
+
return {
|
|
3705
|
+
enabled: false,
|
|
3706
|
+
explicitlyDisabled: false
|
|
3707
|
+
};
|
|
3698
3708
|
}
|
|
3699
3709
|
}
|
|
3700
3710
|
function tolerantRegistration(run) {
|
|
@@ -3931,11 +3941,13 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
3931
3941
|
disposers.push(() => clearInterval(timer));
|
|
3932
3942
|
}
|
|
3933
3943
|
let healTimer;
|
|
3934
|
-
|
|
3944
|
+
let startupRetryCount = 0;
|
|
3945
|
+
const MAX_STARTUP_RETRIES = 3;
|
|
3946
|
+
const checkAndSync = async (allowStartupRetry = false) => {
|
|
3935
3947
|
if (disposed) return;
|
|
3936
|
-
const
|
|
3948
|
+
const status = await fetchThemeSubPluginStatus();
|
|
3937
3949
|
if (disposed) return;
|
|
3938
|
-
if (!enabled) {
|
|
3950
|
+
if (!status.enabled) {
|
|
3939
3951
|
setThemeSubPluginEnabled(false);
|
|
3940
3952
|
disposeGlassMode();
|
|
3941
3953
|
removeThemeSurfaceStyles();
|
|
@@ -3945,21 +3957,39 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
3945
3957
|
restoreNativeThemePresentation(theme ?? globalThemeRuntime);
|
|
3946
3958
|
hasAppliedCustomTheme = false;
|
|
3947
3959
|
}
|
|
3948
|
-
if (
|
|
3949
|
-
if (
|
|
3950
|
-
|
|
3960
|
+
if (status.explicitlyDisabled) {
|
|
3961
|
+
if (healTimer) {
|
|
3962
|
+
clearTimeout(healTimer);
|
|
3963
|
+
healTimer = void 0;
|
|
3964
|
+
}
|
|
3965
|
+
return;
|
|
3966
|
+
}
|
|
3967
|
+
if (allowStartupRetry && startupRetryCount < MAX_STARTUP_RETRIES) {
|
|
3968
|
+
startupRetryCount++;
|
|
3969
|
+
if (!healTimer) {
|
|
3970
|
+
const delay = startupRetryCount * 1e3;
|
|
3971
|
+
healTimer = setTimeout(() => {
|
|
3972
|
+
healTimer = void 0;
|
|
3973
|
+
if (!disposed) checkAndSync(true);
|
|
3974
|
+
}, delay);
|
|
3975
|
+
}
|
|
3976
|
+
} else if (healTimer) {
|
|
3977
|
+
clearTimeout(healTimer);
|
|
3978
|
+
healTimer = void 0;
|
|
3979
|
+
}
|
|
3951
3980
|
return;
|
|
3952
3981
|
}
|
|
3953
3982
|
if (healTimer) {
|
|
3954
|
-
|
|
3983
|
+
clearTimeout(healTimer);
|
|
3955
3984
|
healTimer = void 0;
|
|
3956
3985
|
}
|
|
3986
|
+
startupRetryCount = 0;
|
|
3957
3987
|
setThemeSubPluginEnabled(true);
|
|
3958
3988
|
applyCurrentState(true);
|
|
3959
3989
|
};
|
|
3960
3990
|
globalCheckAndSync = checkAndSync;
|
|
3961
3991
|
const onFocus = () => {
|
|
3962
|
-
if (!disposed) checkAndSync();
|
|
3992
|
+
if (!disposed) checkAndSync(false);
|
|
3963
3993
|
};
|
|
3964
3994
|
if (typeof window !== "undefined") {
|
|
3965
3995
|
window.addEventListener("focus", onFocus);
|
|
@@ -3972,7 +4002,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
3972
4002
|
if (e.target?.closest?.("[data-plugin-rows], [data-plugin-row], [data-shortcut-modal=\"settings\"], [role=\"switch\"]")) {
|
|
3973
4003
|
if (clickTimer) clearTimeout(clickTimer);
|
|
3974
4004
|
clickTimer = setTimeout(() => {
|
|
3975
|
-
if (!disposed) checkAndSync();
|
|
4005
|
+
if (!disposed) checkAndSync(false);
|
|
3976
4006
|
}, 150);
|
|
3977
4007
|
}
|
|
3978
4008
|
};
|
|
@@ -3994,7 +4024,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
3994
4024
|
if (touchesSettings) {
|
|
3995
4025
|
if (settingsObserverTimer) clearTimeout(settingsObserverTimer);
|
|
3996
4026
|
settingsObserverTimer = setTimeout(() => {
|
|
3997
|
-
if (!disposed) checkAndSync();
|
|
4027
|
+
if (!disposed) checkAndSync(false);
|
|
3998
4028
|
}, 150);
|
|
3999
4029
|
}
|
|
4000
4030
|
});
|
|
@@ -4009,7 +4039,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
4009
4039
|
observer.disconnect();
|
|
4010
4040
|
});
|
|
4011
4041
|
}
|
|
4012
|
-
checkAndSync();
|
|
4042
|
+
checkAndSync(true);
|
|
4013
4043
|
applyCurrentState(false);
|
|
4014
4044
|
const offThemeChange = ctx.on("theme/change", () => {
|
|
4015
4045
|
if (disposed || !isThemeSubPluginEnabled()) return;
|
|
@@ -4024,7 +4054,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
|
|
|
4024
4054
|
return () => {
|
|
4025
4055
|
disposed = true;
|
|
4026
4056
|
if (globalCheckAndSync === checkAndSync) globalCheckAndSync = void 0;
|
|
4027
|
-
if (healTimer)
|
|
4057
|
+
if (healTimer) clearTimeout(healTimer);
|
|
4028
4058
|
unsubscribe();
|
|
4029
4059
|
offThemeChange?.();
|
|
4030
4060
|
disposeGlassMode();
|
|
@@ -5749,6 +5779,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
5749
5779
|
"home.build.task1": "新しい機能を実装する",
|
|
5750
5780
|
"home.build.task2": "小さなツールを作成する",
|
|
5751
5781
|
"home.busy": "現在入力の処理中です。しばらくしてからもう一度お試しください。",
|
|
5782
|
+
"workspacePicker.search": "プロジェクトを検索",
|
|
5783
|
+
"workspacePicker.list": "プロジェクト一覧",
|
|
5784
|
+
"workspacePicker.new": "新しいプロジェクト",
|
|
5785
|
+
"workspacePicker.empty": "一致するプロジェクトがありません",
|
|
5786
|
+
"workspacePicker.noProjects": "プロジェクトがまだありません",
|
|
5787
|
+
"workspacePicker.loading": "プロジェクトを読み込み中…",
|
|
5788
|
+
"workspacePicker.createFailed": "プロジェクトの作成に失敗しました:",
|
|
5789
|
+
"workspacePicker.defaultName": "デフォルトのワークスペース",
|
|
5752
5790
|
"home.draft": "現在のドラフトと添付ファイルは保持されています。タスクの提案を使用するには入力をクリアしてください。",
|
|
5753
5791
|
"home.explore": "コードを探索して理解する",
|
|
5754
5792
|
"home.explore.prompt1": "現在のワークスペースのコードを探索し、プロジェクト構造、主要なエントリポイント、モジュール間の関係を説明してください。",
|
|
@@ -5978,6 +6016,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
5978
6016
|
"home.build.task1": "Implementar una nueva función",
|
|
5979
6017
|
"home.build.task2": "Crear una pequeña herramienta",
|
|
5980
6018
|
"home.busy": "La entrada se está procesando actualmente. Vuelva a intentarlo en breve.",
|
|
6019
|
+
"workspacePicker.search": "Buscar proyectos",
|
|
6020
|
+
"workspacePicker.list": "Proyectos",
|
|
6021
|
+
"workspacePicker.new": "Nuevo proyecto",
|
|
6022
|
+
"workspacePicker.empty": "No hay proyectos coincidentes",
|
|
6023
|
+
"workspacePicker.noProjects": "Aún no hay proyectos",
|
|
6024
|
+
"workspacePicker.loading": "Cargando proyectos…",
|
|
6025
|
+
"workspacePicker.createFailed": "No se pudo crear el proyecto: ",
|
|
6026
|
+
"workspacePicker.defaultName": "Espacio de trabajo predeterminado",
|
|
5981
6027
|
"home.draft": "Se conservan el borrador actual y los adjuntos. Limpie la entrada para usar una sugerencia.",
|
|
5982
6028
|
"home.explore": "Explorar y comprender el código",
|
|
5983
6029
|
"home.explore.prompt1": "Explore el código de este espacio de trabajo y explique su estructura, puntos de entrada principales y relaciones entre módulos.",
|
|
@@ -6207,6 +6253,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
6207
6253
|
"home.build.task1": "Implémenter une nouvelle fonctionnalité",
|
|
6208
6254
|
"home.build.task2": "Créer un petit outil",
|
|
6209
6255
|
"home.busy": "La saisie est en cours de traitement. Veuillez réessayer sous peu.",
|
|
6256
|
+
"workspacePicker.search": "Rechercher des projets",
|
|
6257
|
+
"workspacePicker.list": "Projets",
|
|
6258
|
+
"workspacePicker.new": "Nouveau projet",
|
|
6259
|
+
"workspacePicker.empty": "Aucun projet correspondant",
|
|
6260
|
+
"workspacePicker.noProjects": "Pas encore de projet",
|
|
6261
|
+
"workspacePicker.loading": "Chargement des projets…",
|
|
6262
|
+
"workspacePicker.createFailed": "Impossible de créer le projet : ",
|
|
6263
|
+
"workspacePicker.defaultName": "Espace de travail par défaut",
|
|
6210
6264
|
"home.draft": "Votre brouillon actuel et vos pièces jointes sont conservés. Effacez la saisie pour utiliser une suggestion.",
|
|
6211
6265
|
"home.explore": "Explorer et comprendre le code",
|
|
6212
6266
|
"home.explore.prompt1": "Explorez le code de cet espace de travail et expliquez la structure du projet, les points d'entrée principaux et les relations entre modules.",
|
|
@@ -6436,6 +6490,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
6436
6490
|
"home.build.task1": "Eine neue Funktion implementieren",
|
|
6437
6491
|
"home.build.task2": "Ein kleines Tool erstellen",
|
|
6438
6492
|
"home.busy": "Die Eingabe wird derzeit verarbeitet. Bitte versuchen Sie es in Kürze erneut.",
|
|
6493
|
+
"workspacePicker.search": "Projekte suchen",
|
|
6494
|
+
"workspacePicker.list": "Projekte",
|
|
6495
|
+
"workspacePicker.new": "Neues Projekt",
|
|
6496
|
+
"workspacePicker.empty": "Keine passenden Projekte",
|
|
6497
|
+
"workspacePicker.noProjects": "Noch keine Projekte",
|
|
6498
|
+
"workspacePicker.loading": "Projekte werden geladen…",
|
|
6499
|
+
"workspacePicker.createFailed": "Projekt konnte nicht erstellt werden: ",
|
|
6500
|
+
"workspacePicker.defaultName": "Standard-Arbeitsbereich",
|
|
6439
6501
|
"home.draft": "Ihr aktueller Entwurf und Ihre Anhänge bleiben erhalten. Löschen Sie die Eingabe, um einen Aufgabenvorschlag zu verwenden.",
|
|
6440
6502
|
"home.explore": "Code untersuchen und verstehen",
|
|
6441
6503
|
"home.explore.prompt1": "Erkunden Sie den Code dieses Arbeitsbereichs und erklären Sie die Projektstruktur, die Haupteinstiegspunkte und die Modulbeziehungen.",
|
|
@@ -6665,6 +6727,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
6665
6727
|
"home.build.task1": "Реализовать новую функцию",
|
|
6666
6728
|
"home.build.task2": "Создать небольшую утилиту",
|
|
6667
6729
|
"home.busy": "Ввод в данный момент обрабатывается. Пожалуйста, повторите попытку позже.",
|
|
6730
|
+
"workspacePicker.search": "Поиск проектов",
|
|
6731
|
+
"workspacePicker.list": "Проекты",
|
|
6732
|
+
"workspacePicker.new": "Новый проект",
|
|
6733
|
+
"workspacePicker.empty": "Нет подходящих проектов",
|
|
6734
|
+
"workspacePicker.noProjects": "Проектов пока нет",
|
|
6735
|
+
"workspacePicker.loading": "Загрузка проектов…",
|
|
6736
|
+
"workspacePicker.createFailed": "Не удалось создать проект: ",
|
|
6737
|
+
"workspacePicker.defaultName": "Рабочая область по умолчанию",
|
|
6668
6738
|
"home.draft": "Текущий черновик и вложения сохранены. Очистите ввод, чтобы использовать предложение задачи.",
|
|
6669
6739
|
"home.explore": "Исследовать и понять код",
|
|
6670
6740
|
"home.explore.prompt1": "Изучите код этой рабочей области и объясните структуру проекта, основные точки входа и связи между модулями.",
|
|
@@ -6894,6 +6964,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
6894
6964
|
"home.build.task1": "Implementar um novo recurso",
|
|
6895
6965
|
"home.build.task2": "Criar uma pequena ferramenta",
|
|
6896
6966
|
"home.busy": "A entrada está sendo processada no momento. Tente novamente em breve.",
|
|
6967
|
+
"workspacePicker.search": "Buscar projetos",
|
|
6968
|
+
"workspacePicker.list": "Projetos",
|
|
6969
|
+
"workspacePicker.new": "Novo projeto",
|
|
6970
|
+
"workspacePicker.empty": "Nenhum projeto correspondente",
|
|
6971
|
+
"workspacePicker.noProjects": "Ainda não há projetos",
|
|
6972
|
+
"workspacePicker.loading": "Carregando projetos…",
|
|
6973
|
+
"workspacePicker.createFailed": "Não foi possível criar o projeto: ",
|
|
6974
|
+
"workspacePicker.defaultName": "Área de trabalho padrão",
|
|
6897
6975
|
"home.draft": "Seu rascunho atual e anexos foram preservados. Limpe a entrada para usar uma sugestão.",
|
|
6898
6976
|
"home.explore": "Explorar e entender o código",
|
|
6899
6977
|
"home.explore.prompt1": "Explore o código deste espaço de trabalho e explique a estrutura do projeto, os principais pontos de entrada e as relações entre módulos.",
|
|
@@ -7017,6 +7095,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
7017
7095
|
"home.workspace": "请先选择工作区,再选择任务。",
|
|
7018
7096
|
"home.draft": "已保留当前草稿和附件;清空输入后可填入任务建议。",
|
|
7019
7097
|
"home.busy": "当前输入正在处理中,请稍后再试。",
|
|
7098
|
+
"workspacePicker.search": "搜索项目",
|
|
7099
|
+
"workspacePicker.list": "项目列表",
|
|
7100
|
+
"workspacePicker.new": "新建项目",
|
|
7101
|
+
"workspacePicker.empty": "没有匹配的项目",
|
|
7102
|
+
"workspacePicker.noProjects": "还没有项目",
|
|
7103
|
+
"workspacePicker.loading": "正在加载项目…",
|
|
7104
|
+
"workspacePicker.createFailed": "新建项目失败:",
|
|
7105
|
+
"workspacePicker.defaultName": "默认工作区",
|
|
7020
7106
|
"home.explore": "探索并理解代码",
|
|
7021
7107
|
"home.build": "构建新功能、应用或工具",
|
|
7022
7108
|
"home.review": "审查代码并提出修改建议",
|
|
@@ -7244,6 +7330,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
|
|
|
7244
7330
|
"home.workspace": "Choose a workspace first, then select a task.",
|
|
7245
7331
|
"home.draft": "Your draft and attachments are preserved. Clear the input to use a suggestion.",
|
|
7246
7332
|
"home.busy": "The input is busy. Please try again shortly.",
|
|
7333
|
+
"workspacePicker.search": "Search projects",
|
|
7334
|
+
"workspacePicker.list": "Projects",
|
|
7335
|
+
"workspacePicker.new": "New project",
|
|
7336
|
+
"workspacePicker.empty": "No matching projects",
|
|
7337
|
+
"workspacePicker.noProjects": "No projects yet",
|
|
7338
|
+
"workspacePicker.loading": "Loading projects…",
|
|
7339
|
+
"workspacePicker.createFailed": "Could not create project: ",
|
|
7340
|
+
"workspacePicker.defaultName": "Default workspace",
|
|
7247
7341
|
"home.explore": "Explore and understand code",
|
|
7248
7342
|
"home.build": "Build features, apps, or tools",
|
|
7249
7343
|
"home.review": "Review code and suggest changes",
|
|
@@ -10128,6 +10222,519 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
10128
10222
|
unregisterHint();
|
|
10129
10223
|
};
|
|
10130
10224
|
}
|
|
10225
|
+
//#endregion
|
|
10226
|
+
//#region src/client/composer/WorkspacePickerCodex.tsx
|
|
10227
|
+
/** 浮层宽度(对齐参考截图里的 Codex 项目选择器),也是定位计算的钳制依据。 */
|
|
10228
|
+
const PANEL_WIDTH = 266;
|
|
10229
|
+
/** 浮层的最大可能高度,用于打开时判断向下展开是否放得下。 */
|
|
10230
|
+
const POPOVER_MAX_HEIGHT = 312;
|
|
10231
|
+
/**
|
|
10232
|
+
* 宿主首次初始化的工作区自动标题。宿主展示逻辑在
|
|
10233
|
+
* `dsh-api-workspace-controller/default-workspace` 的 `workspaceDisplayTitle`,
|
|
10234
|
+
* 该子路径未列入本包 peer 依赖,故此处按同一 sentinel 本地判定。
|
|
10235
|
+
*/
|
|
10236
|
+
const DEFAULT_WORKSPACE_TITLE = "default-workspace";
|
|
10237
|
+
/** 创建一个初始开放的能力闸门。 */
|
|
10238
|
+
function createCreateGate() {
|
|
10239
|
+
let open = true;
|
|
10240
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
10241
|
+
return {
|
|
10242
|
+
getSnapshot: () => open,
|
|
10243
|
+
subscribe: (listener) => {
|
|
10244
|
+
listeners.add(listener);
|
|
10245
|
+
return () => {
|
|
10246
|
+
listeners.delete(listener);
|
|
10247
|
+
};
|
|
10248
|
+
},
|
|
10249
|
+
close: () => {
|
|
10250
|
+
if (!open) return;
|
|
10251
|
+
open = false;
|
|
10252
|
+
for (const listener of listeners) listener();
|
|
10253
|
+
}
|
|
10254
|
+
};
|
|
10255
|
+
}
|
|
10256
|
+
/**
|
|
10257
|
+
* 组装「新建项目」的目录选择入口。
|
|
10258
|
+
*
|
|
10259
|
+
* browse 后端(远程 Peer、SSH 启动、非 loopback 绑定)以
|
|
10260
|
+
* `directory-picker/unavailable` 拒绝:此时永久关闭闸门并返回 null,
|
|
10261
|
+
* 让「新建项目」入口消失,而不是在界面上留一个点了没反应的假入口。
|
|
10262
|
+
*/
|
|
10263
|
+
function createPickDirectory(deps) {
|
|
10264
|
+
return async () => {
|
|
10265
|
+
if (deps.desktopPicker !== void 0) return deps.desktopPicker.pick();
|
|
10266
|
+
const picker = deps.getRemotePicker?.();
|
|
10267
|
+
if (picker === void 0) return deps.fallback();
|
|
10268
|
+
const result = await picker.pick();
|
|
10269
|
+
if (result.ok) return result.value ?? null;
|
|
10270
|
+
if (result.error?.code === "directory-picker/unavailable") {
|
|
10271
|
+
deps.gate.close();
|
|
10272
|
+
return null;
|
|
10273
|
+
}
|
|
10274
|
+
throw new Error(result.error?.message ?? "directory picker failed");
|
|
10275
|
+
};
|
|
10276
|
+
}
|
|
10277
|
+
/** 目录路径的最后一段,作为没有标题时的兜底名称。 */
|
|
10278
|
+
function pathBasename(path) {
|
|
10279
|
+
const parts = path.split(/[\\/]/).filter((part) => part !== "");
|
|
10280
|
+
return parts[parts.length - 1] ?? path;
|
|
10281
|
+
}
|
|
10282
|
+
/** 与宿主 workspaceDisplayTitle 一致:自动标题显示本地化默认名,其余原样。 */
|
|
10283
|
+
function projectName(workspace, defaultName) {
|
|
10284
|
+
const title = workspace.title.trim();
|
|
10285
|
+
if (title === "") return pathBasename(workspace.path);
|
|
10286
|
+
return title === DEFAULT_WORKSPACE_TITLE ? defaultName : title;
|
|
10287
|
+
}
|
|
10288
|
+
/**
|
|
10289
|
+
* 同项目名的 Workspace 各取「最短的唯一尾部路径段」用于区分展示。
|
|
10290
|
+
*
|
|
10291
|
+
* 语义与宿主 `ui-workspace` 的 `distinguishingPathSuffixes` 相同:分段与分隔符
|
|
10292
|
+
* 交替切分,逐段加长直到没有同名项共享同一后缀;名字唯一的项目不产生后缀。
|
|
10293
|
+
* 该模块未通过宿主的包 `exports` 暴露,因此本地保留同一算法。
|
|
10294
|
+
* @param workspaces - 每个项目的 id、展示标题与规范路径。
|
|
10295
|
+
* @returns 按 Workspace id 索引的区分后缀。
|
|
10296
|
+
*/
|
|
10297
|
+
function distinguishingPathSuffixes(workspaces) {
|
|
10298
|
+
const rows = workspaces.map((workspace) => ({
|
|
10299
|
+
...workspace,
|
|
10300
|
+
parts: workspace.path.split(/([\\/])/)
|
|
10301
|
+
}));
|
|
10302
|
+
const suffix = (parts, count) => parts.slice(-(2 * count - 1)).join("");
|
|
10303
|
+
const suffixes = /* @__PURE__ */ new Map();
|
|
10304
|
+
for (const row of rows) {
|
|
10305
|
+
const peers = rows.filter((other) => other !== row && other.title === row.title);
|
|
10306
|
+
if (peers.length === 0) continue;
|
|
10307
|
+
let count = 1;
|
|
10308
|
+
while (2 * count - 1 < row.parts.length && (suffix(row.parts, count) === "" || peers.some((peer) => suffix(peer.parts, count) === suffix(row.parts, count)))) count++;
|
|
10309
|
+
suffixes.set(row.id, suffix(row.parts, count));
|
|
10310
|
+
}
|
|
10311
|
+
return suffixes;
|
|
10312
|
+
}
|
|
10313
|
+
/**
|
|
10314
|
+
* Codex 风格项目选择器:搜索 + 项目列表 + 新建项目。
|
|
10315
|
+
*
|
|
10316
|
+
* 替换宿主 `conversation.hero.workspace` 的单槽默认实现(无搜索的 Menu),
|
|
10317
|
+
* 交互与视觉对齐参考截图;所有数据仍走宿主 Workspace Controller:选择项目
|
|
10318
|
+
* 调用 owner 的 `onPick`,新建项目先选目录再 `createWorkspace`。
|
|
10319
|
+
*
|
|
10320
|
+
* 浮层材质、菜单行与搜索框分别复用宿主原语 `MenuSurface` / `MenuItemButton` /
|
|
10321
|
+
* `Input`,配色与浅色、深色、玻璃主题由宿主令牌负责;本组件只保留锚点定位、
|
|
10322
|
+
* 组合框式搜索过滤与键盘游标(焦点始终留在搜索框)。
|
|
10323
|
+
*
|
|
10324
|
+
* 与宿主默认实现的差异:本条目未声明 `conversation.hero.workspace.directoryFlow`
|
|
10325
|
+
* 子槽(同一子槽只能有一处声明,官方工作区插件已占用),因此「新建项目」走宿主
|
|
10326
|
+
* 目录选择能力,不提供应用内目录浏览。
|
|
10327
|
+
* @param props - 槽位 owner props、本地化函数与注入的目录/创建能力。
|
|
10328
|
+
* @returns 浮层(portal 到 document.body),关闭时为 null。
|
|
10329
|
+
*/
|
|
10330
|
+
function CodexWorkspacePicker(props) {
|
|
10331
|
+
const { open, selectedId, anchorRef, onPick, onClose, useWorkspaces, t, pickDirectory, createWorkspace, createGate } = props;
|
|
10332
|
+
const snapshot = useWorkspaces((state) => state);
|
|
10333
|
+
const canCreate = (0, react.useSyncExternalStore)(createGate.subscribe, createGate.getSnapshot, createGate.getSnapshot);
|
|
10334
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
10335
|
+
const [active, setActive] = (0, react.useState)(0);
|
|
10336
|
+
const [busy, setBusy] = (0, react.useState)(false);
|
|
10337
|
+
const [error, setError] = (0, react.useState)(null);
|
|
10338
|
+
const [position, setPosition] = (0, react.useState)({
|
|
10339
|
+
position: "fixed",
|
|
10340
|
+
left: 0,
|
|
10341
|
+
top: 0,
|
|
10342
|
+
visibility: "hidden"
|
|
10343
|
+
});
|
|
10344
|
+
const surfaceRef = (0, react.useRef)(null);
|
|
10345
|
+
const scrollRef = (0, react.useRef)(null);
|
|
10346
|
+
const inputRef = (0, react.useRef)(null);
|
|
10347
|
+
const sideRef = (0, react.useRef)("below");
|
|
10348
|
+
const alive = (0, react.useRef)(true);
|
|
10349
|
+
/** 打开时「聚焦搜索框」那一帧的句柄,关闭时必须取消,否则焦点会被抢回输入框。 */
|
|
10350
|
+
const focusFrameRef = (0, react.useRef)(void 0);
|
|
10351
|
+
const baseId = (0, react.useId)();
|
|
10352
|
+
const listId = `${baseId}-list`;
|
|
10353
|
+
const createId = `${baseId}-create`;
|
|
10354
|
+
const rowIdOf = (0, react.useCallback)((index) => `${baseId}-row-${index}`, [baseId]);
|
|
10355
|
+
(0, react.useEffect)(() => {
|
|
10356
|
+
alive.current = true;
|
|
10357
|
+
return () => {
|
|
10358
|
+
alive.current = false;
|
|
10359
|
+
};
|
|
10360
|
+
}, []);
|
|
10361
|
+
const rows = (0, react.useMemo)(() => {
|
|
10362
|
+
const defaultName = t("workspacePicker.defaultName");
|
|
10363
|
+
const listed = snapshot.items.map((workspace) => ({
|
|
10364
|
+
workspace,
|
|
10365
|
+
label: projectName(workspace, defaultName)
|
|
10366
|
+
}));
|
|
10367
|
+
const suffixes = distinguishingPathSuffixes(listed.map(({ workspace, label }) => ({
|
|
10368
|
+
id: workspace.workspaceId,
|
|
10369
|
+
title: label,
|
|
10370
|
+
path: workspace.path
|
|
10371
|
+
})));
|
|
10372
|
+
const needle = query.trim().toLowerCase();
|
|
10373
|
+
const projects = listed.filter(({ workspace, label }) => needle === "" || label.toLowerCase().includes(needle) || workspace.path.toLowerCase().includes(needle)).map(({ workspace, label }) => ({
|
|
10374
|
+
kind: "project",
|
|
10375
|
+
id: workspace.workspaceId,
|
|
10376
|
+
label,
|
|
10377
|
+
suffix: suffixes.get(workspace.workspaceId),
|
|
10378
|
+
path: workspace.path
|
|
10379
|
+
}));
|
|
10380
|
+
return canCreate ? [...projects, { kind: "create" }] : projects;
|
|
10381
|
+
}, [
|
|
10382
|
+
snapshot.items,
|
|
10383
|
+
query,
|
|
10384
|
+
t,
|
|
10385
|
+
canCreate
|
|
10386
|
+
]);
|
|
10387
|
+
const projectCount = canCreate ? rows.length - 1 : rows.length;
|
|
10388
|
+
/** 关闭浮层并把焦点还给锚点胶囊,键盘用户不丢失上下文。 */
|
|
10389
|
+
const closeMenu = (0, react.useCallback)(() => {
|
|
10390
|
+
if (focusFrameRef.current !== void 0) {
|
|
10391
|
+
cancelAnimationFrame(focusFrameRef.current);
|
|
10392
|
+
focusFrameRef.current = void 0;
|
|
10393
|
+
}
|
|
10394
|
+
onClose();
|
|
10395
|
+
anchorRef?.current?.focus({ preventScroll: true });
|
|
10396
|
+
}, [onClose, anchorRef]);
|
|
10397
|
+
(0, react.useEffect)(() => {
|
|
10398
|
+
if (!open) return;
|
|
10399
|
+
setQuery("");
|
|
10400
|
+
setActive(0);
|
|
10401
|
+
setError(null);
|
|
10402
|
+
const frame = requestAnimationFrame(() => {
|
|
10403
|
+
focusFrameRef.current = void 0;
|
|
10404
|
+
inputRef.current?.focus();
|
|
10405
|
+
});
|
|
10406
|
+
focusFrameRef.current = frame;
|
|
10407
|
+
return () => {
|
|
10408
|
+
cancelAnimationFrame(frame);
|
|
10409
|
+
if (focusFrameRef.current === frame) focusFrameRef.current = void 0;
|
|
10410
|
+
};
|
|
10411
|
+
}, [open]);
|
|
10412
|
+
(0, react.useEffect)(() => {
|
|
10413
|
+
setActive((current) => current > rows.length - 1 ? Math.max(0, rows.length - 1) : current);
|
|
10414
|
+
}, [rows.length]);
|
|
10415
|
+
(0, react.useEffect)(() => {
|
|
10416
|
+
if (!open) return;
|
|
10417
|
+
const id = active < projectCount ? rowIdOf(active) : canCreate ? createId : void 0;
|
|
10418
|
+
if (id === void 0) return;
|
|
10419
|
+
document.getElementById(id)?.scrollIntoView?.({ block: "nearest" });
|
|
10420
|
+
}, [
|
|
10421
|
+
open,
|
|
10422
|
+
active,
|
|
10423
|
+
projectCount,
|
|
10424
|
+
canCreate,
|
|
10425
|
+
rowIdOf,
|
|
10426
|
+
createId
|
|
10427
|
+
]);
|
|
10428
|
+
(0, react.useLayoutEffect)(() => {
|
|
10429
|
+
if (!open) return;
|
|
10430
|
+
const syncSide = () => {
|
|
10431
|
+
const rect = anchorRef?.current?.getBoundingClientRect();
|
|
10432
|
+
if (rect === void 0) {
|
|
10433
|
+
sideRef.current = "below";
|
|
10434
|
+
return;
|
|
10435
|
+
}
|
|
10436
|
+
const below = window.innerHeight - rect.bottom;
|
|
10437
|
+
const above = rect.top;
|
|
10438
|
+
sideRef.current = below >= POPOVER_MAX_HEIGHT || below >= above ? "below" : "above";
|
|
10439
|
+
};
|
|
10440
|
+
syncSide();
|
|
10441
|
+
window.addEventListener("resize", syncSide);
|
|
10442
|
+
return () => {
|
|
10443
|
+
window.removeEventListener("resize", syncSide);
|
|
10444
|
+
};
|
|
10445
|
+
}, [open, anchorRef]);
|
|
10446
|
+
(0, react.useLayoutEffect)(() => {
|
|
10447
|
+
if (!open) return;
|
|
10448
|
+
const update = () => {
|
|
10449
|
+
const element = surfaceRef.current;
|
|
10450
|
+
if (element === null) return;
|
|
10451
|
+
const rect = (anchorRef?.current)?.getBoundingClientRect();
|
|
10452
|
+
const width = Math.min(PANEL_WIDTH, window.innerWidth - 16);
|
|
10453
|
+
const height = element.offsetHeight;
|
|
10454
|
+
const anchorLeft = rect?.left ?? 16;
|
|
10455
|
+
const anchorTop = rect?.top ?? window.innerHeight - 88;
|
|
10456
|
+
const anchorBottom = rect?.bottom ?? window.innerHeight - 64;
|
|
10457
|
+
const left = Math.max(8, Math.min(anchorLeft, window.innerWidth - width - 8));
|
|
10458
|
+
const unclamped = sideRef.current === "below" ? anchorBottom + 6 : anchorTop - height - 6;
|
|
10459
|
+
const top = Math.max(8, Math.min(unclamped, window.innerHeight - height - 8));
|
|
10460
|
+
setPosition((current) => current.left === left && current.top === top && current.width === width && current.visibility === "visible" ? current : {
|
|
10461
|
+
position: "fixed",
|
|
10462
|
+
left,
|
|
10463
|
+
top,
|
|
10464
|
+
width,
|
|
10465
|
+
visibility: "visible"
|
|
10466
|
+
});
|
|
10467
|
+
};
|
|
10468
|
+
update();
|
|
10469
|
+
const frame = requestAnimationFrame(update);
|
|
10470
|
+
window.addEventListener("resize", update);
|
|
10471
|
+
window.addEventListener("scroll", update, true);
|
|
10472
|
+
return () => {
|
|
10473
|
+
cancelAnimationFrame(frame);
|
|
10474
|
+
window.removeEventListener("resize", update);
|
|
10475
|
+
window.removeEventListener("scroll", update, true);
|
|
10476
|
+
};
|
|
10477
|
+
}, [
|
|
10478
|
+
open,
|
|
10479
|
+
anchorRef,
|
|
10480
|
+
rows.length,
|
|
10481
|
+
error,
|
|
10482
|
+
busy
|
|
10483
|
+
]);
|
|
10484
|
+
(0, react.useEffect)(() => {
|
|
10485
|
+
if (!open) return;
|
|
10486
|
+
const onPointerDown = (event) => {
|
|
10487
|
+
const target = event.target;
|
|
10488
|
+
if (target === null) return;
|
|
10489
|
+
if (surfaceRef.current?.contains(target) === true) return;
|
|
10490
|
+
if (anchorRef?.current?.contains(target) === true) return;
|
|
10491
|
+
closeMenu();
|
|
10492
|
+
};
|
|
10493
|
+
const onKeyDown = (event) => {
|
|
10494
|
+
if (event.key === "Escape") {
|
|
10495
|
+
event.preventDefault();
|
|
10496
|
+
closeMenu();
|
|
10497
|
+
}
|
|
10498
|
+
};
|
|
10499
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
10500
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
10501
|
+
return () => {
|
|
10502
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
10503
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
10504
|
+
};
|
|
10505
|
+
}, [
|
|
10506
|
+
open,
|
|
10507
|
+
anchorRef,
|
|
10508
|
+
closeMenu
|
|
10509
|
+
]);
|
|
10510
|
+
const startCreate = (0, react.useCallback)(async () => {
|
|
10511
|
+
setBusy(true);
|
|
10512
|
+
setError(null);
|
|
10513
|
+
try {
|
|
10514
|
+
const path = await pickDirectory();
|
|
10515
|
+
if (path === null || path === "") return;
|
|
10516
|
+
const workspace = await createWorkspace({ path });
|
|
10517
|
+
if (!alive.current) return;
|
|
10518
|
+
closeMenu();
|
|
10519
|
+
onPick(workspace.workspaceId);
|
|
10520
|
+
} catch (reason) {
|
|
10521
|
+
if (alive.current) setError(reason instanceof Error ? reason.message : String(reason));
|
|
10522
|
+
} finally {
|
|
10523
|
+
if (alive.current) setBusy(false);
|
|
10524
|
+
}
|
|
10525
|
+
}, [
|
|
10526
|
+
pickDirectory,
|
|
10527
|
+
createWorkspace,
|
|
10528
|
+
closeMenu,
|
|
10529
|
+
onPick
|
|
10530
|
+
]);
|
|
10531
|
+
const choose = (0, react.useCallback)((row) => {
|
|
10532
|
+
if (row.kind === "create") {
|
|
10533
|
+
startCreate();
|
|
10534
|
+
return;
|
|
10535
|
+
}
|
|
10536
|
+
closeMenu();
|
|
10537
|
+
onPick(row.id);
|
|
10538
|
+
}, [
|
|
10539
|
+
startCreate,
|
|
10540
|
+
closeMenu,
|
|
10541
|
+
onPick
|
|
10542
|
+
]);
|
|
10543
|
+
const handleKeyDown = (event) => {
|
|
10544
|
+
if (rows.length === 0) return;
|
|
10545
|
+
if (event.key === "ArrowDown") {
|
|
10546
|
+
event.preventDefault();
|
|
10547
|
+
setActive((current) => (current + 1) % rows.length);
|
|
10548
|
+
return;
|
|
10549
|
+
}
|
|
10550
|
+
if (event.key === "ArrowUp") {
|
|
10551
|
+
event.preventDefault();
|
|
10552
|
+
setActive((current) => (current - 1 + rows.length) % rows.length);
|
|
10553
|
+
return;
|
|
10554
|
+
}
|
|
10555
|
+
if (event.key === "Home") {
|
|
10556
|
+
event.preventDefault();
|
|
10557
|
+
setActive(0);
|
|
10558
|
+
return;
|
|
10559
|
+
}
|
|
10560
|
+
if (event.key === "End") {
|
|
10561
|
+
event.preventDefault();
|
|
10562
|
+
setActive(rows.length - 1);
|
|
10563
|
+
return;
|
|
10564
|
+
}
|
|
10565
|
+
if (event.key === "Enter") {
|
|
10566
|
+
const row = rows[active];
|
|
10567
|
+
if (row === void 0) return;
|
|
10568
|
+
event.preventDefault();
|
|
10569
|
+
choose(row);
|
|
10570
|
+
}
|
|
10571
|
+
};
|
|
10572
|
+
if (!open) return null;
|
|
10573
|
+
const projectRows = rows.filter((row) => row.kind === "project");
|
|
10574
|
+
const createIndex = projectRows.length;
|
|
10575
|
+
const settled = snapshot.state !== "loading";
|
|
10576
|
+
const hasProjects = projectRows.length > 0;
|
|
10577
|
+
const activeId = active < createIndex ? rowIdOf(active) : canCreate ? createId : void 0;
|
|
10578
|
+
return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.MenuSurface, {
|
|
10579
|
+
ref: surfaceRef,
|
|
10580
|
+
className: "dcu-wsp-panel",
|
|
10581
|
+
style: position,
|
|
10582
|
+
"data-dcu-workspace-picker": "",
|
|
10583
|
+
children: [
|
|
10584
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
|
|
10585
|
+
ref: inputRef,
|
|
10586
|
+
className: "dcu-wsp-search",
|
|
10587
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutlineRegular, { size: 14 }),
|
|
10588
|
+
type: "text",
|
|
10589
|
+
value: query,
|
|
10590
|
+
placeholder: t("workspacePicker.search"),
|
|
10591
|
+
"aria-label": t("workspacePicker.search"),
|
|
10592
|
+
role: "combobox",
|
|
10593
|
+
"aria-expanded": "true",
|
|
10594
|
+
"aria-controls": listId,
|
|
10595
|
+
"aria-activedescendant": activeId,
|
|
10596
|
+
"aria-autocomplete": "list",
|
|
10597
|
+
autoComplete: "off",
|
|
10598
|
+
spellCheck: false,
|
|
10599
|
+
onChange: (event) => {
|
|
10600
|
+
setQuery(event.target.value);
|
|
10601
|
+
setActive(0);
|
|
10602
|
+
setError(null);
|
|
10603
|
+
},
|
|
10604
|
+
onKeyDown: handleKeyDown
|
|
10605
|
+
}),
|
|
10606
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10607
|
+
ref: scrollRef,
|
|
10608
|
+
id: listId,
|
|
10609
|
+
className: "dcu-wsp-scroll",
|
|
10610
|
+
role: "menu",
|
|
10611
|
+
"aria-label": t("workspacePicker.list"),
|
|
10612
|
+
children: [
|
|
10613
|
+
projectRows.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10614
|
+
role: "none",
|
|
10615
|
+
className: "dcu-wsp-row",
|
|
10616
|
+
"data-active": active === index,
|
|
10617
|
+
"data-workspace-id": row.id,
|
|
10618
|
+
onMouseEnter: () => setActive(index),
|
|
10619
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
|
|
10620
|
+
id: rowIdOf(index),
|
|
10621
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderCloseRegular, { size: 16 }),
|
|
10622
|
+
current: row.id === selectedId,
|
|
10623
|
+
disabled: busy,
|
|
10624
|
+
onSelect: () => choose(row),
|
|
10625
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
10626
|
+
className: "dcu-wsp-body",
|
|
10627
|
+
children: [
|
|
10628
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10629
|
+
className: "dcu-wsp-label",
|
|
10630
|
+
title: row.path,
|
|
10631
|
+
children: row.label
|
|
10632
|
+
}),
|
|
10633
|
+
row.suffix === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10634
|
+
className: "dcu-wsp-suffix",
|
|
10635
|
+
children: row.suffix
|
|
10636
|
+
}),
|
|
10637
|
+
row.id === selectedId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, {
|
|
10638
|
+
size: 16,
|
|
10639
|
+
"aria-hidden": "true",
|
|
10640
|
+
className: "dcu-wsp-check"
|
|
10641
|
+
}) : null
|
|
10642
|
+
]
|
|
10643
|
+
})
|
|
10644
|
+
})
|
|
10645
|
+
}, row.id)),
|
|
10646
|
+
!hasProjects && !settled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10647
|
+
className: "dcu-wsp-status",
|
|
10648
|
+
role: "status",
|
|
10649
|
+
children: t("workspacePicker.loading")
|
|
10650
|
+
}) : null,
|
|
10651
|
+
!hasProjects && settled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10652
|
+
className: "dcu-wsp-status",
|
|
10653
|
+
role: "status",
|
|
10654
|
+
children: query.trim() === "" ? t("workspacePicker.noProjects") : t("workspacePicker.empty")
|
|
10655
|
+
}) : null
|
|
10656
|
+
]
|
|
10657
|
+
}),
|
|
10658
|
+
canCreate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10659
|
+
role: "none",
|
|
10660
|
+
className: "dcu-wsp-create",
|
|
10661
|
+
"data-active": active === createIndex,
|
|
10662
|
+
"data-dcu-workspace-create": "",
|
|
10663
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
|
|
10664
|
+
id: createId,
|
|
10665
|
+
icon: busy ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10666
|
+
className: "dcu-wsp-spin",
|
|
10667
|
+
"aria-hidden": "true"
|
|
10668
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 16 }),
|
|
10669
|
+
disabled: busy,
|
|
10670
|
+
separatorBefore: true,
|
|
10671
|
+
onSelect: () => choose({ kind: "create" }),
|
|
10672
|
+
children: t("workspacePicker.new")
|
|
10673
|
+
})
|
|
10674
|
+
}) : null,
|
|
10675
|
+
error !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10676
|
+
className: "dcu-wsp-error",
|
|
10677
|
+
role: "alert",
|
|
10678
|
+
children: [t("workspacePicker.createFailed"), error]
|
|
10679
|
+
}) : null
|
|
10680
|
+
]
|
|
10681
|
+
}), document.body);
|
|
10682
|
+
}
|
|
10683
|
+
//#endregion
|
|
10684
|
+
//#region src/client/composer/workspace-picker-style.ts
|
|
10685
|
+
/**
|
|
10686
|
+
* Codex 风格项目选择器样式。
|
|
10687
|
+
*
|
|
10688
|
+
* 材质层(半透明底、圆角、backdrop、进出场)由宿主 `MenuSurface` 提供,菜单行由
|
|
10689
|
+
* 宿主 `MenuItemButton` 渲染。这里补两件宿主菜单列表本来会做、只挂 `MenuSurface`
|
|
10690
|
+
* 会漏掉的事:
|
|
10691
|
+
* 1. 卡片高度感:宿主 `Menu` 的列表类带 `--dsw-elevation-prominent` 投影与描边环,
|
|
10692
|
+
* 并把滚动条 thumb 重绑到 l2 高度色(`--dsh-scrollbar-*`);缺了这些就是一张平卡片;
|
|
10693
|
+
* 2. 压平宿主 `Input` 在表单语境里的描边与 2px 聚焦环——菜单里的搜索行不是表单,
|
|
10694
|
+
* 原样带进来会像一条错误态输入框。
|
|
10695
|
+
*/
|
|
10696
|
+
const WORKSPACE_PICKER_STYLE = `
|
|
10697
|
+
.dcu-wsp-panel{
|
|
10698
|
+
box-sizing:border-box;
|
|
10699
|
+
display:flex;
|
|
10700
|
+
flex-direction:column;
|
|
10701
|
+
width:min(266px,calc(100vw - 16px));
|
|
10702
|
+
padding:4px;
|
|
10703
|
+
--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);
|
|
10704
|
+
box-shadow:var(--dsw-elevation-prominent);
|
|
10705
|
+
--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);
|
|
10706
|
+
--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);
|
|
10707
|
+
}
|
|
10708
|
+
.dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search{
|
|
10709
|
+
box-sizing:border-box;
|
|
10710
|
+
width:100%;
|
|
10711
|
+
height:30px;
|
|
10712
|
+
margin-bottom:4px;
|
|
10713
|
+
padding:0 6px;
|
|
10714
|
+
border:0;
|
|
10715
|
+
border-bottom:1px solid var(--dsw-alias-border-l1);
|
|
10716
|
+
border-radius:0;
|
|
10717
|
+
background:transparent;
|
|
10718
|
+
}
|
|
10719
|
+
.dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search:focus-within{border-bottom-color:var(--dsw-alias-border-l3)}
|
|
10720
|
+
.dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search input,
|
|
10721
|
+
.dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search input:focus,
|
|
10722
|
+
.dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search input:focus-visible{outline:none;box-shadow:none;background:transparent}
|
|
10723
|
+
.dcu-wsp-scroll{display:flex;flex-direction:column;min-height:0;max-height:203px;overflow-y:auto;overscroll-behavior:contain}
|
|
10724
|
+
.dcu-wsp-row{flex:none}
|
|
10725
|
+
.dcu-wsp-row[data-active=true] [role=menuitem],
|
|
10726
|
+
.dcu-wsp-create[data-active=true] [role=menuitem]{background:var(--dsw-alias-interactive-bg-hover)}
|
|
10727
|
+
.dcu-wsp-body{display:flex;align-items:center;gap:6px;min-width:0;width:100%}
|
|
10728
|
+
.dcu-wsp-label{min-width:0;overflow:hidden;text-overflow:ellipsis}
|
|
10729
|
+
.dcu-wsp-suffix{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:inherit}
|
|
10730
|
+
.dcu-wsp-check{margin-left:auto;flex:none;color:var(--dsw-alias-label-secondary)}
|
|
10731
|
+
.dcu-wsp-create{flex:none}
|
|
10732
|
+
.dcu-wsp-status{padding:10px 8px;color:var(--dsw-alias-label-tertiary)}
|
|
10733
|
+
.dcu-wsp-error{padding:6px 10px 2px;color:var(--dsw-alias-state-warn-label,#d94838);font-size:12px;line-height:18px;word-break:break-word}
|
|
10734
|
+
.dcu-wsp-spin{box-sizing:border-box;width:14px;height:14px;flex:none;border-radius:50%;border:1.5px solid color-mix(in srgb,var(--dsw-alias-label-primary) 22%,transparent);border-top-color:var(--dsw-alias-label-primary);animation:dcu-wsp-spin .8s linear infinite}
|
|
10735
|
+
@keyframes dcu-wsp-spin{to{transform:rotate(360deg)}}
|
|
10736
|
+
@media(prefers-reduced-motion:reduce){.dcu-wsp-spin{animation-duration:2.4s}}
|
|
10737
|
+
`;
|
|
10131
10738
|
/** 按用户要求用最窄宽度替代宿主自适应默认;已有有效偏好不重置,拖拽起点沿用宿主存储。 */
|
|
10132
10739
|
function initializeComposerWidth(storage) {
|
|
10133
10740
|
const key = "dsh.conversation.contentWidth";
|
|
@@ -11192,7 +11799,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11192
11799
|
};
|
|
11193
11800
|
const style = doc.createElement("style");
|
|
11194
11801
|
style.id = COMPOSER_ENHANCEMENT_STYLE_ID;
|
|
11195
|
-
style.textContent = `\n${NEW_CONVERSATION_STYLE}\n`;
|
|
11802
|
+
style.textContent = `\n${NEW_CONVERSATION_STYLE}\n${WORKSPACE_PICKER_STYLE}\n`;
|
|
11196
11803
|
(doc.head ?? doc.documentElement).appendChild(style);
|
|
11197
11804
|
return () => {
|
|
11198
11805
|
if (style.parentNode !== null) style.remove();
|
|
@@ -11245,6 +11852,30 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
|
|
|
11245
11852
|
locale: NS
|
|
11246
11853
|
}, SuggestionsDock));
|
|
11247
11854
|
cleaners.push(unregisterSuggestions);
|
|
11855
|
+
const desktopPicker = globalThis.__DSH_DIRECTORY_PICKER__;
|
|
11856
|
+
const createGate = createCreateGate();
|
|
11857
|
+
const pickerInjected = {
|
|
11858
|
+
pickDirectory: createPickDirectory({
|
|
11859
|
+
...desktopPicker === void 0 ? {} : { desktopPicker },
|
|
11860
|
+
getRemotePicker: () => ctx.get?.("remote.directoryPicker"),
|
|
11861
|
+
fallback: () => ctx.uiWorkspace.pickDirectory(),
|
|
11862
|
+
gate: createGate
|
|
11863
|
+
}),
|
|
11864
|
+
createWorkspace: (input) => ctx.workspaces.create(input),
|
|
11865
|
+
createGate
|
|
11866
|
+
};
|
|
11867
|
+
function WorkspacePickerSlot(props) {
|
|
11868
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodexWorkspacePicker, {
|
|
11869
|
+
...props,
|
|
11870
|
+
...pickerInjected
|
|
11871
|
+
});
|
|
11872
|
+
}
|
|
11873
|
+
const unregisterWorkspacePicker = ctx.slots.inject("conversation.hero.workspace", () => ctx.slots.register({
|
|
11874
|
+
name: "conversation.hero.workspace",
|
|
11875
|
+
priority: -100,
|
|
11876
|
+
locale: NS
|
|
11877
|
+
}, WorkspacePickerSlot));
|
|
11878
|
+
cleaners.push(unregisterWorkspacePicker);
|
|
11248
11879
|
function PredictionSlot(props) {
|
|
11249
11880
|
const prediction = (0, react.useSyncExternalStore)(subscribePredictionSettings, getPredictionSettingsState, getPredictionSettingsState);
|
|
11250
11881
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerPredictionOverlay, {
|
|
@@ -113,6 +113,14 @@ const ja = {
|
|
|
113
113
|
"home.build.task1": "新しい機能を実装する",
|
|
114
114
|
"home.build.task2": "小さなツールを作成する",
|
|
115
115
|
"home.busy": "現在入力の処理中です。しばらくしてからもう一度お試しください。",
|
|
116
|
+
"workspacePicker.search": "プロジェクトを検索",
|
|
117
|
+
"workspacePicker.list": "プロジェクト一覧",
|
|
118
|
+
"workspacePicker.new": "新しいプロジェクト",
|
|
119
|
+
"workspacePicker.empty": "一致するプロジェクトがありません",
|
|
120
|
+
"workspacePicker.noProjects": "プロジェクトがまだありません",
|
|
121
|
+
"workspacePicker.loading": "プロジェクトを読み込み中…",
|
|
122
|
+
"workspacePicker.createFailed": "プロジェクトの作成に失敗しました:",
|
|
123
|
+
"workspacePicker.defaultName": "デフォルトのワークスペース",
|
|
116
124
|
"home.draft": "現在のドラフトと添付ファイルは保持されています。タスクの提案を使用するには入力をクリアしてください。",
|
|
117
125
|
"home.explore": "コードを探索して理解する",
|
|
118
126
|
"home.explore.prompt1": "現在のワークスペースのコードを探索し、プロジェクト構造、主要なエントリポイント、モジュール間の関係を説明してください。",
|
|
@@ -342,6 +350,14 @@ const es = {
|
|
|
342
350
|
"home.build.task1": "Implementar una nueva función",
|
|
343
351
|
"home.build.task2": "Crear una pequeña herramienta",
|
|
344
352
|
"home.busy": "La entrada se está procesando actualmente. Vuelva a intentarlo en breve.",
|
|
353
|
+
"workspacePicker.search": "Buscar proyectos",
|
|
354
|
+
"workspacePicker.list": "Proyectos",
|
|
355
|
+
"workspacePicker.new": "Nuevo proyecto",
|
|
356
|
+
"workspacePicker.empty": "No hay proyectos coincidentes",
|
|
357
|
+
"workspacePicker.noProjects": "Aún no hay proyectos",
|
|
358
|
+
"workspacePicker.loading": "Cargando proyectos…",
|
|
359
|
+
"workspacePicker.createFailed": "No se pudo crear el proyecto: ",
|
|
360
|
+
"workspacePicker.defaultName": "Espacio de trabajo predeterminado",
|
|
345
361
|
"home.draft": "Se conservan el borrador actual y los adjuntos. Limpie la entrada para usar una sugerencia.",
|
|
346
362
|
"home.explore": "Explorar y comprender el código",
|
|
347
363
|
"home.explore.prompt1": "Explore el código de este espacio de trabajo y explique su estructura, puntos de entrada principales y relaciones entre módulos.",
|
|
@@ -571,6 +587,14 @@ const fr = {
|
|
|
571
587
|
"home.build.task1": "Implémenter une nouvelle fonctionnalité",
|
|
572
588
|
"home.build.task2": "Créer un petit outil",
|
|
573
589
|
"home.busy": "La saisie est en cours de traitement. Veuillez réessayer sous peu.",
|
|
590
|
+
"workspacePicker.search": "Rechercher des projets",
|
|
591
|
+
"workspacePicker.list": "Projets",
|
|
592
|
+
"workspacePicker.new": "Nouveau projet",
|
|
593
|
+
"workspacePicker.empty": "Aucun projet correspondant",
|
|
594
|
+
"workspacePicker.noProjects": "Pas encore de projet",
|
|
595
|
+
"workspacePicker.loading": "Chargement des projets…",
|
|
596
|
+
"workspacePicker.createFailed": "Impossible de créer le projet : ",
|
|
597
|
+
"workspacePicker.defaultName": "Espace de travail par défaut",
|
|
574
598
|
"home.draft": "Votre brouillon actuel et vos pièces jointes sont conservés. Effacez la saisie pour utiliser une suggestion.",
|
|
575
599
|
"home.explore": "Explorer et comprendre le code",
|
|
576
600
|
"home.explore.prompt1": "Explorez le code de cet espace de travail et expliquez la structure du projet, les points d'entrée principaux et les relations entre modules.",
|
|
@@ -800,6 +824,14 @@ const de = {
|
|
|
800
824
|
"home.build.task1": "Eine neue Funktion implementieren",
|
|
801
825
|
"home.build.task2": "Ein kleines Tool erstellen",
|
|
802
826
|
"home.busy": "Die Eingabe wird derzeit verarbeitet. Bitte versuchen Sie es in Kürze erneut.",
|
|
827
|
+
"workspacePicker.search": "Projekte suchen",
|
|
828
|
+
"workspacePicker.list": "Projekte",
|
|
829
|
+
"workspacePicker.new": "Neues Projekt",
|
|
830
|
+
"workspacePicker.empty": "Keine passenden Projekte",
|
|
831
|
+
"workspacePicker.noProjects": "Noch keine Projekte",
|
|
832
|
+
"workspacePicker.loading": "Projekte werden geladen…",
|
|
833
|
+
"workspacePicker.createFailed": "Projekt konnte nicht erstellt werden: ",
|
|
834
|
+
"workspacePicker.defaultName": "Standard-Arbeitsbereich",
|
|
803
835
|
"home.draft": "Ihr aktueller Entwurf und Ihre Anhänge bleiben erhalten. Löschen Sie die Eingabe, um einen Aufgabenvorschlag zu verwenden.",
|
|
804
836
|
"home.explore": "Code untersuchen und verstehen",
|
|
805
837
|
"home.explore.prompt1": "Erkunden Sie den Code dieses Arbeitsbereichs und erklären Sie die Projektstruktur, die Haupteinstiegspunkte und die Modulbeziehungen.",
|
|
@@ -1029,6 +1061,14 @@ const ru = {
|
|
|
1029
1061
|
"home.build.task1": "Реализовать новую функцию",
|
|
1030
1062
|
"home.build.task2": "Создать небольшую утилиту",
|
|
1031
1063
|
"home.busy": "Ввод в данный момент обрабатывается. Пожалуйста, повторите попытку позже.",
|
|
1064
|
+
"workspacePicker.search": "Поиск проектов",
|
|
1065
|
+
"workspacePicker.list": "Проекты",
|
|
1066
|
+
"workspacePicker.new": "Новый проект",
|
|
1067
|
+
"workspacePicker.empty": "Нет подходящих проектов",
|
|
1068
|
+
"workspacePicker.noProjects": "Проектов пока нет",
|
|
1069
|
+
"workspacePicker.loading": "Загрузка проектов…",
|
|
1070
|
+
"workspacePicker.createFailed": "Не удалось создать проект: ",
|
|
1071
|
+
"workspacePicker.defaultName": "Рабочая область по умолчанию",
|
|
1032
1072
|
"home.draft": "Текущий черновик и вложения сохранены. Очистите ввод, чтобы использовать предложение задачи.",
|
|
1033
1073
|
"home.explore": "Исследовать и понять код",
|
|
1034
1074
|
"home.explore.prompt1": "Изучите код этой рабочей области и объясните структуру проекта, основные точки входа и связи между модулями.",
|
|
@@ -1258,6 +1298,14 @@ const pt = {
|
|
|
1258
1298
|
"home.build.task1": "Implementar um novo recurso",
|
|
1259
1299
|
"home.build.task2": "Criar uma pequena ferramenta",
|
|
1260
1300
|
"home.busy": "A entrada está sendo processada no momento. Tente novamente em breve.",
|
|
1301
|
+
"workspacePicker.search": "Buscar projetos",
|
|
1302
|
+
"workspacePicker.list": "Projetos",
|
|
1303
|
+
"workspacePicker.new": "Novo projeto",
|
|
1304
|
+
"workspacePicker.empty": "Nenhum projeto correspondente",
|
|
1305
|
+
"workspacePicker.noProjects": "Ainda não há projetos",
|
|
1306
|
+
"workspacePicker.loading": "Carregando projetos…",
|
|
1307
|
+
"workspacePicker.createFailed": "Não foi possível criar o projeto: ",
|
|
1308
|
+
"workspacePicker.defaultName": "Área de trabalho padrão",
|
|
1261
1309
|
"home.draft": "Seu rascunho atual e anexos foram preservados. Limpe a entrada para usar uma sugestão.",
|
|
1262
1310
|
"home.explore": "Explorar e entender o código",
|
|
1263
1311
|
"home.explore.prompt1": "Explore o código deste espaço de trabalho e explique a estrutura do projeto, os principais pontos de entrada e as relações entre módulos.",
|
|
@@ -1379,6 +1427,14 @@ const zh = {
|
|
|
1379
1427
|
"home.workspace": "请先选择工作区,再选择任务。",
|
|
1380
1428
|
"home.draft": "已保留当前草稿和附件;清空输入后可填入任务建议。",
|
|
1381
1429
|
"home.busy": "当前输入正在处理中,请稍后再试。",
|
|
1430
|
+
"workspacePicker.search": "搜索项目",
|
|
1431
|
+
"workspacePicker.list": "项目列表",
|
|
1432
|
+
"workspacePicker.new": "新建项目",
|
|
1433
|
+
"workspacePicker.empty": "没有匹配的项目",
|
|
1434
|
+
"workspacePicker.noProjects": "还没有项目",
|
|
1435
|
+
"workspacePicker.loading": "正在加载项目…",
|
|
1436
|
+
"workspacePicker.createFailed": "新建项目失败:",
|
|
1437
|
+
"workspacePicker.defaultName": "默认工作区",
|
|
1382
1438
|
"home.explore": "探索并理解代码",
|
|
1383
1439
|
"home.build": "构建新功能、应用或工具",
|
|
1384
1440
|
"home.review": "审查代码并提出修改建议",
|
|
@@ -1606,6 +1662,14 @@ const en = {
|
|
|
1606
1662
|
"home.workspace": "Choose a workspace first, then select a task.",
|
|
1607
1663
|
"home.draft": "Your draft and attachments are preserved. Clear the input to use a suggestion.",
|
|
1608
1664
|
"home.busy": "The input is busy. Please try again shortly.",
|
|
1665
|
+
"workspacePicker.search": "Search projects",
|
|
1666
|
+
"workspacePicker.list": "Projects",
|
|
1667
|
+
"workspacePicker.new": "New project",
|
|
1668
|
+
"workspacePicker.empty": "No matching projects",
|
|
1669
|
+
"workspacePicker.noProjects": "No projects yet",
|
|
1670
|
+
"workspacePicker.loading": "Loading projects…",
|
|
1671
|
+
"workspacePicker.createFailed": "Could not create project: ",
|
|
1672
|
+
"workspacePicker.defaultName": "Default workspace",
|
|
1609
1673
|
"home.explore": "Explore and understand code",
|
|
1610
1674
|
"home.build": "Build features, apps, or tools",
|
|
1611
1675
|
"home.review": "Review code and suggest changes",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-codex-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "DSH Codex UI — 为 DeepSeek Harness 提供极速历史召回、全屏设置皮肤、原生物理毛玻璃换肤、模块化侧栏与桌面原生窗口菜单 · Input enhancement, settings skin, native glass theme, modular sidebar, and desktop titlebar menu for DSH",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|