@ai-workbench/remote-agent 0.9.0-toolbridge.3 → 0.9.0-toolbridge.31
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 +36 -7
- package/dist/acp.d.ts +23 -3
- package/dist/acp.js +106 -21
- package/dist/broker-runtime.d.ts +2 -0
- package/dist/broker-runtime.js +60 -3
- package/dist/broker.d.ts +56 -1
- package/dist/broker.js +310 -11
- package/dist/claude-local.js +26 -5
- package/dist/client.js +1 -1
- package/dist/close-diagnostics.d.ts +1 -1
- package/dist/close-diagnostics.js +1 -1
- package/dist/cold-protocol.d.ts +17 -0
- package/dist/cold-protocol.js +399 -0
- package/dist/cold-recovery.d.ts +62 -0
- package/dist/cold-recovery.js +595 -0
- package/dist/cold-store.d.ts +99 -0
- package/dist/cold-store.js +29 -0
- package/dist/conversation-details.js +21 -8
- package/dist/employee-endpoint.js +15 -1
- package/dist/employee-mcp.js +1 -1
- package/dist/employee-native.js +7 -1
- package/dist/employee-provider.d.ts +2 -0
- package/dist/employee-provider.js +46 -11
- package/dist/employee-relay.js +148 -1
- package/dist/employee-shell.d.ts +2 -0
- package/dist/employee-shell.js +22 -19
- package/dist/employee-startup.d.ts +18 -0
- package/dist/employee-startup.js +95 -0
- package/dist/employee-tools.js +2 -2
- package/dist/employee-workspace.d.ts +20 -4
- package/dist/employee-workspace.js +26 -5
- package/dist/index.d.ts +12 -3
- package/dist/index.js +223 -51
- package/dist/input.js +4 -1
- package/dist/live-steering.d.ts +46 -0
- package/dist/live-steering.js +45 -0
- package/dist/mapping.d.ts +4 -24
- package/dist/mapping.js +11 -65
- package/dist/model-catalog.d.ts +2 -0
- package/dist/model-catalog.js +5 -1
- package/dist/preflight-diagnostic.js +1 -1
- package/dist/presentation.js +1 -0
- package/dist/provider.d.ts +16 -0
- package/dist/provider.js +66 -33
- package/dist/rpc-namespace.js +16 -2
- package/dist/session-source.d.ts +3 -1
- package/dist/session-source.js +2 -1
- package/dist/startup-timing.d.ts +14 -0
- package/dist/startup-timing.js +34 -0
- package/dist/toolbridge-loop.d.ts +3 -2
- package/dist/toolbridge-loop.js +4 -2
- package/dist/toolbridge-table.d.ts +4 -3
- package/dist/toolbridge-table.js +14 -5
- package/dist/toolbridge.d.ts +1 -1
- package/dist/toolbridge.js +23 -4
- package/package.json +23 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GenerateOptions, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
1
|
+
import { type GenerateOptions, type StreamChunk, type UserMessage } from '@deepseek-ai/dsh-llm';
|
|
2
2
|
import { ToolBridge } from './toolbridge.ts';
|
|
3
3
|
import type { ImageReader } from './input.ts';
|
|
4
4
|
type Producer = (options: GenerateOptions, bridge: ToolBridge) => AsyncGenerator<StreamChunk>;
|
|
@@ -6,9 +6,10 @@ type Producer = (options: GenerateOptions, bridge: ToolBridge) => AsyncGenerator
|
|
|
6
6
|
export declare class ToolBridgeLoop {
|
|
7
7
|
private readImage?;
|
|
8
8
|
private stopped?;
|
|
9
|
+
private isInjected?;
|
|
9
10
|
private runs;
|
|
10
11
|
private concluding;
|
|
11
|
-
constructor(readImage?: ImageReader | undefined, stopped?: ((sessionId: string, notice: string) => void) | undefined);
|
|
12
|
+
constructor(readImage?: ImageReader | undefined, stopped?: ((sessionId: string, notice: string) => void) | undefined, isInjected?: ((sessionId: string, message: UserMessage) => boolean) | undefined);
|
|
12
13
|
private launch;
|
|
13
14
|
conclude(id: string, messages: GenerateOptions['messages']): Promise<void>;
|
|
14
15
|
active(id: string): boolean;
|
package/dist/toolbridge-loop.js
CHANGED
|
@@ -44,11 +44,13 @@ class Projection {
|
|
|
44
44
|
export class ToolBridgeLoop {
|
|
45
45
|
readImage;
|
|
46
46
|
stopped;
|
|
47
|
+
isInjected;
|
|
47
48
|
runs = new Map();
|
|
48
49
|
concluding = new Map();
|
|
49
|
-
constructor(readImage, stopped) {
|
|
50
|
+
constructor(readImage, stopped, isInjected) {
|
|
50
51
|
this.readImage = readImage;
|
|
51
52
|
this.stopped = stopped;
|
|
53
|
+
this.isInjected = isInjected;
|
|
52
54
|
}
|
|
53
55
|
launch(options, producer) {
|
|
54
56
|
const controller = new AbortController(), bridge = new ToolBridge(options, this.readImage);
|
|
@@ -181,7 +183,7 @@ export class ToolBridgeLoop {
|
|
|
181
183
|
throw new NeedError('ABORTED', '本轮已取消,工具结果没有重放。', '确认主机取消状态');
|
|
182
184
|
if (run.latest !== options) {
|
|
183
185
|
for (const m of options.messages)
|
|
184
|
-
if (m.role === 'user' && 'source' in m && m.source?.kind === 'user' && 'id' in m && typeof m.id === 'string' && !run.seen.has(m.id)) {
|
|
186
|
+
if (m.role === 'user' && 'source' in m && m.source?.kind === 'user' && 'id' in m && typeof m.id === 'string' && !run.seen.has(m.id) && !this.isInjected?.(key, m)) {
|
|
185
187
|
run.seen.add(m.id);
|
|
186
188
|
run.deferred.push(m);
|
|
187
189
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { ToolSchema } from '@deepseek-ai/dsh-llm';
|
|
1
|
+
import type { ToolSchema, GenerateOptions } from '@deepseek-ai/dsh-llm';
|
|
2
2
|
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
/** Fixed official tool names; no description heuristics or plugin-name branches. */
|
|
4
|
-
export declare const TOOLBRIDGE_EXCLUDED: readonly ["read", "write", "edit", "read_image", "glob", "grep", "bash", "pwsh", "str_replace_editor", "
|
|
4
|
+
export declare const TOOLBRIDGE_EXCLUDED: readonly ["read", "write", "edit", "read_image", "glob", "grep", "bash", "pwsh", "str_replace_editor", "terminal_open", "terminal_send", "terminal_read", "terminal_signal", "terminal_close", "terminal_list", "run_code"];
|
|
5
5
|
export interface BridgeTool {
|
|
6
6
|
alias: string;
|
|
7
7
|
schema: ToolSchema;
|
|
8
8
|
wire: Tool;
|
|
9
9
|
}
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function dshSkillCatalog(messages?: GenerateOptions['messages']): readonly string[] | undefined;
|
|
11
|
+
export declare function bridgeTable(tools?: readonly ToolSchema[], catalog?: readonly string[], catalogInCurrentPrompt?: boolean): ReadonlyMap<string, BridgeTool>;
|
package/dist/toolbridge-table.js
CHANGED
|
@@ -3,13 +3,21 @@ import { NeedError } from "./remote.js";
|
|
|
3
3
|
/** Fixed official tool names; no description heuristics or plugin-name branches. */
|
|
4
4
|
export const TOOLBRIDGE_EXCLUDED = Object.freeze([
|
|
5
5
|
'read', 'write', 'edit', 'read_image', 'glob', 'grep', 'bash', 'pwsh', 'str_replace_editor',
|
|
6
|
-
'job_output', 'job_list', 'job_kill', 'load_workspace_dependencies',
|
|
7
6
|
'terminal_open', 'terminal_send', 'terminal_read', 'terminal_signal', 'terminal_close', 'terminal_list',
|
|
8
|
-
'
|
|
9
|
-
'team_task_create', 'team_task_list', 'team_task_get', 'team_task_update', 'run_code',
|
|
7
|
+
'run_code',
|
|
10
8
|
]);
|
|
11
9
|
const excluded = new Set(TOOLBRIDGE_EXCLUDED);
|
|
12
|
-
export function
|
|
10
|
+
export function dshSkillCatalog(messages = []) {
|
|
11
|
+
for (const message of messages.toReversed()) {
|
|
12
|
+
const source = message.source;
|
|
13
|
+
if (message.role !== 'user' || source?.kind !== 'skill-catalog' || source.form !== 'catalog' || !Array.isArray(source.entries))
|
|
14
|
+
continue;
|
|
15
|
+
if (!source.entries.every(entry => entry && typeof entry.name === 'string' && typeof entry.description === 'string'))
|
|
16
|
+
continue;
|
|
17
|
+
return source.entries.map(entry => entry.name);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function bridgeTable(tools = [], catalog, catalogInCurrentPrompt = false) {
|
|
13
21
|
const table = new Map(), names = new Set();
|
|
14
22
|
for (const tool of tools) {
|
|
15
23
|
if (excluded.has(tool.name))
|
|
@@ -21,7 +29,8 @@ export function bridgeTable(tools = []) {
|
|
|
21
29
|
if (table.has(alias))
|
|
22
30
|
throw new NeedError('TOOLBRIDGE_NAME_COLLISION', '工具桥名称冲突,未执行。', '唯一工具桥名称');
|
|
23
31
|
const schema = structuredClone(tool);
|
|
24
|
-
|
|
32
|
+
const skill = schema.name === 'skill' ? ' 这是DSH技能加载器,名字取自DSH的<available_skills>目录;主机Claude/Codex的原生技能按各自原生技能指令加载。' + (catalogInCurrentPrompt ? '实际可用性由DSH调用时确认。' : catalog === undefined ? '请以当前DSH技能目录为准。' : '本次DSH公布的目录快照:' + JSON.stringify(catalog) + ';实际可用性由DSH调用时确认。') + '技能资源按返回的<skill_resources>基址读取。' : '';
|
|
33
|
+
table.set(alias, { alias, schema, wire: { name: alias, description: 'DSH工具 ' + schema.name + ':' + schema.description + skill, inputSchema: structuredClone(schema.parameters) } });
|
|
25
34
|
}
|
|
26
35
|
return table;
|
|
27
36
|
}
|
package/dist/toolbridge.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type BridgeTool } from './toolbridge-table.ts';
|
|
|
5
5
|
import type { ImageReader } from './input.ts';
|
|
6
6
|
import type { DetailObservation } from './conversation-details.ts';
|
|
7
7
|
export declare const TOOLBRIDGE_TIMEOUT_SECONDS = 1800;
|
|
8
|
-
export declare const TOOLBRIDGE_NOTICE = "\u542B\u5DE5\u5177\u6865\uFF1A\u672C\u673A\u6587\u4EF6\u5939\u7684\u6269\u5C55\u5DE5\u5177\u7531DSH\u6267\u884C\u5E76\u6309\u5F53\u524D\u6743\u9650\u5BA1\u6279\uFF1B\u6587\u4EF6\u548C\u547D\u4EE4\u4FDD\u6301\u539F\u6267\u884C\u65B9\u5F0F\u3002\u5DE5\u5177\u8868\u5728\u65B0\u4E00\u8F6E\u4E3B\u673A\u8FDE\u63A5\u65F6\u66F4\u65B0\u3002";
|
|
8
|
+
export declare const TOOLBRIDGE_NOTICE = "\u542B\u5DE5\u5177\u6865\uFF1A\u672C\u673A\u6587\u4EF6\u5939\u7684\u6269\u5C55\u5DE5\u5177\uFF08\u542BDSH\u5B50\u4EE3\u7406\u3001workflow\u548C\u540E\u53F0\u4EFB\u52A1\u5DE5\u5177\uFF09\u7531DSH\u6267\u884C\u5E76\u6309\u5F53\u524D\u6743\u9650\u5BA1\u6279\uFF1B\u6587\u4EF6\u548C\u547D\u4EE4\u4FDD\u6301\u539F\u6267\u884C\u65B9\u5F0F\u3002\u5DE5\u5177\u8868\u5728\u65B0\u4E00\u8F6E\u4E3B\u673A\u8FDE\u63A5\u65F6\u66F4\u65B0\u3002";
|
|
9
9
|
export declare const TOOLBRIDGE_ENDED = "\u4E3B\u673A\u5DF2\u7ED3\u675F\u8FD9\u6B21\u5DE5\u5177\u7B49\u5F85\uFF1B\u672C\u8F6E\u5DF2\u505C\u6B62\uFF0C\u8FDF\u5230\u7ED3\u679C\u4E0D\u4F1A\u4EA4\u56DE\uFF0C\u4E5F\u4E0D\u4F1A\u91CD\u65B0\u6267\u884C\u3002\u8BF7\u6838\u5BF9\u5DF2\u53D1\u751F\u7684\u64CD\u4F5C\u3002";
|
|
10
10
|
interface Pending {
|
|
11
11
|
block: ToolCallBlock;
|
package/dist/toolbridge.js
CHANGED
|
@@ -4,10 +4,10 @@ import { mkdtemp, lstat, rm } from 'node:fs/promises';
|
|
|
4
4
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
5
|
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
6
6
|
import { EmployeeSocketTransport } from "./employee-mcp.js";
|
|
7
|
-
import { bridgeTable } from "./toolbridge-table.js";
|
|
7
|
+
import { bridgeTable, dshSkillCatalog } from "./toolbridge-table.js";
|
|
8
8
|
import { NeedError } from "./remote.js";
|
|
9
9
|
export const TOOLBRIDGE_TIMEOUT_SECONDS = 1800;
|
|
10
|
-
export const TOOLBRIDGE_NOTICE = '
|
|
10
|
+
export const TOOLBRIDGE_NOTICE = '含工具桥:本机文件夹的扩展工具(含DSH子代理、workflow和后台任务工具)由DSH执行并按当前权限审批;文件和命令保持原执行方式。工具表在新一轮主机连接时更新。';
|
|
11
11
|
export const TOOLBRIDGE_ENDED = '主机已结束这次工具等待;本轮已停止,迟到结果不会交回,也不会重新执行。请核对已发生的操作。';
|
|
12
12
|
const errorResult = (text) => ({ isError: true, content: [{ type: 'text', text }] });
|
|
13
13
|
/** Only a protocol queue. Tool execution and authorization belong to DSH. */
|
|
@@ -16,7 +16,26 @@ export class ToolBridge {
|
|
|
16
16
|
readImage;
|
|
17
17
|
controller = new AbortController();
|
|
18
18
|
snapshot;
|
|
19
|
-
get table() {
|
|
19
|
+
get table() {
|
|
20
|
+
if (this.snapshot)
|
|
21
|
+
return this.snapshot;
|
|
22
|
+
const messages = this.options.messages, catalog = dshSkillCatalog(messages);
|
|
23
|
+
// prepareInput只转发最后assistant之后的user内容;历史目录不能代替当前prompt。
|
|
24
|
+
// 正文不含目录全部名字时仍保留原schema快照,避免分支/切模型时丢发现入口。
|
|
25
|
+
const current = messages.slice(messages.findLastIndex(message => message.role === 'assistant') + 1);
|
|
26
|
+
const forwarded = catalog !== undefined && catalog.length > 0 && current.some(message => {
|
|
27
|
+
const names = dshSkillCatalog([message]);
|
|
28
|
+
if (names === undefined || JSON.stringify(names) !== JSON.stringify(catalog))
|
|
29
|
+
return false;
|
|
30
|
+
const text = message.content.filter(block => block.type === 'text').map(block => block.text).join('\n');
|
|
31
|
+
// 只认官方目录中明确声明的完整名字;子串命中不能证明office也已随office-xlsx送达。
|
|
32
|
+
// 未识别的格式继续携带原名字快照,不推测目录内容。
|
|
33
|
+
const declared = new Set([...text.matchAll(/<available_skills>([\s\S]*?)<\/available_skills>/g)]
|
|
34
|
+
.flatMap(section => [...section[1].matchAll(/^[ \t]*-[ \t]+`([^`\r\n]+)`[ \t]*:/gm)].map(item => item[1])));
|
|
35
|
+
return catalog.every(name => declared.has(name));
|
|
36
|
+
});
|
|
37
|
+
return this.snapshot = bridgeTable(this.options.tools, catalog, forwarded);
|
|
38
|
+
}
|
|
20
39
|
calls = new Map();
|
|
21
40
|
enabled = false;
|
|
22
41
|
ended = false;
|
|
@@ -41,7 +60,7 @@ export class ToolBridge {
|
|
|
41
60
|
this.readImage = readImage;
|
|
42
61
|
}
|
|
43
62
|
enable(record) { if (!this.table.size)
|
|
44
|
-
return; this.enabled = true; this.record = record; record({ kind: 'session', severity: 'info', code: 'TOOLBRIDGE_SELECTED', summary: TOOLBRIDGE_NOTICE, payload: { toolCount: this.table.size, toolTimeoutSec: TOOLBRIDGE_TIMEOUT_SECONDS, timeoutSource: 'owner-2026-10-26', snapshot: 'native-session-open', excluded: 'official-file-command-
|
|
63
|
+
return; this.enabled = true; this.record = record; record({ kind: 'session', severity: 'info', code: 'TOOLBRIDGE_SELECTED', summary: TOOLBRIDGE_NOTICE, payload: { toolCount: this.table.size, toolTimeoutSec: TOOLBRIDGE_TIMEOUT_SECONDS, timeoutSource: 'owner-2026-10-26', snapshot: 'native-session-open', excluded: 'official-file-command-terminal-run_code' } }); }
|
|
45
64
|
get tools() { return [...this.table.values()].map(t => t.wire); }
|
|
46
65
|
isBridge(name) { return typeof name === 'string' && this.table.has(name.replace(/^mcp__employee__/, '')); }
|
|
47
66
|
async call(alias, args, signal) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-workbench/remote-agent",
|
|
3
|
-
"version": "0.9.0-toolbridge.
|
|
3
|
+
"version": "0.9.0-toolbridge.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"pack:artifact": "node tools/pack-artifact.mjs"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=24.13.1"
|
|
30
|
+
"node": ">=24.13.1",
|
|
31
|
+
"dsh": ">=0.2.0-rc.2 <0.3.0-0"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@agentclientprotocol/sdk": "2.0.0",
|
|
@@ -50,8 +51,16 @@
|
|
|
50
51
|
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
|
|
51
52
|
"@deepseek-ai/dsh-client-store": "0.2.0-rc.2",
|
|
52
53
|
"@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
|
|
54
|
+
"@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
|
|
53
55
|
"@deepseek-ai/dsh-llm": "0.2.0-rc.2",
|
|
56
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2",
|
|
54
57
|
"@deepseek-ai/dsh-session": "0.2.0-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.0-rc.2",
|
|
59
|
+
"@deepseek-ai/dsh-session-projection": "0.2.0-rc.2",
|
|
60
|
+
"@deepseek-ai/dsh-storage-domain": "0.2.0-rc.2",
|
|
61
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
|
|
62
|
+
"@deepseek-ai/dsh-token-meter": "0.2.0-rc.2",
|
|
63
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.2",
|
|
55
64
|
"@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
|
|
56
65
|
"@deepseek-ai/dsh-typert-registry": "0.2.0-rc.2",
|
|
57
66
|
"@deepseek-ai/dsh-user-approval": "0.2.0-rc.2",
|
|
@@ -62,23 +71,21 @@
|
|
|
62
71
|
"react": "18.3.1",
|
|
63
72
|
"react-dom": "18.3.1",
|
|
64
73
|
"typescript": "5.9.3",
|
|
65
|
-
"zustand": "4.4.7"
|
|
66
|
-
"@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2",
|
|
67
|
-
"@deepseek-ai/dsh-storage-domain": "0.2.0-rc.2"
|
|
74
|
+
"zustand": "4.4.7"
|
|
68
75
|
},
|
|
69
76
|
"peerDependencies": {
|
|
70
77
|
"@ai-workbench/connect": "~0.7.37",
|
|
71
78
|
"@ai-workbench/network": "~0.4.9",
|
|
72
|
-
"@deepseek-ai/cordis": "4.0.4",
|
|
73
|
-
"@deepseek-ai/dsh-agent": "0.2.0-rc.2",
|
|
74
|
-
"@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
|
|
75
|
-
"@deepseek-ai/dsh-llm": "0.2.0-rc.2",
|
|
76
|
-
"@deepseek-ai/dsh-
|
|
77
|
-
"@deepseek-ai/dsh-
|
|
78
|
-
"@deepseek-ai/dsh-
|
|
79
|
-
"@deepseek-ai/
|
|
80
|
-
"@deepseek-ai/dsh-
|
|
81
|
-
"@deepseek-ai/
|
|
79
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
80
|
+
"@deepseek-ai/dsh-agent": ">=0.2.0-rc.2 <0.3.0-0",
|
|
81
|
+
"@deepseek-ai/dsh-attachment": ">=0.2.0-rc.2 <0.3.0-0",
|
|
82
|
+
"@deepseek-ai/dsh-llm": ">=0.2.0-rc.2 <0.3.0-0",
|
|
83
|
+
"@deepseek-ai/dsh-sandbox-policy": ">=0.2.0-rc.2 <0.3.0-0",
|
|
84
|
+
"@deepseek-ai/dsh-session": ">=0.2.0-rc.2 <0.3.0-0",
|
|
85
|
+
"@deepseek-ai/dsh-storage-domain": ">=0.2.0-rc.2 <0.3.0-0",
|
|
86
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.2.0-rc.2 <0.3.0-0",
|
|
87
|
+
"@deepseek-ai/dsh-user-approval": ">=0.2.0-rc.2 <0.3.0-0",
|
|
88
|
+
"@deepseek-ai/schemastery": "^3.18.4"
|
|
82
89
|
},
|
|
83
90
|
"dsh": {
|
|
84
91
|
"bundle": {
|
|
@@ -106,7 +113,7 @@
|
|
|
106
113
|
"publishConfig": {
|
|
107
114
|
"access": "public",
|
|
108
115
|
"registry": "https://registry.npmjs.org/",
|
|
109
|
-
"tag": "toolbridge"
|
|
116
|
+
"tag": "host-toolbridge"
|
|
110
117
|
},
|
|
111
118
|
"keywords": [
|
|
112
119
|
"dsh",
|