@ai-workbench/remote-agent 0.9.0-toolbridge.16 → 0.9.0-toolbridge.17
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 +5 -3
- package/dist/broker-runtime.js +1 -7
- package/dist/broker.d.ts +0 -2
- package/dist/broker.js +0 -5
- package/dist/cold-protocol.js +5 -1
- package/dist/index.js +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.
|
|
1
|
+
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.17 · 插件 → 添加插件
|
|
2
2
|
|
|
3
3
|
## 含工具桥预发布线
|
|
4
4
|
|
|
5
|
-
本包为 `0.9.0-toolbridge.
|
|
5
|
+
本包为 `0.9.0-toolbridge.17`,从 `v0.9.0-toolbridge.14` 派生,使用 `host-toolbridge` 发布渠道。员工安装由连接组件提供的「AI 写作工作台(含工具桥)」总包 `@ai-workbench/workbench-toolbridge@0.1.14`,与不含工具桥的版本二选一。
|
|
6
6
|
|
|
7
7
|
本轮增加两家运行中插话(DSH 原生 nextStep),保留官方队列和原话;明确 followup 仍排下一轮。Codex 含桥组件需 `2.2.2-aw.12`,Claude 仍为官方 `0.94.0`。插件确定消息未发出时保留排队资格;送达未确认时明确报错且不重放。已注入旧正文不能撤回,编辑版下一步骤交付。
|
|
8
8
|
|
|
9
|
-
host `0.8.
|
|
9
|
+
host `0.8.11` 的新 broker 支持同一客户端/SDK 在切网后按输出游标和输入 ACK 水位接回原 prompt、结果及用量,不重新发送原 prompt;旧本机执行端失效仍为 UNKNOWN,不用新进程替换或重放旧操作。客户端完全退出、崩溃后,重新打开同一 DSH 会话会自动接回已持久登记的原 prompt,显示未落盘输出并取回原结果、增量用量。原 prompt 只执行一次;旧审批仅取消,不复活未知本机执行。旧运行 broker 和 X.14 在途轮不会被安装自动补造冷恢复记录。无新增设置;512,000,000 字节默认保留,实际协议头计入同一容量。
|
|
10
|
+
|
|
11
|
+
原轮正常完成(或冷接回已交付原结果)后结束该轮主机 broker,原生线程写锁随之释放,同一 DSH 会话下一轮不再因旧轮保留 10 分钟而报“原会话仍被占用”;结果未定(插件退出、断开、失败)时仍保留原轮待接回。旧 X.14–.16 发出的结束请求在主机上始终不生效,只有升级本包才消除;只升主机不够。
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
选择本机文件夹后,Claude 和 Codex 可以把 DSH 已启用的 MCP、web、skill、ask_user、todo/present/goal 等工具交给 DSH 原生执行和审批。内置文件/命令、子代理/agent-team、run_code 不在桥接表;原有文件和命令执行方式保留。plan 不自动放行桥接权限;default 下 Claude 的桥接原生权限由插件单次应答,员工只在 DSH 审批实际工具。主机文件夹不开放工具桥。
|
package/dist/broker-runtime.js
CHANGED
|
@@ -91,13 +91,7 @@ export function brokerFactory(_get, _ask, configuration, provided) {
|
|
|
91
91
|
const dispose = async (cause = { layer: 'broker', initiator: 'broker.dispose', reason: 'BROKER_DISPOSE', action: 'dispose' }) => {
|
|
92
92
|
if (ended)
|
|
93
93
|
return;
|
|
94
|
-
|
|
95
|
-
const attachmentId = channel.attachmentId;
|
|
96
|
-
await detach(cause);
|
|
97
|
-
if (attachmentId)
|
|
98
|
-
void io.run(command(['kill', id, '--if-instance', started.instanceId, '--if-attachment', attachmentId])).catch(() => console.warn('[remote-agent] 原写者已分离或更换,主机按既有生命周期保留原轮'));
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
94
|
+
// Ending the round ends its host agent, so the native thread writer is free for the next round.
|
|
101
95
|
await detach(cause);
|
|
102
96
|
void io.run(command(['kill', id, '--if-instance', started.instanceId])).catch(() => console.warn('[remote-agent] 旧主机会话暂未清理,将由主机自动回收'));
|
|
103
97
|
};
|
package/dist/broker.d.ts
CHANGED
|
@@ -63,8 +63,6 @@ export declare class BrokerTransport {
|
|
|
63
63
|
discardMessage(id: string): Promise<any>;
|
|
64
64
|
observeMessage(id: string): Promise<any>;
|
|
65
65
|
resumeMessage(write: ColdWrite): Promise<void>;
|
|
66
|
-
private attachedId?;
|
|
67
|
-
get attachmentId(): string | undefined;
|
|
68
66
|
private inputSequence;
|
|
69
67
|
private inputReady;
|
|
70
68
|
private pendingInput?;
|
package/dist/broker.js
CHANGED
|
@@ -92,8 +92,6 @@ export class BrokerTransport {
|
|
|
92
92
|
async resumeMessage(write) { const bytes = Buffer.from(write.wire, 'base64'), skip = this.inputSequence - write.baseSequence; if (skip < 0 || skip > write.chunks)
|
|
93
93
|
throw new NeedError('INPUT_DELIVERY_UNCONFIRMED', '原输入水位越界,没有重复写入', '原输入提交回执'); if (skip === write.chunks)
|
|
94
94
|
return; await this.send(bytes, { id: write.id, sha256: write.sha256, chunkBytes: write.chunkBytes, offset: skip * write.chunkBytes }); }
|
|
95
|
-
attachedId;
|
|
96
|
-
get attachmentId() { return this.attachedId; }
|
|
97
95
|
inputSequence = 0;
|
|
98
96
|
inputReady = true;
|
|
99
97
|
pendingInput;
|
|
@@ -296,9 +294,6 @@ export class BrokerTransport {
|
|
|
296
294
|
throw new NeedError('BROKER_PROTOCOL_INVALID', '主机缺少完整消息暂存协议', 'messageInputProtocolVersion 1');
|
|
297
295
|
if (receipt.pendingSequence !== null && receipt.pendingSequence !== this.pendingInput?.sequence && !(this.options.restoreInput?.pending && receipt.pendingSequence === this.options.restoreInput.pending.baseSequence + this.options.restoreInput.pending.chunks && receipt.stagedMessageId === this.options.restoreInput.pending.id && receipt.stagedSha256 === this.options.restoreInput.pending.sha256))
|
|
298
296
|
throw new NeedError('INPUT_DELIVERY_UNCONFIRMED', '主机在途输入不属于本客户端', '原客户端在途输入');
|
|
299
|
-
if (typeof f.attachmentId !== 'string' || !f.attachmentId)
|
|
300
|
-
throw new NeedError('BROKER_PROTOCOL_INVALID', '主机缺少写者实例标识', '本次attachmentId');
|
|
301
|
-
this.attachedId = f.attachmentId;
|
|
302
297
|
this.inputReady = false;
|
|
303
298
|
}
|
|
304
299
|
const lifecycle = f.lifecycle;
|
package/dist/cold-protocol.js
CHANGED
|
@@ -70,7 +70,7 @@ export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
|
70
70
|
broker = new BrokerTransport({ maxFrameBytes: options.maxFrameBytes, controlMaxBytes: record.controlMaxBytes, leased: true, inputProtocolVersion: 2, messageInput: true, recoverDisconnect: true, instanceId: record.instanceId, initialSequence: record.outputStart, restoreInput: { sequence: record.inputSequence, pending: record.pending }, beforeMessage, afterMessage, attach: (after = 0) => options.io.attach(command(['attach', record.brokerId, '--after', String(after), '--framed', '--leased', '--input-protocol', '2', '--message-input', '--if-instance', record.instanceId, '--cold-round', record.id, '--prompt-id', record.promptId, ...owner])) });
|
|
71
71
|
const raw = acp.ndJsonStream(broker.writable, broker.readable, { maxMessageBytes: options.maxMessageBytes }), reader = raw.readable.getReader(), writer = raw.writable.getWriter();
|
|
72
72
|
const mapper = new StreamMapper(record.meta.baseline), output = new StreamMapper(), trim = new Prefix(prefix);
|
|
73
|
-
let terminal = false, replayed = false;
|
|
73
|
+
let terminal = false, replayed = false, delivered = false;
|
|
74
74
|
const pendingRequests = new Map();
|
|
75
75
|
let outboundTail = Promise.resolve();
|
|
76
76
|
const enqueue = (work) => { outboundTail = outboundTail.then(work); void outboundTail.catch(error => broker.fail(error instanceof NeedError ? error : coldNeed())); };
|
|
@@ -323,6 +323,7 @@ export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
|
323
323
|
yield* output.flush();
|
|
324
324
|
const snapshot = record.meta;
|
|
325
325
|
const pointer = { ...(snapshot.hostSource ? { hostSource: snapshot.hostSource } : {}), ...(snapshot.modelConfiguration ? { modelConfiguration: snapshot.modelConfiguration } : {}), version: 2, agent: record.provider, contextSha256: snapshot.contextSha256, usageSnapshot: mapper.usageSnapshot, dshSessionId: record.sessionId, identity: snapshot.identity, cwd: snapshot.cwd, sessionId: record.nativeId, ...(snapshot.binding ? { bindingId: snapshot.binding.bindingId, workspaceId: snapshot.binding.workspaceId } : {}), coldRoundId: record.id, coldPromptId: record.promptId, coldRoundTerminal: true, coldOutputAfter: broker.lastSequence };
|
|
326
|
+
delivered = true;
|
|
326
327
|
yield { type: 'finish', reason: { kind: ['max_tokens', 'max_turn_requests'].includes(m.result.stopReason) ? 'max-tokens' : 'stop' }, replayState: { response: pointer } };
|
|
327
328
|
return;
|
|
328
329
|
}
|
|
@@ -342,6 +343,9 @@ export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
|
342
343
|
await cancelNote?.catch(() => { });
|
|
343
344
|
reader.releaseLock();
|
|
344
345
|
writer.releaseLock();
|
|
346
|
+
// The recovered result is delivered: end its host agent so the next round can own the native thread.
|
|
347
|
+
if (delivered && !options.signal?.aborted)
|
|
348
|
+
void options.io.run(command(['kill', record.brokerId, '--if-instance', record.instanceId])).catch(() => console.warn('[remote-agent] 旧主机会话暂未清理,将由主机自动回收'));
|
|
345
349
|
}
|
|
346
350
|
}
|
|
347
351
|
/** 本地未派发取消的证明来自写前记录或S消息回执,不伪造原生RPC终态。 */
|
package/dist/index.js
CHANGED
|
@@ -365,7 +365,6 @@ export class CodexRemoteAdapter extends LlmAdapter {
|
|
|
365
365
|
let remoteAttempted = false;
|
|
366
366
|
let promptBaseline = 0;
|
|
367
367
|
let failureCode;
|
|
368
|
-
let preserveRecoveredRuntime = false;
|
|
369
368
|
let activeMapper;
|
|
370
369
|
let selected;
|
|
371
370
|
let modelConfiguration;
|
|
@@ -777,7 +776,7 @@ export class CodexRemoteAdapter extends LlmAdapter {
|
|
|
777
776
|
session?.close({ layer: 'adapter', initiator: 'adapter.turn-finally', reason: succeeded ? 'TURN_FINISHED' : 'TURN_FAILED', action: 'close' });
|
|
778
777
|
if (key && this.sessions.get(key) === live)
|
|
779
778
|
this.sessions.delete(key);
|
|
780
|
-
if (session && session.promptDispatchCount > promptBaseline && (runtime.cold || this.shuttingDown || key && this.detached.has(key) || original.signal?.reason?.kind === 'disposed'))
|
|
779
|
+
if (session && session.promptDispatchCount > promptBaseline && (runtime.cold && !succeeded && !bridge?.concludeAcknowledged || this.shuttingDown || key && this.detached.has(key) || original.signal?.reason?.kind === 'disposed'))
|
|
781
780
|
void runtime.detach?.({ layer: 'adapter', initiator: 'adapter.preserve-original', reason: 'SESSION_DETACHED', action: 'detach' });
|
|
782
781
|
else
|
|
783
782
|
void this.cleanupRuntime(runtime);
|