@michengai/dsh-codex-ui 2.2.7 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -324,7 +324,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card {
324
324
  },
325
325
  {
326
326
  attribute: "data-dsh-glass-details",
327
- selector: "[class*=\"rightbarCol\"] [data-sidebar-right-panel], [class*=\"detailsCol\"] [class*=\"root\"]",
327
+ selector: "[class*=\"rightbarCol\"] [data-sidebar-right-panel]",
328
328
  first: true
329
329
  },
330
330
  {
@@ -5749,6 +5749,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5749
5749
  "home.build.task1": "新しい機能を実装する",
5750
5750
  "home.build.task2": "小さなツールを作成する",
5751
5751
  "home.busy": "現在入力の処理中です。しばらくしてからもう一度お試しください。",
5752
+ "workspacePicker.search": "プロジェクトを検索",
5753
+ "workspacePicker.list": "プロジェクト一覧",
5754
+ "workspacePicker.new": "新しいプロジェクト",
5755
+ "workspacePicker.empty": "一致するプロジェクトがありません",
5756
+ "workspacePicker.noProjects": "プロジェクトがまだありません",
5757
+ "workspacePicker.loading": "プロジェクトを読み込み中…",
5758
+ "workspacePicker.createFailed": "プロジェクトの作成に失敗しました:",
5759
+ "workspacePicker.defaultName": "デフォルトのワークスペース",
5752
5760
  "home.draft": "現在のドラフトと添付ファイルは保持されています。タスクの提案を使用するには入力をクリアしてください。",
5753
5761
  "home.explore": "コードを探索して理解する",
5754
5762
  "home.explore.prompt1": "現在のワークスペースのコードを探索し、プロジェクト構造、主要なエントリポイント、モジュール間の関係を説明してください。",
@@ -5978,6 +5986,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5978
5986
  "home.build.task1": "Implementar una nueva función",
5979
5987
  "home.build.task2": "Crear una pequeña herramienta",
5980
5988
  "home.busy": "La entrada se está procesando actualmente. Vuelva a intentarlo en breve.",
5989
+ "workspacePicker.search": "Buscar proyectos",
5990
+ "workspacePicker.list": "Proyectos",
5991
+ "workspacePicker.new": "Nuevo proyecto",
5992
+ "workspacePicker.empty": "No hay proyectos coincidentes",
5993
+ "workspacePicker.noProjects": "Aún no hay proyectos",
5994
+ "workspacePicker.loading": "Cargando proyectos…",
5995
+ "workspacePicker.createFailed": "No se pudo crear el proyecto: ",
5996
+ "workspacePicker.defaultName": "Espacio de trabajo predeterminado",
5981
5997
  "home.draft": "Se conservan el borrador actual y los adjuntos. Limpie la entrada para usar una sugerencia.",
5982
5998
  "home.explore": "Explorar y comprender el código",
5983
5999
  "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 +6223,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6207
6223
  "home.build.task1": "Implémenter une nouvelle fonctionnalité",
6208
6224
  "home.build.task2": "Créer un petit outil",
6209
6225
  "home.busy": "La saisie est en cours de traitement. Veuillez réessayer sous peu.",
6226
+ "workspacePicker.search": "Rechercher des projets",
6227
+ "workspacePicker.list": "Projets",
6228
+ "workspacePicker.new": "Nouveau projet",
6229
+ "workspacePicker.empty": "Aucun projet correspondant",
6230
+ "workspacePicker.noProjects": "Pas encore de projet",
6231
+ "workspacePicker.loading": "Chargement des projets…",
6232
+ "workspacePicker.createFailed": "Impossible de créer le projet : ",
6233
+ "workspacePicker.defaultName": "Espace de travail par défaut",
6210
6234
  "home.draft": "Votre brouillon actuel et vos pièces jointes sont conservés. Effacez la saisie pour utiliser une suggestion.",
6211
6235
  "home.explore": "Explorer et comprendre le code",
6212
6236
  "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 +6460,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6436
6460
  "home.build.task1": "Eine neue Funktion implementieren",
6437
6461
  "home.build.task2": "Ein kleines Tool erstellen",
6438
6462
  "home.busy": "Die Eingabe wird derzeit verarbeitet. Bitte versuchen Sie es in Kürze erneut.",
6463
+ "workspacePicker.search": "Projekte suchen",
6464
+ "workspacePicker.list": "Projekte",
6465
+ "workspacePicker.new": "Neues Projekt",
6466
+ "workspacePicker.empty": "Keine passenden Projekte",
6467
+ "workspacePicker.noProjects": "Noch keine Projekte",
6468
+ "workspacePicker.loading": "Projekte werden geladen…",
6469
+ "workspacePicker.createFailed": "Projekt konnte nicht erstellt werden: ",
6470
+ "workspacePicker.defaultName": "Standard-Arbeitsbereich",
6439
6471
  "home.draft": "Ihr aktueller Entwurf und Ihre Anhänge bleiben erhalten. Löschen Sie die Eingabe, um einen Aufgabenvorschlag zu verwenden.",
6440
6472
  "home.explore": "Code untersuchen und verstehen",
6441
6473
  "home.explore.prompt1": "Erkunden Sie den Code dieses Arbeitsbereichs und erklären Sie die Projektstruktur, die Haupteinstiegspunkte und die Modulbeziehungen.",
@@ -6665,6 +6697,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6665
6697
  "home.build.task1": "Реализовать новую функцию",
6666
6698
  "home.build.task2": "Создать небольшую утилиту",
6667
6699
  "home.busy": "Ввод в данный момент обрабатывается. Пожалуйста, повторите попытку позже.",
6700
+ "workspacePicker.search": "Поиск проектов",
6701
+ "workspacePicker.list": "Проекты",
6702
+ "workspacePicker.new": "Новый проект",
6703
+ "workspacePicker.empty": "Нет подходящих проектов",
6704
+ "workspacePicker.noProjects": "Проектов пока нет",
6705
+ "workspacePicker.loading": "Загрузка проектов…",
6706
+ "workspacePicker.createFailed": "Не удалось создать проект: ",
6707
+ "workspacePicker.defaultName": "Рабочая область по умолчанию",
6668
6708
  "home.draft": "Текущий черновик и вложения сохранены. Очистите ввод, чтобы использовать предложение задачи.",
6669
6709
  "home.explore": "Исследовать и понять код",
6670
6710
  "home.explore.prompt1": "Изучите код этой рабочей области и объясните структуру проекта, основные точки входа и связи между модулями.",
@@ -6894,6 +6934,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
6894
6934
  "home.build.task1": "Implementar um novo recurso",
6895
6935
  "home.build.task2": "Criar uma pequena ferramenta",
6896
6936
  "home.busy": "A entrada está sendo processada no momento. Tente novamente em breve.",
6937
+ "workspacePicker.search": "Buscar projetos",
6938
+ "workspacePicker.list": "Projetos",
6939
+ "workspacePicker.new": "Novo projeto",
6940
+ "workspacePicker.empty": "Nenhum projeto correspondente",
6941
+ "workspacePicker.noProjects": "Ainda não há projetos",
6942
+ "workspacePicker.loading": "Carregando projetos…",
6943
+ "workspacePicker.createFailed": "Não foi possível criar o projeto: ",
6944
+ "workspacePicker.defaultName": "Área de trabalho padrão",
6897
6945
  "home.draft": "Seu rascunho atual e anexos foram preservados. Limpe a entrada para usar uma sugestão.",
6898
6946
  "home.explore": "Explorar e entender o código",
6899
6947
  "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 +7065,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
7017
7065
  "home.workspace": "请先选择工作区,再选择任务。",
7018
7066
  "home.draft": "已保留当前草稿和附件;清空输入后可填入任务建议。",
7019
7067
  "home.busy": "当前输入正在处理中,请稍后再试。",
7068
+ "workspacePicker.search": "搜索项目",
7069
+ "workspacePicker.list": "项目列表",
7070
+ "workspacePicker.new": "新建项目",
7071
+ "workspacePicker.empty": "没有匹配的项目",
7072
+ "workspacePicker.noProjects": "还没有项目",
7073
+ "workspacePicker.loading": "正在加载项目…",
7074
+ "workspacePicker.createFailed": "新建项目失败:",
7075
+ "workspacePicker.defaultName": "默认工作区",
7020
7076
  "home.explore": "探索并理解代码",
7021
7077
  "home.build": "构建新功能、应用或工具",
7022
7078
  "home.review": "审查代码并提出修改建议",
@@ -7244,6 +7300,14 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
7244
7300
  "home.workspace": "Choose a workspace first, then select a task.",
7245
7301
  "home.draft": "Your draft and attachments are preserved. Clear the input to use a suggestion.",
7246
7302
  "home.busy": "The input is busy. Please try again shortly.",
7303
+ "workspacePicker.search": "Search projects",
7304
+ "workspacePicker.list": "Projects",
7305
+ "workspacePicker.new": "New project",
7306
+ "workspacePicker.empty": "No matching projects",
7307
+ "workspacePicker.noProjects": "No projects yet",
7308
+ "workspacePicker.loading": "Loading projects…",
7309
+ "workspacePicker.createFailed": "Could not create project: ",
7310
+ "workspacePicker.defaultName": "Default workspace",
7247
7311
  "home.explore": "Explore and understand code",
7248
7312
  "home.build": "Build features, apps, or tools",
7249
7313
  "home.review": "Review code and suggest changes",
@@ -8045,21 +8109,12 @@ html[data-platform="darwin"]:not([data-fullscreen]) [data-shortcut-modal="settin
8045
8109
  background: var(--dsw-alias-bg-layer-2, #18181b) !important;
8046
8110
  }
8047
8111
 
8048
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
8049
- background: var(--dsw-alias-bg-layer-2, #18181b) !important;
8050
- }
8051
-
8052
8112
  /* 浅色模式全局兜底:浅底高对比度规范,绝不允许残留或回退暗黑色 */
8053
8113
  body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"],
8054
8114
  html[data-ds-theme-source="light"] [data-shortcut-modal="settings"] {
8055
8115
  background: var(--dsw-alias-bg-base, var(--dsw-static-neutral-bluish-00, #ffffff)) !important;
8056
8116
  }
8057
8117
 
8058
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav),
8059
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
8060
- background: var(--dsw-alias-bg-layer-1, var(--dsw-static-neutral-bluish-00, #ffffff)) !important;
8061
- }
8062
-
8063
8118
  /* 玻璃质感/原版兼容排版模式(Compat) */
8064
8119
  html[data-dsh-glass]:not([data-dsh-glass-float]) [data-shortcut-modal="settings"] {
8065
8120
  background: var(--dsw-alias-bg-base, #151517) !important;
@@ -8068,7 +8123,7 @@ html[data-dsh-glass]:not([data-dsh-glass-float]) [data-shortcut-modal="settings"
8068
8123
  }
8069
8124
 
8070
8125
  html[data-dsh-glass]:not([data-dsh-glass-float]) [data-shortcut-modal="settings"] > nav,
8071
- html[data-dsh-glass]:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="navTitle"] {
8126
+ html[data-dsh-glass]:not([data-dsh-glass-float]) [data-shortcut-modal="settings"] > [class*="navTitle"] {
8072
8127
  background: color-mix(
8073
8128
  in srgb,
8074
8129
  var(--dsw-specific-sidebar-fill, #181825) 85%,
@@ -8080,12 +8135,6 @@ html[data-dsh-glass]:not([data-dsh-glass-float]) [data-shortcut-modal="settings"
8080
8135
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05) !important;
8081
8136
  }
8082
8137
 
8083
- html[data-dsh-glass]:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
8084
- background: var(--dsw-alias-bg-base, #151517) !important;
8085
- backdrop-filter: none !important;
8086
- -webkit-backdrop-filter: none !important;
8087
- }
8088
-
8089
8138
  /* 云母悬浮模式(Mica Mode):设置面板全面升华为与首页一致的悬浮双岛体系 */
8090
8139
  html[data-dsh-glass-float] body > [role="presentation"]:has(> [data-shortcut-modal="settings"]) {
8091
8140
  background-color: transparent !important;
@@ -8111,57 +8160,12 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"] {
8111
8160
  -webkit-backdrop-filter: none !important;
8112
8161
  }
8113
8162
 
8114
- /* 左侧导航悬浮岛:与首页侧边栏严格对齐几何形态、12px外边距、16px圆角与微高光 */
8115
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav {
8116
- box-sizing: border-box !important;
8117
- width: calc(var(--dcu-settings-nav-width, 280px) - 24px) !important;
8118
- min-width: calc(var(--dcu-settings-nav-width, 280px) - 24px) !important;
8119
- max-width: calc(var(--dcu-settings-nav-width, 280px) - 24px) !important;
8120
- margin: 8px 12px 12px 12px !important;
8121
- height: calc(100% - 20px) !important;
8122
- max-height: calc(100% - 20px) !important;
8123
- border-radius: 16px !important;
8124
- border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
8125
- box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
8126
- background: var(--dsw-alias-bg-layer-2, var(--dsh-glass-card, #18181b)) !important;
8127
- backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
8128
- -webkit-backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
8129
- overflow: hidden !important;
8130
- }
8131
-
8132
- /* 右侧工作台悬浮岛:独立大圆角卡片,浅色为纯净微光白,深色为深邃灰,与首页悬浮实体完全一致 */
8133
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
8134
- margin: 8px 12px 12px 0 !important;
8135
- height: calc(100% - 20px) !important;
8136
- max-height: calc(100% - 20px) !important;
8137
- border-radius: 16px !important;
8138
- border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
8139
- box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
8140
- background: var(--dsw-alias-bg-layer-2, var(--dsw-alias-bg-layer-1, #18181b)) !important;
8141
- backdrop-filter: none !important;
8142
- -webkit-backdrop-filter: none !important;
8143
- overflow: hidden !important;
8144
- }
8145
-
8146
- /* 云母模式下收敛顶部工具栏与内容区 padding,消除脱节大空隙 */
8147
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child {
8148
- height: 48px !important;
8149
- min-height: 48px !important;
8150
- padding: 0 24px !important;
8151
- background: var(--dsw-alias-bg-layer-2, var(--dsw-alias-bg-layer-1, #18181b)) !important;
8152
- }
8153
-
8154
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) {
8155
- padding: 16px 32px 48px !important;
8156
- background: var(--dsw-alias-bg-layer-2, var(--dsw-alias-bg-layer-1, #18181b)) !important;
8157
- }
8158
-
8159
8163
  html[data-platform="darwin"] [data-shortcut-modal="settings"] > nav {
8160
8164
  background: var(--dsw-specific-sidebar-fill, transparent) !important;
8161
8165
  }
8162
8166
 
8163
8167
  /* 顶部标题与搜索区插槽容器 */
8164
- [data-shortcut-modal="settings"] > nav > :first-child {
8168
+ [data-shortcut-modal="settings"] > [class*="navTitle"] {
8165
8169
  padding: 0 !important;
8166
8170
  display: flex !important;
8167
8171
  flex-direction: column !important;
@@ -8276,8 +8280,7 @@ button.dcu-settings-back-btn:hover,
8276
8280
  }
8277
8281
 
8278
8282
  /* 导航项列表容器 */
8279
- [data-shortcut-modal="settings"] > nav [class*="navList"],
8280
- [data-shortcut-modal="settings"] > nav > :nth-child(2) {
8283
+ [data-shortcut-modal="settings"] > nav [class*="navList"] {
8281
8284
  display: flex !important;
8282
8285
  flex-direction: column !important;
8283
8286
  gap: 2px !important;
@@ -8380,116 +8383,7 @@ button.dcu-settings-back-btn:hover,
8380
8383
  outline-offset: 1px !important;
8381
8384
  }
8382
8385
 
8383
- /* 右侧内容工作区 */
8384
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
8385
- display: flex !important;
8386
- min-width: 0 !important;
8387
- flex: 1 1 auto !important;
8388
- flex-direction: column !important;
8389
- background: var(--dsw-alias-bg-layer-2, #18181b) !important;
8390
- height: 100% !important;
8391
- }
8392
-
8393
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child {
8394
- box-sizing: border-box !important;
8395
- height: 56px !important;
8396
- min-height: 56px !important;
8397
- padding: 0 32px !important;
8398
- border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(255, 255, 255, 0.07)) !important;
8399
- display: flex !important;
8400
- align-items: center !important;
8401
- justify-content: space-between !important;
8402
- background: var(--dsw-alias-bg-layer-2, #18181b) !important;
8403
- }
8404
-
8405
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child h2,
8406
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child span {
8407
- font-size: 16px;
8408
- font-weight: 600;
8409
- color: var(--dsw-alias-label-primary, #f4f4f5) !important;
8410
- letter-spacing: -0.01em;
8411
- }
8412
-
8413
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child button,
8414
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child a {
8415
- color: var(--dsw-alias-label-secondary, #a1a1aa) !important;
8416
- transition: color 0.15s ease;
8417
- }
8418
-
8419
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child button:hover,
8420
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child a:hover {
8421
- color: var(--dsw-alias-label-primary, #f4f4f5) !important;
8422
- }
8423
-
8424
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) {
8425
- box-sizing: border-box !important;
8426
- min-height: 0 !important;
8427
- flex: 1 1 auto !important;
8428
- overflow-y: auto !important;
8429
- padding: 24px 32px 48px !important;
8430
- background: var(--dsw-alias-bg-layer-2, #18181b) !important;
8431
- display: flex !important;
8432
- flex-direction: column !important;
8433
- align-items: stretch !important;
8434
- }
8435
-
8436
- /* 浅色模式右侧内容区实色与文字按钮高对比度兜底 */
8437
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child,
8438
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child {
8439
- background: var(--dsw-alias-bg-layer-1, #ffffff) !important;
8440
- border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08)) !important;
8441
- }
8442
-
8443
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child h2,
8444
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child span,
8445
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child h2,
8446
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child span {
8447
- color: var(--dsw-alias-label-primary, #18181b) !important;
8448
- }
8449
-
8450
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child button,
8451
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child a,
8452
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child button,
8453
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child a {
8454
- color: var(--dsw-alias-label-secondary, #52525b) !important;
8455
- }
8456
-
8457
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child button:hover,
8458
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child a:hover,
8459
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child button:hover,
8460
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child a:hover {
8461
- color: var(--dsw-alias-label-primary, #18181b) !important;
8462
- }
8463
-
8464
- body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2),
8465
- html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) {
8466
- background: var(--dsw-alias-bg-layer-1, #ffffff) !important;
8467
- }
8468
-
8469
- /* 右侧设置区固定宽度规范:卡片先吃满列宽、再被 800px 夹住,左右留白相等(不会出现单侧空洞)。
8470
- 实测(scripts/verify-settings-geometry.mjs,1400px 面板):卡片宽 800px、左右各 260px —
8471
- 即「居中收束」而不是贴左;若要改成贴左,需同时去掉下面的 margin-inline: auto。 */
8472
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) > * {
8473
- width: 100% !important;
8474
- max-width: 800px !important;
8475
- margin-inline: auto !important;
8476
- box-sizing: border-box !important;
8477
- }
8478
-
8479
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) > * > * {
8480
- width: 100% !important;
8481
- max-width: 800px !important;
8482
- margin-inline: auto !important;
8483
- box-sizing: border-box !important;
8484
- }
8485
-
8486
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) [class*="section"] {
8487
- width: 100% !important;
8488
- max-width: 800px !important;
8489
- margin-inline: auto !important;
8490
- }
8491
-
8492
- /* 新版宿主平铺 4 块 Grid 布局映射(0.2.1-alpha.3+),杜绝 4 列横向撕裂与多余空条 */
8386
+ /* 宿主平铺 4 块 Grid 布局映射,杜绝 4 列横向撕裂与多余空条 */
8493
8387
  [data-shortcut-modal="settings"]:has(> [class*="options"]) {
8494
8388
  display: grid !important;
8495
8389
  grid-template-columns: var(--dcu-settings-nav-width, 280px) minmax(0, 1fr) !important;
@@ -8767,41 +8661,6 @@ html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-c
8767
8661
  gap: 0 !important;
8768
8662
  }
8769
8663
 
8770
- html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) {
8771
- margin: 0 !important;
8772
- border-radius: 0 !important;
8773
- border: none !important;
8774
- box-shadow: none !important;
8775
- background: var(--dsw-alias-bg-base, #151517) !important;
8776
- height: 100% !important;
8777
- max-height: 100% !important;
8778
- overflow: hidden !important;
8779
- display: flex !important;
8780
- flex-direction: column !important;
8781
- }
8782
-
8783
- html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) > :first-child {
8784
- background: transparent !important;
8785
- border: none !important;
8786
- border-bottom: none !important;
8787
- flex: none !important;
8788
- }
8789
-
8790
- html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) {
8791
- margin: 0 !important;
8792
- border-radius: 0 !important;
8793
- border: none !important;
8794
- box-shadow: none !important;
8795
- background: transparent !important;
8796
- overflow-y: auto !important;
8797
- flex: 1 1 auto !important;
8798
- min-height: 0 !important;
8799
- padding-top: 28px !important;
8800
- padding-bottom: 64px !important;
8801
- padding-inline: 48px !important;
8802
- box-sizing: border-box !important;
8803
- }
8804
-
8805
8664
  html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"] {
8806
8665
  margin: 0 !important;
8807
8666
  border-radius: 0 !important;
@@ -8826,8 +8685,6 @@ html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortc
8826
8685
  border-right: 1px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.08)) !important;
8827
8686
  }
8828
8687
 
8829
- html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav),
8830
- html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav),
8831
8688
  html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"],
8832
8689
  html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"] {
8833
8690
  background: var(--dsw-alias-bg-base, #ffffff) !important;
@@ -8860,29 +8717,6 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
8860
8717
  flex: none !important;
8861
8718
  }
8862
8719
 
8863
- html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > nav {
8864
- box-sizing: border-box !important;
8865
- width: 56px !important;
8866
- min-width: 56px !important;
8867
- max-width: 56px !important;
8868
- margin: 8px 12px 12px 12px !important;
8869
- padding: 12px 0 16px !important;
8870
- border-radius: 16px !important;
8871
- border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
8872
- box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
8873
- background: var(--dsh-glass-card, var(--dsw-alias-bg-layer-1)) !important;
8874
- backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
8875
- -webkit-backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
8876
- overflow-y: auto !important;
8877
- overflow-x: hidden !important;
8878
- scrollbar-width: none !important;
8879
- -ms-overflow-style: none !important;
8880
- display: flex !important;
8881
- flex-direction: column !important;
8882
- align-items: center !important;
8883
- gap: 0 !important;
8884
- }
8885
-
8886
8720
  html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > nav {
8887
8721
  grid-column: 1 !important;
8888
8722
  grid-row: 2 !important;
@@ -8911,16 +8745,6 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
8911
8745
  align-items: center !important;
8912
8746
  }
8913
8747
 
8914
- html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) {
8915
- margin: 8px 12px 12px 0 !important;
8916
- border-radius: 16px !important;
8917
- border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
8918
- box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
8919
- background: var(--dsw-alias-bg-layer-1) !important;
8920
- overflow-y: auto !important;
8921
- height: calc(100% - 20px) !important;
8922
- }
8923
-
8924
8748
  html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"] {
8925
8749
  grid-column: 2 !important;
8926
8750
  grid-row: 1 / -1 !important;
@@ -8948,36 +8772,6 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
8948
8772
  height: 0 !important;
8949
8773
  }
8950
8774
 
8951
- /* 旧版嵌套结构下的返回标题栏,平铺 Grid 宿主下不命中了 nav > :first-child,避免把 navList 错误当成标题 */
8952
- [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > nav > :first-child {
8953
- border: none !important;
8954
- border-radius: 0 !important;
8955
- background: transparent !important;
8956
- box-shadow: none !important;
8957
- padding: 0 !important;
8958
- margin: 0 auto 10px auto !important;
8959
- width: 100% !important;
8960
- display: flex !important;
8961
- justify-content: center !important;
8962
- align-items: center !important;
8963
- }
8964
-
8965
- [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > nav [class*="navList"],
8966
- [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > nav > :nth-child(2) {
8967
- border: none !important;
8968
- background: transparent !important;
8969
- box-shadow: none !important;
8970
- margin: 0 !important;
8971
- padding: 0 !important;
8972
- width: 100% !important;
8973
- display: flex !important;
8974
- flex-direction: column !important;
8975
- align-items: center !important;
8976
- gap: 4px !important;
8977
- scrollbar-width: none !important;
8978
- -ms-overflow-style: none !important;
8979
- }
8980
-
8981
8775
  [data-shortcut-modal="settings"][data-sidebar-collapsed] .dcu-settings-nav-header-root,
8982
8776
  [data-shortcut-modal="settings"][data-sidebar-collapsed] .dcu-settings-nav-header-top {
8983
8777
  align-items: center !important;
@@ -9140,16 +8934,6 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9140
8934
  pointer-events: auto !important;
9141
8935
  }
9142
8936
 
9143
- html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:not(:has(> [class*="options"])) > div:not(nav) {
9144
- margin: 8px 12px 12px 0 !important;
9145
- border-radius: 16px !important;
9146
- border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
9147
- box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
9148
- background: var(--dsw-alias-bg-layer-1) !important;
9149
- overflow-y: auto !important;
9150
- height: calc(100% - 20px) !important;
9151
- }
9152
-
9153
8937
  [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"],
9154
8938
  html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collapsed]:has(> [class*="options"]) > [class*="options"] {
9155
8939
  grid-column: 2 !important;
@@ -9265,60 +9049,6 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9265
9049
  flex: none !important;
9266
9050
  }
9267
9051
 
9268
- /* 旧版嵌套宿主在 <=768px 下的 nav 单岛体系,与折叠块完全对齐 */
9269
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav,
9270
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav {
9271
- box-sizing: border-box !important;
9272
- width: 56px !important;
9273
- min-width: 56px !important;
9274
- max-width: 56px !important;
9275
- margin: 8px 12px 12px 12px !important;
9276
- padding: 12px 0 16px !important;
9277
- border-radius: 16px !important;
9278
- border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
9279
- box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
9280
- background: var(--dsh-glass-card, var(--dsw-alias-bg-layer-1)) !important;
9281
- backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
9282
- -webkit-backdrop-filter: blur(var(--dsh-glass-blur, 16px)) !important;
9283
- overflow-y: auto !important;
9284
- overflow-x: hidden !important;
9285
- scrollbar-width: none !important;
9286
- -ms-overflow-style: none !important;
9287
- display: flex !important;
9288
- flex-direction: column !important;
9289
- align-items: center !important;
9290
- gap: 0 !important;
9291
- }
9292
-
9293
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav > :first-child {
9294
- border: none !important;
9295
- border-radius: 0 !important;
9296
- background: transparent !important;
9297
- box-shadow: none !important;
9298
- padding: 0 !important;
9299
- margin: 0 auto 10px auto !important;
9300
- width: 100% !important;
9301
- display: flex !important;
9302
- justify-content: center !important;
9303
- align-items: center !important;
9304
- }
9305
-
9306
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav [class*="navList"],
9307
- [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav > :nth-child(2) {
9308
- border: none !important;
9309
- background: transparent !important;
9310
- box-shadow: none !important;
9311
- margin: 0 !important;
9312
- padding: 0 !important;
9313
- width: 100% !important;
9314
- display: flex !important;
9315
- flex-direction: column !important;
9316
- align-items: center !important;
9317
- gap: 4px !important;
9318
- scrollbar-width: none !important;
9319
- -ms-overflow-style: none !important;
9320
- }
9321
-
9322
9052
  .dcu-settings-nav-header-root {
9323
9053
  align-items: center !important;
9324
9054
  justify-content: center !important;
@@ -9370,9 +9100,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9370
9100
  align-items: center !important;
9371
9101
  }
9372
9102
 
9373
- html[data-dsh-glass-float] [data-shortcut-modal="settings"] > nav,
9374
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="options"]) > nav,
9375
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > nav {
9103
+ html[data-dsh-glass-float] [data-shortcut-modal="settings"] > nav {
9376
9104
  grid-column: 1 !important;
9377
9105
  grid-row: 2 !important;
9378
9106
  box-sizing: border-box !important;
@@ -9458,42 +9186,6 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9458
9186
  pointer-events: auto !important;
9459
9187
  }
9460
9188
 
9461
- html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
9462
- margin: 0 !important;
9463
- border-radius: 0 !important;
9464
- border: none !important;
9465
- box-shadow: none !important;
9466
- background: var(--dsw-alias-bg-base, #151517) !important;
9467
- height: 100% !important;
9468
- max-height: 100% !important;
9469
- overflow: hidden !important;
9470
- display: flex !important;
9471
- flex-direction: column !important;
9472
- }
9473
-
9474
- html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :first-child {
9475
- background: transparent !important;
9476
- border: none !important;
9477
- border-bottom: none !important;
9478
- flex: none !important;
9479
- }
9480
-
9481
- /* 右侧设置内容区:普通模式平铺紧贴,云母模式下复刻首页右侧 16px 圆角大卡片独立悬浮岛 */
9482
- html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) > :nth-child(2) {
9483
- margin: 0 !important;
9484
- border-radius: 0 !important;
9485
- border: none !important;
9486
- box-shadow: none !important;
9487
- background: transparent !important;
9488
- overflow-y: auto !important;
9489
- flex: 1 1 auto !important;
9490
- min-height: 0 !important;
9491
- padding-top: 28px !important;
9492
- padding-bottom: 40px !important;
9493
- padding-inline: 20px !important;
9494
- box-sizing: border-box !important;
9495
- }
9496
-
9497
9189
  html:not([data-dsh-glass-float]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"] {
9498
9190
  margin: 0 !important;
9499
9191
  border-radius: 0 !important;
@@ -9509,23 +9201,11 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9509
9201
  box-sizing: border-box !important;
9510
9202
  }
9511
9203
 
9512
- html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav),
9513
- html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav),
9514
9204
  html:not([data-dsh-glass-float]) body:not([data-ds-dark-theme]) [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"],
9515
9205
  html:not([data-dsh-glass-float]) html[data-ds-theme-source="light"] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"] {
9516
9206
  background: var(--dsw-alias-bg-base, #ffffff) !important;
9517
9207
  }
9518
9208
 
9519
- html[data-dsh-glass-float] [data-shortcut-modal="settings"]:not(:has(> [class*="options"])) > div:not(nav) {
9520
- margin: 8px 12px 12px 0 !important;
9521
- border-radius: 16px !important;
9522
- border: 1px solid var(--dsh-glass-rim-soft, rgba(0, 0, 0, 0.08)) !important;
9523
- box-shadow: var(--dsh-glass-drop, 0 8px 24px rgba(0, 0, 0, 0.08)), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
9524
- background: var(--dsw-alias-bg-layer-1) !important;
9525
- overflow-y: auto !important;
9526
- height: calc(100% - 20px) !important;
9527
- }
9528
-
9529
9209
  [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"],
9530
9210
  html[data-dsh-glass-float] [data-shortcut-modal="settings"]:has(> [class*="options"]) > [class*="options"] {
9531
9211
  grid-column: 2 !important;
@@ -9919,8 +9599,8 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
9919
9599
  const sidebarWidth = getHostSidebarExpandedWidth(panelEl.ownerDocument || document);
9920
9600
  panelEl.style.setProperty("--dcu-settings-nav-width", `${sidebarWidth}px`);
9921
9601
  }
9922
- const navHeader = panelEl.querySelector(":scope > [class*=\"navTitle\"]") ?? panelEl.querySelector("nav > :first-child");
9923
- const navList = panelEl.querySelector("nav [class*=\"navList\"]") ?? panelEl.querySelector("nav > :nth-child(2)") ?? panelEl.querySelector("nav > :first-child");
9602
+ const navHeader = panelEl.querySelector(":scope > [class*=\"navTitle\"]");
9603
+ const navList = panelEl.querySelector("nav [class*=\"navList\"]");
9924
9604
  if (!navList) return () => {};
9925
9605
  const doc = panelEl.ownerDocument;
9926
9606
  const phone = doc.defaultView?.matchMedia?.(MOBILE_SETTINGS_QUERY);
@@ -10314,7 +9994,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10314
9994
  };
10315
9995
  //#endregion
10316
9996
  //#region src/client/composer/draft-attachments.ts
10317
- /** 统一旧版图片草稿与 0.1.5 的通用附件草稿,保护已有附件不被历史召回覆盖。 */
9997
+ /** 检查通用附件草稿,保护已有附件不被历史召回覆盖。 */
10318
9998
  function hasDraftAttachments(state) {
10319
9999
  return (state.attachmentIds?.length ?? 0) > 0 || (state.imageIds?.length ?? 0) > 0;
10320
10000
  }
@@ -10512,6 +10192,519 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
10512
10192
  unregisterHint();
10513
10193
  };
10514
10194
  }
10195
+ //#endregion
10196
+ //#region src/client/composer/WorkspacePickerCodex.tsx
10197
+ /** 浮层宽度(对齐参考截图里的 Codex 项目选择器),也是定位计算的钳制依据。 */
10198
+ const PANEL_WIDTH = 266;
10199
+ /** 浮层的最大可能高度,用于打开时判断向下展开是否放得下。 */
10200
+ const POPOVER_MAX_HEIGHT = 312;
10201
+ /**
10202
+ * 宿主首次初始化的工作区自动标题。宿主展示逻辑在
10203
+ * `dsh-api-workspace-controller/default-workspace` 的 `workspaceDisplayTitle`,
10204
+ * 该子路径未列入本包 peer 依赖,故此处按同一 sentinel 本地判定。
10205
+ */
10206
+ const DEFAULT_WORKSPACE_TITLE = "default-workspace";
10207
+ /** 创建一个初始开放的能力闸门。 */
10208
+ function createCreateGate() {
10209
+ let open = true;
10210
+ const listeners = /* @__PURE__ */ new Set();
10211
+ return {
10212
+ getSnapshot: () => open,
10213
+ subscribe: (listener) => {
10214
+ listeners.add(listener);
10215
+ return () => {
10216
+ listeners.delete(listener);
10217
+ };
10218
+ },
10219
+ close: () => {
10220
+ if (!open) return;
10221
+ open = false;
10222
+ for (const listener of listeners) listener();
10223
+ }
10224
+ };
10225
+ }
10226
+ /**
10227
+ * 组装「新建项目」的目录选择入口。
10228
+ *
10229
+ * browse 后端(远程 Peer、SSH 启动、非 loopback 绑定)以
10230
+ * `directory-picker/unavailable` 拒绝:此时永久关闭闸门并返回 null,
10231
+ * 让「新建项目」入口消失,而不是在界面上留一个点了没反应的假入口。
10232
+ */
10233
+ function createPickDirectory(deps) {
10234
+ return async () => {
10235
+ if (deps.desktopPicker !== void 0) return deps.desktopPicker.pick();
10236
+ const picker = deps.getRemotePicker?.();
10237
+ if (picker === void 0) return deps.fallback();
10238
+ const result = await picker.pick();
10239
+ if (result.ok) return result.value ?? null;
10240
+ if (result.error?.code === "directory-picker/unavailable") {
10241
+ deps.gate.close();
10242
+ return null;
10243
+ }
10244
+ throw new Error(result.error?.message ?? "directory picker failed");
10245
+ };
10246
+ }
10247
+ /** 目录路径的最后一段,作为没有标题时的兜底名称。 */
10248
+ function pathBasename(path) {
10249
+ const parts = path.split(/[\\/]/).filter((part) => part !== "");
10250
+ return parts[parts.length - 1] ?? path;
10251
+ }
10252
+ /** 与宿主 workspaceDisplayTitle 一致:自动标题显示本地化默认名,其余原样。 */
10253
+ function projectName(workspace, defaultName) {
10254
+ const title = workspace.title.trim();
10255
+ if (title === "") return pathBasename(workspace.path);
10256
+ return title === DEFAULT_WORKSPACE_TITLE ? defaultName : title;
10257
+ }
10258
+ /**
10259
+ * 同项目名的 Workspace 各取「最短的唯一尾部路径段」用于区分展示。
10260
+ *
10261
+ * 语义与宿主 `ui-workspace` 的 `distinguishingPathSuffixes` 相同:分段与分隔符
10262
+ * 交替切分,逐段加长直到没有同名项共享同一后缀;名字唯一的项目不产生后缀。
10263
+ * 该模块未通过宿主的包 `exports` 暴露,因此本地保留同一算法。
10264
+ * @param workspaces - 每个项目的 id、展示标题与规范路径。
10265
+ * @returns 按 Workspace id 索引的区分后缀。
10266
+ */
10267
+ function distinguishingPathSuffixes(workspaces) {
10268
+ const rows = workspaces.map((workspace) => ({
10269
+ ...workspace,
10270
+ parts: workspace.path.split(/([\\/])/)
10271
+ }));
10272
+ const suffix = (parts, count) => parts.slice(-(2 * count - 1)).join("");
10273
+ const suffixes = /* @__PURE__ */ new Map();
10274
+ for (const row of rows) {
10275
+ const peers = rows.filter((other) => other !== row && other.title === row.title);
10276
+ if (peers.length === 0) continue;
10277
+ let count = 1;
10278
+ while (2 * count - 1 < row.parts.length && (suffix(row.parts, count) === "" || peers.some((peer) => suffix(peer.parts, count) === suffix(row.parts, count)))) count++;
10279
+ suffixes.set(row.id, suffix(row.parts, count));
10280
+ }
10281
+ return suffixes;
10282
+ }
10283
+ /**
10284
+ * Codex 风格项目选择器:搜索 + 项目列表 + 新建项目。
10285
+ *
10286
+ * 替换宿主 `conversation.hero.workspace` 的单槽默认实现(无搜索的 Menu),
10287
+ * 交互与视觉对齐参考截图;所有数据仍走宿主 Workspace Controller:选择项目
10288
+ * 调用 owner 的 `onPick`,新建项目先选目录再 `createWorkspace`。
10289
+ *
10290
+ * 浮层材质、菜单行与搜索框分别复用宿主原语 `MenuSurface` / `MenuItemButton` /
10291
+ * `Input`,配色与浅色、深色、玻璃主题由宿主令牌负责;本组件只保留锚点定位、
10292
+ * 组合框式搜索过滤与键盘游标(焦点始终留在搜索框)。
10293
+ *
10294
+ * 与宿主默认实现的差异:本条目未声明 `conversation.hero.workspace.directoryFlow`
10295
+ * 子槽(同一子槽只能有一处声明,官方工作区插件已占用),因此「新建项目」走宿主
10296
+ * 目录选择能力,不提供应用内目录浏览。
10297
+ * @param props - 槽位 owner props、本地化函数与注入的目录/创建能力。
10298
+ * @returns 浮层(portal 到 document.body),关闭时为 null。
10299
+ */
10300
+ function CodexWorkspacePicker(props) {
10301
+ const { open, selectedId, anchorRef, onPick, onClose, useWorkspaces, t, pickDirectory, createWorkspace, createGate } = props;
10302
+ const snapshot = useWorkspaces((state) => state);
10303
+ const canCreate = (0, react.useSyncExternalStore)(createGate.subscribe, createGate.getSnapshot, createGate.getSnapshot);
10304
+ const [query, setQuery] = (0, react.useState)("");
10305
+ const [active, setActive] = (0, react.useState)(0);
10306
+ const [busy, setBusy] = (0, react.useState)(false);
10307
+ const [error, setError] = (0, react.useState)(null);
10308
+ const [position, setPosition] = (0, react.useState)({
10309
+ position: "fixed",
10310
+ left: 0,
10311
+ top: 0,
10312
+ visibility: "hidden"
10313
+ });
10314
+ const surfaceRef = (0, react.useRef)(null);
10315
+ const scrollRef = (0, react.useRef)(null);
10316
+ const inputRef = (0, react.useRef)(null);
10317
+ const sideRef = (0, react.useRef)("below");
10318
+ const alive = (0, react.useRef)(true);
10319
+ /** 打开时「聚焦搜索框」那一帧的句柄,关闭时必须取消,否则焦点会被抢回输入框。 */
10320
+ const focusFrameRef = (0, react.useRef)(void 0);
10321
+ const baseId = (0, react.useId)();
10322
+ const listId = `${baseId}-list`;
10323
+ const createId = `${baseId}-create`;
10324
+ const rowIdOf = (0, react.useCallback)((index) => `${baseId}-row-${index}`, [baseId]);
10325
+ (0, react.useEffect)(() => {
10326
+ alive.current = true;
10327
+ return () => {
10328
+ alive.current = false;
10329
+ };
10330
+ }, []);
10331
+ const rows = (0, react.useMemo)(() => {
10332
+ const defaultName = t("workspacePicker.defaultName");
10333
+ const listed = snapshot.items.map((workspace) => ({
10334
+ workspace,
10335
+ label: projectName(workspace, defaultName)
10336
+ }));
10337
+ const suffixes = distinguishingPathSuffixes(listed.map(({ workspace, label }) => ({
10338
+ id: workspace.workspaceId,
10339
+ title: label,
10340
+ path: workspace.path
10341
+ })));
10342
+ const needle = query.trim().toLowerCase();
10343
+ const projects = listed.filter(({ workspace, label }) => needle === "" || label.toLowerCase().includes(needle) || workspace.path.toLowerCase().includes(needle)).map(({ workspace, label }) => ({
10344
+ kind: "project",
10345
+ id: workspace.workspaceId,
10346
+ label,
10347
+ suffix: suffixes.get(workspace.workspaceId),
10348
+ path: workspace.path
10349
+ }));
10350
+ return canCreate ? [...projects, { kind: "create" }] : projects;
10351
+ }, [
10352
+ snapshot.items,
10353
+ query,
10354
+ t,
10355
+ canCreate
10356
+ ]);
10357
+ const projectCount = canCreate ? rows.length - 1 : rows.length;
10358
+ /** 关闭浮层并把焦点还给锚点胶囊,键盘用户不丢失上下文。 */
10359
+ const closeMenu = (0, react.useCallback)(() => {
10360
+ if (focusFrameRef.current !== void 0) {
10361
+ cancelAnimationFrame(focusFrameRef.current);
10362
+ focusFrameRef.current = void 0;
10363
+ }
10364
+ onClose();
10365
+ anchorRef?.current?.focus({ preventScroll: true });
10366
+ }, [onClose, anchorRef]);
10367
+ (0, react.useEffect)(() => {
10368
+ if (!open) return;
10369
+ setQuery("");
10370
+ setActive(0);
10371
+ setError(null);
10372
+ const frame = requestAnimationFrame(() => {
10373
+ focusFrameRef.current = void 0;
10374
+ inputRef.current?.focus();
10375
+ });
10376
+ focusFrameRef.current = frame;
10377
+ return () => {
10378
+ cancelAnimationFrame(frame);
10379
+ if (focusFrameRef.current === frame) focusFrameRef.current = void 0;
10380
+ };
10381
+ }, [open]);
10382
+ (0, react.useEffect)(() => {
10383
+ setActive((current) => current > rows.length - 1 ? Math.max(0, rows.length - 1) : current);
10384
+ }, [rows.length]);
10385
+ (0, react.useEffect)(() => {
10386
+ if (!open) return;
10387
+ const id = active < projectCount ? rowIdOf(active) : canCreate ? createId : void 0;
10388
+ if (id === void 0) return;
10389
+ document.getElementById(id)?.scrollIntoView?.({ block: "nearest" });
10390
+ }, [
10391
+ open,
10392
+ active,
10393
+ projectCount,
10394
+ canCreate,
10395
+ rowIdOf,
10396
+ createId
10397
+ ]);
10398
+ (0, react.useLayoutEffect)(() => {
10399
+ if (!open) return;
10400
+ const syncSide = () => {
10401
+ const rect = anchorRef?.current?.getBoundingClientRect();
10402
+ if (rect === void 0) {
10403
+ sideRef.current = "below";
10404
+ return;
10405
+ }
10406
+ const below = window.innerHeight - rect.bottom;
10407
+ const above = rect.top;
10408
+ sideRef.current = below >= POPOVER_MAX_HEIGHT || below >= above ? "below" : "above";
10409
+ };
10410
+ syncSide();
10411
+ window.addEventListener("resize", syncSide);
10412
+ return () => {
10413
+ window.removeEventListener("resize", syncSide);
10414
+ };
10415
+ }, [open, anchorRef]);
10416
+ (0, react.useLayoutEffect)(() => {
10417
+ if (!open) return;
10418
+ const update = () => {
10419
+ const element = surfaceRef.current;
10420
+ if (element === null) return;
10421
+ const rect = (anchorRef?.current)?.getBoundingClientRect();
10422
+ const width = Math.min(PANEL_WIDTH, window.innerWidth - 16);
10423
+ const height = element.offsetHeight;
10424
+ const anchorLeft = rect?.left ?? 16;
10425
+ const anchorTop = rect?.top ?? window.innerHeight - 88;
10426
+ const anchorBottom = rect?.bottom ?? window.innerHeight - 64;
10427
+ const left = Math.max(8, Math.min(anchorLeft, window.innerWidth - width - 8));
10428
+ const unclamped = sideRef.current === "below" ? anchorBottom + 6 : anchorTop - height - 6;
10429
+ const top = Math.max(8, Math.min(unclamped, window.innerHeight - height - 8));
10430
+ setPosition((current) => current.left === left && current.top === top && current.width === width && current.visibility === "visible" ? current : {
10431
+ position: "fixed",
10432
+ left,
10433
+ top,
10434
+ width,
10435
+ visibility: "visible"
10436
+ });
10437
+ };
10438
+ update();
10439
+ const frame = requestAnimationFrame(update);
10440
+ window.addEventListener("resize", update);
10441
+ window.addEventListener("scroll", update, true);
10442
+ return () => {
10443
+ cancelAnimationFrame(frame);
10444
+ window.removeEventListener("resize", update);
10445
+ window.removeEventListener("scroll", update, true);
10446
+ };
10447
+ }, [
10448
+ open,
10449
+ anchorRef,
10450
+ rows.length,
10451
+ error,
10452
+ busy
10453
+ ]);
10454
+ (0, react.useEffect)(() => {
10455
+ if (!open) return;
10456
+ const onPointerDown = (event) => {
10457
+ const target = event.target;
10458
+ if (target === null) return;
10459
+ if (surfaceRef.current?.contains(target) === true) return;
10460
+ if (anchorRef?.current?.contains(target) === true) return;
10461
+ closeMenu();
10462
+ };
10463
+ const onKeyDown = (event) => {
10464
+ if (event.key === "Escape") {
10465
+ event.preventDefault();
10466
+ closeMenu();
10467
+ }
10468
+ };
10469
+ document.addEventListener("pointerdown", onPointerDown, true);
10470
+ document.addEventListener("keydown", onKeyDown, true);
10471
+ return () => {
10472
+ document.removeEventListener("pointerdown", onPointerDown, true);
10473
+ document.removeEventListener("keydown", onKeyDown, true);
10474
+ };
10475
+ }, [
10476
+ open,
10477
+ anchorRef,
10478
+ closeMenu
10479
+ ]);
10480
+ const startCreate = (0, react.useCallback)(async () => {
10481
+ setBusy(true);
10482
+ setError(null);
10483
+ try {
10484
+ const path = await pickDirectory();
10485
+ if (path === null || path === "") return;
10486
+ const workspace = await createWorkspace({ path });
10487
+ if (!alive.current) return;
10488
+ closeMenu();
10489
+ onPick(workspace.workspaceId);
10490
+ } catch (reason) {
10491
+ if (alive.current) setError(reason instanceof Error ? reason.message : String(reason));
10492
+ } finally {
10493
+ if (alive.current) setBusy(false);
10494
+ }
10495
+ }, [
10496
+ pickDirectory,
10497
+ createWorkspace,
10498
+ closeMenu,
10499
+ onPick
10500
+ ]);
10501
+ const choose = (0, react.useCallback)((row) => {
10502
+ if (row.kind === "create") {
10503
+ startCreate();
10504
+ return;
10505
+ }
10506
+ closeMenu();
10507
+ onPick(row.id);
10508
+ }, [
10509
+ startCreate,
10510
+ closeMenu,
10511
+ onPick
10512
+ ]);
10513
+ const handleKeyDown = (event) => {
10514
+ if (rows.length === 0) return;
10515
+ if (event.key === "ArrowDown") {
10516
+ event.preventDefault();
10517
+ setActive((current) => (current + 1) % rows.length);
10518
+ return;
10519
+ }
10520
+ if (event.key === "ArrowUp") {
10521
+ event.preventDefault();
10522
+ setActive((current) => (current - 1 + rows.length) % rows.length);
10523
+ return;
10524
+ }
10525
+ if (event.key === "Home") {
10526
+ event.preventDefault();
10527
+ setActive(0);
10528
+ return;
10529
+ }
10530
+ if (event.key === "End") {
10531
+ event.preventDefault();
10532
+ setActive(rows.length - 1);
10533
+ return;
10534
+ }
10535
+ if (event.key === "Enter") {
10536
+ const row = rows[active];
10537
+ if (row === void 0) return;
10538
+ event.preventDefault();
10539
+ choose(row);
10540
+ }
10541
+ };
10542
+ if (!open) return null;
10543
+ const projectRows = rows.filter((row) => row.kind === "project");
10544
+ const createIndex = projectRows.length;
10545
+ const settled = snapshot.state !== "loading";
10546
+ const hasProjects = projectRows.length > 0;
10547
+ const activeId = active < createIndex ? rowIdOf(active) : canCreate ? createId : void 0;
10548
+ return (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.MenuSurface, {
10549
+ ref: surfaceRef,
10550
+ className: "dcu-wsp-panel",
10551
+ style: position,
10552
+ "data-dcu-workspace-picker": "",
10553
+ children: [
10554
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
10555
+ ref: inputRef,
10556
+ className: "dcu-wsp-search",
10557
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconSearchOutlineRegular, { size: 14 }),
10558
+ type: "text",
10559
+ value: query,
10560
+ placeholder: t("workspacePicker.search"),
10561
+ "aria-label": t("workspacePicker.search"),
10562
+ role: "combobox",
10563
+ "aria-expanded": "true",
10564
+ "aria-controls": listId,
10565
+ "aria-activedescendant": activeId,
10566
+ "aria-autocomplete": "list",
10567
+ autoComplete: "off",
10568
+ spellCheck: false,
10569
+ onChange: (event) => {
10570
+ setQuery(event.target.value);
10571
+ setActive(0);
10572
+ setError(null);
10573
+ },
10574
+ onKeyDown: handleKeyDown
10575
+ }),
10576
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10577
+ ref: scrollRef,
10578
+ id: listId,
10579
+ className: "dcu-wsp-scroll",
10580
+ role: "menu",
10581
+ "aria-label": t("workspacePicker.list"),
10582
+ children: [
10583
+ projectRows.map((row, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10584
+ role: "none",
10585
+ className: "dcu-wsp-row",
10586
+ "data-active": active === index,
10587
+ "data-workspace-id": row.id,
10588
+ onMouseEnter: () => setActive(index),
10589
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
10590
+ id: rowIdOf(index),
10591
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFolderCloseRegular, { size: 16 }),
10592
+ current: row.id === selectedId,
10593
+ disabled: busy,
10594
+ onSelect: () => choose(row),
10595
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
10596
+ className: "dcu-wsp-body",
10597
+ children: [
10598
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10599
+ className: "dcu-wsp-label",
10600
+ title: row.path,
10601
+ children: row.label
10602
+ }),
10603
+ row.suffix === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10604
+ className: "dcu-wsp-suffix",
10605
+ children: row.suffix
10606
+ }),
10607
+ row.id === selectedId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, {
10608
+ size: 16,
10609
+ "aria-hidden": "true",
10610
+ className: "dcu-wsp-check"
10611
+ }) : null
10612
+ ]
10613
+ })
10614
+ })
10615
+ }, row.id)),
10616
+ !hasProjects && !settled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10617
+ className: "dcu-wsp-status",
10618
+ role: "status",
10619
+ children: t("workspacePicker.loading")
10620
+ }) : null,
10621
+ !hasProjects && settled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10622
+ className: "dcu-wsp-status",
10623
+ role: "status",
10624
+ children: query.trim() === "" ? t("workspacePicker.noProjects") : t("workspacePicker.empty")
10625
+ }) : null
10626
+ ]
10627
+ }),
10628
+ canCreate ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
10629
+ role: "none",
10630
+ className: "dcu-wsp-create",
10631
+ "data-active": active === createIndex,
10632
+ "data-dcu-workspace-create": "",
10633
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
10634
+ id: createId,
10635
+ icon: busy ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
10636
+ className: "dcu-wsp-spin",
10637
+ "aria-hidden": "true"
10638
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutlineRegular, { size: 16 }),
10639
+ disabled: busy,
10640
+ separatorBefore: true,
10641
+ onSelect: () => choose({ kind: "create" }),
10642
+ children: t("workspacePicker.new")
10643
+ })
10644
+ }) : null,
10645
+ error !== null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10646
+ className: "dcu-wsp-error",
10647
+ role: "alert",
10648
+ children: [t("workspacePicker.createFailed"), error]
10649
+ }) : null
10650
+ ]
10651
+ }), document.body);
10652
+ }
10653
+ //#endregion
10654
+ //#region src/client/composer/workspace-picker-style.ts
10655
+ /**
10656
+ * Codex 风格项目选择器样式。
10657
+ *
10658
+ * 材质层(半透明底、圆角、backdrop、进出场)由宿主 `MenuSurface` 提供,菜单行由
10659
+ * 宿主 `MenuItemButton` 渲染。这里补两件宿主菜单列表本来会做、只挂 `MenuSurface`
10660
+ * 会漏掉的事:
10661
+ * 1. 卡片高度感:宿主 `Menu` 的列表类带 `--dsw-elevation-prominent` 投影与描边环,
10662
+ * 并把滚动条 thumb 重绑到 l2 高度色(`--dsh-scrollbar-*`);缺了这些就是一张平卡片;
10663
+ * 2. 压平宿主 `Input` 在表单语境里的描边与 2px 聚焦环——菜单里的搜索行不是表单,
10664
+ * 原样带进来会像一条错误态输入框。
10665
+ */
10666
+ const WORKSPACE_PICKER_STYLE = `
10667
+ .dcu-wsp-panel{
10668
+ box-sizing:border-box;
10669
+ display:flex;
10670
+ flex-direction:column;
10671
+ width:min(266px,calc(100vw - 16px));
10672
+ padding:4px;
10673
+ --dsw-elevation-stroke-color:var(--dsw-alias-border-l1);
10674
+ box-shadow:var(--dsw-elevation-prominent);
10675
+ --dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);
10676
+ --dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);
10677
+ }
10678
+ .dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search{
10679
+ box-sizing:border-box;
10680
+ width:100%;
10681
+ height:30px;
10682
+ margin-bottom:4px;
10683
+ padding:0 6px;
10684
+ border:0;
10685
+ border-bottom:1px solid var(--dsw-alias-border-l1);
10686
+ border-radius:0;
10687
+ background:transparent;
10688
+ }
10689
+ .dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search:focus-within{border-bottom-color:var(--dsw-alias-border-l3)}
10690
+ .dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search input,
10691
+ .dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search input:focus,
10692
+ .dcu-wsp-panel .dcu-wsp-search.dcu-wsp-search input:focus-visible{outline:none;box-shadow:none;background:transparent}
10693
+ .dcu-wsp-scroll{display:flex;flex-direction:column;min-height:0;max-height:203px;overflow-y:auto;overscroll-behavior:contain}
10694
+ .dcu-wsp-row{flex:none}
10695
+ .dcu-wsp-row[data-active=true] [role=menuitem],
10696
+ .dcu-wsp-create[data-active=true] [role=menuitem]{background:var(--dsw-alias-interactive-bg-hover)}
10697
+ .dcu-wsp-body{display:flex;align-items:center;gap:6px;min-width:0;width:100%}
10698
+ .dcu-wsp-label{min-width:0;overflow:hidden;text-overflow:ellipsis}
10699
+ .dcu-wsp-suffix{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:inherit}
10700
+ .dcu-wsp-check{margin-left:auto;flex:none;color:var(--dsw-alias-label-secondary)}
10701
+ .dcu-wsp-create{flex:none}
10702
+ .dcu-wsp-status{padding:10px 8px;color:var(--dsw-alias-label-tertiary)}
10703
+ .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}
10704
+ .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}
10705
+ @keyframes dcu-wsp-spin{to{transform:rotate(360deg)}}
10706
+ @media(prefers-reduced-motion:reduce){.dcu-wsp-spin{animation-duration:2.4s}}
10707
+ `;
10515
10708
  /** 按用户要求用最窄宽度替代宿主自适应默认;已有有效偏好不重置,拖拽起点沿用宿主存储。 */
10516
10709
  function initializeComposerWidth(storage) {
10517
10710
  const key = "dsh.conversation.contentWidth";
@@ -11576,7 +11769,7 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
11576
11769
  };
11577
11770
  const style = doc.createElement("style");
11578
11771
  style.id = COMPOSER_ENHANCEMENT_STYLE_ID;
11579
- style.textContent = `\n${NEW_CONVERSATION_STYLE}\n`;
11772
+ style.textContent = `\n${NEW_CONVERSATION_STYLE}\n${WORKSPACE_PICKER_STYLE}\n`;
11580
11773
  (doc.head ?? doc.documentElement).appendChild(style);
11581
11774
  return () => {
11582
11775
  if (style.parentNode !== null) style.remove();
@@ -11629,6 +11822,30 @@ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
11629
11822
  locale: NS
11630
11823
  }, SuggestionsDock));
11631
11824
  cleaners.push(unregisterSuggestions);
11825
+ const desktopPicker = globalThis.__DSH_DIRECTORY_PICKER__;
11826
+ const createGate = createCreateGate();
11827
+ const pickerInjected = {
11828
+ pickDirectory: createPickDirectory({
11829
+ ...desktopPicker === void 0 ? {} : { desktopPicker },
11830
+ getRemotePicker: () => ctx.get?.("remote.directoryPicker"),
11831
+ fallback: () => ctx.uiWorkspace.pickDirectory(),
11832
+ gate: createGate
11833
+ }),
11834
+ createWorkspace: (input) => ctx.workspaces.create(input),
11835
+ createGate
11836
+ };
11837
+ function WorkspacePickerSlot(props) {
11838
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodexWorkspacePicker, {
11839
+ ...props,
11840
+ ...pickerInjected
11841
+ });
11842
+ }
11843
+ const unregisterWorkspacePicker = ctx.slots.inject("conversation.hero.workspace", () => ctx.slots.register({
11844
+ name: "conversation.hero.workspace",
11845
+ priority: -100,
11846
+ locale: NS
11847
+ }, WorkspacePickerSlot));
11848
+ cleaners.push(unregisterWorkspacePicker);
11632
11849
  function PredictionSlot(props) {
11633
11850
  const prediction = (0, react.useSyncExternalStore)(subscribePredictionSettings, getPredictionSettingsState, getPredictionSettingsState);
11634
11851
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComposerPredictionOverlay, {
@@ -15407,55 +15624,6 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
15407
15624
  }
15408
15625
  //#endregion
15409
15626
  //#region src/client/sidebar/session-unread/model.ts
15410
- /** 会话行 `data-row-key` 的前缀。 */
15411
- const SESSION_ROW_KEY_PREFIX = "session:";
15412
- /** 宿主行内操作区(CSS Module 哈希前后都保留 `rowActions`)。 */
15413
- const ROW_ACTIONS_SELECTOR = "[class*=\"rowActions\"]";
15414
- /**
15415
- * 从宿主行的 `data-row-key` 解析会话 id。
15416
- *
15417
- * @param key - 行节点的 `data-row-key`。
15418
- * @returns 会话 id;工作区行、其它行与空键返回 undefined。
15419
- */
15420
- function sessionIdOfRowKey(key) {
15421
- if (key === null || key === void 0 || !key.startsWith(SESSION_ROW_KEY_PREFIX)) return void 0;
15422
- const id = key.slice(8);
15423
- return id === "" ? void 0 : id;
15424
- }
15425
- /**
15426
- * 是否有外部插件往操作区塞了非菜单按钮(归档管理器的星标就是这么插的)。
15427
- *
15428
- * @param button - 操作区内的候选按钮。
15429
- * @returns 是外部按钮时返回 true。
15430
- */
15431
- function isForeignButton(button) {
15432
- const className = button.getAttribute("class") ?? "";
15433
- return className.includes("rowStar") || className.includes("dsham_");
15434
- }
15435
- /**
15436
- * 找到会话行的「···」菜单锚点。
15437
- *
15438
- * 两代宿主结构都要认:
15439
- * - 0.2.2+ 给锚点打了 `data-context-menu-trigger`,快捷操作收进 `rowQuickActions`;
15440
- * - 0.2.1 由 `Menu` 原语把锚点包在自己的 `span` 里,归档 / 置顶按钮与它平级。
15441
- * 标记优先,其次按「非快捷操作区的包裹果」、再按「直接子按钮」兜底。空白会话行没有
15442
- * 操作区,返回 null(右击时保留浏览器原生菜单)。
15443
- *
15444
- * @param row - 会话行节点。
15445
- * @returns 菜单锚点按钮或 null。
15446
- */
15447
- function findSessionMenuButton(row) {
15448
- const actions = row.querySelector(ROW_ACTIONS_SELECTOR);
15449
- if (actions === null) return null;
15450
- const marked = actions.querySelector("button[data-context-menu-trigger]");
15451
- if (marked !== null && !isForeignButton(marked)) return marked;
15452
- const notQuickAction = (button) => !isForeignButton(button) && button.closest("[class*=\"rowQuickActions\"]") === null;
15453
- const wrapped = Array.from(actions.querySelectorAll(":scope > span > button")).filter(notQuickAction);
15454
- if (wrapped.length > 0) return wrapped[0] ?? null;
15455
- const direct = Array.from(actions.querySelectorAll(":scope > button")).filter(notQuickAction);
15456
- if (direct.length > 0) return direct[0] ?? null;
15457
- return Array.from(actions.querySelectorAll("button")).filter(notQuickAction)[0] ?? null;
15458
- }
15459
15627
  /**
15460
15628
  * 读取可写的未读集合。
15461
15629
  *
@@ -15535,8 +15703,6 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
15535
15703
  }
15536
15704
  //#endregion
15537
15705
  //#region src/client/sidebar/session-unread/index.tsx
15538
- /** 宿主会话行菜单槽位(行操作列表)。 */
15539
- const MENU_SLOT = "sidebar.workspaces.session.menu.item";
15540
15706
  /** 槽位内本子插件的行 id:命名空间化,避免与宿主行冲突。 */
15541
15707
  const MENU_ITEM_ID = "codex-ui:session-unread";
15542
15708
  /** 排在置顶(100)之后、重命名(200)之前。 */
@@ -15545,66 +15711,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
15545
15711
  const ICON_UNREAD_KEY = "codex-ui:icon-session-unread";
15546
15712
  const ICON_READ_KEY = "codex-ui:icon-session-read";
15547
15713
  /**
15548
- * 「标记为未读 / 标记为已读」菜单行。
15549
- *
15550
- * 宿主标准 hook 缺一环就整行不渲染:这是可选增强,绝不能让一个缺失的宿主能力
15551
- * 把整份会话菜单拖垮。
15552
- *
15553
- * @param props - 宿主组合 props(见 {@link MarkUnreadMenuProps})。
15554
- * @returns 一行菜单项,或 null(未读不可写 / 已归档 / 正在主视图打开)。
15555
- */
15556
- function MarkUnreadMenuItem(props) {
15557
- const { useMenuOpenState, useSessionStatus, useSessions, useWorkspaces } = props;
15558
- if (typeof useMenuOpenState !== "function" || typeof useSessionStatus !== "function" || typeof useSessions !== "function" || typeof useWorkspaces !== "function" || typeof props.markUnread !== "function" || typeof props.markRead !== "function") return null;
15559
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkUnreadMenuRow, { ...props });
15560
- }
15561
- /**
15562
- * 菜单行的渲染主体:hooks 必须无条件调用,因此与能力守卫拆成两个组件。
15563
- *
15564
- * @param props - 已确认具备全部宿主 hook 的组合 props。
15565
- * @returns 菜单项或 null。
15566
- */
15567
- function MarkUnreadMenuRow(props) {
15568
- const { markRead, markUnread, sessionId, t } = props;
15569
- const [, setMenuOpen] = props.useMenuOpenState();
15570
- const unread = props.useSessionStatus((statuses) => statuses.get(sessionId)?.completionUnread === true);
15571
- const busy = props.useSessionStatus((statuses) => isSessionBusy(statuses.get(sessionId)));
15572
- const openInMainView = props.useSessions((list) => isSessionOpenInMainView(list.byId[sessionId]));
15573
- const archived = props.useWorkspaces((state) => isSessionArchived(state.archivedSessionIds, sessionId));
15574
- if (!shouldShowSessionUnreadAction({
15575
- canWrite: typeof props.canWrite === "function" ? props.canWrite() : props.canWrite === true,
15576
- isUnread: unread,
15577
- isArchived: archived,
15578
- isOpenInMainView: openInMainView,
15579
- isBusy: busy
15580
- })) return null;
15581
- const select = (next) => {
15582
- setMenuOpen(false);
15583
- if (next) markUnread(sessionId);
15584
- else markRead(sessionId);
15585
- };
15586
- if (unread) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
15587
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckCircleOutlineRegular, { size: 16 }),
15588
- onSelect: () => select(false),
15589
- children: t("session.markRead")
15590
- });
15591
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MenuItemButton, {
15592
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
15593
- state: "done",
15594
- size: 10
15595
- }),
15596
- onSelect: () => select(true),
15597
- children: t("session.markUnread")
15598
- });
15599
- }
15600
- /**
15601
15714
  * 从客户端 Context 惰性读取宿主 `uiSession`。
15602
- *
15603
- * 故意不列入插件 inject:服务缺失时本能力整体降级,不影响插件其它功能加载;
15604
- * 服务晚到时因为每次点击才读取,标记依然可用。
15605
- *
15606
- * @param ctx - 客户端插件 Context。
15607
- * @returns 宿主服务的最小可用面或 undefined。
15608
15715
  */
15609
15716
  function unreadHostOf(ctx) {
15610
15717
  try {
@@ -15627,16 +15734,11 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
15627
15734
  return;
15628
15735
  }
15629
15736
  }
15630
- function hostOwnsContextMenu(ctx) {
15631
- return typeof getNativeContextMenuService(ctx)?.open === "function";
15632
- }
15633
15737
  /**
15634
15738
  * 挂载会话未读能力。
15635
15739
  *
15636
- * - DSH 0.2.2+:宿主拥有 contextMenus 服务,直接通过 contextMenus.register(..., order: 150)
15637
- * 注入会话菜单,精准排在置顶(100)之后、重命名(200)之前;同时注入 contextMenu.icon。
15638
- * - DSH 0.2.0 / 0.2.1:老版宿主无 contextMenus 服务,注册 sidebar.workspaces.session.menu.item
15639
- * 并安装文档级 contextmenu 委托点击「···」锚点唤起菜单。
15740
+ * DSH 0.2.2+:宿主拥有 contextMenus 服务,直接通过 contextMenus.register(..., order: 150)
15741
+ * 注入会话菜单,精准排在置顶(100)之后、重命名(200)之前;同时注入 contextMenu.icon。
15640
15742
  *
15641
15743
  * @param ctx - 客户端插件 Context。
15642
15744
  * @returns 卸载函数(重复调用安全)。
@@ -15647,145 +15749,100 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
15647
15749
  const markUnread = (sessionId) => writeSessionUnread(unreadHostOf(ctx), sessionId, true);
15648
15750
  const markRead = (sessionId) => writeSessionUnread(unreadHostOf(ctx), sessionId, false);
15649
15751
  const nativeContextMenus = getNativeContextMenuService(ctx);
15650
- if (typeof nativeContextMenus?.register === "function") {
15651
- let disposeUnreadIcon;
15652
- let disposeReadIcon;
15653
- if (slots !== void 0 && typeof slots.inject === "function" && typeof slots.register === "function") {
15654
- try {
15655
- const u1 = slots.inject("contextMenu.icon", () => slots.register({
15656
- name: "contextMenu.icon",
15657
- key: ICON_UNREAD_KEY
15658
- }, () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
15659
- state: "done",
15660
- size: 10
15661
- })));
15662
- if (typeof u1 === "function") disposeUnreadIcon = u1;
15663
- } catch {}
15664
- try {
15665
- const u2 = slots.inject("contextMenu.icon", () => slots.register({
15666
- name: "contextMenu.icon",
15667
- key: ICON_READ_KEY
15668
- }, () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckCircleOutlineRegular, { size: 16 })));
15669
- if (typeof u2 === "function") disposeReadIcon = u2;
15670
- } catch {}
15671
- }
15672
- let unregNative;
15752
+ if (typeof nativeContextMenus?.register !== "function") return () => {};
15753
+ let disposeUnreadIcon;
15754
+ let disposeReadIcon;
15755
+ if (slots !== void 0 && typeof slots.inject === "function" && typeof slots.register === "function") {
15673
15756
  try {
15674
- unregNative = nativeContextMenus.register({
15675
- id: MENU_ITEM_ID,
15676
- target: "session",
15677
- order: MENU_ORDER,
15678
- observe: () => {
15679
- const sessionStatus = unreadHostOf(ctx)?.sessionStatus;
15680
- return [ctx.locale, ...sessionStatus?.subscribe ? [sessionStatus] : []];
15681
- },
15682
- resolve: (target) => {
15683
- const sessionId = target?.sessionId;
15684
- if (!sessionId) return [];
15685
- const unreadHost = unreadHostOf(ctx);
15686
- const canWrite = canMarkSession(unreadHost);
15687
- const isUnread = unreadSetOf(unreadHost)?.has(sessionId) === true;
15688
- let archived = false;
15689
- try {
15690
- const workspaces = ctx.get?.("workspaces") ?? ctx.workspaces;
15691
- archived = isSessionArchived((workspaces?.list?.getSnapshot?.() ?? workspaces?.getSnapshot?.())?.archivedSessionIds, sessionId);
15692
- } catch {}
15693
- let openInMainView = false;
15694
- let busy = false;
15695
- try {
15696
- const sessions = ctx.get?.("sessions") ?? ctx.sessions;
15697
- const list = sessions?.list?.getSnapshot?.() ?? sessions?.getSnapshot?.();
15698
- const sessionItem = list?.byId?.[sessionId] ?? list?.items?.find?.((s) => s.id === sessionId);
15699
- openInMainView = isSessionOpenInMainView(sessionItem);
15700
- const uiSession = unreadHost;
15701
- const statusMap = uiSession?.sessionStatus?.getSnapshot?.() ?? uiSession?.sessionStatus;
15702
- busy = isSessionBusy(statusMap instanceof Map ? statusMap.get(sessionId) : statusMap?.[sessionId] ?? uiSession?.statusOf?.(sessionId), sessionItem);
15703
- } catch {}
15704
- if (!shouldShowSessionUnreadAction({
15705
- canWrite,
15706
- isUnread,
15707
- isArchived: archived,
15708
- isOpenInMainView: openInMainView,
15709
- isBusy: busy
15710
- })) return [];
15711
- const t = ctx.locale?.bind?.("michengai.codexUi") ?? ((k) => k);
15712
- if (isUnread) return [{
15713
- id: "mark-read",
15714
- label: t("session.markRead"),
15715
- icon: { key: ICON_READ_KEY },
15716
- run: () => {
15717
- markRead(sessionId);
15718
- }
15719
- }];
15720
- return [{
15721
- id: "mark-unread",
15722
- label: t("session.markUnread"),
15723
- icon: { key: ICON_UNREAD_KEY },
15724
- run: () => {
15725
- markUnread(sessionId);
15726
- }
15727
- }];
15728
- }
15729
- });
15730
- } catch (error) {
15731
- console.warn("[codex-ui:session-unread] 注册原生 contextMenus 失败,跳过。", error);
15732
- }
15733
- return () => {
15734
- if (disposed) return;
15735
- disposed = true;
15736
- if (typeof unregNative === "function") try {
15737
- unregNative();
15738
- } catch {}
15739
- if (typeof disposeUnreadIcon === "function") try {
15740
- disposeUnreadIcon();
15741
- } catch {}
15742
- if (typeof disposeReadIcon === "function") try {
15743
- disposeReadIcon();
15744
- } catch {}
15745
- };
15757
+ const u1 = slots.inject("contextMenu.icon", () => slots.register({
15758
+ name: "contextMenu.icon",
15759
+ key: ICON_UNREAD_KEY
15760
+ }, () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
15761
+ state: "done",
15762
+ size: 10
15763
+ })));
15764
+ if (typeof u1 === "function") disposeUnreadIcon = u1;
15765
+ } catch {}
15766
+ try {
15767
+ const u2 = slots.inject("contextMenu.icon", () => slots.register({
15768
+ name: "contextMenu.icon",
15769
+ key: ICON_READ_KEY
15770
+ }, () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckCircleOutlineRegular, { size: 16 })));
15771
+ if (typeof u2 === "function") disposeReadIcon = u2;
15772
+ } catch {}
15746
15773
  }
15747
- if (slots === void 0 || typeof slots.inject !== "function" || typeof slots.register !== "function") return () => {};
15748
- let disposeEntry;
15774
+ let unregNative;
15749
15775
  try {
15750
- disposeEntry = slots.inject(MENU_SLOT, () => slots.register({
15751
- name: MENU_SLOT,
15776
+ unregNative = nativeContextMenus.register({
15752
15777
  id: MENU_ITEM_ID,
15778
+ target: "session",
15753
15779
  order: MENU_ORDER,
15754
- locale: NS,
15755
- inject: () => ({
15756
- markUnread,
15757
- markRead,
15758
- canWrite: () => canMarkSession(unreadHostOf(ctx))
15759
- })
15760
- }, MarkUnreadMenuItem));
15780
+ observe: () => {
15781
+ const sessionStatus = unreadHostOf(ctx)?.sessionStatus;
15782
+ return [ctx.locale, ...sessionStatus?.subscribe ? [sessionStatus] : []];
15783
+ },
15784
+ resolve: (target) => {
15785
+ const sessionId = target?.sessionId;
15786
+ if (!sessionId) return [];
15787
+ const unreadHost = unreadHostOf(ctx);
15788
+ const canWrite = canMarkSession(unreadHost);
15789
+ const isUnread = unreadSetOf(unreadHost)?.has(sessionId) === true;
15790
+ let archived = false;
15791
+ try {
15792
+ const workspaces = ctx.get?.("workspaces") ?? ctx.workspaces;
15793
+ archived = isSessionArchived((workspaces?.list?.getSnapshot?.() ?? workspaces?.getSnapshot?.())?.archivedSessionIds, sessionId);
15794
+ } catch {}
15795
+ let openInMainView = false;
15796
+ let busy = false;
15797
+ try {
15798
+ const sessions = ctx.get?.("sessions") ?? ctx.sessions;
15799
+ const list = sessions?.list?.getSnapshot?.() ?? sessions?.getSnapshot?.();
15800
+ const sessionItem = list?.byId?.[sessionId] ?? list?.items?.find?.((s) => s.id === sessionId);
15801
+ openInMainView = isSessionOpenInMainView(sessionItem);
15802
+ const uiSession = unreadHost;
15803
+ const statusMap = uiSession?.sessionStatus?.getSnapshot?.() ?? uiSession?.sessionStatus;
15804
+ busy = isSessionBusy(statusMap instanceof Map ? statusMap.get(sessionId) : statusMap?.[sessionId] ?? uiSession?.statusOf?.(sessionId), sessionItem);
15805
+ } catch {}
15806
+ if (!shouldShowSessionUnreadAction({
15807
+ canWrite,
15808
+ isUnread,
15809
+ isArchived: archived,
15810
+ isOpenInMainView: openInMainView,
15811
+ isBusy: busy
15812
+ })) return [];
15813
+ const t = ctx.locale?.bind?.("michengai.codexUi") ?? ((k) => k);
15814
+ if (isUnread) return [{
15815
+ id: "mark-read",
15816
+ label: t("session.markRead"),
15817
+ icon: { key: ICON_READ_KEY },
15818
+ run: () => {
15819
+ markRead(sessionId);
15820
+ }
15821
+ }];
15822
+ return [{
15823
+ id: "mark-unread",
15824
+ label: t("session.markUnread"),
15825
+ icon: { key: ICON_UNREAD_KEY },
15826
+ run: () => {
15827
+ markUnread(sessionId);
15828
+ }
15829
+ }];
15830
+ }
15831
+ });
15761
15832
  } catch (error) {
15762
- console.warn("[codex-ui:session-unread] 会话菜单项注册失败,已跳过。", error);
15763
- return () => {};
15833
+ console.warn("[codex-ui:session-unread] 注册原生 contextMenus 失败,跳过。", error);
15764
15834
  }
15765
- const onContextMenu = (event) => {
15766
- if (disposed || event.defaultPrevented) return;
15767
- const target = event.target;
15768
- if (!(target instanceof Element)) return;
15769
- if (target.closest("input, textarea, [contenteditable='true']") !== null) return;
15770
- if (target.closest("[role=\"menu\"]") !== null) return;
15771
- const row = target.closest("[data-row-key]");
15772
- if (row === null || sessionIdOfRowKey(row.getAttribute("data-row-key")) === void 0) return;
15773
- if (hostOwnsContextMenu(ctx) || row.querySelector("[data-context-menu-trigger]") !== null) return;
15774
- const selection = typeof window.getSelection === "function" ? window.getSelection() : null;
15775
- if (selection !== null && selection.toString().trim() !== "") return;
15776
- const menuButton = findSessionMenuButton(row);
15777
- if (menuButton === null) return;
15778
- event.preventDefault();
15779
- menuButton.click();
15780
- };
15781
- document.addEventListener("contextmenu", onContextMenu, true);
15782
15835
  return () => {
15783
15836
  if (disposed) return;
15784
15837
  disposed = true;
15785
- document.removeEventListener("contextmenu", onContextMenu, true);
15786
- if (typeof disposeEntry !== "function") return;
15787
- try {
15788
- disposeEntry();
15838
+ if (typeof unregNative === "function") try {
15839
+ unregNative();
15840
+ } catch {}
15841
+ if (typeof disposeUnreadIcon === "function") try {
15842
+ disposeUnreadIcon();
15843
+ } catch {}
15844
+ if (typeof disposeReadIcon === "function") try {
15845
+ disposeReadIcon();
15789
15846
  } catch {}
15790
15847
  };
15791
15848
  }