@jayyuen66/dsh-zvec-grep 0.1.7 → 0.1.9

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
@@ -2,6 +2,50 @@
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).
4
4
 
5
+ ## 0.1.9
6
+
7
+ 这一版让 search-first 门禁认识宿主的步骤准入,并把设置卡与读面校验统一到 shared 组件和 zod;
8
+ 宿主开发线抬到 0.2.2-alpha.2。
9
+
10
+ ### Changed
11
+
12
+ - **设置卡迁到 shared 组件与 zod**:字段版式、保存条与状态条改用 `@jayyuen66/dsh-plugin-shared/lib/card-ui`;
13
+ `defaultLimit` / `grepBudgetPerSearch` / `unlockWindowMin` 的输入与显示共用 zod 区间 schema,
14
+ `hfEndpoint` 只接受 http(s) URL。
15
+ - **重建轮询回执改按 schema 容错投影**:未知状态、非数字退出码、非字符串输出都折成缺位,坏类型不再带到
16
+ 渲染期;`src/rebuild-reader.ts` 的两个 strict codec 改由 zod 生成。
17
+ - **client 产物按宿主 `PLATFORM_MODULES` 外置 zod**;`zod` 进入 `dependencies`。
18
+ - **宿主开发线抬到 `0.2.2-alpha.2`**:devDependencies 与 catalog/overrides 同值;`@deepseek-ai/dsh*` 的 peer
19
+ 改为同一条支持窗口范围(`^0.2.1-rc.3`,schemastery 仍钉宿主自带版本),精确钉版只留在 devDependencies。
20
+ - **插件页展示面进包**:新增 `locale/en.json`、`locale/zh.json` 与 `docs/DETAIL.md`、`docs/DETAIL.zh.md`;
21
+ `exports` 增加 `./locale/*.json`,`files` 收进 locale 与 docs。
22
+ - **正则常量提取**:错误明细解析、命中计数行等内联正则改为命名常量,行为不变。
23
+
24
+ ### Fixed
25
+
26
+ - **单仓安装态下 lint 把 `ToolBatchInput["agent"]` 读成 error 类型**:`@deepseek-ai/dsh-agent`
27
+ 只是 `@deepseek-ai/dsh-tools` 的 peer,单仓安装不会自动装它;补进 `devDependencies` 后
28
+ `typescript(no-unsafe-assignment)` 与 `no-unnecessary-type-assertion` 两族告警消失。
29
+ - **受限子代理与条件工具步骤被 search-first 门禁拦死**:门禁原先只看 `zg_search` 在注册表里是否存在,
30
+ 不看本步骤的准入视图;模型因此被迫调用一个本步骤调不动的工具。现在执行体带 `toolSet` 时按
31
+ `view(scope)` 判,`zg_search` 不在视图里就让路;没有步骤准入的宿主沿用原判据。为此新增
32
+ `@deepseek-ai/dsh-scope` 值导入(`scopeOf`),并列入 peer 与 devDependencies。
33
+
34
+ ## 0.1.8
35
+
36
+ ### Changed
37
+
38
+ - **`limit` 越界改成点名拒绝,不再静默钳制**(`lib/cli.ts` 的 `clampLimit` 随之更名 `resolveLimit`):`0`、`51`、`999` 一律抛错并报出允许区间(新文案 `limitOutOfRange`,中英双语)。静默钳过的值交回的是一个模型读不出的失真——它请求 999 条、实际拿到 50 条,会把「只有 50 处」当成这次检索的事实;拒绝并点名区间,下一轮它自己把数改对。省略与 `null` 照旧回默认值(那是合法用法),非整数、负数、非数字仍按「必须是非负整数」抛。工具参数说明 `limitDescription`(双语)同步写明越出区间直接报错,模型在第一轮就看到拒绝语义、不必先撞一次错误。命中摘要的 `summaryLimit` 与命令构造引同一个函数,摘要口径仍与实际请求一致。
39
+ - **宿主 `configSchema` 的数值区间改引 `lib/limits.ts` 常量**:`defaultLimit` / `grepBudgetPerSearch` / `unlockWindowMin` 三条的 `.min()/.max()` 此前写的是字面量,本轮换成 `LIMIT_MIN` / `LIMIT_MAX` / `BUDGET_MAX` / `WINDOW_MAX`。取值一个都没动,两份 README 里的区间数字照旧。**顺带纠正 0.1.7 那条声明**——它写着「宿主 schema、命令钳制、卡片显示与输入提示引同一份常量」,实际只落到后三者,schema 侧那三份副本是本轮才收的;写超实现的这句没有门能拦,靠读代码发现。
40
+
41
+ ### Added
42
+
43
+ - **索引锁被非重建操作占用时点名占锁方**(新文案 `lockBusyOtherOperation`,中英双语):`ZVEC_GREP.ENGINE.LOCK.BUSY` 且 `ownerOperation` 不是 `index.rebuild` 时(增量刷新是常见的那一个),原先交回的只有 zg 的原始失败文本,读者分不清「本命令没等这类操作」和「等过之后仍然失败」。现在把点名占锁方、说明为何不排队(这类操作可能跑很久,排队等于无界挂起)那句话放在前面,zg 的原始失败原文随行——证据不吞。回执里缺 `ownerOperation` 时按 `unknown` 点名,不退成一条裸失败。重建占锁照旧走等待重试,两类占锁方不再共用同一条出口。
44
+
45
+ ### Not changed, deliberately
46
+
47
+ - **设置卡的数值框仍然钳到边界并在保存条上提示**(`lib/card-logic.ts`),与本条工具侧的拒绝口径不同。人打错一个越界数,钳到边界比让整次保存失败更合人意;模型给的 `limit` 需要的是「这一轮错了」的反馈。两侧读同一组常量,区间不会各说各话。
48
+
5
49
  ## 0.1.7
6
50
 
7
51
  ### Added
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/@jayyuen66/dsh-zvec-grep"><img src="https://img.shields.io/npm/v/@jayyuen66/dsh-zvec-grep?style=flat-square&logo=npm&logoColor=white" alt="npm version" /></a>
11
- <a href="https://www.npmjs.com/package/@jayyuen66/dsh-zvec-grep"><img src="https://img.shields.io/npm/dm/@jayyuen66/dsh-zvec-grep?style=flat-square" alt="npm downloads" /></a>
11
+ <a href="https://www.npmjs.com/package/@jayyuen66/dsh-zvec-grep"><img src="https://img.shields.io/npm/d18m/@jayyuen66/dsh-zvec-grep?style=flat-square" alt="npm downloads (total)" /></a>
12
12
  <a href="https://github.com/JayYuen666/dsh-zvec-grep/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-zvec-grep/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
13
13
  <img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
14
14
  <img src="https://img.shields.io/badge/node-%3E%3D22.12-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
@@ -77,9 +77,9 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
77
77
  Remove with `dsh plugin --profile web remove @jayyuen66/dsh-zvec-grep`. The package is on the public npm registry; no credentials, no scoped-registry line.
78
78
 
79
79
  - **Node.js `>= 22.12`** (ESM-only; that floor is what makes `require()` of an ESM entry work, hence `engines.node`).
80
- - **Host `dsh` on the `0.2.1-rc.3` line.** The host reads `engines.dsh` (`^0.2.1-rc.3`) and it **decides alone** - with that field present, compatibility is judged before `peerDependencies` is ever consulted, prereleases included. Any `0.2.x` at or above `0.2.1-rc.3` passes; `0.3.0` and later need the risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`.
81
- - **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts`). Profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package there becomes a real second copy; `@deepseek-ai/dsh-tools` keys its scheduler with a plain `Symbol`, so **every native tool call throws** in that profile while build, typecheck and coverage stay green. The `dsh-*` peers are pinned exactly at the `@deepseek-ai/dsh` peer's version - a compile-time discipline against a second host type surface, not a claim the host consults.
82
- - **Value imports are required peers.** `@deepseek-ai/schemastery` is the host fork (only its `resolve` wraps `.volatile()` fields); `@deepseek-ai/dsh-typert-protocol` provides `TypertRemoteService`, a class to `extends`; shared's `lib/text` value-imports `@deepseek-ai/dsh-output-retention`. Each sits in `peerDependencies` plus the same exact pin in `devDependencies` - missing one is `ERR_MODULE_NOT_FOUND` at load, not a graceful downgrade. The only `dependencies` entry is `@jayyuen66/dsh-plugin-shared`.
80
+ - **Host `dsh` on the `0.2.1-rc.3` line.** The host reads `engines.dsh` (`^0.2.1-rc.3`) and it **decides alone** - with that field present, compatibility is judged before `peerDependencies` is ever consulted, prereleases included. Any `0.2.x` at or above `0.2.1-rc.3` passes; `0.3.0` and later need the risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`. The support window rolls: this package is verified against the three most recently released host versions at publish time and re-verified once the window moves, so the version number in this bullet is not a standing promise.
81
+ - **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts`). Profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package there becomes a real second copy; `@deepseek-ai/dsh-tools` keys its scheduler with a plain `Symbol`, so **every native tool call throws** in that profile while build, typecheck and coverage stay green. The `@deepseek-ai/dsh*` peers carry the same support-window range (`^0.2.1-rc.3`), while the exact pins in `devDependencies` are the compile-time discipline against a second host type surface - not a claim the host consults.
82
+ - **Value imports are required peers.** `@deepseek-ai/schemastery` is the host fork (only its `resolve` wraps `.volatile()` fields); `@deepseek-ai/dsh-typert-protocol` provides `TypertRemoteService`, a class to `extends`; `@deepseek-ai/dsh-scope` provides `scopeOf` for the step-admission lookup; shared's `lib/text` value-imports `@deepseek-ai/dsh-output-retention`. Each sits in `peerDependencies` plus the same exact pin in `devDependencies` - missing one is `ERR_MODULE_NOT_FOUND` at load, not a graceful downgrade. `dependencies` holds `@jayyuen66/dsh-plugin-shared` and `zod` (the latter versioned through the umbrella catalog, used by the settings card's strict codecs).
83
83
  - **What ships**: `host.js`, `client.js`, `cordis.patch.yml`, `icon.svg`, both READMEs, `CHANGELOG.md`, `THIRD_PARTY_NOTICES.md`. Artifacts are rebuilt by `prepack`, never committed.
84
84
 
85
85
  ### <img src="https://api.iconify.design/lucide/arrow-down-to-line.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Shared version floor
@@ -114,7 +114,7 @@ If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entr
114
114
 
115
115
  ## <img src="https://api.iconify.design/lucide/search.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Tools exposed to the model
116
116
 
117
- Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status); stdout capped at 400000 bytes, truncated to the tail with a note. Sandbox runner failure, policy denial and a genuine zg failure are told apart; incomplete results are flagged. A `root` must be a string, and the constructed command is capped in UTF-8 bytes (not code units): a non-string root or an over-long command is refused instead of falling back to the session workspace or hitting the OS argument limit.
117
+ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status); stdout capped at 400000 bytes, truncated to the tail with a note. Sandbox runner failure, policy denial and a genuine zg failure are told apart; incomplete results are flagged. A `root` must be a string, and the constructed command is capped in UTF-8 bytes (not code units): a non-string root or an over-long command is refused instead of falling back to the session workspace or hitting the OS argument limit. A `limit` outside 1-50 is refused the same way, naming the allowed range - a silently clamped count would read as the truth about this search; omit it for the default.
118
118
 
119
119
  ### zg_search
120
120
 
@@ -154,6 +154,7 @@ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status);
154
154
  - **What counts as searching**: after quote/comment-aware tokenising of a bash/pwsh command string, grep/egrep/fgrep/rg at a command position, plus the native grep tool. `--help` / `--version`, `echo "grep x"` and commit messages do not.
155
155
  - **Quota per "session x index root"**: each successful `zg_search` re-arms `grepBudgetPerSearch` calls valid for `unlockWindowMin` minutes; the index root is the root itself or its nearest indexed ancestor (up to 8 levels up).
156
156
  - **Partitioning uses the root session** (walked up `header.parentSession`): the main agent and its subagents **share one quota**. Degradation never throws - a missing parent stops at the last known hop, a cycle stops before the first repeat.
157
+ - **Step admission stands the gate down**: when the host supplies a `toolSet` and this step's view does not admit `zg_search` (a restricted subagent or a conditional-tool step), grep/rg are not blocked - requiring a call this step cannot make is a dead end. Hosts without step admission keep the old criterion.
157
158
  - **"Indexed" means `<root>/.zvec-grep/manifest.json` exists *and* parses** with `manifestVersion` strictly 1 and `rootPaths` covering this directory (normalized equality, `/private` prefix stripped on macOS). The directory name alone is not enough - it is also zg's global home (`~/.zvec-grep`), and an existence-only check misreads a truncated or foreign manifest as "indexed", deadlocking both search and the gate.
158
159
  - The whitelist and unlock tables live in bounded memory (64 roots / 256 partitions) with touch-on-hit, expiry-then-LRU eviction; whitelist entries carry a one-day validity.
159
160
  - `enforceSearchFirst=false` disables only the gate; the confirm and root backstops stay.
@@ -255,6 +256,7 @@ A "rebuild workspace" run is one **unowned** job in the host's `ctx.jobs` (`kind
255
256
  | --- | --- |
256
257
  | 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. |
257
258
  | 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 (ownerOperation: ...)" | 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. |
258
260
  | 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. |
259
261
  | 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. |
260
262
  | A root that was never indexed | zg_search fails loudly; building happens only via zg_index on an explicit request. |
package/README.zh-CN.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/@jayyuen66/dsh-zvec-grep"><img src="https://img.shields.io/npm/v/@jayyuen66/dsh-zvec-grep?style=flat-square&logo=npm&logoColor=white" alt="npm version" /></a>
11
- <a href="https://www.npmjs.com/package/@jayyuen66/dsh-zvec-grep"><img src="https://img.shields.io/npm/dm/@jayyuen66/dsh-zvec-grep?style=flat-square" alt="npm downloads" /></a>
11
+ <a href="https://www.npmjs.com/package/@jayyuen66/dsh-zvec-grep"><img src="https://img.shields.io/npm/d18m/@jayyuen66/dsh-zvec-grep?style=flat-square" alt="npm downloads (total)" /></a>
12
12
  <a href="https://github.com/JayYuen666/dsh-zvec-grep/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-zvec-grep/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
13
13
  <img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
14
14
  <img src="https://img.shields.io/badge/node-%3E%3D22.12-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
@@ -77,9 +77,9 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
77
77
  卸载用 `dsh plugin --profile web remove @jayyuen66/dsh-zvec-grep`。包在公共 npm registry 上,不需要凭据,也不需要 scoped-registry 配置行。
78
78
 
79
79
  - **Node.js `>= 22.12`**(纯 ESM;正是这个下限让 `require()` 一枚 ESM 入口成为可能,`engines.node` 因此声明)。
80
- - **宿主 `dsh` 在 `0.2.1-rc.3` 这条线上。** 宿主读 `engines.dsh`(`^0.2.1-rc.3`)且**单独决定**——该字段在场时兼容性先于 `peerDependencies` 判定,prerelease 参与比较。`0.2.x` 里不低于 `0.2.1-rc.3` 的都通过;`0.3.0` 及以上需要风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <确切版本> --accept-risk`。
81
- - **按契约,`dependencies` 下不放任何 `@deepseek-ai/*`**(`test/publish-manifest.test.ts` 钉住)。profile 以 `nodeLinker: hoisted` 与 `autoInstallPeers: false` 安装,宿主包在那里会落成真实的第二份副本;`@deepseek-ai/dsh-tools` 用普通 `Symbol` 给调度器做键,那个 profile 里**每一次原生工具调用都抛错**,而构建、类型检查与覆盖率照绿。`dsh-*` peer 一律精确钉在 `@deepseek-ai/dsh` peer 的版本上——这是防「第二份宿主类型面」的编译期纪律,不是宿主会去读的声明。
82
- - **值导入都是必需 peer。** `@deepseek-ai/schemastery` 是宿主 fork(只有它的 `resolve` 认 `.volatile()` 字段);`@deepseek-ai/dsh-typert-protocol` 提供 `TypertRemoteService` 这个要 `extends` 的类;shared 的 `lib/text` 自己值导入 `@deepseek-ai/dsh-output-retention`。三者都落 peer 加同版精确钉的 devDependencies——缺一枚就是装载期 `ERR_MODULE_NOT_FOUND`,不是优雅降级。`dependencies` 里只有 `@jayyuen66/dsh-plugin-shared`。
80
+ - **宿主 `dsh` 在 `0.2.1-rc.3` 这条线上。** 宿主读 `engines.dsh`(`^0.2.1-rc.3`)且**单独决定**——该字段在场时兼容性先于 `peerDependencies` 判定,prerelease 参与比较。`0.2.x` 里不低于 `0.2.1-rc.3` 的都通过;`0.3.0` 及以上需要风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <确切版本> --accept-risk`。支持窗口是滚动的:本包在发布时最近的三个已发布宿主版本上逐版取证,窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
81
+ - **按契约,`dependencies` 下不放任何 `@deepseek-ai/*`**(`test/publish-manifest.test.ts` 钉住)。profile 以 `nodeLinker: hoisted` 与 `autoInstallPeers: false` 安装,宿主包在那里会落成真实的第二份副本;`@deepseek-ai/dsh-tools` 用普通 `Symbol` 给调度器做键,那个 profile 里**每一次原生工具调用都抛错**,而构建、类型检查与覆盖率照绿。`@deepseek-ai/dsh*` 的 peer 写同一条支持窗口范围(`^0.2.1-rc.3`),`devDependencies` 里的精确钉版才是防「第二份宿主类型面」的编译期纪律——那不是宿主会去读的声明。
82
+ - **值导入都是必需 peer。** `@deepseek-ai/schemastery` 是宿主 fork(只有它的 `resolve` 认 `.volatile()` 字段);`@deepseek-ai/dsh-typert-protocol` 提供 `TypertRemoteService` 这个要 `extends` 的类;`@deepseek-ai/dsh-scope` 提供步骤准入判定用的 `scopeOf`;shared 的 `lib/text` 自己值导入 `@deepseek-ai/dsh-output-retention`。四者都落 peer 加同版精确钉的 devDependencies——缺一枚就是装载期 `ERR_MODULE_NOT_FOUND`,不是优雅降级。`dependencies` 里是 `@jayyuen66/dsh-plugin-shared` 与 `zod`(后者版本走伞根 catalog,供设置卡的 strict codec 校验)。
83
83
  - **随包发什么**:`host.js`、`client.js`、`cordis.patch.yml`、`icon.svg`、两份 README、`CHANGELOG.md`、`THIRD_PARTY_NOTICES.md`。产物由 `prepack` 现产,不入库。
84
84
 
85
85
  ### <img src="https://api.iconify.design/lucide/arrow-down-to-line.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> shared 的版本下限
@@ -114,7 +114,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
114
114
 
115
115
  ## <img src="https://api.iconify.design/lucide/search.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 提供给模型的工具
116
116
 
117
- 输出为纯文本;超时 5 分钟(search)/ 10 分钟(index)/ 60 秒(status);stdout 上限 400000 字节,超限截尾并提示。沙箱 runner 失败、策略拒绝与 zg 自身失败分开归因;结果可能不完整时显式打标。`root` 必须是字符串,构造出的命令按 UTF-8 字节(不是码元)封顶:非字符串的 root 与超长命令直接拒绝,不会回落到会话工作区,也不会撞上内核参数上限。
117
+ 输出为纯文本;超时 5 分钟(search)/ 10 分钟(index)/ 60 秒(status);stdout 上限 400000 字节,超限截尾并提示。沙箱 runner 失败、策略拒绝与 zg 自身失败分开归因;结果可能不完整时显式打标。`root` 必须是字符串,构造出的命令按 UTF-8 字节(不是码元)封顶:非字符串的 root 与超长命令直接拒绝,不会回落到会话工作区,也不会撞上内核参数上限。`limit` 越出 1-50 同样直接拒绝并点名区间,不静默钳制——钳过的少结果会被模型当成这次检索的事实;省略则用默认值。
118
118
 
119
119
  ### zg_search
120
120
 
@@ -154,6 +154,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
154
154
  - **什么算检索**:bash/pwsh 命令串经引号/注释感知切词后,命令位上的 grep/egrep/fgrep/rg 与原生 grep 工具。`--help` / `--version`、`echo "grep x"`、commit message 不算。
155
155
  - **配额按「会话 × 索引根」**:每次成功 zg_search 重新武装 grepBudgetPerSearch 次、unlockWindowMin 分钟有效;索引根是 root 自身或含索引的最近祖先(最多上溯 8 层)。
156
156
  - **分片用根会话**(沿 `header.parentSession` 上溯到顶):主代理与子代理**共享一份额度**。上溯降级不抛错——查不到父就停在已知的最后一跳,成环就停在首次重复前。
157
+ - **步骤准入让路**:宿主提供 `toolSet` 且本步骤的视图不含 `zg_search` 时(受限子代理或条件工具步骤),grep/rg 不被拦——强迫模型去调一个本步骤调不动的工具是死路。不提供步骤准入的宿主沿用原判据。
157
158
  - **「含索引」= `<root>/.zvec-grep/manifest.json` 在盘上,*并且*解析得开**:`manifestVersion` 严格等于 1、`rootPaths` 覆盖该目录(归一相等,macOS 两侧剥 `/private` 前缀)。只判目录名不够——它同时是 zg 的全局 home(`~/.zvec-grep`);只判存在会把半截或外来的清单误判成有索引,把检索与门禁双向堵死。
158
159
  - 白名单/解锁表在内存里有界(64 根 / 256 分片),命中即触摸、先过期后 LRU 淘汰;白名单条目带一天有效期。
159
160
  - enforceSearchFirst=false 只关门禁;confirm 与 root 兜底照旧。
@@ -255,6 +256,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
255
256
  | --- | --- |
256
257
  | grep/rg 被拒且提示「尚未执行过 zg_search」 | 这是 search-first 门禁,先 zg_search;配额用尽或过期同理,换个更准的 query 重搜续上,不必关插件。 |
257
258
  | 检索超时 | 默认 `--refresh wait` 同步刷新索引;用 globs/fileTypes 缩小范围、调小 limit,或起守护进程——直连模式每次冷加载 embedding 模型,那才是预算给到 5 分钟的原因。 |
259
+ | 报错「zg 索引锁正被其他操作占用(ownerOperation: …)」 | 占锁方不是重建(常见是增量刷新),这一条命令不为它等待——那类操作可能跑很久,排队等于无界挂起。稍后重试,或等它落定后再查;只有重建占锁走自动等待重试。zg 的原始失败文本随行,可核对是哪一把锁。 |
258
260
  | 重建被拒「root 不在观测白名单内」 | 该目录从未在本 daemon 开过会话;先在那里起会话,或让模型带 confirm=true 调 zg_index。 |
259
261
  | 卡片显示重建失败而 zg 看着像跑完了 | 成功判据是 completed 且 exit 0——exit 127(zg 没装)也落在 completed,看输出尾部。 |
260
262
  | 从未建索引的 root | zg_search 明确报错;建索引只在明确请求时由 zg_index 做。 |
@@ -19,11 +19,13 @@
19
19
  - 数据边界:索引与向量库(`.zvec-grep/`、`manifest.json`)由上游读写,本包只判它是否存在、是否覆盖
20
20
  目标根,不解析也不改写其内部结构。
21
21
 
22
- ## 编译期与运行期依赖:`@jayyuen66/dsh-plugin-shared`
22
+ ## 编译期与运行期依赖
23
23
 
24
- - 同作者的共享工具库(MIT),是本包 `dependencies` 里唯一一枚,随包从公共 npm 安装。
25
- - 它自己的宿主包 peer(含 `@deepseek-ai/dsh-output-retention`)由 dsh 运行时提供——本包必须把这
26
- 几枚也声明在 peer ∪ dev 上,否则装出去即 `ERR_MODULE_NOT_FOUND`(判据见
24
+ - `@jayyuen66/dsh-plugin-shared`(MIT):同作者的共享工具库,随包从公共 npm 安装。
25
+ - `zod`(MIT):设置卡 `src/rebuild-reader.ts` 的 strict codec 用它校验形状;版本走伞根 catalog,
26
+ client 产物按宿主 `PLATFORM_MODULES` 保持 `require("zod")` 外部化。
27
+ - shared 自己的宿主包 peer(含 `@deepseek-ai/dsh-output-retention`)由 dsh 运行时提供——本包必须把
28
+ 这几枚也声明在 peer ∪ dev 上,否则装出去即 `ERR_MODULE_NOT_FOUND`(判据见
27
29
  `test/publish-manifest.test.ts`)。
28
30
 
29
31
  ## 宿主:dsh 与 `@deepseek-ai/*`