@yolk_vat-y/dsh-project-memory 0.4.0 → 0.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1 (2026-09-03)
4
+
5
+ ### TS 6.x 兼容
6
+
7
+ - **L2/L3 增强器**:验证 TS Compiler API 在 TypeScript 6.0.3 下完全兼容,放开版本限制;`peerDependencies` 与运行时检查同步支持 `^5.0.0 || ^6.0.0`
8
+ - 仅拦截 TS 7.x+(major 版本通常有 breaking changes),警告提示更新为「请使用 TS 5.x/6.x 获得增强类型」
9
+
3
10
  ## 0.4.0 (2026-09-02)
4
11
 
5
12
  ### TaskBridge:跨会话开发任务(取代 v1.2 workflow 方案,v2.5 契约落地)
@@ -51,7 +58,7 @@
51
58
  - **L2 语义增强层**:用户项目安装 `typescript`(`npm i -D typescript`)后,插件自动激活,利用 TS Compiler API 推导返回类型、实例化泛型、提取接口与类型别名、丰富箭头函数签名
52
59
  - **L3 磁盘缓存层**:增强结果按文件内容 SHA256 哈希缓存至 `.dsh-project-memory/type-cache/<hash>.json`,冷启动毫秒级复用,跨会话持久化
53
60
  - **三级优先级队列**:P0 ACTIVE(`fs/observed` 读文件瞬间)> P1 RECENT(`watch` 变更后)> P2 BATCH(`index_repo` 批量)> P3 BACKLOG(启动补全历史),`setImmediate` 每任务后让出事件循环
54
- - **零配置、零感知**:装 TS 重启 dsh 即可;无 TS 或 `enableTypeScript: false` 时优雅回退 L1 正则;TS 6.x/7.x 检测到警告并回退 L1
61
+ - **零配置、零感知**:装 TS 重启 dsh 即可;无 TS 或 `enableTypeScript: false` 时优雅回退 L1 正则;TS 7.x 检测到警告并回退 L1
55
62
  - **解析策略**:单文件 `createProgram`(快 10x),`createRequire(import.meta.url)` 兼容 ESM,解析优先级:配置 `tsPath` → 项目 cwd 向上 `node_modules/typescript` → 插件自身 `node_modules`
56
63
  - **新增配置**:`tsPath`(可选指定 TS 路径)、`enableTypeScript`(默认 true,设 false 彻底禁用)
57
64
  - **扩展名支持**:新增 `.mts` `.cts`
package/README.md CHANGED
@@ -13,7 +13,7 @@ A persistent **project memory** for [DeepSeek Harness](https://github.com/deepse
13
13
  - **Document memorization** — PDF, Markdown, and plain text files are chunked and summarized by the LLM; each entry carries a `path:line` citation back to the source.
14
14
  - **Code symbol memory** — function, class, and method names with full type signatures (generics, parameters, return types, overloads) are extracted by a dependency-free source scanner (string/comment masking, multi-line signature joining, indentation-aware Python, class-method context), without LLM token usage.
15
15
  - **L1 Enhanced Regex** — zero-dep regex scanner now extracts generics, parameter/return types, overloads, interfaces, and type aliases for all supported languages, producing one-line identity signatures `fn(a: A, b: B): R — file.ts:42`.
16
- - **Optional TypeScript semantic enhancement (L2/L3)** — when `typescript` is installed in the user project (`npm i -D typescript`), the plugin automatically activates a second layer (L2) that uses the TS Compiler API to infer return types, resolve generics, extract interfaces and type aliases, and enrich arrow functions — all asynchronously in a priority queue (P0 on `fs/observed`, P1 on `watch`, P2 on `index_repo`). Results are cached on disk keyed by file content hash (L3) for instant cold-start reuse. Zero config: just install TS and restart dsh. Fully optional; if TS is absent or disabled via `enableTypeScript: false`, the plugin falls back to L1 regex-only extraction.
16
+ - **Optional TypeScript semantic enhancement (L2/L3)** — when `typescript` is installed in the user project (`npm i -D typescript`), the plugin automatically activates a second layer (L2) that uses the TS Compiler API to infer return types, resolve generics, extract interfaces and type aliases, and enrich arrow functions — all asynchronously in a priority queue (P0 on `fs/observed`, P1 on `watch`, P2 on `index_repo`). Results are cached on disk keyed by file content hash (L3) for instant cold-start reuse. Zero config: just install TS (5.x or 6.x) and restart dsh. Fully optional; if TS is absent or disabled via `enableTypeScript: false`, the plugin falls back to L1 regex-only extraction.
17
17
  - **Automatic refresh** — a background poll (`watch_repo`) detects new or changed files by content hash and re-memorizes only those.
18
18
  - **Read-time memorization** — files are memorized the moment the model actually reads them (`fs/observed`), so the memory is a byproduct of normal work, not a separate upfront scan. Files that are never read are never indexed. The project root is detected by markers (`.git`, `package.json`, …), a README plus source directories, or the file's own directory as a last resort.
19
19
  - **Doc ↔ code cross-linking** — when a document mentions a symbol, the match is recorded as a `reference`; querying a symbol also surfaces the documents that describe it.
@@ -67,7 +67,7 @@ The store is per-project and follows the codebase: changed files are re-extracte
67
67
 
68
68
  ## Installation
69
69
 
70
- Tested against dsh **0.1.0-rc.7 through 0.1.2-alpha.3**. The plugin relies exclusively on stable public APIs (`defineTool`, `llm.stream`, `Schema`) declared via peerDependencies, ensuring compatibility with future rc/alpha releases without changes.
70
+ The plugin relies exclusively on stable public APIs (`defineTool`, `llm.stream`, `Schema`) declared via peerDependencies, ensuring compatibility with future rc/alpha releases without changes.
71
71
 
72
72
  ```bash
73
73
  cd dsh-project-memory && dsh plugin --profile web add . -w
@@ -203,7 +203,7 @@ These are deliberate scope choices.
203
203
 
204
204
  ### 11. TypeScript enhancement is optional, lazy, and cached
205
205
 
206
- **We do:** L2 TS Compiler API enhancement runs async in a priority queue (P0 on `fs/observed`, P1 on `watch`, P2 on `index_repo`), results cached by content hash in `type-cache/`. Zero config — just `npm i -D typescript`. Falls back to L1 regex if TS absent or disabled.
206
+ **We do:** L2 TS Compiler API enhancement runs async in a priority queue (P0 on `fs/observed`, P1 on `watch`, P2 on `index_repo`), results cached by content hash in `type-cache/`. Zero config — just `npm i -D typescript@5` or `typescript@6`. Falls back to L1 regex if TS absent or disabled.
207
207
 
208
208
  **We don't:** Mandatory TS, blocking enhancement, or full-program type checking.
209
209
 
package/README.zh-CN.md CHANGED
@@ -13,7 +13,7 @@
13
13
  - **文档记忆** — PDF、Markdown、纯文本按块切分并由 LLM 生成摘要,每条记忆携带 `路径:行号` 引用回源文件。
14
14
  - **代码符号记忆** — 通过零依赖的源码扫描器提取函数、类与方法名及完整类型签名(泛型、参数类型、返回类型、重载签名),包含字符串/注释掩码、多行签名续行、Python 缩进感知、类方法上下文,不使用 LLM token。
15
15
  - **L1 增强正则** — 零依赖正则扫描器现可提取泛型、参数/返回类型、重载、接口、类型别名,产出单行身份签名 `fn(a: A, b: B): R — file.ts:42`。
16
- - **可选 TypeScript 语义增强 (L2/L3)** — 当用户项目安装了 `typescript`(`npm i -D typescript`),插件自动激活第二层(L2),利用 TS Compiler API 推导返回类型、实例化泛型、提取接口与类型别名、丰富箭头函数签名 —— 全部在优先级队列中异步后台处理(P0:`fs/observed` 读文件瞬间、P1:`watch` 变更后、P2:`index_repo` 批量索引)。结果按文件内容哈希缓存到磁盘(L3),冷启动毫秒级复用。零配置:装 TS 再重启 dsh 即可。完全可选;若无 TS 或设置 `enableTypeScript: false`,回退至 L1 正则提取。
16
+ - **可选 TypeScript 语义增强 (L2/L3)** — 当用户项目安装了 `typescript`(`npm i -D typescript@5` 或 `npm i -D typescript@6`),插件自动激活第二层(L2),利用 TS Compiler API 推导返回类型、实例化泛型、提取接口与类型别名、丰富箭头函数签名 —— 全部在优先级队列中异步后台处理(P0:`fs/observed` 读文件瞬间、P1:`watch` 变更后、P2:`index_repo` 批量索引)。结果按文件内容哈希缓存到磁盘(L3),冷启动毫秒级复用。零配置:装 TS 再重启 dsh 即可。完全可选;若无 TS 或设置 `enableTypeScript: false`,回退至 L1 正则提取。
17
17
  - **自动刷新** — `watch_repo` 后台轮询,按内容哈希识别新增或变更文件,仅重记这些文件。
18
18
  - **读到即记忆** — 文件在模型**实际读取的瞬间**被记忆(监听 `fs/observed`),记忆是正常工作的副产品,而非额外的一次全量扫描。从未读过的文件不会被记忆。项目根通过标记(`.git`、`package.json` 等)、README 加源码目录、或兜底到文件所在目录逐级识别。
19
19
  - **文档 ↔ 代码交叉链接** — 文档提及某符号时记录为 `reference`;查询符号时同时带出描述该符号的文档。
@@ -67,7 +67,7 @@
67
67
 
68
68
  ## 安装
69
69
 
70
- 实测覆盖 dsh **0.1.0-rc.7 至 0.1.2-alpha.3**。插件仅依赖通过 peerDependencies 声明的稳定公共 API(`defineTool`、`llm.stream`、`Schema`),保证与后续 rc/alpha 版本无需改动即兼容。
70
+ 插件仅依赖通过 peerDependencies 声明的稳定公共 API(`defineTool`、`llm.stream`、`Schema`),保证与后续 rc/alpha 版本无需改动即兼容。
71
71
 
72
72
  ```bash
73
73
  cd dsh-project-memory && dsh plugin --profile web add . -w
@@ -203,7 +203,7 @@ v0.2.0 之前创建的库(单文件 `entries.json` / `index.json`)在首次
203
203
 
204
204
  ### 11. TS 增强可选、异步、缓存
205
205
 
206
- **我们做:** L2 TS Compiler API 在优先级队列异步跑(P0 `fs/observed`、P1 `watch`、P2 `index_repo`),结果按内容哈希缓存 `type-cache/`。零配置——`npm i -D typescript` 即用。无 TS 或禁用时优雅回退 L1 正则。
206
+ **我们做:** L2 TS Compiler API 在优先级队列异步跑(P0 `fs/observed`、P1 `watch`、P2 `index_repo`),结果按内容哈希缓存 `type-cache/`。零配置——`npm i -D typescript@5` 或 `npm i -D typescript@6` 即用。无 TS 或禁用时优雅回退 L1 正则。
207
207
 
208
208
  **不做:** 强制 TS、阻塞式增强、全程序类型检查。
209
209
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolk_vat-y/dsh-project-memory",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Persistent project memory for dsh agents: index docs (PDF/Markdown/text) and code symbols into a searchable per-workspace store, recall them with cited sources, and keep experience entries (problems -> solutions) searchable on demand.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -30,7 +30,8 @@
30
30
  ],
31
31
  "license": "MIT",
32
32
  "publishConfig": {
33
- "access": "public"
33
+ "access": "public",
34
+ "registry": "https://registry.npmjs.org"
34
35
  },
35
36
  "engines": {
36
37
  "node": ">=18"
@@ -50,7 +51,7 @@
50
51
  "@deepseek-ai/dsh-llm": ">=0.0.1-rc.1 <0.1.0 || >=0.1.0-rc.1 <0.2.0-0 || >=0.1.1-rc.1 <0.2.0-0",
51
52
  "@deepseek-ai/dsh-tools": ">=0.0.1-rc.1 <0.1.0 || >=0.1.0-rc.1 <0.2.0-0 || >=0.1.1-rc.1 <0.2.0-0",
52
53
  "@deepseek-ai/schemastery": "^3.18.1",
53
- "typescript": "^5.0.0"
54
+ "typescript": "^5.0.0 || ^6.0.0"
54
55
  },
55
56
  "peerDependenciesMeta": {
56
57
  "@deepseek-ai/cordis": {
package/src/enhancer.js CHANGED
@@ -11,8 +11,8 @@ let tsPath = null
11
11
  let tsVersion = null
12
12
 
13
13
  function acceptTsVersion(mod) {
14
- if (mod && mod.version && (mod.version.startsWith('6.') || mod.version.startsWith('7.'))) {
15
- console.warn(`[dsh-project-memory] TypeScript ${mod.version} 不受支持,回退到 L1 正则。请使用 TS 5.x 获得增强类型。`)
14
+ if (mod && mod.version && mod.version.startsWith('7.')) {
15
+ console.warn(`[dsh-project-memory] TypeScript ${mod.version} 不受支持,回退到 L1 正则。请使用 TS 5.x/6.x 获得增强类型。`)
16
16
  return null
17
17
  }
18
18
  return mod