Skip to content

Commit 677e4ed

Browse files
authored
Update provider DB refresh flow and add manual model config refresh (#1421)
* feat(settings): refresh provider db * fix(chat): use command icon for slash suggestions * fix(agent): unify shell PATH resolution * fix(agent): merge env for background exec
1 parent d8e8fea commit 677e4ed

File tree

33 files changed

+1636
-331
lines changed

33 files changed

+1636
-331
lines changed

src/main/lib/agentRuntime/backgroundExecSessionManager.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'fs'
33
import path from 'path'
44
import { nanoid } from 'nanoid'
55
import logger from '@shared/logger'
6-
import { getShellEnvironment, getUserShell } from './shellEnvHelper'
6+
import { getUserShell } from './shellEnvHelper'
77
import { terminateProcessTree } from './processTree'
88
import { resolveSessionDir } from './sessionPaths'
99

@@ -121,7 +121,6 @@ export class BackgroundExecSessionManager {
121121
const config = getConfig()
122122
const sessionId = `bg_${nanoid(12)}`
123123
const { shell, args } = getUserShell()
124-
const shellEnv = await getShellEnvironment()
125124

126125
const sessionDir = resolveSessionDir(conversationId)
127126
if (sessionDir) {
@@ -134,11 +133,7 @@ export class BackgroundExecSessionManager {
134133

135134
const child = spawn(shell, [...args, command], {
136135
cwd,
137-
env: {
138-
...process.env,
139-
...shellEnv,
140-
...options?.env
141-
},
136+
env: { ...process.env, ...(options?.env ?? {}) },
142137
detached: process.platform !== 'win32',
143138
stdio: ['pipe', 'pipe', 'pipe']
144139
})

src/main/lib/agentRuntime/rtkRuntimeService.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {
1212
UsageDashboardRtkSummary
1313
} from '@shared/types/agent-interface'
1414
import logger from '@shared/logger'
15-
import { getShellEnvironment } from './shellEnvHelper'
15+
import { getShellEnvironment, mergeCommandEnvironment } from './shellEnvHelper'
1616
import { RuntimeHelper } from '../runtimeHelper'
1717

1818
const RTK_ENABLED_SETTING_KEY = 'rtkEnabled'
@@ -650,15 +650,12 @@ export class RtkRuntimeService {
650650
dbPath?: string
651651
): Promise<Record<string, string>> {
652652
const shellEnv = await this.getShellEnvironmentImpl()
653-
const env = this.runtimeHelper.prependBundledRuntimeToEnv({
654-
...Object.fromEntries(
655-
Object.entries(process.env).filter(
656-
(entry): entry is [string, string] => typeof entry[1] === 'string'
657-
)
658-
),
659-
...shellEnv,
660-
...baseEnv
661-
})
653+
const env = this.runtimeHelper.prependBundledRuntimeToEnv(
654+
mergeCommandEnvironment({
655+
shellEnv,
656+
overrides: baseEnv
657+
})
658+
)
662659

663660
if (dbPath) {
664661
fs.mkdirSync(path.dirname(dbPath), { recursive: true })

0 commit comments

Comments
 (0)