feat: ship v0.3.0 with P2.1 editor polish and P3 AI collaboration

Add chapter reorder, search replace, inspiration capture, and AI chat with context editing, settings, offline handling, and naming checks. Fix dev black screen by keeping process.env reads in the main process only.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 16:33:56 +08:00
parent 0b5aa146bd
commit 8ce35a1e8e
59 changed files with 3808 additions and 100 deletions
+11 -2
View File
@@ -8,9 +8,18 @@ export function fail(code: ErrorCode, message: string, recoverable: boolean): Ip
return { ok: false, error: { code, message, recoverable } }
}
export function wrap<T>(fn: () => T, recoverable = true): IpcResult<T> {
export function wrap<T>(fn: () => T | Promise<T>, recoverable = true): IpcResult<T> | Promise<IpcResult<T>> {
try {
return ok(fn())
const out = fn()
if (out && typeof (out as Promise<T>).then === 'function') {
return (out as Promise<T>)
.then((data) => ok(data))
.catch((e) => {
const message = e instanceof Error ? e.message : String(e)
return fail(ErrorCode.UNKNOWN, message, recoverable)
})
}
return ok(out as T)
} catch (e) {
const message = e instanceof Error ? e.message : String(e)
return fail(ErrorCode.UNKNOWN, message, recoverable)