@ai-workbench/remote-agent 0.9.0-toolbridge.8 → 0.9.0-toolbridge.9

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 CHANGED
@@ -1,8 +1,8 @@
1
- # AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.8 · 插件 → 添加插件
1
+ # AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.9 · 插件 → 添加插件
2
2
 
3
3
  ## 含工具桥预发布线
4
4
 
5
- 本包为 `0.9.0-toolbridge.8`,在独立 `toolbridge` 分支开发;稳定 main/0.8.x 和原总包保持原样。员工安装由连接组件提供的「AI 写作工作台(含工具桥)」总包,与不含工具桥的版本二选一。预发布渠道为 `toolbridge`,本轮仅提供本地固定包,不发布 npm。
5
+ 本包为 `0.9.0-toolbridge.9`,在独立 `toolbridge` 分支开发;稳定 main/0.8.x 和原总包保持原样。员工安装由连接组件提供的「AI 写作工作台(含工具桥)」总包,与不含工具桥的版本二选一。预发布渠道为 `toolbridge`,本轮仅提供本地固定包,不发布 npm。
6
6
 
7
7
  选择本机文件夹后,Claude 和 Codex 可以把 DSH 已启用的 MCP、web、skill、ask_user、todo/present/goal 等工具交给 DSH 原生执行和审批。内置文件/命令、子代理/agent-team、run_code 不在桥接表;原有文件和命令执行方式保留。plan 不自动放行桥接权限;default 下 Claude 的桥接原生权限由插件单次应答,员工只在 DSH 审批实际工具。主机文件夹不开放工具桥。
8
8
 
package/dist/acp.js CHANGED
@@ -514,7 +514,7 @@ export class AcpSession {
514
514
  signal?.addEventListener('abort', abort, { once: true });
515
515
  try {
516
516
  const hello = await this.stage('acp-initialize', () => this.connection.agent.request(acp.methods.agent.initialize, {
517
- protocolVersion: acp.PROTOCOL_VERSION, clientInfo: { name: '@ai-workbench/remote-agent', version: '0.9.0-toolbridge.8' },
517
+ protocolVersion: acp.PROTOCOL_VERSION, clientInfo: { name: '@ai-workbench/remote-agent', version: '0.9.0-toolbridge.9' },
518
518
  clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false, session: { notices: {} }, ...(this.employeeMeta ? { _meta: { awEmployeeExecution: { version: 1, closeReason: 1, ...(context?.toolBridgeServers ? { mcpBridge: 1 } : {}) } } } : {}) },
519
519
  }, { cancellationSignal: signal }));
520
520
  if (hello.protocolVersion !== acp.PROTOCOL_VERSION)
package/dist/index.js CHANGED
@@ -209,6 +209,9 @@ export class CodexRemoteAdapter extends LlmAdapter {
209
209
  throw failure.reason;
210
210
  }
211
211
  async *stream(options) {
212
+ // Before the tool bridge: a parked turn must not take a background request for its own continuation.
213
+ if (options.purpose)
214
+ throw new LlmError(employeeFailure('PURPOSE_UNSUPPORTED', this.agent.loginProvider, false), 'PURPOSE_UNSUPPORTED');
212
215
  let promptDispatched = !!options.sessionId && (this.sessions.get(options.sessionId)?.session.promptDispatchCount ?? 0) > 0;
213
216
  try {
214
217
  for await (const chunk of this.bridgeLoop.stream(options, (o, b) => this.generate(o, () => { promptDispatched = true; }, b))) {
@@ -247,8 +250,6 @@ export class CodexRemoteAdapter extends LlmAdapter {
247
250
  }
248
251
  }
249
252
  async *generate(original, onPromptDispatched, bridge) {
250
- if (original.purpose)
251
- throw new NeedError('PURPOSE_UNSUPPORTED', '此远程模型不处理后台标题或上下文整理请求,未发送模型请求', '独立的后台请求能力');
252
253
  if (this.lifetime.signal.aborted)
253
254
  throw new NeedError('DISPOSED', '远程模型插件已关闭', '启用远程模型插件');
254
255
  const key = original.sessionId;
@@ -642,7 +643,7 @@ export class RemoteAgentsAdapter extends LlmAdapter {
642
643
  async prepareCall(provider, model, signal) { const prepared = await this.adapter(provider).prepareCall(provider, model, signal); return { ...prepared, stream: (options) => this.stream(options) }; }
643
644
  providerRetryPolicy() { return { mode: 'normal', maxRetries: 0, retryableCodes: [], initialDelayMs: 0, maxDelayMs: 0, jitterRatio: 0 }; }
644
645
  stream(options) {
645
- if (options.sessionId)
646
+ if (options.sessionId && !options.purpose)
646
647
  for (const [provider, adapter] of this.adapters)
647
648
  if (provider !== options.provider && adapter.hasBridgeSession(options.sessionId)) {
648
649
  void adapter.disposeSession(options.sessionId);
@@ -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
  }
@@ -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])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-workbench/remote-agent",
3
- "version": "0.9.0-toolbridge.8",
3
+ "version": "0.9.0-toolbridge.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -51,8 +51,10 @@
51
51
  "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
52
52
  "@deepseek-ai/dsh-client-store": "0.2.0-rc.2",
53
53
  "@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.2",
54
+ "@deepseek-ai/dsh-compaction-basic": "0.2.0-rc.2",
54
55
  "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
55
56
  "@deepseek-ai/dsh-session": "0.2.0-rc.2",
57
+ "@deepseek-ai/dsh-token-meter": "0.2.0-rc.2",
56
58
  "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2",
57
59
  "@deepseek-ai/dsh-typert-registry": "0.2.0-rc.2",
58
60
  "@deepseek-ai/dsh-user-approval": "0.2.0-rc.2",