dsh-knit 0.26.0 → 0.27.0

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
@@ -3,6 +3,30 @@
3
3
  本项目的重要变更都记在这里。格式参考 [Keep a Changelog](https://keepachangelog.com/),
4
4
  版本号遵循[语义化版本](https://semver.org/lang/zh-CN/)。
5
5
 
6
+ ## [0.27.0] - 2026-11-20
7
+
8
+ ### 架构
9
+
10
+ - **客户端源码分片**:`src/client/client.js` 改为**生成物**,人写的源码拆到 `tools/client-src/` 7 片
11
+ (preamble / i18n / runtime / styles / components / body / entry),由零依赖 `node tools/build-client.mjs`
12
+ 按文件名顺序拼接;加载契约不变(DSH 仍只读一个 `client.js`,无 bundler / JSX)。
13
+ 新增 `npm run build:client`、`build:client:check`,`prepublishOnly` 校验生成物;代码预算按分片计。
14
+
15
+ ### 新增
16
+
17
+ - **「变更」第四档**:在「文档 / 代码 / 媒体」之外新增「变更」,列出**未提交**的 Markdown / 代码文件,
18
+ 带 `修改 / 新增 / 删除 / 重命名` 状态与 `+N −N` 行数;**工作区根不是仓库时自动用一层子目录里的仓库**
19
+ (如 `08_Knit/knit`,行 rel 前缀 `knit/`);点开在同一个预览面板里看**逐行 diff**
20
+ (上下文 / 新增 / 删除 + 新旧行号)。数据来自只读 `git status + numstat + diff`
21
+ (`--no-ext-diff --no-textconv`,无写动词),独立 `/knit/api/status` 与 `/knit/api/diff`。
22
+
23
+ ### 修复
24
+
25
+ - **多张图的评论按输入框附件顺序编号**:第一张附件 = `图像 1`,第二张 = `图像 2`(之前每段都写「图像 1」,
26
+ agent 分不清是哪张图)。编号来源是输入框 `[data-composer-card]` 里已有的附件数 + 1。
27
+ - **连续发送评论时另起独立段落**:输入框已有正文就前面空一行再投(`\n\n`),
28
+ 不再把两段评论拼在同一个段落里;光标先移到末尾,避免插在用户文字中间。
29
+
6
30
  ## [0.26.0] - 2026-11-14
7
31
 
8
32
  ### 新增
@@ -33,6 +57,18 @@
33
57
  **1440×900 @1x 与 1024×900 @2x** 下 visual 百分比逐位相同;监听 paste 只有一次、items 里带 File。
34
58
  截图在 `03_发布/验收截图-v0.26/`。⚠️ **用户桌面 App 里的真人逐条验收还没做**。
35
59
 
60
+ ### 发布记录
61
+
62
+ - ✅ **已发布(2026-11-14)**:轻量 tag `v0.26.0` = 提交 `3c90fcd`(与 registry 的 `gitHead` **逐字相同**);
63
+ OIDC 通道 run `43610425309`,**ref 是 `v0.26.0`** ⇒「tag 与 package.json 版本对齐」那条守卫**真跑了**;
64
+ **attempt 1 一次通过**(v0.25.0 修掉的 mtime flake 没有再来)。
65
+ - registry:`latest` = `0.26.0`,共 **24** 个版本;`dist.shasum` = `a8aa0487ac974de0188df2a4512ab64567cce4c4`,
66
+ `fileCount` **72**,`unpackedSize` **2 640 926 B**(与本地 `npm pack` 的解包大小**逐项相同**);
67
+ 带**签名 provenance**(`search.sigstore.dev` logIndex `3881051560`)。
68
+ - ⚠️ **发布后约 8 分钟内 `npm view` 一直报 `latest = 0.25.0`** —— 连 `--prefer-online` + 全新缓存目录也一样;
69
+ 直查 `registry.npmjs.org`(带 `cache-control: no-cache`)当场就是 `0.26.0`。
70
+ **结论:`npm view` 不是发布回读的可信判据**(它的 packument 缓存会滞后)。
71
+
36
72
  ## [0.25.0] - 2026-10-31
37
73
 
38
74
  > **本版主题**:「看图」这件事从「点一下占半屏」变成**停一下看大图 / 双击看全屏**,
package/README.en.md CHANGED
@@ -198,7 +198,8 @@ as one of its tabs. Each host is an independent optional dependency; missing one
198
198
  | Preview pane is height-draggable (20%–80%, remembered), fullscreen-able, `Esc` to exit | ✅ |
199
199
  | **"Open locally"** opens the document in your default app; the **path in the preview header is clickable** and now opens the system file manager with the file **selected** (`action:'reveal'`), and its tooltip carries the full relative path | ✅ |
200
200
  | Double-click opens in a new tab (the official document preview, with its PDF renderer and renderer switching) | ✅ |
201
- | **In-image comments**: click "Comment" on the hover preview → a **canvas inside the Knit panel** (never covers the conversation); click the image to drop a pin, write a line, send from the bottom bar. Sending attaches the **original image + `图像 1: …` coordinate text**; comments live in session memory only (lost on refresh, not persisted) | ✅ |
201
+ | **Changes view**: a fourth tab (Docs / Code / Media / Changes) listing **uncommitted** Markdown and code files with modified / added / deleted / renamed status and `+N −N`; clicking opens a line-by-line diff in the existing preview. Read-only `git status + numstat + diff` (`--no-ext-diff --no-textconv`) | ✅ |
202
+ | **In-image comments**: click "Comment" on the hover preview → a **canvas inside the Knit panel** (never covers the conversation); click the image to drop a pin, write a line, send from the bottom bar. Sending attaches the **original image + `图像 N: …` coordinate text** (N follows the composer attachment order, and each send starts a new block); comments live in session memory only (lost on refresh, not persisted) | ✅ |
202
203
  | Filter box over title / summary / path | ✅ |
203
204
  | **Click the workspace path** to open the project folder in your file manager | ✅ |
204
205
  | **Hover the entry button to peek**: a read-only floating list of the 5 most recent docs; click to open the right sidebar (doesn't push the layout; the popover is just header + list — no extra divider or hint line) | ✅ |
@@ -764,7 +765,7 @@ All of it is string arithmetic — **no embeddings, no model calls**.
764
765
  - **Makes no outbound network requests**: the client's `fetch` calls all point to
765
766
  the plugin's own same-origin routes
766
767
  - **No install-time scripts** (no `install` / `postinstall`)
767
- - **Zero dependencies** — nothing to build, no build-authorisation prompt
768
+ - **Zero dependencies** — nothing to install or build at install time; the dev-only client shard concatenation uses Node built-ins only
768
769
  - The media route only allows an **image/video-extension allowlist** (images ≤ 12MB,
769
770
  video ≤ 256MB), serves video over HTTP Range, and responds with
770
771
  `nosniff` plus `default-src 'none'; sandbox`; the **text route serves documents, code and
@@ -828,16 +829,20 @@ feature request.
828
829
  git clone https://github.com/PolinniZhong/dsh-knit.git
829
830
  cd dsh-knit
830
831
 
831
- npm test # 914 tests, zero dependencies, no npm install needed
832
+ npm run build:client # client source shards → src/client/client.js (no bundler)
833
+ npm run build:client:check # verify the generated file matches the shards
834
+ npm test # 927 tests, zero dependencies, no npm install needed
832
835
  ```
833
836
 
834
837
  **How changes take effect**: the host half (`src/host/`) **requires a DSH restart** (no hot reload);
835
838
  the client half (`src/client/`) only needs a hard browser refresh.
836
839
 
837
- **There is no build step**: the client half is a hand-written `window.__ModuleLoader__.load({...})`
838
- using `React.createElement` instead of JSX, so there's no tsbuild / tsc. Static assets are inlined
839
- too — changing the icon means editing both the `assets/` source and `KNIT_ICON_PATH` in
840
- `src/client/client.js`; `test/icon.test.mjs` asserts the two are byte-identical.
840
+ **There is no bundler**: the client source lives in `tools/client-src/` and is concatenated into
841
+ `src/client/client.js` by `node tools/build-client.mjs` (DSH still loads exactly one file). It uses
842
+ `React.createElement` instead of JSX, so there's no tsbuild / tsc. Run `npm run build:client` after
843
+ editing a shard, and `npm run build:client:check` before committing. Static assets are inlined too —
844
+ changing the icon means editing both the `assets/` source and `KNIT_ICON_PATH` in the generated
845
+ file; `test/icon.test.mjs` asserts the two are byte-identical.
841
846
 
842
847
  ```
843
848
  knit/
@@ -856,7 +861,7 @@ knit/
856
861
  │ ├── host/feedback.js # usage feedback: read-time attribution / Context Epoch / delta (pure)
857
862
  │ ├── host/tool.js # the agent tool knit_docs (hand-written ToolDefinition)
858
863
  │ └── client/client.js # dual-host registration + panel UI
859
- └── test/ # 914 tests
864
+ └── test/ # 927 tests
860
865
  ├── eval/ # retrieval quality: corpus + cases + frozen v0.5.2 baseline
861
866
  └── context/ # context tiering: 24-doc corpus + 12 real-task cases
862
867
  ```
package/README.md CHANGED
@@ -179,7 +179,8 @@ dsh plugin --profile web add dsh-knit
179
179
  | 图片与视频:方形缩略图网格,**格子基准固定 104px、列数由宽度连续数出来**(320px → 2 列 / 632px → 5 列 / 1200px → 10 列),格子大小基本不变;**纵向有多少行就铺多少行**,超出交给列表滚动;视频自动取首帧、叠播放三角与时长角标(零依赖、不转码) | ✅ |
180
180
  | **悬停看大图**:鼠标停在图片卡片上 350ms 弹出一张大图(上限 420×420,按可用空间收缩;优先摆左侧,放不下翻右侧;滚动即收)。只做图片 | ✅ |
181
181
  | **双击图片 → 整屏查看器**:portal 到整页、模态级层级、**毛玻璃遮罩随深色模式变**;左侧一列「当前这张附近 10 张」缩略图(**点缩略图切图**,当前那张自动滚进可视区);`↑↓` / `←→` / **图片区滚轮**都能翻页、`Esc` / `✕` / 点图片以外关闭;工具条带**收藏 / 本地打开** | ✅ |
182
- | **图内评论**:悬停大图点「评论」→ **Knit 面板内画布**(不盖住会话);点图落 pin、就地写一句、底部评论栏发送。发送 = **原图附件 + `图像 1:…` / 坐标文本**,评论只活在当前会话内存里(刷新丢;不落盘) | ✅ |
182
+ | **变更档**:文档 / 代码 / 媒体 / 变更四档;变更列**未提交**的 Markdown 与代码,显示修改 / 新增 / 删除 / 重命名与 `+N −N`,点开在同一个预览面板看逐行 diff;只读 `git status + numstat + diff`(`--no-ext-diff --no-textconv`) | ✅ |
183
+ | **图内评论**:悬停大图点「评论」→ **Knit 面板内画布**(不盖住会话);点图落 pin、就地写一句、底部评论栏发送。发送 = **原图附件 + `图像 N:…` / 坐标文本**(编号跟输入框附件顺序走,连续发送自动另起一段),评论只活在当前会话内存里(刷新丢;不落盘) | ✅ |
183
184
  | 双击**视频** → 面板内**就地预览**:可播放可拖动(HTTP Range 流式,不全量下载)。查看器只做图片,视频不进去 | ✅ |
184
185
  | 预览面板可拖高度(20%–80%,位置记住)、可全屏,`Esc` 退出;**全屏时头部 / 排序条 / 类型档 / 使用情况 / 列表全部让位**,预览铺满整个面板 | ✅ |
185
186
  | **「本地打开」**:用系统默认应用打开当前预览的这篇文档;**预览头那条路径点开的是它「所在的文件夹」并顺带选中这个文件**(reveal,macOS 是 Finder 里 `open -R`;与顶部那行工作区路径同一套机制,差别只在「打开目录」vs「定位到文件」,完整相对路径在悬停提示里) | ✅ |
@@ -701,7 +702,7 @@ v0.17 的信息都在,但**摞在一行字和几个折叠块里**,读不出
701
702
  同样不写任何文件、不落盘任何计数,重启即失
702
703
  - **不发起任何对外网络请求**:客户端的 `fetch` 都指向插件自己的同源路由
703
704
  - **没有安装期脚本**(无 `install` / `postinstall`)
704
- - **零依赖** —— 装完不需要构建授权,也没有构建步骤
705
+ - **零依赖** —— 装完不需要构建授权;开发时的客户端分片拼接只用 Node 内置模块,不装包
705
706
  - 按路径读文件的接口只放行**图片 / 视频扩展名白名单**(图片 ≤ 12MB、视频 ≤ 256MB),
706
707
  视频走 HTTP Range 按需取字节,响应带 `nosniff` 与 `default-src 'none'; sandbox`
707
708
 
@@ -764,16 +765,19 @@ v0.17 的信息都在,但**摞在一行字和几个折叠块里**,读不出
764
765
  git clone https://github.com/PolinniZhong/dsh-knit.git
765
766
  cd dsh-knit
766
767
 
767
- npm test # 914 项,零依赖,不需要先 npm install
768
+ npm run build:client # 客户端源码分片 → src/client/client.js(无 bundler)
769
+ npm run build:client:check # 提交前校验生成物与分片同步
770
+ npm test # 927 项,零依赖,不需要先 npm install
768
771
  node tools/clean-room-test.mjs # 发版前闸门:npm pack → 解包 → 在解包目录里再跑一遍测试
769
772
  ```
770
773
 
771
774
  **改动生效方式**:宿主半边(`src/host/`)改了**必须重启 DSH**(实测不热加载);
772
775
  客户端半边(`src/client/`)改了硬刷新浏览器即可。
773
776
 
774
- **没有构建步骤**:客户端半边是手写的 `window.__ModuleLoader__.load({...})`,
775
- 用 `React.createElement` 而不是 JSX,所以不需要 tsdown / tsc。
776
- 静态资源也是内联的 —— 改图标要同时改 `assets/` 源文件和 `src/client/client.js` 里的
777
+ **没有 bundler**:客户端源码在 `tools/client-src/`,由 `node tools/build-client.mjs` 按顺序拼成
778
+ `src/client/client.js`(DSH 仍只读这一个文件);用 `React.createElement` 而不是 JSX,不需要
779
+ tsdown / tsc。改分片后跑 `npm run build:client`,提交前 `npm run build:client:check`。
780
+ 静态资源也是内联的 —— 改图标要同时改 `assets/` 源文件和生成文件里的
777
781
  `KNIT_ICON_PATH`,`test/icon.test.mjs` 会核对两者逐字一致。
778
782
 
779
783
  ```
@@ -795,7 +799,7 @@ knit/
795
799
  │ ├── host/feedback.js # 使用反馈:读时归因 / Context Epoch / Delta(纯逻辑,只读事件流)
796
800
  │ ├── host/tool.js # agent 文档工具 knit_docs(手写 ToolDefinition)
797
801
  │ └── client/client.js # 双宿主注册 + 面板 UI
798
- └── test/ # 914 项测试
802
+ └── test/ # 927 项测试
799
803
  ├── eval/ # 检索质量评测:语料 + 用例 + 冻结的 v0.5.2 基线 + Deep Context 四指标
800
804
  └── context/ # 上下文分层评测:24 篇语料 + 12 条任务型用例
801
805
  ```
package/SECURITY.md CHANGED
@@ -2,10 +2,15 @@
2
2
 
3
3
  > **Knit 的安全属性 —— 每一条都指向一个真实存在的检查。**
4
4
  >
5
- > 最后更新:2026-11-14(v0.26.0)—— **本版无安全相关改动**:图内评论只读既有的
5
+ > 最后更新:2026-11-20(v0.27.0)—— **本版动过安全面**:「变更」档新增两条**只读** git 读取
6
+ > (`git diff --numstat -z --no-renames HEAD` 取行数、`git diff --no-color --no-ext-diff
7
+ > --no-textconv --unified=3 HEAD -- <rel>` 取正文):argv 固定、不走 shell,外部 diff 与 textconv
8
+ > 都被挡住,**仍无任何写动词**;diff 正文只回本机面板、不落盘不联网。见下表新增行。
9
+ > 版本号随每版前移,好让「安全表被漏掉」与「本版没动安全面」在版本一致性检查里能分开
10
+ >
11
+ > 📌 **v0.26.0(2026-11-14)那次改了什么**:**无安全相关改动** —— 图内评论只读既有的
6
12
  > `GET /knit/api/raw` 与 `GET /knit/api/attachment`(同一套路径 / 会话边界),**未新增路由**;
7
13
  > 发送只把原图字节(同源读取)与文本投进本机输入框,**零新增网络出口**。
8
- > 版本号随每版前移,好让「安全表被漏掉」与「本版没动安全面」在版本一致性检查里能分开
9
14
  >
10
15
  > 📌 **v0.25.0(2026-10-31)那次改了什么**:新增「**读工作区之外的唯一一处**」——
11
16
  > 对话里工具产出的图(`GET /knit/api/attachment`):只认 `sha256:<64 hex>`、**不接受任何路径**、
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-knit",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "type": "module",
5
5
  "description": "Context retrieval for DeepSeek Harness: ranks docs, code and media by relevance into a sidebar Context Pack. Lexical and fully local by default. Hybrid is off until you configure a provider; it sends your query and file titles/summaries, not bodies.",
6
6
  "main": "./src/host/index.js",
@@ -24,7 +24,11 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "agents:budget": "node tools/agents-budget.mjs",
27
- "test": "node --test test/host.test.mjs test/host-http.test.mjs test/client.test.mjs test/tier1.test.mjs test/entry.test.mjs test/i18n.test.mjs test/icon.test.mjs test/path.test.mjs test/peek.test.mjs test/eval.test.mjs test/tool.test.mjs test/label.test.mjs test/links.test.mjs test/relations.test.mjs test/control.test.mjs test/security.test.mjs test/context.test.mjs test/context-eval.test.mjs test/feedback.test.mjs test/context-delta.test.mjs test/context-feedback-eval.test.mjs test/context-effectiveness.test.mjs test/document-lifecycle.test.mjs test/classification.test.mjs test/code-context.test.mjs test/deep-context.test.mjs test/deep-eval.test.mjs test/deep-scale.test.mjs test/index-store.test.mjs test/index-incremental.test.mjs test/hybrid-eval.test.mjs test/semantic.test.mjs test/hybrid-retrieval.test.mjs test/git-changes.test.mjs test/attachments.test.mjs test/comments.test.mjs"
27
+ "test": "node --test test/host.test.mjs test/host-http.test.mjs test/client.test.mjs test/tier1.test.mjs test/entry.test.mjs test/i18n.test.mjs test/icon.test.mjs test/path.test.mjs test/peek.test.mjs test/eval.test.mjs test/tool.test.mjs test/label.test.mjs test/links.test.mjs test/relations.test.mjs test/control.test.mjs test/security.test.mjs test/context.test.mjs test/context-eval.test.mjs test/feedback.test.mjs test/context-delta.test.mjs test/context-feedback-eval.test.mjs test/context-effectiveness.test.mjs test/document-lifecycle.test.mjs test/classification.test.mjs test/code-context.test.mjs test/deep-context.test.mjs test/deep-eval.test.mjs test/deep-scale.test.mjs test/index-store.test.mjs test/index-incremental.test.mjs test/hybrid-eval.test.mjs test/semantic.test.mjs test/hybrid-retrieval.test.mjs test/git-changes.test.mjs test/attachments.test.mjs test/comments.test.mjs",
28
+ "budget:code": "node tools/code-budget.mjs",
29
+ "build:client": "node tools/build-client.mjs",
30
+ "build:client:check": "node tools/build-client.mjs --check",
31
+ "prepublishOnly": "node tools/build-client.mjs --check"
28
32
  },
29
33
  "dsh": {
30
34
  "bundle": {