@modusensus/dsh-mneme 0.7.17 → 0.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -7,7 +7,7 @@ English | [简体中文](README.md)
7
7
  [![npm version](https://img.shields.io/npm/v/@modusensus/dsh-mneme?color=blue&label=npm)](https://www.npmjs.com/package/@modusensus/dsh-mneme)
8
8
  [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
9
9
  [![Awesome](https://awesome-dsh-plugin.com/badge.svg)](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
10
- [![tests](https://img.shields.io/badge/tests-664%20passed-success)](https://github.com/modusensus/dsh-mneme)
10
+ [![tests](https://img.shields.io/badge/tests-685%20passed-success)](https://github.com/modusensus/dsh-mneme)
11
11
 
12
12
  > A cross-session memory plugin for DeepSeek Harness: it lets the Agent remember you, remember your projects, and organize memories automatically. **Mneme** (Μνήμη) — named after Mnemosyne, the Greek goddess of memory who presides over memory and dreams, just as autoDream consolidates memories in the background.
13
13
 
@@ -162,10 +162,12 @@ Every **background LLM call** (autoDream consolidation + summary, autoSummarize
162
162
 
163
163
  ## 🆕 Recent Release Highlights
164
164
 
165
- > ⚠️ **Archival note**: pre-v0.7.12 rows below record experimental features later removed in the v0.7.12 rewrite (heat model, Wiki-Link, tag system/directory/tag-boost, user/fact layered types, prefix-id resolution, /stats and /directory endpoints). They are version history only — **not current capability**. Current features are what this README's body and the [config table](#-configuration) describe.
165
+ > ⚠️ **Archival note**: pre-v0.7.12 rows below record experimental features later removed in the **v0.7.11** rewrite (Wiki-Link, tag system/directory/tag-boost, user/fact layered types, prefix-id resolution, /stats and /directory endpoints). v0.7.11 and v0.7.12 shipped the same day; historical docs credited v0.7.12, corrected here to v0.7.11. Unrecorded removals in the same rewrite: session lifecycle (`session_disposed_at` soft-hide), provenance birth-session tracking (`session_id`), and the decision-field normalizer (`normalizeDecisions`, superseded by strict prompt schema + `extractJsonArray`). They are version history only — **not current capability**. (The heat model was fully restored in v0.7.20 from v0.7.10, see below.) Current features are what this README's body and the [config table](#-configuration) describe.
166
166
 
167
167
  | Version | Highlights |
168
168
  |------|------|
169
+ | **v0.7.20** | Heat model restored (issue #87): v0.7.0 self-evolving memory back (`src/heat.js` power-law decay `H=1/(1+λΔt)^α` + per-type half-lives), sleep demotion dual protection (cold time-window + heat<0.05 + importance<5), touchRecalled gating back on `heatEnabled`, entity heat projection (ego node heat → size/opacity), recall_runs recording on by default; **default OFF** (matches v0.7.12 behavior out of the box) + feature_flags whitelist rollback switch + lightMode linkage + sleep demotion audit counts exposed (workbench can show "N demoted") + phase-two frontend (/list heat projection, HeatBadge three-tier badge, self-gated status heat-distribution card, order=heat page-local sort, all self-gated); better-sidebar fix (issue #88: soft integration moved to an inner dynamic sub-plugin, no more startup failure without bs); 685 tests green |
170
+ | **v0.7.18** | Ecosystem step one + query convergence: better-sidebar soft integration (inject declaration + optional peer `dsh-better-sidebar` + registerTab reusing the four views, safe skip when absent; narrow-container `@container` adaptation) + `/list?deposited=only` view (receipt_chain ∪ source=dream) + deposited/archived filter chips in the library + status-page dashboard (server totals + view-all jumps) + drawer restore for archived memories; 667 tests green |
169
171
  | **v0.7.17** | Panel polish: sidebar entry continuously aligned with the host (MutationObserver syncs the New-Session class + `width:100%` + native centering restored, resilient to async skin rewrites) + importance rendered as Lucide star glyphs (`ImportanceStars` filled/hollow component replacing text ★) + toolbar dropdown stacking fix (z-index moved to the container; export/import menu no longer painted under the sticky month header); 664 tests green |
170
172
  | **v0.7.16** | Fixed autoDream empty-body failures on thinking models (`no json array in llm output`): restored config-first routing (settings "consolidation model" wins, Issue #25) + reasoningEffort auto-retry without effort on rejection + honest `llm_audit` error on parse failure; backfilled API-route tests (/delete, /entities, /external-api) + lib runtime smoke; 662 tests green |
171
173
  | **v0.7.15** | Desktop adaptation: library panel redesign + 30-key feature-flag UI (features API) + status dashboard + import/export (mirror-isomorphic md golden loop) + token masking by default; 645 tests green |
@@ -210,7 +212,7 @@ Every **background LLM call** (autoDream consolidation + summary, autoSummarize
210
212
  | v0.7.1–0.7.8 | ✅ Done | Issue fixes + graph backfill | tags↔entity_attrs bridge, inline-confirm delete, sidebar trigger toggle, brace escaping, user/fact layered types + stats endpoint (later removed), prefix-id resolution (later removed), sleep batch entity extraction, snapshotEvents() DSH compat; 764→812 tests green |
211
213
  | v0.7.9 | ✅ Done | lib-sync gate | Issue #65: src-only shim silently killed the shipped lib — synced lib + pre-publish src↔lib consistency check + lib smoke tests; 815 tests green |
212
214
  | v0.7.10–0.7.12 | ✅ Done | Panel redesign + near-rewrite | UX upgrades (color dots, pan/zoom, pagination, global search), then near-rewrite: inlined panel → pure HTTP API + standalone CLI + lightMode; TYPES narrowed 8→6 |
213
- | v0.7.13–0.7.17 | ✅ Done | Distillation, security, desktop, dream fix, panel polish | codingRetrospect + 429 governor; private reasoning blocks dropped (CWE-200); desktop panel redesign + feature flags; autoDream thinking-model empty-body fix + backfilled tests; sidebar entry alignment + star glyphs + menu stacking polish; 664 tests green |
215
+ | v0.7.13–0.7.20 | ✅ Done | Distillation, security, desktop, dream fix, panel polish, ecosystem, heat restore | codingRetrospect + 429 governor; private reasoning blocks dropped (CWE-200); desktop panel redesign + feature flags; autoDream thinking-model empty-body fix + backfilled tests; sidebar entry alignment + star glyphs + menu stacking polish; better-sidebar soft integration (inner dynamic sub-plugin fix, issue #88) + deposited/archived library views; heat model restored (issue #87) with phase-two frontend + archival audit (issue #87); 685 tests green |
214
216
  | **v0.8.0** | 🚧 Planned (late Sep) | Graph enhancement | Interest-drift visualization + scope isolation (issue #17) + cross-workspace sharing |
215
217
 
216
218
  > All new capabilities ship as **toggleable features** (enabled/disabled via configuration), conservatively on by default and never breaking existing behavior. The `failure_memories` table and the autoDream decision engine have already paved the way for future reflective growth.
@@ -316,6 +318,7 @@ It works out of the box with the defaults. To adjust, override in `~/.dsh/profil
316
318
  | `evalPersistTestResults` | `false` | Retrieval evaluation persistence (v0.4.5, opt-in, off by default): when enabled, `evaluateRetrieval` writes precision/recall/mrr snapshots into `recall_evals`; when off it only returns them to the caller without persisting. Production `searchMemories` auditing always goes through `recall_runs`, unconditionally never touching `recall_evals` |
317
319
  | `autoReindexOnBoot` | `true` | When existing memories lack embeddings and vectors are configured, a delayed, rate-limited background backfill rebuild starts after boot (set to `false` for manual rebuild only) |
318
320
  | `hybridInject` | `true` | Semantic-recall-first injection (v0.4.6, Bug4): when `injectCandidates` receives a non-empty query, it first recalls candidates via the vector index semantically, then fills in/deduplicates with rule-based filtering; empty query / no vectors falls back to the old logic |
321
+ | `heatEnabled` | `false` | Heat-model master switch (v0.7.0 / restored in v0.7.20, **off by default** — v0.7.12+ users expect no-heat behavior): when on, provides heat fields / sleep heat-combined demotion protection / frontend heat projection without changing recall ranking; when off, skips all heat computation and touch, and sleep demotion reverts to pure time-tiering. Also on the feature_flags whitelist (panel-toggleable rollback switch); light-mode preset forces it off |
319
322
  | `memoryQualityFilter` | `{enabled:true, archiveThreshold:30, degradeThreshold:60, minContentLength:10}` | Memory quality filter (v0.4.6, on by default): heuristic 0-100 scoring before write; meta-memory vocabulary/self-reference/overly short/duplicate/near-duplicate content deduct points; ≥60 stored normally, 30-60 down-weighted (injection ranked by importance×quality/100), <30 archived and flagged `low_quality` (still recallable via explicit search, never auto-injected) |
320
323
  | `llmAudit` | `{enabled:true, retentionDays:90}` | LLM usage audit (v0.4.6, on by default): every background LLM call (autoDream/autoSummarize) writes `llm_audit_logs` (tokens/duration/status/source); failures are recorded as error without blocking; read-only APIs `/api/dsh-mneme/semantic/llm-audit` + `/llm-audit/stats` |
321
324
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![npm version](https://img.shields.io/npm/v/@modusensus/dsh-mneme?color=blue&label=npm)](https://www.npmjs.com/package/@modusensus/dsh-mneme)
6
6
  [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
7
7
  [![Awesome](https://awesome-dsh-plugin.com/badge.svg)](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
8
- [![tests](https://img.shields.io/badge/tests-664%20passed-success)](https://github.com/modusensus/dsh-mneme)
8
+ [![tests](https://img.shields.io/badge/tests-685%20passed-success)](https://github.com/modusensus/dsh-mneme)
9
9
  [![CI](https://img.shields.io/github/actions/workflow/status/modusensus/dsh-mneme/ci.yml)](https://github.com/modusensus/dsh-mneme/actions)
10
10
  [![node](https://img.shields.io/badge/node-24%2B-blue)](https://nodejs.org)
11
11
  [![npm downloads](https://img.shields.io/npm/dm/@modusensus/dsh-mneme?color=blue&label=downloads)](https://www.npmjs.com/package/@modusensus/dsh-mneme)
@@ -34,7 +34,7 @@ dsh web
34
34
  - 不是向量数据库——语义搜索是可选增强,默认零额外依赖
35
35
  - 不替代会话日志——它存的是「值得跨会话记住的」精炼知识
36
36
  - 不改变模型本身——进化的是记忆库与每次注入的上下文
37
- - 删对话 ≠ 删记忆——开启会话生命周期后,删除会话只是把该会话出生的记忆**软隐藏**(可恢复),数据不丢
37
+ - 删对话 ≠ 删记忆——记忆是跨会话的全局知识(v0.7.11 起不再与会话绑定),删除会话不影响已存入的记忆
38
38
 
39
39
  ## ✨ 功能
40
40
 
@@ -42,7 +42,7 @@ dsh web
42
42
 
43
43
  - **SQLite 主存储**:`~/.dsh/memory/memory.db`,`node:sqlite` 内置,零原生依赖
44
44
  - **Markdown 镜像**:`preferences.md` / `projects.md` / `decisions.md` / `history.md` / `summary.md`,人类可读、可手工编辑(**人工修改优先**合并回库)
45
- - **9 种记忆类型**:`preference` 偏好 / `project` 项目 / `decision` 决策 / `history` 历史 / `summary` 会话总览 / `pattern` 模式 + 编码记忆三型 `rejected_solution` 被否方案 / `pitfall` 踩坑 / `constraint` 约束(v0.7.13 起,`codingRetrospect` 默认关;v0.7.12 重写已收窄删除 user/fact 两型)
45
+ - **9 种记忆类型**:`preference` 偏好 / `project` 项目 / `decision` 决策 / `history` 历史 / `summary` 会话总览 / `pattern` 模式 + 编码记忆三型 `rejected_solution` 被否方案 / `pitfall` 踩坑 / `constraint` 约束(v0.7.13 起,`codingRetrospect` 默认关;v0.7.11 近重写已收窄删除 user/fact 两型)
46
46
  - **镜像同步状态机(v0.3.6+)**:mirror 与主库强一致,用 `generation`(期望轮次)/ `applied_generation`(已应用轮次)建模同步债务
47
47
  - 业务写操作在**自身事务内原子递增** desired generation——崩溃在 COMMIT 后、渲染前,重启也能凭 durable 债务恢复,绝不静默跳过(v0.3.8)
48
48
  - `generation` 用 SQLite 原子语句递增,多进程并发零丢失;带 `CHECK` 上界,负数/溢出拒绝
@@ -107,15 +107,6 @@ dsh web
107
107
 
108
108
  > 配置详见 `docs/SLEEP.md`;迁移说明见 `docs/MIGRATION.md`。
109
109
 
110
- ### 会话生命周期:把对话当存档点 💾(v0.6.0,opt-in)
111
-
112
- **默认关闭**(`sessionLifecycleEnabled: false`,保持旧行为)。开启后,会话被删除/销毁(DSH `session/disposed` 事件)时,自动把该会话内出生(`session_id` 溯源)的记忆**软隐藏**——不再出现在检索/注入/列表/整理,但**不删除**,随时可恢复:
113
-
114
- - **与 `archived` 正交**:`archived` 是用户/AI 主动"长期保留但安静",`session_disposed_at` 是会话删除被动隔离,两者互不覆盖。恢复会话绝不复活你手动归档的记忆
115
- - **全局记忆免疫**:存量无 `session_id` 的记忆视为全局,永不参与会话清理
116
- - **幂等 + 熔断**:dispose/restore 状态守卫幂等(重复调用 no-op);事件回调内部异常 catch 住,不抛进 DSH 会话清理流程
117
- - **恢复**:整会话 `service.restoreBySession(sessionId)` 一键还原;`service.listBySession(sessionId, { includeDisposed: true })` 可查看当前隐藏了哪些(DTO 带 `disposed` 标记)
118
-
119
110
  官方设置面板 → 「记忆库设置」→「记忆」标签:按类型浏览、全文搜索;启用向量搜索后可用「语义」切换做向量召回。
120
111
 
121
112
  ### 用户设置(画像 / 规则)与自定义指令 ⚙️
@@ -212,10 +203,12 @@ v0.3.0 起新增**记忆基因**层:从记忆里抽取**命名实体**、**带
212
203
 
213
204
  ## 🆕 最近版本亮点
214
205
 
215
- > ⚠️ **历史存档提示**:下方及路线图表中 v0.7.12 之前的早期条目记录的实验功能(heat 热度模型、Wiki-Link、tag 系统/目录/tag 加权、user/fact 分层类型、前缀 id 解析、/stats 与 /directory 端点等)已在 v0.7.12 近重写时移除,仅作版本历史存档,**不代表当前能力**。当前特性以本 README 正文与 [配置表](#-配置) 为准。
206
+ > ⚠️ **历史存档提示**:下方及路线图表中 v0.7.12 之前的早期条目记录的实验功能(Wiki-Link、tag 系统/目录/tag 加权、user/fact 分层类型、前缀 id 解析、/stats 与 /directory 端点等)已在 **v0.7.11** 近重写时移除(v0.7.11 与 v0.7.12 同日发布,历史文档多标 v0.7.12,此处勘误归一到 v0.7.11),仅作版本历史存档,**不代表当前能力**。同期未记载的移除另有:会话生命周期(`session_disposed_at` 软隐藏)、provenance 出生会话溯源(`session_id`)、决策字段归一化(normalizeDecisions,已由提示词硬规范取代)。(heat 热度模型已于 v0.7.20 从 v0.7.10 完整找回回归,见下方 [v0.7.20](#recent-version-highlights)。)当前特性以本 README 正文与 [配置表](#-配置) 为准。
216
207
 
217
208
  | 版本 | 亮点 |
218
209
  |------|------|
210
+ | **v0.7.20** | heat 热度模型回归(issue #87):找回 v0.7.0 自进化记忆(`src/heat.js` 幂律衰减 `H=1/(1+λΔt)^α` + per-type 差异化半衰期)、sleep 降级热联合双保护(时间窗冷 + heat<0.05 + importance<5)、touchRecalled 门控改回 `heatEnabled`、实体热投影(ego 节点 heat → 前端大小/明暗)、recall_runs 默认记录;**默认关**(默认=与 v0.7.12 行为一致)+ feature_flags 白名单回滚开关 + lightMode 联动 + sleep 降级审计计数暴露(工作动态可展示"降级 N 条")+ 阶段二前端(/list heat 投影、HeatBadge 三档徽章、状态页热度分布卡、order=heat 页内排序,全部自门控);better-sidebar 修复(issue #88:软集成改内层动态子插件,无 bs 环境不再启动失败);685 测试全绿 |
211
+ | **v0.7.18** | 生态第一步 + 查询收敛:better-sidebar 软集成(inject 声明 + optional peer `dsh-better-sidebar` + registerTab 复用四视图,未装安全跳过;窄容器 `@container` 适配)+ `/list?deposited=only` 沉淀视图(receipt_chain ∪ source=dream)+ 记忆库沉淀/已归档筛选 chip + 状态页仪表盘化(统计 + 查看全部跳转预置筛选)+ 抽屉归档记忆「恢复」;667 测试全绿 |
219
212
  | **v0.7.17** | 面板体验细化:侧边栏入口持续对齐宿主(MutationObserver 同步「新会话」类名 + `width:100%` + 交还原生居中,皮肤异步改写不再失配)+ 重要性星级换 Lucide 星形(`ImportanceStars` 实心/空心组件,替换文本 ★)+ 工具栏下拉层级修复(z-index 提到容器,导出/导入菜单不再被吸顶月份头遮挡);664 测试全绿 |
220
213
  | **v0.7.16** | 修复 autoDream 在 thinking 模型上空体 failed(`no json array in llm output`):恢复 config-first 路由(设置面板「巩固模型」生效,Issue #25)+ reasoningEffort 被拒自动去掉重试一次 + 解析失败如实记 llm_audit error 并带原始输出头日志;补测 API 路由空白(/delete、/entities、/external-api)+ lib 运行时冒烟(src↔lib 一致性);662 测试全绿 |
221
214
  | **v0.7.15** | 桌面端适配:记忆库面板重设计(撤对话 tab → 居中非全屏 sheet、卡片网格/时间线双视图、右侧详情抽屉、编辑/归档/关联实体)+ 侧边栏入口上移工作区上方(借用宿主原生类名对齐、收起态零位移)+ 功能开关 30 键上 UI(features API,巩固模型与 embedding 提供方可配)+ 状态页工作台(巩固卡/工作动态流/沉淀记忆/归档恢复)+ 导入导出(镜像同构 md 黄金闭环)+ Token 面板默认遮蔽;645 测试全绿 |
@@ -346,8 +339,6 @@ dsh web
346
339
  dreamThresholdCount: 10
347
340
  dreamThresholdChars: 5000
348
341
  dreamDelayMs: 2000
349
- # 会话生命周期(v0.6.0,默认关):会话被删时软隐藏其记忆,可恢复
350
- # sessionLifecycleEnabled: false
351
342
  ```
352
343
 
353
344
  ## ⚙️ 配置
@@ -403,6 +394,12 @@ dsh web
403
394
  | `bm25SearchEnabled` | `true` | BM25 稀疏第三路召回(v0.5.0):ASCII 词元 + CJK bigram,IDF 加权,散词/ID/代码片段查询不再依赖子串命中 |
404
395
  | `adaptiveThresholdEnabled` | `true` | 自适应相似度阈值(v0.5.0):按查询形态动态截断(前缀 0.5 / 短查询 0.7 / 长查询 0.6 / 头部分差大放宽 0.5),显式传 `threshold` 走旧行为 |
405
396
  | `hotMemoryEnabled` | `true` | 会话级短期热记忆总开关(v0.5.0):关闭后热记忆块不再注入(长期召回不受影响) |
397
+ | `heatEnabled` | `false` | 热度模型总开关(v0.7.0 / v0.7.20 回归,**默认关**——v0.7.12 起用户已习惯无 heat 行为):开启后提供热度字段 / sleep 热联合降级保护 / 前端热度投影,不改变召回排序;关闭则跳过 heat 计算与热度触达,sleep 降级退回纯时间分层。也走 feature_flags 白名单(面板可启停=回滚开关),lightMode 预设强制关 |
398
+ | `heatGlobalAlpha` | `1.2` | 幂律形状参数 α(`H=1/(1+λΔt)^α`),越大衰减越快 |
399
+ | `heatTypeDecay` | 内置 TYPE_DECAY | per-type 衰减因子 λ;λ=0 的类型免疫(preference/pattern/summary 热度恒 1.0,sleep 永不降级) |
400
+ | `sleepHeatThreshold` | `0.05` | sleep 降级联合判定热度下限:heat<该值 **且** importance<5 才允许降级 |
401
+ | `recallRecordDefault` | `true` | recall_runs 记录默认开(显式传 `recordRecall:false` 的调用方不受影响) |
402
+ | `recallRetentionDays` | `90` | recall_runs 滚动清理保留天数 |
406
403
  | `hotMemoryRounds` | `5` | 会话级短期热记忆轮次(v0.5.0):最近 N 轮对话滚动注入,从会话事件日志无状态重建、不落库 |
407
404
  | `hotMemoryMaxTokens` | `2000` | 热记忆 token 预算(v0.5.0,200-32000),超出滚动截断 |
408
405
  | `selectiveInjectEnabled` | `true` | 选择性注入(v0.5.0):query 向量可用时注入候选按主题相似度重排,替代固定规则序 |
@@ -410,8 +407,6 @@ dsh web
410
407
  | `searchSemanticDedupThreshold` | `0.95` | 语义去重相似度阈值(v0.5.0,默认 0.95,范围 0.5-1.0):`searchSemanticDedup=true` 时生效,调整可防小模型误折叠 |
411
408
  | `memoryQualityFilter` | `{enabled:true, archiveThreshold:30, degradeThreshold:60, minContentLength:10}` | 记忆质量过滤(v0.4.6,默认开):写库前启发式打分 0-100,元记忆词汇/自指/过短/重复/近似重复扣分;≥60 正常存储,30-60 降权(注入排序按 importance×quality/100),<30 归档标记 `low_quality`(显式搜索仍可召回,永不自动注入) |
412
409
  | `llmAudit` | `{enabled:true, retentionDays:90}` | LLM 消耗审计(v0.4.6,默认开):每次后台 LLM 调用(autoDream/autoSummarize)写 `llm_audit_logs`(tokens/duration/status/source);失败记 error 不阻塞;只读 API `/api/dsh-mneme/semantic/llm-audit` + `/llm-audit/stats` |
413
- | `sessionLifecycleEnabled` | `false` | 会话生命周期(v0.6.0,默认关):开启后会话被删除/销毁时自动把该会话出生的记忆软隐藏(`session_disposed_at`,与 `archived` 正交、可恢复);存量无 `session_id` 的记忆永不参与清理 |
414
- | `showSidebarTrigger` | `true` | 侧边栏底部(左下角)记忆入口按钮(issue #38,默认开):与其他插件(如 dsh-cost-meter)抢占同一 footer slot 导致 UI 冲突时可关掉;仅隐藏按钮,记忆库仍可通过顶部「记忆库」标签访问。Web 面板「设置」里有对应开关 |
415
410
 
416
411
  > 🔐 **API 安全**:DSH 无内置鉴权且默认仅监听 `127.0.0.1`。插件 API 默认开放(便于 Web 面板即装即用)。如需防护(如局域网暴露),在配置中设置 `apiToken`:写操作(画像/规则/命令)与密钥端点(`vector-config`、`vector-reindex`)需携带 `Authorization: Bearer <token>`(前端设置面板可填入同一 token),只读的 `list` / `search` / `semantic` 保持开放。`/api/dsh-mneme/vector-config` 返回的 `apiKey` 已掩码(`sk-***…`),存储仍保留明文供调用;前端回传空或掩码值表示"不改 key"。
417
412
 
package/cordis.patch.yml CHANGED
@@ -13,4 +13,9 @@
13
13
  dreamThresholdCount: 10
14
14
  dreamThresholdChars: 5000
15
15
  dreamDelayMs: 2000
16
+ # 巩固默认压低推理:思考型模型(如方舟 v4 系)会把 dreamMaxTokens
17
+ # 预算花在推理上、正文空体 → "no json array in llm output"。low 让
18
+ # provider 封顶推理;拒绝 effort 字段的 provider 由 runAuditedLlm
19
+ # 自动去掉重试,行为安全(v0.7.16 机制)。
20
+ dreamReasoningEffort: low
16
21
  entityExtractionEnabled: true
package/lib/api.js CHANGED
@@ -3,6 +3,7 @@ import { readFileSync } from "node:fs";
3
3
  import { timingSafeEqual, randomBytes } from "node:crypto";
4
4
  import { FEATURE_FLAG_SPEC } from "./settings.js";
5
5
  import { TYPE_FILE, renderMirrorText, parseHumanEdits } from "./mirror.js";
6
+ import { computeHeat } from "./heat.js";
6
7
 
7
8
  // headers:少数端点(/export 附件下载)需要追加 Content-Disposition 等响应头。
8
9
  function sendJson(res, status, payload, headers = {}) {
@@ -178,18 +179,26 @@ export function createApi(ctx, service, settings, commands, embedder, semantic =
178
179
  // archived=only:只看归档(状态页的归档列表用)。归档行不进默认列表,
179
180
  // 所以这是独立的视图开关,而不是 includeArchived 的混看模式。
180
181
  const onlyArchived = url.searchParams.get("archived") === "only";
181
- const rows = service.list({ type, limit, offset, order, minImportance, source, updatedFrom, updatedTo, onlyArchived });
182
+ // deposited=only:只看 autoDream 巩固过的记忆(receipt_chain
183
+ // merge/update verdict ∪ source=dream 直写)——状态页「查看全部」
184
+ // 与记忆库的「沉淀」筛选 chip 共用这个视图。
185
+ const depositedOnly = url.searchParams.get("deposited") === "only";
186
+ const rows = service.list({ type, limit, offset, order, minImportance, source, updatedFrom, updatedTo, onlyArchived, depositedOnly });
182
187
  // 面板行在 wire DTO 之上补 archived/quality_score——模型工具的输出
183
188
  // schema 严格复用 toApiList,扩展只发生在 HTTP 层。
189
+ // heat 投影(阶段二前端数据源):仅 heatEnabled=true 时下发逐条热度
190
+ // (heat.js 纯函数,λ=0 免疫类型恒 1.0);字段缺省时前端徽章自动隐藏。
191
+ const heatOn = config?.heatEnabled === true;
184
192
  const items = service.toApiList(rows).map((m, i) => ({
185
193
  ...m,
186
194
  archived: rows[i].archived === true || rows[i].archived === 1,
187
- quality_score: rows[i].quality_score ?? null
195
+ quality_score: rows[i].quality_score ?? null,
196
+ ...(heatOn ? { heat: computeHeat(rows[i], Date.now(), config ?? {}) } : {})
188
197
  }));
189
198
  // Total honors the same filters as the rows, or the pager's
190
199
  // has-more math breaks whenever minImportance/source/updated-at
191
200
  // bounds are active.
192
- sendJson(res, 200, { items, total: service.count(type, { minImportance, source, updatedFrom, updatedTo, onlyArchived }) });
201
+ sendJson(res, 200, { items, total: service.count(type, { minImportance, source, updatedFrom, updatedTo, onlyArchived, depositedOnly }) });
193
202
  } catch {
194
203
  sendJson(res, 500, { error: "internal" });
195
204
  }
@@ -586,7 +595,10 @@ export function createApi(ctx, service, settings, commands, embedder, semantic =
586
595
  name: n.name,
587
596
  type: n.type ?? null,
588
597
  mention_count: n.mention_count ?? 1,
589
- distance: n.distance
598
+ distance: n.distance,
599
+ // v0.7.0 实体热投影:实体热 = 关联记忆 heat 聚合(max),前端据此
600
+ // 缩放节点大小/明暗。heatEnabled=false 时 entityHeat 返回 null。
601
+ heat: service.entityHeat?.(n.id) ?? null
590
602
  })),
591
603
  edges: [...edgeMap.values()].map((e) => ({
592
604
  id: e.id,
@@ -775,7 +787,13 @@ export function createApi(ctx, service, settings, commands, embedder, semantic =
775
787
  status: r.status,
776
788
  provider: r.provider ?? null,
777
789
  model: r.model ?? null,
778
- error: r.error ?? null
790
+ error: r.error ?? null,
791
+ run_type: r.run_type ?? "auto",
792
+ // sleep 审计:heat/时间分层降级决策计数(工作动态可展示"降级 N 条")。
793
+ // 数据来自 runSleep 写入的 decisions.demotion({demoted,archived} 数组)。
794
+ demotion: r.decisions?.demotion
795
+ ? { demoted: (r.decisions.demotion.demoted ?? []).length, archived: (r.decisions.demotion.archived ?? []).length }
796
+ : null
779
797
  }));
780
798
  const pendingConflicts = service.countConflictPending?.() ?? 0;
781
799
  const ids = new Set();