@chatcode/cco-better-sidebar 0.18.0-alpha.3 → 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.
- package/README.md +24 -5
- package/README_EN.md +24 -5
- package/cordis.patch.yml +6 -5
- package/lib/client-editor.js +10919 -362
- package/lib/client-mermaid.js +10810 -275
- package/lib/client-registry.js +3760 -2145
- package/lib/client-terminal.js +402 -261
- package/lib/client.js +3758 -2143
- package/lib/index.js +264 -46
- package/lib/types/client/LogoutConfirmDialog.d.ts +5 -0
- package/lib/types/client/PluginMarketSettingsSection.d.ts +7 -0
- package/lib/types/client/PluginMarketView.d.ts +7 -0
- package/lib/types/client/PluginProjectPicker.d.ts +13 -0
- package/lib/types/client/api.d.ts +17 -0
- package/lib/types/client/builtins/tabs.d.ts +13 -1
- package/lib/types/client/icons.d.ts +26 -8
- package/lib/types/client/locales.d.ts +39 -0
- package/lib/types/client/plugin-market-catalog.d.ts +25 -0
- package/lib/types/client/service.d.ts +1 -1
- package/lib/types/client/ui-tweaks/archive.d.ts +3 -7
- package/lib/types/client/ui-tweaks/branding.d.ts +1 -1
- package/lib/types/client/ui-tweaks/index.d.ts +3 -3
- package/lib/types/client/ui-tweaks/sidebar-header.d.ts +6 -0
- package/lib/types/client/ui-tweaks/typography.d.ts +9 -0
- package/lib/types/config.d.ts +4 -3
- package/lib/types/context-types.d.ts +12 -14
- package/lib/types/login-page-script.d.ts +2 -0
- package/lib/types/login-route.d.ts +2 -0
- package/lib/types/plugin-market-api.d.ts +5 -0
- package/lib/types/plugin-market-shared.d.ts +59 -0
- package/lib/types/prefs-shared.d.ts +1 -1
- package/lib/types/pty-deps.d.ts +1 -1
- package/lib/types/ui-tweaks/config.d.ts +6 -7
- package/lib/types/ui-tweaks/index.d.ts +2 -3
- package/package.json +4 -3
- package/src/client/AccountMenu.tsx +12 -2
- package/src/client/BrowserView.tsx +1 -1
- package/src/client/DiffTab.tsx +1 -1
- package/src/client/EditorHost.tsx +1 -1
- package/src/client/FileTree.tsx +10 -5
- package/src/client/FreeWindow.tsx +2 -1
- package/src/client/GitView.tsx +7 -3
- package/src/client/LogoutConfirmDialog.tsx +39 -0
- package/src/client/PluginMarketSettingsSection.tsx +55 -0
- package/src/client/PluginMarketView.module.css +50 -0
- package/src/client/PluginMarketView.tsx +243 -0
- package/src/client/PluginProjectPicker.tsx +73 -0
- package/src/client/SideCardSection.tsx +2 -23
- package/src/client/Sidebar.tsx +2 -2
- package/src/client/TabBar.tsx +2 -4
- package/src/client/TextEditor.tsx +2 -1
- package/src/client/TreePanel.tsx +1 -2
- package/src/client/UsageHeatmapSection.tsx +1 -1
- package/src/client/api.ts +9 -0
- package/src/client/builtins/tabs.tsx +25 -5
- package/src/client/builtins/viewers.tsx +2 -1
- package/src/client/icons.tsx +57 -4
- package/src/client/index.tsx +10 -1
- package/src/client/intercept.tsx +1 -1
- package/src/client/locales-ja.ts +39 -0
- package/src/client/locales.ts +118 -1
- package/src/client/md-toc.tsx +1 -1
- package/src/client/mermaid.tsx +2 -1
- package/src/client/open-with-settings.tsx +1 -1
- package/src/client/plugin-market-catalog.ts +90 -0
- package/src/client/service.ts +1 -1
- package/src/client/sidebar.module.css +81 -19
- package/src/client/ui-tweaks/archive.tsx +6 -56
- package/src/client/ui-tweaks/branding.tsx +80 -28
- package/src/client/ui-tweaks/index.tsx +45 -108
- package/src/client/ui-tweaks/sidebar-header.ts +73 -0
- package/src/client/ui-tweaks/typography.ts +38 -0
- package/src/config.ts +22 -2
- package/src/context-types.ts +5 -15
- package/src/index.ts +24 -20
- package/src/login-page-script.ts +107 -0
- package/src/login-route.ts +7 -4
- package/src/plugin-market-api.ts +88 -0
- package/src/plugin-market-shared.ts +30 -0
- package/src/prefs-shared.ts +1 -1
- package/src/pty-deps.ts +2 -2
- package/src/ui-tweaks/config.ts +12 -12
- package/src/ui-tweaks/index.ts +7 -13
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.root { box-sizing: border-box; height: 100%; overflow: auto; padding: 4px; color: var(--dsw-alias-label-primary); font: var(--dsw-font-s-14); }
|
|
2
|
+
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
|
|
3
|
+
.head > span { box-sizing: border-box; min-width: 220px; max-width: 380px; flex: 1; }
|
|
4
|
+
.title { font-size: 16px; line-height: 24px; font-weight: 600; margin: 0; }
|
|
5
|
+
.subtitle, .project, .meta, .state { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); margin: 2px 0; }
|
|
6
|
+
.project { overflow-wrap: anywhere; }
|
|
7
|
+
.projectRow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
8
|
+
.projectRow > p { flex: 1; min-width: min(100%, 200px); }
|
|
9
|
+
.projectRow > button { flex-shrink: 0; }
|
|
10
|
+
.installPath { margin: 4px 0; overflow-wrap: anywhere; color: var(--dsw-alias-label-tertiary); font-size: 12px; line-height: 18px; }
|
|
11
|
+
.projectPicker { width: min(620px, calc(100vw - 32px)); }
|
|
12
|
+
.confirmPath { margin: 0; padding: 12px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; white-space: pre-wrap; }
|
|
13
|
+
.directoryPath { display: flex; align-items: center; gap: 8px; }
|
|
14
|
+
.directoryPath > span { flex: 1; min-width: 0; }
|
|
15
|
+
.directoryCrumbs { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
|
|
16
|
+
.directoryList { max-height: 320px; overflow: auto; min-height: 100px; }
|
|
17
|
+
.directoryList > button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: transparent; color: var(--dsw-alias-label-primary); font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
|
|
18
|
+
.directoryList > button:hover, .directoryList > button:focus-visible { background: var(--dsw-alias-interactive-bg-hover); }
|
|
19
|
+
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0 12px; }
|
|
20
|
+
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
|
21
|
+
.tabs button { white-space: nowrap; }
|
|
22
|
+
.tabs button[aria-pressed='true'] { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); font-weight: 600; }
|
|
23
|
+
.breadcrumb { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; color: var(--dsw-alias-label-secondary); overflow-wrap: anywhere; }
|
|
24
|
+
.breadcrumb button { flex-shrink: 0; white-space: nowrap; }
|
|
25
|
+
.breadcrumb > span:last-child { min-width: 0; }
|
|
26
|
+
.operation { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 16px; margin: 12px 0; border: 1px solid var(--dsw-alias-state-business-primary); border-radius: 10px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-state-business-primary); font-weight: 500; }
|
|
27
|
+
.operation > span:first-child { flex-shrink: 0; }
|
|
28
|
+
.operation > span:last-child { min-width: 0; overflow-wrap: anywhere; }
|
|
29
|
+
.warning { padding: 8px 10px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; margin: 10px 0; font-size: 12px; color: var(--dsw-alias-label-secondary); }
|
|
30
|
+
.error, .notice { font-size: 12px; padding: 8px 10px; border-radius: 8px; margin: 10px 0; overflow-wrap: anywhere; }
|
|
31
|
+
.error { color: var(--dsw-alias-state-danger-primary); background: var(--dsw-alias-state-danger-bg); }
|
|
32
|
+
.notice { color: var(--dsw-alias-state-success-primary); background: var(--dsw-alias-state-success-bg); }
|
|
33
|
+
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; margin-top: 12px; }
|
|
34
|
+
.card { display: flex; flex-direction: column; min-width: 0; min-height: 150px; padding: 12px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 10px; background: var(--dsw-alias-bg-layer-1); }
|
|
35
|
+
.cardHead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
36
|
+
.card h3 { font-size: 14px; line-height: 20px; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
|
|
37
|
+
.description { font-size: 12px; line-height: 18px; margin: 8px 0; flex: 1; color: var(--dsw-alias-label-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
|
|
38
|
+
.meta { min-height: 18px; overflow-wrap: anywhere; }
|
|
39
|
+
.actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
|
|
40
|
+
.projectInstall.projectInstall { background: var(--dsw-alias-button-primary-fill); color: var(--dsw-alias-label-primary-foreground); }
|
|
41
|
+
.projectInstall.projectInstall:hover:not(:disabled) { background-color: var(--dsw-alias-button-primary-fill) !important; color: var(--dsw-alias-label-primary-foreground) !important; }
|
|
42
|
+
.marketCard { text-align: left; color: inherit; font: inherit; cursor: pointer; width: 100%; }
|
|
43
|
+
.marketCard:hover:not(:disabled) { border-color: var(--dsw-alias-border-l1); background: var(--dsw-alias-interactive-bg-hover); }
|
|
44
|
+
.marketCard:disabled { cursor: not-allowed; opacity: 0.5; }
|
|
45
|
+
.spinning { display: inline-flex; animation: marketRefresh 1s linear infinite; }
|
|
46
|
+
@keyframes marketRefresh { to { transform: rotate(360deg); } }
|
|
47
|
+
@media (prefers-reduced-motion: reduce) { .spinning { animation: none; } }
|
|
48
|
+
.marketCard:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 2px; }
|
|
49
|
+
.enter { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 18px; }
|
|
50
|
+
@media (max-width: 640px) { .head { flex-direction: column; } .head > span { width: 100%; max-width: none; min-width: 0; } }
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/** Two catalog levels with project/user actions directly on plugin cards. */
|
|
2
|
+
import { useEffect, useRef, useState, useSyncExternalStore } from 'react'
|
|
3
|
+
import { Button, Input, Modal, Pill } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
+
import { api, type SessionScope } from './api.ts'
|
|
5
|
+
import { t } from './locales.ts'
|
|
6
|
+
import { IconChevronLeftOutline14, IconChevronRightOutline14, IconRefreshOutline14 } from './icons.tsx'
|
|
7
|
+
import type { PluginMarketCatalog } from './plugin-market-catalog.ts'
|
|
8
|
+
import type { InstalledMarketplacePlugin, MarketplacePlugin, PluginMarketScope } from '../plugin-market-shared.ts'
|
|
9
|
+
import css from './PluginMarketView.module.css'
|
|
10
|
+
import { PluginProjectPicker, type PluginProjectRequest } from './PluginProjectPicker.tsx'
|
|
11
|
+
|
|
12
|
+
interface ProjectInstallConfirmation { name: string; path: string; finish: (confirmed: boolean) => void }
|
|
13
|
+
|
|
14
|
+
export function PluginMarketView({ scope, visible, catalog }: { scope: SessionScope; visible: boolean; catalog: PluginMarketCatalog }): JSX.Element {
|
|
15
|
+
const snapshot = useSyncExternalStore(catalog.subscribe, catalog.getSnapshot)
|
|
16
|
+
const [marketId, setMarketId] = useState<string | null>(null)
|
|
17
|
+
const [tab, setTab] = useState<'markets' | 'installed'>('markets')
|
|
18
|
+
const [query, setQuery] = useState('')
|
|
19
|
+
const [recordState, setRecordState] = useState<{ key: string; records: InstalledMarketplacePlugin[]; ready: boolean; error: string }>()
|
|
20
|
+
const [message, setMessage] = useState<{ text: string; error: boolean }>()
|
|
21
|
+
const [working, setWorking] = useState<{ id: string; name: string; scope: PluginMarketScope; uninstall: boolean; confirming?: boolean }>()
|
|
22
|
+
const [confirmation, setConfirmation] = useState<ProjectInstallConfirmation>()
|
|
23
|
+
const confirmationRef = useRef<ProjectInstallConfirmation>()
|
|
24
|
+
const [selection, setSelection] = useState<{ key: string; path: string }>()
|
|
25
|
+
const [picker, setPicker] = useState<PluginProjectRequest>()
|
|
26
|
+
const pickerRef = useRef<PluginProjectRequest>()
|
|
27
|
+
const [revision, setRevision] = useState(0)
|
|
28
|
+
const pending = useRef(false)
|
|
29
|
+
const breadcrumbNode = useRef<HTMLDivElement>(null)
|
|
30
|
+
const mutationVersion = useRef(0)
|
|
31
|
+
const focusBack = useRef(false)
|
|
32
|
+
const scopeKey = `${scope.sessionId}\0${scope.cwd ?? ''}`
|
|
33
|
+
const projectPath = selection?.key === scopeKey ? selection.path : scope.cwd
|
|
34
|
+
const recordsKey = `${scopeKey}\0${projectPath ?? ''}`
|
|
35
|
+
const installed = recordState?.key === recordsKey ? recordState.records : []
|
|
36
|
+
const recordsReady = recordState?.key === recordsKey && recordState.ready
|
|
37
|
+
const recordsError = recordState?.key === recordsKey ? recordState.error : ''
|
|
38
|
+
const latestScope = useRef(scopeKey)
|
|
39
|
+
latestScope.current = scopeKey
|
|
40
|
+
const markets = snapshot.markets?.data?.marketplaces ?? []
|
|
41
|
+
const market = markets.find(item => item.id === marketId)
|
|
42
|
+
const catalogEntry = tab === 'markets' && marketId ? snapshot.plugins[marketId] : snapshot.markets
|
|
43
|
+
const loading = snapshot.refresh?.status === 'loading' || (tab === 'markets' && (!catalogEntry || catalogEntry.status === 'loading'))
|
|
44
|
+
const operating = !!working && !working.confirming
|
|
45
|
+
const blocked = loading || snapshot.refresh?.status === 'error' || !!working
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!visible) return
|
|
49
|
+
catalog.start()
|
|
50
|
+
if (tab === 'markets' && marketId) catalog.ensure(marketId)
|
|
51
|
+
}, [catalog, visible, tab, marketId])
|
|
52
|
+
useEffect(() => { setQuery('') }, [tab, marketId])
|
|
53
|
+
useEffect(() => { if (focusBack.current) { breadcrumbNode.current?.querySelector('button')?.focus(); focusBack.current = false } }, [marketId])
|
|
54
|
+
|
|
55
|
+
useEffect(() => { setMessage(undefined) }, [scopeKey])
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
confirmationRef.current?.finish(false)
|
|
58
|
+
confirmationRef.current = undefined
|
|
59
|
+
setConfirmation(undefined)
|
|
60
|
+
}, [scopeKey, visible])
|
|
61
|
+
useEffect(() => () => {
|
|
62
|
+
pickerRef.current?.controller.abort()
|
|
63
|
+
pickerRef.current?.finish(null)
|
|
64
|
+
confirmationRef.current?.finish(false)
|
|
65
|
+
}, [])
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!visible) return
|
|
68
|
+
const controller = new AbortController()
|
|
69
|
+
let active = true
|
|
70
|
+
let reading = false
|
|
71
|
+
const read = async (): Promise<void> => {
|
|
72
|
+
if (pending.current || reading) return
|
|
73
|
+
reading = true
|
|
74
|
+
const version = mutationVersion.current
|
|
75
|
+
try {
|
|
76
|
+
const records = await api.pluginsInstalled(scope, controller.signal, projectPath)
|
|
77
|
+
if (active && !pending.current && version === mutationVersion.current) setRecordState({ key: recordsKey, records, ready: true, error: '' })
|
|
78
|
+
} catch (cause) {
|
|
79
|
+
if (active && version === mutationVersion.current) setRecordState(previous => ({ key: recordsKey, records: previous?.key === recordsKey ? previous.records : [], ready: previous?.key === recordsKey && previous.ready, error: cause instanceof Error ? cause.message : String(cause) }))
|
|
80
|
+
} finally { reading = false }
|
|
81
|
+
}
|
|
82
|
+
void read()
|
|
83
|
+
// Only local installation records are polled for CLI synchronization.
|
|
84
|
+
// Remote catalogs are never polled or refreshed by navigation.
|
|
85
|
+
const timer = setInterval(() => { void read() }, 2000)
|
|
86
|
+
return () => { active = false; clearInterval(timer); controller.abort() }
|
|
87
|
+
}, [recordsKey, visible, revision])
|
|
88
|
+
|
|
89
|
+
const chooseDirectory = (): Promise<string | null> => new Promise(finish => {
|
|
90
|
+
const controller = new AbortController()
|
|
91
|
+
const request = { result: api.pluginProjectPick(controller.signal), controller, finish }
|
|
92
|
+
pickerRef.current = request
|
|
93
|
+
setPicker(request)
|
|
94
|
+
})
|
|
95
|
+
const finishPicker = (path: string | null): void => {
|
|
96
|
+
pickerRef.current?.finish(path)
|
|
97
|
+
pickerRef.current?.controller.abort()
|
|
98
|
+
pickerRef.current = undefined
|
|
99
|
+
setPicker(undefined)
|
|
100
|
+
}
|
|
101
|
+
const confirmProjectInstall = (name: string, path: string): Promise<boolean> => new Promise(finish => {
|
|
102
|
+
const request = { name, path, finish }
|
|
103
|
+
confirmationRef.current = request
|
|
104
|
+
setConfirmation(request)
|
|
105
|
+
})
|
|
106
|
+
const finishConfirmation = (confirmed: boolean): void => {
|
|
107
|
+
const request = confirmationRef.current
|
|
108
|
+
confirmationRef.current = undefined
|
|
109
|
+
setConfirmation(undefined)
|
|
110
|
+
request?.finish(confirmed)
|
|
111
|
+
}
|
|
112
|
+
const chooseProject = async (): Promise<void> => {
|
|
113
|
+
if (pending.current || blocked) return
|
|
114
|
+
pending.current = true
|
|
115
|
+
mutationVersion.current++
|
|
116
|
+
setMessage(undefined)
|
|
117
|
+
const key = scopeKey
|
|
118
|
+
try {
|
|
119
|
+
const path = await chooseDirectory()
|
|
120
|
+
if (path && latestScope.current === key) setSelection({ key, path })
|
|
121
|
+
} finally { pending.current = false; setRevision(value => value + 1) }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const perform = async (plugin: MarketplacePlugin, installScope: PluginMarketScope): Promise<void> => {
|
|
125
|
+
const refreshStatus = catalog.getSnapshot().refresh?.status
|
|
126
|
+
if (pending.current || !recordsReady || blocked || refreshStatus === 'loading' || refreshStatus === 'error') return
|
|
127
|
+
const key = scopeKey
|
|
128
|
+
const record = installed.find(item => item.id === plugin.id && item.scope === installScope)
|
|
129
|
+
const present = !!record
|
|
130
|
+
if (installScope === 'project' && !present && !projectPath) {
|
|
131
|
+
setMessage({ text: t('pluginMarketProjectHint'), error: true })
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
pending.current = true
|
|
135
|
+
mutationVersion.current++
|
|
136
|
+
const operation = { id: plugin.id, name: plugin.name, scope: installScope, uninstall: present }
|
|
137
|
+
setWorking({ ...operation, confirming: installScope === 'project' && !present })
|
|
138
|
+
setMessage(undefined)
|
|
139
|
+
try {
|
|
140
|
+
let target = record?.scope === 'project' ? record.projectPath : projectPath
|
|
141
|
+
if (installScope === 'project' && !present) {
|
|
142
|
+
const confirmed = await confirmProjectInstall(plugin.name, target!)
|
|
143
|
+
if (!confirmed || latestScope.current !== key) return
|
|
144
|
+
setWorking(operation)
|
|
145
|
+
}
|
|
146
|
+
let installedPath = ''
|
|
147
|
+
if (present) await api.pluginUninstall(scope, plugin.id, installScope, target)
|
|
148
|
+
else {
|
|
149
|
+
const result = await api.pluginInstall(scope, plugin.id, installScope, target)
|
|
150
|
+
installedPath = result.installPath
|
|
151
|
+
if (installScope === 'project') {
|
|
152
|
+
target = result.projectPath
|
|
153
|
+
if (latestScope.current === key) setSelection({ key, path: target })
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const records = await api.pluginsInstalled(scope, undefined, target)
|
|
157
|
+
if (latestScope.current === key) {
|
|
158
|
+
setRecordState({ key: `${key}\0${target ?? ''}`, records, ready: true, error: '' })
|
|
159
|
+
setMessage({ text: present ? t('pluginMarketUninstalled') : t('pluginMarketInstalledAt', { path: installedPath }), error: false })
|
|
160
|
+
}
|
|
161
|
+
} catch (cause) {
|
|
162
|
+
if (latestScope.current === key) setMessage({ text: cause instanceof Error ? cause.message : String(cause), error: true })
|
|
163
|
+
} finally { pending.current = false; setWorking(undefined); setRevision(value => value + 1) }
|
|
164
|
+
}
|
|
165
|
+
const refresh = (): void => {
|
|
166
|
+
if (loading || pending.current) return
|
|
167
|
+
catalog.refresh(tab === 'markets' && marketId ? marketId : undefined)
|
|
168
|
+
setRevision(value => value + 1)
|
|
169
|
+
setMessage(undefined)
|
|
170
|
+
}
|
|
171
|
+
const term = query.trim().toLocaleLowerCase()
|
|
172
|
+
const matches = (item: { name: string; description: string }): boolean => `${item.name} ${item.description}`.toLocaleLowerCase().includes(term)
|
|
173
|
+
// One installed card per plugin, with independent controls for both scopes.
|
|
174
|
+
const entries = tab === 'installed' ? [...new Map(installed.map(item => [item.id, item])).values()] : marketId ? snapshot.plugins[marketId]?.data ?? [] : []
|
|
175
|
+
const filteredPlugins = entries.filter(matches)
|
|
176
|
+
const filteredMarkets = markets.filter(matches)
|
|
177
|
+
const showMarkets = tab === 'markets' && !marketId
|
|
178
|
+
const error = snapshot.refresh?.error || (tab === 'markets' ? catalogEntry?.error : '') || recordsError
|
|
179
|
+
const warning = [snapshot.markets?.data?.warning, marketId ? snapshot.plugins[marketId]?.warning : ''].filter(Boolean).join('\n')
|
|
180
|
+
const hasData = tab === 'installed' ? recordsReady : !!catalogEntry?.data
|
|
181
|
+
|
|
182
|
+
return <section className={css.root} aria-label={t('pluginMarketTitle')} aria-busy={loading || operating} data-chatcode-plugin-market>
|
|
183
|
+
<header className={css.head}>
|
|
184
|
+
<div><h2 className={css.title}>{t('pluginMarketTitle')}</h2><p className={css.subtitle}>{t('pluginMarketSubtitle')}</p></div>
|
|
185
|
+
<Input disabled={blocked} value={query} onChange={event => setQuery(event.target.value)} placeholder={t('pluginMarketSearch')} aria-label={t('pluginMarketSearch')} />
|
|
186
|
+
</header>
|
|
187
|
+
<div className={css.projectRow}>
|
|
188
|
+
<p className={css.project}>{projectPath ? t('pluginMarketProjectDirectory', { path: projectPath }) : t('pluginMarketProjectHint')}</p>
|
|
189
|
+
<Button size="sm" variant="outline" disabled={blocked || !!working || !!picker} onClick={() => { void chooseProject() }}>{t('pluginMarketChooseProject')}</Button>
|
|
190
|
+
</div>
|
|
191
|
+
<div className={css.toolbar}>
|
|
192
|
+
<div className={css.tabs}>
|
|
193
|
+
<Button size="sm" variant="ghost" disabled={blocked} aria-pressed={tab === 'markets'} onClick={() => setTab('markets')}>{t('pluginMarketTitle')}</Button>
|
|
194
|
+
<Button size="sm" variant="ghost" disabled={blocked} aria-pressed={tab === 'installed'} onClick={() => setTab('installed')}>{t('pluginMarketInstalledTab')}</Button>
|
|
195
|
+
</div>
|
|
196
|
+
<Button size="sm" variant="outline" aria-label={t('pluginMarketRefresh')} disabled={snapshot.markets?.status === 'loading' || loading || !!working} onClick={refresh}><span aria-hidden="true" className={loading ? css.spinning : undefined}><IconRefreshOutline14 /></span>{t(loading ? 'pluginMarketRefreshing' : 'pluginMarketRefresh')}</Button>
|
|
197
|
+
</div>
|
|
198
|
+
{operating ? <div className={css.operation} role="status">
|
|
199
|
+
<span className={css.spinning} aria-hidden="true"><IconRefreshOutline14 /></span>
|
|
200
|
+
<span>{t(working.uninstall ? 'pluginMarketUninstallProgress' : 'pluginMarketInstallProgress', { name: working.name })}</span>
|
|
201
|
+
</div> : null}
|
|
202
|
+
{warning && tab === 'markets' ? <p className={css.warning} role="status">{warning}</p> : null}
|
|
203
|
+
{error ? <p className={css.error} role="status">{error}</p> : null}
|
|
204
|
+
{message ? <p className={message.error ? css.error : css.notice} role="status">{message.text}</p> : null}
|
|
205
|
+
{tab === 'markets' && marketId ? <div ref={breadcrumbNode} className={css.breadcrumb}>
|
|
206
|
+
<Button size="sm" variant="ghost" disabled={blocked} onClick={() => setMarketId(null)}><IconChevronLeftOutline14 />{t('pluginMarketBack')}</Button>
|
|
207
|
+
<span aria-hidden="true">/</span><span>{market?.name ?? marketId}</span>
|
|
208
|
+
</div> : null}
|
|
209
|
+
{loading ? <p className={css.state} role="status">{t(hasData ? 'pluginMarketRefreshing' : 'pluginMarketLoading')}</p> : null}
|
|
210
|
+
<div className={css.grid} aria-busy={loading || operating}>
|
|
211
|
+
{showMarkets ? filteredMarkets.map(item => <button key={item.id} type="button" disabled={blocked} className={`${css.card} ${css.marketCard}`} onClick={() => { focusBack.current = true; setMarketId(item.id) }}>
|
|
212
|
+
<div className={css.cardHead}><h3>{item.name}</h3>{item.official ? <Pill>{t('pluginMarketDefault')}</Pill> : null}</div>
|
|
213
|
+
<p className={css.description}>{item.description || t('pluginMarketNoDescription')}</p>
|
|
214
|
+
<span className={css.enter}>{t('pluginMarketBrowse')}<IconChevronRightOutline14 /></span>
|
|
215
|
+
</button>) : filteredPlugins.map(item => {
|
|
216
|
+
const records = installed.filter(record => record.id === item.id)
|
|
217
|
+
const marketName = markets.find(value => value.id === item.marketplaceId)?.name ?? item.marketplaceId
|
|
218
|
+
return <article key={item.id} className={css.card} aria-label={item.name} data-plugin-id={item.id}>
|
|
219
|
+
<div className={css.cardHead}><h3>{item.name}</h3>{records.length ? <Pill>{t('pluginMarketInstalledTab')}</Pill> : null}</div>
|
|
220
|
+
<p className={css.description}>{item.description || t('pluginMarketNoDescription')}</p>
|
|
221
|
+
<p className={css.meta}>{marketName}{tab === 'installed' && records[0]?.version ? ` · ${records[0].version}` : ''}</p>
|
|
222
|
+
{records.map(record => <p key={record.scope} className={css.installPath}>{t('pluginMarketInstallPath', { scope: t(record.scope === 'project' ? 'pluginMarketProject' : 'pluginMarketUser'), path: record.installPath })}</p>)}
|
|
223
|
+
<div className={css.actions}>
|
|
224
|
+
{(['project', 'user'] as const).map(installScope => {
|
|
225
|
+
const present = records.some(record => record.scope === installScope)
|
|
226
|
+
const busy = working?.id === item.id && working.scope === installScope
|
|
227
|
+
return <Button key={installScope} size="sm" variant={installScope === 'project' && !present ? 'primary' : 'outline'} className={installScope === 'project' && !present ? css.projectInstall : undefined} disabled={blocked || !!working || !recordsReady} onClick={() => { void perform(item, installScope) }}>
|
|
228
|
+
{busy && operating ? <span className={css.spinning} aria-hidden="true"><IconRefreshOutline14 /></span> : null}
|
|
229
|
+
{t(busy ? working?.confirming ? 'pluginMarketAwaitingConfirmation' : working?.uninstall ? 'pluginMarketUninstalling' : 'pluginMarketInstalling' : present ? 'pluginMarketUninstall' : 'pluginMarketInstall')} · {t(installScope === 'project' ? 'pluginMarketProject' : 'pluginMarketUser')}
|
|
230
|
+
</Button>
|
|
231
|
+
})}
|
|
232
|
+
</div>
|
|
233
|
+
</article>
|
|
234
|
+
})}
|
|
235
|
+
</div>
|
|
236
|
+
{!loading && hasData && (showMarkets ? filteredMarkets : filteredPlugins).length === 0 ? <p className={css.state}>{t('pluginMarketEmpty')}</p> : null}
|
|
237
|
+
{confirmation ? <Modal open title={t('pluginMarketConfirmProjectInstall')} description={t('pluginMarketConfirmProjectDescription', { name: confirmation.name })} closeLabel={t('cancel')} onClose={() => finishConfirmation(false)} className={css.projectPicker}
|
|
238
|
+
footer={<><Button variant="outline" data-modal-autofocus onClick={() => finishConfirmation(false)}>{t('cancel')}</Button><Button variant="primary" onClick={() => finishConfirmation(true)}>{t('pluginMarketConfirmInstall')}</Button></>}>
|
|
239
|
+
<p className={css.confirmPath}>{confirmation.path}</p>
|
|
240
|
+
</Modal> : null}
|
|
241
|
+
{picker ? <PluginProjectPicker request={picker} initialPath={projectPath} onPicked={finishPicker} onCancel={() => finishPicker(null)} onError={text => { setMessage({ text, error: true }); finishPicker(null) }} /> : null}
|
|
242
|
+
</section>
|
|
243
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Native chooser first; the host browse backend supplies the remote Web dialog. */
|
|
2
|
+
import { useEffect, useRef, useState } from 'react'
|
|
3
|
+
import { Button, Input, Modal } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
+
import { api } from './api.ts'
|
|
5
|
+
import { t } from './locales.ts'
|
|
6
|
+
import { IconFolderOpen16 } from './icons.tsx'
|
|
7
|
+
import type { PluginProjectDirectories, PluginProjectPick } from '../plugin-market-shared.ts'
|
|
8
|
+
import css from './PluginMarketView.module.css'
|
|
9
|
+
|
|
10
|
+
export interface PluginProjectRequest {
|
|
11
|
+
result: Promise<PluginProjectPick>
|
|
12
|
+
controller: AbortController
|
|
13
|
+
finish: (path: string | null) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function PluginProjectPicker({ request, initialPath, onPicked, onCancel, onError }: {
|
|
17
|
+
request: PluginProjectRequest
|
|
18
|
+
initialPath?: string
|
|
19
|
+
onPicked: (path: string) => void
|
|
20
|
+
onCancel: () => void
|
|
21
|
+
onError: (message: string) => void
|
|
22
|
+
}): JSX.Element | null {
|
|
23
|
+
const [browse, setBrowse] = useState(false)
|
|
24
|
+
const [path, setPath] = useState(initialPath ?? '')
|
|
25
|
+
const [draft, setDraft] = useState(initialPath ?? '')
|
|
26
|
+
const [listing, setListing] = useState<PluginProjectDirectories>()
|
|
27
|
+
const [loading, setLoading] = useState(true)
|
|
28
|
+
const [error, setError] = useState('')
|
|
29
|
+
const [revision, setRevision] = useState(0)
|
|
30
|
+
const callbacks = useRef({ onPicked, onCancel, onError })
|
|
31
|
+
callbacks.current = { onPicked, onCancel, onError }
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
let active = true
|
|
34
|
+
void request.result.then(result => {
|
|
35
|
+
if (!active) return
|
|
36
|
+
if (result.kind === 'browse') setBrowse(true)
|
|
37
|
+
else if (result.path === null) callbacks.current.onCancel()
|
|
38
|
+
else callbacks.current.onPicked(result.path)
|
|
39
|
+
}).catch(cause => { if (active) callbacks.current.onError(cause instanceof Error ? cause.message : String(cause)) })
|
|
40
|
+
return () => { active = false }
|
|
41
|
+
}, [request])
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!browse) return
|
|
44
|
+
const controller = new AbortController()
|
|
45
|
+
let active = true
|
|
46
|
+
setLoading(true); setListing(undefined); setError('')
|
|
47
|
+
void api.pluginProjectDirectories(path || undefined, controller.signal).then(value => {
|
|
48
|
+
if (active) { setListing(value); setDraft(value.path); setLoading(false) }
|
|
49
|
+
}).catch(cause => {
|
|
50
|
+
if (active) { setError(cause instanceof Error ? cause.message : String(cause)); setLoading(false) }
|
|
51
|
+
})
|
|
52
|
+
return () => { active = false; controller.abort() }
|
|
53
|
+
}, [browse, path, revision])
|
|
54
|
+
const navigate = (next: string): void => { setLoading(true); setListing(undefined); setPath(next); setRevision(value => value + 1) }
|
|
55
|
+
if (!browse) return null
|
|
56
|
+
return <Modal open title={t('pluginMarketChooseProject')} description={t('pluginMarketProjectHint')} closeLabel={t('cancel')} onClose={onCancel} className={css.projectPicker}
|
|
57
|
+
footer={<><Button variant="outline" onClick={onCancel}>{t('cancel')}</Button><Button variant="primary" disabled={loading || !listing} onClick={() => { if (listing) onPicked(listing.path) }}>{t('pluginMarketSelectDirectory')}</Button></>}>
|
|
58
|
+
<form className={css.directoryPath} onSubmit={event => { event.preventDefault(); navigate(draft) }}>
|
|
59
|
+
<Input data-modal-autofocus disabled={loading} aria-label={t('pluginMarketDirectoryPath')} value={draft} onChange={event => setDraft(event.target.value)} />
|
|
60
|
+
<Button type="submit" variant="outline" disabled={loading}>{t('pluginMarketOpenDirectory')}</Button>
|
|
61
|
+
</form>
|
|
62
|
+
<nav className={css.directoryCrumbs} aria-label={t('pluginMarketDirectoryPath')}>
|
|
63
|
+
<Button size="sm" variant="ghost" disabled={loading} onClick={() => navigate('')}>{t('pluginMarketHomeDirectory')}</Button>
|
|
64
|
+
{listing?.crumbs.map(crumb => <Button key={crumb.path} size="sm" variant="ghost" disabled={loading} onClick={() => navigate(crumb.path)}>{crumb.name}</Button>)}
|
|
65
|
+
</nav>
|
|
66
|
+
{error ? <p className={css.error} role="alert">{error}</p> : null}
|
|
67
|
+
{loading ? <p className={css.state} role="status">{t('pluginMarketLoading')}</p> : null}
|
|
68
|
+
<div className={css.directoryList} aria-busy={loading}>
|
|
69
|
+
{listing?.entries.map(entry => <button key={entry.path} type="button" onClick={() => navigate(entry.path)}><IconFolderOpen16 />{entry.name}</button>)}
|
|
70
|
+
</div>
|
|
71
|
+
{listing?.truncated ? <p className={css.state}>{t('pluginMarketDirectoryTruncated')}</p> : null}
|
|
72
|
+
</Modal>
|
|
73
|
+
}
|
|
@@ -41,14 +41,7 @@
|
|
|
41
41
|
* shell.
|
|
42
42
|
*/
|
|
43
43
|
import { Fragment, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
|
44
|
-
import {
|
|
45
|
-
IconChevronDownOutline14,
|
|
46
|
-
IconPlusOutline16,
|
|
47
|
-
IconSettingsOutline16,
|
|
48
|
-
Input,
|
|
49
|
-
Menu,
|
|
50
|
-
Modal,
|
|
51
|
-
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
44
|
+
import { Input, Menu, Modal } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
52
45
|
import clsx from 'clsx'
|
|
53
46
|
// Type-only: pulls the settings shell's SlotMap merges ('settings.section').
|
|
54
47
|
import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
@@ -63,13 +56,9 @@ import {
|
|
|
63
56
|
type TitleBarScheme,
|
|
64
57
|
} from '../prefs-shared.ts'
|
|
65
58
|
import { api } from './api.ts'
|
|
59
|
+
import { IconChevronDownOutline14, IconPlusOutline16, IconSettingsOutline16 } from './icons.tsx'
|
|
66
60
|
import { parsePrefs } from './prefs.ts'
|
|
67
61
|
import { AddPluginModal, type PluginKind } from './add-plugin-modal.tsx'
|
|
68
|
-
import {
|
|
69
|
-
CODING_PLAN_SELECTED_MODEL_KEY,
|
|
70
|
-
CODING_PLAN_SETTINGS_ID,
|
|
71
|
-
CodingPlanModelsSettings,
|
|
72
|
-
} from './CodingPlanModelsSettings.tsx'
|
|
73
62
|
import { t } from './locales.ts'
|
|
74
63
|
import { parseDesktopEnv } from './desktop-env.ts'
|
|
75
64
|
import { getShellPreset, getShellPresets } from './shell-presets.ts'
|
|
@@ -966,16 +955,6 @@ export function SideCardSection({ store, service }: SideCardSectionProps) {
|
|
|
966
955
|
</div>
|
|
967
956
|
</div>
|
|
968
957
|
|
|
969
|
-
{/* CodingPlan lives in the established settings page rather than a
|
|
970
|
-
separate sidebar tab. The catalogue itself is fetched/cached by the
|
|
971
|
-
host, and its selected logical id persists in pluginSettings. */}
|
|
972
|
-
<CodingPlanModelsSettings
|
|
973
|
-
selectedModelId={typeof prefs.pluginSettings[CODING_PLAN_SETTINGS_ID]?.[CODING_PLAN_SELECTED_MODEL_KEY] === 'string'
|
|
974
|
-
? prefs.pluginSettings[CODING_PLAN_SETTINGS_ID]?.[CODING_PLAN_SELECTED_MODEL_KEY] as string
|
|
975
|
-
: undefined}
|
|
976
|
-
onSelect={(modelId) => { applyPluginSetting(CODING_PLAN_SETTINGS_ID, CODING_PLAN_SELECTED_MODEL_KEY, modelId) }}
|
|
977
|
-
/>
|
|
978
|
-
|
|
979
958
|
{/* 侧边栏内容: one small card per registered tab type in a responsive
|
|
980
959
|
grid; features declaring `settings.toggles` open their settings in
|
|
981
960
|
the popup (gear corner button) instead of nested inline rows. */}
|
package/src/client/Sidebar.tsx
CHANGED
|
@@ -36,7 +36,7 @@ import { createElement, memo, useCallback, useEffect, useMemo, useRef, useState,
|
|
|
36
36
|
import { useSyncExternalStore } from 'react'
|
|
37
37
|
import { createPortal } from 'react-dom'
|
|
38
38
|
import clsx from 'clsx'
|
|
39
|
-
import {
|
|
39
|
+
import { Tooltip } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
40
40
|
import type { Context } from '../context-types.ts'
|
|
41
41
|
import { appendToDraft } from './conversation-draft.ts'
|
|
42
42
|
import {
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
type DropZone, type SidebarState, type SidebarStore, type SidebarTab, type SplitNode,
|
|
48
48
|
} from './state.ts'
|
|
49
49
|
import { collectPinnedTabs, createPinnedVirtualTab, getPinnedHomeScope, injectPinnedIntoTree, isPinnedVirtualId, isPinnedVirtualTab, parsePinnedVirtualId, type PinnedTabEntry } from './pinned.ts'
|
|
50
|
-
import { IconBookOutline16, IconPinOutline16 } from './icons.tsx'
|
|
50
|
+
import { IconBookOutline16, IconCloseFill14, IconPinOutline16 } from './icons.tsx'
|
|
51
51
|
import { IconPanelBottomOutline16, IconPanelRightOutline16 } from './icons.tsx'
|
|
52
52
|
import { Workbench, type WorkbenchActions } from './split-pane.tsx'
|
|
53
53
|
import { isNarrowWidth, useViewportSize } from './breakpoints.ts'
|
package/src/client/TabBar.tsx
CHANGED
|
@@ -10,13 +10,11 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
|
12
12
|
import clsx from 'clsx'
|
|
13
|
-
import {
|
|
14
|
-
IconCloseFill14, IconPlusOutline16, Menu,
|
|
15
|
-
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
13
|
+
import { Menu } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
16
14
|
import type { SidebarTab } from './state.ts'
|
|
17
15
|
import { isAgentTabId } from './state.ts'
|
|
18
16
|
import { isPinnedVirtualTab } from './pinned.ts'
|
|
19
|
-
import { IconPinOutline16 } from './icons.tsx'
|
|
17
|
+
import { IconCloseFill14, IconPinOutline16, IconPlusOutline16 } from './icons.tsx'
|
|
20
18
|
import { t } from './locales.ts'
|
|
21
19
|
import css from './sidebar.module.css'
|
|
22
20
|
|
|
@@ -19,7 +19,8 @@ import clsx from 'clsx'
|
|
|
19
19
|
import { EditorState } from '@codemirror/state'
|
|
20
20
|
import { EditorView as CodeMirrorView, keymap, lineNumbers } from '@codemirror/view'
|
|
21
21
|
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands'
|
|
22
|
-
import {
|
|
22
|
+
import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
23
|
+
import { IconCheckOutline16 } from './icons.tsx'
|
|
23
24
|
import { markdownTextProps } from './markdown-labels.tsx'
|
|
24
25
|
import { api, htmlUrl } from './api.ts'
|
|
25
26
|
import { rewriteLocalImageUrls } from './markdown-images.ts'
|
package/src/client/TreePanel.tsx
CHANGED
|
@@ -17,11 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { useEffect, useRef, useState, type InputHTMLAttributes } from 'react'
|
|
19
19
|
import clsx from 'clsx'
|
|
20
|
-
import { IconFolderOpen16, IconRefreshOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
21
20
|
import { api } from './api.ts'
|
|
22
21
|
import type { SidebarStore } from './state.ts'
|
|
23
22
|
import { FileTree } from './FileTree.tsx'
|
|
24
|
-
import { IconUploadOutline16 } from './icons.tsx'
|
|
23
|
+
import { IconFolderOpen16, IconRefreshOutline16, IconUploadOutline16 } from './icons.tsx'
|
|
25
24
|
import type { OpenWithTarget } from './open-with.ts'
|
|
26
25
|
import { t } from './locales.ts'
|
|
27
26
|
import { resolveSidebarPath } from './produced-files.ts'
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
IconChevronRightOutline14,
|
|
5
5
|
IconLoadingOutline16,
|
|
6
6
|
IconRefreshOutline14,
|
|
7
|
-
} from '
|
|
7
|
+
} from './icons.tsx'
|
|
8
8
|
import clsx from 'clsx'
|
|
9
9
|
// Type-only: pulls the settings shell's SlotMap merges ('settings.section').
|
|
10
10
|
import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
|
package/src/client/api.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { encodeHtmlUrl } from '../html-route.ts'
|
|
10
10
|
import type { BrowserProbeResult } from './browser.ts'
|
|
11
|
+
import type { MarketplaceCatalog, MarketplacePlugin, InstalledMarketplacePlugin, PluginMarketScope, PluginProjectPick, PluginProjectDirectories } from '../plugin-market-shared.ts'
|
|
11
12
|
|
|
12
13
|
/** One wire failure. */
|
|
13
14
|
export class SidebarApiError extends Error {
|
|
@@ -287,6 +288,14 @@ function gitPayload(scope: SessionScope, worktree: string | undefined, extra: Re
|
|
|
287
288
|
|
|
288
289
|
/** The sidebar API surface (session scope threaded through every call). */
|
|
289
290
|
export const api = {
|
|
291
|
+
pluginMarketContext: (scope: SessionScope, signal?: AbortSignal) => call<{ sessionId: string; cwd?: string }>('plugins.context', scopePayload(scope, {}), signal),
|
|
292
|
+
pluginProjectPick: (signal?: AbortSignal) => call<PluginProjectPick>('plugins.project.pick', {}, signal),
|
|
293
|
+
pluginProjectDirectories: (path?: string, signal?: AbortSignal) => call<PluginProjectDirectories>('plugins.project.directories', { path }, signal),
|
|
294
|
+
pluginMarketplaces: (signal?: AbortSignal) => call<MarketplaceCatalog>('plugins.marketplaces', {}, signal),
|
|
295
|
+
pluginCatalog: (marketplaceId: string, signal?: AbortSignal) => call<MarketplacePlugin[] | { plugins: MarketplacePlugin[]; warning: string }>('plugins.catalog', { marketplaceId, includeMetadata: true }, signal),
|
|
296
|
+
pluginsInstalled: (scope: SessionScope, signal?: AbortSignal, projectPath?: string) => call<InstalledMarketplacePlugin[]>('plugins.installed', scopePayload(scope, { projectPath }), signal),
|
|
297
|
+
pluginInstall: (scope: SessionScope, pluginId: string, installScope: PluginMarketScope, projectPath?: string) => call<InstalledMarketplacePlugin>('plugins.install', scopePayload(scope, { pluginId, scope: installScope, projectPath })),
|
|
298
|
+
pluginUninstall: (scope: SessionScope, pluginId: string, installScope: PluginMarketScope, projectPath?: string) => call<{ ok: true }>('plugins.uninstall', scopePayload(scope, { pluginId, scope: installScope, projectPath })),
|
|
290
299
|
chatcodeStatus: (signal?: AbortSignal) => call<ChatCodeAuthState>('chatcode.status', {}, signal),
|
|
291
300
|
chatcodeStart: () => call<{ sessionId: string; url: string }>('chatcode.start', {}),
|
|
292
301
|
chatcodeCancel: (sessionId: string) => call<{ ok: true }>('chatcode.cancel', { sessionId }),
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
* (editor / git / terminal / browser / diff) through
|
|
2
|
+
* The 6 built-in tab descriptors: the plugin registers its own pages
|
|
3
|
+
* (editor / git / terminal / browser / diff / plugin-market) through
|
|
4
4
|
* the same {@link BetterSidebarService} external plugins use — eating its
|
|
5
5
|
* own dogfood. The terminal descriptor owns its quota (`TERMINAL_LIMIT`)
|
|
6
6
|
* and mints `terminal:<uuid>` ids through `createTab`; the browser mints
|
|
7
7
|
* `browser:<n>` the same way (no quota). The editor IS the files window
|
|
8
8
|
* (the old standalone explorer merged into it).
|
|
9
9
|
*/
|
|
10
|
-
import { IconBranchOutline16, IconCodeOutline16, IconFolderOpen16, IconPanelLeftOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
11
10
|
import type { Context } from '../../context-types.ts'
|
|
12
11
|
import { allLeaves, isAgentTabId, type SidebarState } from '../state.ts'
|
|
13
12
|
import { t } from '../locales.ts'
|
|
@@ -18,7 +17,17 @@ import { lazyChunkComponent } from '../lazy-chunk.tsx'
|
|
|
18
17
|
import { GitView } from '../GitView.tsx'
|
|
19
18
|
import { DiffTab } from '../DiffTab.tsx'
|
|
20
19
|
import { BrowserView } from '../BrowserView.tsx'
|
|
21
|
-
import {
|
|
20
|
+
import { PluginMarketView } from '../PluginMarketView.tsx'
|
|
21
|
+
import { createPluginMarketCatalog, type PluginMarketCatalog } from '../plugin-market-catalog.ts'
|
|
22
|
+
import {
|
|
23
|
+
IconBranchOutline16,
|
|
24
|
+
IconCodeOutline16,
|
|
25
|
+
IconDiffOutline16,
|
|
26
|
+
IconFolderOpen16,
|
|
27
|
+
IconGlobeOutline16,
|
|
28
|
+
IconPanelLeftOutline16,
|
|
29
|
+
IconTerminalOutline16,
|
|
30
|
+
} from '../icons.tsx'
|
|
22
31
|
import { TERMINAL_FONT_SIZE_MAX, TERMINAL_FONT_SIZE_MIN } from '../../prefs-shared.ts'
|
|
23
32
|
import type { ComponentType } from 'react'
|
|
24
33
|
import type { SessionScope } from '../api.ts'
|
|
@@ -56,6 +65,8 @@ export const TERMINAL_LIMIT = 3
|
|
|
56
65
|
export interface BuiltinTabOptions {
|
|
57
66
|
/** Returns the display title for newly opened terminal tabs. */
|
|
58
67
|
terminalTitle?: () => string
|
|
68
|
+
/** Shared app-lifetime catalog; production supplies the activation's store. */
|
|
69
|
+
pluginMarketCatalog?: PluginMarketCatalog
|
|
59
70
|
}
|
|
60
71
|
|
|
61
72
|
/** A client-side uuid for terminal tab identity (not shown in the UI). */
|
|
@@ -73,8 +84,9 @@ function uiTerminalCount(state: SidebarState): number {
|
|
|
73
84
|
.filter(tab => tab.type === 'terminal' && !isAgentTabId(tab.id)).length
|
|
74
85
|
}
|
|
75
86
|
|
|
76
|
-
/** The
|
|
87
|
+
/** The 6 built-in tab descriptors. */
|
|
77
88
|
export function builtinTabs(ctx: Context, options: BuiltinTabOptions = {}): readonly TabDescriptor[] {
|
|
89
|
+
const pluginMarketCatalog = options.pluginMarketCatalog ?? createPluginMarketCatalog()
|
|
78
90
|
return [
|
|
79
91
|
{
|
|
80
92
|
id: 'editor',
|
|
@@ -259,6 +271,14 @@ export function builtinTabs(ctx: Context, options: BuiltinTabOptions = {}): read
|
|
|
259
271
|
}),
|
|
260
272
|
component: (props) => <BrowserView {...props} />,
|
|
261
273
|
},
|
|
274
|
+
{
|
|
275
|
+
id: 'plugin-market',
|
|
276
|
+
title: () => t('pluginMarketTitle'),
|
|
277
|
+
icon: (size: number) => <IconGlobeOutline16 size={size} />,
|
|
278
|
+
order: 60,
|
|
279
|
+
single: true,
|
|
280
|
+
component: ({ scope, visible }) => <PluginMarketView scope={scope} visible={visible} catalog={pluginMarketCatalog} />,
|
|
281
|
+
},
|
|
262
282
|
{
|
|
263
283
|
id: 'diff',
|
|
264
284
|
title: () => t('git'),
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
* and `icon` — so the Side card settings page can render the enable/disable
|
|
23
23
|
* inventory without hardcoding (eating our own dogfood).
|
|
24
24
|
*/
|
|
25
|
-
import { IconCodeOutline16, IconDownloadOutline16 } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
26
25
|
import { lazyChunkComponent } from '../lazy-chunk.tsx'
|
|
27
26
|
import { PdfView } from '../PdfView.tsx'
|
|
28
27
|
import { BinaryDownload } from '../binary-download.tsx'
|
|
29
28
|
import {
|
|
29
|
+
IconCodeOutline16,
|
|
30
|
+
IconDownloadOutline16,
|
|
30
31
|
IconImageOutline16,
|
|
31
32
|
IconMarkdownOutline16,
|
|
32
33
|
IconPdfOutline16,
|