dsh-vscode-mode 0.16.0 → 0.18.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 +15 -9
- package/lib/client.js +954 -133
- package/lib/client.js.map +1 -1
- package/lib/index.js +5026 -4387
- package/lib/index.js.map +1 -1
- package/locale/en.json +4 -2
- package/locale/zh.json +4 -2
- package/package.json +4 -2
- package/skills/dsh-vscodemode-mcp/SKILL.md +24 -7
- package/src/capture.ts +2 -2
- package/src/client/compat.ts +2 -1
- package/src/client/index.ts +37 -7
- package/src/client/localeClient.ts +97 -0
- package/src/client/mcpSessionState.ts +108 -0
- package/src/client/monaco/lsp/providers.ts +32 -3
- package/src/client/officialSidebar.ts +4 -1
- package/src/client/state/modelWarmer.ts +198 -0
- package/src/client/state/recordsFeed.ts +241 -0
- package/src/client/styles/editor.css +5 -1
- package/src/client/ui/ConversationDiffDock.ts +10 -19
- package/src/client/ui/DiffBadge.ts +12 -19
- package/src/client/ui/EditorPane.ts +16 -4
- package/src/client/ui/EditorView.ts +114 -51
- package/src/client/ui/McpSessionStatus.ts +75 -0
- package/src/client/ui/McpSettings.ts +47 -13
- package/src/client/ui/PerfSizeBadge.ts +7 -4
- package/src/client/ui/PluginDetailSection.ts +82 -0
- package/src/dshVersion.ts +4 -2
- package/src/fileVersions.ts +2 -2
- package/src/lsp/rpc.ts +2 -2
- package/src/mcp.ts +1 -0
- package/src/mcpBridge.ts +163 -0
- package/src/mcpDiscover.ts +38 -0
- package/src/mcpPool.ts +245 -0
- package/src/mcpProject.ts +15 -12
- package/src/mcpRuntime.ts +301 -255
- package/src/registry.ts +15 -2
- package/src/rpc.ts +15 -3
- package/src/rules.ts +9 -4
- package/src/search/fallback.ts +2 -2
- package/src/search/ripgrep.ts +2 -2
- package/src/shared/mcp.ts +47 -0
- package/src/shared/rpc.ts +5 -1
- package/src/store.ts +26 -1
- package/src/svn.ts +2 -2
package/src/mcpProject.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { PROJECT_ENTRY_PREFIX, entriesOf, mergeMcp, validateConfig, nameOverlap,
|
|
|
5
5
|
import { isProjectEntryId } from './compat.js'
|
|
6
6
|
import { clearLegacy, runtimeOf } from './mcpRuntime.js'
|
|
7
7
|
import type { ProjectDef } from './mcpRuntime.js'
|
|
8
|
-
import type
|
|
8
|
+
import { parseMcpPolicy, type McpPolicy, type MpcConfig, type MpcProject, type MpcServer } from './shared/mcp.js'
|
|
9
9
|
import type { Ctx } from './store.js'
|
|
10
10
|
|
|
11
11
|
const FILE_NAME = '.mcp.json'
|
|
@@ -192,19 +192,20 @@ export async function checkMcpName(ctx: Ctx, serverName: string, workspacePath?:
|
|
|
192
192
|
* @param ctx Host services.
|
|
193
193
|
* @param workspacePath Registered workspace.
|
|
194
194
|
* @param refresh Optional unchanged server to reconnect.
|
|
195
|
-
* @
|
|
195
|
+
* @param wait Await connection synchronization for management, or only publication/scheduling for creation.
|
|
196
|
+
* @returns Configuration publication, optionally including scoped fiber synchronization.
|
|
196
197
|
*/
|
|
197
|
-
export async function reconcileProject(ctx: Ctx, workspacePath: string, refresh?: string): Promise<void> {
|
|
198
|
+
export async function reconcileProject(ctx: Ctx, workspacePath: string, refresh?: string, wait = true): Promise<void> {
|
|
198
199
|
const data = await readProjectJson(ctx, workspacePath)
|
|
199
200
|
const defs = new Map<string, ProjectDef>()
|
|
200
201
|
for (const [name, def] of Object.entries(serversOf(data))) {
|
|
201
202
|
const config = configFromDef(def, name)!
|
|
202
203
|
validateConfig(config)
|
|
203
204
|
await checkMcpName(ctx, name, workspacePath)
|
|
204
|
-
defs.set(name, { config, enabled: def.disabled !== true })
|
|
205
|
+
defs.set(name, { config, enabled: def.disabled !== true, policy: parseMcpPolicy(def.vscodeMode) })
|
|
205
206
|
}
|
|
206
207
|
await clearLegacy(ctx)
|
|
207
|
-
await runtimeOf(ctx).replace(workspacePath, defs, refresh)
|
|
208
|
+
await runtimeOf(ctx).replace(workspacePath, defs, refresh, wait)
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
/**
|
|
@@ -245,7 +246,7 @@ export async function deactivateMcp(ctx: Ctx, entryId: string): Promise<void> {
|
|
|
245
246
|
* @param title Workspace title.
|
|
246
247
|
* @returns Configuration and honest runtime status with any read error attached.
|
|
247
248
|
*/
|
|
248
|
-
async function projectOf(ctx: Ctx, workspacePath: string, title: string): Promise<MpcProject> {
|
|
249
|
+
async function projectOf(ctx: Ctx, workspacePath: string, title: string, wait = true): Promise<MpcProject> {
|
|
249
250
|
let fileError: string | undefined
|
|
250
251
|
let missingDir: boolean | undefined
|
|
251
252
|
try {
|
|
@@ -253,7 +254,7 @@ async function projectOf(ctx: Ctx, workspacePath: string, title: string): Promis
|
|
|
253
254
|
if (!fs) throw new Error('缺少 fs 服务')
|
|
254
255
|
const info = await fs.stat(await fs.resolve(workspacePath))
|
|
255
256
|
missingDir = !info || info.type !== 'directory'
|
|
256
|
-
if (!missingDir) await reconcileProject(ctx, workspacePath)
|
|
257
|
+
if (!missingDir) await reconcileProject(ctx, workspacePath, undefined, wait)
|
|
257
258
|
} catch (error) {
|
|
258
259
|
missingDir = isMissingFile(error) || undefined
|
|
259
260
|
fileError = String(error)
|
|
@@ -271,9 +272,9 @@ async function projectOf(ctx: Ctx, workspacePath: string, title: string): Promis
|
|
|
271
272
|
* @param ctx Host services.
|
|
272
273
|
* @returns Project list; individual malformed files are reported on their project.
|
|
273
274
|
*/
|
|
274
|
-
export async function listProjects(ctx: Ctx): Promise<{ projects: MpcProject[] }> {
|
|
275
|
+
export async function listProjects(ctx: Ctx, wait = true): Promise<{ projects: MpcProject[] }> {
|
|
275
276
|
const projects: MpcProject[] = []
|
|
276
|
-
for (const ws of ctx.get('workspaceRegistry')?.list?.() ?? []) projects.push(await projectOf(ctx, ws.path, ws.title ?? ''))
|
|
277
|
+
for (const ws of ctx.get('workspaceRegistry')?.list?.() ?? []) projects.push(await projectOf(ctx, ws.path, ws.title ?? '', wait))
|
|
277
278
|
return { projects }
|
|
278
279
|
}
|
|
279
280
|
|
|
@@ -316,18 +317,20 @@ function mergeDefinition(previous: Record<string, unknown>, config: MpcConfig):
|
|
|
316
317
|
* @param config Submitted configuration.
|
|
317
318
|
* @returns Updated project view; invalid sources or conflicts reject before writing.
|
|
318
319
|
*/
|
|
319
|
-
export async function projectSave(ctx: Ctx, workspacePath: string, serverName: string, config: MpcConfig): Promise<MpcProject> {
|
|
320
|
-
|
|
320
|
+
export async function projectSave(ctx: Ctx, workspacePath: string, serverName: string, config: MpcConfig, policy?: McpPolicy): Promise<MpcProject> {
|
|
321
|
+
if (policy !== undefined) parseMcpPolicy(policy)
|
|
322
|
+
return mcpEdit(ctx, () => saveProject(ctx, workspacePath, serverName, config, policy))
|
|
321
323
|
}
|
|
322
324
|
|
|
323
325
|
/** @private @author ddj 2026年10月08号 @param ctx Host services. @param workspacePath Owner. @param serverName Namespace. @param config Editable fields. @returns Persisted project status. */
|
|
324
|
-
async function saveProject(ctx: Ctx, workspacePath: string, serverName: string, config: MpcConfig): Promise<MpcProject> {
|
|
326
|
+
async function saveProject(ctx: Ctx, workspacePath: string, serverName: string, config: MpcConfig, policy?: McpPolicy): Promise<MpcProject> {
|
|
325
327
|
const workspace = requireWorkspace(ctx, workspacePath)
|
|
326
328
|
validateConfig({ ...config, serverName })
|
|
327
329
|
await checkMcpName(ctx, serverName, workspacePath)
|
|
328
330
|
const data = await readProjectJson(ctx, workspacePath)
|
|
329
331
|
const servers = serversOf(data)
|
|
330
332
|
servers[serverName] = mergeDefinition(servers[serverName] ?? {}, { ...config, serverName })
|
|
333
|
+
if (policy !== undefined) servers[serverName].vscodeMode = { ...parseMcpPolicy(policy) }
|
|
331
334
|
await writeProjectJson(ctx, workspacePath, { ...data, mcpServers: servers })
|
|
332
335
|
await reconcileProject(ctx, workspacePath)
|
|
333
336
|
return projectOf(ctx, workspacePath, workspace.title ?? '')
|