@evegoodevening/dsh-llmwiki 0.0.1 → 0.0.3

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,45 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3] - 2026-10-26
4
+
5
+ ### Security
6
+
7
+ - Require patched Node.js `^22.23.4 || ^24.22.1 || >=26.12.1` in the package and isolated agent runner, enforce the same range in agent preflight, pin CI to Node `24.22.1` and release npm to `12.2.1`, and migrate pack-result consumers to npm 12's package-keyed JSON.
8
+ - Update Vitest/coverage to `4.1.12`; pin patched Vite `8.3.4`, js-yaml `4.3.2`, brace-expansion `1.1.21`/`5.0.12`, and source-map-js `1.2.2` without weakening the seven-day dependency age policy.
9
+ - Keep the retained DSH `0.2.0-rc.2` profile's expected Group `1.0.4` closure explicit in its isolated fixture instead of accepting fresh `1.0.5` resolution; latest-upstream compatibility lanes remain native.
10
+ - Audit the isolated agent-runner lock as well as the root graph; patch its MCP SDK `1.32.0`, proxy-addr `2.0.8`, fast-uri `3.1.8`, sharp `0.35.5`, ip-address `10.7.4`, and Hono `4.13.11`, retaining exact legacy Cordis/Loader pins and updating the runner's integrity digest.
11
+ - Keep the upgraded development graph on patched Zod `4.6.6` instead of DSH `0.2.1-rc.2`'s vulnerable `4.4.3` pin; preserve the seven-day release-age policy and the independent legacy runner.
12
+
13
+ ### Added
14
+
15
+ - Add exact DSH `0.2.1-rc.2` support for the five service peers, retaining every previously supported version and the pinned legacy agent-smoke runner. Keep the new host in the packed-profile regression matrix with native dependencies and strict standalone peer/type checks.
16
+
17
+ ### Changed
18
+
19
+ - Upgrade the root development baseline to DSH `0.2.1-rc.2`, Cordis `4.0.5`, Loader `1.0.6`, Schemastery `3.18.5`, and `node-addon-require-builtin` `0.1.9`; regenerate the lockfile, replace `dsh-code-runtime` with `dsh-ptc-runtime`, and remove `dsh-invariants`. Migrate ordinary smoke to `ToolCallId` and Loader tests to returned entry IDs, synchronous removal plus lifecycle waiting, and import-failure diagnostics rather than rejected creation promises.
20
+ - Validate the separately pinned agent-smoke version against its own runner manifest rather than the root development dependency; preserve its exact frozen lock, integrity checks, and legacy host fixtures.
21
+
22
+ ### Fixed
23
+
24
+ - Pin the upstream-compatibility workflow to npm `12.2.1`, matching the release workflow and package-keyed pack-result parser. The runner's bundled older npm returned array metadata and stopped both probes at `build-and-pack` before host compatibility could be checked.
25
+ - Align the read-only-policy E2E runner digest with the already committed security-patched lock and agent-smoke preflight, preserving the exact-lock checks and legacy runtime without changing either dependency graph.
26
+ - Keep isolated agent preflight aligned with the development toolchain: honor the copied workspace's frozen-install policies and pinned pnpm version, parse machine-readable stdout separately from stderr while retaining the combined output limit, and explicitly activate llmwiki only in the disposable profile. The package remains disabled by default.
27
+
28
+ ## [0.0.2] - 2026-10-17
29
+
30
+ ### Added
31
+
32
+ - Dependency-audit issue notifications: a separate least-privilege reporter assigns and mentions the maintainer on failure, deduplicates repeated failures, closes the alert after a completed successful audit, and reopens it on regression. Setup and registry failures remain alerts rather than being mistaken for recovery.
33
+ - Simplified Chinese README with installation, usage, and development guidance.
34
+
35
+ ### Changed
36
+
37
+ - Standardized installation documentation on the automatically loaded profile `cordis.patch.yml`, retaining explicit activation and writable wiki roots. Documented preserving existing patches, migrating external overlays without duplicate insertion, and removing the profile entry on uninstall.
38
+
39
+ ### Fixed
40
+
41
+ - Added exact Cordis `4.0.5` peer support with DSH `0.2.0-rc.2`, retaining the previously supported versions and pinned legacy development dependencies. Latest-version compatibility hosts and strict consumers now apply the existing `@deepseek-ai/*` release-age exception so Cordis resolves with its required Loader/Include companions instead of mixing new core and older plugins; strict peer validation remains enabled.
42
+
3
43
  ## [0.0.1]
4
44
 
5
45
  Initial release of `@evegoodevening/dsh-llmwiki`.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # dsh-llmwiki
2
2
 
3
+ English | [简体中文](README.zh.md)
4
+
3
5
  Third-party, local-first, source-linked Markdown wiki storage and retrieval plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH), inspired by [Karpathy's LLM Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
4
6
 
5
7
  Maintained by EveGoodEvening, this is not an official DeepSeek or DeepSeek Harness project. References to DeepSeek Harness and Andrej Karpathy describe compatibility and inspiration only; they do not imply affiliation, sponsorship, or endorsement.
@@ -14,14 +16,16 @@ The plugin makes no model or network calls. The calling agent handles synthesis
14
16
 
15
17
  | DSH (`@deepseek-ai/dsh`) | Cordis (`@deepseek-ai/cordis`) | Status |
16
18
  | --- | --- | --- |
17
- | **`0.2.0-rc.2`** | **`4.0.4`** | **Recommended** |
19
+ | **`0.2.1-rc.2`** | **`4.0.5`** | **Recommended** |
20
+ | `0.2.0-rc.2` | `4.0.4` or `4.0.5` | Supported |
18
21
  | `0.1.7-rc.2` | `4.0.4` | Supported |
19
22
  | `0.1.1-rc.2` | `4.0.1` | Supported legacy |
20
23
  | `0.1.0-rc.6` | `4.0.1` | Supported legacy |
21
24
 
22
- - **Node.js:** `^22.19.0 || >=24`.
25
+ - **Node.js:** `^22.23.4 || ^24.22.1 || >=26.12.1`. CI pins `24.22.1`; earlier 24.x and odd-numbered 23/25 releases are not supported. Use npm `12.2.1` for the release/pack probes and pnpm below for dependency management.
23
26
  - **pnpm:** `11.7.0`, on `PATH` for `dsh plugin` and development.
24
27
  - Use a coherent DSH service family, not mixed release candidates. The `0.1.0-rc.6` host resolves its five DSH service peers to `0.1.0-rc.8`; the other rows use same-version services.
28
+ - Cordis `4.0.5` requires Loader `~1.0.6` and Include `~1.0.10`; update the host's companion packages together rather than forcing Cordis onto older companions.
25
29
  - Direct Cordis loading also needs DSH `tools`, `commands`, and `systemPrompt` services and one shared `@deepseek-ai/schemastery@^3.18.1` installation. See [exact peer ranges](package.json) and the [standalone example](examples/README.md).
26
30
 
27
31
  The plugin's version in [package.json](package.json) is independent of the DSH and dependency versions above.
@@ -30,34 +34,38 @@ The plugin's version in [package.json](package.json) is independent of the DSH a
30
34
 
31
35
  Use **`@evegoodevening/dsh-llmwiki`**. The unscoped `dsh-llmwiki` package belongs to a different project.
32
36
 
33
- From this checkout, pack and install `0.0.1` with a supported DSH host on `PATH` (`web` is the example profile):
37
+ From this checkout, pack and install `0.0.3` with a supported DSH host on `PATH` (`web` is the example profile):
34
38
 
35
39
  ```sh
36
40
  pnpm install --frozen-lockfile
37
41
  pnpm pack
38
- dsh plugin --profile web add ./evegoodevening-dsh-llmwiki-0.0.1.tgz
42
+ dsh plugin --profile web add ./evegoodevening-dsh-llmwiki-0.0.3.tgz
39
43
  ```
40
44
 
41
45
  When the package is available on npm, the equivalent registry command is `dsh plugin --profile web add @evegoodevening/dsh-llmwiki@latest`.
42
46
 
43
- Installation leaves the plugin **disabled**. Enable it with an operator-owned patch and an explicit, writable wiki root:
47
+ Installation leaves the plugin **disabled**: its bundled patch is empty. To enable it, merge the following into the profile's `$DSH_HOME/profiles/web/cordis.patch.yml`. Preserve existing patches; if the file contains only `[]`, replace that empty list. Insert `llmwiki` only once, and replace the example `root` with your own writable absolute path. Plain YAML does not expand `$HOME`.
44
48
 
45
- ```sh
46
- mkdir -p "$HOME/.config/dsh"
47
- cat > "$HOME/.config/dsh/llmwiki-web.patch.yml" <<YAML
49
+ ```yaml
48
50
  - insert:
49
51
  - id: llmwiki
50
52
  name: '@evegoodevening/dsh-llmwiki'
51
53
  config:
52
- root: '$HOME/.local/share/dsh/llmwiki/web'
53
- YAML
54
- dsh --profile web --patch "$HOME/.config/dsh/llmwiki-web.patch.yml" --dump-config
55
- dsh --profile web --patch "$HOME/.config/dsh/llmwiki-web.patch.yml"
54
+ root: /var/lib/dsh/llmwiki/web
55
+ ```
56
+
57
+ `insert` creates the plugin instance; a plain `- id: llmwiki` only overrides an existing instance. DSH automatically loads the profile patch. Inspect the composed configuration, then start:
58
+
59
+ ```sh
60
+ dsh --profile web --dump-config
61
+ dsh --profile web
56
62
  ```
57
63
 
58
- Keep the patch on every start; restart a running profile after changes. Use `/wiki status` to inspect the repository. Before changing the installed package, stop all writers and back up the root. Retain the same explicit root to reuse existing wiki data, and check the filesystem requirements below before enabling it.
64
+ If migrating from an external `--patch` file, move its `llmwiki` entry here with the same root and remove that command-line argument. Do not load both copies. Restart a running profile after changes.
59
65
 
60
- To uninstall without deleting wiki data:
66
+ Use `/wiki status` to inspect the repository. Before changing the installed package, stop all writers and back up the root. Retain the same explicit root to reuse existing wiki data, and check the filesystem requirements below before enabling it.
67
+
68
+ To uninstall without deleting wiki data, first remove the `llmwiki` entry and any resulting empty `insert` block from the profile patch (use `[]` if no patches remain), then remove the package:
61
69
 
62
70
  ```sh
63
71
  dsh plugin --profile web remove @evegoodevening/dsh-llmwiki
@@ -148,9 +156,11 @@ pnpm run check:determinism
148
156
  pnpm run smoke
149
157
  ```
150
158
 
151
- The Linux unit suite's read-only tmpfs test requires root and mount-namespace capability. E2E builds first and exercises packed packages across the supported host matrix; run it separately from other builds because it temporarily hides shared checkout paths. Ordinary smoke uses the pinned legacy development dependencies, not the recommended host.
159
+ The Linux unit suite's read-only tmpfs test requires root and mount-namespace capability. E2E builds first and exercises packed packages across the supported host matrix; run it separately from other builds because it temporarily hides shared checkout paths. Ordinary smoke uses the development baseline below.
160
+
161
+ The development baseline is DSH `0.2.1-rc.2`, Cordis `4.0.5`, Loader `1.0.6`, Schemastery `3.18.5`, and `node-addon-require-builtin` `0.1.9`. The root graph uses `dsh-ptc-runtime` instead of the retired `dsh-code-runtime` and no longer includes `dsh-invariants`. Supported legacy hosts and the independent agent-smoke runner remain unchanged. The fixed `0.2.1-rc.2` E2E row uses native host dependencies and a strict standalone consumer, independently of the rolling latest-version probes.
152
162
 
153
- - **Upstream compatibility:** `pnpm run check:compatibility` probes latest DSH with native dependencies and, separately, forced latest Cordis. Networked, model-free; probes do not automatically extend the support table. See the [scheduled workflow](.github/workflows/compatibility.yml).
163
+ - **Upstream compatibility:** `pnpm run check:compatibility` probes latest DSH with native dependencies and, separately, forced latest Cordis. Disposable hosts and consumers apply the repository's `@deepseek-ai/*` release-age exception so fresh vendor companions can resolve together; other dependency age settings are unchanged. Networked, model-free; probes do not automatically extend the support table. See the [scheduled workflow](.github/workflows/compatibility.yml).
154
164
  - **Real-agent smoke:** set `DEEPSEEK_API_KEY`, `LLMWIKI_AGENT_SMOKE_MODEL`, and `LLMWIKI_AGENT_SMOKE_NETWORK=allow`, then run `pnpm run smoke:agent`. This separate, credentialed check uses a pinned DSH `0.1.1-rc.2` runner; offline checks do not prove model behavior.
155
165
  - **Publishing:** the [release workflow](.github/workflows/publish.yml) uses npm Trusted Publishing for a `v*` tag matching `package.json`.
156
166
 
package/README.zh.md ADDED
@@ -0,0 +1,183 @@
1
+ # dsh-llmwiki
2
+
3
+ [English](README.md) | 简体中文
4
+
5
+ 面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)的第三方 Markdown wiki 存储与检索插件,采用本地优先设计,关联原始来源,灵感来自 [Karpathy 的 LLM Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)。
6
+
7
+ 本项目由 EveGoodEvening 维护,并非 DeepSeek 或 DeepSeek Harness 官方项目。提及 DeepSeek Harness 和 Andrej Karpathy 仅用于说明兼容性与灵感来源,不代表任何隶属、赞助或背书关系。
8
+
9
+ - 按 SHA-256 保存不可变来源,并编写引用这些来源的 Markdown 页面。
10
+ - 使用确定性的词法索引搜索页面章节;索引过期时重建。
11
+ - 通过不调用模型的 lint 检查结构、链接和完整性。
12
+
13
+ 插件不会调用模型,也不会发起网络请求。内容综合与语义审查由调用它的智能体负责;引用来源只能证明对应记录存在,不能证明其支持相关主张。
14
+
15
+ ## 环境要求
16
+
17
+ | DSH(`@deepseek-ai/dsh`) | Cordis(`@deepseek-ai/cordis`) | 状态 |
18
+ | --- | --- | --- |
19
+ | **`0.2.1-rc.2`** | **`4.0.5`** | **推荐** |
20
+ | `0.2.0-rc.2` | `4.0.4` 或 `4.0.5` | 支持 |
21
+ | `0.1.7-rc.2` | `4.0.4` | 支持 |
22
+ | `0.1.1-rc.2` | `4.0.1` | 支持的旧版本 |
23
+ | `0.1.0-rc.6` | `4.0.1` | 支持的旧版本 |
24
+
25
+ - **Node.js:** `^22.23.4 || ^24.22.1 || >=26.12.1`。CI 固定使用 `24.22.1`;不支持更早的 24.x 和 23/25 系列。发布及打包探针使用 npm `12.2.1`,依赖管理仍使用下述 pnpm。
26
+ - **pnpm:** `11.7.0`,执行 `dsh plugin` 和开发时需确保其位于 `PATH` 中。
27
+ - 使用相互兼容的同一系列 DSH 服务,不要混用不同的候选发布版本。`0.1.0-rc.6` 宿主会将其五个 DSH 服务对等依赖解析为 `0.1.0-rc.8`;表中其他宿主使用与自身版本相同的服务。
28
+ - Cordis `4.0.5` 需要 Loader `~1.0.6` 和 Include `~1.0.10`;请一并更新宿主的配套依赖,不要将新版 Cordis 强行搭配旧版配套包。
29
+ - 直接通过 Cordis 加载时,还需要 DSH 的 `tools`、`commands` 和 `systemPrompt` 服务,以及一份共享的 `@deepseek-ai/schemastery@^3.18.1` 安装。参见[准确的对等依赖版本范围](package.json)和[独立加载示例](examples/README.md)。
30
+
31
+ [package.json](package.json) 中的插件版本独立于上表中的 DSH 和依赖版本。
32
+
33
+ ## 安装
34
+
35
+ 请使用 **`@evegoodevening/dsh-llmwiki`**。不带作用域的 `dsh-llmwiki` 包属于另一个项目。
36
+
37
+ 在当前检出的仓库中打包并安装 `0.0.3`,同时确保受支持的 DSH 宿主位于 `PATH` 中(以下以 `web` profile 为例):
38
+
39
+ ```sh
40
+ pnpm install --frozen-lockfile
41
+ pnpm pack
42
+ dsh plugin --profile web add ./evegoodevening-dsh-llmwiki-0.0.3.tgz
43
+ ```
44
+
45
+ 当该包在 npm 上可用时,等效的仓库安装命令为 `dsh plugin --profile web add @evegoodevening/dsh-llmwiki@latest`。
46
+
47
+ 安装后插件仍处于**禁用**状态:随包补丁为空。启用时,将以下内容合并到 profile 的 `$DSH_HOME/profiles/web/cordis.patch.yml` 中。保留已有补丁;如果文件只有 `[]`,则用以下列表替换该空列表。只插入一次 `llmwiki`,并将示例 `root` 替换为自己的可写绝对路径。普通 YAML 不会展开 `$HOME`。
48
+
49
+ ```yaml
50
+ - insert:
51
+ - id: llmwiki
52
+ name: '@evegoodevening/dsh-llmwiki'
53
+ config:
54
+ root: /var/lib/dsh/llmwiki/web
55
+ ```
56
+
57
+ `insert` 用于创建插件实例;单独的 `- id: llmwiki` 只能修改已有实例。DSH 会自动加载 profile 补丁。先检查合成后的配置,再启动:
58
+
59
+ ```sh
60
+ dsh --profile web --dump-config
61
+ dsh --profile web
62
+ ```
63
+
64
+ 如果此前使用外置 `--patch` 文件,请将其中的 `llmwiki` 条目移到这里,保持原有根目录,并移除对应的命令行参数。不要重复加载两份配置。修改后请重启正在运行的 profile。
65
+
66
+ 使用 `/wiki status` 检查仓库状态。更改已安装的包之前,先停止所有写入操作并备份根目录。保留同一个显式指定的根目录,即可复用已有 wiki 数据;启用前请检查下文的文件系统要求。
67
+
68
+ 如需卸载插件但保留 wiki 数据,先从 profile 补丁中移除 `llmwiki` 条目以及因此变空的 `insert` 块(如果没有剩余补丁,则保留 `[]`),然后移除包:
69
+
70
+ ```sh
71
+ dsh plugin --profile web remove @evegoodevening/dsh-llmwiki
72
+ ```
73
+
74
+ 本地 tarball 安装或独立 Cordis 加载方式,参见[可运行示例](examples/README.md)。
75
+
76
+ ## 使用
77
+
78
+ ### 命令
79
+
80
+ | 命令 | 用途 |
81
+ | --- | --- |
82
+ | `/wiki status` | 报告初始化状态、来源/页面数量及索引状态;也是 `/wiki` 的默认操作 |
83
+ | `/wiki lint` | 报告结构错误和警告,不进行任何修复 |
84
+ | `/wiki reindex` | 重建派生的搜索索引 |
85
+
86
+ ### 智能体工具
87
+
88
+ | 工具 | 用途 |
89
+ | --- | --- |
90
+ | `llmwiki_status` | 检查存储并读取由人工维护的 schema |
91
+ | `llmwiki_add_source` | 原样保存 UTF-8 内容,返回来源 ID |
92
+ | `llmwiki_list_sources` | 分页浏览来源元数据 |
93
+ | `llmwiki_read_source` | 读取已保存的内容及来源信息 |
94
+ | `llmwiki_search` | 查找按相关性排序的页面章节匹配结果 |
95
+ | `llmwiki_list_pages` | 分页浏览页面元数据和哈希 |
96
+ | `llmwiki_read_page` | 按逻辑 ID 读取页面的原始 Markdown 及其 SHA-256 |
97
+ | `llmwiki_upsert_page` | 创建或有条件地更新引用已有来源 ID 的页面 |
98
+ | `llmwiki_lint` | 检查结构、完整性、链接及索引是否最新 |
99
+
100
+ 先查看状态和 schema。仅在获得用户授权后保存来源并维护受影响的页面。即使没有写入,也要在**语义审查之前**运行结构 lint;发生任何更新后,再运行一次。语义层面的发现是智能体的判断,不是 lint 结果。完整工作流见[运行时提示词](src/prompt.ts);参数见[工具 schema](src/tools.ts)。
101
+
102
+ 搜索使用经 NFKC 规范化和小写转换后得到的确定性词元,并采用 BM25 字段加权;分数相同时,按页面 ID 和章节起始行排序。片段围绕最早出现、能完整容纳且参与评分的查询词元,展示规范化正文中的连续上下文;词元为完整的字母/数字串,或现有的 CJK 双码点 n-gram,同一位置的候选按词元的 UTF-16 字典序打破平局。片段大小不超过 `maxSnippetBytes`,不会截断 UTF-8 码点,也不添加省略标记。分散的查询词不一定全部出现在片段中。仅标题/章节标题匹配,或正文词元过大而超出上限时,改用受长度限制的正文前缀。
103
+
104
+ ### 页面写入前置条件
105
+
106
+ 每次写入页面都必须提供 `expectedSha256`:创建尚不存在的页面时使用 `null`;更新已有页面时,使用读取页面或目录列表返回的、对原始 Markdown 计算出的精确 `sha256`。遇到 `PAGE_CONFLICT` 时,先重新读取页面并整合差异,再重试;不要使用过期哈希覆盖页面,也不要盲目重试。
107
+
108
+ ## 配置
109
+
110
+ 所有配置项均为可选。数值必须为整数;未知配置项会被拒绝。
111
+
112
+ | 配置项 | 默认值 | 含义 / 限制 |
113
+ | --- | --- | --- |
114
+ | `root` | `.llmwiki` | 非空路径;基于宿主进程的 cwd 一次性解析 |
115
+ | `maxSourceBytes` | `2097152` | 来源内容上限:2 MiB;最小为 1 字节 |
116
+ | `maxPageBytes` | `524288` | 渲染后的页面正文上限:512 KiB;最小为 1 字节 |
117
+ | `maxResults` | `20` | 搜索和目录列表的每页条目数上限;`1..100` |
118
+ | `maxSnippetBytes` | `1200` | 搜索片段上限;`64..16384` 字节 |
119
+ | `commandDiagnosticLimit` | `20` | `/wiki lint` 输出的诊断条目数;`1..100` |
120
+
121
+ ## 存储与安全
122
+
123
+ ```text
124
+ <root>/
125
+ schema.md # 由人工维护的指引;仅在不存在时创建
126
+ sources/<sha256>/
127
+ content # 不可变的 UTF-8 来源
128
+ metadata.json # 来源信息与采集元数据
129
+ pages/<page-id>.md # 包含标题、摘要和来源 ID 的 Markdown
130
+ .index/{search,state}.json # 派生的、可重建的搜索数据
131
+ ```
132
+
133
+ - **宿主机存储,而非 DSH 沙箱。** 直接使用 Node 文件系统 I/O,会绕过 `ctx.fs`、DSH 权限模式、审批、编辑前读取要求,以及远程/工作区提供器。如果必须依赖这些控制机制,请勿启用本插件;应通过操作系统权限和进程隔离来实施边界约束。
134
+ - **每次激活使用固定的根目录。** 会话/工作区的 cwd 发生变化时,不会切换存储位置。通过不同根目录实现隔离;互不信任的租户不得共用根目录或同一次插件激活实例。不支持跨激活实例/进程并发写入。不要允许不受信任的进程修改根目录。
135
+ - **文件系统后端。** 以文件描述符约束路径访问的存储后端需要 Linux、数值形式的 nofollow/目录打开标志,以及已挂载且可用的 `/proc/self/fd`。所需能力不受支持或不可用时,会以 `UNSAFE_FILESYSTEM` 拒绝操作;不会回退到基于路径名的访问方式。不支持非 Linux 的文件描述符后端,也不声称已证明其安全性。每次操作都会固定根目录和子目录的描述符,打开最终文件时不跟随符号链接;已初始化根目录的设备号/inode 标识必须保持不变。
136
+ - **对抗保证的边界。** 固定描述符的路径遍历可防止符号链接替换将文件系统操作重定向到根目录外的符号链接目标。但这并非整棵目录树的事务,也不提供 compare-and-rename(比较后重命名)保证。已授权访问的目录被重命名到原有路径名所定义的根目录之外后,仍可能保持可访问。普通文件/硬链接注入、借助特权进行挂载或访问进程,以及恶意替换 procfs,均不在此保证范围内;仍须依赖操作系统隔离,并禁止不受信任的写入者。
137
+ - **部分读取操作可能写入。** 状态查询、目录列表和 lint 从不写入。读取来源/页面以及搜索可能初始化存储;搜索还可能重建索引。只读部署需要已初始化的仓库及最新索引。
138
+ - 插件从不编辑或删除来源。已有的 `schema.md` 会被保留;不提供编辑 schema 的 API。
139
+
140
+ ### 来源写入中断
141
+
142
+ 来源写入中断后,以相同内容重试 `llmwiki_add_source`(或 `ctx.llmwiki.addSource`)。恢复仅限于**尚未提交 `metadata.json`** 的最终来源目录;该目录必须为空,或仅包含内容匹配的已持久化 `content` 和/或可识别为写入器产生的临时文件(必须为普通文件)。匹配的持久化内容会被保留;元数据使用重试时提供的来源信息,并在最后提交。恢复操作返回的回执带有 `deduplicated: false`;下一次使用相同内容重试时会去重。
143
+
144
+ 有效且完整的记录始终会去重,不会更改首次提交的元数据/来源信息字节。内容或元数据损坏、包含未知子项,或子项为符号链接/非普通文件的记录,都会被拒绝,且被拒绝的记录保持不变。读取、目录列表和 lint 不会修复部分写入的记录,也不会将其视为有效记录;如上所述,读取来源/页面仍可能初始化存储布局。这只是针对崩溃后重试的有限恢复机制,并非通用修复/隔离设施,也不是多页面事务。
145
+
146
+ ## 开发
147
+
148
+ ```sh
149
+ pnpm install --frozen-lockfile
150
+ pnpm run build
151
+ pnpm run typecheck
152
+ pnpm run lint
153
+ pnpm test
154
+ pnpm run test:e2e
155
+ pnpm run check:determinism
156
+ pnpm run smoke
157
+ ```
158
+
159
+ Linux 单元测试套件中的只读 tmpfs 测试需要 root 权限和挂载命名空间能力。E2E 会先构建,再在受支持的宿主版本矩阵中测试打包后的包;请与其他构建分开运行,因为它会临时隐藏共享的仓库检出路径。常规 smoke 使用下述开发基线。
160
+
161
+ 开发基线为 DSH `0.2.1-rc.2`、Cordis `4.0.5`、Loader `1.0.6`、Schemastery `3.18.5` 和 `node-addon-require-builtin` `0.1.9`。根依赖图使用 `dsh-ptc-runtime` 替代已退役的 `dsh-code-runtime`,不再包含 `dsh-invariants`。旧宿主支持和独立的 agent-smoke 运行器保持不变。固定的 `0.2.1-rc.2` E2E 用例使用宿主原生依赖和严格的独立消费者检查,与滚动的最新版探测相互独立。
162
+
163
+ - **上游兼容性:** `pnpm run check:compatibility` 分别检查使用原生依赖的最新版 DSH,以及强制使用最新版 Cordis 的情况。临时宿主和消费者项目沿用仓库的 `@deepseek-ai/*` 最低发布年龄例外,使新发布的配套包能够一起解析;其他依赖的发布年龄设置保持不变。此检查需要联网,但不调用模型;检查结果不会自动扩展支持表。参见[定时工作流](.github/workflows/compatibility.yml)。
164
+ - **真实智能体 smoke:** 设置 `DEEPSEEK_API_KEY`、`LLMWIKI_AGENT_SMOKE_MODEL` 和 `LLMWIKI_AGENT_SMOKE_NETWORK=allow`,然后运行 `pnpm run smoke:agent`。这项独立且需要凭据的检查使用固定的 DSH `0.1.1-rc.2` 运行器;离线检查不能证明模型行为。
165
+ - **发布:** [发布工作流](.github/workflows/publish.yml)使用 npm Trusted Publishing,针对与 `package.json` 版本匹配的 `v*` 标签执行发布。
166
+
167
+ ## 参考资料 / 致谢
168
+
169
+ 设计与集成工作参考了以下来源:
170
+
171
+ - [Andrej Karpathy 的 LLM Wiki 构想文件](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)——主要概念灵感:不可变的原始来源、由 LLM 维护的持久化 Markdown wiki、schema 指引,以及导入/查询/lint 工作流。它描述的是一种模式,而非必须遵循的实现或 API。
172
+ - [Astro-Han/karpathy-llm-wiki](https://github.com/Astro-Han/karpathy-llm-wiki)——其智能体技能中的 raw/wiki/schema 分离、证据要求,以及明确的导入/查询/lint 工作流。具体的分流处理与级联更新指引,其限定范围的归属说明及保留的 MIT 许可证见[第三方声明](THIRD_PARTY_NOTICES.md)。
173
+ - [ddsyasas/llm-wiki](https://github.com/ddsyasas/llm-wiki)——持久化来源/页面记录、索引优先导航,以及确定性 lint 与模型判断的分离。本项目未采用其 Next.js/SQLite/FTS 应用架构。
174
+ - [Praney Behl 的 llm-wiki-plugin](https://github.com/praneybehl/llm-wiki-plugin)——其搜索工具中的章节级词法检索与稳定的证据输出,以及导入工作流中的精准页面更新、引用和用户审查边界。本项目未采用其 Python/uv/FastEmbed/sqlite-vec 运行时。
175
+ - [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness/tree/fa7e9f5a)——Cordis 插件与服务约定、生命周期归属、工具/命令/系统提示词注册,以及 profile bundle 集成。最初的集成研究使用修订版本 `fa7e9f5a`;受支持的运行时版本见上表。
176
+
177
+ 这些致谢用于说明设计影响和集成参考,并不意味着相关作者或项目为本项目背书。本包的 MIT 许可证不会改变所引用作品的许可;这些作品仍受各自的版权和许可条款约束。
178
+
179
+ ## 许可证
180
+
181
+ [MIT](LICENSE) © EveGoodEvening。
182
+
183
+ 有关工作流指引的归属范围及保留的完整上游许可证,请参见[第三方声明](THIRD_PARTY_NOTICES.md)。本项目的 MIT 许可证不能替代该声明。
@@ -6,7 +6,7 @@ import type { PageId, SourceId } from './ids.ts';
6
6
  import type { AddSourceInput, ByteRange, CatalogRequest, LintReport, PageCatalogPage, PageRead, PageReceipt, ReindexReceipt, SearchHit, SourceCatalogPage, SourceRead, SourceReceipt, UpsertPageInput, WikiStatus } from './types.ts';
7
7
  declare const configKey: unique symbol;
8
8
  export declare class LlmWikiService extends Service {
9
- static Config: Schemastery<ConfigSchema, ResolvedConfig>;
9
+ static Config: Schemastery<ConfigSchema, ResolvedConfig, "plain">;
10
10
  private readonly [configKey];
11
11
  private pathsValue;
12
12
  private queue;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,MAAM,IAA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AC,KAAK,EAAE,MAAM,EAAE,UAAU,SAA6B,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAoB1G,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;YAc9C,mBAAmB;YAQnB,WAAW;YAqBX,WAAW;CAsC1B;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,OAAO,EAAE,cAAc,CAAA;KACxB;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evegoodevening/dsh-llmwiki",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Third-party, local-first, source-linked Markdown wiki storage and retrieval plugin for DeepSeek Harness",
5
5
  "author": "EveGoodEvening",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "packageManager": "pnpm@11.7.0",
16
16
  "engines": {
17
- "node": "^22.19.0 || >=24"
17
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1"
18
18
  },
19
19
  "main": "lib/index.js",
20
20
  "types": "lib/types/index.d.ts",
@@ -58,41 +58,40 @@
58
58
  }
59
59
  },
60
60
  "peerDependencies": {
61
- "@deepseek-ai/cordis": "4.0.1 || 4.0.4",
62
- "@deepseek-ai/dsh-brand": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2",
63
- "@deepseek-ai/dsh-commands": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2",
64
- "@deepseek-ai/dsh-session": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2",
65
- "@deepseek-ai/dsh-system-prompt": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2",
66
- "@deepseek-ai/dsh-tools": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2",
61
+ "@deepseek-ai/cordis": "4.0.1 || 4.0.4 || 4.0.5",
62
+ "@deepseek-ai/dsh-brand": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.2",
63
+ "@deepseek-ai/dsh-commands": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.2",
64
+ "@deepseek-ai/dsh-session": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.2",
65
+ "@deepseek-ai/dsh-system-prompt": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.2",
66
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.6 || 0.1.0-rc.8 || 0.1.1-rc.2 || 0.1.7-rc.2 || 0.2.0-rc.2 || 0.2.1-rc.2",
67
67
  "@deepseek-ai/schemastery": "^3.18.1"
68
68
  },
69
69
  "devDependencies": {
70
- "@deepseek-ai/cordis": "4.0.1",
71
- "@deepseek-ai/cordis-plugin-loader": "1.0.2",
72
- "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
73
- "@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
74
- "@deepseek-ai/dsh-brand": "0.1.1-rc.2",
75
- "@deepseek-ai/dsh-code-runtime": "0.1.1-rc.2",
76
- "@deepseek-ai/dsh-commands": "0.1.1-rc.2",
77
- "@deepseek-ai/dsh-invariants": "0.1.1-rc.2",
78
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
79
- "@deepseek-ai/dsh-scope": "0.1.1-rc.2",
80
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
81
- "@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
82
- "@deepseek-ai/dsh-timeout": "0.1.1-rc.2",
83
- "@deepseek-ai/dsh-tools": "0.1.1-rc.2",
84
- "@deepseek-ai/dsh-typert-protocol": "0.1.1-rc.2",
85
- "@deepseek-ai/dsh-user-approval": "0.1.1-rc.2",
86
- "@deepseek-ai/schemastery": "3.18.1",
70
+ "@deepseek-ai/cordis": "4.0.5",
71
+ "@deepseek-ai/cordis-plugin-loader": "1.0.6",
72
+ "@deepseek-ai/dsh-agent": "0.2.1-rc.2",
73
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.2",
74
+ "@deepseek-ai/dsh-brand": "0.2.1-rc.2",
75
+ "@deepseek-ai/dsh-commands": "0.2.1-rc.2",
76
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
77
+ "@deepseek-ai/dsh-ptc-runtime": "0.2.1-rc.2",
78
+ "@deepseek-ai/dsh-scope": "0.2.1-rc.2",
79
+ "@deepseek-ai/dsh-session": "0.2.1-rc.2",
80
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
81
+ "@deepseek-ai/dsh-timeout": "0.2.1-rc.2",
82
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
83
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.2",
84
+ "@deepseek-ai/dsh-user-approval": "0.2.1-rc.2",
85
+ "@deepseek-ai/schemastery": "3.18.5",
87
86
  "@types/node": "22.20.0",
88
87
  "@typescript-eslint/eslint-plugin": "8.67.0",
89
88
  "@typescript-eslint/parser": "8.67.0",
90
- "@vitest/coverage-v8": "4.1.8",
89
+ "@vitest/coverage-v8": "4.1.12",
91
90
  "eslint": "9.39.2",
92
- "node-addon-require-builtin": "0.1.4",
91
+ "node-addon-require-builtin": "0.1.9",
93
92
  "tsdown": "0.22.2",
94
93
  "tsx": "4.22.4",
95
94
  "typescript": "6.0.3",
96
- "vitest": "4.1.8"
95
+ "vitest": "4.1.12"
97
96
  }
98
97
  }