Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(remote-agent): 以转义开头的相对沙箱 glob 不再被当成绝对路径丢掉
fmfsaisai1b6c6593c2ec
diff --git a/apps/desktop/src/main/remote-agent/controller/execServerRelay.ts b/apps/desktop/src/main/remote-agent/controller/execServerRelay.tsindex 1e0b7ef4f8..f117c19e49 100644--- a/apps/desktop/src/main/remote-agent/controller/execServerRelay.ts+++ b/apps/desktop/src/main/remote-agent/controller/execServerRelay.ts@@ -209,7 +209,8 @@ function mapSandboxEntry(entry: unknown, workspace: ExecutorWorkspace): unknown[const agentPath = agentPathFromUri(target.path);return deny && agentPath !== null && isLocalAbsolutePath(agentPath) ? [entry] : [];}- if (target.type === 'glob_pattern' && typeof target.pattern === 'string' && /^(?:[A-Za-z]:|[\\/])/.test(target.pattern)) {+ // 绝对 glob 只认盘符、`/` 开头与 UNC(`\\server`);单个 `\` 开头是 POSIX 的转义(`\*.pem`),按相对 glob 保留。+ if (target.type === 'glob_pattern' && typeof target.pattern === 'string' && /^(?:[A-Za-z]:|\/|\\\\)/.test(target.pattern)) {const local = workspace.localGlobFromAgent(target.pattern);if (local !== null) return [{ ...record, path: { ...target, pattern: local } }];return deny && isLocalAbsolutePath(target.pattern) ? [entry] : [];diff --git a/apps/desktop/src/main/remote-agent/executor/__tests__/virtualWorkspace.test.ts b/apps/desktop/src/main/remote-agent/executor/__tests__/virtualWorkspace.test.tsindex 92aa2a0a0b..7475508a23 100644--- a/apps/desktop/src/main/remote-agent/executor/__tests__/virtualWorkspace.test.ts+++ b/apps/desktop/src/main/remote-agent/executor/__tests__/virtualWorkspace.test.ts@@ -481,6 +481,8 @@ describe('virtual workspace', () => {{ path: { type: 'path', path: 'file:///home/agent/workspace' }, access: 'write' },{ path: { type: 'path', path: 'file:///home/agent/.codex/memories' }, access: 'write' },{ path: { type: 'path', path: 'file:///home/agent/.ssh' }, access: 'deny' },+ // 以转义开头的相对 glob(名字就叫 `*.pem` 的文件),不是以反斜杠开头的绝对路径。+ { path: { type: 'glob_pattern', pattern: '\\*.pem' }, access: 'deny' },] } },cwd: 'file:///home/agent/workspace',};@@ -489,6 +491,7 @@ describe('virtual workspace', () => {{ path: { type: 'path', path: pathToFileURL(project).href }, access: 'write' },// 任务电脑是 Windows 时 POSIX 路径不是本机路径,禁止条目也无从对应。...(process.platform === 'win32' ? [] : [{ path: { type: 'path', path: 'file:///home/agent/.ssh' }, access: 'deny' }]),+ { path: { type: 'glob_pattern', pattern: '\\*.pem' }, access: 'deny' },]);expect(params.sandbox.cwd).toBe(pathToFileURL(project).href);// 没有虚拟工作区(旧版对端)时沙箱原样转发,与之前一致。