fix: make goosed mcp paths container safe
This commit is contained in:
+14
-3
@@ -3,10 +3,18 @@ import { fileURLToPath } from 'node:url';
|
||||
import { resolveAgentGooseMode } from './policies.mjs';
|
||||
|
||||
/** Spawned as a separate Node process by goosed; must sit beside bundled portal runtime. */
|
||||
export function resolveSandboxMcpServerPath() {
|
||||
export function resolveSandboxMcpServerPath(overridePath) {
|
||||
const normalized = String(overridePath ?? '').trim();
|
||||
if (normalized) return normalized;
|
||||
return path.join(path.dirname(fileURLToPath(import.meta.url)), 'mindspace-sandbox-mcp.mjs');
|
||||
}
|
||||
|
||||
export function resolveSandboxMcpNodeExecPath(overridePath) {
|
||||
const normalized = String(overridePath ?? '').trim();
|
||||
if (normalized) return normalized;
|
||||
return process.execPath;
|
||||
}
|
||||
|
||||
export const CAPABILITY_CATALOG = [
|
||||
{
|
||||
key: 'shell',
|
||||
@@ -307,7 +315,7 @@ export function buildAgentExtensionPolicy(
|
||||
'工作区沙箱文件系统与用户私有数据空间。用户私有数据空间是当前用户唯一的 SQLite 数据库,适合问卷、表单、清单、调研数据和分析中间表;不要用于账号、计费、权限、审计、公开平台数据或跨用户数据。',
|
||||
display_name: 'sandbox-fs',
|
||||
bundled: false,
|
||||
cmd: sandboxMcp.nodeExecPath ?? process.execPath,
|
||||
cmd: resolveSandboxMcpNodeExecPath(sandboxMcp.nodeExecPath),
|
||||
// sandboxRoot passed as argv[2] so it works even if goosed doesn't forward envs
|
||||
args: [sandboxMcp.serverPath, sandboxMcp.sandboxRoot],
|
||||
// envs (goosed field name) as belt-and-suspenders backup
|
||||
@@ -350,7 +358,10 @@ export function buildAgentExtensionPolicy(
|
||||
extensions.push(makeExtension('platform', 'summon', summonTools));
|
||||
}
|
||||
}
|
||||
if (capabilities.code_sandbox) {
|
||||
const enableCodeExecutionExtension = /^(1|true|yes)$/i.test(
|
||||
process.env.TKMIND_ENABLE_CODE_EXECUTION_EXTENSION ?? '',
|
||||
);
|
||||
if (capabilities.code_sandbox && enableCodeExecutionExtension) {
|
||||
extensions.push(makeExtension('platform', 'code_execution', []));
|
||||
}
|
||||
if (capabilities.chat_recall) {
|
||||
|
||||
Reference in New Issue
Block a user