@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
|
@@ -11,16 +11,13 @@
|
|
|
11
11
|
* - **恢复** (Restore): remove the session from the archive set — its log and
|
|
12
12
|
* workspace slot are kept, so the conversation reappears in the normal
|
|
13
13
|
* sidebar list.
|
|
14
|
-
* -
|
|
15
|
-
* durable log, workspace accounting, archive-set entry and caches; the list
|
|
16
|
-
* then refreshes so the row (and the session itself) disappear.
|
|
17
|
-
* - **全部恢复 / 全部删除**: the same actions for every archived session.
|
|
14
|
+
* - **全部恢复**: restore every archived session.
|
|
18
15
|
*
|
|
19
16
|
* Live (open/running) sessions are refused by the server; the client maps the
|
|
20
17
|
* `session-live` error code to localized copy.
|
|
21
18
|
* @module dsh-ui-tweaks/client/archive
|
|
22
19
|
*/
|
|
23
|
-
import type {
|
|
20
|
+
import type { SessionListState } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
24
21
|
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client';
|
|
25
22
|
import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
|
|
26
23
|
import type { SettingsClient } from './index.tsx';
|
|
@@ -33,10 +30,9 @@ export declare function installArchiveStyles(): () => void;
|
|
|
33
30
|
export interface ArchiveSectionProps {
|
|
34
31
|
controller: SettingsClient;
|
|
35
32
|
t: Translate;
|
|
36
|
-
sessionsService: ISessions;
|
|
37
33
|
/** Framework standard feeds: session list + workspace archive set. */
|
|
38
34
|
useSessions: SnapshotSelectorHook<SessionListState>;
|
|
39
35
|
useWorkspaces: SnapshotSelectorHook<WorkspaceSnapshot>;
|
|
40
36
|
}
|
|
41
|
-
export declare function ArchiveSection({ controller, t,
|
|
37
|
+
export declare function ArchiveSection({ controller, t, useSessions, useWorkspaces }: ArchiveSectionProps): import("react").JSX.Element;
|
|
42
38
|
export {};
|
|
@@ -40,6 +40,6 @@ export declare function SidebarProjectLogo({ size }: {
|
|
|
40
40
|
}): ReactNode;
|
|
41
41
|
/** Expanded-sidebar wordmark supplied through the host's dedicated slot. */
|
|
42
42
|
export declare function SidebarProjectName(): ReactNode;
|
|
43
|
-
export declare const BRANDING_CSS = "\n/* ChatCode CLI branding is deliberately limited to primary actions. Every\n other surface and interaction state (including workspace/sidebar rows,\n menus, the composer, text and shadows) remains owned by the host theme. */\nbody:not([data-ds-dark-theme]) .dut-unicom-primary-action{background:linear-gradient(135deg,#9B0B09,#b71916) !important;border-color:#9B0B09 !important;color:#fff !important;box-shadow:0 7px 18px rgba(155,11,9,.24) !important}\nbody:not([data-ds-dark-theme]) .dut-unicom-primary-action:hover{background:linear-gradient(135deg,#b71916,#cf302c) !important;border-color:#b71916 !important;color:#fff !important;box-shadow:0 10px 24px rgba(155,11,9,.30) !important}\nbody:not([data-ds-dark-theme]) .dut-unicom-primary-action:active{transform:translateY(1px);box-shadow:0 4px 11px rgba(155,11,9,.22) !important}\n/* In dark mode, alter only the resting background of primary buttons. Once\n hovered, the host owns the complete interaction treatment again. */\nbody[data-ds-dark-theme] .dut-unicom-primary-action:not(:hover){background:#9B0B09 !important}\n.dut-project-logo{display:block;object-fit:contain}\n.dut-left-logo{width:
|
|
43
|
+
export declare const BRANDING_CSS = "\n/* ChatCode CLI branding is deliberately limited to primary actions. Every\n other surface and interaction state (including workspace/sidebar rows,\n menus, the composer, text and shadows) remains owned by the host theme. */\nbody:not([data-ds-dark-theme]) .dut-unicom-primary-action{background:linear-gradient(135deg,#9B0B09,#b71916) !important;border-color:#9B0B09 !important;color:#fff !important;box-shadow:0 7px 18px rgba(155,11,9,.24) !important}\nbody:not([data-ds-dark-theme]) .dut-unicom-primary-action:hover{background:linear-gradient(135deg,#b71916,#cf302c) !important;border-color:#b71916 !important;color:#fff !important;box-shadow:0 10px 24px rgba(155,11,9,.30) !important}\nbody:not([data-ds-dark-theme]) .dut-unicom-primary-action:active{transform:translateY(1px);box-shadow:0 4px 11px rgba(155,11,9,.22) !important}\n/* In dark mode, alter only the resting background of primary buttons. Once\n hovered, the host owns the complete interaction treatment again. */\nbody[data-ds-dark-theme] .dut-unicom-primary-action:not(:hover){background:#9B0B09 !important}\n.dut-project-logo{display:block;object-fit:contain}\n.dut-left-logo{width:24px !important;height:24px !important}\n.dut-brand-title{font:var(--dsw-font-s-strong-14) !important}\n.dut-sidebar-logo{width:24px !important;height:24px !important}\n.dut-sidebar-brand-name{font:var(--dsw-font-s-strong-14) !important;letter-spacing:-.01em !important;white-space:nowrap}\n\n.dut-sidebar-header{height:44px !important;padding:0 4px !important;margin-bottom:8px !important;gap:8px !important}\n.dut-sidebar-brand{min-width:0 !important;background:transparent !important;box-shadow:none !important}\n.dut-sidebar-identity{height:24px !important;gap:8px !important}\n.dut-sidebar-wordmark{font:var(--dsw-font-s-strong-14) !important;letter-spacing:-.01em !important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.dut-sidebar-toggle{width:28px !important;height:28px !important;border-radius:8px !important;color:var(--dsw-alias-label-secondary) !important}\n.dut-sidebar-toggle:hover{background:var(--dsw-alias-interactive-bg-hover) !important}\n/* Reuse the original ChatCode primary-action red, scoped to this marked CTA. */\n.dut-sidebar-new-session{height:40px !important;justify-content:flex-start !important;gap:8px !important;margin:0 0 10px !important;padding:8px 10px !important;border:1px solid #9B0B09 !important;border-radius:10px !important;background:linear-gradient(135deg,#9B0B09,#b71916) !important;color:#fff !important;font:var(--dsw-font-s-strong-14) !important;font-weight:600 !important;box-shadow:none !important;transform:none !important}\n.dut-sidebar-new-session:hover{background:linear-gradient(135deg,#b71916,#cf302c) !important}\n.dut-sidebar-new-session:active{background:#9B0B09 !important}\n.dut-sidebar-new-session:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}\n.dut-sidebar-new-session > span:first-child{flex:1;min-width:0;overflow:hidden;mask-image:none !important}\n.dut-sidebar-new-session > span:first-child > span{width:auto !important;justify-content:flex-start !important;gap:8px !important;min-width:0}\n.dut-sidebar-new-session > span:first-child > span > svg{width:16px;height:16px;flex:none;color:inherit}\n.dut-sidebar-new-session > span:first-child > span > span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.dut-sidebar-new-session > span + span{opacity:1 !important;flex:none;color:color-mix(in srgb,currentColor 75%,transparent);font:var(--dsw-font-xxs-12)}\n/* Temporary navigation-only hide. Remove this block to restore Plugins;\n registrations, settings, installed plugins and other panel entries stay intact. */\nnav:is([aria-label=\"\u5168\u5C40\u9762\u677F\"],[aria-label=\"Global panels\"]) > button:is([aria-label=\"\u63D2\u4EF6\"],[aria-label=\"Plugins\"]),\nnav:is([aria-label=\"\u5168\u5C40\u9762\u677F\"],[aria-label=\"Global panels\"]):has(> button:is([aria-label=\"\u63D2\u4EF6\"],[aria-label=\"Plugins\"]):only-child){display:none !important}\n\n.dut-brand-version{display:none !important}\n.dut-hero-preview{display:none !important}\n.dut-hero-logo{width:60px !important;height:60px !important}\n.dut-hero-title{font-size:30px !important;line-height:40px !important;font-weight:600 !important;letter-spacing:.06em !important;white-space:nowrap}\n[class*=\"headline\"]:has(.dut-hero-logo){grid-template-columns:60px auto !important;font-size:30px !important;line-height:40px !important}\n.dut-settings-logo{width:19px;height:19px;object-fit:contain}\n";
|
|
44
44
|
/** Install the brand theme and retain it across host navigation/rerenders. */
|
|
45
45
|
export declare function installBranding(): () => void;
|
|
@@ -58,7 +58,7 @@ declare const en: {
|
|
|
58
58
|
readonly fontSize: "Message font size";
|
|
59
59
|
readonly fontSizeHint: "Number between 10 and 32; applies to message text, headings, tables and code.";
|
|
60
60
|
readonly codeFontSize: "Code font size";
|
|
61
|
-
readonly codeFontSizeHint: "Absolute code size in px (8–32); 13px is ChatCode CLI's default at a
|
|
61
|
+
readonly codeFontSizeHint: "Absolute code size in px (8–32); 13px is ChatCode CLI's default at a 14px body. Applies to code blocks; inline code follows proportionally.";
|
|
62
62
|
readonly lineHeight: "Line spacing";
|
|
63
63
|
readonly lineHeightHint: "Base vertical spacing in px: gaps between message rows (Think ↔ tool cards) and blocks inside one reply, plus text line-height, paragraph and list margins, all scale from it; 16 is ChatCode CLI's default.";
|
|
64
64
|
readonly tableStyle: "Table style";
|
|
@@ -70,7 +70,7 @@ declare const en: {
|
|
|
70
70
|
readonly gitBarOn: "On";
|
|
71
71
|
readonly gitBarOff: "Off";
|
|
72
72
|
readonly archiveManager: "Archive manager";
|
|
73
|
-
readonly archiveManagerHint: "An Archive settings page to
|
|
73
|
+
readonly archiveManagerHint: "An Archive settings page to view and restore archived sessions.";
|
|
74
74
|
readonly archiveManagerOn: "On";
|
|
75
75
|
readonly archiveManagerOff: "Off";
|
|
76
76
|
readonly mcpManager: "MCP manager";
|
|
@@ -175,7 +175,7 @@ declare const en: {
|
|
|
175
175
|
readonly archiveCount: "sessions";
|
|
176
176
|
readonly archiveUnavailable: "Archive unavailable.";
|
|
177
177
|
readonly archiveLiveError: "This session is running; close it before permanently deleting it.";
|
|
178
|
-
readonly archiveDisabledHint: "Archive management is off. Turn it on in 界面调整 (UI Tweaks) to
|
|
178
|
+
readonly archiveDisabledHint: "Archive management is off. Turn it on in 界面调整 (UI Tweaks) to view and restore archived sessions here.";
|
|
179
179
|
readonly archiveEnable: "Enable archive management";
|
|
180
180
|
readonly archiveRestored: "Restored.";
|
|
181
181
|
readonly defaultAction: "Default";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Compact sidebar chrome; the host retains every button, shortcut and drag surface. */
|
|
2
|
+
export declare const SIDEBAR_HEADER_CSS = "\n.dut-sidebar-header{height:44px !important;padding:0 4px !important;margin-bottom:8px !important;gap:8px !important}\n.dut-sidebar-brand{min-width:0 !important;background:transparent !important;box-shadow:none !important}\n.dut-sidebar-identity{height:24px !important;gap:8px !important}\n.dut-sidebar-wordmark{font:var(--dsw-font-s-strong-14) !important;letter-spacing:-.01em !important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.dut-sidebar-toggle{width:28px !important;height:28px !important;border-radius:8px !important;color:var(--dsw-alias-label-secondary) !important}\n.dut-sidebar-toggle:hover{background:var(--dsw-alias-interactive-bg-hover) !important}\n/* Reuse the original ChatCode primary-action red, scoped to this marked CTA. */\n.dut-sidebar-new-session{height:40px !important;justify-content:flex-start !important;gap:8px !important;margin:0 0 10px !important;padding:8px 10px !important;border:1px solid #9B0B09 !important;border-radius:10px !important;background:linear-gradient(135deg,#9B0B09,#b71916) !important;color:#fff !important;font:var(--dsw-font-s-strong-14) !important;font-weight:600 !important;box-shadow:none !important;transform:none !important}\n.dut-sidebar-new-session:hover{background:linear-gradient(135deg,#b71916,#cf302c) !important}\n.dut-sidebar-new-session:active{background:#9B0B09 !important}\n.dut-sidebar-new-session:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}\n.dut-sidebar-new-session > span:first-child{flex:1;min-width:0;overflow:hidden;mask-image:none !important}\n.dut-sidebar-new-session > span:first-child > span{width:auto !important;justify-content:flex-start !important;gap:8px !important;min-width:0}\n.dut-sidebar-new-session > span:first-child > span > svg{width:16px;height:16px;flex:none;color:inherit}\n.dut-sidebar-new-session > span:first-child > span > span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.dut-sidebar-new-session > span + span{opacity:1 !important;flex:none;color:color-mix(in srgb,currentColor 75%,transparent);font:var(--dsw-font-xxs-12)}\n/* Temporary navigation-only hide. Remove this block to restore Plugins;\n registrations, settings, installed plugins and other panel entries stay intact. */\nnav:is([aria-label=\"\u5168\u5C40\u9762\u677F\"],[aria-label=\"Global panels\"]) > button:is([aria-label=\"\u63D2\u4EF6\"],[aria-label=\"Plugins\"]),\nnav:is([aria-label=\"\u5168\u5C40\u9762\u677F\"],[aria-label=\"Global panels\"]):has(> button:is([aria-label=\"\u63D2\u4EF6\"],[aria-label=\"Plugins\"]):only-child){display:none !important}\n";
|
|
3
|
+
/** Mark only the expanded brand row and its adjacent native New Session button. */
|
|
4
|
+
export declare function syncSidebarHeader(): void;
|
|
5
|
+
/** Restore native header styling when the branding effect is disposed. */
|
|
6
|
+
export declare function clearSidebarHeader(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Font overrides for the conversation, preserving the live theme families. */
|
|
2
|
+
/**
|
|
3
|
+
* Apply the UI Tweaks size and spacing preferences to the host's prose tokens.
|
|
4
|
+
* @param fontSize - Selected body size in pixels.
|
|
5
|
+
* @param lineHeight - Vertical-spacing unit; 16 retains the normal rhythm.
|
|
6
|
+
* @param codeFontSize - Selected code-block size in pixels.
|
|
7
|
+
* @returns Theme-token overrides for a runtime stylesheet.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildFontCss(fontSize: number, lineHeight: number, codeFontSize: number): string;
|
package/lib/types/config.d.ts
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* @module dsh-better-sidebar/config
|
|
6
6
|
*/
|
|
7
7
|
import z from 'schemastery';
|
|
8
|
+
import { type UITweaksConfig } from './ui-tweaks/config.ts';
|
|
8
9
|
import { type SidebarPrefs } from './prefs-shared.ts';
|
|
9
10
|
export { SIDEBAR_PREFS_DEFAULTS, SIDEBAR_PREFS_NS, TERMINAL_FONT_SIZE_DEFAULT, TERMINAL_FONT_SIZE_MAX, TERMINAL_FONT_SIZE_MIN, TITLE_BAR_STRIP_DEFAULT, TITLE_BAR_STRIP_MAX, TITLE_BAR_STRIP_MIN, WIDTH_PERCENT_DEFAULT, WIDTH_PERCENT_MAX, WIDTH_PERCENT_MIN, type SidebarPrefs, } from './prefs-shared.ts';
|
|
10
11
|
/** Tunable sidebar host limits (every field optional; defaults fill in). */
|
|
11
|
-
export interface SidebarConfig {
|
|
12
|
+
export interface SidebarConfig extends Partial<SidebarPrefs>, UITweaksConfig {
|
|
12
13
|
/** Read cap of one text file (bytes); larger files return truncated. */
|
|
13
14
|
readLimit?: number;
|
|
14
15
|
/** Media route cap (bytes); larger binaries are refused. */
|
|
@@ -56,8 +57,6 @@ export interface CodingPlanConfig {
|
|
|
56
57
|
/** Catalogue request timeout in milliseconds. */
|
|
57
58
|
requestTimeoutMs?: number;
|
|
58
59
|
}
|
|
59
|
-
/** Schemastery schema for the plugin configuration. */
|
|
60
|
-
export declare const Config: z<SidebarConfig>;
|
|
61
60
|
/** Fully defaulted sidebar host settings. */
|
|
62
61
|
export interface ResolvedSidebarConfig {
|
|
63
62
|
readLimit: number;
|
|
@@ -93,3 +92,5 @@ export interface ResolvedCodingPlanConfig {
|
|
|
93
92
|
export declare function resolveSidebarConfig(config: SidebarConfig | undefined): ResolvedSidebarConfig;
|
|
94
93
|
/** Schemastery schema for the user-facing preferences (validated by the settings service). */
|
|
95
94
|
export declare const PrefsSchema: z<SidebarPrefs>;
|
|
95
|
+
/** One entry schema: deployment fields stay fixed while sidebar and UI preferences are live-editable. */
|
|
96
|
+
export declare const Config: z<SidebarConfig>;
|
|
@@ -427,21 +427,10 @@ export interface SidebarInvariantsService {
|
|
|
427
427
|
/** Reserve one package's checks and install them in the service's child fiber. */
|
|
428
428
|
register(packageName: string, installer: (ctx: Context, fail: (message: string) => never) => void | Promise<void>): () => void;
|
|
429
429
|
}
|
|
430
|
-
/** The settings service face (mirror of @deepseek-ai/dsh-settings'
|
|
430
|
+
/** The settings service face (mirror of @deepseek-ai/dsh-settings' SettingsForms). */
|
|
431
431
|
export interface SidebarSettingsService {
|
|
432
|
-
/**
|
|
433
|
-
|
|
434
|
-
* then the composition base, then the user document).
|
|
435
|
-
*/
|
|
436
|
-
register<T>(ns: string, schema: unknown, options?: {
|
|
437
|
-
base?: Partial<T>;
|
|
438
|
-
applies?: 'live' | 'restart';
|
|
439
|
-
}): {
|
|
440
|
-
get(): T;
|
|
441
|
-
watch(callback: (next: T, prev: T) => void | Promise<void>): () => void;
|
|
442
|
-
update(patch: object): Promise<void>;
|
|
443
|
-
replace(section: object): Promise<void>;
|
|
444
|
-
};
|
|
432
|
+
/** Whether the active profile accepts form edits. */
|
|
433
|
+
readonly writable: boolean;
|
|
445
434
|
/** Redacted descriptors of every registered namespace (secrets stripped). */
|
|
446
435
|
describe(options?: {
|
|
447
436
|
redactSecrets?: boolean;
|
|
@@ -455,6 +444,15 @@ export interface SidebarSettingsService {
|
|
|
455
444
|
}>;
|
|
456
445
|
/** Service-level merge write with the revision guard (a stale writer is refused). */
|
|
457
446
|
update(ns: string, patch: object, expectedRevision?: number): Promise<void>;
|
|
447
|
+
/** Apply path edits without restating fields hidden from the caller. */
|
|
448
|
+
mutate(ns: string, ops: readonly ({
|
|
449
|
+
op: 'set';
|
|
450
|
+
path: readonly string[];
|
|
451
|
+
value: unknown;
|
|
452
|
+
} | {
|
|
453
|
+
op: 'unset';
|
|
454
|
+
path: readonly string[];
|
|
455
|
+
})[], expectedRevision?: number): Promise<void>;
|
|
458
456
|
}
|
|
459
457
|
/**
|
|
460
458
|
* The tools service face (mirror of @deepseek-ai/dsh-tools' ToolRuntime).
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type { Context, SidebarHttpRequest } from './context-types.ts';
|
|
2
|
+
/** Render the standalone login gate with one automatic attempt and persistent manual recovery. */
|
|
3
|
+
export declare function renderChatcodeLoginPage(logo: string): string;
|
|
2
4
|
export declare function registerLoginRoute(ctx: Context, fence: (req: SidebarHttpRequest) => boolean): () => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Shared config plugin routes inside the sidebar's existing trust fence. */
|
|
2
|
+
import type { Context } from './context-types.ts';
|
|
3
|
+
export declare function buildPluginMarketApi(ctx: Pick<Context, 'get'>, cwdOf: (payload: unknown) => Promise<{
|
|
4
|
+
cwd: string;
|
|
5
|
+
}>): Record<string, (payload: unknown) => Promise<unknown>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** Credential-free structural contract of the config plugin's host service. */
|
|
2
|
+
export type PluginMarketScope = 'project' | 'user';
|
|
3
|
+
export interface PluginMarketplace {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
official: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface MarketplacePlugin {
|
|
10
|
+
id: string;
|
|
11
|
+
marketplaceId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
}
|
|
15
|
+
export interface InstalledMarketplacePlugin extends MarketplacePlugin {
|
|
16
|
+
scope: PluginMarketScope;
|
|
17
|
+
projectPath: string;
|
|
18
|
+
installPath: string;
|
|
19
|
+
version: string;
|
|
20
|
+
installedAt: string;
|
|
21
|
+
}
|
|
22
|
+
export interface MarketplaceCatalog {
|
|
23
|
+
marketplaces: PluginMarketplace[];
|
|
24
|
+
warning: string;
|
|
25
|
+
}
|
|
26
|
+
export interface PluginCatalog {
|
|
27
|
+
plugins: MarketplacePlugin[];
|
|
28
|
+
warning: string;
|
|
29
|
+
}
|
|
30
|
+
/** Host-owned paths for the remote Web directory browser. */
|
|
31
|
+
export interface PluginProjectDirectories {
|
|
32
|
+
path: string;
|
|
33
|
+
home: string;
|
|
34
|
+
crumbs: Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
path: string;
|
|
37
|
+
hidden: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
entries: Array<{
|
|
40
|
+
name: string;
|
|
41
|
+
path: string;
|
|
42
|
+
hidden: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
truncated: boolean;
|
|
45
|
+
}
|
|
46
|
+
export type PluginProjectPick = {
|
|
47
|
+
kind: 'native';
|
|
48
|
+
path: string | null;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'browse';
|
|
51
|
+
};
|
|
52
|
+
export interface PluginMarketService {
|
|
53
|
+
marketplaces(): Promise<MarketplaceCatalog>;
|
|
54
|
+
plugins(marketplaceId: string): Promise<MarketplacePlugin[]>;
|
|
55
|
+
catalog?(marketplaceId: string): Promise<PluginCatalog>;
|
|
56
|
+
installed(cwd: string): Promise<InstalledMarketplacePlugin[]>;
|
|
57
|
+
install(cwd: string, pluginId: string, scope: PluginMarketScope): Promise<InstalledMarketplacePlugin>;
|
|
58
|
+
uninstall(cwd: string, pluginId: string, scope: PluginMarketScope): Promise<void>;
|
|
59
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* the browser bundle never pulls the schema runtime in.
|
|
7
7
|
*/
|
|
8
8
|
/** The user-settings namespace holding the side card preferences. */
|
|
9
|
-
export declare const SIDEBAR_PREFS_NS = "
|
|
9
|
+
export declare const SIDEBAR_PREFS_NS = "better-sidebar";
|
|
10
10
|
/** User-facing side card preferences (new-conversation defaults). */
|
|
11
11
|
export interface SidebarPrefs {
|
|
12
12
|
/** Whether a brand-new conversation opens the side card by default. */
|
package/lib/types/pty-deps.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type NodePtyModule = typeof nodePtyNs;
|
|
|
6
6
|
* range DSH core declares (`@deepseek-ai/dsh-subprocess-local`): the same
|
|
7
7
|
* range keeps pnpm resolving both to one physical package.
|
|
8
8
|
*/
|
|
9
|
-
export declare const DSH_NODE_PTY_RANGE = "
|
|
9
|
+
export declare const DSH_NODE_PTY_RANGE = "1.2.0-beta.15";
|
|
10
10
|
/**
|
|
11
11
|
* The WebSocket close-code-1011 reason the host sends when node-pty is
|
|
12
12
|
* unavailable. The client recognizes this exact marker and fetches the full
|
|
@@ -22,10 +22,9 @@ export interface UITweaksConfig {
|
|
|
22
22
|
*/
|
|
23
23
|
codeFontScale?: number;
|
|
24
24
|
/**
|
|
25
|
-
* Absolute code font size in px (8–32)
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `codeFontScale` percentage, then to the stock default.
|
|
25
|
+
* Absolute code font size in px (8–32), default 13. Drives code blocks;
|
|
26
|
+
* inline code and small code follow proportionally. When unset, uses a non-default legacy
|
|
27
|
+
* `codeFontScale` percentage, otherwise 13px.
|
|
29
28
|
*/
|
|
30
29
|
codeFontSize?: number;
|
|
31
30
|
/**
|
|
@@ -47,7 +46,7 @@ export interface UITweaksConfig {
|
|
|
47
46
|
gitBarEnabled?: boolean;
|
|
48
47
|
/**
|
|
49
48
|
* Whether the Archive manager is shown: the "归档" Settings page that lists
|
|
50
|
-
* archived sessions and can restore
|
|
49
|
+
* archived sessions and can restore them. Off by
|
|
51
50
|
* default; users turn it on in Settings.
|
|
52
51
|
*/
|
|
53
52
|
archiveManagerEnabled?: boolean;
|
|
@@ -106,7 +105,7 @@ export interface UITweaksConfig {
|
|
|
106
105
|
}
|
|
107
106
|
export declare const MIN_FONT_SIZE = 10;
|
|
108
107
|
export declare const MAX_FONT_SIZE = 32;
|
|
109
|
-
export declare const DEFAULT_FONT_SIZE =
|
|
108
|
+
export declare const DEFAULT_FONT_SIZE = 14;
|
|
110
109
|
/** 16px matches the stock DSH vertical rhythm (message/block gaps, etc.). */
|
|
111
110
|
export declare const MIN_LINE_HEIGHT = 0;
|
|
112
111
|
export declare const MAX_LINE_HEIGHT = 64;
|
|
@@ -115,7 +114,7 @@ export declare const DEFAULT_LINE_HEIGHT = 16;
|
|
|
115
114
|
export declare const MIN_CODE_FONT_SCALE = 50;
|
|
116
115
|
export declare const MAX_CODE_FONT_SCALE = 150;
|
|
117
116
|
export declare const DEFAULT_CODE_FONT_SCALE = 81;
|
|
118
|
-
/**
|
|
117
|
+
/** Default absolute code-block size, paired with 14px prose. */
|
|
119
118
|
export declare const MIN_CODE_FONT_SIZE = 8;
|
|
120
119
|
export declare const MAX_CODE_FONT_SIZE = 32;
|
|
121
120
|
export declare const DEFAULT_CODE_FONT_SIZE = 13;
|
|
@@ -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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatcode/cco-better-sidebar",
|
|
3
|
-
"version": "0.18.0-
|
|
3
|
+
"version": "0.18.0-rc.11",
|
|
4
4
|
"description": "ChatCode CLI Web plugin: a VS Code-like right sidebar (explorer / editor / terminal / git / browser), isolated per conversation session. Exposes a service for other plugins to register sidebar tabs and file viewers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"url": "https://github.com/omdsh-dev/DSH-better-sidebar"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
11
|
+
"access": "public",
|
|
12
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
13
|
},
|
|
13
14
|
"main": "lib/index.js",
|
|
14
15
|
"types": "lib/types/index.d.ts",
|
|
@@ -138,7 +139,7 @@
|
|
|
138
139
|
"clsx": "^2.1.1",
|
|
139
140
|
"dompurify": "^3.4.14",
|
|
140
141
|
"mermaid": "^11.16.1",
|
|
141
|
-
"node-pty": "
|
|
142
|
+
"node-pty": "1.2.0-beta.15",
|
|
142
143
|
"react-icons": "5.7.0",
|
|
143
144
|
"rxjs": "^7.8.2",
|
|
144
145
|
"schemastery": "^3.18.0",
|
|
@@ -11,6 +11,7 @@ import { useEffect, useRef, useState } from 'react'
|
|
|
11
11
|
import { api } from './api.ts'
|
|
12
12
|
import { useChatcodeAccount } from './useChatcodeAccount.ts'
|
|
13
13
|
import { redirectToChatcodeLogin } from './chatcode-login-route.ts'
|
|
14
|
+
import { LogoutConfirmDialog } from './LogoutConfirmDialog.tsx'
|
|
14
15
|
import { t } from './locales.ts'
|
|
15
16
|
import css from './sidebar.module.css'
|
|
16
17
|
|
|
@@ -75,6 +76,7 @@ function logout(): void {
|
|
|
75
76
|
export function AccountMenu(): JSX.Element {
|
|
76
77
|
const rootRef = useRef<HTMLDivElement>(null)
|
|
77
78
|
const [open, setOpen] = useState(false)
|
|
79
|
+
const [logoutTarget, setLogoutTarget] = useState<'chatcode' | 'browser'>()
|
|
78
80
|
const [userName, setUserName] = useState('User')
|
|
79
81
|
const { chatcode, busy, error, loginUrl, startLogin, logout: logoutChatcode } = useChatcodeAccount()
|
|
80
82
|
|
|
@@ -157,11 +159,11 @@ export function AccountMenu(): JSX.Element {
|
|
|
157
159
|
{canStartChatcodeLogin && <button type="button" role="menuitem" className={css.accountItem} disabled={busy} onClick={startLogin}>
|
|
158
160
|
<LogoutIcon />{busy ? t('accountMenuChatcodeStarting') : t('accountMenuChatcodeLogin')}
|
|
159
161
|
</button>}
|
|
160
|
-
{hasChatcodeAccount && <button type="button" role="menuitem" className={css.accountItem} disabled={busy} onClick={
|
|
162
|
+
{hasChatcodeAccount && <button type="button" role="menuitem" className={css.accountItem} disabled={busy} onClick={() => { setLogoutTarget('chatcode') }}>
|
|
161
163
|
<LogoutIcon />{t('accountMenuLogout')}
|
|
162
164
|
</button>}
|
|
163
165
|
</>}
|
|
164
|
-
{chatcode?.available === false && <button type="button" role="menuitem" className={css.accountItem} onClick={
|
|
166
|
+
{chatcode?.available === false && <button type="button" role="menuitem" className={css.accountItem} onClick={() => { setLogoutTarget('browser') }}>
|
|
165
167
|
<LogoutIcon />{t('accountMenuLogout')}
|
|
166
168
|
</button>}
|
|
167
169
|
</div>
|
|
@@ -178,6 +180,14 @@ export function AccountMenu(): JSX.Element {
|
|
|
178
180
|
<span className={css.accountName}>{chatcodeName}</span>
|
|
179
181
|
<span className={css.accountPresence} style={{ opacity: signedIn ? 1 : 0.25 }} aria-hidden="true" />
|
|
180
182
|
</button>
|
|
183
|
+
{logoutTarget !== undefined && <LogoutConfirmDialog
|
|
184
|
+
onCancel={() => { setLogoutTarget(undefined) }}
|
|
185
|
+
onConfirm={() => {
|
|
186
|
+
setLogoutTarget(undefined)
|
|
187
|
+
if (logoutTarget === 'chatcode') logoutChatcode()
|
|
188
|
+
else logout()
|
|
189
|
+
}}
|
|
190
|
+
/>}
|
|
181
191
|
</div>
|
|
182
192
|
)
|
|
183
193
|
}
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
IconLinkOutline14,
|
|
24
24
|
IconRefreshOutline14,
|
|
25
25
|
IconWarningOutline16,
|
|
26
|
-
} from '
|
|
26
|
+
} from './icons.tsx'
|
|
27
27
|
import { VscLinkExternal } from 'react-icons/vsc'
|
|
28
28
|
import { api } from './api.ts'
|
|
29
29
|
import { embeddabilityOf, isAllowedLoopbackUrl, normalizeBrowserUrl } from './browser.ts'
|
package/src/client/DiffTab.tsx
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* very content it shows.
|
|
9
9
|
*/
|
|
10
10
|
import { useCallback, useEffect, useState } from 'react'
|
|
11
|
-
import { IconRefreshOutline16 } from '
|
|
11
|
+
import { IconRefreshOutline16 } from './icons.tsx'
|
|
12
12
|
import type { SessionScope } from './api.ts'
|
|
13
13
|
import { api } from './api.ts'
|
|
14
14
|
import type { SidebarDiffRef } from './state.ts'
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'
|
|
26
26
|
import { createElement } from 'react'
|
|
27
27
|
import clsx from 'clsx'
|
|
28
|
-
import { IconCheckOutline16, IconFolderOpen16, IconRefreshOutline14 } from '
|
|
28
|
+
import { IconCheckOutline16, IconFolderOpen16, IconRefreshOutline14 } from './icons.tsx'
|
|
29
29
|
import type { Context } from '../context-types.ts'
|
|
30
30
|
import { api, isOutsideWorkspaceMessage, mediaUrl, type SessionScope } from './api.ts'
|
|
31
31
|
import { BinaryDownload } from './binary-download.tsx'
|
package/src/client/FileTree.tsx
CHANGED
|
@@ -23,15 +23,20 @@
|
|
|
23
23
|
import { useCallback, useEffect, useRef, useState, type DragEvent, type MouseEvent, type ReactNode } from 'react'
|
|
24
24
|
import { createPortal } from 'react-dom'
|
|
25
25
|
import clsx from 'clsx'
|
|
26
|
-
import {
|
|
27
|
-
IconChevronRightOutline14, IconCodeOutline16, IconCopyOutline16, IconDownloadOutline16,
|
|
28
|
-
IconLinkOutline16, Menu, type MenuEntry, type MenuItem, writeClipboard,
|
|
29
|
-
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
26
|
+
import { Menu, type MenuEntry, type MenuItem, writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
30
27
|
import { SiCursor, SiZedindustries } from 'react-icons/si'
|
|
31
28
|
import { VscFile, VscFolder, VscFolderOpened, VscLinkExternal, VscPin, VscPinned } from 'react-icons/vsc'
|
|
32
29
|
import { api, downloadUrl, isOutsideWorkspaceMessage, type FsEntry } from './api.ts'
|
|
33
30
|
import { FenceErrorNotice } from './FenceErrorNotice.tsx'
|
|
34
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
IconChevronRightOutline14,
|
|
33
|
+
IconCodeOutline16,
|
|
34
|
+
IconCopyOutline16,
|
|
35
|
+
IconDownloadOutline16,
|
|
36
|
+
IconLinkOutline16,
|
|
37
|
+
IconUploadOutline16,
|
|
38
|
+
IconVscode16,
|
|
39
|
+
} from './icons.tsx'
|
|
35
40
|
import type { OpenWithTarget } from './open-with.ts'
|
|
36
41
|
import { relativeTo } from './paths.ts'
|
|
37
42
|
import { t } from './locales.ts'
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
|
18
18
|
import clsx from 'clsx'
|
|
19
|
-
import {
|
|
19
|
+
import { Menu } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
20
|
+
import { IconCloseFill14 } from './icons.tsx'
|
|
20
21
|
import type { FloatWindow, SidebarTab } from './state.ts'
|
|
21
22
|
import { FLOAT_MIN_H, FLOAT_MIN_W } from './state.ts'
|
|
22
23
|
import { t } from './locales.ts'
|
package/src/client/GitView.tsx
CHANGED
|
@@ -10,10 +10,14 @@
|
|
|
10
10
|
* file changes appear without a manual refresh.
|
|
11
11
|
*/
|
|
12
12
|
import { useCallback, useEffect, useRef, useState, type MouseEvent, type ReactNode } from 'react'
|
|
13
|
+
import { Button, Input, Menu, Modal, writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
13
14
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
IconBranchOutline16,
|
|
16
|
+
IconCodeOutline16,
|
|
17
|
+
IconCopyOutline16,
|
|
18
|
+
IconRefreshOutline16,
|
|
19
|
+
IconTrashOutline16,
|
|
20
|
+
} from './icons.tsx'
|
|
17
21
|
import type { GitLogEntry, GitStatusEntry, GitStatusResult, GitWorktree, SessionScope } from './api.ts'
|
|
18
22
|
import { api } from './api.ts'
|
|
19
23
|
import { isWithinWorkspace, relativeTo } from './paths.ts'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useEffect, useId, useRef } from 'react'
|
|
2
|
+
import { t } from './locales.ts'
|
|
3
|
+
import css from './sidebar.module.css'
|
|
4
|
+
|
|
5
|
+
/** Native modal supplies an inert background and default Cancel focus until a choice is made. */
|
|
6
|
+
export function LogoutConfirmDialog({ onCancel, onConfirm }: {
|
|
7
|
+
onCancel: () => void
|
|
8
|
+
onConfirm: () => void
|
|
9
|
+
}): JSX.Element {
|
|
10
|
+
const ref = useRef<HTMLDialogElement>(null)
|
|
11
|
+
const titleId = useId()
|
|
12
|
+
const descriptionId = useId()
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const dialog = ref.current
|
|
16
|
+
dialog?.showModal()
|
|
17
|
+
return () => { if (dialog?.open) dialog.close() }
|
|
18
|
+
}, [])
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<dialog
|
|
22
|
+
ref={ref}
|
|
23
|
+
className={css.accountLogoutDialog}
|
|
24
|
+
role="alertdialog"
|
|
25
|
+
aria-modal="true"
|
|
26
|
+
aria-labelledby={titleId}
|
|
27
|
+
aria-describedby={descriptionId}
|
|
28
|
+
onCancel={event => { event.preventDefault(); onCancel() }}
|
|
29
|
+
onKeyDown={event => { event.stopPropagation() }}
|
|
30
|
+
>
|
|
31
|
+
<h2 id={titleId} className={css.accountLogoutTitle}>{t('accountMenuLogoutConfirmTitle')}</h2>
|
|
32
|
+
<p id={descriptionId} className={css.accountLogoutDescription}>{t('accountMenuLogoutConfirmDescription')}</p>
|
|
33
|
+
<div className={css.accountLogoutActions}>
|
|
34
|
+
<button type="button" autoFocus onClick={onCancel}>{t('cancel')}</button>
|
|
35
|
+
<button type="button" className={css.accountLogoutConfirm} onClick={onConfirm}>{t('accountMenuLogout')}</button>
|
|
36
|
+
</div>
|
|
37
|
+
</dialog>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Replace the product's market settings seat through the public slot API. */
|
|
2
|
+
import { useCallback, useEffect, useState, useSyncExternalStore } from 'react'
|
|
3
|
+
import type { Context } from '../context-types.ts'
|
|
4
|
+
import { api, type SessionScope } from './api.ts'
|
|
5
|
+
import { useCurrentSessionId } from './current-session.ts'
|
|
6
|
+
import { PluginMarketView } from './PluginMarketView.tsx'
|
|
7
|
+
import { RenderBoundary } from './RenderBoundary.tsx'
|
|
8
|
+
import { t } from './locales.ts'
|
|
9
|
+
import type { PluginMarketCatalog } from './plugin-market-catalog.ts'
|
|
10
|
+
|
|
11
|
+
export function PluginMarketSettingsSection({ ctx, catalog }: { ctx: Context; catalog: PluginMarketCatalog }): JSX.Element {
|
|
12
|
+
const sessionId = useCurrentSessionId(ctx) ?? ''
|
|
13
|
+
const sessions = useSyncExternalStore(
|
|
14
|
+
useCallback(listener => ctx.sessions.list.subscribe(listener), [ctx]),
|
|
15
|
+
useCallback(() => ctx.sessions.list.getSnapshot(), [ctx]),
|
|
16
|
+
)
|
|
17
|
+
useSyncExternalStore(
|
|
18
|
+
useCallback(listener => ctx.locale.subscribe(listener), [ctx]),
|
|
19
|
+
useCallback(() => ctx.locale.getSnapshot(), [ctx]),
|
|
20
|
+
)
|
|
21
|
+
const cwd = sessions.byId[sessionId]?.cwd
|
|
22
|
+
const key = `${sessionId}\0${cwd ?? ''}`
|
|
23
|
+
const [context, setContext] = useState<{ key: string; scope: SessionScope }>()
|
|
24
|
+
const [error, setError] = useState('')
|
|
25
|
+
const [revision, setRevision] = useState(0)
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const controller = new AbortController()
|
|
28
|
+
let active = true
|
|
29
|
+
setError('')
|
|
30
|
+
void api.pluginMarketContext({ sessionId, cwd }, controller.signal)
|
|
31
|
+
.then(scope => { if (active) setContext({ key, scope }) })
|
|
32
|
+
.catch(cause => { if (active) setError(cause instanceof Error ? cause.message : String(cause)) })
|
|
33
|
+
return () => { active = false; controller.abort() }
|
|
34
|
+
}, [sessionId, cwd, revision])
|
|
35
|
+
|
|
36
|
+
return <div data-chatcode-plugin-market-settings>
|
|
37
|
+
{context?.key === key ? <PluginMarketView key={key} scope={context.scope} catalog={catalog} visible />
|
|
38
|
+
: error ? <><p role="status">{error}</p><button type="button" onClick={() => setRevision(value => value + 1)}>{t('pluginMarketRefresh')}</button></>
|
|
39
|
+
: <p role="status">{t('pluginMarketLoading')}</p>}
|
|
40
|
+
</div>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function registerPluginMarketSettings(ctx: Context, catalog: PluginMarketCatalog): void {
|
|
44
|
+
// Same seat as dsh-market, lower priority wins independent of activation
|
|
45
|
+
// order. The settings shell projects elected entries, giving one nav row.
|
|
46
|
+
// The old market component never mounts; the skill-market seat is untouched.
|
|
47
|
+
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
48
|
+
name: 'settings.section',
|
|
49
|
+
id: 'market',
|
|
50
|
+
order: 40,
|
|
51
|
+
priority: -10,
|
|
52
|
+
label: () => t('pluginMarketTitle'),
|
|
53
|
+
inject: () => ({ ctx, catalog }),
|
|
54
|
+
}, ({ ctx, catalog }: { ctx: Context; catalog: PluginMarketCatalog }) => <RenderBoundary><PluginMarketSettingsSection ctx={ctx} catalog={catalog} /></RenderBoundary>))
|
|
55
|
+
}
|