Files
goodbuddy/src/main/agent/process-environment.ts
T
mesalogo 27055693bf feat: add multi-terminal workbar and resizable sidebars
The assistant workbar now uses persistent application tabs with a permanent catalog entry point and supports multiple local or managed SSH terminals bound to the current project. Terminal sessions flow through the Main, preload, and renderer boundaries with bounded output, resize, lifecycle, and cleanup behavior.

The main sidebar and Magic Notes list now support pointer and keyboard resizing. Magic Notes can also hide and restore its list, remembers the chosen layout, and stacks its panes when the available width is narrow.

Closing a terminal tab ends its Shell session. Restored terminal tabs do not restart prior Shell processes and require an explicit reconnect.

Release note: 助手工作栏现可通过“+”打开多个本机或当前远程项目终端;主侧栏和魔法笔记列表支持拖拽调宽,魔法笔记列表可隐藏并记住布局。
2026-09-01 00:49:49 +08:00

112 lines
2.5 KiB
TypeScript

export const runtimeProviderEnvironmentNames = [
'ANTHROPIC_API_KEY',
'OPENAI_API_KEY',
'GOOGLE_GENERATIVE_AI_API_KEY',
'GEMINI_API_KEY',
'GROQ_API_KEY',
'AZURE_OPENAI_API_KEY',
'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY',
'AWS_SESSION_TOKEN',
'AWS_REGION',
'AWS_PROFILE',
'OPENROUTER_API_KEY',
'XAI_API_KEY',
'MISTRAL_API_KEY',
'COHERE_API_KEY'
] as const
const runtimeEnvironmentAllowlist = [
'PATH',
'Path',
'PATHEXT',
'SystemRoot',
'COMSPEC',
'TEMP',
'TMP',
'TMPDIR',
'HOME',
'USERPROFILE',
'APPDATA',
'LOCALAPPDATA',
'PROGRAMDATA',
'LANG',
'LC_ALL',
'LC_CTYPE',
'SSL_CERT_FILE',
'SSL_CERT_DIR',
'NODE_EXTRA_CA_CERTS',
'HTTP_PROXY',
'HTTPS_PROXY',
'NO_PROXY',
...runtimeProviderEnvironmentNames
] as const
export type RuntimeProfileCredential = {
name: 'ANTHROPIC_API_KEY' | 'OPENAI_API_KEY'
value: string
}
export const runtimePrivacyEnvironment: NodeJS.ProcessEnv = {
DO_NOT_TRACK: '1',
OTEL_EXPORTER_OTLP_ENDPOINT: '',
OTEL_EXPORTER_OTLP_HEADERS: '',
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: '',
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: '',
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: '',
OTEL_LOGS_EXPORTER: 'none',
OTEL_LOG_USER_PROMPTS: '0',
OTEL_METRICS_EXPORTER: 'none',
OTEL_SDK_DISABLED: 'true',
OTEL_TRACES_EXPORTER: 'none'
}
export function buildRuntimeEnvironment(
overrides: NodeJS.ProcessEnv,
source: NodeJS.ProcessEnv = process.env
): NodeJS.ProcessEnv {
const environment: NodeJS.ProcessEnv = {}
for (const name of runtimeEnvironmentAllowlist) {
if (source[name] !== undefined) {
environment[name] = source[name]
}
}
return {
...environment,
...overrides,
NODE_TLS_REJECT_UNAUTHORIZED: '0'
}
}
export function buildExplicitProfileRuntimeEnvironment(
overrides: NodeJS.ProcessEnv,
credential?: RuntimeProfileCredential,
source: NodeJS.ProcessEnv = process.env
): NodeJS.ProcessEnv {
const environment = buildRuntimeEnvironment(overrides, source)
for (const name of runtimeProviderEnvironmentNames) {
delete environment[name]
}
if (credential) {
environment[credential.name] = credential.value
}
return environment
}
export function buildControlledHarnessEnvironment(
dshHome: string,
source: NodeJS.ProcessEnv = process.env
): NodeJS.ProcessEnv {
const environment = buildExplicitProfileRuntimeEnvironment(
{
DSH_HOME: dshHome,
DSH_TELEMETRY_DISABLED: '1',
...runtimePrivacyEnvironment
},
undefined,
source
)
delete environment.NODE_TLS_REJECT_UNAUTHORIZED
return environment
}