@chatcode/cco-better-sidebar 0.18.0-alpha.3 → 0.18.0-rc.2
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 +3 -3
- package/README_EN.md +3 -3
- package/cordis.patch.yml +6 -5
- package/lib/client-editor.js +10678 -262
- package/lib/client-mermaid.js +10703 -290
- package/lib/client-registry.js +2292 -1654
- package/lib/client-terminal.js +261 -261
- package/lib/client.js +2296 -1658
- package/lib/index.js +61 -40
- package/lib/types/client/builtins/tabs.d.ts +9 -0
- package/lib/types/client/icons.d.ts +26 -8
- package/lib/types/client/service.d.ts +1 -1
- package/lib/types/config.d.ts +4 -3
- package/lib/types/context-types.d.ts +12 -14
- package/lib/types/prefs-shared.d.ts +1 -1
- package/lib/types/ui-tweaks/index.d.ts +2 -3
- package/package.json +3 -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/SideCardSection.tsx +2 -8
- 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/builtins/tabs.tsx +9 -2
- package/src/client/builtins/viewers.tsx +2 -1
- package/src/client/icons.tsx +57 -4
- package/src/client/intercept.tsx +1 -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/service.ts +1 -1
- package/src/client/ui-tweaks/branding.tsx +48 -3
- package/src/client/ui-tweaks/index.tsx +3 -3
- package/src/config.ts +22 -2
- package/src/context-types.ts +5 -15
- package/src/index.ts +22 -20
- package/src/prefs-shared.ts +1 -1
- package/src/ui-tweaks/config.ts +1 -1
- package/src/ui-tweaks/index.ts +7 -13
package/src/client/intercept.tsx
CHANGED
|
@@ -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 '
|
|
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'
|
package/src/client/md-toc.tsx
CHANGED
|
@@ -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 '
|
|
21
|
+
import { IconListPenOutline16 } from './icons.tsx'
|
|
22
22
|
import { t } from './locales.ts'
|
|
23
23
|
import css from './sidebar.module.css'
|
|
24
24
|
|
package/src/client/mermaid.tsx
CHANGED
|
@@ -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 {
|
|
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 '
|
|
13
|
+
import { IconCloseOutline16 } from './icons.tsx'
|
|
14
14
|
import {
|
|
15
15
|
isValidCustomEditor,
|
|
16
16
|
newCustomEditorId,
|
package/src/client/service.ts
CHANGED
|
@@ -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.
|
|
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
|
|
@@ -28,12 +28,31 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
28
28
|
export const PROJECT_LOGO_URL = '/_dsh/ui-tweaks/assets/logo.svg'
|
|
29
29
|
const PROJECT_NAME = 'ChatCode CLI'
|
|
30
30
|
const HERO_TITLE = '与世界,深一度对话'
|
|
31
|
-
const LEGACY_HOST_BRAND_TEXT = /DSH\s*(?:Local\s*Build|本地构建)|ChatCode\s*CLI/giu
|
|
32
|
-
const
|
|
31
|
+
const LEGACY_HOST_BRAND_TEXT = /DSH\s*(?:Local\s*Build|本地构建)|DeepSeek\s*Harness|ChatCode\s*CLI/giu
|
|
32
|
+
const LEGACY_HOST_BRAND_LABEL_TEXT = /^(?:DSH\s*(?:Local\s*Build|本地构建)|ChatCode\s*CLI)$/iu
|
|
33
33
|
const HOST_BUILD_VERSION_TEXT = /^v?\d+\.\d+\.\d+(?:[-+][0-9a-z.-]+)*$/iu
|
|
34
34
|
const HERO_HEADLINE = /探索未至之境/u
|
|
35
35
|
const HERO_PREVIEW_TEXT = /^(?:预览版|Preview)$/iu
|
|
36
36
|
const FAVICON_MARKER = 'data-dut-project-favicon'
|
|
37
|
+
const VERSION_NOTICE_MARKER = 'data-dut-version-notice'
|
|
38
|
+
const VERSION_NOTICE = {
|
|
39
|
+
en: {
|
|
40
|
+
legacyTitle: 'Internal Testing Notice',
|
|
41
|
+
title: 'Version Usage Notice',
|
|
42
|
+
paragraphs: [
|
|
43
|
+
'ChatCode CLI is currently evolving rapidly, and its features and user experience will continue to improve. If you encounter any issues or have feedback or suggestions, please join our DingTalk group to share them.',
|
|
44
|
+
'DingTalk group ID: 178730000511',
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
zh: {
|
|
48
|
+
legacyTitle: '内测声明',
|
|
49
|
+
title: '版本使用声明',
|
|
50
|
+
paragraphs: [
|
|
51
|
+
'ChatCode CLI 当前版本处于快速迭代阶段,相关功能与使用体验将持续优化。如您在使用过程中遇到问题,或有任何意见与建议,欢迎加入钉钉交流群反馈。',
|
|
52
|
+
'钉钉群号:178730000511',
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
} as const
|
|
37
56
|
|
|
38
57
|
/** Reusable rendering of the packaged project logo. */
|
|
39
58
|
export function ProjectLogoIcon({ className = '' }: { className?: string }): ReactNode {
|
|
@@ -135,6 +154,30 @@ function hideVersionBesideBrandLabel(label: HTMLElement): void {
|
|
|
135
154
|
}
|
|
136
155
|
}
|
|
137
156
|
|
|
157
|
+
/** Replace the registry build's older upstream notice with ChatCode product copy. */
|
|
158
|
+
function syncVersionNotice(): void {
|
|
159
|
+
document.querySelectorAll<HTMLElement>(
|
|
160
|
+
`[role="dialog"][aria-label="${VERSION_NOTICE.zh.legacyTitle}"],`
|
|
161
|
+
+ `[role="dialog"][aria-label="${VERSION_NOTICE.en.legacyTitle}"],`
|
|
162
|
+
+ `[role="dialog"][${VERSION_NOTICE_MARKER}]`,
|
|
163
|
+
).forEach((dialog) => {
|
|
164
|
+
const heading = dialog.querySelector<HTMLElement>('h1,h2,h3')
|
|
165
|
+
const legacyTitle = dialog.getAttribute('aria-label') ?? heading?.textContent?.trim()
|
|
166
|
+
const language = dialog.dataset.dutVersionNoticeLanguage === 'zh'
|
|
167
|
+
|| legacyTitle === VERSION_NOTICE.zh.legacyTitle ? 'zh' : 'en'
|
|
168
|
+
const notice = VERSION_NOTICE[language]
|
|
169
|
+
dialog.setAttribute('aria-label', notice.title)
|
|
170
|
+
dialog.setAttribute(VERSION_NOTICE_MARKER, '')
|
|
171
|
+
dialog.dataset.dutVersionNoticeLanguage = language
|
|
172
|
+
if (heading !== null) heading.textContent = notice.title
|
|
173
|
+
const paragraphs = dialog.querySelectorAll<HTMLParagraphElement>('p')
|
|
174
|
+
notice.paragraphs.forEach((text, index) => {
|
|
175
|
+
const paragraph = paragraphs.item(index)
|
|
176
|
+
if (paragraph !== null) paragraph.textContent = text
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
|
|
138
181
|
function syncBranding(): void {
|
|
139
182
|
document.title = document.title.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME)
|
|
140
183
|
|
|
@@ -151,7 +194,7 @@ function syncBranding(): void {
|
|
|
151
194
|
// The sidebar label identifies the precise icon to its left. Process it
|
|
152
195
|
// before the generic text pass so the sibling relationship is still intact.
|
|
153
196
|
document.querySelectorAll<HTMLElement>('body *').forEach((element) => {
|
|
154
|
-
if (element.childElementCount !== 0 || !
|
|
197
|
+
if (element.childElementCount !== 0 || !LEGACY_HOST_BRAND_LABEL_TEXT.test(element.textContent?.trim() ?? '')) return
|
|
155
198
|
if (element.textContent !== PROJECT_NAME) element.textContent = PROJECT_NAME
|
|
156
199
|
element.classList.add('dut-brand-title')
|
|
157
200
|
replaceLogoBesideBrandLabel(element)
|
|
@@ -182,6 +225,8 @@ function syncBranding(): void {
|
|
|
182
225
|
title.classList.add('dut-hero-title')
|
|
183
226
|
})
|
|
184
227
|
|
|
228
|
+
syncVersionNotice()
|
|
229
|
+
|
|
185
230
|
// Older host builds expose a brand-mark wrapper but no text-bearing sibling.
|
|
186
231
|
document.querySelectorAll<HTMLElement>('[class*="brandMark"]').forEach((host) => {
|
|
187
232
|
const svg = host.matches('svg') ? host : host.querySelector('svg')
|
|
@@ -1487,7 +1487,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1487
1487
|
// packaged logo there rather than restyling the host's fallback FishLogo.
|
|
1488
1488
|
ctx.slots.inject('conversation.hero.brand.mark', () => ctx.slots.register({
|
|
1489
1489
|
name: 'conversation.hero.brand.mark',
|
|
1490
|
-
priority: 10,
|
|
1490
|
+
priority: -10,
|
|
1491
1491
|
}, HeroProjectLogo))
|
|
1492
1492
|
|
|
1493
1493
|
// The sidebar renders this same slot in its expanded header and collapsed
|
|
@@ -1495,7 +1495,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1495
1495
|
// from falling back to the host FishLogo after the sidebar is collapsed.
|
|
1496
1496
|
ctx.slots.inject('sidebar.brand.mark', () => ctx.slots.register({
|
|
1497
1497
|
name: 'sidebar.brand.mark',
|
|
1498
|
-
priority: 10,
|
|
1498
|
+
priority: -10,
|
|
1499
1499
|
}, SidebarProjectLogo))
|
|
1500
1500
|
|
|
1501
1501
|
// Newer DSH hosts expose the expanded wordmark as its own slot. Owning it
|
|
@@ -1504,7 +1504,7 @@ export function apply(ctx: UITweaksClientContext): void {
|
|
|
1504
1504
|
// path above.
|
|
1505
1505
|
ctx.slots.inject('sidebar.brand.name', () => ctx.slots.register({
|
|
1506
1506
|
name: 'sidebar.brand.name',
|
|
1507
|
-
priority: 10,
|
|
1507
|
+
priority: -10,
|
|
1508
1508
|
}, SidebarProjectName))
|
|
1509
1509
|
|
|
1510
1510
|
// GitBar v3: the branch chip lives in the session header's action row
|
package/src/config.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import z from 'schemastery'
|
|
9
|
+
import { Config as UITweaksSchema, type UITweaksConfig } from './ui-tweaks/config.ts'
|
|
9
10
|
import {
|
|
10
11
|
SIDEBAR_PREFS_DEFAULTS,
|
|
11
12
|
SIDEBAR_PREFS_NS,
|
|
@@ -37,7 +38,7 @@ export {
|
|
|
37
38
|
} from './prefs-shared.ts'
|
|
38
39
|
|
|
39
40
|
/** Tunable sidebar host limits (every field optional; defaults fill in). */
|
|
40
|
-
export interface SidebarConfig {
|
|
41
|
+
export interface SidebarConfig extends Partial<SidebarPrefs>, UITweaksConfig {
|
|
41
42
|
/** Read cap of one text file (bytes); larger files return truncated. */
|
|
42
43
|
readLimit?: number
|
|
43
44
|
/** Media route cap (bytes); larger binaries are refused. */
|
|
@@ -88,7 +89,7 @@ export interface CodingPlanConfig {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
/** Schemastery schema for the plugin configuration. */
|
|
91
|
-
|
|
92
|
+
const HostConfig = z.object({
|
|
92
93
|
readLimit: z.number().step(1).min(1).default(512 * 1024),
|
|
93
94
|
mediaLimit: z.number().step(1).min(1).default(20 * 1024 * 1024),
|
|
94
95
|
uploadLimit: z.number().step(1).min(1).default(128 * 1024 * 1024),
|
|
@@ -205,3 +206,22 @@ export const PrefsSchema: z<SidebarPrefs> = z.object({
|
|
|
205
206
|
// keys as unknown schema fields.
|
|
206
207
|
pluginSettings: z.dict(z.dict(z.any())).default({}),
|
|
207
208
|
})
|
|
209
|
+
|
|
210
|
+
function live<T>(schema: z<T>): z<T> {
|
|
211
|
+
Reflect.set(schema.meta, 'volatile', true)
|
|
212
|
+
return schema
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function liveFields(schema: z): Record<string, z> {
|
|
216
|
+
if (schema.type !== 'object' || schema.dict === undefined) {
|
|
217
|
+
throw new TypeError('Live settings schema must be an object')
|
|
218
|
+
}
|
|
219
|
+
return Object.fromEntries(Object.entries(schema.dict).map(([key, field]) => [key, live(field)]))
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** One entry schema: deployment fields stay fixed while sidebar and UI preferences are live-editable. */
|
|
223
|
+
export const Config = z.object({
|
|
224
|
+
...HostConfig.dict,
|
|
225
|
+
...liveFields(PrefsSchema),
|
|
226
|
+
...liveFields(UITweaksSchema),
|
|
227
|
+
}) as z<SidebarConfig>
|
package/src/context-types.ts
CHANGED
|
@@ -446,22 +446,10 @@ export interface SidebarInvariantsService {
|
|
|
446
446
|
): () => void
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
-
/** The settings service face (mirror of @deepseek-ai/dsh-settings'
|
|
449
|
+
/** The settings service face (mirror of @deepseek-ai/dsh-settings' SettingsForms). */
|
|
450
450
|
export interface SidebarSettingsService {
|
|
451
|
-
/**
|
|
452
|
-
|
|
453
|
-
* then the composition base, then the user document).
|
|
454
|
-
*/
|
|
455
|
-
register<T>(
|
|
456
|
-
ns: string,
|
|
457
|
-
schema: unknown,
|
|
458
|
-
options?: { base?: Partial<T>; applies?: 'live' | 'restart' },
|
|
459
|
-
): {
|
|
460
|
-
get(): T
|
|
461
|
-
watch(callback: (next: T, prev: T) => void | Promise<void>): () => void
|
|
462
|
-
update(patch: object): Promise<void>
|
|
463
|
-
replace(section: object): Promise<void>
|
|
464
|
-
}
|
|
451
|
+
/** Whether the active profile accepts form edits. */
|
|
452
|
+
readonly writable: boolean
|
|
465
453
|
/** Redacted descriptors of every registered namespace (secrets stripped). */
|
|
466
454
|
describe(options?: { redactSecrets?: boolean }): Array<{
|
|
467
455
|
ns: string
|
|
@@ -473,6 +461,8 @@ export interface SidebarSettingsService {
|
|
|
473
461
|
}>
|
|
474
462
|
/** Service-level merge write with the revision guard (a stale writer is refused). */
|
|
475
463
|
update(ns: string, patch: object, expectedRevision?: number): Promise<void>
|
|
464
|
+
/** Apply path edits without restating fields hidden from the caller. */
|
|
465
|
+
mutate(ns: string, ops: readonly ({ op: 'set'; path: readonly string[]; value: unknown } | { op: 'unset'; path: readonly string[] })[], expectedRevision?: number): Promise<void>
|
|
476
466
|
}
|
|
477
467
|
|
|
478
468
|
/**
|
package/src/index.ts
CHANGED
|
@@ -21,7 +21,6 @@ import { WebSocket, WebSocketServer } from 'ws'
|
|
|
21
21
|
import type { Context, SidebarHttpRequest } from './context-types.ts'
|
|
22
22
|
import {
|
|
23
23
|
Config,
|
|
24
|
-
PrefsSchema,
|
|
25
24
|
resolveSidebarConfig,
|
|
26
25
|
SIDEBAR_PREFS_DEFAULTS,
|
|
27
26
|
SIDEBAR_PREFS_NS,
|
|
@@ -829,9 +828,8 @@ function buildApi(
|
|
|
829
828
|
* {@link resolveSidebarConfig}.
|
|
830
829
|
*/
|
|
831
830
|
export function apply(ctx: Context, config?: SidebarConfig): void {
|
|
832
|
-
// dsh-ui-tweaks is embedded as an intact feature module. Its
|
|
833
|
-
//
|
|
834
|
-
// settings.yaml values and browser behavior carry over without migration.
|
|
831
|
+
// dsh-ui-tweaks is embedded as an intact feature module. Its routes stay
|
|
832
|
+
// unchanged while its live fields share this entry's generated settings form.
|
|
835
833
|
// Cordis honours the root `inject` list in production. Keeping this guard
|
|
836
834
|
// lets lightweight embedders that call apply() directly retain the sidebar
|
|
837
835
|
// subset when they intentionally omit the settings service.
|
|
@@ -886,8 +884,8 @@ export function apply(ctx: Context, config?: SidebarConfig): void {
|
|
|
886
884
|
void codingPlanCatalogue.refresh().catch(() => { /* catalogue returns a safe unavailable snapshot */ })
|
|
887
885
|
|
|
888
886
|
// ── User-facing "Side card" preferences ──────────────────────────────────
|
|
889
|
-
//
|
|
890
|
-
//
|
|
887
|
+
// The Settings page (client half) renders and persists the
|
|
888
|
+
// new-conversation defaults from this entry's volatile Config fields. The
|
|
891
889
|
// DSH settings RPC domain (api-proxy) only serves allowlisted namespaces to
|
|
892
890
|
// configuration clients, so the client reaches this namespace through the
|
|
893
891
|
// plugin's own fenced routes below ('settings.get'/'settings.update'),
|
|
@@ -921,17 +919,7 @@ export function apply(ctx: Context, config?: SidebarConfig): void {
|
|
|
921
919
|
}
|
|
922
920
|
}
|
|
923
921
|
ctx.inject(['settings'], (sctx) => {
|
|
924
|
-
// DSH 0.1.2-alpha.2 validates namespaces at compile time
|
|
925
|
-
// (SettingsNamespaceInput); the 'dsh-better-sidebar' literal passes, so the
|
|
926
|
-
// runtime helper this used to call (settingsNamespace) is gone upstream.
|
|
927
922
|
const ns = SIDEBAR_PREFS_NS
|
|
928
|
-
// The structural settings mirror types `schema` as unknown, so the
|
|
929
|
-
// generic is not inferred here; the real service resolves it from the
|
|
930
|
-
// schemastery schema (PrefsSchema) — narrow the owner scope explicitly.
|
|
931
|
-
const scope = sctx.settings.register(ns, PrefsSchema) as {
|
|
932
|
-
get(): SidebarPrefs
|
|
933
|
-
watch(callback: (next: SidebarPrefs, prev: SidebarPrefs) => void): () => void
|
|
934
|
-
}
|
|
935
923
|
const viewOf = (): { value?: unknown; revision?: number } => {
|
|
936
924
|
const descriptor = sctx.settings.describe({ redactSecrets: true }).find(candidate => candidate.ns === ns)
|
|
937
925
|
return descriptor === undefined
|
|
@@ -957,6 +945,15 @@ export function apply(ctx: Context, config?: SidebarConfig): void {
|
|
|
957
945
|
return viewOf()
|
|
958
946
|
},
|
|
959
947
|
}
|
|
948
|
+
const scope = {
|
|
949
|
+
get: (): SidebarPrefs => {
|
|
950
|
+
const value = viewOf().value
|
|
951
|
+
return {
|
|
952
|
+
...SIDEBAR_PREFS_DEFAULTS,
|
|
953
|
+
...(typeof value === 'object' && value !== null ? value : {}),
|
|
954
|
+
} as SidebarPrefs
|
|
955
|
+
},
|
|
956
|
+
}
|
|
960
957
|
// Register (or unregister) the terminal tools from the current setting,
|
|
961
958
|
// and keep them in sync with every settings commit.
|
|
962
959
|
syncToolsGate(scope)
|
|
@@ -988,10 +985,15 @@ export function apply(ctx: Context, config?: SidebarConfig): void {
|
|
|
988
985
|
}
|
|
989
986
|
}
|
|
990
987
|
syncOpenToolsGate()
|
|
991
|
-
//
|
|
992
|
-
//
|
|
993
|
-
|
|
994
|
-
|
|
988
|
+
// Volatile Config writes preserve the plugin fiber. Re-read the projected
|
|
989
|
+
// form after each Loader update so both gates track the committed values.
|
|
990
|
+
const updates = sctx as unknown as {
|
|
991
|
+
on(event: 'loader/volatile-update', listener: () => void): () => void
|
|
992
|
+
}
|
|
993
|
+
updates.on('loader/volatile-update', () => {
|
|
994
|
+
syncToolsGate(scope)
|
|
995
|
+
syncOpenToolsGate()
|
|
996
|
+
})
|
|
995
997
|
})
|
|
996
998
|
|
|
997
999
|
// ── JSON API ────────────────────────────────────────────────────────────
|
package/src/prefs-shared.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/** The user-settings namespace holding the side card preferences. */
|
|
10
|
-
export const SIDEBAR_PREFS_NS = '
|
|
10
|
+
export const SIDEBAR_PREFS_NS = 'better-sidebar'
|
|
11
11
|
|
|
12
12
|
/** User-facing side card preferences (new-conversation defaults). */
|
|
13
13
|
export interface SidebarPrefs {
|
package/src/ui-tweaks/config.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { SettingsNamespace } from '@deepseek-ai/dsh-settings'
|
|
|
14
14
|
// `settingsNamespace()` was removed in DSH 0.1.2-alpha.2. Keep the opaque
|
|
15
15
|
// namespace type for source compatibility with older DSH declarations, while
|
|
16
16
|
// emitting the plain validated literal required by the current runtime.
|
|
17
|
-
export const UI_TWEAKS_SETTINGS_NAMESPACE = '
|
|
17
|
+
export const UI_TWEAKS_SETTINGS_NAMESPACE = 'better-sidebar' as SettingsNamespace
|
|
18
18
|
|
|
19
19
|
/** Raw user-facing configuration (partial inputs receive schema defaults). */
|
|
20
20
|
export interface UITweaksConfig {
|
package/src/ui-tweaks/index.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-ui-tweaks — server half.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* conversation UI
|
|
6
|
-
* document directly (settings.yaml `ui-tweaks:` section). All rendering work
|
|
4
|
+
* Uses the owning sidebar entry's live settings so users can tune the
|
|
5
|
+
* conversation UI from the Settings panel. All rendering work
|
|
7
6
|
* happens in the browser bundle (`src/client`), which reads and writes this
|
|
8
7
|
* namespace through the same-origin route mounted here — the Web settings RPC
|
|
9
8
|
* only exposes a fixed allowlist of namespaces since rc.6, so a custom route is
|
|
@@ -12,11 +11,7 @@
|
|
|
12
11
|
*/
|
|
13
12
|
|
|
14
13
|
import type { Context } from '@deepseek-ai/cordis'
|
|
15
|
-
import {
|
|
16
|
-
UI_TWEAKS_SETTINGS_NAMESPACE,
|
|
17
|
-
Config,
|
|
18
|
-
type UITweaksConfig,
|
|
19
|
-
} from './config.ts'
|
|
14
|
+
import { UI_TWEAKS_SETTINGS_NAMESPACE, type UITweaksConfig } from './config.ts'
|
|
20
15
|
import { installTurnOutcomeProjection } from './turn-outcome.ts'
|
|
21
16
|
import { UITweaksWebBackend, installUITweaksWeb } from './web.ts'
|
|
22
17
|
import { GitBackend } from './git.ts'
|
|
@@ -30,10 +25,6 @@ export const name = 'dsh-ui-tweaks'
|
|
|
30
25
|
export const inject = ['settings']
|
|
31
26
|
|
|
32
27
|
export function apply(ctx: Context): void {
|
|
33
|
-
ctx.settings.register(UI_TWEAKS_SETTINGS_NAMESPACE, Config, {
|
|
34
|
-
applies: 'live',
|
|
35
|
-
})
|
|
36
|
-
|
|
37
28
|
// The task notifier classifies turn endings (completed / aborted / failed)
|
|
38
29
|
// through this session projection (same registration pattern as above).
|
|
39
30
|
installTurnOutcomeProjection(ctx)
|
|
@@ -44,7 +35,10 @@ export function apply(ctx: Context): void {
|
|
|
44
35
|
|
|
45
36
|
// The GitBar runs git in the session's working directory through these
|
|
46
37
|
// same-origin routes (sessions/llm are optional services, duck-typed).
|
|
47
|
-
const readConfig = (): UITweaksConfig =>
|
|
38
|
+
const readConfig = (): UITweaksConfig => {
|
|
39
|
+
const descriptor = ctx.settings.describe().find(candidate => candidate.ns === UI_TWEAKS_SETTINGS_NAMESPACE)
|
|
40
|
+
return descriptor?.value as UITweaksConfig | undefined ?? {}
|
|
41
|
+
}
|
|
48
42
|
installGitWeb(ctx, new GitBackend(ctx, readConfig))
|
|
49
43
|
|
|
50
44
|
// The Archive panel lists archived sessions and restores ("deletes") them
|