dsh-project-mcp 0.2.0 → 0.3.1
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 +71 -25
- 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 +3710 -0
- package/lib/index.js +7461 -0
- package/lib/index.js.map +1 -0
- package/package.json +14 -18
- package/src/activation.ts +6 -1
- 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 +48 -14
- 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 +162 -1
- package/src/shared.ts +9 -3
- package/src/types.ts +65 -0
- package/src/ui.ts +61 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-project-mcp",
|
|
3
3
|
"description": "Per-project MCP servers for DeepSeek Harness: mounts the MCP servers a project declares into the sessions working in it",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"dsh",
|
|
19
|
+
"dsh-plugin",
|
|
19
20
|
"deepseek-harness",
|
|
20
21
|
"mcp",
|
|
21
22
|
"model-context-protocol",
|
|
@@ -59,34 +60,29 @@
|
|
|
59
60
|
},
|
|
60
61
|
"peerDependencies": {
|
|
61
62
|
"@deepseek-ai/cordis": ">=4.0.2",
|
|
62
|
-
"@deepseek-ai/dsh-mcp-client": ">=0.
|
|
63
|
-
"@deepseek-ai/dsh-scope": ">=0.
|
|
64
|
-
"dsh-better-sidebar": ">=0.19.0",
|
|
63
|
+
"@deepseek-ai/dsh-mcp-client": ">=0.2.0-rc.2",
|
|
64
|
+
"@deepseek-ai/dsh-scope": ">=0.2.0-rc.2",
|
|
65
65
|
"react": ">=18.2.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
|
-
"dsh-better-sidebar": {
|
|
69
|
-
"optional": true
|
|
70
|
-
},
|
|
71
68
|
"react": {
|
|
72
69
|
"optional": true
|
|
73
70
|
}
|
|
74
71
|
},
|
|
75
72
|
"devDependencies": {
|
|
76
|
-
"@deepseek-ai/cordis": "4.0.
|
|
77
|
-
"@deepseek-ai/dsh-mcp-client": "0.
|
|
78
|
-
"@deepseek-ai/dsh-scope": "0.
|
|
79
|
-
"@
|
|
73
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
74
|
+
"@deepseek-ai/dsh-mcp-client": "0.2.0-rc.2",
|
|
75
|
+
"@deepseek-ai/dsh-scope": "0.2.0-rc.2",
|
|
76
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.2",
|
|
77
|
+
"@types/node": "^22.20.4",
|
|
80
78
|
"@types/react": "^18.3.31",
|
|
81
|
-
"@vitest/coverage-v8": "^5.0.
|
|
82
|
-
"@vitest/ui": "5.0.
|
|
83
|
-
"dsh-better-sidebar": "^0.19.1",
|
|
79
|
+
"@vitest/coverage-v8": "^5.0.2",
|
|
80
|
+
"@vitest/ui": "5.0.2",
|
|
84
81
|
"react": "^18.3.1",
|
|
85
|
-
"tsdown": "^0.
|
|
86
|
-
"unrun": "^0.2.39",
|
|
82
|
+
"tsdown": "^0.23.0",
|
|
87
83
|
"typescript": "^7.0.2",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
84
|
+
"unrun": "^0.3.1",
|
|
85
|
+
"vitest": "^5.0.2"
|
|
90
86
|
},
|
|
91
87
|
"scripts": {
|
|
92
88
|
"build": "tsc -p tsconfig.json && tsdown && node scripts/wrap-client.mjs",
|
package/src/activation.ts
CHANGED
|
@@ -410,10 +410,15 @@ export function surfaceChars(schemas: readonly ToolSchemaLike[]): number {
|
|
|
410
410
|
* {@link surfaceChars} sums, so a caller that splits a surface into two halves
|
|
411
411
|
* counts each half by one rule.
|
|
412
412
|
*
|
|
413
|
+
* Exported for the same reason {@link surfaceChars} is: the on-demand tool
|
|
414
|
+
* detail route answers the *size of one definition* as a host measurement, and
|
|
415
|
+
* a reason line that recomputed it would risk a different number than the
|
|
416
|
+
* budget decision it explains.
|
|
417
|
+
*
|
|
413
418
|
* @param schema - one schema a session may offer.
|
|
414
419
|
* @returns its character count.
|
|
415
420
|
*/
|
|
416
|
-
function schemaChars(schema: ToolSchemaLike): number {
|
|
421
|
+
export function schemaChars(schema: ToolSchemaLike): number {
|
|
417
422
|
return schema.name.length + schema.description.length + serializedLength(schema.parameters)
|
|
418
423
|
}
|
|
419
424
|
|
|
@@ -26,10 +26,11 @@ import type {
|
|
|
26
26
|
ServerUsage,
|
|
27
27
|
SessionSnapshot,
|
|
28
28
|
SessionTools,
|
|
29
|
+
ToolFacts,
|
|
29
30
|
ToolPolicy,
|
|
30
31
|
} from '../types.ts'
|
|
31
32
|
import type { ToastDraft } from './toasts.ts'
|
|
32
|
-
import { STATUS_HINT } from './view.ts'
|
|
33
|
+
import { STATUS_HINT, seedToolFacts } from './view.ts'
|
|
33
34
|
|
|
34
35
|
/** Session the fixtures belong to; `shortSessionId` renders it as `8fce1c`. */
|
|
35
36
|
export const DESIGN_SESSION = 'session-8fce1c-4a3f-4d0b-9c11-2f6a7b8c9d10'
|
|
@@ -93,6 +94,97 @@ export const DESIGN_USAGE: Record<string, ServerUsage> = {
|
|
|
93
94
|
},
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
/**
|
|
98
|
+
* The definitions the stand's own host publishes (F-56).
|
|
99
|
+
*
|
|
100
|
+
* The body of an opened row is answered by `GET tool`, a route the stand has no
|
|
101
|
+
* host behind: without these records every open row of the design surfaces would
|
|
102
|
+
* sit on a read that never lands. The records are the picture's own — they agree
|
|
103
|
+
* with {@link DESIGN_USAGE} (`workspace` was called, `catalog` never) and with
|
|
104
|
+
* {@link designTools} — so the stand draws the real body: a description, a field
|
|
105
|
+
* list with one required field and one nested object drawn as its type, and the
|
|
106
|
+
* reason a deferred name is not in the request.
|
|
107
|
+
*
|
|
108
|
+
* They are seeded into the panel's own cache ({@link designProject} calls
|
|
109
|
+
* {@link seedDesignToolFacts}), not branched on inside the row: `view.ts` has no
|
|
110
|
+
* code path that knows whether an answer came from a socket, and the stand must
|
|
111
|
+
* render the product's body rather than a second drawing of it.
|
|
112
|
+
*/
|
|
113
|
+
export const DESIGN_TOOL_FACTS: Record<string, ToolFacts> = {
|
|
114
|
+
'mcp__tglider__workspace': {
|
|
115
|
+
name: 'mcp__tglider__workspace',
|
|
116
|
+
description:
|
|
117
|
+
'Workspace overview: changed symbols, diagnostics and the files that carry them, as one page.',
|
|
118
|
+
fields: [
|
|
119
|
+
{
|
|
120
|
+
name: 'path',
|
|
121
|
+
type: 'string',
|
|
122
|
+
required: true,
|
|
123
|
+
description: 'Directory to read, relative to the project root.',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'depth',
|
|
127
|
+
type: 'number',
|
|
128
|
+
required: false,
|
|
129
|
+
description: 'How deep the dependency walk may go.',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
// An object field is drawn as its own type and not expanded: the panel
|
|
133
|
+
// lists what a call takes, it does not mirror the schema.
|
|
134
|
+
name: 'filters',
|
|
135
|
+
type: 'object',
|
|
136
|
+
required: false,
|
|
137
|
+
description: 'Per-file overrides; the server documents their shape.',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
// No fields at all, so the stand also shows the rule that an empty group draws
|
|
142
|
+
// no heading rather than an empty list under it.
|
|
143
|
+
'mcp__tglider__catalog': {
|
|
144
|
+
name: 'mcp__tglider__catalog',
|
|
145
|
+
description: 'Every tool the server declares, with the size of each definition.',
|
|
146
|
+
fields: [],
|
|
147
|
+
},
|
|
148
|
+
'mcp__grafana-local__query': {
|
|
149
|
+
name: 'mcp__grafana-local__query',
|
|
150
|
+
description: 'Run one PromQL query against a dashboard’s data source.',
|
|
151
|
+
fields: [
|
|
152
|
+
{ name: 'query', type: 'string', required: true, description: 'The PromQL expression.' },
|
|
153
|
+
{ name: 'range', type: 'string', required: false },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
'mcp__context7__docs': {
|
|
157
|
+
name: 'mcp__context7__docs',
|
|
158
|
+
description: 'Documentation pages for one library, ranked by the question asked.',
|
|
159
|
+
fields: [],
|
|
160
|
+
},
|
|
161
|
+
'mcp__playwright__navigate': {
|
|
162
|
+
name: 'mcp__playwright__navigate',
|
|
163
|
+
description: 'Open a URL in the browser and wait for the page to settle.',
|
|
164
|
+
fields: [{ name: 'url', type: 'string', required: true, description: 'Absolute URL to open.' }],
|
|
165
|
+
// Every figure is one the picture's own host measured, which is the whole
|
|
166
|
+
// point of the reason line: the panel prints no size it computed itself.
|
|
167
|
+
reason: { kind: 'budget', chars: 1_240, budget: 8_000, used: 6_900 },
|
|
168
|
+
},
|
|
169
|
+
'mcp__rider__open': {
|
|
170
|
+
name: 'mcp__rider__open',
|
|
171
|
+
description: 'Open one file in the IDE at a line.',
|
|
172
|
+
fields: [{ name: 'path', type: 'string', required: true }],
|
|
173
|
+
reason: { kind: 'budget', chars: 640, budget: 8_000 },
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Publish the picture's definitions into the panel's cache.
|
|
179
|
+
*
|
|
180
|
+
* Idempotent and cheap: called from {@link designProject}, which every design
|
|
181
|
+
* surface renders through, so a fixture body is always seeded before the first
|
|
182
|
+
* row can be opened. Seeding the same record twice is the same record.
|
|
183
|
+
*/
|
|
184
|
+
export function seedDesignToolFacts(): void {
|
|
185
|
+
for (const [name, facts] of Object.entries(DESIGN_TOOL_FACTS)) seedToolFacts(name, facts)
|
|
186
|
+
}
|
|
187
|
+
|
|
96
188
|
/** One lifecycle event, as the ring stores it. */
|
|
97
189
|
function event(
|
|
98
190
|
at: number,
|
|
@@ -320,6 +412,9 @@ function sessionOf(variant: DesignVariant): SessionSnapshot[] {
|
|
|
320
412
|
*/
|
|
321
413
|
export function designProject(variant: DesignVariant): ProjectSnapshot | undefined {
|
|
322
414
|
if (variant === 'no-project' || variant === 'no-session') return undefined
|
|
415
|
+
// The stand's own host answers (F-56): an opened row reads the definitions
|
|
416
|
+
// from the cache the product reads, seeded here because there is no route.
|
|
417
|
+
seedDesignToolFacts()
|
|
323
418
|
const rows = mergedRows(variant)
|
|
324
419
|
const logs = variant === 'full' ? DESIGN_EVENTS : variant === 'tools-absent' ? DESIGN_PENDING_EVENT : []
|
|
325
420
|
const sessions = sessionOf(variant)
|
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) => {
|