@ai-workbench/remote-agent 0.8.31 → 0.9.0-toolbridge.11
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 +13 -3
- package/dist/acp.d.ts +7 -0
- package/dist/acp.js +40 -4
- package/dist/agents.js +1 -1
- package/dist/claude-local.js +2 -1
- package/dist/client.js +1 -1
- package/dist/employee-mcp.d.ts +2 -0
- package/dist/employee-mcp.js +3 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.js +112 -19
- package/dist/provider.d.ts +2 -0
- package/dist/toolbridge-loop.d.ts +19 -0
- package/dist/toolbridge-loop.js +251 -0
- package/dist/toolbridge-table.d.ts +10 -0
- package/dist/toolbridge-table.js +27 -0
- package/dist/toolbridge.d.ts +114 -0
- package/dist/toolbridge.js +205 -0
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.
|
|
1
|
+
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.11 · 插件 → 添加插件
|
|
2
|
+
|
|
3
|
+
## 含工具桥预发布线
|
|
4
|
+
|
|
5
|
+
本包为 `0.9.0-toolbridge.11`,从 `v0.9.0-toolbridge.9` 派生,使用 `host-toolbridge` 发布渠道。员工安装由连接组件提供的「AI 写作工作台(含工具桥)」总包 `@ai-workbench/workbench-toolbridge@0.1.8`,与不含工具桥的版本二选一。
|
|
6
|
+
|
|
7
|
+
选择本机文件夹后,Claude 和 Codex 可以把 DSH 已启用的 MCP、web、skill、ask_user、todo/present/goal 等工具交给 DSH 原生执行和审批。内置文件/命令、子代理/agent-team、run_code 不在桥接表;原有文件和命令执行方式保留。plan 不自动放行桥接权限;default 下 Claude 的桥接原生权限由插件单次应答,员工只在 DSH 审批实际工具。主机文件夹不开放工具桥。
|
|
8
|
+
|
|
9
|
+
工具表按每次主机连接生成快照,新增/移除在下一次连接生效;不承诺 Codex 当前 MCP 会话热刷新。审批期间的插话等当前主机 prompt 结束后再发,停泊中切换助手会停止原轮次并明确提示。工具主动结束DSH轮次时,已提交结果仍交回原agent;确认原生工具收到后结束原prompt,下一条沿原线程继续,不在已关闭步骤追加模型回复。取消和主机结束等待后的结果不重放;工具已执行的副作用不能因取消而撤销,请按说明核对。图片结果由官方附件组件读取后交回。
|
|
10
|
+
|
|
11
|
+
Codex 需要 S 后续安装的独立受保护命令 `/usr/local/aw-host/bin/codex-acp-toolbridge`(aw.8),不会替换原 codex-acp/aw.6;Claude命令不变。指定桥接 server 的等待为 owner 确认的 **1800 秒**、审批交 DSH;不改其他server的调用时限,不新增插件设置项。含桥的本机Codex会话按原生规则等各扩展现有启动时限结算后再捕获工具;启动失败会明确说明,文件和命令仍按原方式执行,本轮不自动重试。N0.4.9、L0.7.37沿既有公开合同;真实界面/员工验收由编排安排。完整合同和本轮启动修复证据见 `docs/contracts/codex-toolbridge.md`、`docs/evidence/2026-10-27-toolbridge-startup/REPORT.md`。
|
|
2
12
|
|
|
3
13
|
通过官方 DSH 插件入口使用 Claude(远程主机)与 Codex(远程主机)。登录和工作区来源由“远程主机连接”组件提供;员工在原生工作区和模型菜单中选择文件夹与型号。
|
|
4
14
|
|
|
5
15
|
文件和命令在所选的本机或主机目录执行,订阅凭据留在主机。插件不改写 DSH 的默认模型,不为员工创建同名主机目录,已有主机会话只提取一次原有主机来源并保存。
|
|
6
16
|
|
|
7
|
-
需要远程主机连接组件 0.7.
|
|
17
|
+
需要远程主机连接组件 0.7.37 或更新的 0.7.x、联网助手 0.4.9,以及支持公开会话归属接口的主机组件 S0.4.26。主机来源保存于官方 storage.domain 的会话元数据表,每轮仅由连接组件检查一次主机目录,不检查本机占位目录。
|
|
8
18
|
|
|
9
19
|
Claude 本机 Bash 会单独消费员工桥代理的控制诊断,不把它交给模型当作命令输出;真实传输中断仍提示结果未知。命令自身的标准输出、标准错误与退出码照常返回。
|
|
10
20
|
|
|
@@ -37,7 +47,7 @@ Codex 员工端只使用随包提供的原生组件,通道等待本次组件
|
|
|
37
47
|
|
|
38
48
|
| 参数 | 默认值 | 作用 |
|
|
39
49
|
| --- | ---: | --- |
|
|
40
|
-
| acpMaxMessageBytes |
|
|
50
|
+
| acpMaxMessageBytes | 32000000 | 会话消息容量;默认32 MB(十进制),低于主机完整ACP行32 MiB上限以留出协议外壳余量 |
|
|
41
51
|
| brokerMaxFrameBytes | 2097152 | 主机回传单段容量 |
|
|
42
52
|
| brokerControlMaxBytes | 1048576 | 主机会话管理回复容量 |
|
|
43
53
|
| employeeShellKillGraceMs | 1000 | 本机命令连接取消后的清理宽限毫秒 |
|
package/dist/acp.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface EmployeeExecutionMeta {
|
|
|
37
37
|
acpMaxMessageBytes: number;
|
|
38
38
|
}
|
|
39
39
|
export interface AcpStartContext {
|
|
40
|
+
toolBridgeServers?: EmployeeRouting['mcpServers'];
|
|
40
41
|
systemPrompt?: string;
|
|
41
42
|
codexNewSessionOnly?: true;
|
|
42
43
|
employeeExecution?: EmployeeExecutionMeta;
|
|
@@ -95,6 +96,12 @@ export declare class AcpSession {
|
|
|
95
96
|
private detail;
|
|
96
97
|
private employeeNoticeNames;
|
|
97
98
|
private employeeNoticeUnshown;
|
|
99
|
+
private employeeBridge;
|
|
100
|
+
private pendingBridgeStartupFailures;
|
|
101
|
+
private bridgeStartupFailed;
|
|
102
|
+
private bridgeStartupNoticeDelivered;
|
|
103
|
+
private confirmBridgeStartupFailure;
|
|
104
|
+
private flushBridgeStartupNotice;
|
|
98
105
|
private employeeInfo;
|
|
99
106
|
private need;
|
|
100
107
|
constructor(transport: acp.Stream | acp.AgentApp | stable.AgentApp, hooks: AcpHooks);
|
package/dist/acp.js
CHANGED
|
@@ -226,7 +226,31 @@ export class AcpSession {
|
|
|
226
226
|
}
|
|
227
227
|
employeeNoticeNames = new Set();
|
|
228
228
|
employeeNoticeUnshown = false;
|
|
229
|
+
employeeBridge = false;
|
|
230
|
+
pendingBridgeStartupFailures = new Set();
|
|
231
|
+
bridgeStartupFailed = false;
|
|
232
|
+
bridgeStartupNoticeDelivered = false;
|
|
233
|
+
confirmBridgeStartupFailure() {
|
|
234
|
+
if (!this.sessionId)
|
|
235
|
+
return;
|
|
236
|
+
const failed = this.pendingBridgeStartupFailures.has(this.sessionId);
|
|
237
|
+
this.pendingBridgeStartupFailures.clear();
|
|
238
|
+
if (failed && !this.bridgeStartupFailed) {
|
|
239
|
+
this.bridgeStartupFailed = true;
|
|
240
|
+
this.detail({ kind: 'extension', severity: 'warning', code: 'TOOLBRIDGE_STARTUP_FAILED', summary: '本轮DSH扩展工具桥启动失败;文件和命令继续使用原生路径,没有自动重试。', method: 'session/update', payload: { server: 'employee', status: 'failed', source: 'codex-acp/mcp-startup-report', nativeSessionId: this.sessionId } });
|
|
241
|
+
}
|
|
242
|
+
this.flushBridgeStartupNotice();
|
|
243
|
+
}
|
|
244
|
+
flushBridgeStartupNotice() {
|
|
245
|
+
if (!this.bridgeStartupFailed || this.bridgeStartupNoticeDelivered || !this.busy || this.closeRequested || this.turnSignal?.aborted || !this.hooks.onEmployeeNotice)
|
|
246
|
+
return;
|
|
247
|
+
this.hooks.onEmployeeNotice('本轮DSH里的扩展工具未能连接到Codex,暂时不可用。文件和命令仍按原方式执行;具体原因见技术详情。本轮不会自动重试。');
|
|
248
|
+
this.bridgeStartupNoticeDelivered = true;
|
|
249
|
+
}
|
|
229
250
|
employeeInfo(value) {
|
|
251
|
+
const bridge = record(record(value)?.mcpBridge);
|
|
252
|
+
if (bridge)
|
|
253
|
+
this.detail({ kind: 'session', severity: 'info', code: 'TOOLBRIDGE_HOST_POLICY', summary: '主机回报本轮指定桥接server的等待与审批策略;不改变其他工具。', payload: { toolTimeoutSec: typeof bridge.toolTimeoutSec === 'number' && Number.isFinite(bridge.toolTimeoutSec) ? bridge.toolTimeoutSec : null, approval: bridge.approval === 'approve' ? 'approve' : 'UNKNOWN', source: bridge.source === 'owner-2026-10-26' ? bridge.source : 'UNKNOWN' } });
|
|
230
254
|
const info = employeeExecutionInfo(value);
|
|
231
255
|
if (!info)
|
|
232
256
|
return;
|
|
@@ -260,6 +284,11 @@ export class AcpSession {
|
|
|
260
284
|
this.detail({ kind: 'session', severity: 'warning', code: 'ACP_FOREIGN_SESSION_UPDATE', summary: '收到不属于当前远端会话的通知,未作为正文处理', method: 'session/update', payload: notification });
|
|
261
285
|
return;
|
|
262
286
|
}
|
|
287
|
+
const update = notification.update;
|
|
288
|
+
if (this.employeeBridge && !this.closeRequested && (update.sessionUpdate === 'tool_call' || update.sessionUpdate === 'tool_call_update') && update.status === 'failed' && update.title === 'mcp__employee__startup' && update.toolCallId.startsWith('mcp_startup.employee.') && update.toolCallId.length > 'mcp_startup.employee.'.length) {
|
|
289
|
+
this.pendingBridgeStartupFailures.add(notification.sessionId);
|
|
290
|
+
this.confirmBridgeStartupFailure();
|
|
291
|
+
}
|
|
263
292
|
const meta = record(notification._meta);
|
|
264
293
|
if (notification.update.sessionUpdate === 'current_mode_update') {
|
|
265
294
|
this.nativeModeId = notification.update.currentModeId;
|
|
@@ -479,20 +508,21 @@ export class AcpSession {
|
|
|
479
508
|
throw new NeedError('SESSION_ALREADY_STARTED', '此连接已用于建立会话,不能转用工作区或身份', '新的独立远端连接');
|
|
480
509
|
this.startAttempted = true;
|
|
481
510
|
this.employeeMeta = context?.employeeExecution;
|
|
511
|
+
this.employeeBridge = !!this.employeeMeta && !!context?.toolBridgeServers;
|
|
482
512
|
const abort = () => this.close({ layer: 'acp', initiator: 'acp.start-signal', reason: 'ABORTED', action: 'abort' }, new NeedError('ABORTED', '会话建立已取消', '重新连接主机'));
|
|
483
513
|
signal?.throwIfAborted();
|
|
484
514
|
signal?.addEventListener('abort', abort, { once: true });
|
|
485
515
|
try {
|
|
486
516
|
const hello = await this.stage('acp-initialize', () => this.connection.agent.request(acp.methods.agent.initialize, {
|
|
487
|
-
protocolVersion: acp.PROTOCOL_VERSION, clientInfo: { name: '@ai-workbench/remote-agent', version: '0.
|
|
488
|
-
clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false, session: { notices: {} }, ...(this.employeeMeta ? { _meta: { awEmployeeExecution: { version: 1, closeReason: 1 } } } : {}) },
|
|
517
|
+
protocolVersion: acp.PROTOCOL_VERSION, clientInfo: { name: '@ai-workbench/remote-agent', version: '0.9.0-toolbridge.9' },
|
|
518
|
+
clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false, session: { notices: {} }, ...(this.employeeMeta ? { _meta: { awEmployeeExecution: { version: 1, closeReason: 1, ...(context?.toolBridgeServers ? { mcpBridge: 1 } : {}) } } } : {}) },
|
|
489
519
|
}, { cancellationSignal: signal }));
|
|
490
520
|
if (hello.protocolVersion !== acp.PROTOCOL_VERSION)
|
|
491
521
|
throw new NeedError('ACP_VERSION_MISMATCH', 'ACP 协议版本不兼容', '支持 ACP v1 的远端 agent');
|
|
492
522
|
this.negotiated = hello.agentCapabilities ?? {};
|
|
493
523
|
if (this.employeeMeta) {
|
|
494
524
|
const policy = record(hello._meta?.awEmployeeExecution);
|
|
495
|
-
if (!this.hooks.employeeExecution || !policy || Object.keys(policy).length !== 5 || policy.version !== 1 || policy.nativeCliVersion !== '0.160.1' || policy.native !== true || policy.perRpcGate !== true || policy.noHostFallback !== true)
|
|
525
|
+
if (!this.hooks.employeeExecution || !policy || Object.keys(policy).length !== (context?.toolBridgeServers ? 6 : 5) || context?.toolBridgeServers && policy.mcpBridge !== 1 || policy.version !== 1 || policy.nativeCliVersion !== '0.160.1' || policy.native !== true || policy.perRpcGate !== true || policy.noHostFallback !== true)
|
|
496
526
|
throw new NeedError('EMPLOYEE_EXECUTION_UNSUPPORTED', '当前主机尚不支持在你的电脑执行Codex原生工具,本轮没有执行。', 'Codex员工端原生执行适配器与明确能力声明');
|
|
497
527
|
this.employeeNegotiated = true;
|
|
498
528
|
this.detail({ kind: 'session', severity: 'info', code: 'EMPLOYEE_EXECUTION_SELECTED', summary: '文件和命令在员工电脑的选定目录执行;订阅凭据留在主机,本机扩展的忽略详情单独记录。', payload: { bindingId: this.employeeMeta.bindingId, workspaceId: this.employeeMeta.workspaceId, cwd: this.employeeMeta.cwd, nativeCliVersion: '0.160.1', noHostFallback: true, agentConfigSource: 'host CODEX_HOME', unsupportedLocalFeatures: ['http-mcp-execution', 'hooks', 'plugins', 'cold-resume', 'slash-commands', 'host-file-reports'] } });
|
|
@@ -503,7 +533,7 @@ export class AcpSession {
|
|
|
503
533
|
this.validatePrompt(prompt);
|
|
504
534
|
const routing = context?.employeeRouting ? structuredClone(context.employeeRouting) : undefined;
|
|
505
535
|
this.employeeRouting = routing;
|
|
506
|
-
const params = { cwd, mcpServers: routing ? structuredClone(routing.mcpServers) : [], ...((routing || this.employeeMeta) ? { _meta: { ...(this.employeeMeta ? { awEmployeeExecution: this.employeeMeta } : {}), ...(routing ? { claudeCode: { options: employeeClaudeOptions(routing) } } : {}) } } : {}), ...(systemPrompt && !(resumeId && this.codexNewSessionOnly) ? { systemPrompt: { mode: 'append', content: [{ type: 'text', text: systemPrompt }] } } : {}) };
|
|
536
|
+
const params = { cwd, mcpServers: context?.toolBridgeServers ? structuredClone(context.toolBridgeServers) : routing ? structuredClone(routing.mcpServers) : [], ...((routing || this.employeeMeta) ? { _meta: { ...(this.employeeMeta ? { awEmployeeExecution: this.employeeMeta } : {}), ...(routing ? { claudeCode: { options: employeeClaudeOptions(routing) } } : {}) } } : {}), ...(systemPrompt && !(resumeId && this.codexNewSessionOnly) ? { systemPrompt: { mode: 'append', content: [{ type: 'text', text: systemPrompt }] } } : {}) };
|
|
507
537
|
const configRevision = this.resetConfiguration();
|
|
508
538
|
const restore = async (operation) => {
|
|
509
539
|
try {
|
|
@@ -529,6 +559,8 @@ export class AcpSession {
|
|
|
529
559
|
this.sessionId = resumeId;
|
|
530
560
|
if (this.negotiated.sessionCapabilities?.resume) {
|
|
531
561
|
const result = await restore(() => this.stage('acp-session-resume', () => this.connection.agent.request(acp.methods.agent.session.resume, { ...params, sessionId: resumeId }, { cancellationSignal: signal })));
|
|
562
|
+
if (this.employeeMeta)
|
|
563
|
+
this.employeeInfo(result._meta?.awEmployeeExecutionInfo);
|
|
532
564
|
this.lifecycleConfiguration(result, configRevision);
|
|
533
565
|
this.method = acp.methods.agent.session.resume;
|
|
534
566
|
}
|
|
@@ -536,6 +568,8 @@ export class AcpSession {
|
|
|
536
568
|
if (!this.negotiated.loadSession)
|
|
537
569
|
throw new NeedError('RESUME_UNSUPPORTED', '远端未声明会话恢复或加载能力,不能恢复原会话', '支持 session/resume 或 session/load 的 agent');
|
|
538
570
|
const result = await restore(() => this.stage('acp-session-load', () => this.connection.agent.request(acp.methods.agent.session.load, { ...params, sessionId: resumeId }, { cancellationSignal: signal })));
|
|
571
|
+
if (this.employeeMeta)
|
|
572
|
+
this.employeeInfo(result._meta?.awEmployeeExecutionInfo);
|
|
539
573
|
this.lifecycleConfiguration(result, configRevision);
|
|
540
574
|
this.method = acp.methods.agent.session.load;
|
|
541
575
|
}
|
|
@@ -548,6 +582,7 @@ export class AcpSession {
|
|
|
548
582
|
this.lifecycleConfiguration(result, configRevision);
|
|
549
583
|
this.method = acp.methods.agent.session.new;
|
|
550
584
|
}
|
|
585
|
+
this.confirmBridgeStartupFailure();
|
|
551
586
|
await this.hooks.sessionOwnership?.bind(this.sessionId, signal);
|
|
552
587
|
this.ready = true;
|
|
553
588
|
this.cwd = cwd;
|
|
@@ -599,6 +634,7 @@ export class AcpSession {
|
|
|
599
634
|
};
|
|
600
635
|
signal?.addEventListener('abort', cancel, { once: true });
|
|
601
636
|
try {
|
|
637
|
+
this.flushBridgeStartupNotice();
|
|
602
638
|
const result = await this.stage('acp-prompt', () => {
|
|
603
639
|
this.promptPermissions.set(params, { current, native });
|
|
604
640
|
const request = this.connection.agent.request(acp.methods.agent.session.prompt, params, { cancellationSignal: signal });
|
package/dist/agents.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const CODEX_AGENT = Object.freeze({ id: 'codex-remote', name: Object.freeze({ zh: 'Codex(远程主机)', en: 'Codex (Remote Host)' }), command: '/usr/local/aw-host/bin/codex-acp', loginProvider: 'codex' });
|
|
1
|
+
export const CODEX_AGENT = Object.freeze({ id: 'codex-remote', name: Object.freeze({ zh: 'Codex(远程主机)', en: 'Codex (Remote Host)' }), command: '/usr/local/aw-host/bin/codex-acp-toolbridge', loginProvider: 'codex' });
|
|
2
2
|
export const CLAUDE_AGENT = Object.freeze({ id: 'claude-code-workbench', name: Object.freeze({ zh: 'Claude(远程主机)', en: 'Claude (Remote Host)' }), command: '/usr/local/aw-host/bin/claude-agent-acp', loginProvider: 'claude' });
|
|
3
3
|
export const AGENTS = Object.freeze([CODEX_AGENT, CLAUDE_AGENT]);
|
|
4
4
|
export function agentForProvider(id) { return AGENTS.find(agent => agent.id === id); }
|
package/dist/claude-local.js
CHANGED
|
@@ -115,7 +115,8 @@ export function createClaudeLocalProvider(options) {
|
|
|
115
115
|
const network = options.getNetwork();
|
|
116
116
|
lease = await (options.ports?.lease ?? openEmployeeLease)({ closeDiagnostics, getConnect: () => options.getConnect(), getNetwork: options.getNetwork, readWorkspace: () => options.readWorkspace(request.sessionId), host: target, sessionId: request.sessionId, control: async (_target, command, signal) => (await transport()).run(command, signal), detail: unscoped }, request.signal);
|
|
117
117
|
const shell = (options.ports?.shell ?? createEmployeeShell)({ closeDiagnostics, target: lease.target, sshArgs: lease.sshArgs, maxBytes: maximum, killGraceMs: grace, attach: async (spec) => (await transport()).attach([spec.command, ...spec.args].map(shellQuote).join(' ')) });
|
|
118
|
-
|
|
118
|
+
request.toolBridge?.enable(event => details.record(event));
|
|
119
|
+
mcp = await (options.ports?.mcp ?? openEmployeeMcp)({ bridge: request.toolBridge, closeDiagnostics, lease, maxBytes: maximum, killGraceMs: grace, runShell: shell, activeSignal: () => entry?.active?.signal, captureDetail: () => { const sink = entry?.active?.details; if (!sink)
|
|
119
120
|
throw failure('EMPLOYEE_NO_ACTIVE_TURN'); return observation => sink.record(observation); }, detail: unscoped });
|
|
120
121
|
entry = { runtime: undefined, scope, lease, details, request };
|
|
121
122
|
const row = entry;
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({id:'@ai-workbench/remote-agent',factory(require){
|
|
2
2
|
const messages={"en":{"administratorNote":"Settings → Built-in plugins → 远程助手参数. Eight named settings with defaults, scope and effects.","providerName":"Codex (Remote Host)"},"zh":{"administratorNote":"管理员:设置 → 内置插件 → 远程助手参数。八项设置含默认值、范围、生效和后果说明。","providerName":"Codex(远程主机)"}};
|
|
3
|
-
const settingsFields=[{"key":"acpMaxMessageBytes","name":"完整消息与工具输出容量(字节)","kind":"number","min":1,"max":9007199254740991,"range":"1~9007199254740991 的整数;0不能关闭上限","scope":"
|
|
3
|
+
const settingsFields=[{"key":"acpMaxMessageBytes","name":"完整消息与工具输出容量(字节)","kind":"number","min":1,"max":9007199254740991,"range":"1~9007199254740991 的整数;0不能关闭上限","scope":"两位远程助手的完整会话消息;默认32 MB(32000000字节)。也用于模型目录、本机 MCP、员工执行 RPC 和工具输出容量。","when":"当轮快照不变;下一次独立调用或目录查询读取新值。","consequence":"调大可接收更大消息、占用更多内存;调小更早拒绝超限。超限明确停止,不截断、不自动重试;不能用0取消完整消息保护。","defaultValue":32000000},{"key":"brokerMaxFrameBytes","name":"主机会话回传单段容量(字节)","kind":"number","min":1,"max":9007199254740991,"range":"1~9007199254740991 的整数;0不能关闭上限","scope":"本插件接收主机会话单段输出的容量;不会替主机修改它自己的输出策略。","when":"当轮快照不变;更改后已有会话需新建。","consequence":"调大允许更大回传段、占用更多内存;调小可能拒绝主机合法输出。超限停止,不截断;不能关闭协议帧核验。","defaultValue":2097152},{"key":"brokerControlMaxBytes","name":"主机会话管理回复容量(字节)","kind":"number","min":1,"max":9007199254740991,"range":"1~9007199254740991 的整数;0不能关闭上限","scope":"主机会话管理命令的标准输出、标准错误各自容量;也用于本机执行桥的管理回复。","when":"当轮快照不变;更改后已有会话需新建。","consequence":"调大允许更长管理回复、占用更多内存;调小可能无法核实状态。超限明确停止,不能把不完整回复当成功;0不表示无限。","defaultValue":1048576},{"key":"employeeShellKillGraceMs","name":"本机命令外层连接清理宽限(毫秒)","kind":"number","min":0,"max":2147483647,"range":"0~2147483647 的整数","scope":"仅 Claude 本机 Bash 取消后,本插件自己的外层 SSH 进程清理;不控制员工命令或 Codex 执行器。","when":"当轮快照不变;更改后已有会话需新建。","consequence":"大于0时先请求外层连接退出,再等待所设毫秒后强制清理;0表示不留宽限、立即强制清理外层连接,不是关闭取消。没有员工端退出确认时结果仍未知,不能据此自动重放或声称命令已停止。","defaultValue":1000}];
|
|
4
4
|
/* Public settings.plugins.tab + shared ConfigForms. No private client services. */
|
|
5
5
|
function mountRuntimeSettings(ctx,React,fields){
|
|
6
6
|
const h=React.createElement;
|
package/dist/employee-mcp.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ToolBridge } from './toolbridge.ts';
|
|
1
2
|
import { type CloseCause, type CloseDiagnostics, type CloseObserver } from './close-diagnostics.ts';
|
|
2
3
|
import { type Socket } from 'node:net';
|
|
3
4
|
import { type JSONRPCMessage, type Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -28,6 +29,7 @@ export declare class EmployeeSocketTransport implements Transport {
|
|
|
28
29
|
close(cause?: CloseCause): Promise<void>;
|
|
29
30
|
}
|
|
30
31
|
export interface EmployeeMcpOptions {
|
|
32
|
+
bridge?: ToolBridge;
|
|
31
33
|
closeDiagnostics?: CloseDiagnostics;
|
|
32
34
|
lease: EmployeeLease;
|
|
33
35
|
maxBytes: number;
|
package/dist/employee-mcp.js
CHANGED
|
@@ -136,12 +136,14 @@ export async function openEmployeeMcp(options) {
|
|
|
136
136
|
const mcp = new Server({ name: 'ai-workbench-employee', version: '0.8.14' }, { capabilities: { tools: {} } }), transport = new EmployeeSocketTransport(socket, options.maxBytes, observeConnection);
|
|
137
137
|
clients.add(mcp);
|
|
138
138
|
transports.add(transport);
|
|
139
|
-
mcp.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: EMPLOYEE_MCP_TOOLS }));
|
|
139
|
+
mcp.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...EMPLOYEE_MCP_TOOLS, ...options.bridge?.tools ?? []] }));
|
|
140
140
|
mcp.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
141
141
|
const active = options.activeSignal();
|
|
142
142
|
if (!active || active.aborted)
|
|
143
143
|
return { isError: true, content: [{ type: 'text', text: 'EMPLOYEE_NO_ACTIVE_TURN:当前没有已接纳的用户轮次,本机工具未执行。' }] };
|
|
144
144
|
const signal = AbortSignal.any([active, extra.signal, transport.signal, options.lease.signal]);
|
|
145
|
+
if (options.bridge?.isBridge(request.params.name))
|
|
146
|
+
return options.bridge.call(request.params.name, request.params.arguments ?? {}, signal);
|
|
145
147
|
let sink;
|
|
146
148
|
try {
|
|
147
149
|
sink = options.captureDetail?.() ?? options.detail;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const settingsNamespace = "ai-workbench-codex";
|
|
|
15
15
|
export declare const inject: string[];
|
|
16
16
|
/** Owner-approved defaults; administrators may override through the existing settings. */
|
|
17
17
|
export declare const DEFAULT_CONFIG: Readonly<{
|
|
18
|
-
readonly acpMaxMessageBytes:
|
|
18
|
+
readonly acpMaxMessageBytes: 32000000;
|
|
19
19
|
readonly brokerMaxFrameBytes: 2097152;
|
|
20
20
|
readonly brokerControlMaxBytes: 1048576;
|
|
21
21
|
readonly employeeShellKillGraceMs: 1000;
|
|
@@ -57,6 +57,7 @@ export declare class CodexRemoteAdapter extends LlmAdapter {
|
|
|
57
57
|
private readonly directory?;
|
|
58
58
|
private readonly preflightDiagnostics?;
|
|
59
59
|
private readonly permissions?;
|
|
60
|
+
private bridgeLoop;
|
|
60
61
|
private config;
|
|
61
62
|
private sessions;
|
|
62
63
|
private turns;
|
|
@@ -65,7 +66,8 @@ export declare class CodexRemoteAdapter extends LlmAdapter {
|
|
|
65
66
|
private detached;
|
|
66
67
|
private modelPresentation;
|
|
67
68
|
private employeeNoticeSessions;
|
|
68
|
-
|
|
69
|
+
private pendingEmployeeNotices;
|
|
70
|
+
constructor(config: PluginConfig | (() => PluginConfig), resolveRuntime: RuntimeProvider, approve?: InvocationApproval | undefined, providerName?: () => string, agent?: AgentDefinition, readImage?: ImageReader | undefined, reportLoginFailure?: LoginFailureReporter | undefined, directory?: ModelDirectory | undefined, preflightDiagnostics?: PreflightDiagnostics | undefined, permissions?: PermissionSource | undefined, bridgeStopped?: (sessionId: string, notice: string) => void);
|
|
69
71
|
providerInfo(provider: string): {
|
|
70
72
|
id: string;
|
|
71
73
|
name: string;
|
|
@@ -88,6 +90,8 @@ export declare class CodexRemoteAdapter extends LlmAdapter {
|
|
|
88
90
|
jitterRatio: number;
|
|
89
91
|
};
|
|
90
92
|
private cleanupRuntime;
|
|
93
|
+
completeDshTurn(sessionId: string, messages: GenerateOptions['messages']): Promise<void>;
|
|
94
|
+
hasBridgeSession(sessionId: string): boolean;
|
|
91
95
|
disposeSession(sessionId: string): Promise<void>;
|
|
92
96
|
detachSession(sessionId: string): Promise<void>;
|
|
93
97
|
dispose(): Promise<void>;
|
|
@@ -97,7 +101,7 @@ export declare class CodexRemoteAdapter extends LlmAdapter {
|
|
|
97
101
|
/** One official registration owns both routes, preserving opaque replay ownership. */
|
|
98
102
|
export declare class RemoteAgentsAdapter extends LlmAdapter {
|
|
99
103
|
private adapters;
|
|
100
|
-
constructor(config: () => PluginConfig, makeRuntime: (agent: AgentDefinition) => RuntimeProvider, approve: InvocationApproval, nameFor: (agent: AgentDefinition) => string, readImage?: ImageReader, reportLoginFailure?: LoginFailureReporter, directory?: ModelDirectory, preflightDiagnostics?: PreflightDiagnostics, permissions?: PermissionSource);
|
|
104
|
+
constructor(config: () => PluginConfig, makeRuntime: (agent: AgentDefinition) => RuntimeProvider, approve: InvocationApproval, nameFor: (agent: AgentDefinition) => string, readImage?: ImageReader, reportLoginFailure?: LoginFailureReporter, directory?: ModelDirectory, preflightDiagnostics?: PreflightDiagnostics, permissions?: PermissionSource, bridgeStopped?: (sessionId: string, notice: string) => void);
|
|
101
105
|
private adapter;
|
|
102
106
|
providerInfo(provider: string): {
|
|
103
107
|
id: string;
|
|
@@ -108,8 +112,8 @@ export declare class RemoteAgentsAdapter extends LlmAdapter {
|
|
|
108
112
|
})[]>;
|
|
109
113
|
resolveModel(provider: string, model: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;
|
|
110
114
|
prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<{
|
|
111
|
-
model: LlmResolvedModelInfo;
|
|
112
115
|
stream: (options: GenerateOptions) => AsyncGenerator<StreamChunk, any, any>;
|
|
116
|
+
model: LlmResolvedModelInfo;
|
|
113
117
|
}>;
|
|
114
118
|
providerRetryPolicy(): {
|
|
115
119
|
mode: "normal";
|
|
@@ -120,6 +124,7 @@ export declare class RemoteAgentsAdapter extends LlmAdapter {
|
|
|
120
124
|
jitterRatio: number;
|
|
121
125
|
};
|
|
122
126
|
stream(options: GenerateOptions): AsyncGenerator<StreamChunk, any, any>;
|
|
127
|
+
completeDshTurn(sessionId: string, messages: GenerateOptions['messages']): Promise<void>;
|
|
123
128
|
disposeSession(sessionId: string): Promise<void>;
|
|
124
129
|
detachSession(sessionId: string): Promise<void>;
|
|
125
130
|
dispose(): Promise<void>;
|