fix: JSONStore.exists() validates meta.json integrity and add Agent.r…#37
Merged
CrazyBoyM merged 1 commit intoshareAI-lab:mainfrom Feb 11, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复
JSONStore.exists()与Agent.resumeFromStore()的语义不一致。增强exists()使其验证meta.json完整性,并新增Agent.resumeOrCreate()提供安全的恢复回退机制。Motivation / Context
JSONStore.exists()仅通过fs.access检查目录是否存在,不验证meta.json。导致目录存在但数据损坏时exists()返回true,而resumeFromStore()抛出ResumeError。集成方必须自行编写 try-catch + 清理逻辑。SQLite/Postgres Store 基于数据库查询,不存在此问题。相关 issue: #4Type of Change
Scope / Modules
Public API
src/index.ts导出有变更Breaking Changes
Testing
npm run test:unit(必需)npm run test:integration(按需)npm run test:e2e(按需)Impact / Risk
JSONStore.exists()对目录存在但meta.json缺失/损坏的情况现在返回false,与 SQLite/Postgres Store 语义对齐。依赖旧行为(仅检查目录)的代码可能受影响。Agent.resumeOrCreate()是新增方法,不影响现有代码。Checklist
tests/README.md规范dist/变更