@ai-workbench/remote-agent 0.8.31 → 0.9.0-toolbridge.10
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 +12 -2
- 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/employee-mcp.d.ts +2 -0
- package/dist/employee-mcp.js +3 -1
- package/dist/employee-native.d.ts +16 -6
- package/dist/employee-native.js +9 -4
- package/dist/index.d.ts +8 -3
- package/dist/index.js +110 -17
- package/dist/presentation.js +1 -1
- 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 +6 -5
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.10 · 插件 → 添加插件
|
|
2
|
+
|
|
3
|
+
## 含工具桥预发布线
|
|
4
|
+
|
|
5
|
+
本包为 `0.9.0-toolbridge.10`,在独立 `release/x-mac-universal` 分支支持 Intel 与 Apple 芯片 Mac;稳定 main/0.8.x 和原总包保持原样。员工安装由连接组件提供的「AI 写作工作台(含工具桥)」总包,与不含工具桥的版本二选一。预发布渠道为 `mac-universal`,本轮仅提供本地固定包,不发布 npm。
|
|
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
|
|
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/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;
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
export declare const EMPLOYEE_NATIVE: Readonly<{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
arm64: Readonly<{
|
|
3
|
+
version: "0.160.1";
|
|
4
|
+
platform: "darwin";
|
|
5
|
+
arch: "arm64";
|
|
6
|
+
package: "@openai/codex-darwin-arm64";
|
|
7
|
+
packageVersion: "0.160.1-darwin-arm64";
|
|
8
|
+
triple: "aarch64-apple-darwin";
|
|
9
|
+
}>;
|
|
10
|
+
x64: Readonly<{
|
|
11
|
+
version: "0.160.1";
|
|
12
|
+
platform: "darwin";
|
|
13
|
+
arch: "x64";
|
|
14
|
+
package: "@openai/codex-darwin-x64";
|
|
15
|
+
packageVersion: "0.160.1-darwin-x64";
|
|
16
|
+
triple: "x86_64-apple-darwin";
|
|
17
|
+
}>;
|
|
8
18
|
}>;
|
|
9
19
|
/** Resolve the installed executable; no per-turn hash or version probe. */
|
|
10
20
|
export declare function resolveEmployeeNative(ports?: {
|
package/dist/employee-native.js
CHANGED
|
@@ -2,14 +2,19 @@ import { createRequire } from 'node:module';
|
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { NeedError } from "./remote.js";
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
5
|
-
export const EMPLOYEE_NATIVE = Object.freeze({
|
|
5
|
+
export const EMPLOYEE_NATIVE = Object.freeze({
|
|
6
|
+
arm64: Object.freeze({ version: '0.160.1', platform: 'darwin', arch: 'arm64', package: '@openai/codex-darwin-arm64', packageVersion: '0.160.1-darwin-arm64', triple: 'aarch64-apple-darwin' }),
|
|
7
|
+
x64: Object.freeze({ version: '0.160.1', platform: 'darwin', arch: 'x64', package: '@openai/codex-darwin-x64', packageVersion: '0.160.1-darwin-x64', triple: 'x86_64-apple-darwin' }),
|
|
8
|
+
});
|
|
6
9
|
/** Resolve the installed executable; no per-turn hash or version probe. */
|
|
7
10
|
export async function resolveEmployeeNative(ports = {}) {
|
|
8
|
-
|
|
11
|
+
const arch = ports.arch ?? process.arch;
|
|
12
|
+
if ((ports.platform ?? process.platform) !== 'darwin' || (arch !== 'arm64' && arch !== 'x64'))
|
|
9
13
|
throw new NeedError('EMPLOYEE_PLATFORM_UNSUPPORTED', '当前设备尚未支持本机执行。', '对应平台执行器');
|
|
14
|
+
const native = EMPLOYEE_NATIVE[arch];
|
|
10
15
|
try {
|
|
11
|
-
const manifest = (ports.resolve ?? require.resolve)(
|
|
12
|
-
return { path: join(dirname(manifest), 'vendor',
|
|
16
|
+
const manifest = (ports.resolve ?? require.resolve)(native.package + '/package.json');
|
|
17
|
+
return { path: join(dirname(manifest), 'vendor', native.triple, 'bin', 'codex') };
|
|
13
18
|
}
|
|
14
19
|
catch {
|
|
15
20
|
throw new NeedError('AW_EMPLOYEE_BINARY_MISSING', '本机执行组件没有装齐,请重新安装插件。', '随插件安装的执行组件');
|
package/dist/index.d.ts
CHANGED
|
@@ -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>;
|