Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(provider-sharing): 受邀者的 Codex 会话保留 shell 快照

Lizi5feeb591811b
diff --git a/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.native.test.ts b/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.native.test.ts
index 6e611024c6..f050c21b80 100644
--- a/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.native.test.ts
+++ b/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.native.test.ts
@@ -177,9 +177,11 @@ describe.skipIf(!binaryPath)('Codex device-hosted guest with a real app-server',
const enabledOutsideAllowlist = threadFeatures
.filter((feature) => feature.enabled && feature.stage !== 'removed' && !CODEX_DEVICE_HOSTED_GUEST_KEPT_FEATURES.has(feature.name))
.map((feature) => feature.name);
- if (guest)
- expect(enabledOutsideAllowlist).toEqual([]);
+ if (guest) expect(enabledOutsideAllowlist).toEqual([]);
else expect(enabledOutsideAllowlist.length).toBeGreaterThan(0);
+ // 两种会话里干活要用的功能都开着(命令、shell 快照、看图、子代理)。
+ const enabled = new Set(threadFeatures.filter((feature) => feature.enabled).map((feature) => feature.name));
+ expect(['shell_tool', 'unified_exec', 'shell_snapshot', 'view_image', 'multi_agent'].filter((name) => !enabled.has(name))).toEqual([]);
await handle.close();
expect(bodies.length).toBeGreaterThan(0);
diff --git a/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.test.ts b/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.test.ts
index 064b140ba7..4c339f95b9 100644
--- a/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.test.ts
+++ b/packages/maker-core/src/agents/codex/__tests__/device-hosted-guest.test.ts
@@ -61,6 +61,7 @@ const FEATURE_PAGES: Record<string, { data: Array<{ name: string; stage: string;
data: [
{ name: 'shell_tool', stage: 'stable', enabled: true },
{ name: 'view_image', stage: 'stable', enabled: true },
+ { name: 'shell_snapshot', stage: 'stable', enabled: true },
{ name: 'image_generation', stage: 'stable', enabled: true },
{ name: 'in_app_local_automation', stage: 'stable', enabled: true },
{ name: 'network_proxy', stage: 'beta', enabled: false },
@@ -304,7 +305,8 @@ describe('Codex device-hosted guest sessions', () => {
'features.network_proxy': false,
'features.future_local_tool': false,
});
- for (const key of ['features.shell_tool', 'features.view_image', 'features.item_ids', 'features.web_search_request']) {
+ // shell 快照由执行环境在受邀者电脑上生成,保持开启。
+ for (const key of ['features.shell_tool', 'features.view_image', 'features.shell_snapshot', 'features.item_ids', 'features.web_search_request']) {
expect(config[key]).toBeUndefined();
}
expect(fixture.request.mock.calls.filter(([method]) => method === Method.ExperimentalFeatureList)
diff --git a/packages/maker-core/src/agents/codex/device-hosted-guest.ts b/packages/maker-core/src/agents/codex/device-hosted-guest.ts
index 780254c4d6..6b7361f65d 100644
--- a/packages/maker-core/src/agents/codex/device-hosted-guest.ts
+++ b/packages/maker-core/src/agents/codex/device-hosted-guest.ts
@@ -69,11 +69,12 @@ export const CODEX_DEVICE_HOSTED_GUEST_THREAD_CONFIG: Readonly<Record<string, un
* 本机或项目配置打开的、Codex 升级新增的都一样。启动时从 app-server 取完整的功能清单
* (experimentalFeature/list),名单外的逐个关闭,见 codexGuestFeatureOverrides。
*
- * 留下的:命令、补丁与看图(经执行环境在受邀者电脑上执行),子代理,技能搜索,等待,审批与提问,
- * 目标与 Fast,以及连接、鉴权、上下文压缩本身需要的。生图不在内:它能按本机路径读参考图。
+ * 留下的:命令、补丁与看图(经执行环境在受邀者电脑上执行),shell 快照(由执行环境在受邀者电脑上
+ * 按受邀者自己的 shell 配置生成,关掉会让命令缺少 .zshrc 等设置的 PATH),子代理,技能搜索,等待,
+ * 审批与提问,目标与 Fast,以及连接、鉴权、上下文压缩本身需要的。生图不在内:它能按本机路径读参考图。
*/
export const CODEX_DEVICE_HOSTED_GUEST_KEPT_FEATURES: ReadonlySet<string> = new Set([
- 'shell_tool', 'unified_exec', 'unified_exec_tty', 'write_stdin_approval', 'view_image',
+ 'shell_tool', 'unified_exec', 'unified_exec_tty', 'write_stdin_approval', 'view_image', 'shell_snapshot',
'multi_agent', 'multi_agent_v2', 'skill_search', 'sleep_tool', 'mentions_v2',
'guardian_approval', 'guardian_reuse_parent_compaction', 'auth_elicitation', 'tool_call_mcp_elicitation',
'goals', 'fast_mode',