@chatcode/cco-better-sidebar 0.18.0-rc.2 → 0.18.0-rc.4
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 +7 -2
- package/README_EN.md +7 -2
- package/lib/client-editor.js +319 -262
- package/lib/client-mermaid.js +300 -258
- package/lib/client-registry.js +1104 -467
- package/lib/client-terminal.js +315 -258
- package/lib/client.js +1107 -470
- package/lib/index.js +49 -3
- package/lib/types/client/PluginMarketSettingsSection.d.ts +7 -0
- package/lib/types/client/PluginMarketView.d.ts +7 -0
- package/lib/types/client/api.d.ts +15 -0
- package/lib/types/client/builtins/tabs.d.ts +6 -3
- package/lib/types/client/locales.d.ts +21 -0
- package/lib/types/client/plugin-market-catalog.d.ts +25 -0
- package/lib/types/client/ui-tweaks/index.d.ts +1 -1
- package/lib/types/client/ui-tweaks/typography.d.ts +9 -0
- package/lib/types/plugin-market-api.d.ts +5 -0
- package/lib/types/plugin-market-shared.d.ts +37 -0
- package/lib/types/pty-deps.d.ts +1 -1
- package/lib/types/ui-tweaks/config.d.ts +5 -6
- package/package.json +2 -2
- package/src/client/PluginMarketSettingsSection.tsx +55 -0
- package/src/client/PluginMarketView.module.css +35 -0
- package/src/client/PluginMarketView.tsx +154 -0
- package/src/client/api.ts +7 -0
- package/src/client/builtins/tabs.tsx +16 -3
- package/src/client/index.tsx +10 -1
- package/src/client/locales-ja.ts +21 -0
- package/src/client/locales.ts +42 -0
- package/src/client/plugin-market-catalog.ts +90 -0
- package/src/client/ui-tweaks/branding.tsx +15 -7
- package/src/client/ui-tweaks/index.tsx +36 -99
- package/src/client/ui-tweaks/typography.ts +38 -0
- package/src/index.ts +2 -0
- package/src/plugin-market-api.ts +42 -0
- package/src/plugin-market-shared.ts +21 -0
- package/src/pty-deps.ts +2 -2
- package/src/ui-tweaks/config.ts +10 -10
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** Shared config plugin routes inside the sidebar's existing trust fence. */
|
|
2
|
+
import type { Context } from './context-types.ts'
|
|
3
|
+
import type { PluginMarketService, PluginMarketScope } from './plugin-market-shared.ts'
|
|
4
|
+
import { requireString, SidebarError } from './wire.ts'
|
|
5
|
+
|
|
6
|
+
export function buildPluginMarketApi(ctx: Pick<Context, 'get'>, cwdOf: (payload: unknown) => Promise<{ cwd: string }>): Record<string, (payload: unknown) => Promise<unknown>> {
|
|
7
|
+
const service = (): PluginMarketService => {
|
|
8
|
+
const value = ctx.get('chatcodePluginMarket', false) as PluginMarketService | undefined
|
|
9
|
+
if (!value) throw new SidebarError('chatcode-unavailable', '插件市场服务未挂载,请更新并启用 ChatCode config 插件。', 503)
|
|
10
|
+
return value
|
|
11
|
+
}
|
|
12
|
+
const scopeOf = (payload: unknown): PluginMarketScope => {
|
|
13
|
+
const scope = requireString(payload, 'scope')
|
|
14
|
+
if (scope !== 'project' && scope !== 'user') throw new SidebarError('bad-request', 'scope must be project or user')
|
|
15
|
+
return scope
|
|
16
|
+
}
|
|
17
|
+
// Settings can be opened before a conversation exists. In that case the
|
|
18
|
+
// host launch directory is the project; never take a sessionless cwd from
|
|
19
|
+
// the browser. Conversations still use the existing authoritative resolver.
|
|
20
|
+
const contextOf = async (payload: unknown): Promise<{ sessionId: string; cwd: string }> => {
|
|
21
|
+
const sessionId = (payload as { sessionId?: unknown } | null)?.sessionId
|
|
22
|
+
if (sessionId === undefined || sessionId === '') return { sessionId: '', cwd: process.cwd() }
|
|
23
|
+
requireString(payload, 'sessionId')
|
|
24
|
+
return { sessionId: sessionId as string, cwd: (await cwdOf(payload)).cwd }
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
'plugins.context': contextOf,
|
|
28
|
+
'plugins.marketplaces': () => service().marketplaces(),
|
|
29
|
+
'plugins.catalog': async payload => {
|
|
30
|
+
const market = service()
|
|
31
|
+
const id = requireString(payload, 'marketplaceId')
|
|
32
|
+
if ((payload as { includeMetadata?: unknown }).includeMetadata !== true) return market.plugins(id)
|
|
33
|
+
return market.catalog ? market.catalog(id) : { plugins: await market.plugins(id), warning: '' }
|
|
34
|
+
},
|
|
35
|
+
'plugins.installed': async payload => service().installed((await contextOf(payload)).cwd),
|
|
36
|
+
'plugins.install': async payload => service().install((await contextOf(payload)).cwd, requireString(payload, 'pluginId'), scopeOf(payload)),
|
|
37
|
+
'plugins.uninstall': async payload => {
|
|
38
|
+
await service().uninstall((await contextOf(payload)).cwd, requireString(payload, 'pluginId'), scopeOf(payload))
|
|
39
|
+
return { ok: true }
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Credential-free structural contract of the config plugin's host service. */
|
|
2
|
+
export type PluginMarketScope = 'project' | 'user'
|
|
3
|
+
export interface PluginMarketplace { id: string; name: string; description: string; official: boolean }
|
|
4
|
+
export interface MarketplacePlugin { id: string; marketplaceId: string; name: string; description: string }
|
|
5
|
+
export interface InstalledMarketplacePlugin extends MarketplacePlugin {
|
|
6
|
+
scope: PluginMarketScope
|
|
7
|
+
projectPath: string
|
|
8
|
+
installPath: string
|
|
9
|
+
version: string
|
|
10
|
+
installedAt: string
|
|
11
|
+
}
|
|
12
|
+
export interface MarketplaceCatalog { marketplaces: PluginMarketplace[]; warning: string }
|
|
13
|
+
export interface PluginCatalog { plugins: MarketplacePlugin[]; warning: string }
|
|
14
|
+
export interface PluginMarketService {
|
|
15
|
+
marketplaces(): Promise<MarketplaceCatalog>
|
|
16
|
+
plugins(marketplaceId: string): Promise<MarketplacePlugin[]>
|
|
17
|
+
catalog?(marketplaceId: string): Promise<PluginCatalog>
|
|
18
|
+
installed(cwd: string): Promise<InstalledMarketplacePlugin[]>
|
|
19
|
+
install(cwd: string, pluginId: string, scope: PluginMarketScope): Promise<InstalledMarketplacePlugin>
|
|
20
|
+
uninstall(cwd: string, pluginId: string, scope: PluginMarketScope): Promise<void>
|
|
21
|
+
}
|
package/src/pty-deps.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* agent terminal tools are simply not registered.
|
|
18
18
|
*
|
|
19
19
|
* Version contract: the plugin must stay in sync with DSH core —
|
|
20
|
-
* `@deepseek-ai/dsh-subprocess-local` declares `"node-pty": "
|
|
20
|
+
* `@deepseek-ai/dsh-subprocess-local` declares `"node-pty": "1.2.0-beta.15"` in
|
|
21
21
|
* its `dependencies`. Both sides then resolve the SAME pnpm store entry
|
|
22
22
|
* (same range, same integrity → one native binding, no drift). Do NOT
|
|
23
23
|
* switch to a fork (e.g. @lydell/node-pty) or a different range without
|
|
@@ -39,7 +39,7 @@ export type NodePtyModule = typeof nodePtyNs
|
|
|
39
39
|
* range DSH core declares (`@deepseek-ai/dsh-subprocess-local`): the same
|
|
40
40
|
* range keeps pnpm resolving both to one physical package.
|
|
41
41
|
*/
|
|
42
|
-
export const DSH_NODE_PTY_RANGE = '
|
|
42
|
+
export const DSH_NODE_PTY_RANGE = '1.2.0-beta.15'
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* The WebSocket close-code-1011 reason the host sends when node-pty is
|
package/src/ui-tweaks/config.ts
CHANGED
|
@@ -29,10 +29,9 @@ export interface UITweaksConfig {
|
|
|
29
29
|
*/
|
|
30
30
|
codeFontScale?: number
|
|
31
31
|
/**
|
|
32
|
-
* Absolute code font size in px (8–32)
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* `codeFontScale` percentage, then to the stock default.
|
|
32
|
+
* Absolute code font size in px (8–32), default 13. Drives code blocks;
|
|
33
|
+
* inline code and small code follow proportionally. When unset, uses a non-default legacy
|
|
34
|
+
* `codeFontScale` percentage, otherwise 13px.
|
|
36
35
|
*/
|
|
37
36
|
codeFontSize?: number
|
|
38
37
|
/**
|
|
@@ -114,7 +113,7 @@ export interface UITweaksConfig {
|
|
|
114
113
|
|
|
115
114
|
export const MIN_FONT_SIZE = 10
|
|
116
115
|
export const MAX_FONT_SIZE = 32
|
|
117
|
-
export const DEFAULT_FONT_SIZE =
|
|
116
|
+
export const DEFAULT_FONT_SIZE = 14
|
|
118
117
|
|
|
119
118
|
/** 16px matches the stock DSH vertical rhythm (message/block gaps, etc.). */
|
|
120
119
|
export const MIN_LINE_HEIGHT = 0
|
|
@@ -126,7 +125,7 @@ export const MIN_CODE_FONT_SCALE = 50
|
|
|
126
125
|
export const MAX_CODE_FONT_SCALE = 150
|
|
127
126
|
export const DEFAULT_CODE_FONT_SCALE = 81
|
|
128
127
|
|
|
129
|
-
/**
|
|
128
|
+
/** Default absolute code-block size, paired with 14px prose. */
|
|
130
129
|
export const MIN_CODE_FONT_SIZE = 8
|
|
131
130
|
export const MAX_CODE_FONT_SIZE = 32
|
|
132
131
|
export const DEFAULT_CODE_FONT_SIZE = 13
|
|
@@ -164,7 +163,7 @@ export const DEFAULT_NOTIFY_SOUND = false
|
|
|
164
163
|
|
|
165
164
|
/** Configuration schema with documented defaults. */
|
|
166
165
|
export const Config: Schema<UITweaksConfig> = z.object({
|
|
167
|
-
fontSize: z.number().min(10).max(32).default(
|
|
166
|
+
fontSize: z.number().min(10).max(32).default(DEFAULT_FONT_SIZE),
|
|
168
167
|
codeFontScale: z.number().min(MIN_CODE_FONT_SCALE).max(MAX_CODE_FONT_SCALE).default(DEFAULT_CODE_FONT_SCALE),
|
|
169
168
|
codeFontSize: z.number().min(MIN_CODE_FONT_SIZE).max(MAX_CODE_FONT_SIZE),
|
|
170
169
|
lineHeight: z.number().min(MIN_LINE_HEIGHT).max(MAX_LINE_HEIGHT).default(DEFAULT_LINE_HEIGHT),
|
|
@@ -229,11 +228,12 @@ export interface ResolvedUITweaksConfig {
|
|
|
229
228
|
export function resolveConfig(config: UITweaksConfig = {}): ResolvedUITweaksConfig {
|
|
230
229
|
const fontSize = config.fontSize ?? DEFAULT_FONT_SIZE
|
|
231
230
|
const codeFontScale = config.codeFontScale ?? DEFAULT_CODE_FONT_SCALE
|
|
232
|
-
//
|
|
233
|
-
// the legacy percentage at the resolved body size; otherwise stock.
|
|
231
|
+
// Explicit code sizing wins; the stock preference keeps readable 13px code.
|
|
234
232
|
const codeFontSize = typeof config.codeFontSize === 'number'
|
|
235
233
|
? Math.min(MAX_CODE_FONT_SIZE, Math.max(MIN_CODE_FONT_SIZE, config.codeFontSize))
|
|
236
|
-
:
|
|
234
|
+
: codeFontScale === DEFAULT_CODE_FONT_SCALE
|
|
235
|
+
? DEFAULT_CODE_FONT_SIZE
|
|
236
|
+
: Math.max(8, Math.round(fontSize * (13 / 16) * (codeFontScale / DEFAULT_CODE_FONT_SCALE)))
|
|
237
237
|
const lineHeight = config.lineHeight ?? DEFAULT_LINE_HEIGHT
|
|
238
238
|
const tableStyle = config.tableStyle ?? 'default'
|
|
239
239
|
const gitBarEnabled = config.gitBarEnabled ?? DEFAULT_GITBAR_ENABLED
|