feat: complete WorkBuddy parity and Windows release workflow
This commit is contained in:
1 parent
143516b3a8
commit
d5512df549
434 files changed
+54977
-1854
No files matched your search
@@ -248,6 +248,7 @@ interface IpcTestState {
|
||||
promptCalls: number
|
||||
abortCalls: number
|
||||
rejectNextPrompt: boolean
|
||||
thinkingLevels: string[]
|
||||
}
|
||||
|
||||
async function testIpcCancellationPersistence(): Promise<void> {
|
||||
@@ -259,12 +260,14 @@ async function testIpcCancellationPersistence(): Promise<void> {
|
||||
kernel: null,
|
||||
promptCalls: 0,
|
||||
abortCalls: 0,
|
||||
rejectNextPrompt: false
|
||||
rejectNextPrompt: false,
|
||||
thinkingLevels: []
|
||||
}
|
||||
await mkdir(state.userData, { recursive: true })
|
||||
const globalWithMock = globalThis as typeof globalThis & { __YCODE_OMP_TEST__?: IpcTestState }
|
||||
const previous = globalWithMock.__YCODE_OMP_TEST__
|
||||
globalWithMock.__YCODE_OMP_TEST__ = state
|
||||
let cleanupKernels: (() => Promise<void>) | undefined
|
||||
|
||||
try {
|
||||
const entry = join(process.cwd(), 'src', 'main', 'ipc.ts')
|
||||
@@ -298,6 +301,7 @@ async function testIpcCancellationPersistence(): Promise<void> {
|
||||
encryptString: (value) => Buffer.from(value),
|
||||
decryptString: (value) => value.toString()
|
||||
};
|
||||
export const powerSaveBlocker = { start: () => 1, stop: () => undefined, isStarted: () => true };
|
||||
export const ipcMain = {
|
||||
handle: (name, handler) => state.handlers.set(name, handler)
|
||||
};
|
||||
@@ -314,6 +318,7 @@ async function testIpcCancellationPersistence(): Promise<void> {
|
||||
import { EventEmitter } from 'node:events';
|
||||
export class OmpKernel extends EventEmitter {
|
||||
constructor() { super(); globalThis.__YCODE_OMP_TEST__.kernel = this; }
|
||||
setThinkingLevel(level) { globalThis.__YCODE_OMP_TEST__.thinkingLevels.push(level); return Promise.resolve(); }
|
||||
prompt() {
|
||||
const state = globalThis.__YCODE_OMP_TEST__;
|
||||
state.promptCalls++;
|
||||
@@ -334,7 +339,7 @@ async function testIpcCancellationPersistence(): Promise<void> {
|
||||
setImmediate(() => this.emit('event', { type: 'agent_end', yielded: true }));
|
||||
return Promise.resolve({ type: 'response', success: true });
|
||||
}
|
||||
dispose() {}
|
||||
dispose() { return Promise.resolve(); }
|
||||
}
|
||||
export const detectOmpPath = () => 'mock-omp';
|
||||
export const getOmpInfo = () => ({ available: true, exePath: 'mock-omp', profile: 'ycode', model: 'ycode/test' });
|
||||
@@ -346,6 +351,7 @@ async function testIpcCancellationPersistence(): Promise<void> {
|
||||
})
|
||||
|
||||
const ipc = await import(pathToFileURL(outfile).href)
|
||||
cleanupKernels = ipc.disposeOmpKernels
|
||||
;(ipc.registerIpc as (getWindow: () => unknown) => void)(() => ({
|
||||
webContents: { send: () => undefined }
|
||||
}))
|
||||
@@ -371,6 +377,7 @@ async function testIpcCancellationPersistence(): Promise<void> {
|
||||
if (messages.at(-1)?.status !== 'streaming') break
|
||||
}
|
||||
check('the fake OMP kernel received one prompt and one abort', state.promptCalls === 1 && state.abortCalls === 1)
|
||||
check('a non-reasoning model explicitly disables native thinking before prompt', state.thinkingLevels[0] === 'off')
|
||||
check('cancelled assistant status is persisted through IPC', messages.at(-1)?.role === 'assistant' && messages.at(-1)?.status === 'cancelled', JSON.stringify(messages))
|
||||
|
||||
const sessionsFile = join(state.userData, 'sessions.json')
|
||||
@@ -418,6 +425,7 @@ async function testIpcCancellationPersistence(): Promise<void> {
|
||||
JSON.stringify(errorDiskMessages)
|
||||
)
|
||||
} finally {
|
||||
await cleanupKernels?.()
|
||||
globalWithMock.__YCODE_OMP_TEST__ = previous
|
||||
await rm(tempRoot, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user