@ai-workbench/remote-agent 0.9.0-toolbridge.36 → 0.9.0-toolbridge.37-rc.4
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 +10 -5
- package/dist/acp.d.ts +4 -3
- package/dist/acp.js +7 -9
- package/dist/claude-local.js +2 -2
- package/dist/cold-protocol.d.ts +1 -0
- package/dist/cold-protocol.js +14 -7
- package/dist/cold-recovery.d.ts +1 -0
- package/dist/cold-recovery.js +2 -2
- package/dist/cold-store.d.ts +0 -1
- package/dist/custom-instructions.d.ts +6 -0
- package/dist/custom-instructions.js +21 -0
- package/dist/employee-mcp.js +2 -2
- package/dist/employee-native.d.ts +2 -2
- package/dist/employee-native.js +1 -1
- package/dist/employee-provider.js +1 -1
- package/dist/employee-relay.js +1 -1
- package/dist/employee-tools.js +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +32 -62
- package/dist/input.d.ts +2 -9
- package/dist/input.js +13 -62
- package/dist/native-content-transport.d.ts +42 -0
- package/dist/native-content-transport.js +83 -0
- package/dist/native-content.d.ts +67 -0
- package/dist/native-content.js +294 -0
- package/dist/provider.d.ts +4 -2
- package/dist/toolbridge-table.d.ts +5 -3
- package/dist/toolbridge-table.js +6 -15
- package/dist/toolbridge.js +21 -32
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.
|
|
1
|
+
# AI Workbench 远程助手 · @ai-workbench/remote-agent@0.9.0-toolbridge.37-rc.4 · 插件 → 添加插件
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
本版为 0.3.8 配套的预发布验证版本,正式渠道仍为总包 0.3.7 / X.36。只有三版 DSH、真实模型、主机与独审门全部通过后才转正式。
|
|
4
4
|
|
|
5
|
+
本版撤除插件自行拼写的系统规则、位置说明和技能目录说明。模型接收员工输入、原工具描述、CLI 原生上下文,以及员工显式配置的自定义指令原文。DSH 系统规则不转送;同一 DSH 会话切换品牌时仍补带可见对话及角色结构。插件控制诊断留在技术详情,不混入模型回复或下一轮历史。I3 规则重注入、摘要回执与 v2 协商已整体删除。
|
|
6
|
+
|
|
7
|
+
DSH 已公布目录的技能与资源同步到两端同一受控绝对路径,SKILL 正文使用同一作用域的官方 skills.get() 原文,原 frontmatter、资源文件字节与可执行位保留;项目 AGENTS.md/CLAUDE.md 原文镜像后由 CLI 原生读取。Claude 使用原生插件技能入口,Codex 使用原生 skills/extraRoots/set;新轮次与冷恢复均更新原生目录。实际文件和命令仍由员工执行器执行。纯正文虚拟技能保留官方正文;未提供可镜像出口的 URL/opaque 资源明确报既有上下文不可用;主机原有技能中写死的任意主机脚本路径尚未证明可在员工端使用。
|
|
8
|
+
|
|
9
|
+
Claude 原生 Agent/TaskStop 与 Codex 原生子代理首轮可用。Codex 只把技能、办公依赖必需桥工具置于 employee 首轮分组,DSH 子代理及其余工具在 dsh 分组按需发现。保留 B6 原生插话、冷恢复、防重放、U1 每次 prompt 用量和原生型号、推理档、权限设置。含桥主机需 2.2.2-aw.17(Codex 0.162.0);不含桥通道不变。没有新增设置项或自定义错误码。
|
|
5
10
|
|
|
6
11
|
## 办公依赖与开工计时(O1,2026-11-15)
|
|
7
12
|
|
|
@@ -13,7 +18,7 @@ S7 按 owner 11-15 裁定撤除:删除 `local-user-turn` 及其轮次证明、
|
|
|
13
18
|
|
|
14
19
|
## 含工具桥预发布线
|
|
15
20
|
|
|
16
|
-
本包为 `0.9.0-toolbridge.
|
|
21
|
+
本包为 `0.9.0-toolbridge.37-rc.4`,从 `v0.9.0-toolbridge.14` 派生,使用 `host-toolbridge` 发布渠道。员工安装由连接组件提供的「AI 写作工作台(含工具桥)」总包 `@ai-workbench/workbench-toolbridge@0.3.7`;0.3.8 尚未转正式,与不含工具桥的版本二选一。
|
|
17
22
|
|
|
18
23
|
本轮增加两家运行中插话(DSH 原生 nextStep),保留官方队列和原话;明确 followup 仍排下一轮。Codex 含桥组件需 `2.2.2-aw.12`,Claude 仍为官方 `0.94.0`。插件确定消息未发出时保留排队资格;送达未确认时明确报错且不重放。已注入旧正文不能撤回,编辑版下一步骤交付。
|
|
19
24
|
|
|
@@ -40,7 +45,7 @@ Codex 需要 S 后续安装的独立受保护命令 `/usr/local/aw-host/bin/code
|
|
|
40
45
|
|
|
41
46
|
Claude 员工MCP的stdio通道保持在当前原生客户端上。底层员工SSH/Unix流断开时,在途工具只返回结果未知,不重放;连接恢复后下一次新工具调用串行重新连接并初始化。同一DSH会话无需新建;若连接/绑定已撤销或DSH桥工具在途结束本轮,网络恢复后在原会话发新消息,沿原生编号续接。只使用原已核验的设备/账户/绑定,不跨代偷接。
|
|
42
47
|
|
|
43
|
-
DSH技能工具仅使用DSH公布的目录,主机原生技能按各自原生指令加载;本机文件夹下主机 Claude 的主会话和子代理都能用原生 Skill 加载主机账户的用户级技能(0.9.0-toolbridge.20 起),技能里的 `!` 内联命令需要原生 Bash,原生 Bash
|
|
48
|
+
DSH技能工具仅使用DSH公布的目录,主机原生技能按各自原生指令加载;本机文件夹下主机 Claude 的主会话和子代理都能用原生 Skill 加载主机账户的用户级技能(0.9.0-toolbridge.20 起),技能里的 `!` 内联命令需要原生 Bash,原生 Bash 仍关闭,所以不会在主机执行,该技能加载失败并明确报错;桥接工具描述仅使用 DSH 原文;同步后的原生技能入口提供资源路径。
|
|
44
49
|
|
|
45
50
|
Claude 本机 Bash 会单独消费员工桥代理的控制诊断,不把它交给模型当作命令输出;真实传输中断仍提示结果未知。命令自身的标准输出、标准错误与退出码照常返回。非UTF-8流不拒绝,按原始字节base64返回并增加对应stdoutEncoding/stderrEncoding标记;有效UTF-8格式不变。没有新增原始字节上限,编码后的消息沿既有512MB容量核验。
|
|
46
51
|
|
|
@@ -90,7 +95,7 @@ Codex 员工端只使用随包提供的原生组件,通道等待本次组件
|
|
|
90
95
|
|
|
91
96
|
模型目录在官方启动读取时获取,并在连接变为 connected 时经官方注册刷新;官方菜单打开或重试读取缓存是 DSH 官方限制,本插件不改官方菜单或核心。真正不支持的推理档位由 DSH 预检,其英文提示保留为观察项。
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
U1(本版保留):Codex 和 Claude 的 ACP 用量按本次 prompt 逐轮全额结算一次,不减历史基线。冷接回只减同一 prompt 已在 DSH 落盘的部分;可靠终态先持久化,原 broker 回收后仍可补记未落盘用量。订阅额度卡读取官方额度窗口,不由 token 数推算百分比。旧 I3 系统规则传递机制已删除。
|
|
94
99
|
|
|
95
100
|
T3(0.9.0-toolbridge.33):在已连接、当前员工目录已接纳的 Codex 路径,同轮登录核验与端点准备重叠;两项均成功并再次核对目标、连接代次与物理目录后才开工,每轮核验与正常完成后结束 broker 的做法保留。当前输入已完整列出同一技能目录时,skill 工具省去重复名字数组;目录不完整或只有历史目录时保留原快照。未改变首轮工具可见性,没有新增设置、限制或错误码。本机受控时延与工具字节测量不代表远机实测速率或实际 API token 节省;DSH 原生本轮因缺独立登录未测。
|
|
96
101
|
|
package/dist/acp.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NativeSessionContent } from './native-content-transport.ts';
|
|
1
2
|
import type { StartupTiming } from './startup-timing.ts';
|
|
2
3
|
import { CloseDiagnostics, type CloseCause } from './close-diagnostics.ts';
|
|
3
4
|
import * as stable from '@agentclientprotocol/sdk';
|
|
@@ -40,10 +41,10 @@ export interface EmployeeExecutionMeta {
|
|
|
40
41
|
acpMaxMessageBytes: number;
|
|
41
42
|
}
|
|
42
43
|
export interface AcpStartContext {
|
|
44
|
+
nativeContent?: NativeSessionContent;
|
|
43
45
|
initialModel?: string;
|
|
44
46
|
toolBridgeServers?: EmployeeRouting['mcpServers'];
|
|
45
|
-
|
|
46
|
-
systemPromptChanged?: boolean;
|
|
47
|
+
customInstructions?: string;
|
|
47
48
|
codexNewSessionOnly?: true;
|
|
48
49
|
employeeExecution?: EmployeeExecutionMeta;
|
|
49
50
|
employeeRouting?: EmployeeRouting;
|
|
@@ -129,7 +130,7 @@ export declare class AcpSession {
|
|
|
129
130
|
setHooks(hooks: AcpHooks): void;
|
|
130
131
|
get closed(): Promise<void>;
|
|
131
132
|
start(cwd: string, resumeId?: string, signal?: AbortSignal, context?: AcpStartContext, prompt?: acp.ContentBlock[]): Promise<string>;
|
|
132
|
-
/**
|
|
133
|
+
/** 续接保留原生线程,不向既有历史注入插件规则。 */
|
|
133
134
|
prompt(input: string | acp.ContentBlock[], signal?: AbortSignal): Promise<acp.StopReason>;
|
|
134
135
|
steer(prompt: acp.ContentBlock[], signal?: AbortSignal, isCurrent?: () => boolean, maxBytes?: number): Promise<'injected' | 'promptRequired'>;
|
|
135
136
|
close(cause?: CloseCause, error?: Error): void;
|
package/dist/acp.js
CHANGED
|
@@ -34,7 +34,7 @@ t=$(printf '%s' "$t" | z)
|
|
|
34
34
|
printf '%s\\n' "$c" | while IFS= read -r v; do v=\${v#C}; case $v in ''|*[!A-Za-z0-9._+@/\\ -]*) echo hit;; *) [ "$(printf '%s' "$v" | z)" = "$t" ] && echo hit;; esac; done | /usr/bin/grep -q hit && deny
|
|
35
35
|
exit 0`;
|
|
36
36
|
const claudeSettings = () => ({ hooks: { PreToolUse: [{ matcher: 'Agent', hooks: [{ type: 'command', command: cloudSubagentHook }] }] } });
|
|
37
|
-
function employeeClaudeOptions(routing) { return { tools: ['Agent', 'TaskStop', 'Skill'], disallowedTools: ['Read', 'Write', 'Edit', 'Glob', 'Grep', 'Bash'], toolAliases: structuredClone(routing.toolAliases), settings: claudeSettings() }; }
|
|
37
|
+
function employeeClaudeOptions(routing) { return { tools: ['Agent', 'TaskStop', 'Skill', 'ToolSearch'], disallowedTools: ['Read', 'Write', 'Edit', 'Glob', 'Grep', 'Bash'], toolAliases: structuredClone(routing.toolAliases), settings: claudeSettings() }; }
|
|
38
38
|
const permissionRanks = { claude: { plan: 0, default: 1, acceptEdits: 1, bypassPermissions: 2 }, codex: { 'read-only': 0, 'workspace-write': 1, agent: 1, 'agent-full-access': 2 } };
|
|
39
39
|
/** ACP v1 with explicitly negotiated SDK 2.0 lifecycle/context extensions. */
|
|
40
40
|
export class AcpSession {
|
|
@@ -556,22 +556,20 @@ export class AcpSession {
|
|
|
556
556
|
this.steeringSupported = steering?.supported === true && (!context?.codexNewSessionOnly || steering.idleBehavior === 'promptRequired');
|
|
557
557
|
if (this.employeeMeta) {
|
|
558
558
|
const policy = record(hello._meta?.awEmployeeExecution);
|
|
559
|
-
if (!this.hooks.employeeExecution || !policy || Object.keys(policy).length !== (context?.toolBridgeServers ? 6 : 5) || context?.toolBridgeServers && policy.mcpBridge !== 1 || policy.version !== 1 || policy.nativeCliVersion !== '0.
|
|
559
|
+
if (!this.hooks.employeeExecution || !policy || Object.keys(policy).length !== (context?.toolBridgeServers ? 6 : 5) || context?.toolBridgeServers && policy.mcpBridge !== 1 || policy.version !== 1 || policy.nativeCliVersion !== '0.162.0' || policy.native !== true || policy.perRpcGate !== true || policy.noHostFallback !== true)
|
|
560
560
|
throw new NeedError('EMPLOYEE_EXECUTION_UNSUPPORTED', '当前主机尚不支持在你的电脑执行Codex原生工具,本轮没有执行。', 'Codex员工端原生执行适配器与明确能力声明');
|
|
561
561
|
this.employeeNegotiated = true;
|
|
562
|
-
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.
|
|
562
|
+
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.162.0', noHostFallback: true, agentConfigSource: 'host CODEX_HOME', unsupportedLocalFeatures: ['http-mcp-execution', 'hooks', 'plugins', 'cold-resume', 'slash-commands', 'host-file-reports'] } });
|
|
563
563
|
}
|
|
564
|
-
const systemPrompt = context?.systemPrompt;
|
|
565
|
-
const resumePolicy = record(this.negotiated._meta?.aiWorkbenchSystemPrompt);
|
|
566
|
-
const nativeContext = !!resumeId && !!context?.codexNewSessionOnly && resumePolicy?.version === 2;
|
|
567
564
|
const initialPolicy = record(this.negotiated._meta?.aiWorkbenchInitialModel);
|
|
568
565
|
const initialModel = !resumeId && context?.codexNewSessionOnly && initialPolicy?.version === 1 && initialPolicy?.scope === 'new-session' ? context.initialModel : undefined;
|
|
569
566
|
this.codexNewSessionOnly = !!context?.codexNewSessionOnly;
|
|
570
567
|
if (prompt)
|
|
571
568
|
this.validatePrompt(prompt);
|
|
572
569
|
const routing = context?.employeeRouting ? structuredClone(context.employeeRouting) : undefined;
|
|
573
|
-
const
|
|
574
|
-
const
|
|
570
|
+
const plugins = context?.nativeContent ? [{ type: 'local', path: context.nativeContent.claudePluginRoot }] : undefined;
|
|
571
|
+
const claudeCode = routing ? { options: { ...employeeClaudeOptions(routing), ...(plugins ? { plugins } : {}) } } : this.codexNewSessionOnly ? undefined : { options: { settings: claudeSettings(), ...(plugins ? { plugins } : {}) } };
|
|
572
|
+
const params = { cwd, mcpServers: context?.toolBridgeServers ? structuredClone(context.toolBridgeServers) : routing ? structuredClone(routing.mcpServers) : [], ...((claudeCode || this.employeeMeta || initialModel || context?.customInstructions !== undefined || context?.nativeContent) ? { _meta: { ...(this.codexNewSessionOnly && context?.nativeContent ? { awNativeSkills: { root: context.nativeContent.codexSkillsRoot } } : {}), ...(context?.customInstructions === undefined ? {} : { jetbrains: { air: { customInstructions: context.customInstructions } } }), ...(initialModel ? { awInitialModel: { version: 1, model: initialModel } } : {}), ...(this.employeeMeta ? { awEmployeeExecution: this.employeeMeta } : {}), ...(claudeCode ? { claudeCode } : {}) } } : {}) };
|
|
575
573
|
const configRevision = this.resetConfiguration();
|
|
576
574
|
const restore = async (operation) => {
|
|
577
575
|
try {
|
|
@@ -637,7 +635,7 @@ export class AcpSession {
|
|
|
637
635
|
signal?.removeEventListener('abort', abort);
|
|
638
636
|
}
|
|
639
637
|
}
|
|
640
|
-
/**
|
|
638
|
+
/** 续接保留原生线程,不向既有历史注入插件规则。 */
|
|
641
639
|
async prompt(input, signal) {
|
|
642
640
|
if (!this.ready || !this.sessionId)
|
|
643
641
|
throw new NeedError('SESSION_REQUIRED', '我需要先建立远端会话', 'ACP 会话');
|
package/dist/claude-local.js
CHANGED
|
@@ -49,7 +49,7 @@ export function createClaudeLocalProvider(options) {
|
|
|
49
49
|
closeDiagnostics.bind(event => details.record(event));
|
|
50
50
|
request.closeDiagnostics = closeDiagnostics;
|
|
51
51
|
details.record({ kind: 'session', severity: 'info', code: 'CLAUDE_EMPLOYEE_VALIDATION_POLICY', summary: '本机执行不可改到主机:每轮开始从L读取一次本机工作区上下文,核验所选物理目录、N端点与主机目标,并新建本轮工具通道。之后不逐消息、审批或工具重复核验;既有连接、位置、网络事件和通道关闭只终止本轮,下一轮重新核验。' });
|
|
52
|
-
const openRequest = () => ({ ...request, detailChannel: details, bindingId: item.bindingId, workspaceId: workspace.workspaceId, bindingRevision: state.revision });
|
|
52
|
+
const openRequest = () => ({ ...request, detailChannel: details, bindingId: item.bindingId, workspaceId: workspace.workspaceId, nativeEmployeeCwd: workspace.directory.path, bindingRevision: state.revision });
|
|
53
53
|
let io;
|
|
54
54
|
const transport = async () => { if (!io) {
|
|
55
55
|
const name = '@ai-workbench/connect';
|
|
@@ -105,7 +105,7 @@ export function createClaudeLocalProvider(options) {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
const executionSignal = modelLifetime.signal;
|
|
108
|
-
row.runtime = { ...underlying, localDirectory: { ...workspace.directory }, closeDiagnostics, cwd: workspace.directory.path, details, connection: { ...connection }, binding: { bindingId: item.bindingId, workspaceId: workspace.workspaceId, revision: state.revision }, execution: { hostCwd: target.session.root, routing: mcp.routing, notice: NOTICE, signal: executionSignal, scope: { source: 'local', cwd: workspace.directory.path, hostCwd: target.session.root, uid: lease.target.endpoint.remoteUid, claudeAcpVersion: '0.94.0', sdkVersion: '0.3.303', unsupported: ['internal-direct-calls', 'binary-read', 'background-shell'] }, validate: async (signal) => { signal?.throwIfAborted(); lease.signal.throwIfAborted(); executionSignal.throwIfAborted(); }, beginTurn: async (signal) => { signal?.throwIfAborted(); lease.signal.throwIfAborted(); executionSignal.throwIfAborted(); if (row.closing || row.active)
|
|
108
|
+
row.runtime = { ...underlying, localDirectory: { ...workspace.directory }, closeDiagnostics, cwd: workspace.directory.path, details, connection: { ...connection }, binding: { bindingId: item.bindingId, workspaceId: workspace.workspaceId, revision: state.revision }, execution: { hostCwd: base.nativeContent?.hostCwd ?? target.session.root, routing: mcp.routing, notice: NOTICE, signal: executionSignal, scope: { source: 'local', cwd: workspace.directory.path, hostCwd: base.nativeContent?.hostCwd ?? target.session.root, uid: lease.target.endpoint.remoteUid, claudeAcpVersion: '0.94.0', sdkVersion: '0.3.303', unsupported: ['internal-direct-calls', 'binary-read', 'background-shell'] }, validate: async (signal) => { signal?.throwIfAborted(); lease.signal.throwIfAborted(); executionSignal.throwIfAborted(); }, beginTurn: async (signal) => { signal?.throwIfAborted(); lease.signal.throwIfAborted(); executionSignal.throwIfAborted(); if (row.closing || row.active)
|
|
109
109
|
throw failure('TURN_BUSY'); row.active = { signal, details: row.details }; }, endTurn: () => { row.active = undefined; } }, dispose: cause => close(false, cause), detach: cause => close(true, cause) };
|
|
110
110
|
entries.set(request.sessionId, row);
|
|
111
111
|
const endpointAborted = () => {
|
package/dist/cold-protocol.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare function recoverColdProtocol(record: ColdRound, store: ColdStore,
|
|
|
11
11
|
maxMessageBytes: number;
|
|
12
12
|
signal?: AbortSignal;
|
|
13
13
|
markerId?: string;
|
|
14
|
+
notice?: (text: string) => void;
|
|
14
15
|
cancelOnly?: boolean;
|
|
15
16
|
}): AsyncGenerator<StreamChunk>;
|
|
16
17
|
/** 本地未派发取消的证明来自写前记录或S消息回执,不伪造原生RPC终态。 */
|
package/dist/cold-protocol.js
CHANGED
|
@@ -63,7 +63,7 @@ const LOGIN_ENDED = '\n上一轮因主机会话的登录已失效没有完成,
|
|
|
63
63
|
/** The checkpoint that commits the original round and lets the next round resume its native thread. */
|
|
64
64
|
function coldPointer(record, outputAfter) {
|
|
65
65
|
const snapshot = record.meta;
|
|
66
|
-
return { ...(snapshot.hostSource ? { hostSource: snapshot.hostSource } : {}), ...(snapshot.modelConfiguration ? { modelConfiguration: snapshot.modelConfiguration } : {}), version: 2, agent: record.provider,
|
|
66
|
+
return { ...(snapshot.hostSource ? { hostSource: snapshot.hostSource } : {}), ...(snapshot.modelConfiguration ? { modelConfiguration: snapshot.modelConfiguration } : {}), version: 2, agent: record.provider, 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: outputAfter };
|
|
67
67
|
}
|
|
68
68
|
export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
69
69
|
options.signal?.throwIfAborted();
|
|
@@ -91,7 +91,7 @@ export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
|
91
91
|
for (const chunk of ended.acpResponse(record.terminal.value))
|
|
92
92
|
if (chunk.type === 'usage')
|
|
93
93
|
yield* remainingUsage(chunk.usage, prefix.usage);
|
|
94
|
-
|
|
94
|
+
options.notice?.(HOST_ROUND_ENDED);
|
|
95
95
|
yield* ended.flush();
|
|
96
96
|
yield { type: 'finish', reason: { kind: 'stop' }, replayState: { response: coldPointer(record, record.terminalAfter ?? record.outputStart ?? record.outputAfter) } };
|
|
97
97
|
return;
|
|
@@ -272,13 +272,20 @@ export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
|
272
272
|
})();
|
|
273
273
|
// Keep the reader alive independently while outgoing controls await a new replay barrier.
|
|
274
274
|
activePump = pump;
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
if (record.meta.prelude) {
|
|
276
|
+
trim.take('text', record.meta.prelude);
|
|
277
|
+
options.notice?.(record.meta.prelude);
|
|
278
|
+
}
|
|
277
279
|
mapper.flush();
|
|
278
280
|
let nativeUpdates = 0, noticeIndex = 0;
|
|
279
281
|
const notices = function* () { while (record.localNotices?.[noticeIndex]?.beforeUpdate === nativeUpdates) {
|
|
280
282
|
const notice = record.localNotices[noticeIndex++];
|
|
281
|
-
|
|
283
|
+
if (notice.kind === undefined) {
|
|
284
|
+
trim.take('text', notice.text);
|
|
285
|
+
options.notice?.(notice.text);
|
|
286
|
+
}
|
|
287
|
+
else
|
|
288
|
+
yield* projection(mapper.text(notice.text, notice.kind === 'reasoning'));
|
|
282
289
|
} };
|
|
283
290
|
yield* notices();
|
|
284
291
|
for (;;) {
|
|
@@ -337,7 +344,7 @@ export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
|
337
344
|
if (options.markerId && acpNeed(new acp.RequestError(m.error.code, m.error.message, m.error.data)).code === 'LOGIN_REQUIRED') {
|
|
338
345
|
await options.io.run(command(['kill', record.brokerId, '--if-instance', record.instanceId]), options.signal).catch(() => { options.signal?.throwIfAborted(); console.warn('[remote-agent] 旧主机会话暂未清理,将由主机自动回收'); });
|
|
339
346
|
yield* output.flush();
|
|
340
|
-
|
|
347
|
+
options.notice?.(LOGIN_ENDED);
|
|
341
348
|
yield* output.flush();
|
|
342
349
|
yield { type: 'finish', reason: { kind: 'stop' }, replayState: { response: coldPointer(record, broker.lastSequence) } };
|
|
343
350
|
return;
|
|
@@ -360,7 +367,7 @@ export async function* recoverColdProtocol(record, store, prefix, options) {
|
|
|
360
367
|
throw new LlmError(message, 'ABORTED');
|
|
361
368
|
}
|
|
362
369
|
if (m.result.stopReason === 'refusal')
|
|
363
|
-
|
|
370
|
+
options.notice?.('远端拒绝此请求,未执行。');
|
|
364
371
|
trim.finish();
|
|
365
372
|
yield* output.flush();
|
|
366
373
|
delivered = true;
|
package/dist/cold-recovery.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare class ColdRecovery {
|
|
|
33
33
|
brokerControlMaxBytes?: number;
|
|
34
34
|
}, provided?: {
|
|
35
35
|
store?: ColdStore;
|
|
36
|
+
notice?: (row: ColdRound, text: string) => Promise<void>;
|
|
36
37
|
readSource?: (id: string) => Promise<unknown>;
|
|
37
38
|
io?: (r: ColdRound) => BrokerIo;
|
|
38
39
|
argv?: SshArgv;
|
package/dist/cold-recovery.js
CHANGED
|
@@ -351,7 +351,7 @@ export class ColdRecovery {
|
|
|
351
351
|
const m = row.meta;
|
|
352
352
|
if (!row.nativeId)
|
|
353
353
|
return { index, pointer: undefined };
|
|
354
|
-
return { index, pointer: { version: 2, agent: row.provider, dshSessionId: row.sessionId, identity: m.identity, cwd: m.cwd, sessionId: row.nativeId,
|
|
354
|
+
return { index, pointer: { version: 2, agent: row.provider, dshSessionId: row.sessionId, identity: m.identity, cwd: m.cwd, sessionId: row.nativeId, ...(m.binding ? { bindingId: m.binding.bindingId, workspaceId: m.binding.workspaceId } : {}), ...(m.hostSource ? { hostSource: m.hostSource } : {}), ...(m.modelConfiguration ? { modelConfiguration: m.modelConfiguration } : {}) } };
|
|
355
355
|
}
|
|
356
356
|
release(sessionId, id) { if (this.live.get(sessionId) === id)
|
|
357
357
|
this.live.delete(sessionId); }
|
|
@@ -578,7 +578,7 @@ export class ColdRecovery {
|
|
|
578
578
|
revoke();
|
|
579
579
|
signal.throwIfAborted();
|
|
580
580
|
this.live.set(row.sessionId, row.id);
|
|
581
|
-
yield* recoverColdProtocol(row, this.store, { blocks, usage }, { io, maxFrameBytes: this.config().brokerMaxFrameBytes, maxMessageBytes: this.config().acpMaxMessageBytes, signal, markerId: selected.markerId });
|
|
581
|
+
yield* recoverColdProtocol(row, this.store, { blocks, usage }, { io, maxFrameBytes: this.config().brokerMaxFrameBytes, maxMessageBytes: this.config().acpMaxMessageBytes, signal, markerId: selected.markerId, notice: text => { void this.provided?.notice?.(row, text).catch(() => console.warn('[remote-agent] 恢复诊断未保存')); } });
|
|
582
582
|
if (revoked)
|
|
583
583
|
throw revoked;
|
|
584
584
|
}
|
package/dist/cold-store.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { symbols } from '@deepseek-ai/cordis';
|
|
2
|
+
import { scopeOf, scopeChainOf } from '@deepseek-ai/dsh-scope';
|
|
3
|
+
/** Only active official instruction plugins' explicit raw profile overrides. */
|
|
4
|
+
export function readCustomInstructions(context, scope) {
|
|
5
|
+
const editor = context.get('configEditor');
|
|
6
|
+
if (typeof editor?.configuration !== 'function')
|
|
7
|
+
return;
|
|
8
|
+
const chain = scope?.ctx ? scopeChainOf(scopeOf(scope.ctx)) : [];
|
|
9
|
+
const rows = editor.configuration().filter(({ entry }) => !entry.disabled && !!entry.fiber);
|
|
10
|
+
const personas = rows.filter(({ entry }) => entry.options.name === '@deepseek-ai/dsh-persona' && entry.context && chain.includes(scopeOf(entry.context)));
|
|
11
|
+
personas.sort((a, b) => chain.indexOf(scopeOf(a.entry.context)) - chain.indexOf(scopeOf(b.entry.context)));
|
|
12
|
+
const original = (value) => value && typeof value === 'object' ? value[symbols.original] ?? value : value;
|
|
13
|
+
const registry = original(context.get('systemPrompt'));
|
|
14
|
+
const globals = rows.filter(({ entry }) => entry.options.name === '@deepseek-ai/dsh-system-prompt' && (!entry.context || original(entry.context.get('systemPrompt')) === registry));
|
|
15
|
+
const selected = personas[0] ?? globals[0];
|
|
16
|
+
if (!selected)
|
|
17
|
+
return;
|
|
18
|
+
const keys = selected.entry.options.name === '@deepseek-ai/dsh-persona' ? ['prefix', 'suffix'] : ['personaPrefix', 'personaSuffix'];
|
|
19
|
+
const parts = keys.filter(key => Object.hasOwn(selected.override, key) && typeof selected.override[key] === 'string').map(key => selected.override[key]);
|
|
20
|
+
return parts.length ? parts.join('') : undefined;
|
|
21
|
+
}
|
package/dist/employee-mcp.js
CHANGED
|
@@ -8,7 +8,7 @@ import { createEmployeeTools } from "./employee-tools.js";
|
|
|
8
8
|
import { employeeRouting } from "./employee-relay.js";
|
|
9
9
|
import { NeedError } from "./remote.js";
|
|
10
10
|
const string = { type: 'string' }, integer = { type: 'integer' }, boolean = { type: 'boolean' };
|
|
11
|
-
function schema(name, properties, required) { return { name,
|
|
11
|
+
function schema(name, properties, required) { return { name, _meta: { 'anthropic/alwaysLoad': true }, inputSchema: { type: 'object', properties, required, additionalProperties: false } }; }
|
|
12
12
|
export const EMPLOYEE_MCP_TOOLS = [
|
|
13
13
|
schema('Read', { file_path: string, offset: integer, limit: integer, pages: string }, ['file_path']),
|
|
14
14
|
schema('Write', { file_path: string, content: string }, ['file_path', 'content']),
|
|
@@ -140,7 +140,7 @@ export async function openEmployeeMcp(options) {
|
|
|
140
140
|
mcp.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
141
141
|
const active = options.activeSignal();
|
|
142
142
|
if (!active || active.aborted)
|
|
143
|
-
return { isError: true, content: [{ type: 'text', text: 'EMPLOYEE_NO_ACTIVE_TURN
|
|
143
|
+
return { isError: true, content: [{ type: 'text', text: JSON.stringify({ code: 'EMPLOYEE_NO_ACTIVE_TURN' }) }] };
|
|
144
144
|
const signal = AbortSignal.any([active, extra.signal, transport.signal, options.lease.signal]);
|
|
145
145
|
if (options.bridge?.isBridge(request.params.name))
|
|
146
146
|
return options.bridge.call(request.params.name, request.params.arguments ?? {}, signal);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const EMPLOYEE_NATIVE: Readonly<{
|
|
2
|
-
version: "0.
|
|
2
|
+
version: "0.162.0";
|
|
3
3
|
platform: "darwin";
|
|
4
4
|
arch: "arm64";
|
|
5
5
|
package: "@openai/codex-darwin-arm64";
|
|
6
|
-
packageVersion: "0.
|
|
6
|
+
packageVersion: "0.162.0-darwin-arm64";
|
|
7
7
|
triple: "aarch64-apple-darwin";
|
|
8
8
|
}>;
|
|
9
9
|
/** Resolve the installed executable; no per-turn hash or version probe. */
|
package/dist/employee-native.js
CHANGED
|
@@ -3,7 +3,7 @@ import { dirname, join } from 'node:path';
|
|
|
3
3
|
import { NeedError } from "./remote.js";
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
5
5
|
let installedPath;
|
|
6
|
-
export const EMPLOYEE_NATIVE = Object.freeze({ version: '0.
|
|
6
|
+
export const EMPLOYEE_NATIVE = Object.freeze({ version: '0.162.0', platform: 'darwin', arch: 'arm64', package: '@openai/codex-darwin-arm64', packageVersion: '0.162.0-darwin-arm64', triple: 'aarch64-apple-darwin' });
|
|
7
7
|
/** Resolve the installed executable; no per-turn hash or version probe. */
|
|
8
8
|
export async function resolveEmployeeNative(ports = {}) {
|
|
9
9
|
if ((ports.platform ?? process.platform) !== EMPLOYEE_NATIVE.platform || (ports.arch ?? process.arch) !== EMPLOYEE_NATIVE.arch)
|
|
@@ -185,7 +185,7 @@ export function createEmployeeProvider(get, options, agent) {
|
|
|
185
185
|
if (!options.open)
|
|
186
186
|
throw fail('RUNTIME_REQUIRED');
|
|
187
187
|
// Host cwd is only the protected agent bootstrap/config directory. Native tools use admitted.cwd.
|
|
188
|
-
const openHost = () => options.open(target, { name: 'employee', path: target.projectRoot }, { ...request, signal: roundSignal, agent, employeeScope: scope, bindingId: admitted.bindingId, workspaceId: admitted.workspaceId, bindingRevision: state.revision, closeDiagnostics, detailChannel: details, resumeSessionId: request.resumeSessionId });
|
|
188
|
+
const openHost = () => options.open(target, { name: 'employee', path: target.projectRoot }, { ...request, signal: roundSignal, agent, employeeScope: scope, nativeEmployeeCwd: admitted.cwd, bindingId: admitted.bindingId, workspaceId: admitted.workspaceId, bindingRevision: state.revision, closeDiagnostics, detailChannel: details, resumeSessionId: request.resumeSessionId });
|
|
189
189
|
const host = opening = await (request.startupTiming?.run('broker-open', openHost) ?? openHost());
|
|
190
190
|
roundSignal.throwIfAborted();
|
|
191
191
|
// The old per-RPC identity check belongs once at the end of this round's opening.
|
package/dist/employee-relay.js
CHANGED
|
@@ -156,7 +156,7 @@ export const EMPLOYEE_RELAY_PYTHON = EMPLOYEE_TARGET_PYTHON + String.raw `
|
|
|
156
156
|
reply={"jsonrpc":"2.0","result":self.initialized} if method=="initialize" else await self.request(process,message)
|
|
157
157
|
await self.emit({**reply,"id":front})
|
|
158
158
|
except (OSError,Disconnected):
|
|
159
|
-
text="
|
|
159
|
+
text=json.dumps({"code":-32603,"data":{"result":"unknown","replayed":False}},separators=(",",":"))
|
|
160
160
|
reply={"result":{"isError":True,"content":[{"type":"text","text":text}]}} if method=="tools/call" else {"error":{"code":-32603,"message":text}}
|
|
161
161
|
await self.emit({"jsonrpc":"2.0","id":front,**reply})
|
|
162
162
|
async def relay():
|
package/dist/employee-tools.js
CHANGED
|
@@ -283,7 +283,7 @@ export function createEmployeeTools(options) {
|
|
|
283
283
|
catch (error) {
|
|
284
284
|
const code = error instanceof NeedError ? error.code : signal.aborted ? 'EMPLOYEE_CANCELLED_UNKNOWN' : typeof error?.code === 'string' ? 'EMPLOYEE_IO_' + error.code : 'EMPLOYEE_OPERATION_FAILED';
|
|
285
285
|
detail(submitted && signal.aborted ? 'unknown' : 'failed', code);
|
|
286
|
-
return { isError: true, content: [{ type: 'text', text: code
|
|
286
|
+
return { isError: true, content: [{ type: 'text', text: JSON.stringify({ code }) }] };
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
return {
|
package/dist/index.d.ts
CHANGED
|
@@ -70,8 +70,6 @@ export declare class CodexRemoteAdapter extends LlmAdapter {
|
|
|
70
70
|
private shuttingDown;
|
|
71
71
|
private detached;
|
|
72
72
|
private modelPresentation;
|
|
73
|
-
private employeeNoticeSessions;
|
|
74
|
-
private pendingEmployeeNotices;
|
|
75
73
|
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, steeringReceipts?: SteeringReceipts | undefined, coldRecovery?: ColdRecovery | undefined);
|
|
76
74
|
providerInfo(provider: string): {
|
|
77
75
|
id: string;
|