Repository navigation
v2.17.0-beta.2
Pre-releaseEnglish
Summary
This preview migrates desktop structured storage to local SQLite in WAL mode, automatically and atomically importing data from prompt-optimizer-data.json on first launch while keeping legacy JSON files untouched as pre-upgrade snapshots. It also hardens desktop quit and startup error handling and fixes concurrency edge cases across history, templates, preferences, and IndexedDB storage.
Highlights
- Atomic SQLite desktop storage: Replace full-file debounced JSON rewrites with short SQLite WAL transactions backed by
node:sqlite, preserving all models, image model configs, templates, history chains, contexts, favorites, preferences, variables, and workspace drafts. - Zero-touch legacy preservation: First-run startup copies
prompt-optimizer-data.json(or an existing.backupif needed) intoprompt-optimizer-data.sqlitein one transaction without modifying, deleting, or rewriting the original JSON snapshot. - Clear startup and shutdown protection: Startup prevents silent overwrites when SQLite fails to initialize (distinguishing storage, WAL-unsupported, and service errors with an action to open the data directory), and app quit drains pending SQLite closes safely across repeated quit events.
- Cross-store concurrency reliability: History iteration appends, template mutations, preference clearing, and browser IndexedDB queued updates serialize cleanly without losing updates, breaking chain roots, or masking domain errors.
Product Updates
Desktop
- Switch desktop structured storage (
models,templates,history,contexts,favorites,preferences, and drafts) fromFileStorageProvider(prompt-optimizer-data.json) toSQLiteStorageProvider(prompt-optimizer-data.sqlitewith SQLite WAL mode) via@prompt-optimizer/core/node. - Run an atomic one-time migration on the first launch with no completed migration marker. Keep the original
prompt-optimizer-data.jsonand any existing.backupon disk. - Serialize
will-quitstorage closing across secondary quit attempts, close opened storage cleanly on fatal startup failure, and reset updater quit locks when auto-update errors occur. - Present localized startup error dialogs (
zh-CN,zh-TW,en-US) for WAL-unsupported filesystems, storage initialization failures, and post-storage service initialization failures, surfacing directory-open errors explicitly.
Web
- No user-facing Web workflow or UI changes in this release. Underlying IndexedDB
updateDataconcurrency and domain-error handling inDexieStorageProviderare improved cleanly.
Extension
- No extension-specific user-facing changes in this release. Built artifacts remain isolated from Node SQLite modules.
Core/Infra
- Expose
@prompt-optimizer/core/node(SQLiteStorageProvider,openDesktopStorage,openExistingDesktopStorage,openExistingDesktopStorageForWriting,exportDesktopStorageAsLegacyJSON) as a Node-only entrypoint separate from@prompt-optimizer/core. - Convert
HistoryManagermutations (deleteRecord,deleteChain,addIteration),TemplateManagersaves/deletes, andPreferenceService.clear()(via atomicdeleteByPrefix) to single-transaction operations. - Add
trimRecordsPreservingRootsacross history additions, iterations, and imports to preserve active chain roots and re-linkpreviousIdancestors within the 50-record limit. - Normalize unpaired UTF-16 surrogates to
U+FFFDduring raw SQLite writes and legacy migrations (rolling back if normalized legacy keys collide) while keeping JSON-escaped text intact.
Fixes
- Prevent concurrent
HistoryManager.addIterationcalls from forking linear chains or losing updates against deleted chains, and keep returned chains consistent with the 50-record retention cap. - Keep
getChain,getAllChains, andgetIterationChainconsistent across 50-record trimming and history imports in newest-first order. - Ensure
PreferenceService.clear()deletes all persisted preferences including untouched or cross-connection keys atomically without partially tearing concurrent batch writes. - Preserve synchronous modifier domain errors (such as
RecordNotFoundError) acrossDexieStorageProvider.updateDatainstead of retrying or wrapping them intoStorageError, and isolate per-key FIFO queues so a rejected mutation does not fail subsequent queued updates. - Restore
createDesktopServiceBridgemain-process slicing boundaries alongside lifecycle helpers inpackages/desktop/main.js, and gate SQLitebirthtimeNsidentity checks towin32anddarwin.
Breaking Changes / Upgrade Notes
- This prerelease previews the desktop SQLite storage upgrade. Back up important data with the app's backup or export tools before upgrading.
- After upgrading, new desktop edits are written to
prompt-optimizer-data.sqlitein the user data directory; the existingprompt-optimizer-data.jsonremains intact as a pre-upgrade snapshot and is not updated afterwards or re-read on future startups. - SQLite WAL mode requires the desktop data directory to reside on a local disk volume supporting file locking (certain network/virtual filesystems are rejected cleanly on startup without modifying files).
- Browser and desktop IndexedDB image stores (
PromptOptimizerImageDB,PromptOptimizerFavoriteImageDB) remain unchanged in this release. - The extension ZIP is available for manual installation. Its numeric version is
2.17.0and its display version is2.17.0-beta.2. - Docker images are available under the preview tag
2.17.0-beta.2.
Developer Notes
- Build-output verification confirmed zero
node:sqliteorSQLiteStorageProviderleakage intopackages/ui/dist,packages/web/dist, orpackages/extension/dist. - Node
v24.22.1validation covered the core, UI, web, and extension builds, 41 storage tests, Electron first start and restart, and the repository and desktop test suites. The storage recovery fixture sets the template language explicitly so it runs consistently across locales. - Real packaged desktop installer and cross-platform macOS/Linux verification remain to be completed via release workflow builds and live preview testing before promoting a stable release.
Installation guide: English | 中文
Source release notes (EN)
中文
概括
本预览版将桌面端结构化数据存储升级为本地 SQLite(WAL 模式):首次启动时自动将原 prompt-optimizer-data.json 原子迁移到 prompt-optimizer-data.sqlite,同时原样保留旧版 JSON 文件作为升级前快照。本次同时强化了桌面端退出清理与启动异常提示,并修复了历史记录、模板、偏好设置及 IndexedDB 并发更新中的边界问题。
亮点
- 原子化的 SQLite 桌面存储:用基于内置
node:sqlite的 WAL 短事务替代原有整文件防抖写盘机制,完整保留模型配置、图像模型参数、模板、历史迭代链、上下文、收藏、偏好设置、变量及工作区草稿。 - 不改动历史 JSON 快照:首次启动在单一事务内将
prompt-optimizer-data.json(或已有.backup)迁移并校验写入prompt-optimizer-data.sqlite,不会删除、覆盖或改写原有旧文件。 - 更稳妥的启动与退出保护:在存储或服务启动失败时弹出清晰的故障引导(区分不支持 WAL 的目录、存储初始化失败与服务初始化失败,支持一键打开数据目录),并在应用退出期间串行守护未完成的 SQLite 关闭流程。
- 跨存储并发一致性修复:历史链追加与导入、模板保存/删除、偏好清空以及浏览器 IndexedDB 队列写入均保持并发安全、根记录完整且领域错误不被掩盖。
产品更新
Desktop
- 通过
@prompt-optimizer/core/node将桌面端结构化存储从FileStorageProvider(prompt-optimizer-data.json)切换为SQLiteStorageProvider(prompt-optimizer-data.sqlite,WAL 模式)。 - 首次启动自动执行一次性原子迁移,原
prompt-optimizer-data.json与已有.backup文件保持只读且原样保留在目录中。 - 在
will-quit阶段串行阻塞重复退出直到 SQLite 关闭完成;致命启动失败时安全关闭存储并立即退出;自动更新出错时恢复退出前保存状态。 - 新增多语言(简体中文、繁体中文、英文)启动错误对话框,明确区分 WAL 目录不支持、存储失败与服务启动失败,并在无法打开目录时提示具体错误原因。
Web
- 本次没有面向用户的 Web 端界面或交互变更;底层共享的浏览器端
DexieStorageProvider优化了updateData并发队列与领域异常透传。
Extension
- 本次没有扩展端特有的功能变化,构建产物已验证完全隔离 Node SQLite 模块。
Core/Infra
- 提供独立的 Node 专用子入口
@prompt-optimizer/core/node(导出SQLiteStorageProvider、openDesktopStorage、openExistingDesktopStorage、openExistingDesktopStorageForWriting、exportDesktopStorageAsLegacyJSON),与浏览器主入口物理隔离。 - 将
HistoryManager(deleteRecord、deleteChain、addIteration)、TemplateManager写删以及PreferenceService.clear()(新增原子deleteByPrefix)统一切换为单事务原语。 - 新增
trimRecordsPreservingRoots统一保护新增、迭代及导入时的 50 条截断逻辑,确保保留的每条链都留存版本 1 根记录,并自动重连被淘汰中间版本的previousId祖先链路。 - 在 SQLite 原始键值写入与旧版 JSON 迁移时将孤立 UTF-16 代理项规范化为
U+FFFD(遇到旧键冲突时回滚拒绝),同时保持正常 JSON 序列化字段完整无损。
修复
- 修复
HistoryManager.addIteration在多连接并发或链被删除时的竞态分叉问题,并确保返回值在 50 条截断下与存储读取结果一致。 - 修复超出 50 条记录时多条活跃链互相挤掉根记录、
getIterationChain在被淘汰中间节点处断链,以及最新优先导入 51 条记录丢失根记录的问题。 - 修复
PreferenceService.clear()清理跨连接写入及未缓存键时的并发撕裂隐患,支持前缀原子清除。 - 修复
DexieStorageProvider.updateData在修改器抛出RecordNotFoundError等业务异常时误触发重试/降级包装为StorageError的问题,并修复同键并发队列前序失败波及后续合法写入的问题。 - 修复
packages/desktop/main.js退出辅助逻辑位置对核心桌面服务桥接测试切片的影响,并将底层文件标识的birthtimeNs检查限定在win32与darwin平台。
破坏性变更 / 升级说明
- 本预览版用于体验桌面端共享 SQLite 存储。升级前请通过应用内备份或导出功能留存重要数据。
- 升级后桌面端新增与修改数据将保存至数据目录下的
prompt-optimizer-data.sqlite;原有的prompt-optimizer-data.json保留为升级前历史快照,后续不会再同步更新,也不会在后续启动时重读。 - SQLite WAL 模式要求桌面端数据目录位于支持文件锁的本地磁盘卷;若数据目录位于不支持文件锁的特殊网络盘/虚拟磁盘,应用会暂停启动并提示迁移数据目录,不会修改原文件。
- 桌面端与浏览器端的图片资产 IndexedDB(
PromptOptimizerImageDB、PromptOptimizerFavoriteImageDB)本次结构不变。 - 扩展 ZIP 供手动安装,数字版本为
2.17.0,显示版本为2.17.0-beta.2。 - Docker 镜像使用预览标签
2.17.0-beta.2。
开发者说明
- 已验证
packages/ui/dist、packages/web/dist与packages/extension/dist产物中均零残留node:sqlite或SQLiteStorageProvider引用。 - 在 Node
v24.22.1下验证了 Core、UI、Web 和扩展构建、41 项存储测试、Electron 首启和重启,以及仓库和桌面端测试。存储恢复用例显式设置模板语言,确保不同系统语言下结果一致。 - 打包安装器在各桌面平台的实机升级验收将在本 beta 预发布产出构建物后进一步验证。
安装文档:English | 中文
仓库版本说明(中文)
macOS note: if macOS reports the app as damaged or cannot verify the developer, this is usually caused by the quarantine attribute on downloaded apps. See the installation guide, or remove it after installing with xattr -rd com.apple.quarantine /Applications/PromptOptimizer.app; for a downloaded DMG, you can run the same command on ~/Downloads/PromptOptimizer-*.dmg before installing.
macOS 备注:如果 macOS 提示“已损坏”或“无法验证开发者”,通常是下载文件的隔离属性导致。请参考安装文档;也可以在安装后执行 xattr -rd com.apple.quarantine /Applications/PromptOptimizer.app,或在安装前对 ~/Downloads/PromptOptimizer-*.dmg 执行同类命令。