@jayyuen66/dsh-zvec-grep 0.1.12 → 0.1.13
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 +77 -50
- package/README.md +18 -16
- package/README.zh-CN.md +44 -42
- package/THIRD_PARTY_NOTICES.md +4 -4
- package/client.js +103 -28
- package/cordis.patch.yml +1 -1
- package/docs/DETAIL.md +13 -6
- package/docs/DETAIL.zh.md +14 -7
- package/host.js +1739 -649
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,17 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The deviations below are deliberate: version headings carry no release date (publish times are recorded by the registry — `npm view <package> time`), and a release may add sections beyond the standard six, such as `Not changed, deliberately` and `Earlier`.
|
|
4
4
|
|
|
5
|
+
## 0.1.13
|
|
6
|
+
|
|
7
|
+
适配 zg 0.3.0(上游 Rust 重写,CLI 形态破坏性变更),新增守护进程 MCP 传输层与传输三档设置卡开关,并把 0.3.0 的功能面对齐进三件工具。**不兼容旧 zg**:`MINIMUM_ZG_VERSION` 抬到 `0.3.0`,0.2.x 的 Node 版 zg 会在版本门槛处被拦下并给出升级指引。
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **zg 0.3.0 命令形态**:`zg index/status/query/server` 子命令全部改为 `--index/--status/裸词/--server`(0.3.0 里裸词是搜索文本,`zg query …` 会被当成一次查询词被污染的搜索——那是本包版本门槛注释里预言的「看起来正常实则查错」形态,实测确认)。drop 分支移除 `--yes`(0.3.0 删除立即执行,实测带 `--yes` 退 2)。穷举通道 `zg query --rg` → 顶层 `zg --rg`。状态命令的未配置报告从 0.2.2 的 `? Workspace index is not configured … Next: …` 变为四字段布局(`Coverage Unavailable (index not configured)`)。
|
|
12
|
+
- **MINIMUM_ZG_VERSION 抬到 0.3.0**:本包下发的每条命令都按 0.3.0 形态书写,装了 0.2.x 的 Node 版 zg 会在发命令前被拦下。`zg --version` 的输出形状不变(单行三段数字),版本门解析器未动。
|
|
13
|
+
- **输出解析层按 0.3.0 重写**:命中条目头行不再有 `matchedBy=`(现量 `#1 路径:行号`),`hits: N` 组计数行消失——`hitSummary` 只剩「去重后位置数」一个维度,容忍 `freshness:` 头行(MCP 传输)与 `--preview detail` 的缩进头行(尾部 `score=` 装饰在代码里剥,正则保持线性);错误格式从 `Error: …/Code: …/Details:` 变为 `Error[码]: 成因`,`lib/zg-errors.ts` 按新格式重写(锁竞争等价物是 `ZG.ENGINE.RESOURCE_BUSY`,成因串里的 `operation=` 决定是否排队等重建;`ZG.ENGINE.DAEMON_LEASE_ACTIVE` 独立码不复存在;新增 `ZG.ENGINE.PERMISSION_DENIED` 归类,远程授权被拒时补部署开关与 `zg --auth grant` 指引);stderr 进度行白名单改为前缀匹配,覆盖 0.3.0 的九种非 TTY 进度行(`Model warning:` 刻意不收——它是告警不是进度,交给降级注回显)。
|
|
14
|
+
- **workspace manifest 探测按 0.3.0 形状重写**:manifest 的 `manifestVersion/rootPaths` 换成 `indexVersion: 2` + `sourceRoot.recordedPath`,`manifestCoversRoot` 同步;0.2.x 旧形状判「无索引」。
|
|
15
|
+
- **0.2.2 的两条实测事实在 0.3.0 失效,判定与文档随之改写**:① `--ignore-file` 指向读不成的文件不再弄坏索引树(0.3.0 静默容忍、坏路径记进回执 `roots` 行),`assertIgnoreFilesExist` 预检保留但理由改为「排除规则悄悄不生效 = 静默错误答案」;② 密钥文件默认就不进索引(0.3.0 text-only:`.pem` 记 binary、`id_rsa` 记 unsupported),`excludeSecrets` 的 `--iglob` 规则降为双保险。
|
|
16
|
+
- **CI 门禁防假绿**:gate 的 pnpm 步(install 与 check)统一声明 `shell: bash`——Windows runner 的默认 shell 是 pwsh,会把 pnpm 解析成 `.ps1` 垫片,实测那一步零输出、秒退 0 而结论 success;pnpm 步之前加「pnpm 可用性」自检(打印解析到的路径与版本),门禁输出经 `tee` 落 `$RUNNER_TEMP/gate.log`,其后新增「断言门禁真跑出测试」一步——日志里没有 vitest 的 `Test Files` 汇总行即判红。两格拆分的注释同步改写:root 判据的 win32 档收盘符/UNC 之后真盘用例在 windows 格照跑,拆分只剩「覆盖率归 ubuntu 一格」的格子分工;host-stack.ts 里解释旧平台跳过的注释随之删除。actionlint / dependabot / publish / scorecard 四份配置只作措辞统一,判据不变。
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **并发自启与多会话 MCP**:同一宿主内的冷启动合并成一发 `zg --server on`;token 用 O_EXCL 原子认领,多宿主共享同一枚;每个并发工具调用各用一条 MCP 会话(实测同会话并发会被上游串行化到超时),空闲会话复用;显式 `mcp` 档在共享 daemon 被另一宿主停掉后于同一次调用内重新 ensure 并重试一次。
|
|
21
|
+
- **Windows 支持**:root 判据收盘符/UNC,命令转义切到 pwsh(内嵌 `'` 写成 `''`),grep/rg 门禁按 win32 切词并认 `rg.exe`/`grep.exe`,manifest 与白名单比较按 NTFS 大小写不敏感;命令规模上限在 win32 收到 24000 字节。POSIX 行为不变。
|
|
22
|
+
- **MCP 传输层**(`lib/daemon-client.ts` + `lib/daemon-args.ts`):检索(索引通道)可走守护进程的 MCP HTTP 端点(纯 fetch、无 SDK,实测 initialize → mcp-session-id → tools/call 全流程与 token 鉴权 401/200)。与 CLI 通道共享守卫层、取值器与输出解析(应答文本与 CLI stdout 同构);锁忙/重建等待在两条 lane 通用(`attemptWithRebuildWait` 收拢)。MCP 面的参数差异按实测处理:preview 就近降级(none→short、detail→full)、`fileTypes` 映射 `includedFormats`(引擎格式位)、`device` 点名拒绝(daemon 检索面没有这一位)。
|
|
23
|
+
- **传输三档**(volatile `transport: auto|cli|mcp`,设置卡可选):自动 = daemon 就绪走 MCP、缺席落回 CLI;仅 CLI = 恒 spawn(不碰 daemon 端口);仅 MCP = 恒 MCP,daemon 缺席时插件拉起(`zg --server on` + 自生成 `ZVEC_GREP_SERVER_TOKEN`,仅存本插件内存;起不来明确报错,不静默回退)。token 同时经 env 喂给 CLI lane 子进程与探测(自启 daemon 带鉴权,四路同源)。已知限制:插件重启后旧 token 失忆,`zg --server off` 后重拉即可(文案已写明)。
|
|
24
|
+
- **0.3.0 新参数进工具**:`zg_search` 新增 `fts`/`vector`(词法/语义补充组)、`fuse`(多组融合)、`preview: detail`(元数据+outline+文件分组档)、`category`/`categoryNot`(引擎分类过滤)、`files`(文件发现模式 `zg --rg --files`:gitignore 三件套默认感知、排序、无上限;与 query/limit/preview 等互斥);`zg_index` 新增 `nestedGit`(嵌套 Git 仓库扫描)。
|
|
25
|
+
- **远程 embedding 打通**:候选清单新增远程组(qwen 三枚,`zg --help models` 现量),设置卡模型下拉分本地/远程两组;部署开放 `allowRemoteEmbedding` 后远程引用放行且命令自动补 `--allow-remote`(0.3.0 非交互远程索引的门槛),`allowRemote` 放行的是远程**闭集**——未知前缀引用在任何开关下都不放行(0.2.2 时代「开放即放行一切非空串」的旧语义收紧);首次索引需用户 `zg --auth grant` 授权,错误文案带可照抄命令。
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- **符号类型闭集对齐 0.3.0**:新增 `enum` 档(七值 `alias/class/enum/function/interface/module/value`,与上游 MCP 声明同源)。
|
|
30
|
+
- **indexProbe 的 macOS 路径比对**:0.3.0 manifest 的 `recordedPath` 是解析过的 `/private/…` 形式,比对两侧都剥前缀后进行。
|
|
31
|
+
|
|
5
32
|
## 0.1.12
|
|
6
33
|
|
|
7
|
-
宿主开发基线抬到 `0.2.2-rc.1`(支持窗口 `^0.2.1-rc.5 || ^0.2.2-alpha.3` 未变),`engines.node`
|
|
34
|
+
宿主开发基线抬到 `0.2.2-rc.1`(支持窗口 `^0.2.1-rc.5 || ^0.2.2-alpha.3` 未变),`engines.node` 下限抬到 `>=24.9.0`;卡片组件改由 shared 的 `./client` 供。检索门禁、索引与重建的判定逻辑不变,需要留意的是 `engines.node` 抬高后 node 22 装不上本包。
|
|
8
35
|
|
|
9
36
|
### Changed
|
|
10
37
|
|
|
11
|
-
- **shared 抬到 0.2.4**:catalog、生成物与 lockfile 随之同步;发布态依赖门禁不再要求消费者重复提供 shared 自己声明并随包安装的普通依赖(当前是纯解析器 `@deepseek-ai/dsh-fs-patch`)。这条豁免按包名整片生效,今后 shared
|
|
12
|
-
- **宿主开发基线**:`devDependencies` 的 dsh 家族抬到 `0.2.2-rc.1`,`@deepseek-ai/cordis` 抬到 `4.1.0`,`@deepseek-ai/cordis-plugin-group` 抬到 `1.1.0`、`@deepseek-ai/cordis-plugin-timer` 抬到 `1.2.0`,`@deepseek-ai/schemastery` 抬到 `3.19.0`;`@deepseek-ai/dsh-ptc-runtime` 从 devDependencies 移除(源码与测试都不再引用它)。`engines.dsh` 与三枚 `@deepseek-ai/dsh*` peer 保持 `^0.2.1-rc.5 || ^0.2.2-alpha.3` 未动;`@deepseek-ai/schemastery` 的 peer 由 `^3.18.6-alpha.1` 放宽为 `^3.18.5 || ^3.18.6-alpha.1`,与两条宿主线各自的实装版本对齐。`engines.node` 由 `>=22.12.0` 抬到 `>=24.9.0
|
|
13
|
-
- **卡片组件改由 shared 的 `./client` 供**:`src/client-entry.ts` 的四路运行期值导入(`lib/card-ui`、`lib/card-diff`、`lib/errors`、`lib/record`)统一改走 `./client
|
|
38
|
+
- **shared 抬到 0.2.4**:catalog、生成物与 lockfile 随之同步;发布态依赖门禁不再要求消费者重复提供 shared 自己声明并随包安装的普通依赖(当前是纯解析器 `@deepseek-ai/dsh-fs-patch`)。这条豁免按包名整片生效,今后 shared 新增任何宿主依赖都会静默通过,不再逐条变红——它换到的是「消费者不为库包的内部依赖重复负责」这一规则。
|
|
39
|
+
- **宿主开发基线**:`devDependencies` 的 dsh 家族抬到 `0.2.2-rc.1`,`@deepseek-ai/cordis` 抬到 `4.1.0`,`@deepseek-ai/cordis-plugin-group` 抬到 `1.1.0`、`@deepseek-ai/cordis-plugin-timer` 抬到 `1.2.0`,`@deepseek-ai/schemastery` 抬到 `3.19.0`;`@deepseek-ai/dsh-ptc-runtime` 从 devDependencies 移除(源码与测试都不再引用它)。`engines.dsh` 与三枚 `@deepseek-ai/dsh*` peer 保持 `^0.2.1-rc.5 || ^0.2.2-alpha.3` 未动;`@deepseek-ai/schemastery` 的 peer 由 `^3.18.6-alpha.1` 放宽为 `^3.18.5 || ^3.18.6-alpha.1`,与两条宿主线各自的实装版本对齐。`engines.node` 由 `>=22.12.0` 抬到 `>=24.9.0`,取值取自宿主自己的下限。
|
|
40
|
+
- **卡片组件改由 shared 的 `./client` 供**:`src/client-entry.ts` 的四路运行期值导入(`lib/card-ui`、`lib/card-diff`、`lib/errors`、`lib/record`)统一改走 `./client`,只换模块说明符,没有逻辑改动,`package.json` 新增 `dsh.bundle.client.external`,`build-client.mjs` 的外置清单同步;`cordis.patch.yml` 因此插入一条**不写 id** 的 `@jayyuen66/dsh-plugin-shared` 组件行(写 id 会在插件页多出一个可关闭的组件,关掉后设置卡失去组件供应)。
|
|
14
41
|
- **CI 的 node 矩阵收敛**:`ci.yml` 的 `node: [22, 24]` 加 macOS 排除改为单格 `node: [24.9]`,两份 workflow 的 `node-version` 由 `24` 改为 `24.9`,与 `engines.node` 同值。
|
|
15
|
-
- **文档**:dsh 徽章与两份 README 的窗口句保持 `^0.2.1-rc.5` 系(`engines.dsh` 本轮未动,`test/readme-parity.test.ts` 把徽章与全文 caret
|
|
42
|
+
- **文档**:dsh 徽章与两份 README 的窗口句保持 `^0.2.1-rc.5` 系(`engines.dsh` 本轮未动,`test/readme-parity.test.ts` 把徽章与全文 caret 版本集合对齐到窗口首条,改值会当场红);两份 README 的 `insert:` 块由「唯一一行」改为「两条条目」并写明 shared 那行为何不写 id。
|
|
16
43
|
|
|
17
44
|
### Fixed
|
|
18
45
|
|
|
@@ -20,30 +47,30 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
20
47
|
|
|
21
48
|
## 0.1.11
|
|
22
49
|
|
|
23
|
-
这一版补上 search-first
|
|
50
|
+
这一版补上 search-first 门禁对命令替换与壳层包装的识别,给索引探测加显式失效通道,把状态读取路径按部署形态统一处理,并让发布链与产物门禁各自多一道判据;宿主开发基线抬到 `0.2.2-alpha.3`,支持窗口改为 `^0.2.1-rc.5 || ^0.2.2-alpha.3`。
|
|
24
51
|
|
|
25
52
|
### Changed
|
|
26
53
|
|
|
27
54
|
- **宿主与元数据**:devDependencies / catalog / overrides 全量抬到 `0.2.2-alpha.3`(cordis `4.0.6-alpha.2`、schemastery `3.18.6-alpha.2`);peer 与 engines 的支持窗口改为 `^0.2.1-rc.5 || ^0.2.2-alpha.3`;shared 抬到 `0.2.3`。
|
|
28
55
|
- **search-first 门禁**(`lib/search-predicates.ts`):`$(...)` 命令替换与 `bash -c '…'` / `sh -c` / `zsh -lc` 等壳层包装里的 grep/rg 也纳入词法判据,嵌套最多两层。
|
|
29
56
|
- **索引探测失效**(`host.ts`):`zg_index` 前台落定后当场清掉该根的探测缓存,drop/重建不再等 60 秒 TTL;门禁与 `findIndexRoot` 同一拍看到新状态。
|
|
30
|
-
-
|
|
57
|
+
- **状态读取接口**(`host.ts`、`lib/card-logic.ts`、`src/ui-messages.ts`):`zg_status` 的守护进程注文按 `clientMode`统一处理(direct 部署不再发空头承诺);卡片就绪位只认 `true`/`false`,畸形 `status` 或缺退出码统一落到「没有可判定的结果」。
|
|
31
58
|
- **构建与发布链**:`build-client` / `build-host` 直接复用 shared 的 `singleEntryChunk` 与包名同源校验;CI 与 publish 的 pnpm 补丁版本单点声明,发布 job 按 build 登记的 tarball 名/版本核对,registry 自检 URL 从 package.json 现取;产物体积门补下限,防止截断产物混过上限。action 钉版抬到 `pnpm/action-setup` v6.1.1 与 `github/codeql-action` v4.39.2。
|
|
32
59
|
- **文档**:中英 README 重写搜索门禁、root 判据、卡片就绪位、随包文件与覆盖率分母;`docs/DETAIL.zh.md` 同步 `rebuildWaitMs` 默认值与冲突旗标。
|
|
33
60
|
|
|
34
61
|
### Fixed
|
|
35
62
|
|
|
36
63
|
- **argv 守卫**(`lib/argv-guard.ts`):单值/数组入口对非字符串坏值单独报「字符串或字符串数组」,不再误报成「必须是字符串数组」。
|
|
37
|
-
-
|
|
64
|
+
- **卡片读取接口**(`lib/card-logic.ts`、`src/client-entry.ts`):`roots()` 的探测失败折成 `false`;重建输入占位与镜像地址走 locale 常量。
|
|
38
65
|
- **契约门禁**:`test/schema-coverage.ts` 认正则字面量与 `as const`/`satisfies` 尾巴,避免把类型标注当成设置字段;两份 README 的 dsh 窗口与 badge 新增与 `engines.dsh` 同源的用例,`bump-manifests` 只改 package.json 时本仓会当场红。
|
|
39
66
|
|
|
40
67
|
### Added
|
|
41
68
|
|
|
42
|
-
-
|
|
69
|
+
- **夹具**:`test/cjk-residue.test.ts`(中文残留字符类的独立判据)、`test/host-freshness.test.ts`(产物一致性夹具的形状判据)、`test/schema-coverage-parsing.test.ts`(正则/字面量解析边界)、`test/embedding-cache.ts`(按模型定位真实缓存位置)、`test/sync-write-support.ts`(写锁用例共用支撑)。
|
|
43
70
|
|
|
44
71
|
## 0.1.10
|
|
45
72
|
|
|
46
|
-
|
|
73
|
+
一轮跨模块审查修复:search-first 检查的词法判据重建、重建注册表代次化,状态读取接口与发布链统一处理。
|
|
47
74
|
|
|
48
75
|
### Changed
|
|
49
76
|
|
|
@@ -52,9 +79,9 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
52
79
|
|
|
53
80
|
### Fixed
|
|
54
81
|
|
|
55
|
-
- **门禁词法**(`lib/search-predicates.ts`):包装命令取值旗标按包装名分表(sudo/time/git/xargs 各自的 `-n/-p/-E/-r/-t` 不再误吞真命令);新增检索侧取值旗标表与重定向标记(`grep foo src > /tmp/out`
|
|
82
|
+
- **门禁词法**(`lib/search-predicates.ts`):包装命令取值旗标按包装名分表(sudo/time/git/xargs 各自的 `-n/-p/-E/-r/-t` 不再误吞真命令);新增检索侧取值旗标表与重定向标记(`grep foo src > /tmp/out` 的写入目标不算操作数);组字符只在独立成词时分隔(`${DIR}/src` 不再被切碎放行);命令位绝对路径不再当根外目标。
|
|
56
83
|
- **重建注册表代次化**(`lib/rebuild-state.ts`):`release`/`attach` 增加可选 claim 凭据校验,迟到收尾不再删改同根新条目;`wait` 改递归 `waitCovering`,祖先+后代同时覆盖时逐轮都等;全部键经 `normalizeRoot`。
|
|
57
|
-
-
|
|
84
|
+
- **状态读取接口**(`host.ts`、`lib/rebuild-remote.ts`):zg_status 的锁忙 stderr 不再被吸收成「未就绪」;`comparablePath` 的 `/private` 剥除加 darwin 门控;超时 `jobs.kill` 包 try、失效退回 `killProc`;历史裁剪按 `startedAt` 排序;`roots()` 探测失败不再连带白名单不可用;超时分钟数 `Math.max(1, ceil)`。
|
|
58
85
|
- **卡片与草稿**(`lib/card-logic.ts`、`lib/card-draft.ts`、`src/client-entry.ts`):端点草稿逐字回显,键入中不被 URL 校验吞;草稿/已提交两层都只判自有属性;useRebuild 加 jobRef 代次与重挂置真。
|
|
59
86
|
- **散修**:`lib/cli.ts` 查询串改 `--hybrid=` 等号拼值(`-` 开头的查询不再被当旗标)、embedding 引用 trim;`lib/messages.ts` `fill()` 只取自有属性;`lib/argv-guard.ts` 计数改过滤后长度;`lib/index-preflight.ts` 增 ENAMETOOLONG;`lib/sandbox-note.ts` trim 加「unknown」兜底;`lib/zg-errors.ts` 明细只认第一个错误块;`lib/zg-config.ts` 远程端点走与 HF 镜像同一套规范化校验;`lib/embedding-catalog.ts` 目录深冻结。
|
|
60
87
|
|
|
@@ -64,7 +91,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
64
91
|
|
|
65
92
|
## 0.1.9
|
|
66
93
|
|
|
67
|
-
这一版让 search-first
|
|
94
|
+
这一版让 search-first 检查认识宿主的步骤准入,并把设置卡与读取接口校验统一到 shared 组件和 zod;
|
|
68
95
|
宿主开发线抬到 0.2.2-alpha.2。
|
|
69
96
|
|
|
70
97
|
### Changed
|
|
@@ -77,7 +104,7 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
77
104
|
- **client 产物按宿主 `PLATFORM_MODULES` 外置 zod**;`zod` 进入 `dependencies`。
|
|
78
105
|
- **宿主开发线抬到 `0.2.2-alpha.2`**:devDependencies 与 catalog/overrides 同值;`@deepseek-ai/dsh*` 的 peer
|
|
79
106
|
改为同一条支持窗口范围(`^0.2.1-rc.3`,schemastery 仍钉宿主自带版本),精确钉版只留在 devDependencies。
|
|
80
|
-
-
|
|
107
|
+
- **插件页展示进包**:新增 `locale/en.json`、`locale/zh.json` 与 `docs/DETAIL.md`、`docs/DETAIL.zh.md`;
|
|
81
108
|
`exports` 增加 `./locale/*.json`,`files` 收进 locale 与 docs。
|
|
82
109
|
- **正则常量提取**:错误明细解析、命中计数行等内联正则改为命名常量,行为不变。
|
|
83
110
|
|
|
@@ -95,16 +122,16 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
95
122
|
|
|
96
123
|
### Changed
|
|
97
124
|
|
|
98
|
-
- **`limit` 越界改成点名拒绝,不再静默钳制**(`lib/cli.ts` 的 `clampLimit` 随之更名 `resolveLimit`):`0`、`51`、`999` 一律抛错并报出允许区间(新文案 `limitOutOfRange`,中英双语)。静默钳过的值交回的是一个模型读不出的失真——它请求 999 条、实际拿到 50 条,会把「只有 50 处」当成这次检索的事实;拒绝并点名区间,下一轮它自己把数改对。省略与 `null` 照旧回默认值(那是合法用法),非整数、负数、非数字仍按「必须是非负整数」抛。工具参数说明 `limitDescription`(双语)同步写明越出区间直接报错,模型在第一轮就看到拒绝语义、不必先撞一次错误。命中摘要的 `summaryLimit`
|
|
125
|
+
- **`limit` 越界改成点名拒绝,不再静默钳制**(`lib/cli.ts` 的 `clampLimit` 随之更名 `resolveLimit`):`0`、`51`、`999` 一律抛错并报出允许区间(新文案 `limitOutOfRange`,中英双语)。静默钳过的值交回的是一个模型读不出的失真——它请求 999 条、实际拿到 50 条,会把「只有 50 处」当成这次检索的事实;拒绝并点名区间,下一轮它自己把数改对。省略与 `null` 照旧回默认值(那是合法用法),非整数、负数、非数字仍按「必须是非负整数」抛。工具参数说明 `limitDescription`(双语)同步写明越出区间直接报错,模型在第一轮就看到拒绝语义、不必先撞一次错误。命中摘要的 `summaryLimit` 与命令构造引同一个函数,摘要规则仍与实际请求一致。
|
|
99
126
|
- **宿主 `configSchema` 的数值区间改引 `lib/limits.ts` 常量**:`defaultLimit` / `grepBudgetPerSearch` / `unlockWindowMin` 三条的 `.min()/.max()` 此前写的是字面量,本轮换成 `LIMIT_MIN` / `LIMIT_MAX` / `BUDGET_MAX` / `WINDOW_MAX`。取值一个都没动,两份 README 里的区间数字照旧。**顺带纠正 0.1.7 那条声明**——它写着「宿主 schema、命令钳制、卡片显示与输入提示引同一份常量」,实际只落到后三者,schema 侧那三份副本是本轮才收的;写超实现的这句没有门能拦,靠读代码发现。
|
|
100
127
|
|
|
101
128
|
### Added
|
|
102
129
|
|
|
103
|
-
- **索引锁被非重建操作占用时点名占锁方**(新文案 `lockBusyOtherOperation`,中英双语):`ZVEC_GREP.ENGINE.LOCK.BUSY` 且 `ownerOperation` 不是 `index.rebuild` 时(增量刷新是常见的那一个),原先交回的只有 zg 的原始失败文本,读者分不清「本命令没等这类操作」和「等过之后仍然失败」。现在把点名占锁方、说明为何不排队(这类操作可能跑很久,排队等于无界挂起)那句话放在前面,zg 的原始失败原文随行——证据不吞。回执里缺 `ownerOperation` 时按 `unknown`
|
|
130
|
+
- **索引锁被非重建操作占用时点名占锁方**(新文案 `lockBusyOtherOperation`,中英双语):`ZVEC_GREP.ENGINE.LOCK.BUSY` 且 `ownerOperation` 不是 `index.rebuild` 时(增量刷新是常见的那一个),原先交回的只有 zg 的原始失败文本,读者分不清「本命令没等这类操作」和「等过之后仍然失败」。现在把点名占锁方、说明为何不排队(这类操作可能跑很久,排队等于无界挂起)那句话放在前面,zg 的原始失败原文随行——证据不吞。回执里缺 `ownerOperation` 时按 `unknown` 点名,不退成一句只说失败、不说原因的话。重建占锁照旧走等待重试,两类占锁方不再共用同一条出口。
|
|
104
131
|
|
|
105
132
|
### Not changed, deliberately
|
|
106
133
|
|
|
107
|
-
- **设置卡的数值框仍然钳到边界并在保存条上提示**(`lib/card-logic.ts
|
|
134
|
+
- **设置卡的数值框仍然钳到边界并在保存条上提示**(`lib/card-logic.ts`),与本条工具侧的拒绝规则不同。人打错一个越界数,钳到边界比让整次保存失败更合人意;模型给的 `limit` 需要的是「这一轮错了」的反馈。两侧读同一组常量,区间不会各说各话。
|
|
108
135
|
|
|
109
136
|
## 0.1.7
|
|
110
137
|
|
|
@@ -112,8 +139,8 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
112
139
|
|
|
113
140
|
- **`lib/limits.ts`**:设置卡六个字段里三个数值字段的区间与默认值收成单一来源,宿主 schema、命令钳制、卡片显示与输入提示引同一份常量;新增 `dropWithIndexArgs` 与 `rebuildExitUnknown` 两条文案。
|
|
114
141
|
- `tsconfig.build-scripts.json` 加进 typecheck 链条:`// @ts-check` 只在编辑器和显式跑 `tsc` 时生效,构建脚本没进任何 tsc program 时 CI 上没有门。变异实测过——往 `build-client.mjs` 里加一行类型错误,这条会红。
|
|
115
|
-
- `build-utils.mjs`:两个构建脚本原先各自持有 `isRecord` / `asRecord` / `isEntryChunk` / `singleEntryChunk` / `writeArtifact` / `invokedDirectly` 六份逐字副本。这些恰好都是「只在一侧修就会静默保留旧缺陷」的语义,现在只有一份,且进了 tsc 与 lint
|
|
116
|
-
-
|
|
142
|
+
- `build-utils.mjs`:两个构建脚本原先各自持有 `isRecord` / `asRecord` / `isEntryChunk` / `singleEntryChunk` / `writeArtifact` / `invokedDirectly` 六份逐字副本。这些恰好都是「只在一侧修就会静默保留旧缺陷」的语义,现在只有一份,且进了 tsc 与 lint 的扫描范围。
|
|
143
|
+
- 回归测试覆盖未登记的 `react` 家族说明符:构建期直接失败,而不是等到加载期。
|
|
117
144
|
|
|
118
145
|
### Fixed
|
|
119
146
|
|
|
@@ -121,16 +148,16 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
121
148
|
- **`drop=true` 携带任何索引侧参数时点名拒绝**:过滤、rebuild、embedding、深度等不再被静默忽略,避免用户以为清除/过滤生效而实际只删了索引。`resetPaths` 仍单独点名互斥。
|
|
122
149
|
- **`ignoreFiles` 预检改用 `path.resolve`**:相对条目按 root 解析、绝对条目原样;`ENOENT` / `EACCES` / `EISDIR` / `ENOTDIR` 判「文件不合适」,其余环境故障(fd 耗尽、链接环等)原样上抛。上游遇到读不成的忽略文件会让整次索引失败并把坏路径写进索引状态,因此必须在命令构造前拦下。
|
|
123
150
|
- **非字符串 `root` 立即报错**:`{root: 123}` 不再静默落回会话工作区,类型错不会再执行到别的目录。
|
|
124
|
-
-
|
|
125
|
-
- **重建与轮询的收尾**:`done` reject
|
|
151
|
+
- **卡片数值字段的钳制与清空语义统一处理**:越界整数钳到区间并在保存条提示;用户清空的配额/时效显示空串而不是默认值;非法原文留在控件里,不会被下一次渲染换成宿主值。
|
|
152
|
+
- **重建与轮询的收尾**:`done` reject 也释放占位与定时器;卸载时逐条统一处理;活跃表超限只告警不淘汰;未知 status 且没有可读退出码时报通用失败,不再拼「退出码 undefined」。
|
|
126
153
|
- **search-first 改按索引根判界**:`||` 与包装命令的选项取值不再漏判;空 enforcement 不再拼出残缺的沙箱后缀。
|
|
127
154
|
- **zg 版本与配置校验**:版本号接受 `v` 前缀、分量最多 9 位;HF 端点与凭据变量名做形状校验。
|
|
128
155
|
- **轮询加在途与卸载守卫**:慢响应不会覆写终态;remote 现取、挂载失败可重试;保存中禁用正文输入。
|
|
129
|
-
- **`external` 的 `react/` 前缀放行会把未登记的子路径静默内联**:宿主模块表里 react 家族只有四条,前缀放行意味着 `react-dom/server` 这类说明符会走 `return false` 被 rolldown 就地打进 `client.js`,产物里于是同时存在外部的 `react` 与内联的一份副本,hooks 静默失效。现在外置按精确集合查表,命中之外若是 react
|
|
156
|
+
- **`external` 的 `react/` 前缀放行会把未登记的子路径静默内联**:宿主模块表里 react 家族只有四条,前缀放行意味着 `react-dom/server` 这类说明符会走 `return false` 被 rolldown 就地打进 `client.js`,产物里于是同时存在外部的 `react` 与内联的一份副本,hooks 静默失效。现在外置按精确集合查表,命中之外若是 react 家族的说明符则构建期报错,要求显式登记。
|
|
130
157
|
- **同源守卫判据从「产物里出现包名」换成「产物里的 `BUNDLE_PKG` 声明值」**:包名在产物里不止一处,子串匹配只拦得住两个常量一起漂移的情形;只有 `BUNDLE_PKG` 漂移时断言照样通过,卡片静默不渲染。
|
|
131
158
|
- `writeArtifact` 的临时文件名只用 pid:同一进程内并行构建两次会撞名。改成带 `randomUUID()`;清理临时文件的 `rm` 失败也不再把原始错误盖掉。
|
|
132
159
|
- `invokedDirectly()` 改用异步 `realpath`:全仓唯一的同步 fs 调用,而共享 lint 基线的同步调用豁免表是手工清单,收录与否没有门保证。
|
|
133
|
-
- 构建脚本里 `package.json` 的 `name` 从「缺失时退化成字符串 `unknown`」改成 fail loud:`client.js` 的 id
|
|
160
|
+
- 构建脚本里 `package.json` 的 `name` 从「缺失时退化成字符串 `unknown`」改成 fail loud:`client.js` 的 id 就是宿主模块表的键,退化后备会让构建与新鲜度门禁一起绿、缺陷直达运行时。
|
|
134
161
|
|
|
135
162
|
### Changed
|
|
136
163
|
|
|
@@ -156,21 +183,21 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
156
183
|
### Changed
|
|
157
184
|
|
|
158
185
|
- **CI 两格分工**:ubuntu 格跑 `pnpm run check`(全部门禁,含四项 100% 覆盖率);其余平台跑新增的 `pnpm run check:platform`——同一套 typecheck / lint / 两个 bundle / 全量用例 / `oxfmt`,只是不判覆盖率。理由写在 `ci.yml` 的注释里:需要盘上真根的用例在 win32 整块跳过之后,`host.ts` 的覆盖率本就到不了 100%,把阈值调低等于把 ubuntu 格的真约束改成装饰。
|
|
159
|
-
- **`test/host.test.ts` 按平台跳过 24 个 suite**(谓词收成一处 `realRootUnavailable = process.platform === "win32"`,各 suite 写 `describe.skipIf(realRootUnavailable)(…)`)。写成字面上的 `describe.skipIf` 而不是包一层别名:oxlint 的 vitest 规则按 `describe` 识别 suite,别名会让整文件被当成一个作用域,实测冒出 221 条 `consistent-test-it` 噪声。**没有**跳过在 win32 上原样通过的那 6 个 suite
|
|
186
|
+
- **`test/host.test.ts` 按平台跳过 24 个 suite**(谓词收成一处 `realRootUnavailable = process.platform === "win32"`,各 suite 写 `describe.skipIf(realRootUnavailable)(…)`)。写成字面上的 `describe.skipIf` 而不是包一层别名:oxlint 的 vitest 规则按 `describe` 识别 suite,别名会让整文件被当成一个作用域,实测冒出 221 条 `consistent-test-it` 噪声。**没有**跳过在 win32 上原样通过的那 6 个 suite(信任检查、白名单有效期、hitSummary、探测缓存、render 全性、隐式注册验收)——跳掉一条本来会绿的用例就是抹掉真实信号。
|
|
160
187
|
- 两份 README 新增「支持面 / Support surface」一节:本包是 POSIX-only,Windows 宿主下三个 zg 工具在 `rootOf` 当场拒并说明原因(fail-fast,不会拿错位路径去拼命令、也不会把错路结果当正常检索交回模型);真要支持 Windows 得动 root 归一、第二套命令形态(pwsh/cmd 的引号与 `bash -c` 不同义)、门禁的 `/` 切词与 `manifest.json` 的 `rootPaths` 比对,属设计变更。
|
|
161
188
|
|
|
162
189
|
### Fixed
|
|
163
190
|
|
|
164
|
-
- 新增 `test:platform` / `check:platform` 两个脚本,让「不判覆盖率的那套门禁」在 package.json
|
|
191
|
+
- 新增 `test:platform` / `check:platform` 两个脚本,让「不判覆盖率的那套门禁」在 package.json 里唯一来源,CI 只挑命令——避免 workflow 里内联一串命令、日后与本地脚本各走各的。
|
|
165
192
|
|
|
166
193
|
## 0.1.4
|
|
167
194
|
|
|
168
|
-
把 **zg 守护进程(server 模式)这一档能力差从「使用限制」变成显式判据**:`--mode auto` 在 daemon 缺席时由上游静默落回 direct(模型逐次冷加载、增量刷新与 `refresh=background` 都不存在),而本包过去既没有一处说明,也没有拦住那个不可能兑现的参数。顺带修掉两处评审确认的缺陷:`requireApprovalForExplicitRoot` 会为**注定被拒**的 root 弹一次换不来放行的确认;两份 README 与 `host.ts`
|
|
195
|
+
把 **zg 守护进程(server 模式)这一档能力差从「使用限制」变成显式判据**:`--mode auto` 在 daemon 缺席时由上游静默落回 direct(模型逐次冷加载、增量刷新与 `refresh=background` 都不存在),而本包过去既没有一处说明,也没有拦住那个不可能兑现的参数。顺带修掉两处评审确认的缺陷:`requireApprovalForExplicitRoot` 会为**注定被拒**的 root 弹一次换不来放行的确认;两份 README 与 `host.ts` 头注释的配置项数字早已和 schema 脱节(14 vs 16、四个 vs 十枚)。
|
|
169
196
|
|
|
170
197
|
### Added
|
|
171
198
|
|
|
172
199
|
- **守护进程就绪门槛(`createZgServerGate`)**:按 TTL(60 秒)缓存 `zg server status --check-ready` 的**退出码**(上游契约:就绪 0、未就绪以「zvec-grep server is not ready」非零退出;读 stdout 那份状态表不行,它给人看、不在本包的依赖契约里)。探测失败一律折成「未就绪」,**绝不外抛**基础设施故障,也绝不影响 `wait` / `off` / 穷举检索这些照常能用的通道。本包**不代为 `zg server on`**:那会在用户机器上落下 detached 长驻进程与 token 文件,属该由用户点头的动作。
|
|
173
|
-
- **`refresh=background`
|
|
200
|
+
- **`refresh=background` 归一(`BackgroundSupport` 三档)**:不可用时在**命令构造期**就拒,并区分两种成因各给一句诚实文案——守护进程缺席(出路是 `zg server on`)与部署把 `clientMode` 钉死 `direct`(此时叫用户起 daemon 是指错方向,出路是回行 config 改模式)。旧行为是让命令照发、由 zg 把刷新整个关掉、只留一行 stderr warning:退出码照旧 0、命中照旧出,唯独「后台在刷新」这件事是假的。判据只有 `backgroundSupportFor` 一处,模式与探测两步都由宿主算(纯构造器只按它折成拒绝);没人要这一档时不起探测,穷举通道也不起(它本就不接受 `refresh`)。
|
|
174
201
|
- **就绪态回显两处**:`zg_status` 的输出尾部各说一句(就绪讲能拿到什么,未就绪讲后果与出路),设置卡新增一行;重建期那条「合成投影」不补——它的契约本就是不启任何子进程。引导端点 `rebuild-roots` 的应答新增 `serverReady`,卡片判据收在可单测的 `daemonNoteKey`:应答里**没有这一位**(旧版 host)时不渲染,而不是把「不知道」显示成「未就绪」。
|
|
175
202
|
- **无 `Code:` 行的失败补一句 `--debug` 指引**:上游不带 `--debug` 时会把 `MODEL2VEC_DOWNLOAD_FAILED` 与 `INDEXING.FILES_FAILED` 塌成一句无码文案(首次下载 embedding 权重正落在这一档),而本包所有按码归因都读那一行 `Code:`。现在只有「非零退出、有输出、却没有 `Code:` 行」那一支补指引;空输出不补(谈不上「塌成一句」),带码的不补(归因本就够)。本包**不默认带** `--debug`:它明显拉长输出,而这三个工具的回显预算是给模型读的。
|
|
176
203
|
- **文档数字的门禁**:`test/readme-parity.test.ts` 新增一条,把中英两份声明的「字段总数 / 卡上 volatile 数 / 非 volatile 部署值数」与导出 `Config` 的实际形状逐一对齐(第三枚是可推导的:总数 - volatile)。原有的结构对等门只能抓到「一侧多了一节」,抓不到两侧一起写错——这次正是两侧一起错。
|
|
@@ -178,15 +205,15 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
178
205
|
### Fixed
|
|
179
206
|
|
|
180
207
|
- **`requireApprovalForExplicitRoot` 不再为注定被拒的调用发问**。旧判据是「显式 root 既不是会话工作区、也不在 ledger」,于是对 `/etc`、相对路径、盘上不存在、没有会话工作区可作参照这些 `rootOf` **一律拒**的调用也弹一次确认;用户点「允许一次」之后照样被拒(那道闸刻意只加不减),确认成了让人为一个无法兑现的承诺点按钮。现在发问判据与 `rootOf` **同源**:两者共用同一个 `judgeRoot`,只有「靠与会话工作区互为祖先/后代这一条才放行」的调用才发问。同时删掉 `sameAsSessionRoot` 那第二条判据(它比 `judgeRoot` 宽,正是漏问/误问两侧漂移的来源)。
|
|
181
|
-
- **search-first
|
|
208
|
+
- **search-first 检查不再误拦「管道下游、只过滤上游输出」的 grep**。`isGrepRgCommand` 原先把命令位上的 grep/rg 一律判成检索,于是 `ps aux | grep node`、`env | grep KEY`、`dscacheutil -q host | grep ip_address`(实测被拦)这类**根本不读文件系统**的调用也被要求「先 zg_search」——检查要建立的「已用语义检索定向」那条证据链对它无从谈起。现在 token 多带一档「是否由 `|` 喂入」(只有管道算,`;` 与 `&&` 之后的命令不算),管道下游那一支还要**后随实参里出现路径形状的操作数**(`/x`、`a/b`、`.`、`..`;旗标不算)才判为检索,带路径的管道调用照旧算。副作用方向是漏拦:`cat a.txt | grep foo` 因上游确实读了工作区文件而被放行,与 `hasExternalTarget` 的既有取舍同侧,代价由 systemPrompt 路由文本兜底。
|
|
182
209
|
- **`startBackgroundIndex` 不再构造哑值依赖**。它不是 HTTP 请求,过去要凑出 `RebuildRoutes` 就得给 `csrf` 塞空串、给 `servingNonLoopback` 塞 `false`——两个「没被用到」只靠下游恰好不读它们来保证的占位值。现在把起一条 `zg index` 写操作所需的依赖收窄成 `IndexWriteRoutes`(`RebuildRoutes extends` 它),哑值在类型上不再可能被构造出来。
|
|
183
210
|
- **删掉 `startBackgroundIndex` 那份重复的 JSDoc**:同一段 17 行文档在文件里出现两次,第二份悬在 `registerIndexTool` 头上,指向的却不是它下面那个函数。
|
|
184
211
|
|
|
185
212
|
### Changed
|
|
186
213
|
|
|
187
|
-
- 引导端点 `/_dsh/zvec-grep/rebuild-roots` 的 handler 转为 async
|
|
214
|
+
- 引导端点 `/_dsh/zvec-grep/rebuild-roots` 的 handler 转为 async(就绪态要在**信任检查与方法判定之后**才取,被拒的请求不起子进程)。官方 `WebRoute.handler` 本就允许 `void | Promise<void>`,另两条路由一直是 async 形态。
|
|
188
215
|
- `buildSearchCommand` 新增第五位 `backgroundSupport`(缺省 `daemon-down`:拿不到判据时保守拒绝,而不是把一句假话发给模型);`lib/cli.ts` 导出 `requestsBackgroundRefresh` 供宿主判「要不要探」。
|
|
189
|
-
- 两份 README:`--mode direct` 的过时说法改成按实现的 `auto`
|
|
216
|
+
- 两份 README:`--mode direct` 的过时说法改成按实现的 `auto` 规则并新增「守护进程(server 模式)」一节;配置项数字改成 16 / 6 / 10;`refresh` 与 `requireApprovalForExplicitRoot` 两节跟着上面的行为重写;`host.ts` 头注释同样对齐。
|
|
190
217
|
- 集成层新增一条按环境自适应的用例:`clientMode=auto` 时断言跟着**这台机器上守护进程的真实就绪态**给期望值(无条件式断言,不分支),另有一条钉死 `clientMode=direct` 时「命令根本没发出去」。
|
|
191
218
|
|
|
192
219
|
## 0.1.3
|
|
@@ -195,24 +222,24 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
195
222
|
|
|
196
223
|
### Fixed
|
|
197
224
|
|
|
198
|
-
- **作业身份改用投影值,不再比注册表实例引用**。旧 `sameJob` 的一半判据是 `state.owner === ctx.get("jobs")`,而真实 cordis 每读一次服务都新建一枚 traceable 代理 ⇒ 同一枚注册表的两次读也不 `===`,该判据在真实宿主上**恒为假**(mock
|
|
199
|
-
- **`ignoreFiles` 预检补上「可读性」这半段,并与「是否存在」合成一次判定**。原判据只查 `statSync().isFile()`,而它对 mode 000 / 他人属主的文件照样返回 `true`(stat 只要父目录可搜索、不要文件本身可读);真 zg 去 open 它会 `EACCES` ⇒ 整次索引失败并把这条坏路径**写进工作区索引状态**,此后这棵树上的 `zg index` / `zg status` 都报同一个错,`--reset-paths` 清不掉,只有 `zg_index drop` 能救——与「文件不存在」是同一种永久损坏,却漏过了预检。现以 `accessSync(R_OK)` 在前、`isFile()` 在后合成一次 try:`accessSync` 与 zg 的读权限同 uid 同源(root 下两者都放行、非 root 下两者都拒),只查权限位、不读内容,没有 `readFileSync` 那种把大文件整段读进内存的代价。**刻意不拆成「不存在」与「读不了」两条独立分支 / 两句文案**:可读性那一档在 windows(chmod 只翻只读位、属主仍读得了)与 root(绕过 DAC)下造不出文件来触发,拆成独立分支会让 CI 的 windows 那格在 100%
|
|
200
|
-
- **`drop`
|
|
225
|
+
- **作业身份改用投影值,不再比注册表实例引用**。旧 `sameJob` 的一半判据是 `state.owner === ctx.get("jobs")`,而真实 cordis 每读一次服务都新建一枚 traceable 代理 ⇒ 同一枚注册表的两次读也不 `===`,该判据在真实宿主上**恒为假**(mock 上下文里永远成立,故单测全绿、线上全崩)。后果有三:轮询端点对每条活着的重建恒回 404;卸载 / 超时臂只 `killProc` 而从不 `jobs.remove` ⇒ 官方环缓冲留在宿主内存里(内存泄露);「同根第二条启动复用在跑那条」的 follow 恒不生效。现改用官方 `JobView` 上三段**值稳定**的投影(`kind` / `label` / `startedAt`)做身份——`JobView` 虽每次新建对象,这三个原始值却跨读恒定。`startedAt` 未盖章时用占位 `0`(官方签的是 `Date.now()`,永不为 0),保证 `start` 同步跑第一拍时不会把同 id 的另一条作业误认成自己的。
|
|
226
|
+
- **`ignoreFiles` 预检补上「可读性」这半段,并与「是否存在」合成一次判定**。原判据只查 `statSync().isFile()`,而它对 mode 000 / 他人属主的文件照样返回 `true`(stat 只要父目录可搜索、不要文件本身可读);真 zg 去 open 它会 `EACCES` ⇒ 整次索引失败并把这条坏路径**写进工作区索引状态**,此后这棵树上的 `zg index` / `zg status` 都报同一个错,`--reset-paths` 清不掉,只有 `zg_index drop` 能救——与「文件不存在」是同一种永久损坏,却漏过了预检。现以 `accessSync(R_OK)` 在前、`isFile()` 在后合成一次 try:`accessSync` 与 zg 的读权限同 uid 同源(root 下两者都放行、非 root 下两者都拒),只查权限位、不读内容,没有 `readFileSync` 那种把大文件整段读进内存的代价。**刻意不拆成「不存在」与「读不了」两条独立分支 / 两句文案**:可读性那一档在 windows(chmod 只翻只读位、属主仍读得了)与 root(绕过 DAC)下造不出文件来触发,拆成独立分支会让 CI 的 windows 那格在 100% 覆盖率检查下无从而钉(本仓不用 coverage-ignore 逃生口);合成一条 catch 后由跨平台的「不存在」这一档钉住,三种成因(ENOENT / EISDIR / EACCES)共用一句「不是一份存在且当前进程可读的文件」文案。
|
|
227
|
+
- **`drop` 那一条分支不再被 `ignoreFiles` 预检误拒**。`--drop` 的命令只有 `zg index <root> --drop --yes`,`ignoreFiles` 被 `buildIndexCommand` 静默丢掉、根本不进 zg(也就无从损坏索引);而预检原先无条件先跑,于是 `drop:true` + 一条坏 `ignoreFiles` 会被「请给一个真实存在的忽略文件」这句误导文案拦下一次合法的删索引。现 `drop` 为真时整段跳过预检,判 `drop` 用与构造器**同一个** `boolOf`,两处规则不漂。
|
|
201
228
|
|
|
202
229
|
### Added
|
|
203
230
|
|
|
204
|
-
- **`ignoreFiles` 可用性预检(`assertIgnoreFilesExist`)**:模型够得着 `ignoreFiles` 这个参数,而一条读不成的忽略文件会永久弄坏工作区索引,属于必须在起进程之前拦下的那一类。前台索引、模型侧后台索引、设置卡重建这三条起 `zg index` 的路径共用同一道预检(卡片那条不带 `ignoreFiles
|
|
231
|
+
- **`ignoreFiles` 可用性预检(`assertIgnoreFilesExist`)**:模型够得着 `ignoreFiles` 这个参数,而一条读不成的忽略文件会永久弄坏工作区索引,属于必须在起进程之前拦下的那一类。前台索引、模型侧后台索引、设置卡重建这三条起 `zg index` 的路径共用同一道预检(卡片那条不带 `ignoreFiles`,天然没有校验作用);`drop` 为真时整段跳过(见上)。三种不可用成因合成一句「不是存在且可读的文件」文案,双语,并写明代价与出路。
|
|
205
232
|
- **测试分三层**。原来只有 `test/*.test.ts`(单测 + 一枚 mock 宿主上下文)。新增:
|
|
206
|
-
- `test/integration/*`:真宿主半栈——官方 cordis `Context` + `dsh-tools` 的 `ToolRuntime`(含 pre-execute 瀑布与官方 JSON Schema 子集校验)+ `dsh-subprocess-local` / `dsh-bash-local` 的本地 bash 执行器(真 spawn / 真 deadline / 真 stdout 上限与 spill / 真凭据擦除)+ `dsh-jobs-local` 的 `LocalJobRegistry`(真环 / 真泵 / 真容量)+ 真 `node:http` 监听的 `dsh-host-webserver` + timer + approval
|
|
207
|
-
- `test/e2e/zg-cli.test.ts`:既无插件也无替身,只把 `lib/cli.ts` 造出的命令行喂给**真 zg CLI
|
|
208
|
-
- **两层按环境 gate,而非无条件跑**:真-zg 的 integration + e2e 整体 `describe.skipIf(!zgAvailable())`——CI 的干净 runner 没装真 zg,硬跑会以「command not found」变红而不是跳过;本机装了 zg 才跑。本包自己的判据另由 `test/host.test.ts` 的 mock
|
|
233
|
+
- `test/integration/*`:真宿主半栈——官方 cordis `Context` + `dsh-tools` 的 `ToolRuntime`(含 pre-execute 瀑布与官方 JSON Schema 子集校验)+ `dsh-subprocess-local` / `dsh-bash-local` 的本地 bash 执行器(真 spawn / 真 deadline / 真 stdout 上限与 spill / 真凭据擦除)+ `dsh-jobs-local` 的 `LocalJobRegistry`(真环 / 真泵 / 真容量)+ 真 `node:http` 监听的 `dsh-host-webserver` + timer + approval,把插件挂进官方调用流水线(`ctx.tools.execute()` / 真 `fetch`)驱动。宿主约定的缺陷都出在这一层:mock 上下文只会同意本包已经相信的事(`ctx.get("jobs") === ctx.get("jobs")` 在替身里永远成立、真实 cordis 永远不成立,正是上面那条 Fixed 的成因)。
|
|
234
|
+
- `test/e2e/zg-cli.test.ts`:既无插件也无替身,只把 `lib/cli.ts` 造出的命令行喂给**真 zg CLI**,钉它的命令行旗标、输出形状、错误码,以及「坏 `ignoreFiles` 会弄坏整棵树」这类上游事实(含 ENOENT 与 EACCES 两档)。
|
|
235
|
+
- **两层按环境 gate,而非无条件跑**:真-zg 的 integration + e2e 整体 `describe.skipIf(!zgAvailable())`——CI 的干净 runner 没装真 zg,硬跑会以「command not found」变红而不是跳过;本机装了 zg 才跑。本包自己的判据另由 `test/host.test.ts` 的 mock 宿主独立对齐到 100%(`assertIgnoreFilesExist`:drop 跳过 / 不存在 / 读不了 / 放行,绝对与相对两种写法都覆盖),所以这两层在 CI 跳过后覆盖率不塌;「读不了」那档再按 `canMakeUnreadableFile()`(root 或 windows 造不出属主读不了的文件)单独跳过,也不依赖它保覆盖率。
|
|
209
236
|
- 两份 README 各补一段「测试分三层」的说明。
|
|
210
237
|
|
|
211
238
|
### Changed
|
|
212
239
|
|
|
213
240
|
- `devDependencies` 补 `@deepseek-ai/dsh-bash-local` / `dsh-http-proxy` / `dsh-subprocess-local` / `dsh-timeout`(真宿主台架的传递依赖,均**不进** `dependencies`)。
|
|
214
241
|
- `pnpm-workspace.yaml` 的 `allowBuilds` 把 `@deepseek-ai/dsh-subprocess-local` / `koffi` / `node-pty` 显式记为 `false`。这三枚是集测台架经 `dsh-subprocess-local` 传递引入的原生模块(各带安装脚本),而 pnpm 12 默认拦截未声明的构建脚本 ⇒ CI 那步 `pnpm install --frozen-lockfile` 以 `ERR_PNPM_IGNORED_BUILDS` 退出 1(本机因 `.modules.yaml` 早记下 ignoredBuilds 决定反而不报)。但本包根本用不到它们的构建产物:`dsh-subprocess-local` 经 `dsh-lazy-require` 惰性加载 `node-pty` / `koffi`,集成用例走的是 bash 执行路径、从不 require(本机 `.modules.yaml` 记的正是 ignoredBuilds,600 用例照绿)。显式 `false` 让 pnpm 跳过构建且不计入 ignoredBuilds(源码实测:唯有 `allowBuild()` 返回 `undefined` 的未声明档才报错),CI 也因此不必为用不到的原生模块在 windows 那一格背上 node-gyp 编译。`esbuild: true` 那条不动(vite 传递引入,确实要它落平台二进制)。
|
|
215
|
-
- `oxlint.config.ts` 的 `syncWrites` 声明 `chmodSync`(用例造 mode 000 的不可读忽略文件)与 `accessSync
|
|
242
|
+
- `oxlint.config.ts` 的 `syncWrites` 声明 `chmodSync`(用例造 mode 000 的不可读忽略文件)与 `accessSync`(只读权限探测;共享基线的只读豁免表恰好没收录它,故经本包这唯一的 sync 例外口子声明)。
|
|
216
243
|
|
|
217
244
|
## 0.1.2
|
|
218
245
|
|
|
@@ -220,17 +247,17 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
220
247
|
|
|
221
248
|
### Fixed
|
|
222
249
|
|
|
223
|
-
- **`servingNonLoopback` 不再比字面量**。`@deepseek-ai/dsh-host-webserver` 的 `Config.host` 从两值联合(`'127.0.0.1' | '0.0.0.0'`)变成「本机任一网卡的具体地址」,而通配绑定(`0.0.0.0`、`::`
|
|
224
|
-
- **装载期缺包**。`@jayyuen66/dsh-plugin-shared@0.1.4` 的 `dist/text.js` 值导入 `@deepseek-ai/dsh-output-retention`,而本包只用它的 `truncateEnd` / `truncateStart`,从不直接引那枚宿主包——升级后 `test/host.test.ts` 立刻以 `Cannot find package` 倒下,而类型检查、构建与其余 282
|
|
250
|
+
- **`servingNonLoopback` 不再比字面量**。`@deepseek-ai/dsh-host-webserver` 的 `Config.host` 从两值联合(`'127.0.0.1' | '0.0.0.0'`)变成「本机任一网卡的具体地址」,而通配绑定(`0.0.0.0`、`::` 及其映射形)现在**在加载期就被拒**。于是每条路由的第一道信任检查里那句 `webServer.host === "0.0.0.0"` 恒为 `false`:非回环宿主服务换了形态,判据还在找那枚绑不上的字面量,结果把服务绑在真实网卡地址上的情形当成回环服务——同一网段一方拿着网卡权威,`Host` 那条腿就不再收紧。现在改取 shared 导出的 `isNonLoopbackBindHost(webServer.host)`(它是 0.1.4 为这件事专门加的出口,JSDoc 明写「不要再自己比字面量」),判据同时覆盖 IPv6 回环的多种拼法。用例按四档钉:未声明绑定、`127.0.0.1`、`0.0.0.0`、本机网卡具体 IPv4。
|
|
251
|
+
- **装载期缺包**。`@jayyuen66/dsh-plugin-shared@0.1.4` 的 `dist/text.js` 值导入 `@deepseek-ai/dsh-output-retention`,而本包只用它的 `truncateEnd` / `truncateStart`,从不直接引那枚宿主包——升级后 `test/host.test.ts` 立刻以 `Cannot find package` 倒下,而类型检查、构建与其余 282 条用例全部照绿。按本包对宿主包的一贯规则补上:非 optional `peerDependencies` + `devDependencies` 同枚精确版本,**不进 `dependencies`**。
|
|
225
252
|
|
|
226
253
|
### Changed
|
|
227
254
|
|
|
228
255
|
- `@deepseek-ai/dsh-*` 家族与 peer 的 `@deepseek-ai/dsh` 从 `0.2.1-alpha.1` 升到 `0.2.1-alpha.2`;`@deepseek-ai/cordis` `4.0.5-alpha.1`、`@deepseek-ai/schemastery` `3.18.5-alpha.1`、`@deepseek-ai/cordis-plugin-timer` `1.1.7-alpha.1` **不动**——那是 alpha.2 自己钉的那几枚,registry 上没有更新的 alpha。
|
|
229
256
|
- `pnpm-workspace.yaml` 整体换成与 `dsh-danger-guard` / `dsh-plugin-shared` 逐字节相同的那一份:`dsh-*` 86 枚 override 跟到 alpha.2,工具链跟到 registry 现行头(`@types/node` 26.6.3→26.6.5、`vitest` 与 `@vitest/coverage-v8` 5.0.2→5.0.3、`vite` 8.3.1→8.3.4、`rolldown` 1.2.11→1.2.13、`oxlint` 1.86.0→1.87.0、`oxfmt` 0.71.0→0.72.0、`oxlint-tsgolint` 7.0.2003→7.0.2004、`happy-dom` 20.14.5→20.14.6、`jsdom` 30.1.1→30.1.2)。`@jayyuen66/dsh-plugin-shared` `^0.1.3`→`^0.1.4`(实装的 0.1.2 比声明还旧,锁文件已过期)。
|
|
230
|
-
- `engines`
|
|
231
|
-
(更正:宿主判据与上面这句相反——`engine.dsh` 在场时它**先判这一条且单独决定**,`peerDependencies` 根本不参与比较,比较时还带 `includePrerelease`(见 deepseek-harness `packages/boot/app-boot/src/plugin-compatibility.ts` 的 `satisfies` 与 `unmetRequirements`)。本包现行的 `engines.dsh` 是 `^0.2.1-rc.3`、`node` 是 `>=22.12.0`,两份 README
|
|
257
|
+
- `engines` 取严格规则:`dsh: >=0.2.1-alpha.2`(shared 0.1.4 自己的 `engines.dsh` 就是这个下限,声明得更宽等于撒谎)、`node: ^22.19.0 || >=24.0.0`(同取自 shared)。宿主按 **peer 声明**判兼容、不读 `engines.dsh`,且逐条比对每一枚 `@deepseek-ai/dsh*`——本包的精确钉因此意味着**高于 0.2.1-alpha.2 的宿主也需要 `dsh plugin allow-version … --accept-risk`**,两份 README 已按实测写明。
|
|
258
|
+
(更正:宿主判据与上面这句相反——`engine.dsh` 在场时它**先判这一条且单独决定**,`peerDependencies` 根本不参与比较,比较时还带 `includePrerelease`(见 deepseek-harness `packages/boot/app-boot/src/plugin-compatibility.ts` 的 `satisfies` 与 `unmetRequirements`)。本包现行的 `engines.dsh` 是 `^0.2.1-rc.3`、`node` 是 `>=22.12.0`,两份 README 已按现行规则写。)
|
|
232
259
|
- README 拆成中英两份:`README.md` 为英文、`README.zh-CN.md` 为中文,两份顶部互链。原来是一份文件里的 `## 中文` / `## English` 两段,正文一字未改地按语言切开。
|
|
233
|
-
- 注释里「钉进依赖 `.d.ts` 的行号」全量换成文件 + 符号/原文锚点。抽查即见腐坏:`dsh-tools` 那组(`ToolDefinition` / `ToolGuard` / `ToolRuntime`)随 alpha.2 整体漂了 7–17 行,`tool.execute`
|
|
260
|
+
- 注释里「钉进依赖 `.d.ts` 的行号」全量换成文件 + 符号/原文锚点。抽查即见腐坏:`dsh-tools` 那组(`ToolDefinition` / `ToolGuard` / `ToolRuntime`)随 alpha.2 整体漂了 7–17 行,`tool.execute` 的调用点也是。夹具里的 `src/beta.ts:1-3` 那类是 **数据**(zg 的输出形态),不在射程内。
|
|
234
261
|
- `.github/workflows/publish.yml` 跟 `dsh-danger-guard` 同款加固:`concurrency` 防两次 dispatch 并行、action 钉 commit SHA、预检加「读本包」这一档(只查依赖就发现不了「版本号没进 main 就触发」)、发布用的 `NODE_AUTH_TOKEN` 走与预检同款清洗、加 `--provenance` 与 `--publish-wait-timeout 600000`,并且不再把凭据长度打进日志。
|
|
235
262
|
|
|
236
263
|
### Added
|
|
@@ -238,22 +265,22 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
238
265
|
- 新增 `.github/workflows/ci.yml`:`push` / `pull_request` 门禁跑 ubuntu×windows × node 22/24 的 `pnpm run check` 四格;另有一道**装载探针**——两个发布器各打一次包,进干净目录用 `npm install`(不带任何 flag)与 `npm pack` 的产物、`pnpm add` 与 `pnpm pack` 的产物各装一次,然后真 `import` 入口并断言它交出 cordis 插件形状(`apply` / `Config` / `inject`)、`cordis.patch.yml` 随包且在。上一轮那两起「全绿但装出去炸」的故障,判据只能落在这里。
|
|
239
266
|
- `test/publish-manifest.test.ts` 的门禁集合补齐:
|
|
240
267
|
- `ALWAYS_SHIPPED` 改成实测清单。旧集合把 `CHANGELOG.md` 也算成「npm 无条件附带」,于是门禁比 npm 的真实语义更宽松、自己先失效。实测办法:包根临时放一份 `CHANGELOG.md` 与一份 `THIRD_PARTY_NOTICES.md` 且不写进 `files`,`npm pack --dry-run` 只回 `package.json`、`README*`、`LICENSE`。
|
|
241
|
-
-
|
|
242
|
-
- 「包根的每一份 `.md`
|
|
243
|
-
-
|
|
268
|
+
- 注释禁止名单加**本机绝对路径**(`/Users/…`、`/home/…`):注释里的举例路径会被打包器原样搬进随包发布的产物,那是把本机用户名发到公共 tarball 的路。
|
|
269
|
+
- 「包根的每一份 `.md` 都必须在发布名单里」——一次性封住「新增文档忘了写进 `files` ⇒ 静默不随包分发」这一类,而不是每加一份补一条断言。
|
|
270
|
+
- 产物内部指涉扫描(本机绝对路径、`node_modules/.pnpm/` 内容寻址布局)。注释门读不到产物,因为 rolldown 剥注释;而 `//#region` 标记里的路径恰恰会进产物。
|
|
244
271
|
- `shapeOf` 精确文件名条目的回归防线:把 `host.js` 误读成「收所有 `.js`」会让 `files` 覆盖那道断言的集合虚高,而它对失效毫无反应。
|
|
245
|
-
- 「shared 出货产物值导入的宿主包,本包一律在 peer ∪ dev
|
|
246
|
-
- `test/dist-size.test.ts`:产物体积预算闸(host 半 240,000 B、client 半 54,000 B
|
|
272
|
+
- 「shared 出货产物值导入的宿主包,本包一律在 peer ∪ dev 里提供」——判断时取**产物**而非 shared 声明的 peer 全集(纯类型上的成员本包不引就不该钉)。
|
|
273
|
+
- `test/dist-size.test.ts`:产物体积预算闸(host 半 240,000 B、client 半 54,000 B,取实测值上加约 25%)。体积不是行为,不会让任何现有用例变红,所以得单独有把尺子。刻意不开 minify:压缩后产物里的跨包说明符字符串会消失,而「依赖必须外部化」那几条断言正是靠检索这些字符串来判的。
|
|
247
274
|
- `test/readme-parity.test.ts`:中英两份 README 的骨架对等门(标题层级序列、首行包名、顶部互链三处)。一侧加了节而另一侧没跟,不会有任何用例变红。
|
|
248
275
|
- `build-client.mjs` 产出前把 `//#region` 标记里的 pnpm 内容寻址段折成普通的 `node_modules/` 一层。client 半必须把 shared 的 `record.js` / `errors.js` **内联**(浏览器解析不了裸说明符),于是标记里烙着依赖版本与本机 store 哈希:既外泄安装布局,又让同一份源码在不同机器上产出不同字节。
|
|
249
276
|
- `.gitattributes`(`* text=auto eol=lf`):Windows runner 上 Git for Windows 的机器级 `core.autocrlf=true` 会把工作树换成 CRLF,而 oxfmt 的 `endOfLine` 默认 lf —— 没有这份文件,新加的 windows 那一格会把每个文件都判成未格式化。
|
|
250
277
|
- `scripts.fmt`(`oxfmt .`),与既有的 `fmt:check` 配对。
|
|
251
|
-
- npm 发布元数据补齐 `keywords` / `bugs` / `homepage`(对照 plugin-shared 实测缺这三项)。`sideEffects: false` **不**照抄:client.js 是往 `window.__ModuleLoader__` 注册,属于真实副作用,标 false
|
|
278
|
+
- npm 发布元数据补齐 `keywords` / `bugs` / `homepage`(对照 plugin-shared 实测缺这三项)。`sideEffects: false` **不**照抄:client.js 是往 `window.__ModuleLoader__` 注册,属于真实副作用,标 false 等于授权打包器把它摇掉。新增两道发布元数据检查:description/keywords/license/author 齐备,以及 repository / bugs / homepage 三处按 `<账号>/<仓库>` 归一后必须同源——抄兄弟包的这一段再只改一处是必然会犯的错,那样 npm 页面上的「报告问题」会跳到别人的仓库。
|
|
252
279
|
- 上游归属信息(本包是在第三方 `@zvec/zvec-grep` 之上做二次开发):两份 README 的「外部依赖」一节写清上游包名、仓库、**Apache-2.0** 许可、`0.2.2` 版本契约,以及「本包不含上游代码、不替上游分发」这条边界;新增 `THIRD_PARTY_NOTICES.md` 并写进 `files`(实测 npm 不自动附带 NOTICE 类文件,漏写等于没随包分发);新增「开发」与「许可」两节,与 dsh-ocr-review 的双语 README 骨架对齐。
|
|
253
280
|
|
|
254
281
|
## 0.1.1
|
|
255
282
|
|
|
256
|
-
|
|
283
|
+
评审统一处理:索引重建、宿主版本门与远程 embedding 的边界。
|
|
257
284
|
|
|
258
285
|
### Added
|
|
259
286
|
|
package/README.md
CHANGED
|
@@ -91,16 +91,16 @@ If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entr
|
|
|
91
91
|
1. **The layer is mounted.** `dsh --profile web --dump-config` ends with `# == @jayyuen66/dsh-zvec-grep` plus `- id: zvec-grep`. That command is the only accepted signal and is **not read-only** - read layer lines from stdout **and** check stderr separately; accept both `# == <layer>` and `# == <layer>, patched by <path>`.
|
|
92
92
|
2. **The tools answer.** Ask the model to run `zg_status` on the current workspace: it executes and passes zg's own output through. "Unknown tool" means the bundle layer is not mounted.
|
|
93
93
|
3. **The gate refuses - in an indexed workspace.** With `enforceSearchFirst` on and a manifest under `<root>/.zvec-grep/`, grep/rg is refused with the "no zg_search has run yet" message until one successful search. Without an index there is nothing to gate.
|
|
94
|
-
4. **The card renders.** The settings page lists "zvec-grep (zg)" with the
|
|
94
|
+
4. **The card renders.** The settings page lists "zvec-grep (zg)" with the seven editable values (including the search transport), the readiness line (empty when the probe cannot answer) and the rebuild button; a toggle plus **Save** round-trips with a 200.
|
|
95
95
|
5. **No host copy in the profile.** A scratch profile's `node_modules/` holds `@jayyuen66/` and no `@deepseek-ai/` directory.
|
|
96
96
|
|
|
97
97
|
## <img src="https://api.iconify.design/lucide/circle-slash.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> What it does not provide
|
|
98
98
|
|
|
99
99
|
- **No HTTP route of its own.** The card's data plane is the official Typert Remote namespace `zvecGrepRebuild` through the host `/api` gateway; auth, Host/DNS-rebinding/Origin checks and body limits are all the gateway's.
|
|
100
100
|
- **No CLI subcommand.** `dsh zvec-grep …` does not exist.
|
|
101
|
-
- **
|
|
101
|
+
- **The daemon lifecycle depends on the transport.** `transport=auto` / `cli` never start a daemon (`auto` only uses MCP when a readiness probe says one is up); `transport=mcp` starts one with a random token (`zg --server on`, loopback 7999) and feeds that same token to every CLI child via env and to MCP calls as the Bearer. On unload the plugin stops the daemon it started with that token. A user-started daemon (no token by default) is only probed for readiness, never stopped.
|
|
102
102
|
- **No ripgrep dependency.** rg appears only inside the gate predicate.
|
|
103
|
-
- **
|
|
103
|
+
- **One file written, only for the self-started daemon.** The token for `transport=mcp` is persisted at `<ZVEC_GREP_HOME or ~/.zvec-grep>/dsh-zvec-grep.token` with mode 0600 so a restart can re-authenticate; it is removed after a successful daemon stop. Everything else on disk is zg's business, not this package's: its index/manifest `.zvec-grep/` under the searched root, its global home `~/.zvec-grep` (config, locks, models), and embedding weights fetched per `hfEndpoint`.
|
|
104
104
|
- Required surfaces: `settings` / `shell` / `tools` / `systemPrompt` / `timer` (all in `inject`). The host `jobs` service is optional - without it the rebuild paths refuse and spawn nothing; the three tools keep working.
|
|
105
105
|
|
|
106
106
|
## <img src="https://api.iconify.design/lucide/plug.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Enabling it in dsh
|
|
@@ -119,9 +119,9 @@ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status);
|
|
|
119
119
|
### zg_search
|
|
120
120
|
|
|
121
121
|
- At least one of query / queries / fts / vector (32 routes max, 4000 chars each); the four filter fields (`globs` / `insensitiveGlobs` / `fileTypes` / `excludedFileTypes`) take a single string or an array (128 items, 1024 chars each).
|
|
122
|
-
- `symbolTypes` is zg's closed set, **lowercase only** (`
|
|
123
|
-
- `preview`: `none` / `short` (default) / `full
|
|
124
|
-
- A **hit summary** at the tail reports
|
|
122
|
+
- `symbolTypes` is zg's closed set, **lowercase only** (`alias` / `class` / `enum` / `function` / `interface` / `module` / `value`, at most 7 items); invalid values are refused before the command is built, without case folding.
|
|
123
|
+
- `preview`: `none` / `short` (default) / `full` / `detail` (new in 0.3.0: symbols, signatures and ranges, grouped by file). `refresh`: `wait` (default) / `off` / `background` - `background` needs a **ready daemon** and is refused before the command is built when there is none (the way out is `zg --server on`, or unpinning `clientMode` from `direct`).
|
|
124
|
+
- A **hit summary** at the tail reports distinct locations after dedup (the identity is the text after the `#N` header line, with the `score=` decoration stripped) - one location hit by several groups is counted once. A group at exactly `--limit` is an observation only; zg gives no truncation signal.
|
|
125
125
|
- `trace` passes through `--trace` (per-hit recall routes, ranks, scores); the dedup key strips the score, which differs per group.
|
|
126
126
|
|
|
127
127
|
### zg_index
|
|
@@ -161,7 +161,7 @@ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status);
|
|
|
161
161
|
|
|
162
162
|
## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Settings
|
|
163
163
|
|
|
164
|
-
Namespace `zvec-grep` equals the settings entry id; the schema has
|
|
164
|
+
Namespace `zvec-grep` equals the settings entry id; the schema has 18 fields with built-in defaults, 7 of them volatile and on the card.
|
|
165
165
|
|
|
166
166
|
| Field | Type | Default | Purpose |
|
|
167
167
|
| --- | --- | --- | --- |
|
|
@@ -172,7 +172,7 @@ Namespace `zvec-grep` equals the settings entry id; the schema has 16 fields wit
|
|
|
172
172
|
| `grepBudgetPerSearch` | natural, 1-20 | `3` | grep/rg calls each successful search re-arms |
|
|
173
173
|
| `unlockWindowMin` | natural, 1-240 | `10` | Minutes that quota stays valid |
|
|
174
174
|
|
|
175
|
-
There are also **non-volatile deployment values**,
|
|
175
|
+
There are also **non-volatile deployment values**, 11 of them off the card; the row `config:` in `cordis.yml` is the only way to change them: `searchTimeoutMs=300000`, `statusTimeoutMs=60000`, `indexTimeoutMs=600000` (also the rebuild kill timer), `stdoutMaxBytes=400000`, `clientMode=auto`, `daemonUrl=http://127.0.0.1:7999/mcp`, `rebuildWaitMs=120000`, the remote-embedding trio and `requireApprovalForExplicitRoot` (below). Precedence: card value > row config > `.default()`; an explicitly absent row field does not override.
|
|
176
176
|
|
|
177
177
|
### Remote embedding
|
|
178
178
|
|
|
@@ -188,22 +188,24 @@ Off by default: `allowRemoteEmbedding=false`, `remoteEmbeddingEndpoint=""`, `rem
|
|
|
188
188
|
|
|
189
189
|
## <img src="https://api.iconify.design/lucide/monitor.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Support surface
|
|
190
190
|
|
|
191
|
-
- **POSIX
|
|
192
|
-
- **Windows is
|
|
193
|
-
- **CI splits accordingly**: the ubuntu job is the full gate (including the four 100% coverage thresholds); other platforms run only the checks that need no on-disk workspace and do not judge coverage.
|
|
191
|
+
- **POSIX and Windows hosts.** The root predicate accepts `/…` on POSIX and drive-letter (`C:\…`, `C:/…`) or UNC (`\\server\share\…`) paths on Windows; command construction uses `bash` single-quote escaping on POSIX and `pwsh` escaping on Windows; the grep/rg gate tokenizer follows the same dialect (backslash escapes on POSIX, backtick escapes and `rg.exe`/`grep.exe` names on Windows).
|
|
192
|
+
- **Windows is covered by tests, not guessed.** Platform-injected win32 fixtures run on every host, and CI's `windows-latest` grid runs the real temp-workspace suites; the ubuntu job remains the only one that judges the 100% coverage thresholds (reasoning in `.github/workflows/ci.yml`).
|
|
193
|
+
- **CI splits accordingly**: the ubuntu job is the full gate (including the four 100% coverage thresholds); other platforms run only the checks that need no on-disk workspace and do not judge coverage.
|
|
194
194
|
|
|
195
195
|
## <img src="https://api.iconify.design/lucide/cpu.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> External dependency
|
|
196
196
|
|
|
197
197
|
- The binary dependency is **zg** (`npm install -g @zvec/zvec-grep`). Not on PATH → exit 127 → "zg is not installed or not on PATH", kept separate from "the sandbox runner never started".
|
|
198
198
|
- Upstream is `@zvec/zvec-grep` (provides the `zg` bin), repository https://github.com/zvec-ai/zvec-grep, **Apache-2.0**. This package shells out to the CLI; it contains and redistributes no upstream source.
|
|
199
|
-
- Version floor `0.
|
|
199
|
+
- Version floor `0.3.0` (`MINIMUM_ZG_VERSION` in `lib/zg-version.ts`): 0.3.0 is the first release of the Rust rewrite's breaking CLI shape (`--index` / `--status` / bare words / `--server`). Below it the plugin stops before dispatch and names the actual version - older releases parse the same argv as something else entirely.
|
|
200
200
|
- Local embeddings load through zg's backends (qwen3/embeddinggemma via llama-cpp, potion-* via model2vec, the rest via transformers-js); weights download with `HF_ENDPOINT` injected from `hfEndpoint`.
|
|
201
201
|
|
|
202
202
|
## <img src="https://api.iconify.design/lucide/server.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Daemon (server mode)
|
|
203
203
|
|
|
204
204
|
- Direct and server are **two capability surfaces**, not a speed knob: direct cold-loads the embedding model on every query; watcher-driven incremental refresh, `refresh=background` and a resident model pool exist only in server mode. Upstream probes readiness for `auto` but never starts a daemon.
|
|
205
|
-
-
|
|
206
|
-
-
|
|
205
|
+
- Whether this package starts one follows `transport`: `auto` / `cli` never do; `mcp` starts a daemon with a random token (`zg --server on`, on `daemonUrl`'s host:port; default loopback 7999) and feeds that same token to every CLI child via env and to MCP calls as the Bearer. On unload it stops the daemon **it started** with that token. A user-started daemon (no token by default) is only probed for readiness, never stopped. The token is persisted at `<ZVEC_GREP_HOME or ~/.zvec-grep>/dsh-zvec-grep.token` (0600): a crash/restart or another host reads it back, and concurrent cold starts converge on one token through an O_EXCL claim instead of overwriting each other.
|
|
206
|
+
- **Several agents can search at the same time.** A host coalesces its own cold start into one `zg --server on`; multiple hosts sharing `ZVEC_GREP_HOME` share the singleton daemon (upstream `instance.lock`; a duplicate start exits 0 with the same PID). Each concurrent tool call uses its own MCP session - one zg session handles one `tools/call` at a time - and idle sessions are reused, so agents do not queue behind each other. Only an index rebuild holds the workspace write lock; searches wait for it up to `rebuildWaitMs` (that is the one bounded wait, not startup). Different `ZVEC_GREP_HOME` values mean different daemons, so give each one its own `daemonUrl` port.
|
|
207
|
+
- Readiness is **explicit**: the exit code of `zg --server status --check-ready` is cached for 60 s (a failed probe counts as "not ready", never an infrastructure error), gates `refresh=background`, and is echoed once in `zg_status` output and once on the card. The probe is issued by the `roots()` read, `zg_status`, and `backgroundSupportFor`.
|
|
208
|
+
- The card's `serverReady` is `true` / `false` at the card layer — a failed or erroring probe counts as `false` ("probe failure means not ready"), so the readiness line always renders. `undefined` only survives inside the raw `roots()` payload of an older card snapshot; the live card folds it to `false`. To run a shared daemon manually, use `zg --server on` in a terminal.
|
|
207
209
|
|
|
208
210
|
## <img src="https://api.iconify.design/lucide/network.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Public interface
|
|
209
211
|
|
|
@@ -242,7 +244,7 @@ A "rebuild workspace" run is one **unowned** job in the host's `ctx.jobs` (`kind
|
|
|
242
244
|
|
|
243
245
|
## <img src="https://api.iconify.design/lucide/triangle-alert.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Known boundaries
|
|
244
246
|
|
|
245
|
-
- **Windows hosts are
|
|
247
|
+
- **Windows hosts are supported** with drive-letter/UNC roots and `pwsh` command quoting; see the Support surface section for the exact boundary.
|
|
246
248
|
- **Extensionless key files** are outside the secret-exclusion rules; `id_rsa*` / `id_ed25519*` cover only the OpenSSH default names.
|
|
247
249
|
- **An unowned rebuild job is visible to every session** - accepted exposure of the official job registry.
|
|
248
250
|
- **The CJK output window shrank about a third** with the official ring (UTF-8 bytes vs UTF-16 code units).
|
|
@@ -256,7 +258,7 @@ A "rebuild workspace" run is one **unowned** job in the host's `ctx.jobs` (`kind
|
|
|
256
258
|
| --- | --- |
|
|
257
259
|
| grep/rg refused with "no zg_search has run yet" | The search-first gate; run zg_search. Quota spent or expired - re-search with a sharper query to refresh it, no need to disable the plugin. |
|
|
258
260
|
| Search times out | Default `--refresh wait` refreshes synchronously; narrow with globs/fileTypes, lower the limit, or start the daemon - direct mode cold-loads the embedding model on every call, which is why that budget is 5 minutes. |
|
|
259
|
-
| "the zg index lock is held by another operation (
|
|
261
|
+
| "the zg index lock is held by another operation (operation=...)" | The lock holder is not a rebuild (an index refresh is the usual one), and this command does not wait for it - such an operation can run very long, and queueing behind it would be unbounded. Retry later, or query again once it settles; only a rebuild-owned lock waits and retries automatically. zg's original failure text is appended, so you can read which lock it was. |
|
|
260
262
|
| Rebuild refused with "not in the workspace whitelist" | That directory never had a session in this daemon; start one there first, or let the model call zg_index with confirm=true. |
|
|
261
263
|
| Card reports a failed rebuild although zg looks finished | Success is "completed with exit 0" - exit 127 (zg missing) also lands in completed; read the output tail. |
|
|
262
264
|
| A root that was never indexed | zg_search fails loudly; building happens only via zg_index on an explicit request. |
|