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:
@@ -77,6 +77,7 @@ describe('model archive', () => {
|
||||
}
|
||||
})
|
||||
|
||||
const progress: number[] = []
|
||||
await expect(
|
||||
extractModelArchive({
|
||||
archivePath: archive,
|
||||
@@ -89,7 +90,10 @@ describe('model archive', () => {
|
||||
],
|
||||
maximumArchiveBytes: 1024 * 1024,
|
||||
maximumFileBytes: 1024,
|
||||
maximumTotalBytes: 2048
|
||||
maximumTotalBytes: 2048,
|
||||
onProgress: (completedBytes) => {
|
||||
progress.push(completedBytes)
|
||||
}
|
||||
})
|
||||
).resolves.toMatchObject({
|
||||
kind: 'speech',
|
||||
@@ -101,6 +105,7 @@ describe('model archive', () => {
|
||||
await expect(readFile(join(extracted, 'tokens.txt'))).resolves.toEqual(
|
||||
tokens
|
||||
)
|
||||
expect(progress.at(-1)).toBe(model.byteLength + tokens.byteLength)
|
||||
})
|
||||
|
||||
it('preserves an existing archive when source verification fails', async () => {
|
||||
@@ -208,4 +213,39 @@ describe('model archive', () => {
|
||||
})
|
||||
).rejects.toThrow('模型 ID 不匹配')
|
||||
})
|
||||
|
||||
it('handles malformed entry rejection without an unhandled promise', async () => {
|
||||
const directory = await temporaryDirectory()
|
||||
const archive = join(directory, 'truncated.zip')
|
||||
const extracted = join(directory, 'extracted')
|
||||
await mkdir(extracted)
|
||||
const complete = zipSync({
|
||||
'goodbuddy-model.json': Buffer.from('{}'),
|
||||
'model.onnx': Buffer.alloc(128 * 1024, 7)
|
||||
})
|
||||
await writeFile(archive, complete.subarray(0, complete.length - 17))
|
||||
const unhandled: unknown[] = []
|
||||
const onUnhandled = (reason: unknown): void => {
|
||||
unhandled.push(reason)
|
||||
}
|
||||
process.on('unhandledRejection', onUnhandled)
|
||||
try {
|
||||
await expect(
|
||||
extractModelArchive({
|
||||
archivePath: archive,
|
||||
destinationDirectory: extracted,
|
||||
expectedKind: 'speech',
|
||||
expectedModelId: 'test-model',
|
||||
expectedFiles: [{ name: 'model.onnx', role: 'model' }],
|
||||
maximumArchiveBytes: 1024 * 1024,
|
||||
maximumFileBytes: 1024 * 1024,
|
||||
maximumTotalBytes: 1024 * 1024
|
||||
})
|
||||
).rejects.toThrow()
|
||||
await new Promise<void>((resolve) => setImmediate(resolve))
|
||||
expect(unhandled).toEqual([])
|
||||
} finally {
|
||||
process.removeListener('unhandledRejection', onUnhandled)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user