feat: improve desktop reliability and customization
Address reliability and consistency gaps across Agent Runtimes, persistence, settings, Knowledge, Magic Notes, Smart Heartbeat, and the download site. Runtime processes now have bounded lifecycle cleanup and atomic configuration rollback, while model packages and persisted mutations recover safely. Add a configurable global shortcut, protect unsaved work, improve modal and keyboard behavior, localize the built-in project without rewriting stored data, and lazy-load heavy renderer routes under enforced bundle budgets. Align project forms and disabled controls with shared typography and interaction states, and strengthen website release metadata validation and navigation accessibility. Release note: 修复 Runtime、设置、知识库、魔法笔记与智能心跳中的可靠性和交互一致性问题;新增可配置全局快捷键,改进无障碍与加载性能,并强化官网下载校验。
This commit is contained in:
@@ -26,6 +26,7 @@ import type {
|
||||
RuntimeExtensionCatalog,
|
||||
RuntimeExtensionStoreDependencies
|
||||
} from './runtime-extension-store'
|
||||
import { terminateProcessTreeAndWait } from './child-process-termination'
|
||||
|
||||
const NPM_REGISTRY_URL = 'https://registry.npmjs.org'
|
||||
const NPM_SEARCH_PAGE_SIZE = 250
|
||||
@@ -167,61 +168,14 @@ export type PackageManagerRunner = (
|
||||
}
|
||||
) => Promise<PackageManagerRunResult>
|
||||
|
||||
function waitForProcessClose(
|
||||
child: ReturnType<typeof spawn>
|
||||
): Promise<void> {
|
||||
if (child.exitCode !== null) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
const finish = (): void => {
|
||||
clearTimeout(timer)
|
||||
child.removeListener('close', finish)
|
||||
resolve()
|
||||
}
|
||||
const timer = setTimeout(finish, 5_000)
|
||||
child.once('close', finish)
|
||||
})
|
||||
}
|
||||
|
||||
async function terminatePackageManager(
|
||||
child: ReturnType<typeof spawn>
|
||||
): Promise<void> {
|
||||
const closed = waitForProcessClose(child)
|
||||
if (process.platform === 'win32' && child.pid) {
|
||||
const killer = spawn(
|
||||
'taskkill.exe',
|
||||
['/PID', String(child.pid), '/T', '/F'],
|
||||
{
|
||||
shell: false,
|
||||
stdio: 'ignore',
|
||||
windowsHide: true
|
||||
}
|
||||
)
|
||||
await new Promise<void>((resolve) => {
|
||||
const finish = (): void => {
|
||||
clearTimeout(timer)
|
||||
killer.removeListener('close', finish)
|
||||
killer.removeListener('error', finish)
|
||||
resolve()
|
||||
}
|
||||
const timer = setTimeout(finish, 5_000)
|
||||
killer.once('close', finish)
|
||||
killer.once('error', finish)
|
||||
})
|
||||
} else if (child.pid) {
|
||||
try {
|
||||
process.kill(-child.pid, 'SIGKILL')
|
||||
} catch {
|
||||
child.kill('SIGKILL')
|
||||
}
|
||||
} else {
|
||||
child.kill('SIGKILL')
|
||||
}
|
||||
if (child.exitCode === null) {
|
||||
child.kill('SIGKILL')
|
||||
}
|
||||
await closed
|
||||
await terminateProcessTreeAndWait(child, {
|
||||
processGroup: true,
|
||||
signal: 'SIGKILL',
|
||||
waitMs: 5_000
|
||||
})
|
||||
}
|
||||
|
||||
function boundedAppend(current: string, chunk: unknown): string {
|
||||
|
||||
Reference in New Issue
Block a user