dsh-plugin-workspace-capabilities 0.0.0-stage → 1.3.2
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/LICENSE +21 -0
- package/README.en.md +97 -0
- package/README.md +96 -2
- package/client.js +488 -0
- package/cordis.patch.yml +3 -0
- package/discovery.js +129 -0
- package/http-api.js +113 -0
- package/index.js +64 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/locales.js +258 -0
- package/package.json +96 -4
- package/policy.js +52 -0
- package/runtime.js +180 -0
- package/skill-provider.js +16 -0
- package/store.js +45 -0
- package/translation-target.js +20 -0
- package/translations.js +119 -0
- package/workspaces.js +16 -0
package/discovery.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
2
|
+
import { join, dirname, isAbsolute } from 'node:path';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { parse as parseToml } from 'smol-toml';
|
|
5
|
+
import { parseDocument } from 'yaml';
|
|
6
|
+
import { canonical } from './policy.js';
|
|
7
|
+
|
|
8
|
+
const hash = value => createHash('sha256').update(value).digest('hex');
|
|
9
|
+
const object = value => value && typeof value === 'object' && !Array.isArray(value);
|
|
10
|
+
const strings = value => object(value) && Object.entries(value).every(([k, v]) => typeof k === 'string' && typeof v === 'string');
|
|
11
|
+
function envValue(value) {
|
|
12
|
+
if (typeof value !== 'string') return value;
|
|
13
|
+
return value.replace(/\$\{(?:env:)?([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, key) => process.env[key] ?? '${env:' + key + '}');
|
|
14
|
+
}
|
|
15
|
+
function resolveValues(value) {
|
|
16
|
+
if (typeof value === 'string') return envValue(value);
|
|
17
|
+
if (Array.isArray(value)) return value.map(resolveValues);
|
|
18
|
+
if (object(value)) return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, resolveValues(v)]));
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
export function redactEndpoint(value) {
|
|
22
|
+
try { const url = new URL(value); url.username = ''; url.password = ''; url.search = ''; url.hash = ''; return url.toString(); }
|
|
23
|
+
catch { return '(无效地址)'; }
|
|
24
|
+
}
|
|
25
|
+
export function publicMcp(row) {
|
|
26
|
+
return { id: row.id, name: row.name, description: row.description ?? '', source: row.source, workspace: row.workspace, native: row.native,
|
|
27
|
+
namespace: row.namespace, transport: row.config?.transport ?? 'native',
|
|
28
|
+
launch: row.config?.transport === 'stdio' ? row.config.command : row.config?.url ? redactEndpoint(row.config.url) : '由 DSH 原生配置连接',
|
|
29
|
+
envNames: Object.keys(row.config?.env ?? {}), valid: !row.problem, problem: row.problem ?? '', fingerprint: row.fingerprint };
|
|
30
|
+
}
|
|
31
|
+
export function normalizeMcp(name, raw, source, workspace = '', native = false) {
|
|
32
|
+
const id = hash(source + '\0' + name).slice(0, 24);
|
|
33
|
+
const namespace = native ? name : 'wc_' + id.slice(0, 12);
|
|
34
|
+
let config, problem = '';
|
|
35
|
+
try {
|
|
36
|
+
if (!object(raw)) throw new Error('服务配置必须是对象。');
|
|
37
|
+
const value = resolveValues(raw);
|
|
38
|
+
if (value.disabled === true || value.enabled === false) throw new Error('源配置中已禁用,请先在源配置中启用。');
|
|
39
|
+
if (value.type === 'sse' || value.transport === 'sse') throw new Error('此版本仅支持 stdio 和 Streamable HTTP。');
|
|
40
|
+
if (typeof value.command === 'string' && value.command.trim()) {
|
|
41
|
+
if (value.args !== undefined && (!Array.isArray(value.args) || !value.args.every(v => typeof v === 'string'))) throw new Error('args 必须是字符串数组。');
|
|
42
|
+
if (value.env !== undefined && !strings(value.env)) throw new Error('env 必须是字符串字典。');
|
|
43
|
+
const env = { ...(value.env ?? {}) };
|
|
44
|
+
if (Array.isArray(value.env_vars)) for (const key of value.env_vars) if (typeof key === 'string' && process.env[key] !== undefined) env[key] = process.env[key];
|
|
45
|
+
const cwd = value.cwd ? (isAbsolute(value.cwd) ? value.cwd : join(workspace || dirname(source), value.cwd)) : workspace || dirname(source);
|
|
46
|
+
config = { transport: 'stdio', serverName: namespace, command: value.command, args: value.args ?? [], env, cwd };
|
|
47
|
+
} else if (typeof value.url === 'string') {
|
|
48
|
+
const url = new URL(value.url);
|
|
49
|
+
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('HTTP 服务地址无效。');
|
|
50
|
+
const headers = { ...(value.http_headers ?? value.headers ?? {}) };
|
|
51
|
+
if (!strings(headers)) throw new Error('headers 必须是字符串字典。');
|
|
52
|
+
if (object(value.env_http_headers)) for (const [key, env] of Object.entries(value.env_http_headers)) if (process.env[env]) headers[key] = process.env[env];
|
|
53
|
+
if (typeof value.bearer_token_env_var === 'string' && process.env[value.bearer_token_env_var]) headers.Authorization = 'Bearer ' + process.env[value.bearer_token_env_var];
|
|
54
|
+
config = { transport: 'streamable-http', serverName: namespace, url: url.toString(), headers };
|
|
55
|
+
} else throw new Error('未发现 command 或 url。');
|
|
56
|
+
if (JSON.stringify(config).includes('${env:')) throw new Error('DSH 服务环境中缺少配置引用的环境变量。');
|
|
57
|
+
config.toolCallTimeoutMs = 60000; config.failOnStartupError = true;
|
|
58
|
+
config.reconnect = { enabled: true, initialDelayMs: 1000, maxDelayMs: 30000, maxAttempts: 10 };
|
|
59
|
+
} catch (error) { problem = error.message; }
|
|
60
|
+
// Raw credentials never leave the backend; approval also invalidates on credential rotation.
|
|
61
|
+
return { id, name, description: typeof raw?.description === 'string' ? raw.description.slice(0, 6000) : '', source, workspace: canonical(workspace), native, namespace, config, problem, fingerprint: hash(JSON.stringify({ raw, config, workspace })) };
|
|
62
|
+
}
|
|
63
|
+
function nativeEntries(value, output = []) {
|
|
64
|
+
if (Array.isArray(value)) for (const item of value) nativeEntries(item, output);
|
|
65
|
+
else if (object(value)) {
|
|
66
|
+
if (value.name === '@deepseek-ai/dsh-mcp-client' && value.disabled !== true && typeof value.config?.serverName === 'string') output.push([value.config.serverName, value.config]);
|
|
67
|
+
if (value.insert) nativeEntries(value.insert, output);
|
|
68
|
+
}
|
|
69
|
+
return output;
|
|
70
|
+
}
|
|
71
|
+
export class Discovery {
|
|
72
|
+
constructor({ home, dshHome, snapshot, schemas, workspaces, includeExternal = () => false }) {
|
|
73
|
+
Object.assign(this, { home, dshHome, snapshot, schemas, workspaces, includeExternal }); this.rows = new Map(); this.issues = []; this.scannedAt = null; this.scanPromise = null;
|
|
74
|
+
}
|
|
75
|
+
async sources() {
|
|
76
|
+
const sources = [
|
|
77
|
+
[join(this.dshHome, 'mcp.json'), 'json'],
|
|
78
|
+
[join(this.dshHome, 'cordis.patch.yml'), 'yaml'], [join(this.dshHome, 'profiles/web/cordis.patch.yml'), 'yaml']
|
|
79
|
+
];
|
|
80
|
+
const external = this.includeExternal();
|
|
81
|
+
if (external) sources.push([join(this.home, '.codex/config.toml'), 'toml', '', true], [join(this.home, '.claude.json'), 'json', '', true],
|
|
82
|
+
[join(this.home, '.claude/claude_desktop_config.json'), 'json', '', true], [join(this.home, '.config/Claude/claude_desktop_config.json'), 'json', '', true],
|
|
83
|
+
[join(this.home, '.cursor/mcp.json'), 'json', '', true]);
|
|
84
|
+
for (const workspace of await this.workspaces()) {
|
|
85
|
+
sources.push([join(workspace.path, '.dsh/mcp.json'), 'json', workspace.path]);
|
|
86
|
+
if (external) for (const [file, type] of [['.mcp.json', 'json'], ['.cursor/mcp.json', 'json'], ['.codex/config.toml', 'toml']]) sources.push([join(workspace.path, file), type, workspace.path, true]);
|
|
87
|
+
}
|
|
88
|
+
return sources;
|
|
89
|
+
}
|
|
90
|
+
scan() { return this.scanPromise ??= this.performScan().finally(() => { this.scanPromise = null; }); }
|
|
91
|
+
async performScan() {
|
|
92
|
+
const rows = new Map(), issues = [];
|
|
93
|
+
for (const [source, type, workspace = '', external = false] of await this.sources()) {
|
|
94
|
+
try {
|
|
95
|
+
if ((await stat(source)).size > 2 * 1024 * 1024) throw new Error('文件超过 2 MiB,已跳过。');
|
|
96
|
+
const text = await readFile(source, 'utf8');
|
|
97
|
+
let value;
|
|
98
|
+
if (type === 'toml') value = parseToml(text);
|
|
99
|
+
else if (type === 'yaml') {
|
|
100
|
+
const doc = parseDocument(text, { customTags: [{ tag: '!js', resolve: text => {
|
|
101
|
+
const match = /^process\.env\.([A-Za-z_][A-Za-z0-9_]*)$/.exec(text.trim());
|
|
102
|
+
return match ? '${env:' + match[1] + '}' : text;
|
|
103
|
+
}}] });
|
|
104
|
+
if (doc.errors.length) throw new Error('YAML 解析失败。'); value = doc.toJS();
|
|
105
|
+
} else value = JSON.parse(text);
|
|
106
|
+
const entries = type === 'yaml' ? nativeEntries(value) : Object.entries(value.mcpServers ?? value.mcp_servers ?? {});
|
|
107
|
+
for (const [name, config] of entries) {
|
|
108
|
+
const row = normalizeMcp(name, config, source, workspace, type === 'yaml'); row.external = external; rows.set(row.id, row);
|
|
109
|
+
}
|
|
110
|
+
// Claude Code can keep per-project MCP definitions in its user JSON file.
|
|
111
|
+
if (source === join(this.home, '.claude.json') && object(value.projects)) for (const [path, project] of Object.entries(value.projects)) {
|
|
112
|
+
for (const [name, config] of Object.entries(project.mcpServers ?? {})) {
|
|
113
|
+
const row = normalizeMcp(name, config, source + '#projects:' + path, path); row.external = true; rows.set(row.id, row);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
} catch (error) { if (error.code !== 'ENOENT') issues.push({ source, message: error.code === 'EACCES' ? '没有读取权限。' : '无法解析配置;未执行或修改该文件。' }); }
|
|
117
|
+
}
|
|
118
|
+
// Include live native MCP tools even when their bundle config is outside the known files.
|
|
119
|
+
for (const tool of this.schemas()) {
|
|
120
|
+
if (!tool.name.startsWith('mcp__') || [...rows.values()].some(r => tool.name.startsWith('mcp__' + r.namespace + '__'))) continue;
|
|
121
|
+
const name = tool.name.slice(5).split('__')[0];
|
|
122
|
+
if (!name || name.startsWith('wc_')) continue;
|
|
123
|
+
const id = 'native:' + name;
|
|
124
|
+
rows.set(id, { id, name, namespace: name, source: 'DSH 当前工具注册表', workspace: '', native: true, fingerprint: hash(id) });
|
|
125
|
+
}
|
|
126
|
+
this.rows = rows; this.issues = issues; this.scannedAt = new Date().toISOString(); return rows;
|
|
127
|
+
}
|
|
128
|
+
matching(tool) { return [...this.rows.values()].filter(row => tool.startsWith('mcp__' + row.namespace + '__')); }
|
|
129
|
+
}
|
package/http-api.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { stat } from 'node:fs/promises';
|
|
2
|
+
import { canonical, allowed, PolicyError } from './policy.js';
|
|
3
|
+
import { publicMcp } from './discovery.js';
|
|
4
|
+
import { translationTargets } from './translations.js';
|
|
5
|
+
|
|
6
|
+
export const BASE = '/workspace-capabilities/v1';
|
|
7
|
+
const send = (response, status, value) => {
|
|
8
|
+
response.writeHead(status, { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff' });
|
|
9
|
+
response.end(JSON.stringify(value));
|
|
10
|
+
};
|
|
11
|
+
async function body(request) {
|
|
12
|
+
const chunks = []; let size = 0;
|
|
13
|
+
for await (const chunk of request) { size += chunk.length; if (size > 65536) throw new PolicyError('请求超过 64 KiB。', 413); chunks.push(chunk); }
|
|
14
|
+
try { const value = JSON.parse(Buffer.concat(chunks).toString('utf8')); if (!value || Array.isArray(value) || typeof value !== 'object') throw new Error(); return value; }
|
|
15
|
+
catch { throw new PolicyError('请求不是有效的 JSON 对象。'); }
|
|
16
|
+
}
|
|
17
|
+
export function createApi(ctx, store, discovery, runtime, { syncSources, translations } = {}) {
|
|
18
|
+
async function view(path = '', options = {}) {
|
|
19
|
+
const workspace = canonical(path), state = store.state;
|
|
20
|
+
const observation = await runtime.originalSnapshot(workspace ? { cwd: workspace } : {});
|
|
21
|
+
const rules = workspace ? state.workspaces[workspace] ?? { skills: {}, mcp: {} } : state.global;
|
|
22
|
+
const skills = observation.skills.map(item => ({ name: item.name, description: item.description, source: item.source,
|
|
23
|
+
path: item.path ?? '', provider: item.provider, rule: rules.skills[item.name] ?? null,
|
|
24
|
+
global: allowed(state, 'skills', item.name), enabled: allowed(state, 'skills', item.name, workspace), invocation: item.invocation }));
|
|
25
|
+
const mcp = [...discovery.rows.values()].filter(row => !row.external || state.discovery.includeExternal).map(row => ({ ...publicMcp(row), rule: rules.mcp[row.id] ?? null,
|
|
26
|
+
global: allowed(state, 'mcp', row.id, '', row.workspace), enabled: runtime.rowAllowed(row, workspace),
|
|
27
|
+
requested: allowed(state, 'mcp', row.id, workspace, row.workspace), approved: row.native || state.approvals[row.id] === row.fingerprint,
|
|
28
|
+
status: runtime.connectionStatus(row), tools: discovery.schemas().filter(tool => tool.name.startsWith('mcp__' + row.namespace + '__')).length,
|
|
29
|
+
toolDetails: discovery.schemas().filter(tool => tool.name.startsWith('mcp__' + row.namespace + '__')).map(tool => ({ name: tool.name, description: tool.description ?? '' })) }));
|
|
30
|
+
const translation = translations?.info(options) ?? { available: false, model: null };
|
|
31
|
+
const result = { revision: state.revision, defaults: state.defaults, discovery: state.discovery, workspace, workspaces: await discovery.workspaces(),
|
|
32
|
+
skills, mcp, translation, complete: observation.complete, scannedAt: discovery.scannedAt, issues: discovery.issues, error: store.error };
|
|
33
|
+
const targets = new Map(translationTargets(result).map(item => [item.key, item]));
|
|
34
|
+
for (const item of skills) item.translation = translations?.cached(targets.get('skill:' + item.name), translation.model, options) ?? null;
|
|
35
|
+
for (const item of mcp) {
|
|
36
|
+
item.translation = translations?.cached(targets.get('mcp:' + item.id), translation.model, options) ?? null;
|
|
37
|
+
for (const tool of item.toolDetails) tool.translation = translations?.cached(targets.get('tool:' + tool.name), translation.model, options) ?? null;
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
async function action(data) {
|
|
42
|
+
const workspace = data.workspace ? canonical(data.workspace) : '';
|
|
43
|
+
if (data.workspace && !workspace) throw new PolicyError('工作区必须是绝对路径。');
|
|
44
|
+
if (workspace) { try { if (!(await stat(workspace)).isDirectory()) throw new Error(); } catch { throw new PolicyError('工作区目录不存在或不可访问。'); } }
|
|
45
|
+
if (data.action === 'refresh') { await discovery.scan(); await runtime.changed(); return view(workspace, data); }
|
|
46
|
+
const known = await view(workspace);
|
|
47
|
+
if (data.action === 'rule' || data.action === 'approve') {
|
|
48
|
+
if (!['skills', 'mcp'].includes(data.kind)) throw new PolicyError('能力类型无效。');
|
|
49
|
+
const item = known[data.kind].find(item => (data.kind === 'skills' ? item.name : item.id) === data.key);
|
|
50
|
+
if (!item) throw new PolicyError('未发现此能力,请重新扫描。', 404);
|
|
51
|
+
if (![true, false, null].includes(data.value)) throw new PolicyError('规则必须为启用、禁用或继承。');
|
|
52
|
+
if (data.kind === 'mcp' && item.workspace && workspace !== item.workspace && data.value === true) throw new PolicyError('此 MCP 来源于另一工作区,仅能在来源工作区启用。');
|
|
53
|
+
}
|
|
54
|
+
if (data.action === 'approve') {
|
|
55
|
+
if (data.kind !== 'mcp' || data.value !== true) throw new PolicyError('批准连接参数无效。');
|
|
56
|
+
const old = discovery.rows.get(data.key);
|
|
57
|
+
await discovery.scan();
|
|
58
|
+
const current = discovery.rows.get(data.key);
|
|
59
|
+
if (!current || old.fingerprint !== current.fingerprint || data.fingerprint !== current.fingerprint) throw new PolicyError('源配置已改变,请重新检查并批准。', 409);
|
|
60
|
+
if (current.problem) throw new PolicyError(current.problem);
|
|
61
|
+
}
|
|
62
|
+
await store.update(data.revision, next => {
|
|
63
|
+
if (data.action === 'discovery') {
|
|
64
|
+
if (typeof data.value !== 'boolean') throw new PolicyError('发现来源开关无效。');
|
|
65
|
+
next.discovery.includeExternal = data.value; return;
|
|
66
|
+
}
|
|
67
|
+
if (data.action === 'workspace') {
|
|
68
|
+
if (!workspace) throw new PolicyError('请选择工作区。');
|
|
69
|
+
next.workspaces[workspace] ??= { skills: {}, mcp: {} }; return;
|
|
70
|
+
}
|
|
71
|
+
if (data.action === 'defaults') {
|
|
72
|
+
if (!['skills', 'mcp'].includes(data.kind) || typeof data.value !== 'boolean' || workspace) throw new PolicyError('默认规则无效。');
|
|
73
|
+
next.defaults[data.kind] = data.value; return;
|
|
74
|
+
}
|
|
75
|
+
if (!['rule', 'approve'].includes(data.action)) throw new PolicyError('操作无效。');
|
|
76
|
+
const container = workspace ? next.workspaces[workspace] ??= { skills: {}, mcp: {} } : next.global;
|
|
77
|
+
if (data.value === null) delete container[data.kind][data.key]; else container[data.kind][data.key] = data.value;
|
|
78
|
+
if (data.action === 'approve') next.approvals[data.key] = discovery.rows.get(data.key).fingerprint;
|
|
79
|
+
});
|
|
80
|
+
if (data.action === 'discovery' && syncSources) await syncSources();
|
|
81
|
+
else await runtime.changed();
|
|
82
|
+
return view(workspace, data);
|
|
83
|
+
}
|
|
84
|
+
async function translate(data, signal) {
|
|
85
|
+
if (!translations) throw new PolicyError('翻译服务尚未就绪。', 503);
|
|
86
|
+
if (data.force !== undefined && typeof data.force !== 'boolean') throw new PolicyError('重新翻译参数无效。');
|
|
87
|
+
if (!Array.isArray(data.keys) || data.keys.length < 1 || data.keys.length > 12 || data.keys.some(key => typeof key !== 'string') || new Set(data.keys).size !== data.keys.length) throw new PolicyError('每次请选择 1–12 条说明。');
|
|
88
|
+
const current = await view(data.workspace ?? '', data), targets = translationTargets(current);
|
|
89
|
+
const items = data.keys.map(key => targets.find(item => item.key === key));
|
|
90
|
+
if (items.some(item => !item)) throw new PolicyError('该能力已不在当前发现范围,请刷新后重试。', 404);
|
|
91
|
+
const result = await translations.translate(items, { ...data, signal });
|
|
92
|
+
return { ...result, view: await view(data.workspace ?? '', data) };
|
|
93
|
+
}
|
|
94
|
+
async function handler(request, response) {
|
|
95
|
+
const rejection = ctx.connection.requestRejection(request);
|
|
96
|
+
if (rejection !== undefined) return send(response, rejection, { error: '请使用受信任的 Harness 页面访问设置。' });
|
|
97
|
+
const controller = new AbortController();
|
|
98
|
+
const abort = () => { if (!response.writableEnded) controller.abort(); };
|
|
99
|
+
request.once('aborted', abort); response.once('close', abort);
|
|
100
|
+
try {
|
|
101
|
+
const url = new URL(request.url, 'http://local');
|
|
102
|
+
const options = { sessionId: url.searchParams.get('sessionId') ?? undefined, uiLocale: url.searchParams.get('uiLocale') ?? undefined, ...(url.searchParams.has('targetLanguage') ? { targetLanguage: url.searchParams.get('targetLanguage') } : {}),
|
|
103
|
+
...(url.searchParams.has('provider') ? { selection: { provider: url.searchParams.get('provider'), model: url.searchParams.get('model') } } : {}) };
|
|
104
|
+
if (request.method === 'GET' && url.pathname === BASE + '/state') return send(response, 200, await view(url.searchParams.get('workspace') ?? '', options));
|
|
105
|
+
if (request.method !== 'POST' || ![BASE + '/action', BASE + '/translate'].includes(url.pathname)) return send(response, 404, { error: '接口不存在。' });
|
|
106
|
+
if (!/^application\/json(?:;|$)/i.test(request.headers['content-type'] ?? '')) throw new PolicyError('请求必须使用 application/json。', 415);
|
|
107
|
+
const data = await body(request);
|
|
108
|
+
return send(response, 200, url.pathname === BASE + '/translate' ? await translate(data, controller.signal) : await action(data));
|
|
109
|
+
} catch (error) { return send(response, error.status ?? 500, { error: error instanceof PolicyError ? error.message : '操作未完成,请刷新后重试。' }); }
|
|
110
|
+
finally { request.off('aborted', abort); response.off('close', abort); }
|
|
111
|
+
}
|
|
112
|
+
return { view, action, translate, handler };
|
|
113
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import z from '@deepseek-ai/schemastery';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { CapabilitySkillProvider } from './skill-provider.js';
|
|
5
|
+
import { PolicyStore } from './store.js';
|
|
6
|
+
import { collectWorkspaces } from './workspaces.js';
|
|
7
|
+
import { Discovery } from './discovery.js';
|
|
8
|
+
import { createRuntime } from './runtime.js';
|
|
9
|
+
import { createApi, BASE } from './http-api.js';
|
|
10
|
+
import { TranslationService } from './translations.js';
|
|
11
|
+
|
|
12
|
+
export const name = 'workspace-capabilities';
|
|
13
|
+
export const inject = ['skills', 'tools', 'agents', 'workspaceRegistry'];
|
|
14
|
+
export const Config = z.object({ dataDir: z.string(), skillRoots: z.array(String).default([]), translationTargetLanguage: z.string().max(160).pattern(/^[^\u0000-\u001f\u007f]*$/u).default('').volatile() });
|
|
15
|
+
|
|
16
|
+
export async function apply(ctx, config) {
|
|
17
|
+
const home = homedir(), dshHome = process.env.DSH_HOME || join(home, '.dsh');
|
|
18
|
+
const baseline = await ctx.skills.snapshot({ cwd: process.cwd() });
|
|
19
|
+
const store = await new PolicyStore(join(config.dataDir || join(dshHome, 'workspace-capabilities'), 'policy.json')).init(baseline.skills.map(item => item.name));
|
|
20
|
+
const workspaces = async () => collectWorkspaces({
|
|
21
|
+
cwd: process.cwd(), registered: ctx.workspaceRegistry.list(),
|
|
22
|
+
agents: ctx.agents.list(), rules: store.state.workspaces
|
|
23
|
+
});
|
|
24
|
+
let runtime;
|
|
25
|
+
let externalFiber;
|
|
26
|
+
let sourceQueue = Promise.resolve();
|
|
27
|
+
function syncSources() { sourceQueue = sourceQueue.then(performSourceSync, performSourceSync); return sourceQueue; }
|
|
28
|
+
async function performSourceSync() {
|
|
29
|
+
const enabled = store.state.discovery.includeExternal;
|
|
30
|
+
if (enabled && !externalFiber) {
|
|
31
|
+
externalFiber = ctx.plugin({ name: 'capabilities-external-skills', inject: ['skills'], async apply(child) {
|
|
32
|
+
let provider;
|
|
33
|
+
child.skills.registerProvider(control => provider = new CapabilitySkillProvider(child, control, {
|
|
34
|
+
providerName: 'workspace-capabilities-filesystem', includeDefaultRoots: true,
|
|
35
|
+
customSkillDirs: [join(home, '.cc-switch/skills'), join(home, '.codex/skills'), join(home, '.codex/skills/.system'), join(home, '.claude/skills'), ...config.skillRoots]
|
|
36
|
+
}));
|
|
37
|
+
child.effect(() => () => provider.dispose(), 'capabilities: external skill watchers');
|
|
38
|
+
}});
|
|
39
|
+
await externalFiber.await();
|
|
40
|
+
} else if (!enabled && externalFiber) {
|
|
41
|
+
const old = externalFiber; externalFiber = undefined; await old.dispose();
|
|
42
|
+
}
|
|
43
|
+
// Drain an old scan first so disabling external sources cannot publish a stale mixed catalog.
|
|
44
|
+
if (discovery.scanPromise) await discovery.scanPromise;
|
|
45
|
+
await discovery.scan(); await runtime.changed();
|
|
46
|
+
}
|
|
47
|
+
const discovery = new Discovery({ home, dshHome, workspaces, schemas: () => runtime?.originalSchemas() ?? ctx.tools.schemas(), snapshot: options => runtime.originalSnapshot(options), includeExternal: () => store.state.discovery.includeExternal });
|
|
48
|
+
runtime = createRuntime(ctx, store, discovery);
|
|
49
|
+
await syncSources();
|
|
50
|
+
const translations = await new TranslationService(ctx, join(config.dataDir || join(dshHome, 'workspace-capabilities'), 'translations.json'), { targetLanguage: () => { const value = config.translationTargetLanguage; return value?.get ? value.get() : typeof value === 'function' ? value() : value ?? ''; } }).init();
|
|
51
|
+
ctx.effect(() => () => translations.close(), 'capabilities: translation lifecycle');
|
|
52
|
+
ctx.inject(['settings'], child => child.settings.configure({ auto: false }, ctx.fiber));
|
|
53
|
+
ctx.inject(['webServer', 'connection'], child => {
|
|
54
|
+
const api = createApi(child, store, discovery, runtime, { syncSources, translations });
|
|
55
|
+
child.effect(() => child.webServer.register({ kind: 'prefix', path: BASE, handler: api.handler }), 'capabilities: authenticated settings API');
|
|
56
|
+
});
|
|
57
|
+
let scanning = false;
|
|
58
|
+
const timer = setInterval(async () => {
|
|
59
|
+
if (scanning) return; scanning = true;
|
|
60
|
+
try { await discovery.scan(); await runtime.sync(); } catch { /* Keep last known catalog, never execute a failed discovery. */ }
|
|
61
|
+
finally { scanning = false; }
|
|
62
|
+
}, 15000);
|
|
63
|
+
timer.unref(); ctx.effect(() => () => clearInterval(timer), 'capabilities: discovery refresh');
|
|
64
|
+
}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/locales.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
export const zh = {
|
|
2
|
+
" · 当前使用工作区规则": " · 当前使用工作区规则",
|
|
3
|
+
" · 当前继承全局": " · 当前继承全局",
|
|
4
|
+
" 个工具": " 个工具",
|
|
5
|
+
" 条…": " 条…",
|
|
6
|
+
" 规则": " 规则",
|
|
7
|
+
"/home/用户名/项目": "/home/用户名/项目",
|
|
8
|
+
"DSH 原生连接": "DSH 原生连接",
|
|
9
|
+
"Skill 与 MCP": "Skill 与 MCP",
|
|
10
|
+
"使用当前模型重新翻译并更新缓存": "使用当前模型重新翻译并更新缓存",
|
|
11
|
+
"使用默认": "使用默认",
|
|
12
|
+
"保存语言": "保存语言",
|
|
13
|
+
"全局规则将应用到未单独设置的工作区。": "全局规则将应用到未单独设置的工作区。",
|
|
14
|
+
"全局默认": "全局默认",
|
|
15
|
+
"全局:": "全局:",
|
|
16
|
+
"切换到该来源工作区后可设置。": "切换到该来源工作区后可设置。",
|
|
17
|
+
"原生配置/未发现工具": "原生配置/未发现工具",
|
|
18
|
+
"发现列表已刷新。": "发现列表已刷新。",
|
|
19
|
+
"发现过程中的问题 (": "发现过程中的问题 (",
|
|
20
|
+
"可用": "可用",
|
|
21
|
+
"可选读取 CC Switch 共享 Skill 目录,以及 Codex、Claude、Cursor 配置。扫描只读取来源;新能力默认禁用,MCP 首次连接仍需批准。": "可选读取 CC Switch 共享 Skill 目录,以及 Codex、Claude、Cursor 配置。扫描只读取来源;新能力默认禁用,MCP 首次连接仍需批准。",
|
|
22
|
+
"启用": "启用",
|
|
23
|
+
"工作区绝对路径": "工作区绝对路径",
|
|
24
|
+
"工作区:": "工作区:",
|
|
25
|
+
"工具说明 (": "工具说明 (",
|
|
26
|
+
"已保存,当前及后续 Agent 调用即时使用新规则。": "已保存,当前及后续 Agent 调用即时使用新规则。",
|
|
27
|
+
"已处理 {p0} 条,{p1} 条已是目标语言 · {p2}": "已处理 {p0} 条,{p1} 条已是目标语言 · {p2}",
|
|
28
|
+
"已批准的 MCP 默认启用": "已批准的 MCP 默认启用",
|
|
29
|
+
"已是目标语言": "已是目标语言",
|
|
30
|
+
"已禁用": "已禁用",
|
|
31
|
+
"已连接": "已连接",
|
|
32
|
+
"已连接/暂无工具": "已连接/暂无工具",
|
|
33
|
+
"当前范围未发现 MCP。DSH 配置和工作区 .dsh/mcp.json 会自动发现;其他应用需打开上方扫描开关。": "当前范围未发现 MCP。DSH 配置和工作区 .dsh/mcp.json 会自动发现;其他应用需打开上方扫描开关。",
|
|
34
|
+
"当前范围未发现 Skill。这里展示 DeepSeek 已注册的 Skill;其他应用需打开上方扫描开关。": "当前范围未发现 Skill。这里展示 DeepSeek 已注册的 Skill;其他应用需打开上方扫描开关。",
|
|
35
|
+
"待批准": "待批准",
|
|
36
|
+
"所属工作区:": "所属工作区:",
|
|
37
|
+
"扫描其他应用的 Skill / MCP(全局)": "扫描其他应用的 Skill / MCP(全局)",
|
|
38
|
+
"批准配置并启用连接": "批准配置并启用连接",
|
|
39
|
+
"搜索名称、说明或来源路径": "搜索名称、说明或来源路径",
|
|
40
|
+
"搜索能力": "搜索能力",
|
|
41
|
+
"新发现的 Skill 默认启用": "新发现的 Skill 默认启用",
|
|
42
|
+
"日本語": "日本語",
|
|
43
|
+
"显示译文": "显示译文",
|
|
44
|
+
"未连接": "未连接",
|
|
45
|
+
"来源:": "来源:",
|
|
46
|
+
"查看原文": "查看原文",
|
|
47
|
+
"查看译文": "查看译文",
|
|
48
|
+
"正在翻译 ": "正在翻译 ",
|
|
49
|
+
"正在读取能力列表…": "正在读取能力列表…",
|
|
50
|
+
"正在重新翻译 ": "正在重新翻译 ",
|
|
51
|
+
"此配置已批准;修改源配置后需要重新批准。": "此配置已批准;修改源配置后需要重新批准。",
|
|
52
|
+
"没有匹配的能力。": "没有匹配的能力。",
|
|
53
|
+
"添加工作区": "添加工作区",
|
|
54
|
+
"添加已有目录的工作区规则": "添加已有目录的工作区规则",
|
|
55
|
+
"点击后使用当前界面所选模型翻译名称和说明,结果保存在本地缓存。同语默认保留原文,单项按钮可强制翻译。原始标识符和 Agent 调用保持不变。": "点击后使用当前界面所选模型翻译名称和说明,结果保存在本地缓存。同语默认保留原文,单项按钮可强制翻译。原始标识符和 Agent 调用保持不变。",
|
|
56
|
+
"环境变量名称:": "环境变量名称:",
|
|
57
|
+
"禁用": "禁用",
|
|
58
|
+
"简体中文": "简体中文",
|
|
59
|
+
"繁體中文": "繁體中文",
|
|
60
|
+
"继承全局": "继承全局",
|
|
61
|
+
"翻译当前列表": "翻译当前列表",
|
|
62
|
+
"翻译成": "翻译成",
|
|
63
|
+
"翻译模型:": "翻译模型:",
|
|
64
|
+
"翻译目标语言已保存。": "翻译目标语言已保存。",
|
|
65
|
+
"翻译目标语言未保存,请刷新后重试。": "翻译目标语言未保存,请刷新后重试。",
|
|
66
|
+
"翻译说明": "翻译说明",
|
|
67
|
+
"能力类型": "能力类型",
|
|
68
|
+
"规则范围": "规则范围",
|
|
69
|
+
"请先选择模型": "请先选择模型",
|
|
70
|
+
"请求失败": "请求失败",
|
|
71
|
+
"跟随界面语言": "跟随界面语言",
|
|
72
|
+
"这些规则控制 Agent 的 Skill 加载和 MCP 调用;源文件不会被修改。设置已持久保存,服务重启后仍然有效。": "这些规则控制 Agent 的 Skill 加载和 MCP 调用;源文件不会被修改。设置已持久保存,服务重启后仍然有效。",
|
|
73
|
+
"这里的全局与工作区规则仅作用于 DeepSeek Harness。默认只发现 DSH 自身的 Skill 和 MCP;其他应用来源可以单独开启。": "这里的全局与工作区规则仅作用于 DeepSeek Harness。默认只发现 DSH 自身的 Skill 和 MCP;其他应用来源可以单独开启。",
|
|
74
|
+
"连接中": "连接中",
|
|
75
|
+
"连接失败,请检查源配置或重新启用": "连接失败,请检查源配置或重新启用",
|
|
76
|
+
"部分 Skill 目录尚未完成扫描,请重新发现。": "部分 Skill 目录尚未完成扫描,请重新发现。",
|
|
77
|
+
"重新发现": "重新发现",
|
|
78
|
+
"重新翻译": "重新翻译",
|
|
79
|
+
"重新翻译 ": "重新翻译 ",
|
|
80
|
+
"(跟随当前界面)": "(跟随当前界面)",
|
|
81
|
+
"服务配置必须是对象。": "服务配置必须是对象。",
|
|
82
|
+
"源配置中已禁用,请先在源配置中启用。": "源配置中已禁用,请先在源配置中启用。",
|
|
83
|
+
"此版本仅支持 stdio 和 Streamable HTTP。": "此版本仅支持 stdio 和 Streamable HTTP。",
|
|
84
|
+
"args 必须是字符串数组。": "args 必须是字符串数组。",
|
|
85
|
+
"env 必须是字符串字典。": "env 必须是字符串字典。",
|
|
86
|
+
"HTTP 服务地址无效。": "HTTP 服务地址无效。",
|
|
87
|
+
"headers 必须是字符串字典。": "headers 必须是字符串字典。",
|
|
88
|
+
"未发现 command 或 url。": "未发现 command 或 url。",
|
|
89
|
+
"DSH 服务环境中缺少配置引用的环境变量。": "DSH 服务环境中缺少配置引用的环境变量。",
|
|
90
|
+
"文件超过 2 MiB,已跳过。": "文件超过 2 MiB,已跳过。",
|
|
91
|
+
"YAML 解析失败。": "YAML 解析失败。",
|
|
92
|
+
"请求超过 64 KiB。": "请求超过 64 KiB。",
|
|
93
|
+
"请求不是有效的 JSON 对象。": "请求不是有效的 JSON 对象。",
|
|
94
|
+
"工作区必须是绝对路径。": "工作区必须是绝对路径。",
|
|
95
|
+
"工作区目录不存在或不可访问。": "工作区目录不存在或不可访问。",
|
|
96
|
+
"能力类型无效。": "能力类型无效。",
|
|
97
|
+
"未发现此能力,请重新扫描。": "未发现此能力,请重新扫描。",
|
|
98
|
+
"规则必须为启用、禁用或继承。": "规则必须为启用、禁用或继承。",
|
|
99
|
+
"此 MCP 来源于另一工作区,仅能在来源工作区启用。": "此 MCP 来源于另一工作区,仅能在来源工作区启用。",
|
|
100
|
+
"批准连接参数无效。": "批准连接参数无效。",
|
|
101
|
+
"源配置已改变,请重新检查并批准。": "源配置已改变,请重新检查并批准。",
|
|
102
|
+
"发现来源开关无效。": "发现来源开关无效。",
|
|
103
|
+
"请选择工作区。": "请选择工作区。",
|
|
104
|
+
"默认规则无效。": "默认规则无效。",
|
|
105
|
+
"操作无效。": "操作无效。",
|
|
106
|
+
"翻译服务尚未就绪。": "翻译服务尚未就绪。",
|
|
107
|
+
"重新翻译参数无效。": "重新翻译参数无效。",
|
|
108
|
+
"每次请选择 1–12 条说明。": "每次请选择 1–12 条说明。",
|
|
109
|
+
"该能力已不在当前发现范围,请刷新后重试。": "该能力已不在当前发现范围,请刷新后重试。",
|
|
110
|
+
"请求必须使用 application/json。": "请求必须使用 application/json。",
|
|
111
|
+
"设置已在别处更新,请刷新后重试。": "设置已在别处更新,请刷新后重试。",
|
|
112
|
+
"翻译目标语言无效,最多 160 字符。": "翻译目标语言无效,最多 160 字符。",
|
|
113
|
+
"模型返回的翻译格式不完整,请重试。": "模型返回的翻译格式不完整,请重试。",
|
|
114
|
+
"模型未执行强制翻译,请重试。": "模型未执行强制翻译,请重试。",
|
|
115
|
+
"请先在 DeepSeek 界面选择可用的模型。": "请先在 DeepSeek 界面选择可用的模型。",
|
|
116
|
+
"当前界面所选模型的服务尚未就绪。": "当前界面所选模型的服务尚未就绪。",
|
|
117
|
+
"每次最多翻译 12 条能力说明。": "每次最多翻译 12 条能力说明。",
|
|
118
|
+
"另一批翻译正在进行,请稍后重试。": "另一批翻译正在进行,请稍后重试。",
|
|
119
|
+
"模型未完成翻译,请重试或减少翻译条数。": "模型未完成翻译,请重试或减少翻译条数。",
|
|
120
|
+
"模型返回的翻译过长。": "模型返回的翻译过长。",
|
|
121
|
+
"模型未返回有效的翻译 JSON,请重试。": "模型未返回有效的翻译 JSON,请重试。",
|
|
122
|
+
"模型遗漏了部分翻译,请重试。": "模型遗漏了部分翻译,请重试。",
|
|
123
|
+
"请使用受信任的 Harness 页面访问设置。": "请使用受信任的 Harness 页面访问设置。",
|
|
124
|
+
"操作未完成,请刷新后重试。": "操作未完成,请刷新后重试。",
|
|
125
|
+
"操作未完成,请重试。": "操作未完成,请重试。",
|
|
126
|
+
"翻译已取消或超时,请重试。": "翻译已取消或超时,请重试。",
|
|
127
|
+
"当前模型翻译失败,请检查 DeepSeek 的模型连接后重试。": "当前模型翻译失败,请检查 DeepSeek 的模型连接后重试。",
|
|
128
|
+
"策略文件无法读取,Skill 和 MCP 已暂停。请恢复 policy.json 备份后重启服务。": "策略文件无法读取,Skill 和 MCP 已暂停。请恢复 policy.json 备份后重启服务。"
|
|
129
|
+
};
|
|
130
|
+
export const en = {
|
|
131
|
+
" · 当前使用工作区规则": " · Using workspace rules",
|
|
132
|
+
" · 当前继承全局": " · Inheriting global rules",
|
|
133
|
+
" 个工具": " tools",
|
|
134
|
+
" 条…": " entries…",
|
|
135
|
+
" 规则": " rule",
|
|
136
|
+
"/home/用户名/项目": "/home/user/project",
|
|
137
|
+
"DSH 原生连接": "DSH native connection",
|
|
138
|
+
"Skill 与 MCP": "Skills & MCP",
|
|
139
|
+
"使用当前模型重新翻译并更新缓存": "Regenerate with the current model and update the cache",
|
|
140
|
+
"使用默认": "Use default",
|
|
141
|
+
"保存语言": "Save language",
|
|
142
|
+
"全局规则将应用到未单独设置的工作区。": "Global rules apply to workspaces without an override.",
|
|
143
|
+
"全局默认": "Global default",
|
|
144
|
+
"全局:": "Global: ",
|
|
145
|
+
"切换到该来源工作区后可设置。": "Switch to the source workspace to configure it.",
|
|
146
|
+
"原生配置/未发现工具": "Native configuration / no tools discovered",
|
|
147
|
+
"发现列表已刷新。": "Discovery list refreshed.",
|
|
148
|
+
"发现过程中的问题 (": "Discovery issues (",
|
|
149
|
+
"可用": "Available",
|
|
150
|
+
"可选读取 CC Switch 共享 Skill 目录,以及 Codex、Claude、Cursor 配置。扫描只读取来源;新能力默认禁用,MCP 首次连接仍需批准。": "Optionally read shared CC Switch Skills and Codex, Claude, and Cursor configuration. Scanning only reads sources; new capabilities default to disabled, and the first MCP connection requires approval.",
|
|
151
|
+
"启用": "Enable",
|
|
152
|
+
"工作区绝对路径": "Absolute workspace path",
|
|
153
|
+
"工作区:": "Workspace: ",
|
|
154
|
+
"工具说明 (": "Tool descriptions (",
|
|
155
|
+
"已保存,当前及后续 Agent 调用即时使用新规则。": "Saved. Current and subsequent Agent calls use the new rules immediately.",
|
|
156
|
+
"已处理 {p0} 条,{p1} 条已是目标语言 · {p2}": "Processed {p0} entries; {p1} already in the target language · {p2}",
|
|
157
|
+
"已批准的 MCP 默认启用": "Enable approved MCP by default",
|
|
158
|
+
"已是目标语言": "Already in the target language",
|
|
159
|
+
"已禁用": "Disabled",
|
|
160
|
+
"已连接": "Connected",
|
|
161
|
+
"已连接/暂无工具": "Connected / no tools",
|
|
162
|
+
"当前范围未发现 MCP。DSH 配置和工作区 .dsh/mcp.json 会自动发现;其他应用需打开上方扫描开关。": "No MCP discovered in this scope. DSH configuration and workspace .dsh/mcp.json are discovered automatically; enable the scan option for other applications.",
|
|
163
|
+
"当前范围未发现 Skill。这里展示 DeepSeek 已注册的 Skill;其他应用需打开上方扫描开关。": "No Skills discovered in this scope. This list shows Skills registered with DeepSeek; enable the scan option for other applications.",
|
|
164
|
+
"待批准": "Approval needed",
|
|
165
|
+
"所属工作区:": "Workspace: ",
|
|
166
|
+
"扫描其他应用的 Skill / MCP(全局)": "Scan other applications' Skills / MCP (global)",
|
|
167
|
+
"批准配置并启用连接": "Approve configuration and enable connection",
|
|
168
|
+
"搜索名称、说明或来源路径": "Search names, descriptions, or source paths",
|
|
169
|
+
"搜索能力": "Search capabilities",
|
|
170
|
+
"新发现的 Skill 默认启用": "Enable newly discovered Skills by default",
|
|
171
|
+
"日本語": "Japanese",
|
|
172
|
+
"显示译文": "Show translations",
|
|
173
|
+
"未连接": "Disconnected",
|
|
174
|
+
"来源:": "Source: ",
|
|
175
|
+
"查看原文": "Show original",
|
|
176
|
+
"查看译文": "Show translation",
|
|
177
|
+
"正在翻译 ": "Translating ",
|
|
178
|
+
"正在读取能力列表…": "Loading capabilities…",
|
|
179
|
+
"正在重新翻译 ": "Retranslating ",
|
|
180
|
+
"此配置已批准;修改源配置后需要重新批准。": "Approved. Changes to the source configuration require approval again.",
|
|
181
|
+
"没有匹配的能力。": "No matching capabilities.",
|
|
182
|
+
"添加工作区": "Add workspace",
|
|
183
|
+
"添加已有目录的工作区规则": "Add rules for an existing workspace folder",
|
|
184
|
+
"点击后使用当前界面所选模型翻译名称和说明,结果保存在本地缓存。同语默认保留原文,单项按钮可强制翻译。原始标识符和 Agent 调用保持不变。": "Translate names and descriptions with the selected model and cache results locally. Text already in the target language stays unchanged unless translated individually. Identifiers and Agent calls remain unchanged.",
|
|
185
|
+
"环境变量名称:": "Environment variable names: ",
|
|
186
|
+
"禁用": "Disable",
|
|
187
|
+
"简体中文": "Simplified Chinese",
|
|
188
|
+
"繁體中文": "Traditional Chinese",
|
|
189
|
+
"继承全局": "Inherit global",
|
|
190
|
+
"翻译当前列表": "Translate this list",
|
|
191
|
+
"翻译成": "Translate into",
|
|
192
|
+
"翻译模型:": "Translation model: ",
|
|
193
|
+
"翻译目标语言已保存。": "Translation target saved.",
|
|
194
|
+
"翻译目标语言未保存,请刷新后重试。": "Translation target was not saved. Refresh and try again.",
|
|
195
|
+
"翻译说明": "Translate description",
|
|
196
|
+
"能力类型": "Capability type",
|
|
197
|
+
"规则范围": "Rule scope",
|
|
198
|
+
"请先选择模型": "Select a model first",
|
|
199
|
+
"请求失败": "Request failed",
|
|
200
|
+
"跟随界面语言": "Follow interface language",
|
|
201
|
+
"这些规则控制 Agent 的 Skill 加载和 MCP 调用;源文件不会被修改。设置已持久保存,服务重启后仍然有效。": "These rules control Agent Skill loading and MCP calls without changing source files. Settings persist across service restarts.",
|
|
202
|
+
"这里的全局与工作区规则仅作用于 DeepSeek Harness。默认只发现 DSH 自身的 Skill 和 MCP;其他应用来源可以单独开启。": "Global and workspace rules apply to DeepSeek Harness. DSH's own Skills and MCP are discovered by default; other application sources are optional.",
|
|
203
|
+
"连接中": "Connecting",
|
|
204
|
+
"连接失败,请检查源配置或重新启用": "Connection failed; check the configuration or enable it again",
|
|
205
|
+
"部分 Skill 目录尚未完成扫描,请重新发现。": "Some Skill folders have not finished scanning. Discover again.",
|
|
206
|
+
"重新发现": "Discover again",
|
|
207
|
+
"重新翻译": "Retranslate",
|
|
208
|
+
"重新翻译 ": "Retranslate ",
|
|
209
|
+
"(跟随当前界面)": " (current interface selection)",
|
|
210
|
+
"服务配置必须是对象。": "Server configuration must be an object.",
|
|
211
|
+
"源配置中已禁用,请先在源配置中启用。": "Disabled in the source configuration. Enable it there first.",
|
|
212
|
+
"此版本仅支持 stdio 和 Streamable HTTP。": "This version supports stdio and Streamable HTTP only.",
|
|
213
|
+
"args 必须是字符串数组。": "args must be a string array.",
|
|
214
|
+
"env 必须是字符串字典。": "env must be a string dictionary.",
|
|
215
|
+
"HTTP 服务地址无效。": "Invalid HTTP server URL.",
|
|
216
|
+
"headers 必须是字符串字典。": "headers must be a string dictionary.",
|
|
217
|
+
"未发现 command 或 url。": "No command or URL found.",
|
|
218
|
+
"DSH 服务环境中缺少配置引用的环境变量。": "A referenced environment variable is missing from the DSH service environment.",
|
|
219
|
+
"文件超过 2 MiB,已跳过。": "File exceeds 2 MiB and was skipped.",
|
|
220
|
+
"YAML 解析失败。": "Could not parse YAML.",
|
|
221
|
+
"请求超过 64 KiB。": "Request exceeds 64 KiB.",
|
|
222
|
+
"请求不是有效的 JSON 对象。": "Request is not a valid JSON object.",
|
|
223
|
+
"工作区必须是绝对路径。": "Workspace must be an absolute path.",
|
|
224
|
+
"工作区目录不存在或不可访问。": "Workspace folder is missing or inaccessible.",
|
|
225
|
+
"能力类型无效。": "Invalid capability type.",
|
|
226
|
+
"未发现此能力,请重新扫描。": "Capability was not discovered. Scan again.",
|
|
227
|
+
"规则必须为启用、禁用或继承。": "Rule must be enabled, disabled, or inherited.",
|
|
228
|
+
"此 MCP 来源于另一工作区,仅能在来源工作区启用。": "This MCP belongs to another workspace and can only be enabled there.",
|
|
229
|
+
"批准连接参数无效。": "Invalid connection approval parameters.",
|
|
230
|
+
"源配置已改变,请重新检查并批准。": "Source configuration changed. Review and approve it again.",
|
|
231
|
+
"发现来源开关无效。": "Invalid discovery source option.",
|
|
232
|
+
"请选择工作区。": "Choose a workspace.",
|
|
233
|
+
"默认规则无效。": "Invalid default rule.",
|
|
234
|
+
"操作无效。": "Invalid operation.",
|
|
235
|
+
"翻译服务尚未就绪。": "Translation service is not ready.",
|
|
236
|
+
"重新翻译参数无效。": "Invalid retranslation parameter.",
|
|
237
|
+
"每次请选择 1–12 条说明。": "Select 1–12 descriptions per request.",
|
|
238
|
+
"该能力已不在当前发现范围,请刷新后重试。": "Capability is no longer in this discovery scope. Refresh and try again.",
|
|
239
|
+
"请求必须使用 application/json。": "Requests must use application/json.",
|
|
240
|
+
"设置已在别处更新,请刷新后重试。": "Settings changed elsewhere. Refresh and try again.",
|
|
241
|
+
"翻译目标语言无效,最多 160 字符。": "Invalid translation target; use at most 160 characters.",
|
|
242
|
+
"模型返回的翻译格式不完整,请重试。": "Model returned an incomplete translation. Retry.",
|
|
243
|
+
"模型未执行强制翻译,请重试。": "Model did not perform the forced translation. Retry.",
|
|
244
|
+
"请先在 DeepSeek 界面选择可用的模型。": "Select an available model in the DeepSeek interface first.",
|
|
245
|
+
"当前界面所选模型的服务尚未就绪。": "The selected model's service is not ready.",
|
|
246
|
+
"每次最多翻译 12 条能力说明。": "Translate at most 12 capability descriptions per request.",
|
|
247
|
+
"另一批翻译正在进行,请稍后重试。": "Another translation batch is in progress. Try again later.",
|
|
248
|
+
"模型未完成翻译,请重试或减少翻译条数。": "Model did not finish translating. Retry or reduce the batch size.",
|
|
249
|
+
"模型返回的翻译过长。": "Model translation response is too long.",
|
|
250
|
+
"模型未返回有效的翻译 JSON,请重试。": "Model did not return valid translation JSON. Retry.",
|
|
251
|
+
"模型遗漏了部分翻译,请重试。": "Model omitted some translations. Retry.",
|
|
252
|
+
"请使用受信任的 Harness 页面访问设置。": "Open settings from a trusted Harness page.",
|
|
253
|
+
"操作未完成,请刷新后重试。": "Operation did not complete. Refresh and retry.",
|
|
254
|
+
"操作未完成,请重试。": "Operation did not complete. Retry.",
|
|
255
|
+
"翻译已取消或超时,请重试。": "Translation was cancelled or timed out. Retry.",
|
|
256
|
+
"当前模型翻译失败,请检查 DeepSeek 的模型连接后重试。": "Translation failed. Check the DeepSeek model connection and retry.",
|
|
257
|
+
"策略文件无法读取,Skill 和 MCP 已暂停。请恢复 policy.json 备份后重启服务。": "Policy file is unreadable; Skills and MCP are paused. Restore the policy.json backup and restart."
|
|
258
|
+
};
|