feat: add managed local tool environments
GoodBuddy can now provide managed Node.js and on-demand Python to local Skills and stdio MCP servers, or validate an explicitly selected custom interpreter. The Capabilities and tools settings page exposes source selection, diagnostics, installation progress, cancellation, and removal while new processes receive immutable PATH snapshots. Application settings migrate to v10. Local terminal and remote Host environments remain unchanged. Windows x64 native-source Node and Python paths are validated; OSS mirror publication, redistributed license resources, and the remaining native platform probes are recorded as release blockers. Release note: 新增工具执行环境,可为本机 Skills 和 stdio MCP 使用 GoodBuddy 托管的 Node.js、按需安装的 Python,或经过验证的自定义解释器。
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { LaunchEnvironmentProvider } from '../local-tool-environment/launch-environment-provider'
|
||||
|
||||
export const runtimeProviderEnvironmentNames = [
|
||||
'ANTHROPIC_API_KEY',
|
||||
'OPENAI_API_KEY',
|
||||
@@ -35,6 +37,7 @@ export function buildCredentialFilteredUserEnvironment(
|
||||
const upperName = name.toUpperCase()
|
||||
if (
|
||||
value !== undefined &&
|
||||
upperName !== 'ELECTRON_RUN_AS_NODE' &&
|
||||
!upperName.startsWith('GOODBUDDY_') &&
|
||||
!upperName.startsWith('FACTORY_') &&
|
||||
!userProcessCredentialEnvironmentNames.has(upperName)
|
||||
@@ -45,6 +48,39 @@ export function buildCredentialFilteredUserEnvironment(
|
||||
return environment
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies only the PATH prepared by the local tool environment. In
|
||||
* particular, arbitrary values from that snapshot must not bypass the
|
||||
* credential filtering performed by the caller.
|
||||
*/
|
||||
export function applyLaunchEnvironmentPath(
|
||||
environment: NodeJS.ProcessEnv,
|
||||
provider?: LaunchEnvironmentProvider
|
||||
): NodeJS.ProcessEnv {
|
||||
if (!provider) {
|
||||
return environment
|
||||
}
|
||||
const launchEnvironment = provider()
|
||||
const path =
|
||||
launchEnvironment.PATH ??
|
||||
launchEnvironment.Path ??
|
||||
launchEnvironment.path
|
||||
if (path === undefined) {
|
||||
return environment
|
||||
}
|
||||
const result = { ...environment }
|
||||
const existingPathName = Object.keys(environment).find(
|
||||
(name) => name.toLowerCase() === 'path'
|
||||
)
|
||||
for (const name of Object.keys(result)) {
|
||||
if (name.toLowerCase() === 'path') {
|
||||
delete result[name]
|
||||
}
|
||||
}
|
||||
result[existingPathName ?? 'PATH'] = path
|
||||
return result
|
||||
}
|
||||
|
||||
const runtimeEnvironmentAllowlist = [
|
||||
'PATH',
|
||||
'Path',
|
||||
|
||||
Reference in New Issue
Block a user