@ai-workbench/remote-agent 0.9.0-toolbridge.37-rc.4 → 0.9.0-toolbridge.37-rc.5
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 +4 -2
- package/dist/broker-runtime.js +48 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.37-rc.
|
|
1
|
+
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.37-rc.5 · 插件 → 添加插件
|
|
2
2
|
|
|
3
3
|
本版为 0.3.8 配套的预发布验证版本,正式渠道仍为总包 0.3.7 / X.36。只有三版 DSH、真实模型、主机与独审门全部通过后才转正式。
|
|
4
4
|
|
|
@@ -8,6 +8,8 @@ DSH 已公布目录的技能与资源同步到两端同一受控绝对路径,S
|
|
|
8
8
|
|
|
9
9
|
Claude 原生 Agent/TaskStop 与 Codex 原生子代理首轮可用。Codex 只把技能、办公依赖必需桥工具置于 employee 首轮分组,DSH 子代理及其余工具在 dsh 分组按需发现。保留 B6 原生插话、冷恢复、防重放、U1 每次 prompt 用量和原生型号、推理档、权限设置。含桥主机需 2.2.2-aw.17(Codex 0.162.0);不含桥通道不变。没有新增设置项或自定义错误码。
|
|
10
10
|
|
|
11
|
+
上一轮正常结束仍异步清理,不延迟已完成回复。下一次同一可信主机、DSH会话、品牌、原生线程及连接代次打开前,只等待本插件已经发出的那一次释放操作;取消等待不取消释放,失败仍走原有归属校验,不增加模型重试或重复发送任务。
|
|
12
|
+
|
|
11
13
|
## 办公依赖与开工计时(O1,2026-11-15)
|
|
12
14
|
|
|
13
15
|
员工目录模式现在桥接 DSH `load_workspace_dependencies`,由 DSH 原生循环执行、审批并返回员工电脑的 Python/Node 绝对路径;命令仍通过员工执行器执行这些路径。主机目录模式不开放工具桥,不能使用员工运行时路径。Codex 新建线程在主机明确声明能力时,先按本轮所选模型建立原生基础说明,再保留每轮模型、推理与权限的真实设置回执;没有裁剪 DSH、安全或原生说明,恢复与真实换模型维持原语义。需主机含桥适配器 `2.2.2-aw.13`;旧主机照旧运行。
|
|
@@ -18,7 +20,7 @@ Claude 原生 Agent/TaskStop 与 Codex 原生子代理首轮可用。Codex 只
|
|
|
18
20
|
|
|
19
21
|
## 含工具桥预发布线
|
|
20
22
|
|
|
21
|
-
本包为 `0.9.0-toolbridge.37-rc.
|
|
23
|
+
本包为 `0.9.0-toolbridge.37-rc.5`,从 `v0.9.0-toolbridge.14` 派生,使用 `host-toolbridge` 发布渠道。员工安装由连接组件提供的「AI 写作工作台(含工具桥)」总包 `@ai-workbench/workbench-toolbridge@0.3.7`;0.3.8 尚未转正式,与不含工具桥的版本二选一。
|
|
22
24
|
|
|
23
25
|
本轮增加两家运行中插话(DSH 原生 nextStep),保留官方队列和原话;明确 followup 仍排下一轮。Codex 含桥组件需 `2.2.2-aw.12`,Claude 仍为官方 `0.94.0`。插件确定消息未发出时保留排队资格;送达未确认时明确报错且不重放。已注入旧正文不能撤回,编辑版下一步骤交付。
|
|
24
26
|
|
package/dist/broker-runtime.js
CHANGED
|
@@ -8,14 +8,32 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
8
8
|
};
|
|
9
9
|
import { newColdId } from "./cold-store.js";
|
|
10
10
|
import { randomUUID } from 'node:crypto';
|
|
11
|
-
import { CloseDiagnostics } from "./close-diagnostics.js";
|
|
11
|
+
import { CloseDiagnostics, closeCode } from "./close-diagnostics.js";
|
|
12
12
|
import { BrokerTransport, brokerCommand, brokerId, sshIo, controlJson } from "./broker.js";
|
|
13
13
|
import { CODEX_AGENT } from "./agents.js";
|
|
14
14
|
import { NeedError } from "./remote.js";
|
|
15
15
|
import { identity } from "./provider.js";
|
|
16
16
|
import { brokerOwnership } from "./broker-ownership.js";
|
|
17
|
+
/** Wait only for our own already-issued release; aborting the waiter never cancels it. */
|
|
18
|
+
async function awaitRelease(release, signal) {
|
|
19
|
+
signal?.throwIfAborted();
|
|
20
|
+
if (!signal) {
|
|
21
|
+
await release;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const aborted = Promise.withResolvers(), onAbort = () => aborted.reject(signal.reason ?? new DOMException('Aborted', 'AbortError'));
|
|
25
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
26
|
+
try {
|
|
27
|
+
signal.throwIfAborted();
|
|
28
|
+
await Promise.race([release, aborted.promise]);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
signal.removeEventListener('abort', onAbort);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
17
34
|
/** Each invocation owns a new agent. Context resumes by native session ID, never by reattaching a broker. */
|
|
18
35
|
export function brokerFactory(_get, _ask, configuration, provided) {
|
|
36
|
+
const pendingReleases = new Map();
|
|
19
37
|
return async (target, project, request) => {
|
|
20
38
|
const agent = request.agent ?? CODEX_AGENT, settings = request.brokerSettings ?? (typeof configuration === 'function' ? configuration() : configuration);
|
|
21
39
|
let argv = provided?.argv;
|
|
@@ -26,6 +44,17 @@ export function brokerFactory(_get, _ask, configuration, provided) {
|
|
|
26
44
|
const io = provided?.io?.(target) ?? sshIo(target, argv, settings.brokerControlMaxBytes);
|
|
27
45
|
const command = (args) => brokerCommand(target, args);
|
|
28
46
|
const diagnostics = request.closeDiagnostics ?? new CloseDiagnostics(detail => request.detailChannel?.record(detail));
|
|
47
|
+
const api = _get(), connection = api?.getConnectionState(), generation = JSON.stringify(connection ? [connection.instanceId, connection.epoch, connection.phase] : null);
|
|
48
|
+
const releaseKey = JSON.stringify([identity(target), target.session.root, request.sessionId, agent.loginProvider]), previousRelease = pendingReleases.get(releaseKey);
|
|
49
|
+
if (request.resumeSessionId !== undefined && previousRelease && previousRelease.nativeId === request.resumeSessionId && previousRelease.api === api && previousRelease.generation === generation) {
|
|
50
|
+
try {
|
|
51
|
+
await awaitRelease(previousRelease.promise, request.signal);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
request.signal?.throwIfAborted();
|
|
55
|
+
diagnostics.record({ layer: 'broker', initiator: 'broker.previous-release', reason: closeCode(error, 'BROKER_CONTROL_FAILED'), action: 'failure' });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
29
58
|
const id = brokerId(request.sessionId + '/' + randomUUID(), agent.id);
|
|
30
59
|
const startCommand = command(['start', id, '--cwd', project.path, '--settings', target.session.settingsPath, '--dsh-session-id', request.sessionId, '--provider', agent.loginProvider, '--', agent.command]);
|
|
31
60
|
// environments.toml overrides CODEX_EXEC_SERVER_URL. Refuse that host default rather
|
|
@@ -96,23 +125,34 @@ export function brokerFactory(_get, _ask, configuration, provided) {
|
|
|
96
125
|
diagnostics.record(cause);
|
|
97
126
|
channel.close(cause);
|
|
98
127
|
};
|
|
99
|
-
|
|
128
|
+
let disposing, nativeSessionId;
|
|
129
|
+
const dispose = (cause = { layer: 'broker', initiator: 'broker.dispose', reason: 'BROKER_DISPOSE', action: 'dispose' }) => {
|
|
130
|
+
if (disposing)
|
|
131
|
+
return disposing;
|
|
100
132
|
if (ended)
|
|
101
|
-
return;
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
133
|
+
return Promise.resolve();
|
|
134
|
+
// Register synchronously before detach yields. Only the next same-thread open
|
|
135
|
+
// waits; the completed official turn keeps its non-blocking cleanup contract.
|
|
136
|
+
const release = Promise.resolve().then(async () => { await detach(cause); await io.run(command(['kill', id, '--if-instance', started.instanceId])); });
|
|
137
|
+
disposing = release.catch(() => console.warn('[remote-agent] 旧主机会话暂未清理,将由主机自动回收'));
|
|
138
|
+
const entry = { promise: release, nativeId: nativeSessionId, api, generation };
|
|
139
|
+
pendingReleases.set(releaseKey, entry);
|
|
140
|
+
const clear = () => { if (pendingReleases.get(releaseKey) === entry)
|
|
141
|
+
pendingReleases.delete(releaseKey); };
|
|
142
|
+
void release.then(clear, clear);
|
|
143
|
+
return disposing;
|
|
105
144
|
};
|
|
106
145
|
const aborted = () => channel.fail(new NeedError('ABORTED', '本轮已取消。', '确认主机状态'), { layer: 'broker', initiator: 'broker.open-signal', reason: 'ABORTED', action: 'abort' });
|
|
107
146
|
request.signal?.addEventListener('abort', aborted, { once: true });
|
|
108
147
|
let sessionOwnership;
|
|
109
148
|
try {
|
|
110
|
-
|
|
149
|
+
const ownership = brokerOwnership(io, command, { id, instanceId: started.instanceId }, started, request.sessionId, agent.loginProvider);
|
|
150
|
+
sessionOwnership = { ...ownership, async bind(nativeId, signal) { await ownership.bind(nativeId, signal); nativeSessionId = nativeId; } };
|
|
111
151
|
request.signal?.throwIfAborted();
|
|
112
152
|
await channel.connect();
|
|
113
153
|
}
|
|
114
154
|
catch (error) {
|
|
115
|
-
|
|
155
|
+
void dispose().catch(() => console.warn('[remote-agent] 旧主机会话暂未清理,将由主机自动回收'));
|
|
116
156
|
throw error;
|
|
117
157
|
}
|
|
118
158
|
finally {
|