stratagate-dsh 0.3.16 → 0.3.18

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/docs/DSH.md CHANGED
@@ -148,17 +148,35 @@ memory_record_use memory_remember
148
148
  memory_profile_update
149
149
  ```
150
150
 
151
- `memory_get_blocks` accepts `scope=session` (the default, preserving the historical
152
- session-local behavior) or `scope=namespace` (all threads in the active project,
153
- session, or global namespace). Every response includes the selected `scope`,
151
+ `memory_get_blocks` returns a paginated directory: each row contains only `id`,
152
+ `title`, `turnRange`, and the current `level`. Read source content with `memory_expand_block`.
153
+ It accepts `offset` and `limit` (default 12, bounded to 1–20), and returns `total`,
154
+ `offset`, `limit`, and `nextOffset` (`null` at the end). `blockCount` counts all matching
155
+ ready blocks before pagination. An offset past the end returns an empty page without
156
+ reporting that the scope has no blocks.
157
+
158
+ `scope=session` (the default) strictly matches the active `threadId`.
159
+ `scope=namespace` includes all threads and legacy unthreaded blocks in the active project,
160
+ session, or global namespace. Every response includes the selected `scope`,
154
161
  `namespace`, `threadId`, block counts, and `emptyReason`. A `null` reason means
155
- blocks were returned; `no_blocks_in_namespace` means the namespace has no sealed
162
+ matching ready blocks exist; `no_blocks_in_namespace` means the namespace has no sealed
156
163
  blocks, `blocks_exist_in_other_threads` means only another thread has sealed
157
164
  blocks, and `open_tail_pending` means matching turns exist but have not sealed yet.
158
- `memory_search_raw` defaults to namespace scope and accepts the same `scope` filter,
165
+ `memory_search_raw` defaults to namespace scope and uses the same strict thread filter for `scope=session`,
159
166
  so a raw hit's `blockId` can be followed by `memory_get_blocks(scope=namespace)`
160
167
  or `memory_expand_block` without an unexplained visibility mismatch.
161
168
 
169
+ The deprecated `memory_search_elements` tool is no longer registered; use
170
+ `memory_search_graph`. Legacy agent-memory provenance transcripts display `Recorded:`
171
+ while preserving the stored raw messages.
172
+
173
+ Automatic Event extraction now checks existing cards before admission. After upgrade,
174
+ a resumable background task scans each existing namespace once when a model is available.
175
+ Exact duplicates retain one card; similar candidates receive a dedicated conservative model
176
+ review. Distinct timing, scope, versions, progress, and uncertain facts remain separate.
177
+ Confirmed redundant cards are archived with their original provenance, never deleted.
178
+ System Status shows a summary without requiring pair-by-pair user action.
179
+
162
180
  Search responses use compact cards by default. Event cards keep `id`, `title`, `summary`, source time,
163
181
  status/scope, `sourceBlockId`, `batchId`, and `evidenceRefs`; graph cards keep `id`, `name`, type,
164
182
  aliases, current state, status, and explainable `matchedFields`/`matchReason`; raw cards keep the
@@ -237,9 +255,13 @@ For diagnostics, the five most recent successful memory-model responses are reta
237
255
 
238
256
  ## Compatibility and permissions
239
257
 
240
- Installation peers and startup checks support the complete DSH `0.2.0` version family: all Alpha, Beta, RC, and stable releases (`>=0.2.0-0 <0.2.1-0`), without enumerating individual prereleases. Previously supported DSH `0.1.2-rc.1`, CLI `0.1.5-rc.1` (internal packages `0.1.5-rc.2`), `0.1.6-alpha.1`, and the `0.1.7` family from rc.1 through stable remain supported. Startup still requires one coherent internal DSH version and compatible Cordis `4.0.x` patches from `4.0.4` and Schemastery `3.18.x` patches from `3.18.4`; older hosts retain their original dependency families. DSH `0.1.8`, `0.2.1`, and their prereleases remain excluded.
258
+ DSH `0.2.1-rc.1` reads the unified host declaration `engines.dsh: "0.1.2-rc.1 || >=0.1.5-rc.1 <0.3.0-0"`; older hosts use the peer declarations. CLI `0.1.5-rc.1` shipped internal packages at `0.1.5-rc.2`, explaining the different lower bounds.
259
+
260
+ Installation peers use continuous compatibility ranges: `0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0` for general DSH interfaces and `>=0.1.5-rc.2 <0.3.0-0` for Session Format interfaces. Existing legacy adapters remain available. Hosts such as `0.2.1-rc.1` and later `0.2.x` updates need no individual whitelist entries or patch-version upper bounds. DSH `0.3.0`, including every prerelease, remains outside the support boundary until its key interfaces are verified. DSH checks these ranges with `includePrerelease`, accepting alpha, beta, RC, and stable versions within the boundary; ordinary npm range matching does not guarantee acceptance of later prereleases.
261
+
262
+ Startup still requires one coherent internal DSH version. From the `0.2.0` prereleases onward, Session Format packages must also match the core version. Modern hosts require Cordis `4.0.x` patches from `4.0.4` and Schemastery `3.18.x` patches from `3.18.4`; older hosts retain their original dependency families. Before migration or database access, startup checks tool registration, system prompt, model streaming, and default model selection interfaces. The migration loader also validates codec, migration-stage, and restoration entry points before proceeding. Missing interfaces stop the operation with a specific diagnostic. Method presence alone does not prove behavioral compatibility: strict artifact validation, immutable source generations, and recovery receipts remain in place. A continuous range does not mean every version within it has been tested.
241
263
 
242
- Development dependencies are pinned to DSH `0.2.0-rc.2` for reproducible checks. The release-gate matrix is configured to verify the previously listed older hosts plus `0.2.0-rc.1` and `0.2.0-rc.2` on Node `24`, Linux, and Windows. `dshWorkshop.compatibility.dshVersions` records concrete verification hosts; installation compatibility comes from the full peer ranges, so that test list does not restrict future `0.2.0` updates.
264
+ Development dependencies remain pinned to DSH `0.2.0-rc.2` for reproducible checks. `dshWorkshop.compatibility.dshVersions` records concrete regression hosts rather than an installation whitelist. Use `DSH_VERSION=<version> node scripts/run-dsh-compatibility.mjs` to check a new host within the peer ranges. Current repository policy skips GitHub CI and Roadmap synchronization while retaining local verification.
243
265
 
244
266
  On DSH `0.2.0`, the host-owned `dsh-session-format`, `dsh-session-format-catalog`, and `dsh-session-format-v0-to-v1` packages must also match the core DSH version. Mixed or missing Session Format packages stop startup before legacy migration; earlier hosts retain their existing compatibility rules.
245
267
 
package/docs/DSH.zh-CN.md CHANGED
@@ -128,15 +128,25 @@ memory_record_use memory_remember
128
128
  memory_profile_update
129
129
  ```
130
130
 
131
- `memory_get_blocks` 支持 `scope=session`(默认值,保留历史上的当前会话隔离语义)和
132
- `scope=namespace`(当前 project、session 或 global 命名空间中的全部 thread)。每次响应都会
133
- 包含实际 `scope`、`namespace`、`threadId`、Block 计数,以及机器可读的 `emptyReason`:返回
134
- Block 时为 `null`;`no_blocks_in_namespace` 表示命名空间没有已封存 Block;
131
+ `memory_get_blocks` 返回分页目录,每项仅含 `id`、`title`、`turnRange` 和当前 `level`;
132
+ 正文通过 `memory_expand_block` 获取。支持 `offset/limit`,默认每页 12 项,限制在 1–20 项,
133
+ 返回 `total/offset/limit/nextOffset`,末页的 `nextOffset` 为 `null`。
134
+ `blockCount` 表示分页前匹配的就绪块总数;offset 超出末页时返回空页,不误报范围内没有块。
135
+
136
+ `scope=session`(默认值)严格匹配当前 `threadId`;`scope=namespace` 包含当前 project、session
137
+ 或 global 命名空间中的全部 thread 及没有 threadId 的旧块。每次响应都会
138
+ 包含实际 `scope`、`namespace`、`threadId`、Block 计数,以及机器可读的 `emptyReason`:
139
+ 匹配的就绪 Block 存在时为 `null`;`no_blocks_in_namespace` 表示命名空间没有已封存 Block;
135
140
  `blocks_exist_in_other_threads` 表示只有其他 thread 有已封存 Block;`open_tail_pending`
136
141
  表示匹配的轮次存在但尚未封存。`memory_search_raw` 默认使用 namespace 范围,也接受同样的
137
- `scope` 过滤,因此可以用 `memory_get_blocks(scope=namespace)` 或 `memory_expand_block`
142
+ `scope` 过滤,`scope=session` 同样严格按 threadId 匹配。因此可以用 `memory_get_blocks(scope=namespace)` 或 `memory_expand_block`
138
143
  继续浏览 raw 命中的 `blockId`,不会再出现范围不明的空结果。
139
144
 
145
+ deprecated 的 `memory_search_elements` 已停止注册,请使用 `memory_search_graph`。
146
+ 旧 agent-memory 来源块的转录展示改为 `Recorded:`,原始消息记录保持不变。
147
+
148
+ 重复记忆由程序发现候选、AI 优先判断并整理完整合并稿。明确应保留两张的结果直接完成;只有不确定、证据不足或未完成的候选进入人工队列。用户可编辑完整稿、仅保留 A/B 或同时保留,并查看来源、处理历史及撤销。双方证据和历史记录保留,后续新增记忆也会发现新候选。任务和调用预算可跨重启恢复。详见 [Event 提取与重复卡整理](event-extractor.md)。
149
+
140
150
  搜索默认返回紧凑卡片:Event 保留 `id`、标题、摘要、时间、状态/范围和 `sourceBlockId`;Graph
141
151
  保留 `id`、名称、类型、别名、当前状态及可解释的 `matchedFields`/`matchReason`;Raw 保留消息
142
152
  ID、`blockId`、角色、轮次和有界摘录。`narrative`、`quotes`、来源消息列表、完整 facts/edges
@@ -214,11 +224,13 @@ Topic Projection 优先将全部本批 Event 完整分配到章节和小节。
214
224
 
215
225
  ## 兼容性与权限
216
226
 
217
- 安装声明与启动检查支持整个 DSH `0.2.0` 版本族:全部 Alpha、Beta、RC 和正式版(`>=0.2.0-0 <0.2.1-0`),无需逐个列出预发布版本。此前支持的 DSH `0.1.2-rc.1`、CLI `0.1.5-rc.1`(内部包 `0.1.5-rc.2`)、`0.1.6-alpha.1`,以及从 rc.1 到正式版的 `0.1.7` 仍受支持。启动时仍要求核心 DSH 包来自同一个版本,并限制 Cordis 为 `4.0.x`(从 `4.0.4` 起)、Schemastery 为 `3.18.x`(从 `3.18.4` 起);早期宿主保留其原有依赖族。`0.1.8`、`0.2.1` 及其预发布版本均不在支持范围内。
227
+ 新版 DSH(从 `0.2.1-rc.1` 起)直接读取统一宿主声明 `engines.dsh: "0.1.2-rc.1 || >=0.1.5-rc.1 <0.3.0-0"`;旧版宿主继续使用 peer 声明。CLI `0.1.5-rc.1` 对应内部包 `0.1.5-rc.2`,两者下限不同是历史发布差异。
228
+
229
+ 安装声明使用连续兼容范围:普通 DSH 接口为 `0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0`,Session Format 接口为 `>=0.1.5-rc.2 <0.3.0-0`。保留已有旧版适配,取消每次宿主升级都追加白名单和设置补丁版本上限的做法;`0.2.1-rc.1` 及后续 `0.2.x` 更新无需逐版追加。`0.3.0` 及其全部预发布版暂不接纳,待关键接口验证后再调整边界。DSH 的兼容检查启用了 `includePrerelease`,范围内的 Alpha、Beta、RC 和正式版均可匹配;普通 npm 的默认范围匹配不保证接纳后续预发布版。
218
230
 
219
- 开发依赖固定为 DSH `0.2.0-rc.2`,保证检查可复现。发布门禁配置在 Node `24`、Linux 和 Windows 上验证此前列出的旧宿主,以及 `0.2.0-rc.1` 和 `0.2.0-rc.2`。`dshWorkshop.compatibility.dshVersions` 记录用于验证的具体宿主;安装兼容性由完整的 peer 版本范围声明,测试版本列表不会限制新的 `0.2.0` 更新。
231
+ 运行时仍要求核心 DSH 包来自同一个版本;从 `0.2.0` 预发布版起,也要求 Session Format 包与核心版本一致。新版宿主的 Cordis 保持 `4.0.x`(从 `4.0.4` 起)、Schemastery 保持 `3.18.x`(从 `3.18.4` 起),早期宿主保留其原有依赖族。启动时先检查工具注册、系统提示词、模型调用和默认模型选择接口,再迁移会话或打开数据库;迁移模块加载后,先验证编解码器、迁移阶段和恢复校验入口。接口缺失时给出具体名称并停止操作。方法存在不保证行为完全兼容,迁移仍保留严格内容校验、原始代际不变与恢复收据;连续版本范围也不代表已实测其中每个版本。
220
232
 
221
- 在 DSH `0.2.0` 上,由宿主提供的 `dsh-session-format`、`dsh-session-format-catalog` 和 `dsh-session-format-v0-to-v1` 也必须与核心 DSH 包版本一致。Session Format 包混装或缺失时,插件会在旧会话迁移前拒绝启动;早期宿主保留原有兼容规则。
233
+ 开发依赖固定为 DSH `0.2.0-rc.2`,保证检查可复现。`dshWorkshop.compatibility.dshVersions` 记录用于回归验证的具体宿主,不是安装白名单;安装兼容性由 peer 版本范围声明。可通过 `DSH_VERSION=目标版本 node scripts/run-dsh-compatibility.mjs` 验证范围内的新宿主。按当前仓库约定跳过 GitHub CI 与 Roadmap 同步,保留本地验证。
222
234
 
223
235
  DSH 核心包现在都是由宿主提供的可选 peer。若某个 profile 曾在本地安装这些 peer,升级后、启动前运行 `dsh plugin --profile <名称> exec stratagate-dsh-repair`。该命令只会把已知 DSH 运行时包移动到 profile 内的 `.stratagate-runtime-backups` 并写入恢复收据,不会删除包或触碰会话数据。启动时 bootstrap 还会把 StrataGate 自身的 DSH 导入定向到宿主维护的共享模块回退目录,再检查实际解析出的 DSH 核心族;未知宿主会立即给出明确错误并停止,而不是让正文区域空白。对于受支持的 DSH `0.1.5`、`0.1.6`、`0.1.7` 和 `0.2.0`,含已废弃 `stratagate/memory-citations` 事件的 v0 会话会先复制成经过校验的 v1 代际,再由宿主继续其迁移链;原始 v0 日志不会被修改,并写入 `stratagate-legacy-citations-v1.json` 记录源/目标哈希和恢复说明。
224
236
 
@@ -1,6 +1,6 @@
1
1
  # Event Extractor v2
2
2
 
3
- 新版规则只用于升级后正常提取的新 Event。不会重放旧 L5、改写旧标题、拆分或合并旧 Event,也不会回填分类提示或版本号。已有待处理任务仍按正常重试规则处理。
3
+ 新版提取规则只用于升级后正常提取的新 Event。提取器不会重放旧 L5、改写旧标题或回填分类提示和版本号。已有待处理任务仍按正常重试规则处理。历史重复卡由下述独立的一次性整理任务处理。
4
4
 
5
5
  ## 提取判断
6
6
 
@@ -16,6 +16,22 @@ Extractor 结构化输出必须明确返回合法 scope。工具调用及文本
16
16
 
17
17
  纯重复且没有新增长期信息可不提取;明确强化或延续用 sameEventId,替代/纠正用 supersedesEventIds,无法确认替代的矛盾用 conflictsWithEventIds。历史卡保留。相同项目、关键词近似不能单独建立关系。现有 timeline 仍最多提供 8 条相关及 4 条最近 Event,增加每条最多 400 字符的摘要、范围和历史状态以辅助识别;字段对自定义 Extractor 保持可选。timeline / neighbor 只供理解和关系匹配,不能为新事实提供来源。
18
18
 
19
+ ## 入库去重与一次性历史整理
20
+
21
+ 程序负责从当前命名空间的 passive/agent 两个 Event 池发现候选。同批同来源的重复输出仍确定性消重,写入回执继续处理重放;跨 Block 的相似记录即使文字相同,也交给 AI 判断,不能仅凭文本相似直接丢弃新来源。
22
+
23
+ 专用裁决器读取双方完整卡与来源。KEEP_LEFT/KEEP_RIGHT 选择沿用的主卡,并返回完整标题和正文草稿;只有证据支持同一事实、草稿有效且 confidence 至少为 0.9 时才自动采用。缺失信息、表达精度和分类差异不单独构成冲突;不同发生、后续进展、纠正或真实矛盾应明确 KEEP_BOTH,不确定才 REVIEW。明确 KEEP_BOTH 视为 AI 已完成,不要求用户逐对确认。缺草稿、低把握、失败或证据超限时保留原卡,进入人工队列,不回退到程序拼接。阈值是执行规则,并非经真实模型评测校准的准确率。
24
+
25
+ 整理版本为 3,升级时重审未由人工确认的旧候选,并保留已有撤销记录。扫描包括 active/superseded 卡;自动裁决只处理双方 active 的候选,历史版本直接进入人工队列,不消耗自动裁决调用。初次扫描完成后,新增 Event 会触发新候选发现,已处理候选不反复调用模型。程序检查命名空间/会话范围、指纹、置顶和关系完整性;日期、数值等语义差异交给 AI 或人工结合上下文判断。合并采用完整草稿,双方引语、参与者、标签、来源及安全关联按规则保留;沿用主卡的结构化日期和状态,界面提示有差异的字段。自动合并及普通有效卡合并遇到进展、替代、冲突关系或时间环时拒绝折叠;显式人工历史合并保留原始时间链,不重定向历史关联。权重继承双方真实采用字段最大值,不制造采用回执。
26
+
27
+ 后台保留跨进程租约、调用前预留尝试、每对最多两次、60 秒退避和 30 秒外层超时。人工预览复用当前来源指纹对应的 AI 稿;无缓存时可请求草稿,失败后仍可直接填写完整稿,最终确认本身不调用模型。界面分为“需要你判断 / 等待 AI / 已处理”,支持完整标题/正文编辑、仅保留 A/B、保留两张、来源查看和手动接管。切换候选/队列会在当前页面保留最多 50 份编辑草稿;刷新不保存未提交的人工编辑。自动与人工合并均保存可恢复的逆操作;撤销会恢复原内容、历史状态及关系,有后续编辑、采用或相关投影变化时拒绝覆盖新数据。
28
+
29
+ 界面逐组展示 A/B 卡片及发生日期、引语、参与者和来源。用户先选主卡,再选择“合并双方内容”或“只保留所选卡”,预览保留/归档对象、日期和证据去向后确认。日期或事实存在差异时可由用户核对完整稿后合并,不确定时保留两张。superseded 历史卡可在人工确认后补入当前有效卡:默认推荐当前卡作为主卡,完整标题和正文必须经 AI 起草或人工编辑后提交;旧卡归档且保留原文、来源及时间链,双方证据汇入当前卡,当前卡结构化日期和状态不变,外部关联不改写。若旧卡指向另一个版本、将被归档的卡已置顶或已作为其他合并的原始证据,拒绝合并并显示具体原因。用户仍可显式二选一(恢复历史卡前单独提示影响):所选卡设为 active,另一张归档,内容、采用权重、原始来源和历史引用均不混合、不改写;不额外排入模型投影任务。置顶副卡、已合并来源和过期指纹仍受保护。人工选择独立记为 selected,不冒充 merged;归档 agent 卡可通过显式来源页面查看证据。撤销后回到“需要你判断”并定位刚恢复的候选,避免跳到无关卡片。
30
+
31
+ 存储 schema 13 通过独立 event_merge_sources 表记录 mergedFromEventIds;普通卡继续采用单来源边界,合并卡的额外消息必须来自可追溯的归档原卡。schema 12 可只读查看并无损升级,旧插件会拒绝打开更高存储版本。撤销外部导入时,若其证据已参与合并则拒绝整批删除,避免破坏其他来源。narrative 是已退役的 Event 字段,现存正文在 summary;合并不生成或改写事实正文。
32
+
33
+ 这套机制减少重复,但不能保证语义改写零漏判。仅共享主题、后续进展或时间不明的重复发生都优先保留;不会为追求去重率抹掉独立事实。存量扫描采用词元候选召回,低词面重合的同义表达仍可能未命中。
34
+
19
35
  ## 可选字段与兼容
20
36
 
21
37
  | 字段 | 语义 | 边界 |
@@ -29,4 +45,4 @@ SQLite 用新增的可选 `event_metadata` 附表保存这两个字段,支持
29
45
 
30
46
  ## 验证边界
31
47
 
32
- 确定性测试验证 prompt/schema 合约、模型输出归一化、同 Block 精确去重、目标来源边界、relation 写入、SQLite 往返、旧库只读/升级、无历史重提取/回填,以及旧卡的检索、Topic、Graph、API 和 UI 路径。测试里的模型响应是 mock,并非真实模型语义准确率测量;同义识别、提取敏感度及泛化质量仍取决于实际模型。未新增模型调用、依赖、全局 consolidation 或目录算法。
48
+ 确定性测试验证 prompt/schema 合约、模型输出归一化、同 Block 及跨 Block 去重、目标来源边界、relation 写入、SQLite 往返、旧库只读/升级、无历史重提取/回填,以及旧卡的检索、Topic、Graph、API 和 UI 路径。去重另覆盖模型失败/低把握时保留、并发变化、跨进程租约、检查点恢复和一次性执行。测试里的模型响应是 mock,并非真实模型语义准确率测量;同义识别、提取敏感度及泛化质量仍取决于实际模型。未新增依赖或目录算法。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stratagate-dsh",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "description": "Recent conversations stay vivid. Older ones fade into summaries, not oblivion. StrataGate gives DeepSeek Harness six-layer, time-decaying memory, while lasting events and relationships settle into a knowledge graph. Bring your memories from other AIs with you—no need to start over.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -151,21 +151,22 @@
151
151
  "access": "public"
152
152
  },
153
153
  "engines": {
154
+ "dsh": "0.1.2-rc.1 || >=0.1.5-rc.1 <0.3.0-0",
154
155
  "node": "^22.19.0 || >=24.0.0"
155
156
  },
156
157
  "peerDependencies": {
157
158
  "@deepseek-ai/cordis": "4.0.2 || ~4.0.4",
158
- "@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
159
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
160
- "@deepseek-ai/dsh-llm": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
161
- "@deepseek-ai/dsh-native-command": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
162
- "@deepseek-ai/dsh-session": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
163
- "@deepseek-ai/dsh-session-format": "0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
164
- "@deepseek-ai/dsh-session-format-catalog": "0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
165
- "@deepseek-ai/dsh-session-format-v0-to-v1": "0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
166
- "@deepseek-ai/dsh-settings": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
167
- "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
168
- "@deepseek-ai/dsh-tools": "0.1.2-rc.1 || 0.1.5-rc.2 || 0.1.6-alpha.1 || >=0.1.7-rc.1 <0.1.8-0 || >=0.2.0-0 <0.2.1-0",
159
+ "@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
160
+ "@deepseek-ai/dsh-client-ui-conversation": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
161
+ "@deepseek-ai/dsh-llm": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
162
+ "@deepseek-ai/dsh-native-command": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
163
+ "@deepseek-ai/dsh-session": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
164
+ "@deepseek-ai/dsh-session-format": ">=0.1.5-rc.2 <0.3.0-0",
165
+ "@deepseek-ai/dsh-session-format-catalog": ">=0.1.5-rc.2 <0.3.0-0",
166
+ "@deepseek-ai/dsh-session-format-v0-to-v1": ">=0.1.5-rc.2 <0.3.0-0",
167
+ "@deepseek-ai/dsh-settings": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
168
+ "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
169
+ "@deepseek-ai/dsh-tools": "0.1.2-rc.1 || >=0.1.5-rc.2 <0.3.0-0",
169
170
  "@deepseek-ai/schemastery": "3.18.2 || ~3.18.4"
170
171
  },
171
172
  "peerDependenciesMeta": {
@@ -226,6 +227,7 @@
226
227
  "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
227
228
  "@deepseek-ai/schemastery": "3.18.4",
228
229
  "@types/node": "^22.0.0",
230
+ "@types/semver": "^7.8.0",
229
231
  "cytoscape": "^3.34.1",
230
232
  "cytoscape-fcose": "^2.2.0",
231
233
  "esbuild": "^0.28.2",
@@ -236,7 +238,8 @@
236
238
  },
237
239
  "dependencies": {
238
240
  "ngraph.graph": "^20.1.2",
239
- "ngraph.leiden": "^0.3.0"
241
+ "ngraph.leiden": "^0.3.0",
242
+ "semver": "^7.8.5"
240
243
  },
241
244
  "directories": {
242
245
  "doc": "docs",
@@ -1,41 +0,0 @@
1
- # Issue #119 修复与验证
2
-
3
- 基线:`e954eaf2f2cbbef4bb6226a2ebb35191424868c2`(main,stratagate-dsh 0.3.6)。
4
-
5
- ## 根因与修改
6
-
7
- - 日志中的 656、778 字符概要均正常结束于 `tool-calls`,被 600 字符业务上限拒绝,不能归因于 token 截断。现在使用 `TOPIC_OVERVIEW_MAX_CHARACTERS = 1000`,按 Unicode code point 计数,保留原文,不截断。
8
- - DSH `StringValueSchemaSpec` 只支持类型、枚举、常量和注解,不支持 `maxLength`。工具字段说明与提示词引用同一常量,解析器和存储提交门调用同一校验函数。
9
- - 旧 `TopicOverviewRepairGuard` 把未保存的违规草稿计数和来源持久化成补写义务,还从历史字段错误推导“至少一段”的要求。删除这套草稿守卫、错误携带和跨批分配逻辑,保留语义去重。旧 `overviewRepairRequirements` 字段仅供快照兼容与识别恢复对象,不发送给模型、不约束提交,重排、失败或成功时清理。
10
- - 有效旧概要仍由原有存储逻辑继承;章节成员与小节归属、来源权限、批次覆盖、源版本、租约、陈旧响应和原子提交检查继续生效。原有合法重分类、来源失效和遗忘语义不变,旧小节消失时仍按现有规则移除孤立概要。
11
- - 提示词先要求完整事件归类;新增概要通常 0~2 段,无必要时允许空数组,建议 300~600 字符,不为凑长度省略事实,不复述已有内容。
12
- - 沿用 `recoveryVersion`,升级为 2。仅恢复仍有效、有未完成工作且命中概要字段、旧草稿要求、Provider 失败或原始 `invalid-output` 签名的终态任务。无关内容校验、超时和 worker 失败不获得新周期。已完成来源、失效来源、已有排队工作、重启和并发写入沿用原有排除与持久化机制;单周期仍最多三次任务尝试,没有新增恢复状态机。
13
-
14
- ## Provider 预算与剩余证据
15
-
16
- DSH `LlmResolvedModelInfo` 公开 `context.contextWindow` 和 `defaultMaxTokens`;后者仅是未显式指定输出预算时使用的普通默认值,不证明模型能力,也不限制 Topic 的独立请求。Topic 保留 32,768 上限,仅按实际 provider/model 路由已知的上下文剩余空间收缩。当前元数据没有可用的已验证模型输出硬上限,不据默认值猜测 Provider 限制。提示中的预算与每次实际请求保持一致,包括内容重试和 reasoning-off 回退。审查后的实现删除了普通默认值限流和对应缓存。
17
-
18
- 无法容纳输入的模型配置报告 `provider-failed`,不归类成内容校验错误。输出实际截断继续用 `max-tokens` 和现有有界拆批;Provider 异常继续走现有任务退避,无新增专属补丁或重试次数。普通默认值为 512、1024 的路由测试使用 12 张 Event 和两段 1000 字符概要,完整响应的估算 token 超过这些默认值,断言实际请求仍使用独立预算并只调用一次;这是模拟流的请求策略验证,不是低实际预算下的真实生成能力测试。人工重试路径同时保留携带敏感响应的普通 `worker-failed` 脱敏测试。
19
-
20
- Issue 中那次 `finishReason=error` 的根因尚未确认。32,768 可能超过部分模型的输出能力,但也可能是限流、路由或其他请求错误。确认仍需要实际 Provider/model 标识、路由配置的 defaultMaxTokens 与 contextWindow、Provider 错误码/HTTP 状态/请求编号,以及 token usage(含 reasoning)和对应失败请求日志。不得凭当前安全摘要断言是哪一项。
21
-
22
- ## 固定模拟响应对比
23
-
24
- 在固定 main 与首轮修复提交 `6edcb34445e58e9df1ede0189e118672f90fcb42` 上运行同一临时重放测试,使用 `tests/llm.test.ts` 的 `modelBridge`、`context`、`proposal` 辅助函数;只把新概要 text 替换成 `𠮷.repeat(length)`。第一次与第二次流均正常结束于 `tool-calls`;656、778、1000 的第二次响应重复原响应;1001 的第二次响应返回空概要且保留全部章节/小节归类。其余输入与输出一致。保留这次原始测量;审查修复不改变这些未配置路由默认值的概要校验场景,新的定向测试继续覆盖其行为。
25
-
26
- | 首次字符数 | 修复前结果 / 调用数 | 修复后结果 / 调用数 |
27
- | --- | --- | --- |
28
- | 656 | 长度校验失败 / 2 | 首次通过 / 1 |
29
- | 778 | 长度校验失败 / 2 | 首次通过 / 1 |
30
- | 1000 | 长度校验失败 / 2 | 首次通过 / 1 |
31
- | 1001 → 空概要 | 草稿守卫拒绝 / 2 | 合法重试通过 / 2 |
32
-
33
- 这组样例首次通过率 0/4 → 3/4,总调用数 8 → 5,最终完成 0/4 → 4/4。1001 字符始终拒绝,成功来自第二次合法结果。原始输出保存在 [修复前](issue119-before.json) 与 [修复后](issue119-after.json)。这是模拟流经过真实实现的测量,不是线上成功率、真实模型遵从度或提示词效果的测量;未调用真实 Provider,未读取用户数据库。
34
-
35
- ## 回归范围
36
-
37
- 定向测试覆盖 656、778、1000 / 1001 与补充平面 Unicode 字符,字段级诊断、Schema 与提示词、草稿舍弃、完整 Event 分类、旧概要和来源继承、伪造来源和遗漏 Event 拒绝、SQLite 重启、旧恢复要求、部分完成与重叠任务、重复提交、并发初始化、失败后有界拆批,以及 Provider 预算配置与分类。
38
-
39
- 首轮修复提交在 Node 24.19.0 下:`npm run check` 全部通过;`npm test` 的 core 286、DSH 580、WorkBuddy 10 项通过,共 876 项通过、1 项既有跳过;`npm run build` 的 core、DSH 和 WorkBuddy 全部通过。隔离安装最初跳过安装脚本,导致旧数据库迁移测试缺少 better-sqlite3 绑定;用相同 Node 24 执行 `npm rebuild better-sqlite3` 后,完整测试通过。未修改依赖或锁文件。
40
-
41
- 审查修复后的本地验证:`tests/llm.test.ts` 与 `tests/memory-topics.test.ts` 共 194 项通过,`packages/core/tests/topic-recovery.test.ts` 25 项通过,共 219 项定向测试通过;`npm run check` 和 `npm run build` 全部通过。已自查实际预算反馈、内容重试与 reasoning-off 回退、上下文预检分类、持久化来源/归属/旧概要保护和有界恢复路径。新提交仍需独立复审及其对应的 CI 结果;未执行用户真实 Windows + DSH 数据库的升级验收。