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,或经过验证的自定义解释器。
93 lines
2.8 KiB
TypeScript
93 lines
2.8 KiB
TypeScript
import { mkdtemp, rm } from 'node:fs/promises'
|
|
import { tmpdir } from 'node:os'
|
|
import { join } from 'node:path'
|
|
import { afterAll, describe, expect, it } from 'vitest'
|
|
import {
|
|
defaultLocalToolEnvironmentSettings,
|
|
type LocalToolEnvironmentSettings
|
|
} from '../src/shared/local-tool-environment-contracts'
|
|
import { LocalToolEnvironmentService } from '../src/main/local-tool-environment/local-tool-environment-service'
|
|
import { buildCredentialFilteredUserEnvironment } from '../src/main/agent/process-environment'
|
|
|
|
const runLive = process.env.GOODBUDDY_RUN_LIVE_TOOL_ENVIRONMENT === '1'
|
|
const describeLive = runLive ? describe : describe.skip
|
|
let root: string | undefined
|
|
|
|
afterAll(async () => {
|
|
if (root) {
|
|
await rm(root, { recursive: true, force: true })
|
|
}
|
|
})
|
|
|
|
describeLive('live local tool environment', () => {
|
|
it('installs and validates the pinned Managed Python artifact', async () => {
|
|
root = await mkdtemp(join(tmpdir(), 'goodbuddy-live-tools-'))
|
|
let settings: LocalToolEnvironmentSettings = {
|
|
...defaultLocalToolEnvironmentSettings,
|
|
artifactDownloadSource: 'native'
|
|
}
|
|
const service = new LocalToolEnvironmentService({
|
|
settingsStore: {
|
|
get: async () => ({ localToolEnvironment: settings }),
|
|
update: async (input: {
|
|
localToolEnvironment: LocalToolEnvironmentSettings
|
|
}) => {
|
|
settings = input.localToolEnvironment
|
|
return { localToolEnvironment: settings }
|
|
}
|
|
} as never,
|
|
binDirectory: join(root, 'bin'),
|
|
managedPythonRoot: join(root, 'managed-python'),
|
|
pythonArtifactCatalogPath: join(
|
|
process.cwd(),
|
|
'resources',
|
|
'tool-environment',
|
|
'managed-python-artifacts.json'
|
|
),
|
|
packagedNpmCliPath: join(
|
|
process.cwd(),
|
|
'node_modules',
|
|
'npm',
|
|
'bin',
|
|
'npm-cli.js'
|
|
),
|
|
packagedNpxCliPath: join(
|
|
process.cwd(),
|
|
'node_modules',
|
|
'npm',
|
|
'bin',
|
|
'npx-cli.js'
|
|
),
|
|
selectExecutable: async () => undefined,
|
|
electronExecutablePath: join(
|
|
process.cwd(),
|
|
'node_modules',
|
|
'electron',
|
|
'dist',
|
|
process.platform === 'win32' ? 'electron.exe' : 'electron'
|
|
),
|
|
baseEnvironment: buildCredentialFilteredUserEnvironment()
|
|
})
|
|
|
|
try {
|
|
await service.initialize()
|
|
const snapshot = await service.installPython()
|
|
expect(snapshot.managedPython).toMatchObject({
|
|
version: '3.13.15',
|
|
installed: true
|
|
})
|
|
expect(snapshot.diagnostics.python).toMatchObject({
|
|
available: true,
|
|
source: 'managed',
|
|
version: '3.13.15'
|
|
})
|
|
expect(snapshot.diagnostics.pip).toMatchObject({
|
|
available: true,
|
|
source: 'managed'
|
|
})
|
|
} finally {
|
|
await service.dispose()
|
|
}
|
|
}, 180_000)
|
|
})
|