@chatcode/cco-better-sidebar 0.18.0-alpha.4 → 0.18.0-rc.11

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.
Files changed (83) hide show
  1. package/README.md +24 -5
  2. package/README_EN.md +24 -5
  3. package/cordis.patch.yml +6 -5
  4. package/lib/client-editor.js +10920 -363
  5. package/lib/client-mermaid.js +10806 -271
  6. package/lib/client-registry.js +3733 -2150
  7. package/lib/client-terminal.js +398 -257
  8. package/lib/client.js +3734 -2151
  9. package/lib/index.js +264 -46
  10. package/lib/types/client/LogoutConfirmDialog.d.ts +5 -0
  11. package/lib/types/client/PluginMarketSettingsSection.d.ts +7 -0
  12. package/lib/types/client/PluginMarketView.d.ts +7 -0
  13. package/lib/types/client/PluginProjectPicker.d.ts +13 -0
  14. package/lib/types/client/api.d.ts +17 -0
  15. package/lib/types/client/builtins/tabs.d.ts +13 -1
  16. package/lib/types/client/icons.d.ts +26 -8
  17. package/lib/types/client/locales.d.ts +39 -0
  18. package/lib/types/client/plugin-market-catalog.d.ts +25 -0
  19. package/lib/types/client/service.d.ts +1 -1
  20. package/lib/types/client/ui-tweaks/archive.d.ts +3 -7
  21. package/lib/types/client/ui-tweaks/branding.d.ts +1 -1
  22. package/lib/types/client/ui-tweaks/index.d.ts +3 -3
  23. package/lib/types/client/ui-tweaks/sidebar-header.d.ts +6 -0
  24. package/lib/types/client/ui-tweaks/typography.d.ts +9 -0
  25. package/lib/types/config.d.ts +4 -3
  26. package/lib/types/context-types.d.ts +12 -14
  27. package/lib/types/login-page-script.d.ts +2 -0
  28. package/lib/types/login-route.d.ts +2 -0
  29. package/lib/types/plugin-market-api.d.ts +5 -0
  30. package/lib/types/plugin-market-shared.d.ts +59 -0
  31. package/lib/types/prefs-shared.d.ts +1 -1
  32. package/lib/types/pty-deps.d.ts +1 -1
  33. package/lib/types/ui-tweaks/config.d.ts +6 -7
  34. package/lib/types/ui-tweaks/index.d.ts +2 -3
  35. package/package.json +2 -2
  36. package/src/client/AccountMenu.tsx +12 -2
  37. package/src/client/BrowserView.tsx +1 -1
  38. package/src/client/DiffTab.tsx +1 -1
  39. package/src/client/EditorHost.tsx +1 -1
  40. package/src/client/FileTree.tsx +10 -5
  41. package/src/client/FreeWindow.tsx +2 -1
  42. package/src/client/GitView.tsx +7 -3
  43. package/src/client/LogoutConfirmDialog.tsx +39 -0
  44. package/src/client/PluginMarketSettingsSection.tsx +55 -0
  45. package/src/client/PluginMarketView.module.css +50 -0
  46. package/src/client/PluginMarketView.tsx +243 -0
  47. package/src/client/PluginProjectPicker.tsx +73 -0
  48. package/src/client/SideCardSection.tsx +2 -23
  49. package/src/client/Sidebar.tsx +2 -2
  50. package/src/client/TabBar.tsx +2 -4
  51. package/src/client/TextEditor.tsx +2 -1
  52. package/src/client/TreePanel.tsx +1 -2
  53. package/src/client/UsageHeatmapSection.tsx +1 -1
  54. package/src/client/api.ts +9 -0
  55. package/src/client/builtins/tabs.tsx +25 -5
  56. package/src/client/builtins/viewers.tsx +2 -1
  57. package/src/client/icons.tsx +57 -4
  58. package/src/client/index.tsx +10 -1
  59. package/src/client/intercept.tsx +1 -1
  60. package/src/client/locales-ja.ts +39 -0
  61. package/src/client/locales.ts +118 -1
  62. package/src/client/md-toc.tsx +1 -1
  63. package/src/client/mermaid.tsx +2 -1
  64. package/src/client/open-with-settings.tsx +1 -1
  65. package/src/client/plugin-market-catalog.ts +90 -0
  66. package/src/client/service.ts +1 -1
  67. package/src/client/sidebar.module.css +81 -19
  68. package/src/client/ui-tweaks/archive.tsx +6 -56
  69. package/src/client/ui-tweaks/branding.tsx +36 -29
  70. package/src/client/ui-tweaks/index.tsx +42 -105
  71. package/src/client/ui-tweaks/sidebar-header.ts +73 -0
  72. package/src/client/ui-tweaks/typography.ts +38 -0
  73. package/src/config.ts +22 -2
  74. package/src/context-types.ts +5 -15
  75. package/src/index.ts +24 -20
  76. package/src/login-page-script.ts +107 -0
  77. package/src/login-route.ts +7 -4
  78. package/src/plugin-market-api.ts +88 -0
  79. package/src/plugin-market-shared.ts +30 -0
  80. package/src/prefs-shared.ts +1 -1
  81. package/src/pty-deps.ts +2 -2
  82. package/src/ui-tweaks/config.ts +12 -12
  83. package/src/ui-tweaks/index.ts +7 -13
@@ -39,6 +39,8 @@ import { SideCardSection } from './SideCardSection.tsx'
39
39
  import { UsageHeatmapSection } from './UsageHeatmapSection.tsx'
40
40
  import { AiRatioSection } from './AiRatioSection.tsx'
41
41
  import { UpdateSettingsSection } from './UpdateSettingsSection.tsx'
42
+ import { registerPluginMarketSettings } from './PluginMarketSettingsSection.tsx'
43
+ import { createPluginMarketCatalog } from './plugin-market-catalog.ts'
42
44
  import { api } from './api.ts'
43
45
  import { LOCALE_NS, attachLocale, attachBetterLocale, t, zh, en,
44
46
  ja, de, fr, pt, ko, ar, hi, id, tr, vi, th, ru, it, nl, sv, pl,
@@ -142,6 +144,11 @@ export function apply(ctx: Context): void {
142
144
  // registrations (the official createXXXStore() factory rule — no
143
145
  // module-level singleton).
144
146
  const sidebarStore = createSidebarStore()
147
+ const pluginMarketCatalog = createPluginMarketCatalog()
148
+ ctx.effect(() => {
149
+ pluginMarketCatalog.start()
150
+ return () => pluginMarketCatalog.dispose()
151
+ }, 'dsh-better-sidebar: plugin catalogs')
145
152
  // Extend (rather than replace) DSH's single-owner Workspace browser with a
146
153
  // durable Pinned sessions peer group and an extra native row-menu action.
147
154
  // The native browser keeps ownership of search, workspace management and
@@ -180,7 +187,7 @@ export function apply(ctx: Context): void {
180
187
  // service (eating our own dogfood). The disposer unregisters them on
181
188
  // fiber disposal (HMR-safe).
182
189
  ctx.effect(
183
- () => registerBuiltins(ctx, service, { terminalTitle: () => terminalTitle }),
190
+ () => registerBuiltins(ctx, service, { terminalTitle: () => terminalTitle, pluginMarketCatalog }),
184
191
  'dsh-better-sidebar: register built-in tabs and viewers',
185
192
  )
186
193
  // A failure anywhere in the client lifecycle must never take the app down
@@ -481,6 +488,8 @@ export function apply(ctx: Context): void {
481
488
  'dsh-better-sidebar: skill market navigation icon fallback',
482
489
  )
483
490
 
491
+ registerPluginMarketSettings(ctx, pluginMarketCatalog)
492
+
484
493
  // The "Side card" settings section: appears in the DSH Settings shell
485
494
  // once the shell's declaration is on the ledger (slots.inject waits for
486
495
  // it); the section reads/writes the prefs through the plugin's own
@@ -5,7 +5,7 @@
5
5
  * compatible across that transition. The chips open the file in the sidebar
6
6
  * instead of the host OS.
7
7
  */
8
- import { IconCodeOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
8
+ import { IconCodeOutline16 } from './icons.tsx'
9
9
  import type { Context } from '../context-types.ts'
10
10
  import { firstLeaf, revealPaths, togglePanel, type SidebarStore } from './state.ts'
11
11
  import { t } from './locales.ts'
@@ -16,8 +16,47 @@
16
16
 
17
17
  /** The ja dictionary (key-set-equal to zh, enforced by the type annotation in locales.ts). */
18
18
  export const ja: Record<string, string> = {
19
+ pluginMarketTitle: 'プラグインマーケット',
20
+ pluginMarketProjectDirectory: 'プロジェクトディレクトリ:{path}',
21
+ pluginMarketInstalledTab: 'インストール済み',
22
+ pluginMarketRefresh: '更新',
23
+ pluginMarketLoading: 'プラグインを読み込み中…',
24
+ pluginMarketRefreshing: '一覧を更新中…',
25
+ pluginMarketEmpty: 'プラグインはありません。',
26
+ pluginMarketBack: '戻る',
27
+ pluginMarketInstall: 'インストール',
28
+ pluginMarketUninstall: 'アンインストール',
29
+ pluginMarketProject: 'プロジェクト',
30
+ pluginMarketUser: 'ユーザー',
31
+ pluginMarketInstalled: 'プラグインをインストールしました。',
32
+ pluginMarketUninstalled: 'プラグインをアンインストールしました。',
33
+ pluginMarketSubtitle: 'マーケットを参照し、プロジェクトディレクトリを選ぶかユーザー環境にインストールします。',
34
+ pluginMarketChooseProject: 'プロジェクトディレクトリを選択',
35
+ pluginMarketProjectHint: 'プロジェクトにインストールする場合は対象フォルダーを選択してください。',
36
+ pluginMarketChoosingDirectory: 'ディレクトリを選択中…',
37
+ pluginMarketAwaitingConfirmation: '確認待ち…',
38
+ pluginMarketConfirmProjectInstall: 'プロジェクトへのインストールを確認',
39
+ pluginMarketConfirmProjectDescription: '{name} を以下のプロジェクトディレクトリにインストールします。変更する場合はキャンセルし、ページ上部でディレクトリを選択してください。',
40
+ pluginMarketConfirmInstall: 'インストールを確認',
41
+ pluginMarketInstalledAt: 'プラグインのインストール先:{path}',
42
+ pluginMarketInstallPath: '{scope}のインストール先:{path}',
43
+ pluginMarketDirectoryPath: 'ディレクトリパス',
44
+ pluginMarketOpenDirectory: 'ディレクトリを開く',
45
+ pluginMarketSelectDirectory: 'このディレクトリを選択',
46
+ pluginMarketHomeDirectory: 'ホーム',
47
+ pluginMarketDirectoryTruncated: '一部のフォルダーのみ表示しています。完全なパスを入力してプロジェクトを開けます。',
48
+ pluginMarketSearch: 'マーケットやプラグインを検索',
49
+ pluginMarketDefault: 'デフォルト',
50
+ pluginMarketBrowse: 'プラグインを見る',
51
+ pluginMarketNoDescription: '説明なし',
52
+ pluginMarketInstalling: 'インストール中…',
53
+ pluginMarketUninstalling: 'アンインストール中…',
54
+ pluginMarketInstallProgress: '{name} をインストールしています。しばらくお待ちください…',
55
+ pluginMarketUninstallProgress: '{name} をアンインストールしています。しばらくお待ちください…',
19
56
  accountMenuSettings: '設定',
20
57
  accountMenuLogout: 'ログアウト',
58
+ accountMenuLogoutConfirmTitle: 'ログアウトしますか?',
59
+ accountMenuLogoutConfirmDescription: 'ChatCode CLI からログアウトしますか?続行するには再度ログインする必要があります。',
21
60
  accountMenuLabel: 'アカウントメニュー',
22
61
  updateMenu: '更新を確認 / 今すぐ更新',
23
62
  updateNav: '更新',
@@ -23,8 +23,47 @@
23
23
 
24
24
  /** The zh dictionary (also registered into the ChatCode CLI locale registry under {@link LOCALE_NS}). */
25
25
  export const zh = {
26
+ pluginMarketTitle: '插件市场',
27
+ pluginMarketProjectDirectory: '项目目录:{path}',
28
+ pluginMarketInstalledTab: '已安装',
29
+ pluginMarketRefresh: '刷新',
30
+ pluginMarketLoading: '正在加载插件…',
31
+ pluginMarketRefreshing: '正在刷新列表…',
32
+ pluginMarketEmpty: '暂无插件。',
33
+ pluginMarketBack: '返回',
34
+ pluginMarketInstall: '安装',
35
+ pluginMarketUninstall: '卸载',
36
+ pluginMarketProject: '项目级',
37
+ pluginMarketUser: '用户级',
38
+ pluginMarketInstalled: '插件安装成功。',
39
+ pluginMarketUninstalled: '插件卸载成功。',
40
+ pluginMarketSubtitle: '浏览插件市场,选择项目目录安装,或安装到用户环境。',
41
+ pluginMarketChooseProject: '选择项目目录',
42
+ pluginMarketProjectHint: '安装到项目时,请先选择目标项目文件夹。',
43
+ pluginMarketChoosingDirectory: '正在选择目录…',
44
+ pluginMarketAwaitingConfirmation: '等待确认…',
45
+ pluginMarketConfirmProjectInstall: '确认项目级安装',
46
+ pluginMarketConfirmProjectDescription: '将把 {name} 安装到以下项目目录。如需更改,请取消后在顶部选择项目目录。',
47
+ pluginMarketConfirmInstall: '确认安装',
48
+ pluginMarketInstalledAt: '插件已安装到:{path}',
49
+ pluginMarketInstallPath: '{scope}安装目录:{path}',
50
+ pluginMarketDirectoryPath: '目录路径',
51
+ pluginMarketOpenDirectory: '打开目录',
52
+ pluginMarketSelectDirectory: '选择此目录',
53
+ pluginMarketHomeDirectory: '主目录',
54
+ pluginMarketDirectoryTruncated: '目录过多,仅显示部分结果;可输入完整路径打开项目。',
55
+ pluginMarketSearch: '搜索市场或插件',
56
+ pluginMarketDefault: '默认',
57
+ pluginMarketBrowse: '查看插件',
58
+ pluginMarketNoDescription: '暂无描述',
59
+ pluginMarketInstalling: '安装中…',
60
+ pluginMarketUninstalling: '卸载中…',
61
+ pluginMarketInstallProgress: '正在安装 {name},请稍候…',
62
+ pluginMarketUninstallProgress: '正在卸载 {name},请稍候…',
26
63
  accountMenuSettings: '设置',
27
64
  accountMenuLogout: '退出登录',
65
+ accountMenuLogoutConfirmTitle: '退出登录?',
66
+ accountMenuLogoutConfirmDescription: '确定要退出 ChatCode CLI 吗?退出后需要重新登录才能继续使用。',
28
67
  accountMenuLabel: '账户菜单',
29
68
  updateMenu: '检查更新 / 一键更新',
30
69
  updateNav: '更新',
@@ -494,8 +533,47 @@ export const zh = {
494
533
 
495
534
  /** The en dictionary (key-set-equal to zh, enforced by the type annotation). */
496
535
  export const en: Record<keyof typeof zh, string> = {
536
+ pluginMarketTitle: 'Plugin marketplace',
537
+ pluginMarketProjectDirectory: 'Project directory: {path}',
538
+ pluginMarketInstalledTab: 'Installed',
539
+ pluginMarketRefresh: 'Refresh',
540
+ pluginMarketLoading: 'Loading plugins…',
541
+ pluginMarketRefreshing: 'Refreshing list…',
542
+ pluginMarketEmpty: 'No plugins.',
543
+ pluginMarketBack: 'Back',
544
+ pluginMarketInstall: 'Install',
545
+ pluginMarketUninstall: 'Uninstall',
546
+ pluginMarketProject: 'Project',
547
+ pluginMarketUser: 'User',
548
+ pluginMarketInstalled: 'Plugin installed.',
549
+ pluginMarketUninstalled: 'Plugin uninstalled.',
550
+ pluginMarketSubtitle: 'Browse marketplaces, choose a project directory, or install for your user.',
551
+ pluginMarketChooseProject: 'Choose project directory',
552
+ pluginMarketProjectHint: 'Choose a target project folder when installing for a project.',
553
+ pluginMarketChoosingDirectory: 'Choosing directory…',
554
+ pluginMarketAwaitingConfirmation: 'Awaiting confirmation…',
555
+ pluginMarketConfirmProjectInstall: 'Confirm project installation',
556
+ pluginMarketConfirmProjectDescription: '{name} will be installed in the project directory below. To change it, cancel and choose a project directory at the top of the page.',
557
+ pluginMarketConfirmInstall: 'Confirm installation',
558
+ pluginMarketInstalledAt: 'Plugin installed at: {path}',
559
+ pluginMarketInstallPath: '{scope} installation directory: {path}',
560
+ pluginMarketDirectoryPath: 'Directory path',
561
+ pluginMarketOpenDirectory: 'Open directory',
562
+ pluginMarketSelectDirectory: 'Select this directory',
563
+ pluginMarketHomeDirectory: 'Home',
564
+ pluginMarketDirectoryTruncated: 'Only some folders are shown. Enter the full path to open your project.',
565
+ pluginMarketSearch: 'Search marketplaces or plugins',
566
+ pluginMarketDefault: 'Default',
567
+ pluginMarketBrowse: 'Browse plugins',
568
+ pluginMarketNoDescription: 'No description',
569
+ pluginMarketInstalling: 'Installing…',
570
+ pluginMarketUninstalling: 'Uninstalling…',
571
+ pluginMarketInstallProgress: 'Installing {name}, please wait…',
572
+ pluginMarketUninstallProgress: 'Uninstalling {name}, please wait…',
497
573
  accountMenuSettings: 'Settings',
498
574
  accountMenuLogout: 'Log out',
575
+ accountMenuLogoutConfirmTitle: 'Log out?',
576
+ accountMenuLogoutConfirmDescription: 'Are you sure you want to log out of ChatCode CLI? You will need to sign in again to continue.',
499
577
  accountMenuLabel: 'Account menu',
500
578
  updateMenu: 'Check for updates / Update now',
501
579
  updateNav: 'Update',
@@ -992,9 +1070,48 @@ import { zhHK as zhHKDict } from './locales-zh-HK.ts'
992
1070
  import { zhTW as zhTWDict } from './locales-zh-TW.ts'
993
1071
  import { zhMO as zhMODict } from './locales-zh-MO.ts'
994
1072
 
995
- // English fallback for the new account/model surfaces until third-language translations are supplied.
1073
+ // English fallback for the new account/model/marketplace surfaces until third-language translations are supplied.
996
1074
  // Keep this list explicit so the dictionary parity check still catches other missing keys.
997
1075
  const accountAndModelFallback = {
1076
+ pluginMarketTitle: en.pluginMarketTitle,
1077
+ pluginMarketProjectDirectory: en.pluginMarketProjectDirectory,
1078
+ pluginMarketInstalledTab: en.pluginMarketInstalledTab,
1079
+ pluginMarketRefresh: en.pluginMarketRefresh,
1080
+ pluginMarketLoading: en.pluginMarketLoading,
1081
+ pluginMarketRefreshing: en.pluginMarketRefreshing,
1082
+ pluginMarketEmpty: en.pluginMarketEmpty,
1083
+ pluginMarketBack: en.pluginMarketBack,
1084
+ pluginMarketInstall: en.pluginMarketInstall,
1085
+ pluginMarketUninstall: en.pluginMarketUninstall,
1086
+ pluginMarketProject: en.pluginMarketProject,
1087
+ pluginMarketUser: en.pluginMarketUser,
1088
+ pluginMarketInstalled: en.pluginMarketInstalled,
1089
+ pluginMarketUninstalled: en.pluginMarketUninstalled,
1090
+ pluginMarketSubtitle: en.pluginMarketSubtitle,
1091
+ pluginMarketChooseProject: en.pluginMarketChooseProject,
1092
+ pluginMarketProjectHint: en.pluginMarketProjectHint,
1093
+ pluginMarketChoosingDirectory: en.pluginMarketChoosingDirectory,
1094
+ pluginMarketAwaitingConfirmation: en.pluginMarketAwaitingConfirmation,
1095
+ pluginMarketConfirmProjectInstall: en.pluginMarketConfirmProjectInstall,
1096
+ pluginMarketConfirmProjectDescription: en.pluginMarketConfirmProjectDescription,
1097
+ pluginMarketConfirmInstall: en.pluginMarketConfirmInstall,
1098
+ pluginMarketInstalledAt: en.pluginMarketInstalledAt,
1099
+ pluginMarketInstallPath: en.pluginMarketInstallPath,
1100
+ pluginMarketDirectoryPath: en.pluginMarketDirectoryPath,
1101
+ pluginMarketOpenDirectory: en.pluginMarketOpenDirectory,
1102
+ pluginMarketSelectDirectory: en.pluginMarketSelectDirectory,
1103
+ pluginMarketHomeDirectory: en.pluginMarketHomeDirectory,
1104
+ pluginMarketDirectoryTruncated: en.pluginMarketDirectoryTruncated,
1105
+ pluginMarketSearch: en.pluginMarketSearch,
1106
+ pluginMarketDefault: en.pluginMarketDefault,
1107
+ pluginMarketBrowse: en.pluginMarketBrowse,
1108
+ pluginMarketNoDescription: en.pluginMarketNoDescription,
1109
+ pluginMarketInstalling: en.pluginMarketInstalling,
1110
+ pluginMarketUninstalling: en.pluginMarketUninstalling,
1111
+ pluginMarketInstallProgress: en.pluginMarketInstallProgress,
1112
+ pluginMarketUninstallProgress: en.pluginMarketUninstallProgress,
1113
+ accountMenuLogoutConfirmTitle: en.accountMenuLogoutConfirmTitle,
1114
+ accountMenuLogoutConfirmDescription: en.accountMenuLogoutConfirmDescription,
998
1115
  chatcodeGateChecking: en.chatcodeGateChecking,
999
1116
  chatcodeGateUnverified: en.chatcodeGateUnverified,
1000
1117
  chatcodeGatePending: en.chatcodeGatePending,
@@ -18,7 +18,7 @@
18
18
  */
19
19
  import { useLayoutEffect, useRef, useState } from 'react'
20
20
  import type { ReactNode } from 'react'
21
- import { IconListPenOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
21
+ import { IconListPenOutline16 } from './icons.tsx'
22
22
  import { t } from './locales.ts'
23
23
  import css from './sidebar.module.css'
24
24
 
@@ -28,7 +28,8 @@ import { useCallback, useEffect, useLayoutEffect, useRef, useState, type MouseEv
28
28
  import { createPortal } from 'react-dom'
29
29
  import { createRoot, type Root } from 'react-dom/client'
30
30
  import mermaid from 'mermaid'
31
- import { IconCopyOutline16, MarkdownText, writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'
31
+ import { MarkdownText, writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'
32
+ import { IconCopyOutline16 } from './icons.tsx'
32
33
  import { isDarkScheme, subscribeColorScheme } from './theme.ts'
33
34
  import { markdownTextProps } from './markdown-labels.tsx'
34
35
  import { t } from './locales.ts'
@@ -10,7 +10,7 @@
10
10
  * this component owns only its own section.
11
11
  */
12
12
  import { useState } from 'react'
13
- import { IconCloseOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
13
+ import { IconCloseOutline16 } from './icons.tsx'
14
14
  import {
15
15
  isValidCustomEditor,
16
16
  newCustomEditorId,
@@ -0,0 +1,90 @@
1
+ /** App-lifetime remote catalogs, shared by Settings and the sidebar tab. */
2
+ import { api } from './api.ts'
3
+ import type { MarketplaceCatalog, MarketplacePlugin } from '../plugin-market-shared.ts'
4
+
5
+ interface Entry<T> {
6
+ readonly status: 'loading' | 'ready' | 'error'
7
+ readonly data?: T
8
+ readonly error?: string
9
+ readonly warning?: string
10
+ }
11
+ interface Snapshot {
12
+ readonly markets?: Entry<MarketplaceCatalog>
13
+ readonly plugins: Readonly<Record<string, Entry<MarketplacePlugin[]>>>
14
+ readonly refresh?: { readonly status: 'loading' | 'ready' | 'error'; readonly error?: string }
15
+ }
16
+ export interface PluginMarketCatalog {
17
+ subscribe(listener: () => void): () => void
18
+ getSnapshot(): Snapshot
19
+ start(): void
20
+ ensure(marketplaceId: string): void
21
+ refresh(marketplaceId?: string): void
22
+ dispose(): void
23
+ }
24
+
25
+ export function createPluginMarketCatalog(): PluginMarketCatalog {
26
+ let snapshot: Snapshot = { plugins: {} }
27
+ let disposed = false
28
+ const listeners = new Set<() => void>()
29
+ const controllers = new Set<AbortController>()
30
+ const requests = new Map<string, Promise<string | undefined>>()
31
+ const publish = (next: Snapshot): void => {
32
+ if (disposed) return
33
+ snapshot = next
34
+ listeners.forEach(listener => listener())
35
+ }
36
+ const load = <T>(
37
+ key: string,
38
+ current: () => Entry<T> | undefined,
39
+ update: (entry: Entry<T>) => void,
40
+ request: (signal: AbortSignal) => Promise<{ data: T; warning?: string }>,
41
+ ): Promise<string | undefined> => {
42
+ if (disposed) return Promise.resolve(undefined)
43
+ const pending = requests.get(key)
44
+ if (pending) return pending
45
+ const entry: Entry<T> = { status: 'loading', data: current()?.data }
46
+ const controller = new AbortController()
47
+ controllers.add(controller)
48
+ update(entry)
49
+ const result = request(controller.signal).then(
50
+ ({ data, warning }) => { if (current() === entry) update({ status: 'ready', data, ...(warning ? { warning } : {}) }); return undefined },
51
+ cause => {
52
+ const error = cause instanceof Error ? cause.message : String(cause)
53
+ if (current() === entry) update({ status: 'error', data: entry.data, error })
54
+ return error
55
+ },
56
+ ).finally(() => { controllers.delete(controller); requests.delete(key) })
57
+ requests.set(key, result)
58
+ return result
59
+ }
60
+ const markets = (force = false): Promise<string | undefined> => {
61
+ if (!force && snapshot.markets) return Promise.resolve(undefined)
62
+ return load('markets', () => snapshot.markets, entry => publish({ ...snapshot, markets: entry }), async signal => ({ data: await api.pluginMarketplaces(signal) }))
63
+ }
64
+ const plugins = (id: string, force = false): Promise<string | undefined> => {
65
+ if (!force && snapshot.plugins[id]) return Promise.resolve(undefined)
66
+ return load(`plugins:${id}`, () => snapshot.plugins[id], entry => publish({ ...snapshot, plugins: { ...snapshot.plugins, [id]: entry } }), async signal => {
67
+ const result = await api.pluginCatalog(id, signal)
68
+ return Array.isArray(result) ? { data: result } : { data: result.plugins, warning: result.warning }
69
+ })
70
+ }
71
+ return {
72
+ subscribe: listener => { listeners.add(listener); return () => { listeners.delete(listener) } },
73
+ getSnapshot: () => snapshot,
74
+ start: () => { void markets() },
75
+ ensure: id => { void plugins(id) },
76
+ refresh: id => {
77
+ if (disposed || snapshot.refresh?.status === 'loading') return
78
+ // Refresh every previously visited catalog before unlocking navigation.
79
+ // Keep cached cards for layout continuity; views disable their controls.
80
+ const ids = new Set(Object.keys(snapshot.plugins))
81
+ if (id) ids.add(id)
82
+ publish({ ...snapshot, refresh: { status: 'loading' } })
83
+ void Promise.all([markets(true), ...[...ids].map(key => plugins(key, true))]).then(results => {
84
+ const errors = [...new Set(results.filter((value): value is string => value !== undefined))]
85
+ publish({ ...snapshot, refresh: errors.length ? { status: 'error', error: errors.join('\n') } : { status: 'ready' } })
86
+ })
87
+ },
88
+ dispose: () => { disposed = true; controllers.forEach(controller => controller.abort()); controllers.clear(); requests.clear(); listeners.clear() },
89
+ }
90
+ }
@@ -472,7 +472,7 @@ export function matchUrlTarget(tabs: readonly TabDescriptor[], url: URL): TabDes
472
472
  * The plugin version this service instance reports. Keep in lockstep with
473
473
  * `package.json`'s version — `tests/service.spec.ts` asserts the pair.
474
474
  */
475
- export const SIDEBAR_SERVICE_VERSION = '0.18.0-alpha.0'
475
+ export const SIDEBAR_SERVICE_VERSION = '0.18.0-alpha.4'
476
476
 
477
477
  /**
478
478
  * Monotonic capability list consumers use to gate new API usage (features
@@ -442,13 +442,11 @@
442
442
  box-sizing: border-box;
443
443
  gap: 8px;
444
444
  width: 100%;
445
- min-height: 52px;
446
- padding: 10px 14px max(10px, env(safe-area-inset-bottom));
445
+ min-height: 44px;
446
+ padding: 8px 12px max(8px, env(safe-area-inset-bottom));
447
447
  border-radius: 0;
448
448
  background: var(--dsw-alias-bg-layer-1);
449
- font-family: var(--dsw-font-family-body);
450
- font-size: var(--dsw-font-size-body-sm);
451
- line-height: var(--dsw-font-line-height-body-sm);
449
+ font: var(--dsw-font-xs-13);
452
450
  transition: background var(--ds-transition-duration-slow) var(--ds-ease-in-out);
453
451
  }
454
452
 
@@ -466,18 +464,21 @@
466
464
  .accountAvatar {
467
465
  position: relative;
468
466
  display: grid;
469
- width: 28px;
470
- height: 28px;
467
+ box-sizing: border-box;
468
+ width: 24px;
469
+ height: 24px;
471
470
  flex: none;
472
471
  place-items: center;
473
472
  border-radius: 50%;
474
473
  background: var(--dsw-alias-bg-layer-3);
475
474
  border: 1px solid var(--dsw-alias-border-l2);
476
475
  color: var(--dsw-alias-fg-accent);
476
+ font: var(--dsw-font-xxs-12);
477
477
  font-weight: 600;
478
478
  }
479
479
 
480
480
  .accountName {
481
+ min-width: 0;
481
482
  overflow: hidden;
482
483
  text-overflow: ellipsis;
483
484
  white-space: nowrap;
@@ -490,10 +491,10 @@
490
491
  left: 8px;
491
492
  display: grid;
492
493
  box-sizing: border-box;
493
- width: min(252px, calc(100% - 16px));
494
- padding: 10px 8px 8px;
494
+ width: min(224px, calc(100% - 16px));
495
+ padding: 8px 6px 6px;
495
496
  border: 1px solid var(--dsw-alias-border-l2);
496
- border-radius: 12px;
497
+ border-radius: 10px;
497
498
  background: var(--dsw-alias-bg-layer-2);
498
499
  z-index: 1;
499
500
  }
@@ -502,16 +503,15 @@
502
503
  display: flex;
503
504
  align-items: center;
504
505
  gap: 8px;
505
- min-height: 36px;
506
- padding: 0 8px 8px;
507
- font-family: var(--dsw-font-family-body);
508
- font-size: var(--dsw-font-size-body-sm);
509
- line-height: var(--dsw-font-line-height-body-sm);
506
+ min-width: 0;
507
+ min-height: 28px;
508
+ padding: 0 6px 6px;
509
+ font: var(--dsw-font-xs-13);
510
510
  }
511
511
 
512
512
  .accountMenuDivider {
513
513
  height: 1px;
514
- margin: 0 4px 6px;
514
+ margin: 0 4px 4px;
515
515
  background: var(--dsw-alias-border-l2);
516
516
  }
517
517
 
@@ -519,12 +519,12 @@
519
519
  display: flex;
520
520
  align-items: center;
521
521
  gap: 8px;
522
- min-height: 32px;
523
- padding: 0 10px;
522
+ min-height: 30px;
523
+ padding: 0 8px;
524
524
  border-radius: 7px;
525
525
  background: transparent;
526
526
  text-align: left;
527
- font: var(--dsw-font-s-14);
527
+ font: var(--dsw-font-xs-13);
528
528
  }
529
529
 
530
530
  .accountItem:hover {
@@ -546,6 +546,68 @@
546
546
  border-color: var(--dsw-alias-bg-layer-1);
547
547
  }
548
548
 
549
+ /* The native top layer is viewport-centered even though the account rail is positioned. */
550
+ .accountLogoutDialog {
551
+ box-sizing: border-box;
552
+ width: min(400px, calc(100vw - 32px));
553
+ max-width: calc(100vw - 32px);
554
+ max-height: calc(100dvh - 32px);
555
+ margin: auto;
556
+ padding: 24px;
557
+ overflow: auto;
558
+ border: 1px solid var(--dsw-alias-border-l2);
559
+ border-radius: 16px;
560
+ background: var(--dsw-alias-bg-layer-2);
561
+ color: var(--dsw-alias-fg-base);
562
+ font: var(--dsw-font-s-14);
563
+ }
564
+
565
+ .accountLogoutDialog::backdrop {
566
+ background: var(--dsw-alias-bg-mask-1);
567
+ }
568
+
569
+ .accountLogoutTitle {
570
+ margin: 0;
571
+ font: var(--dsw-font-base-strong-16);
572
+ }
573
+
574
+ .accountLogoutDescription {
575
+ margin: 12px 0 24px;
576
+ color: var(--dsw-alias-label-secondary);
577
+ }
578
+
579
+ .accountLogoutActions {
580
+ display: flex;
581
+ flex-wrap: wrap;
582
+ justify-content: flex-end;
583
+ gap: 8px;
584
+ }
585
+
586
+ .accountLogoutActions button {
587
+ min-height: 34px;
588
+ padding: 6px 14px;
589
+ border: 1px solid var(--dsw-alias-border-l2);
590
+ border-radius: 8px;
591
+ background: var(--dsw-alias-bg-layer-2);
592
+ color: var(--dsw-alias-fg-base);
593
+ font: var(--dsw-font-xs-13);
594
+ cursor: pointer;
595
+ }
596
+
597
+ .accountLogoutActions button:hover {
598
+ background: var(--dsw-alias-bg-hover);
599
+ }
600
+
601
+ .accountLogoutActions button:focus-visible {
602
+ outline: 2px solid var(--dsw-alias-border-accent);
603
+ outline-offset: 2px;
604
+ }
605
+
606
+ .accountLogoutActions .accountLogoutConfirm {
607
+ border-color: var(--dsw-alias-state-error-primary);
608
+ color: var(--dsw-alias-state-error-primary);
609
+ }
610
+
549
611
  /* The compatibility action cluster used when the host exposes no native
550
612
  right-sidebar affordance. It stays pinned to the viewport corner, sitting
551
613
  flush in the 34px tab strip (28px buttons at top: 3) whose right end it