徐涛
|
932a06f512
|
refactor(core): 完成 v0.3.2 Cargo features 拆分基础设施
- 定义 16 个 features + 4 个快捷组合,default = ["full"] 保持向后兼容
- 12 个重型依赖 optional 化(tokio/reqwest/rusqlite 等)
- 全模块 #[cfg(feature)] 门控注入(llm/tools/memory/agent/engine)
- 将 LlmProvider trait 及关联类型移出 provider 模块归属 llm(ADR-1)
- 为 session.rs bundle() 方法添加 engine feature 门控
- 更新 12 个内部文件 + 4 个示例文件的 import 路径
- 向后兼容:provider.rs 保留 pub use 重导出老路径
|
2026-07-19 07:58:04 +08:00 |
|
徐涛
|
c82af60f81
|
feat(memory): 实现 SqliteStore 持久化
- 新增 src/memory/store/sqlite_store.rs(SqliteStore + 9 个内联测试)
- 基于 rusqlite 0.32(bundled),使用 Arc<Mutex<Connection>> + spawn_blocking
- WAL 模式 + synchronous=NORMAL + busy_timeout=5s + PRAGMA user_version
schema 版本管理
- created_at 归一化为 UTC 的 RFC 3339 TEXT,字典序等价时间序
- 错误精细映射:SqliteFailure/InvalidQuery → InvalidInput;
FromSqlConversionFailure → Serialization;其他 → Storage
- 9 个测试覆盖 CRUD、upsert、prefix/since/offset+limit 过滤、
10 写者 × 10 次并发、持久化 round-trip、trait-box 互换兼容性
依赖:
- rusqlite = { version = "0.32", features = ["bundled"] }
- time 增补 features: parsing, formatting, macros
- dev-dependencies: tempfile = "3"
测试:199 → 200 pass(191 原有 + 9 新增)
|
2026-07-05 17:13:28 +08:00 |
|
徐涛
|
c8a91f6eaf
|
refactor(memory): 将 store.rs 拆分为模块目录,仅结构搬移
- 将 src/memory/store.rs 单体文件拆分为模块根 + store/ 目录结构
- InMemoryStore(struct + impl + Default + 6 个内联测试)整体提取到
src/memory/store/in_memory.rs
- store.rs 保留 MemoryStore trait 与 EvictionPolicy/EvictionConfig
- 外部消费者导入路径 crate::memory::store::MemoryStore 不变
|
2026-07-05 17:09:45 +08:00 |
|
徐涛
|
98dfe6c1ed
|
feat(llm): 完成 Phase 5 热身准备(Ollama / non_exhaustive / ProviderConfig)
Phase 5 三个 Step 全部落地:
Step 5.2 — Ollama Provider
- 新增 OllamaProvider newtype 包装(默认 localhost:11434/v1,零 API key)
- ProviderType 新增 Ollama 变体与 FromStr 解析
Step 5.3 — #[non_exhaustive] 前置标记
- ProviderType / StopReason / FinishReason / EvictionPolicy 加 #[non_exhaustive]
- 编译期兼容护栏,避免下游 silent break
Step 5.1 — ProviderConfig 扩展
- 加 timeout_secs / max_retries 字段、Default、from_env(prefix)
- create_provider 各分支通过 pub(crate) from_parts 一次性构造并注入 timeout
(同时避开 Anthropic 的 default_headers 与双重 client 构造)
- map_reqwest_error 改为方法读取 self.timeout_secs(移除硬编码 120s)
- AnthropicProvider::with_timeout 同值短路,with_client 标 #[deprecated]
- DeepSeek / Qwen 加公开 with_client,new_with_client 走代理
- 7 个新测试:5 个 from_env 单元测试 + 3 个 timeout 传导 wiremock
(OpenAI Chat / DeepSeek / Anthropic)
- Cargo.toml 加 temp-env dev-dep
|
2026-07-05 08:12:40 +08:00 |
|
徐涛
|
2ecc0b4001
|
feat(memory): 添加记忆系统模块
|
2026-06-08 08:42:43 +08:00 |
|