dsh-project-mcp 0.2.0 → 0.4.0
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 +108 -47
- package/lib/client.d.ts +77 -0
- package/lib/client.js +10127 -0
- package/lib/client.js.map +1 -0
- package/lib/index.d.ts +3785 -0
- package/lib/index.js +7563 -0
- package/lib/index.js.map +1 -0
- package/package.json +31 -34
- package/src/activation.ts +170 -44
- package/src/client/design-fixtures.ts +96 -1
- package/src/client/design.ts +64 -51
- package/src/client/index.ts +74 -133
- package/src/client/locales/ui.ts +54 -20
- package/src/client/plugin-config.ts +9 -9
- package/src/client/settings.ts +2 -2
- package/src/client/sidebar-tab.ts +521 -0
- package/src/client/view.ts +780 -80
- package/src/index.ts +18 -3
- package/src/runtime.ts +185 -8
- package/src/shared.ts +9 -3
- package/src/types.ts +65 -0
- package/src/ui.ts +61 -3
package/src/client/design.ts
CHANGED
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
import { createElement as h, useState } from 'react'
|
|
29
29
|
import type { ReactNode } from 'react'
|
|
30
30
|
import type { Context } from '@deepseek-ai/cordis'
|
|
31
|
-
import type { BetterSidebarService, TabDescriptor } from 'dsh-better-sidebar'
|
|
32
|
-
import { TAB_ID } from '../shared.ts'
|
|
33
31
|
import { en, ru, zh } from './locales/ui.ts'
|
|
34
32
|
import { NS_HOST, en as hostEn, ru as hostRu, zh as hostZh, hostTranslate } from './locales/host.ts'
|
|
33
|
+
import { registerSidebarTab } from './sidebar-tab.ts'
|
|
34
|
+
import type { SidebarSettingsProps, SidebarTabBodyProps, SidebarTabServices } from './sidebar-tab.ts'
|
|
35
35
|
import {
|
|
36
36
|
DEFAULT_SETTINGS_VIEW,
|
|
37
37
|
NS,
|
|
@@ -51,8 +51,10 @@ import type { ToastsServices } from './toasts.ts'
|
|
|
51
51
|
import {
|
|
52
52
|
PanelHeader,
|
|
53
53
|
ProjectBlock,
|
|
54
|
+
RefreshRow,
|
|
54
55
|
STYLE,
|
|
55
56
|
browserStorage,
|
|
57
|
+
createRefreshStore,
|
|
56
58
|
sessionLogCount,
|
|
57
59
|
statusGroups,
|
|
58
60
|
storedString,
|
|
@@ -169,16 +171,20 @@ export function DesignPanel(props: {
|
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
/**
|
|
172
|
-
* The tab's own settings
|
|
174
|
+
* The tab's own settings popup, drawn from a picture.
|
|
173
175
|
*
|
|
174
|
-
* Same shape as `ProjectMcpSettings
|
|
175
|
-
* counts the projects and offers `Sync`/`Close`, and
|
|
176
|
-
* `ProjectBlock` per project — the product's own
|
|
177
|
-
*
|
|
178
|
-
*
|
|
176
|
+
* Same shape as `ProjectMcpSettings`: the poll-interval row first, then the bar
|
|
177
|
+
* that names the surface, counts the projects and offers `Sync`/`Close`, and a
|
|
178
|
+
* body rendering one `ProjectBlock` per project — the product's own components,
|
|
179
|
+
* fed here. The row is shared with the product rather than redrawn, so the two
|
|
180
|
+
* cannot drift on the control this port moved into the popup.
|
|
181
|
+
* @param props - the picture, the interval, the close seat and the translate seats.
|
|
182
|
+
* @returns the popup element tree.
|
|
179
183
|
*/
|
|
180
184
|
export function DesignPopup(props: {
|
|
181
185
|
variant: DesignVariant
|
|
186
|
+
refreshMs: number
|
|
187
|
+
onRefreshMs?: ((value: number) => void) | undefined
|
|
182
188
|
onClose?: (() => void) | undefined
|
|
183
189
|
t?: Translate | undefined
|
|
184
190
|
/** Host-namespace seat for the fixtures' coded payload fields (F-48). */
|
|
@@ -200,6 +206,7 @@ export function DesignPopup(props: {
|
|
|
200
206
|
? null
|
|
201
207
|
: h('button', { style: STYLE.button, onClick: () => props.onClose?.() }, t('close')),
|
|
202
208
|
),
|
|
209
|
+
h(RefreshRow, { refreshMs: props.refreshMs, onRefreshMs: props.onRefreshMs, t }),
|
|
203
210
|
h(
|
|
204
211
|
'div',
|
|
205
212
|
{ style: STYLE.body },
|
|
@@ -282,38 +289,43 @@ export function DesignSettingsTab(props: {
|
|
|
282
289
|
}
|
|
283
290
|
|
|
284
291
|
/**
|
|
285
|
-
* The tab
|
|
286
|
-
*
|
|
287
|
-
*
|
|
292
|
+
* The tab body the entry hands to {@link registerSidebarTab}.
|
|
293
|
+
*
|
|
294
|
+
* The entry already bound both translate seats, so the adapter only forwards the
|
|
295
|
+
* framework's own session and the fixture the mode was started with — the
|
|
296
|
+
* product's own adapter (`LocalizedPanel` in `./index.ts`) does the same with the
|
|
297
|
+
* real panel.
|
|
298
|
+
* @param props - the body's props, seats included.
|
|
299
|
+
* @returns the fixture panel.
|
|
288
300
|
*/
|
|
289
|
-
function LocalizedDesignPanel(props: {
|
|
290
|
-
|
|
291
|
-
variant:
|
|
292
|
-
sessionId: string | undefined
|
|
293
|
-
}): ReactNode {
|
|
294
|
-
const t = useTabTranslate(props.locale)
|
|
295
|
-
const hostT = hostTranslate(props.locale)
|
|
296
|
-
return h(DesignPanel, { variant: props.variant, sessionId: props.sessionId, t, hostT })
|
|
301
|
+
export function LocalizedDesignPanel(props: SidebarTabBodyProps & { variant?: DesignVariant }): ReactNode {
|
|
302
|
+
const variant = props.variant ?? 'full'
|
|
303
|
+
return h(DesignPanel, { variant, sessionId: props.sessionId, t: props.t, hostT: props.hostT })
|
|
297
304
|
}
|
|
298
305
|
|
|
299
306
|
/**
|
|
300
|
-
* The
|
|
301
|
-
*
|
|
302
|
-
*
|
|
307
|
+
* The settings popup's fixture content.
|
|
308
|
+
*
|
|
309
|
+
* Same chrome as the product's popup — the poll-interval row first, then the
|
|
310
|
+
* per-project blocks — with the stand's fixtures behind it. The interval row is
|
|
311
|
+
* the shared {@link RefreshRow}, so the stand cannot drift from the product on
|
|
312
|
+
* the control the port moved here.
|
|
313
|
+
* @param props - the popup's props, seats included, plus the fixture variant.
|
|
314
|
+
* @returns the fixture popup.
|
|
303
315
|
*/
|
|
304
|
-
function LocalizedDesignPopup(props: {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
return h(DesignPopup, { variant: props.variant, onClose: props.onClose, t, hostT })
|
|
316
|
+
export function LocalizedDesignPopup(props: SidebarSettingsProps & { variant?: DesignVariant }): ReactNode {
|
|
317
|
+
const variant = props.variant ?? 'full'
|
|
318
|
+
return h(DesignPopup, {
|
|
319
|
+
variant,
|
|
320
|
+
refreshMs: props.refreshMs,
|
|
321
|
+
onRefreshMs: props.onRefreshMs,
|
|
322
|
+
onClose: props.onClose,
|
|
323
|
+
t: props.t,
|
|
324
|
+
hostT: props.hostT,
|
|
325
|
+
})
|
|
315
326
|
}
|
|
316
327
|
|
|
328
|
+
|
|
317
329
|
/**
|
|
318
330
|
* The frame-wide toast stack, repeating its three fixture banners.
|
|
319
331
|
*
|
|
@@ -348,7 +360,7 @@ export function registerDesignToasts(services: ToastsServices): void {
|
|
|
348
360
|
/**
|
|
349
361
|
* Register the fixture surfaces on the browser half.
|
|
350
362
|
*
|
|
351
|
-
* Mirrors `apply`'s own wiring exactly — the tab behind
|
|
363
|
+
* Mirrors `apply`'s own wiring exactly — the tab behind the right sidebar's
|
|
352
364
|
* settings page behind `slots` + `locale`, the toasts behind `slots` alone — so
|
|
353
365
|
* the design mode is a drop-in replacement for the real one and a composition
|
|
354
366
|
* missing a service behaves the same way in both.
|
|
@@ -362,25 +374,26 @@ export function registerDesignSurfaces(
|
|
|
362
374
|
const locale = localeServiceOf(ctx)
|
|
363
375
|
const t = tabTranslate(locale)
|
|
364
376
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
377
|
+
// The same four seats the product registers, from the fixtures: the stand has
|
|
378
|
+
// to draw the surface the port produced — a right-sidebar tab, one actions-menu
|
|
379
|
+
// row and the popup in the frame-wide floating layer — or it would be comparing
|
|
380
|
+
// the product against a surface that no longer exists.
|
|
381
|
+
ctx.inject(['slots', 'sidebarRightTabs'], (scope) => {
|
|
382
|
+
registerSidebarTab(scope as unknown as SidebarTabServices, {
|
|
383
|
+
locale,
|
|
384
|
+
// The stand reads and writes the same browser-local interval the product
|
|
385
|
+
// does, so the row a designer presses there behaves exactly like the row
|
|
386
|
+
// the product shows.
|
|
387
|
+
refresh: createRefreshStore(),
|
|
388
|
+
body: (props) =>
|
|
389
|
+
h(LocalizedDesignPanel, { ...props, variant }),
|
|
390
|
+
settings: (props) =>
|
|
391
|
+
h(LocalizedDesignPopup, { ...props, variant }),
|
|
392
|
+
copy: {
|
|
370
393
|
title: () => t('designTitle', { variant }),
|
|
371
394
|
description: () => t('designDesc', { variant }),
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
settings: {
|
|
375
|
-
render: (
|
|
376
|
-
props: Parameters<NonNullable<NonNullable<TabDescriptor['settings']>['render']>>[0],
|
|
377
|
-
) =>
|
|
378
|
-
h(LocalizedDesignPopup, { locale, variant, onClose: props.close }),
|
|
379
|
-
},
|
|
380
|
-
component: (props: Parameters<TabDescriptor['component']>[0]) =>
|
|
381
|
-
h(LocalizedDesignPanel, { locale, variant, sessionId: props.scope.sessionId }),
|
|
382
|
-
}),
|
|
383
|
-
)
|
|
395
|
+
},
|
|
396
|
+
})
|
|
384
397
|
})
|
|
385
398
|
|
|
386
399
|
ctx.inject(['slots', 'locale'], (scope) => {
|
package/src/client/index.ts
CHANGED
|
@@ -1,55 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `dsh-project-mcp`, browser half: a DSH sidebar tab that shows which MCP
|
|
2
|
+
* `dsh-project-mcp`, browser half: a DSH right-sidebar tab that shows which MCP
|
|
3
3
|
* servers each project declares and what is currently mounted for its sessions,
|
|
4
|
-
* its own settings
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* its own settings popup in the tab chip's actions menu, a page in DSH's native
|
|
5
|
+
* Settings listing every project with a live session, and a frame-wide toast
|
|
6
|
+
* stack for the servers that come up, fail or are released.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* The tab is a type of DSH's own right sidebar (`./sidebar-tab.ts`, which mirrors
|
|
9
|
+
* the shipped contract structurally), and the popup is an entry of the frame-wide
|
|
10
|
+
* floating layer. The other three seats are the browser-shell slots
|
|
11
|
+
* `settings.section`, `plugins.bundle.config` and `shell.overlay`. Every seat
|
|
12
|
+
* exists in the browser half only. The host half publishes the same data over
|
|
13
|
+
* `/project-mcp/*` (see `src/ui.ts`), so this module never imports host code at
|
|
14
|
+
* runtime.
|
|
13
15
|
*
|
|
14
16
|
* @module dsh-project-mcp/client
|
|
15
17
|
*/
|
|
16
18
|
|
|
17
|
-
import { createElement
|
|
19
|
+
import { createElement } from 'react'
|
|
18
20
|
import type { ReactNode } from 'react'
|
|
19
|
-
import type { BetterSidebarService, TabDescriptor } from 'dsh-better-sidebar'
|
|
20
21
|
import type { Context } from '@deepseek-ai/cordis'
|
|
21
|
-
import { PACKAGE_NAME
|
|
22
|
+
import { PACKAGE_NAME } from '../shared.ts'
|
|
22
23
|
import { designModeEnabled, registerDesignSurfaces } from './design.ts'
|
|
23
24
|
import { en, ru, zh } from './locales/ui.ts'
|
|
24
|
-
import { NS_HOST, en as hostEn, ru as hostRu, zh as hostZh
|
|
25
|
+
import { NS_HOST, en as hostEn, ru as hostRu, zh as hostZh } from './locales/host.ts'
|
|
25
26
|
import { registerPluginConfigCard } from './plugin-config.ts'
|
|
26
27
|
import type { PluginConfigSlotServices } from './plugin-config.ts'
|
|
27
28
|
import { NS, registerSettingsTab } from './settings.ts'
|
|
28
29
|
import type { SettingsSlotServices } from './settings.ts'
|
|
29
|
-
import { localeServiceOf
|
|
30
|
-
import
|
|
30
|
+
import { localeServiceOf } from './tab-locale.ts'
|
|
31
|
+
import { registerSidebarTab } from './sidebar-tab.ts'
|
|
32
|
+
import type { SidebarSettingsProps, SidebarTabBodyProps, SidebarTabServices } from './sidebar-tab.ts'
|
|
31
33
|
import { registerToasts } from './toasts.ts'
|
|
32
34
|
import type { ToastsServices } from './toasts.ts'
|
|
33
|
-
import {
|
|
34
|
-
ProjectMcpPanel,
|
|
35
|
-
ProjectMcpSettings,
|
|
36
|
-
REFRESH_KEY,
|
|
37
|
-
pluginSettingsOf,
|
|
38
|
-
refreshMsOf,
|
|
39
|
-
} from './view.ts'
|
|
35
|
+
import { ProjectMcpPanel, ProjectMcpSettings, createRefreshStore } from './view.ts'
|
|
40
36
|
|
|
41
37
|
/** Plugin name: matches the package name and the host half. */
|
|
42
38
|
export const name = PACKAGE_NAME
|
|
43
39
|
|
|
44
40
|
/**
|
|
45
|
-
* Register the
|
|
41
|
+
* Register the surfaces, each behind the services it actually needs.
|
|
46
42
|
*
|
|
47
|
-
* No module-level dependency is declared, because
|
|
48
|
-
* module-level `inject` would leave this entry **pending** for good in a
|
|
49
|
-
* composition without
|
|
43
|
+
* No module-level dependency is declared, because every one of them is optional:
|
|
44
|
+
* a module-level `inject` would leave this entry **pending** for good in a
|
|
45
|
+
* composition without the right sidebar, and DSH's web boot audit refuses to
|
|
50
46
|
* start while an entry is pending. `ctx.inject(name, …)` waits for the same
|
|
51
|
-
*
|
|
52
|
-
* the native Settings page and the toast stack.
|
|
47
|
+
* services without gating the entry, so a composition without the sidebar keeps
|
|
48
|
+
* the native Settings page, the config card and the toast stack.
|
|
53
49
|
*
|
|
54
50
|
* A service this fiber did not declare must never be read as a property: Cordis
|
|
55
51
|
* throws `cannot get property "…" without inject`, and that throw fails the
|
|
@@ -59,81 +55,46 @@ export const name = PACKAGE_NAME
|
|
|
59
55
|
export const inject: string[] = []
|
|
60
56
|
|
|
61
57
|
/**
|
|
62
|
-
* Register the browser half's surfaces.
|
|
63
|
-
* Cordis runs
|
|
64
|
-
* free of "already registered" failures.
|
|
58
|
+
* Register the browser half's surfaces. Every registration returns a disposer and
|
|
59
|
+
* Cordis runs them on fiber disposal, which is what keeps HMR and plugin
|
|
60
|
+
* disabling free of "already registered" failures.
|
|
65
61
|
* @param ctx - client root context.
|
|
66
62
|
*/
|
|
67
63
|
export function apply(ctx: Context): void {
|
|
68
|
-
// The design-only render mode: when the flag names a picture, the
|
|
64
|
+
// The design-only render mode: when the flag names a picture, the four
|
|
69
65
|
// surfaces below are registered from fixtures instead (`./design.ts`). It is a
|
|
70
|
-
// replacement, never an addition — two registrations of one tab id would
|
|
71
|
-
// over the same sidebar cell. The flag is a browser-local preference, so
|
|
72
|
-
// product and the fixture mode are one bundle apart, not one build apart.
|
|
66
|
+
// replacement, never an addition — two registrations of one tab type id would
|
|
67
|
+
// fight over the same sidebar cell. The flag is a browser-local preference, so
|
|
68
|
+
// the product and the fixture mode are one bundle apart, not one build apart.
|
|
73
69
|
if (designModeEnabled()) {
|
|
74
70
|
registerDesignSurfaces(ctx)
|
|
75
71
|
return
|
|
76
72
|
}
|
|
77
73
|
|
|
78
|
-
// The
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
// falls back to the merged English table
|
|
74
|
+
// The plugin's own translate seat: the slots below are registered without a
|
|
75
|
+
// locale namespace of their own, because the plugin registers its dictionaries
|
|
76
|
+
// itself and wants the tab to repaint on a language switch either way. The
|
|
77
|
+
// shell's locale service is read with `ctx.get` — this fiber does not declare
|
|
78
|
+
// it — and without one the seat falls back to the merged English table
|
|
79
|
+
// composed in ./locales/ui.ts.
|
|
83
80
|
const locale = localeServiceOf(ctx)
|
|
84
|
-
const t = tabTranslate(locale)
|
|
85
81
|
|
|
86
|
-
// The
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// Live copy, the closure shape: the sidebar's `SidebarSettingToggle`
|
|
103
|
-
// declares `title`/`desc` as `string | (() => string)` ("i18n
|
|
104
|
-
// friendly", service.ts), exactly like the descriptor's own title
|
|
105
|
-
// above, so the row re-reads the seat on every render and no
|
|
106
|
-
// re-registration is needed. (The alternative — strings resolved
|
|
107
|
-
// at registration plus a re-register on locale change — would
|
|
108
|
-
// leave the row frozen until then.)
|
|
109
|
-
title: () => t('refreshTitle'),
|
|
110
|
-
desc: () => t('refreshDesc'),
|
|
111
|
-
type: 'number',
|
|
112
|
-
min: 1_000,
|
|
113
|
-
max: 60_000,
|
|
114
|
-
unit: 'ms',
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
render: (props: Parameters<NonNullable<NonNullable<TabDescriptor['settings']>['render']>>[0]) =>
|
|
118
|
-
createElement(LocalizedSettings, {
|
|
119
|
-
pluginSettings: props.pluginSettings,
|
|
120
|
-
updatePluginSetting: props.updatePluginSetting,
|
|
121
|
-
onClose: props.close,
|
|
122
|
-
locale,
|
|
123
|
-
}),
|
|
124
|
-
},
|
|
125
|
-
// `LocalizedPanel` re-binds the seat when the shell's language changes:
|
|
126
|
-
// the descriptor's own title is read again by the sidebar on every render,
|
|
127
|
-
// and the panel below it subscribes to the same service.
|
|
128
|
-
component: (props: Parameters<TabDescriptor['component']>[0]) =>
|
|
129
|
-
createElement(LocalizedPanel, {
|
|
130
|
-
locale,
|
|
131
|
-
visible: props.visible,
|
|
132
|
-
sessionId: props.scope.sessionId,
|
|
133
|
-
refreshMs: refreshMsOf(pluginSettingsOf(betterSidebar.getSnapshot())),
|
|
134
|
-
}),
|
|
135
|
-
}),
|
|
136
|
-
)
|
|
82
|
+
// The panel's poll interval, shared by the tab it paces and the popup that
|
|
83
|
+
// changes it. One store for both, because the two are not in one tree.
|
|
84
|
+
const refresh = createRefreshStore()
|
|
85
|
+
|
|
86
|
+
// The sidebar tab, its chip's settings row and the settings popup itself:
|
|
87
|
+
// `./sidebar-tab.ts` holds the structural contract of DSH's own right sidebar
|
|
88
|
+
// and registers all four seats behind the services they need. `ctx.inject`
|
|
89
|
+
// parks this callback until the slot registry and the tab registry exist, so a
|
|
90
|
+
// composition without a right sidebar still boots everything below.
|
|
91
|
+
ctx.inject(['slots', 'sidebarRightTabs'], (scope) => {
|
|
92
|
+
registerSidebarTab(scope as unknown as SidebarTabServices, {
|
|
93
|
+
locale,
|
|
94
|
+
refresh,
|
|
95
|
+
body: LocalizedPanel,
|
|
96
|
+
settings: LocalizedSettings,
|
|
97
|
+
})
|
|
137
98
|
})
|
|
138
99
|
|
|
139
100
|
// The native Settings page. `ctx.inject` runs this callback only once both
|
|
@@ -196,60 +157,40 @@ export function apply(ctx: Context): void {
|
|
|
196
157
|
}
|
|
197
158
|
|
|
198
159
|
/**
|
|
199
|
-
* The sidebar panel
|
|
160
|
+
* The sidebar panel.
|
|
200
161
|
*
|
|
201
|
-
* `
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
* @
|
|
162
|
+
* `./sidebar-tab.ts` already bound the two translate seats — the UI namespace and
|
|
163
|
+
* the host-message one — before calling this, so the adapter has nothing left to
|
|
164
|
+
* do but name the component and let React render it as an element rather than as
|
|
165
|
+
* a bare call.
|
|
166
|
+
* @param props - the body's props, seats included.
|
|
167
|
+
* @returns the panel element.
|
|
206
168
|
*/
|
|
207
|
-
export function LocalizedPanel(props: {
|
|
208
|
-
locale: TabLocale | undefined
|
|
209
|
-
visible: boolean
|
|
210
|
-
sessionId: string | undefined
|
|
211
|
-
refreshMs: number
|
|
212
|
-
}): ReactNode {
|
|
213
|
-
const t = useTabTranslate(props.locale)
|
|
214
|
-
// The host namespace beside the UI one: the Logs tab renders the host's
|
|
215
|
-
// coded events (F-48), and the seat follows the active language the same way
|
|
216
|
-
// `t` does — the repaint rides on `t`'s re-bind.
|
|
217
|
-
const hostT = hostTranslate(props.locale)
|
|
169
|
+
export function LocalizedPanel(props: SidebarTabBodyProps): ReactNode {
|
|
218
170
|
return createElement(ProjectMcpPanel, {
|
|
219
171
|
visible: props.visible,
|
|
220
172
|
sessionId: props.sessionId,
|
|
221
173
|
refreshMs: props.refreshMs,
|
|
222
|
-
t,
|
|
223
|
-
hostT,
|
|
174
|
+
t: props.t,
|
|
175
|
+
hostT: props.hostT,
|
|
224
176
|
})
|
|
225
177
|
}
|
|
226
178
|
|
|
227
179
|
/**
|
|
228
|
-
* The
|
|
180
|
+
* The settings popup's content, with the same two seats.
|
|
229
181
|
*
|
|
230
|
-
* The popup is
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* @
|
|
235
|
-
* @returns the popup element with its translator.
|
|
182
|
+
* The popup is an entry of the frame-wide floating layer, so its chrome has to
|
|
183
|
+
* repaint on a language switch exactly like the tab's: the seats are bound per
|
|
184
|
+
* render by `./sidebar-tab.ts`, and this adapter only names the component.
|
|
185
|
+
* @param props - the popup's props, seats included.
|
|
186
|
+
* @returns the settings panel element.
|
|
236
187
|
*/
|
|
237
|
-
export function LocalizedSettings(props: {
|
|
238
|
-
locale: TabLocale | undefined
|
|
239
|
-
pluginSettings: Record<string, unknown>
|
|
240
|
-
updatePluginSetting: (key: string, value: unknown) => void
|
|
241
|
-
onClose?: (() => void) | undefined
|
|
242
|
-
}): ReactNode {
|
|
243
|
-
const t = useTabTranslate(props.locale)
|
|
244
|
-
// The host namespace beside the UI one: the popup renders the host's coded
|
|
245
|
-
// payload fields (F-48), and the bound seat follows the active language the
|
|
246
|
-
// same way `t` does — the repaint still rides on `t`'s re-bind.
|
|
247
|
-
const hostT = hostTranslate(props.locale)
|
|
188
|
+
export function LocalizedSettings(props: SidebarSettingsProps): ReactNode {
|
|
248
189
|
return createElement(ProjectMcpSettings, {
|
|
249
|
-
|
|
250
|
-
|
|
190
|
+
refreshMs: props.refreshMs,
|
|
191
|
+
onRefreshMs: props.onRefreshMs,
|
|
251
192
|
onClose: props.onClose,
|
|
252
|
-
t,
|
|
253
|
-
hostT,
|
|
193
|
+
t: props.t,
|
|
194
|
+
hostT: props.hostT,
|
|
254
195
|
})
|
|
255
196
|
}
|
package/src/client/locales/ui.ts
CHANGED
|
@@ -138,13 +138,28 @@ export const zh: Record<UiKey, string> = {
|
|
|
138
138
|
idleDay: '闲置 {count} 天',
|
|
139
139
|
idleHour: '闲置 {count} 小时',
|
|
140
140
|
idleMinute: '闲置 {count} 分钟',
|
|
141
|
-
// One tool row's detail block:
|
|
141
|
+
// One tool row's detail block (F-56): the serving server with its state, the
|
|
142
|
+
// tier as a sentence, the two counter readings, then the host's own answer
|
|
143
|
+
// about the definition. The header keeps the name, the clock and the step, and the
|
|
144
|
+
// body prints them again in its fact line: that is what the contract's own probe reads
|
|
145
|
+
// out of the open disclosure (`contracts/surfaces.md` §1.5).
|
|
142
146
|
toolServer: '服务器 {server}',
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
toolServerState: '{server} · {state}',
|
|
148
|
+
toolTierPinned: '已置顶 — 始终在请求中',
|
|
149
|
+
toolTierSession: '由本次会话提供',
|
|
150
|
+
toolTierContext: '由上下文排序提供',
|
|
151
|
+
showTool: '显示此工具的服务器、说明、字段及其提供方式',
|
|
152
|
+
hideTool: '隐藏此工具的详细信息',
|
|
153
|
+
toolCallsSession: '本次会话 {count} 次',
|
|
154
|
+
toolLoading: '正在从宿主读取此定义…',
|
|
155
|
+
toolFailed: '宿主没有对此定义作答',
|
|
156
|
+
toolFieldsLabel: '接受',
|
|
157
|
+
toolFieldRequiredHint: '必填字段',
|
|
158
|
+
toolReasonBudget: '未提供:{chars} 字符,超出 {budget} 字符的预算',
|
|
159
|
+
toolReasonChars: '{chars} 字符',
|
|
160
|
+
toolReasonBudgetOnly: '{budget} 字符的预算',
|
|
161
|
+
toolReasonUsed: '已提供 {used}',
|
|
162
|
+
toolReason: '未提供',
|
|
148
163
|
// The errors and logs blocks, under their own disclosures: the event ring is
|
|
149
164
|
// the plugin's own, one project at a time.
|
|
150
165
|
errorsSection: '问题',
|
|
@@ -245,9 +260,11 @@ export const zh: Record<UiKey, string> = {
|
|
|
245
260
|
toastFailed: '{server} 失败',
|
|
246
261
|
toastReleased: '{server} 已释放',
|
|
247
262
|
toastDetail: '{project} · {detail}',
|
|
248
|
-
// The
|
|
263
|
+
// The poll interval's row in the tab's settings panel.
|
|
249
264
|
refreshTitle: '刷新间隔',
|
|
250
265
|
refreshDesc: '面板重新读取宿主快照的频率',
|
|
266
|
+
// The tab's actions menu: the row that opens the settings popup.
|
|
267
|
+
settingsMenuItem: '面板设置…',
|
|
251
268
|
// The design stand's own tab title and description.
|
|
252
269
|
designTitle: '项目 MCP · 设计 ({variant})',
|
|
253
270
|
designDesc: '设计模式:{variant} 夹具,背后没有宿主',
|
|
@@ -439,15 +456,15 @@ export const zh: Record<UiKey, string> = {
|
|
|
439
456
|
configActivationSeeded: '预置工具数',
|
|
440
457
|
configActivationSeededHint: '在计数累计之前,从第一步就提供的工具数;0 表示不预置',
|
|
441
458
|
configActivationMinCalls: '固定所需调用次数',
|
|
442
|
-
configActivationMinCallsHint: '
|
|
459
|
+
configActivationMinCallsHint: '调用达到此次数后,计数器会直接固定该工具;0 表示只要有过调用就固定',
|
|
443
460
|
configToolIdleMs: '工具闲置超时(毫秒)',
|
|
444
|
-
configToolIdleMsHint: '
|
|
461
|
+
configToolIdleMsHint: '工具超过此时长未使用将从请求中移除;0 表示整个会话都保留',
|
|
445
462
|
configGuidanceEnabled: '系统提示指引',
|
|
446
463
|
configGuidanceEnabledHint: '将本插件的使用说明注入会话提示',
|
|
447
464
|
configActivationAutoLimit: '自动激活上限',
|
|
448
465
|
configActivationAutoLimitHint: '计数器最多可自行加入的工具数(0–50)',
|
|
449
466
|
configActivationAutoStickySteps: '黏滞步数',
|
|
450
|
-
configActivationAutoStickyStepsHint: '
|
|
467
|
+
configActivationAutoStickyStepsHint: '按任务上下文提供的工具额外保留多少条用户消息;0 表示仅保留当前消息(0–1000)',
|
|
451
468
|
configActivationToolBudgetChars: '工具预算(字符)',
|
|
452
469
|
configActivationToolBudgetCharsHint: '单次请求携带的工具模式字符预算(≥ 1000)',
|
|
453
470
|
configAllowGlobalWrite: '允许全局写入',
|
|
@@ -546,13 +563,28 @@ export const ru: Record<UiKey, string> = {
|
|
|
546
563
|
idleDay: 'простой {count}д',
|
|
547
564
|
idleHour: 'простой {count}ч',
|
|
548
565
|
idleMinute: 'простой {count}мин',
|
|
549
|
-
// One tool row's detail block:
|
|
566
|
+
// One tool row's detail block (F-56): the serving server with its state, the
|
|
567
|
+
// tier as a sentence, the two counter readings, then the host's own answer
|
|
568
|
+
// about the definition. The header keeps the name, the clock and the step, and the
|
|
569
|
+
// body prints them again in its fact line: that is what the contract's own probe reads
|
|
570
|
+
// out of the open disclosure (`contracts/surfaces.md` §1.5).
|
|
550
571
|
toolServer: 'сервер {server}',
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
572
|
+
toolServerState: '{server} · {state}',
|
|
573
|
+
toolTierPinned: 'закреплён — всегда в запросе',
|
|
574
|
+
toolTierSession: 'предложен этой сессией',
|
|
575
|
+
toolTierContext: 'предложен ранжированием контекста',
|
|
576
|
+
showTool: 'показать сервер инструмента, описание, поля и способ предложения',
|
|
577
|
+
hideTool: 'скрыть подробности инструмента',
|
|
578
|
+
toolCallsSession: '{count} в этой сессии',
|
|
579
|
+
toolLoading: 'читаем это определение у хоста…',
|
|
580
|
+
toolFailed: 'хост не ответил на это определение',
|
|
581
|
+
toolFieldsLabel: 'принимает',
|
|
582
|
+
toolFieldRequiredHint: 'обязательное поле',
|
|
583
|
+
toolReasonBudget: 'не предложен: {chars} символов при бюджете {budget}',
|
|
584
|
+
toolReasonChars: '{chars} символов',
|
|
585
|
+
toolReasonBudgetOnly: 'бюджет {budget} символов',
|
|
586
|
+
toolReasonUsed: 'уже предложено {used}',
|
|
587
|
+
toolReason: 'не предложен',
|
|
556
588
|
// The errors and logs blocks, under their own disclosures.
|
|
557
589
|
errorsSection: 'Проблемы',
|
|
558
590
|
showErrors: 'показать серверы, требующие внимания',
|
|
@@ -648,9 +680,11 @@ export const ru: Record<UiKey, string> = {
|
|
|
648
680
|
toastFailed: '{server}: сбой',
|
|
649
681
|
toastReleased: '{server} освобождён',
|
|
650
682
|
toastDetail: '{project} · {detail}',
|
|
651
|
-
// The
|
|
683
|
+
// The poll interval's row in the tab's settings panel.
|
|
652
684
|
refreshTitle: 'Интервал обновления',
|
|
653
685
|
refreshDesc: 'Как часто панель перечитывает снимок хоста',
|
|
686
|
+
// The tab's actions menu: the row that opens the settings popup.
|
|
687
|
+
settingsMenuItem: 'Настройки панели…',
|
|
654
688
|
// The design stand's own tab title and description.
|
|
655
689
|
designTitle: 'MCP проекта · дизайн ({variant})',
|
|
656
690
|
designDesc: 'режим дизайна: фикстура {variant}, хоста за ней нет',
|
|
@@ -842,15 +876,15 @@ export const ru: Record<UiKey, string> = {
|
|
|
842
876
|
configActivationSeeded: 'Предустановленные инструменты',
|
|
843
877
|
configActivationSeededHint: 'Инструменты, предлагаемые с первого шага, до накопления счётчиков; 0 — не предлагать',
|
|
844
878
|
configActivationMinCalls: 'Вызовов до закрепления',
|
|
845
|
-
configActivationMinCallsHint: 'После стольких вызовов счётчики закрепляют инструмент
|
|
879
|
+
configActivationMinCallsHint: 'После стольких вызовов счётчики закрепляют инструмент напрямую; 0 — закрепить любой инструмент с записанным вызовом',
|
|
846
880
|
configToolIdleMs: 'Тайм-аут простоя инструмента (мс)',
|
|
847
|
-
configToolIdleMsHint: 'Инструмент, не использованный за это время, исключается из
|
|
881
|
+
configToolIdleMsHint: 'Инструмент, не использованный за это время, исключается из запроса; 0 — оставить его на всю сессию',
|
|
848
882
|
configGuidanceEnabled: 'Подсказки в системном промпте',
|
|
849
883
|
configGuidanceEnabledHint: 'Добавлять рабочие заметки плагина в промпт сессии',
|
|
850
884
|
configActivationAutoLimit: 'Лимит автоактивации',
|
|
851
885
|
configActivationAutoLimitHint: 'Максимум инструментов, которые счётчики могут добавить сами (0–50)',
|
|
852
886
|
configActivationAutoStickySteps: 'Шагов закрепления',
|
|
853
|
-
configActivationAutoStickyStepsHint: 'Сколько
|
|
887
|
+
configActivationAutoStickyStepsHint: 'Сколько пользовательских сообщений предложенный по контексту инструмент остаётся предложенным; 0 — только для этого сообщения (0–1000)',
|
|
854
888
|
configActivationToolBudgetChars: 'Бюджет инструментов (символы)',
|
|
855
889
|
configActivationToolBudgetCharsHint: 'Бюджет в символах на схемы инструментов в одном запросе (≥ 1000)',
|
|
856
890
|
configAllowGlobalWrite: 'Глобальная запись',
|