@ai-workbench/remote-agent 0.9.0-toolbridge.2 → 0.9.0-toolbridge.21

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.
Files changed (46) hide show
  1. package/README.md +23 -8
  2. package/dist/acp.d.ts +23 -1
  3. package/dist/acp.js +127 -17
  4. package/dist/broker-runtime.d.ts +2 -0
  5. package/dist/broker-runtime.js +52 -3
  6. package/dist/broker.d.ts +56 -1
  7. package/dist/broker.js +300 -10
  8. package/dist/claude-local.js +26 -5
  9. package/dist/client.js +1 -1
  10. package/dist/close-diagnostics.d.ts +1 -1
  11. package/dist/close-diagnostics.js +1 -1
  12. package/dist/cold-protocol.d.ts +17 -0
  13. package/dist/cold-protocol.js +358 -0
  14. package/dist/cold-recovery.d.ts +63 -0
  15. package/dist/cold-recovery.js +598 -0
  16. package/dist/cold-store.d.ts +100 -0
  17. package/dist/cold-store.js +29 -0
  18. package/dist/employee-endpoint.js +15 -1
  19. package/dist/employee-mcp.js +1 -1
  20. package/dist/employee-provider.js +26 -6
  21. package/dist/employee-relay.js +148 -1
  22. package/dist/employee-shell.d.ts +2 -0
  23. package/dist/employee-shell.js +22 -19
  24. package/dist/employee-tools.js +2 -2
  25. package/dist/employee-workspace.d.ts +20 -4
  26. package/dist/employee-workspace.js +26 -5
  27. package/dist/index.d.ts +12 -3
  28. package/dist/index.js +205 -40
  29. package/dist/input.js +4 -1
  30. package/dist/live-steering.d.ts +46 -0
  31. package/dist/live-steering.js +45 -0
  32. package/dist/model-catalog.d.ts +2 -0
  33. package/dist/model-catalog.js +5 -1
  34. package/dist/preflight-diagnostic.js +1 -1
  35. package/dist/presentation.js +1 -0
  36. package/dist/provider.d.ts +13 -0
  37. package/dist/rpc-namespace.js +16 -2
  38. package/dist/session-source.d.ts +3 -1
  39. package/dist/session-source.js +2 -1
  40. package/dist/toolbridge-loop.d.ts +3 -2
  41. package/dist/toolbridge-loop.js +4 -2
  42. package/dist/toolbridge-table.d.ts +4 -3
  43. package/dist/toolbridge-table.js +15 -5
  44. package/dist/toolbridge.d.ts +1 -1
  45. package/dist/toolbridge.js +4 -4
  46. package/package.json +23 -16
@@ -0,0 +1,46 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { UserMessage } from '@deepseek-ai/dsh-llm';
3
+ import { z } from 'zod';
4
+ declare const receiptSchema: z.ZodObject<{
5
+ sessionId: z.ZodString;
6
+ provider: z.ZodString;
7
+ messageId: z.ZodString;
8
+ nativeSessionId: z.ZodString;
9
+ turnId: z.ZodString;
10
+ messageSha256: z.ZodString;
11
+ outcome: z.ZodEnum<{
12
+ unknown: "unknown";
13
+ injected: "injected";
14
+ prepared: "prepared";
15
+ deferred: "deferred";
16
+ }>;
17
+ }, z.core.$strict>;
18
+ export type SteeringReceipt = z.infer<typeof receiptSchema>;
19
+ export declare const steeringMessageDigest: (message: UserMessage) => string;
20
+ export interface SteeringReceipts {
21
+ read(sessionId: string, provider: string, ids: readonly string[]): Promise<ReadonlyMap<string, SteeringReceipt>>;
22
+ put(receipt: SteeringReceipt): Promise<void>;
23
+ }
24
+ export declare const liveSteeringSpec: {
25
+ name: string;
26
+ version: number;
27
+ tables: {
28
+ receipts: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
29
+ sessionId: string;
30
+ provider: string;
31
+ messageId: string;
32
+ nativeSessionId: string;
33
+ turnId: string;
34
+ messageSha256: string;
35
+ outcome: "unknown" | "injected" | "prepared" | "deferred";
36
+ }>;
37
+ };
38
+ };
39
+ export declare function createSteeringReceipts(ctx: Context): SteeringReceipts;
40
+ export interface LiveSteeringTarget {
41
+ canSteer(provider: string, sessionId: string): boolean;
42
+ steer(provider: string, sessionId: string, message: UserMessage, isCurrent?: () => boolean): Promise<unknown>;
43
+ }
44
+ /** Observe the public inbox; the official driver still claims and records every input. */
45
+ export declare function installLiveSteering(ctx: Context, target: LiveSteeringTarget): void;
46
+ export {};
@@ -0,0 +1,45 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { defineDomain, domainTable } from '@deepseek-ai/dsh-storage-domain';
3
+ import { z } from 'zod';
4
+ import { NeedError } from "./remote.js";
5
+ const receiptSchema = z.object({ sessionId: z.string().min(1), provider: z.string().min(1), messageId: z.string().min(1), nativeSessionId: z.string().min(1), turnId: z.string().min(1), messageSha256: z.string().regex(/^[a-f0-9]{64}$/), outcome: z.enum(['prepared', 'injected', 'deferred', 'unknown']) }).strict();
6
+ export const steeringMessageDigest = (message) => createHash('sha256').update(JSON.stringify({ source: message.source, content: message.content })).digest('hex');
7
+ export const liveSteeringSpec = defineDomain({ name: 'ai_workbench_live_steering', version: 1, tables: { receipts: domainTable(receiptSchema) } });
8
+ const key = (sessionId, provider, messageId) => JSON.stringify([sessionId, provider, messageId]);
9
+ const storageFailure = () => new NeedError('INPUT_DELIVERY_UNCONFIRMED', '中途消息的送达登记未能确认;没有自动重复发送,请核对原轮状态。', '官方storageDomain中途消息回执');
10
+ export function createSteeringReceipts(ctx) {
11
+ let domain;
12
+ const open = () => { if (!domain) {
13
+ const facility = ctx.get('storageDomain');
14
+ if (!facility)
15
+ throw storageFailure();
16
+ domain = facility.open(liveSteeringSpec).catch(error => { domain = undefined; throw error; });
17
+ } return domain; };
18
+ ctx.effect(() => async () => { if (domain)
19
+ await (await domain).close(); });
20
+ return {
21
+ async read(sessionId, provider, ids) { try {
22
+ const table = (await open()).table('receipts');
23
+ return new Map(ids.flatMap(id => { const row = table.get(key(sessionId, provider, id)); return row ? [[id, receiptSchema.parse(row)]] : []; }));
24
+ }
25
+ catch (error) {
26
+ throw Object.assign(storageFailure(), { cause: error });
27
+ } },
28
+ async put(receipt) { try {
29
+ await (await open()).table('receipts').put(key(receipt.sessionId, receipt.provider, receipt.messageId), receiptSchema.parse(receipt));
30
+ }
31
+ catch (error) {
32
+ throw Object.assign(storageFailure(), { cause: error });
33
+ } },
34
+ };
35
+ }
36
+ /** Observe the public inbox; the official driver still claims and records every input. */
37
+ export function installLiveSteering(ctx, target) {
38
+ ctx.on('agent/inbox/inserted', ({ agent, message }) => {
39
+ const provider = agent.options.provider, id = agent.session.id;
40
+ if (typeof provider !== 'string' || message.source.kind !== 'user' || !agent.inbox.nextStep.some(item => item.id === message.id) || !target.canSteer(provider, id))
41
+ return;
42
+ const digest = steeringMessageDigest(message);
43
+ void target.steer(provider, id, message, () => agent.options.provider === provider && agent.inbox.nextStep.some(item => item.id === message.id && steeringMessageDigest(item) === digest)).catch(() => ctx.logger('remote-agent').warn('INPUT_DELIVERY_UNCONFIRMED:中途消息回执未确认,没有自动重复发送'));
44
+ });
45
+ }
@@ -17,6 +17,8 @@ export interface HostModel {
17
17
  defaultKnown: boolean;
18
18
  };
19
19
  source: unknown;
20
+ /** Host-sourced token capacity. Absent means unknown: X declares nothing and DSH reports it. */
21
+ contextWindow?: number;
20
22
  }
21
23
  export interface CatalogLease {
22
24
  readonly target: ModelCatalogTarget;
@@ -61,6 +61,10 @@ export function parseHostCatalog(input, provider, username) {
61
61
  reject('具体型号与发送模型值不一致');
62
62
  continue;
63
63
  }
64
+ if (model.contextWindow !== undefined && (!Number.isSafeInteger(model.contextWindow) || model.contextWindow < 1)) {
65
+ reject('上下文窗口不是正整数', 'MODEL_CONTEXT_WINDOW_INVALID');
66
+ continue;
67
+ }
64
68
  const r = model.reasoning;
65
69
  if (!Array.isArray(r.options) || typeof r.defaultKnown !== 'boolean' || (r.defaultValue !== null && !text(r.defaultValue)) || (!r.defaultKnown && r.defaultValue !== null)) {
66
70
  reject('推理档位或默认档位资料无效', 'MODEL_REASONING_INVALID');
@@ -161,5 +165,5 @@ export class ModelCatalog {
161
165
  }
162
166
  export function modelInfo(provider, model) {
163
167
  // Official rc.2 represents no reasoning levels by absence, and rejects an empty efforts array.
164
- return { provider, id: model.id, name: model.name, inputModalities: ['text', 'image'], ...(model.reasoning.options.length ? { reasoning: { efforts: model.reasoning.options.map(option => ({ id: ReasoningEffortId(option.value), name: option.name })), ...(model.reasoning.defaultKnown && model.reasoning.defaultValue !== null ? { defaultEffort: ReasoningEffortId(model.reasoning.defaultValue) } : {}) } } : {}), catalog: model };
168
+ return { provider, id: model.id, name: model.name, inputModalities: ['text', 'image'], ...(model.contextWindow === undefined ? {} : { context: { contextWindow: model.contextWindow } }), ...(model.reasoning.options.length ? { reasoning: { efforts: model.reasoning.options.map(option => ({ id: ReasoningEffortId(option.value), name: option.name })), ...(model.reasoning.defaultKnown && model.reasoning.defaultValue !== null ? { defaultEffort: ReasoningEffortId(model.reasoning.defaultValue) } : {}) } } : {}), catalog: model };
165
169
  }
@@ -37,7 +37,7 @@ export function createPreflightDiagnostics(options) {
37
37
  if (sessionId && session) {
38
38
  let workspace;
39
39
  try {
40
- workspace = officialEmployeeWorkspace(sessionId, options.ctx.get('workspaceRegistry'), session.header);
40
+ workspace = officialEmployeeWorkspace(sessionId, options.ctx.get('workspaceRegistry'), options.ctx.get('sessions'));
41
41
  }
42
42
  catch (error) {
43
43
  if (!(error instanceof NeedError && error.code === 'EMPLOYEE_WORKSPACE_UNAVAILABLE'))
@@ -54,6 +54,7 @@ export function employeeFailure(code, brand = 'codex', promptDispatched = true)
54
54
  PROMPT_CONTENT_UNSUPPORTED: '远端没有声明这类输入能力,本轮未发送;请使用受支持的内容或联系管理员。',
55
55
  ATTACHMENT_REQUIRED: '我需要官方附件组件读取这张图片,请联系管理员检查组件。',
56
56
  ATTACHMENT_INVALID: '图片附件没有返回匹配的已核验内容,本轮未发送;请重新添加图片或联系管理员。',
57
+ PURPOSE_UNSUPPORTED: '这段对话太长,需要先整理上下文,但远程模型不支持整理;这句话未发送,需要重新输入。请新建会话继续,或换回原来的模型',
57
58
  ACP_MESSAGE_TOO_LARGE: '本轮输入超过会话消息容量,未截断或发送;请联系管理员调整acpMaxMessageBytes。',
58
59
  };
59
60
  if (messages[code])
@@ -1,3 +1,4 @@
1
+ import type { ColdRound, ColdStore } from './cold-store.ts';
1
2
  import type { ToolBridge } from './toolbridge.ts';
2
3
  import { type SessionSource } from './host-workspace.ts';
3
4
  import type { CloseCause, CloseDiagnostics } from './close-diagnostics.ts';
@@ -27,6 +28,18 @@ export interface EmployeeExecution {
27
28
  validate(signal?: AbortSignal): Promise<void>;
28
29
  }
29
30
  export interface Runtime {
31
+ localDirectory?: {
32
+ path: string;
33
+ device: number;
34
+ inode: number;
35
+ };
36
+ cold?: {
37
+ id: string;
38
+ store: ColdStore;
39
+ bound: Promise<number>;
40
+ failBinding: (error: unknown) => void;
41
+ prepare: (nativeId: string | undefined, meta: NonNullable<ColdRound['meta']>) => Promise<void>;
42
+ };
30
43
  identity: string;
31
44
  cwd: string;
32
45
  hostWorkspace?: Readonly<HostWorkspacePresentation>;
@@ -4,7 +4,8 @@ import { NeedError } from "./remote.js";
4
4
  export function isolateRpcIds(stream, onWrite) {
5
5
  const prefix = randomUUID() + '/';
6
6
  const pending = new Map();
7
- const readable = stream.readable.pipeThrough(new TransformStream({ transform(message, controller) {
7
+ let incoming;
8
+ const readable = stream.readable.pipeThrough(new TransformStream({ start(controller) { incoming = controller; }, transform(message, controller) {
8
9
  const raw = message;
9
10
  if (!raw.method && Object.hasOwn(raw, 'id')) {
10
11
  if (typeof raw.id !== 'string' || !pending.has(raw.id))
@@ -28,9 +29,22 @@ export function isolateRpcIds(stream, onWrite) {
28
29
  const params = raw.params;
29
30
  outgoing = { ...raw, params: { ...params, requestId: prefix + JSON.stringify(params.requestId) } };
30
31
  }
31
- const writer = stream.writable.getWriter();
32
+ // A known pre-dispatch steering rejection belongs to one request. Throwing
33
+ // from WritableStream.write would permanently poison the shared SDK channel.
34
+ // Deliver an explicit local RPC error on the public Stream instead. No native
35
+ // write or dispatch count occurs, and the namespaced pending entry is removed.
32
36
  try {
33
37
  onWrite?.(outgoing);
38
+ }
39
+ catch (error) {
40
+ if (raw.method !== '_session/steering' || !Object.hasOwn(raw, 'id') || !(error instanceof NeedError) || !['ACP_MESSAGE_TOO_LARGE', 'PERMISSION_POLICY_CHANGED'].includes(error.code))
41
+ throw error;
42
+ pending.delete(String(outgoing.id));
43
+ incoming.enqueue({ jsonrpc: '2.0', id: raw.id, error: { code: -32603, message: 'ACP_LOCAL_REQUEST_REJECTED', data: { localDispatchCode: error.code } } });
44
+ return;
45
+ }
46
+ const writer = stream.writable.getWriter();
47
+ try {
34
48
  await writer.write(outgoing);
35
49
  }
36
50
  finally {
@@ -15,4 +15,6 @@ export declare const sessionSourceSpec: {
15
15
  };
16
16
  };
17
17
  /** Official domain metadata, keyed by native session ID. No L files, local path probes or host identity hashes. */
18
- export declare function createSessionSources(ctx: Context, getApi: () => ConnectApi | undefined): (request: RuntimeRequest, api: ConnectApi) => Promise<SessionSource | undefined>;
18
+ export declare function createSessionSources(ctx: Context, getApi: () => ConnectApi | undefined): ((request: RuntimeRequest, api: ConnectApi) => Promise<SessionSource | undefined>) & {
19
+ read: (sessionId: string) => Promise<SessionSource | undefined>;
20
+ };
@@ -79,7 +79,7 @@ export function createSessionSources(ctx, getApi) {
79
79
  return;
80
80
  void save(session, api).catch(() => ctx.logger('remote-agent').warn('会话文件来源暂未保存;发送时将重试'));
81
81
  });
82
- return async (request, api) => {
82
+ const resolve = async (request, api) => {
83
83
  if (!request.sessionId || api.getContractInfo?.().workspaceLocations !== 1 && !request.hostSource)
84
84
  return;
85
85
  const session = ctx.get('sessions')?.get(SessionId(request.sessionId));
@@ -87,4 +87,5 @@ export function createSessionSources(ctx, getApi) {
87
87
  throw storageNeed();
88
88
  return save(session, api, request);
89
89
  };
90
+ return Object.assign(resolve, { read: async (sessionId) => { const source = (await open()).table('sessions').get(sessionId); return source ? Object.freeze({ ...source }) : undefined; } });
90
91
  }
@@ -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;
@@ -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", "job_output", "job_list", "job_kill", "load_workspace_dependencies", "terminal_open", "terminal_send", "terminal_read", "terminal_signal", "terminal_close", "terminal_list", "subagent", "list_subagent_models", "send_message", "interrupt_agent", "spawn_teammate", "list_agents", "wait_agent", "team_task_create", "team_task_list", "team_task_get", "team_task_update", "run_code"];
4
+ export declare const TOOLBRIDGE_EXCLUDED: readonly ["read", "write", "edit", "read_image", "glob", "grep", "bash", "pwsh", "str_replace_editor", "load_workspace_dependencies", "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 bridgeTable(tools?: readonly ToolSchema[]): ReadonlyMap<string, BridgeTool>;
10
+ export declare function dshSkillCatalog(messages?: GenerateOptions['messages']): readonly string[] | undefined;
11
+ export declare function bridgeTable(tools?: readonly ToolSchema[], catalog?: readonly string[]): ReadonlyMap<string, BridgeTool>;
@@ -3,13 +3,22 @@ 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',
6
+ 'load_workspace_dependencies',
7
7
  'terminal_open', 'terminal_send', 'terminal_read', 'terminal_signal', 'terminal_close', 'terminal_list',
8
- 'subagent', 'list_subagent_models', 'send_message', 'interrupt_agent', 'spawn_teammate', 'list_agents', 'wait_agent',
9
- 'team_task_create', 'team_task_list', 'team_task_get', 'team_task_update', 'run_code',
8
+ 'run_code',
10
9
  ]);
11
10
  const excluded = new Set(TOOLBRIDGE_EXCLUDED);
12
- export function bridgeTable(tools = []) {
11
+ export function dshSkillCatalog(messages = []) {
12
+ for (const message of messages.toReversed()) {
13
+ const source = message.source;
14
+ if (message.role !== 'user' || source?.kind !== 'skill-catalog' || source.form !== 'catalog' || !Array.isArray(source.entries))
15
+ continue;
16
+ if (!source.entries.every(entry => entry && typeof entry.name === 'string' && typeof entry.description === 'string'))
17
+ continue;
18
+ return source.entries.map(entry => entry.name);
19
+ }
20
+ }
21
+ export function bridgeTable(tools = [], catalog) {
13
22
  const table = new Map(), names = new Set();
14
23
  for (const tool of tools) {
15
24
  if (excluded.has(tool.name))
@@ -21,7 +30,8 @@ export function bridgeTable(tools = []) {
21
30
  if (table.has(alias))
22
31
  throw new NeedError('TOOLBRIDGE_NAME_COLLISION', '工具桥名称冲突,未执行。', '唯一工具桥名称');
23
32
  const schema = structuredClone(tool);
24
- table.set(alias, { alias, schema, wire: { name: alias, description: 'DSH工具 ' + schema.name + ':' + schema.description, inputSchema: structuredClone(schema.parameters) } });
33
+ const skill = schema.name === 'skill' ? ' 这是DSH技能加载器,名字取自DSH的<available_skills>目录;主机Claude/Codex的原生技能按各自原生技能指令加载。' + (catalog === undefined ? '请以当前DSH技能目录为准。' : '本次DSH公布的目录快照:' + JSON.stringify(catalog) + ';实际可用性由DSH调用时确认。') + '技能资源按返回的<skill_resources>基址读取。' : '';
34
+ table.set(alias, { alias, schema, wire: { name: alias, description: 'DSH工具 ' + schema.name + ':' + schema.description + skill, inputSchema: structuredClone(schema.parameters) } });
25
35
  }
26
36
  return table;
27
37
  }
@@ -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;
@@ -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 = '含工具桥:本机文件夹的扩展工具由DSH执行并按当前权限审批;文件和命令保持原执行方式。工具表在新一轮主机连接时更新。';
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,7 @@ export class ToolBridge {
16
16
  readImage;
17
17
  controller = new AbortController();
18
18
  snapshot;
19
- get table() { return this.snapshot ??= bridgeTable(this.options.tools); }
19
+ get table() { return this.snapshot ??= bridgeTable(this.options.tools, dshSkillCatalog(this.options.messages)); }
20
20
  calls = new Map();
21
21
  enabled = false;
22
22
  ended = false;
@@ -41,7 +41,7 @@ export class ToolBridge {
41
41
  this.readImage = readImage;
42
42
  }
43
43
  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-subagent-team-run_code' } }); }
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-terminal-run_code' } }); }
45
45
  get tools() { return [...this.table.values()].map(t => t.wire); }
46
46
  isBridge(name) { return typeof name === 'string' && this.table.has(name.replace(/^mcp__employee__/, '')); }
47
47
  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.2",
3
+ "version": "0.9.0-toolbridge.21",
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-session": "0.2.0-rc.2",
77
- "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
78
- "@deepseek-ai/dsh-user-approval": "0.2.0-rc.2",
79
- "@deepseek-ai/schemastery": "3.18.4",
80
- "@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2",
81
- "@deepseek-ai/dsh-storage-domain": "0.2.0-rc.2"
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",