@jayyuen66/dsh-zvec-grep 0.1.10 → 0.1.12

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,6 +1,45 @@
1
1
  # Changelog
2
2
 
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).
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
+
5
+ ## 0.1.12
6
+
7
+ 宿主开发基线抬到 `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
+
9
+ ### Changed
10
+
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`(只换说明符,没有逻辑改动),`package.json` 新增 `dsh.bundle.client.external`,`build-client.mjs` 的外置清单同步;`cordis.patch.yml` 因此插入一条**不写 id** 的 `@jayyuen66/dsh-plugin-shared` 组件行(写 id 会在插件页多出一个可关闭的组件,关掉后设置卡失去组件供应)。
14
+ - **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 版本集合钉到窗口首条,改值会当场红);两份 README 的 `insert:` 块由「唯一一行」改为「两条条目」并写明 shared 那行为何不写 id。
16
+
17
+ ### Fixed
18
+
19
+ - **两份 DETAIL 的不对称**:英文版漏了 `rebuildWaitMs` 的默认值(120000,取自 `host.ts` 的 `REBUILD_WAIT_MS = 2 * 60_000`)与「十项部署值只能走注册行 `config:`,优先级是行 `config:` > 代码 `.default()`」这句,中文版已有;英文补平。两侧「随包那份 `cordis.patch.yml` 只带 `id` / `name`」的说法按本轮改动改成两条条目——这一句要紧,因为按原文读者会以为多出来的 shared 行是多余物可以删,而删掉后设置卡会失去组件供应。
20
+
21
+ ## 0.1.11
22
+
23
+ 这一版补上 search-first 门禁对命令替换与壳层包装的识别,给索引探测加显式失效通道,把状态读面按部署形态收口,并让发布链与产物门禁各自多一道判据;宿主开发基线抬到 `0.2.2-alpha.3`,支持窗口改为 `^0.2.1-rc.5 || ^0.2.2-alpha.3`。
24
+
25
+ ### Changed
26
+
27
+ - **宿主与元数据**: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
+ - **search-first 门禁**(`lib/search-predicates.ts`):`$(...)` 命令替换与 `bash -c '…'` / `sh -c` / `zsh -lc` 等壳层包装里的 grep/rg 也纳入词法判据,嵌套最多两层。
29
+ - **索引探测失效**(`host.ts`):`zg_index` 前台落定后当场清掉该根的探测缓存,drop/重建不再等 60 秒 TTL;门禁与 `findIndexRoot` 同一拍看到新状态。
30
+ - **状态读面**(`host.ts`、`lib/card-logic.ts`、`src/ui-messages.ts`):`zg_status` 的守护进程注文按 `clientMode` 收口(direct 部署不再发空头承诺);卡片就绪位只认 `true`/`false`,畸形 `status` 或缺退出码统一落到「没有可判定的结果」。
31
+ - **构建与发布链**:`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
+ - **文档**:中英 README 重写搜索门禁、root 判据、卡片就绪位、随包文件与覆盖率分母;`docs/DETAIL.zh.md` 同步 `rebuildWaitMs` 默认值与冲突旗标。
33
+
34
+ ### Fixed
35
+
36
+ - **argv 守卫**(`lib/argv-guard.ts`):单值/数组入口对非字符串坏值单独报「字符串或字符串数组」,不再误报成「必须是字符串数组」。
37
+ - **卡片读面**(`lib/card-logic.ts`、`src/client-entry.ts`):`roots()` 的探测失败折成 `false`;重建输入占位与镜像地址走 locale 常量。
38
+ - **契约门禁**:`test/schema-coverage.ts` 认正则字面量与 `as const`/`satisfies` 尾巴,避免把类型标注当成设置字段;两份 README 的 dsh 窗口与 badge 新增与 `engines.dsh` 同源的用例,`bump-manifests` 只改 package.json 时本仓会当场红。
39
+
40
+ ### Added
41
+
42
+ - **测试夹具**:`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`(写锁用例共用支撑)。
4
43
 
5
44
  ## 0.1.10
6
45
 
package/README.md CHANGED
@@ -11,8 +11,8 @@
11
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
- <img src="https://img.shields.io/badge/node-%3E%3D22.12-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.3-658EFF?style=flat-square" alt="dsh" />
14
+ <img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.5-658EFF?style=flat-square" alt="dsh" />
16
16
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
17
17
  </p>
18
18
 
@@ -76,11 +76,11 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
76
76
 
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
- - **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` / `0.2.2-alpha.2` 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.
79
+ - **Node.js `>= 24.9`** (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.5` or `0.2.2-alpha.3` line.** The host reads `engines.dsh` (`^0.2.1-rc.5 || ^0.2.2-alpha.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.5` passes the host gate; on the `0.2.2` prerelease line, strict npm peer resolution starts at `0.2.2-alpha.3`. `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: at publish time this package is checked against every released host version inside the window - the judgement is the host's `--dump-config` layer line for this package, while the settings card and its namespace calls are verified once in full on the release's development baseline - 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.5 || ^0.2.2-alpha.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
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
- - **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.
83
+ - **What ships**: `host.js`, `client.js`, `cordis.patch.yml`, `icon.svg`, both READMEs, `CHANGELOG.md`, `THIRD_PARTY_NOTICES.md`, `locale/zh.json` + `locale/en.json`, and `docs/` (both DETAIL files). 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
86
86
 
@@ -100,12 +100,12 @@ If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entr
100
100
  - **No CLI subcommand.** `dsh zvec-grep …` does not exist.
101
101
  - **No daemon lifecycle.** `zg server on` is the user's action; this package only reads readiness.
102
102
  - **No ripgrep dependency.** rg appears only inside the gate predicate.
103
- - **Nothing written to the host data directory.** The only on-disk shape is zg's own `.zvec-grep/` under the indexed root.
103
+ - **Nothing written to the host data directory.** What lands 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`. This package itself writes nothing.
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
107
107
 
108
- - `dsh.bundle.patch` points at `cordis.patch.yml`, whose single line is `- id: zvec-grep` with `name: "@jayyuen66/dsh-zvec-grep"` - the **bare package name** is what makes the host scan the client half. Bundle installation goes through pnpm (>= 12.3.0).
108
+ - `dsh.bundle.patch` points at `cordis.patch.yml`, whose `insert:` block carries **two entries**: `- name: "@jayyuen66/dsh-plugin-shared"` (the supplier of the card components, deliberately **without an `id`** so the plugin page does not list it as a switchable component) and `- id: zvec-grep` with `name: "@jayyuen66/dsh-zvec-grep"` - the **bare package name** is what makes the host scan the client half. Bundle installation goes through pnpm (>= 12.3.0).
109
109
  - A missing injected surface keeps cordis from activating the entry (startup diagnostic: `pending (waiting for service: …)`); a malformed ctx throws `required services … missing` from apply.
110
110
  - The card is registered in the `plugins.bundle.config` slot keyed by the **bundle package name**; the settings namespace and `configForms` reads stay the bare entry id `zvec-grep` (implicit registration by entry id).
111
111
  - The rebuild read surface is installed on the apply fiber - no `webServer` dependency, no child fiber. On a TUI host the service still registers; the card simply has nowhere to render.
@@ -142,7 +142,7 @@ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status);
142
142
  ### The rg switch
143
143
 
144
144
  - `rg` unset: with no index in the workspace **or any ancestor**, the search falls back to exhaustive matching with a prepended note ("literal line matches, not semantic ranking"). `rg=true` forces it; `rg=false` refuses the fallback (zg then reports `WORKSPACE_INDEX_NOT_FOUND`).
145
- - Exhaustive search grants **no** grep/rg quota: it reads no index. Flag conflicts (`preview` / `refresh` / `symbol-type` / `prefer-symbol` / `fuse` / `fts` / `vector`, `trace`) are refused at assembly time with the conflicts listed; there is no hit summary (no `hits:` lines to count).
145
+ - Exhaustive search grants **no** grep/rg quota: it reads no index. Flag conflicts (`preview` / `refresh` / `symbol-type` / `prefer-symbol` / `fuse` / `fts` / `vector`, `trace`, plus a non-empty `queries` - the exhaustive channel takes a single `query` as the pattern) are refused at assembly time with the conflicts listed; there is no hit summary (no `hits:` lines to count).
146
146
 
147
147
  ### Root rules
148
148
 
@@ -152,7 +152,7 @@ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status);
152
152
  ## <img src="https://api.iconify.design/lucide/ban.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> The search-first gate
153
153
 
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
- - **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).
155
+ - **Quota per "session x index root"**: each successful, **index-reading** `zg_search` re-arms `grepBudgetPerSearch` calls valid for `unlockWindowMin` minutes (an exhaustive lexical fallback also "succeeds" but grants no quota); the index root is the root itself or its nearest indexed ancestor (up to 8 levels up). The gate yields only when the host supplies a step-admission view (`toolSet`) without `zg_search` in it - hosts that provide no admission info keep the plain criteria.
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
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.
158
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.
@@ -203,7 +203,7 @@ Off by default: `allowRemoteEmbedding=false`, `remoteEmbeddingEndpoint=""`, `rem
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
205
  - This package does not start one either - `zg server on` leaves a detached process and a token file, which is the user's decision. It makes the difference **explicit** instead: 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. Only the `roots()` read issues the probe.
206
- - The card's `serverReady` is only ever `true` / `false`; when the probe cannot answer, that arm renders nothing rather than "not ready". To get the benefits, run `zg server on` in a terminal.
206
+ - 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 get the benefits, run `zg server on` in a terminal.
207
207
 
208
208
  ## <img src="https://api.iconify.design/lucide/network.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Public interface
209
209
 
@@ -211,7 +211,7 @@ One official Typert Remote namespace, `zvecGrepRebuild`, installed on the apply
211
211
 
212
212
  | Method | Input | Reply |
213
213
  | --- | --- | --- |
214
- | `roots()` | - | `{ roots, serverReady }` - observed whitelist plus the readiness line; `serverReady` is `undefined` when the probe cannot answer |
214
+ | `roots()` | - | `{ roots, serverReady }` - observed whitelist plus the readiness line; the probe folds failure to `false` (`undefined` only marks an older snapshot where the probe never ran) |
215
215
  | `rebuild({ root })` | an absolute root | `{ ok: true, jobId, reused? }` or `{ ok: false, error, status }` |
216
216
  | `status({ jobId })` | a job id from this package | `{ status, exitCode, root, output }` (plus `sandbox` when present) or `{ ok: false, error, status: 404 \| 503 }` |
217
217
 
@@ -232,7 +232,7 @@ A "rebuild workspace" run is one **unowned** job in the host's `ctx.jobs` (`kind
232
232
 
233
233
  | Aspect | Content |
234
234
  | --- | --- |
235
- | Written to disk | Nothing by this package. The only on-disk shape is the `.zvec-grep/` index directory under the searched root, written by zg; nothing lands in the host data directory |
235
+ | Written to disk | Nothing by this package. zg owns the disk shapes: the `.zvec-grep/` index directory under the searched root, its global home `~/.zvec-grep` (config/locks/models) and the embedding-weight cache; nothing lands in the host data directory |
236
236
  | What it reads | The index probe: one existence check plus one manifest read |
237
237
  | Network | Only the embedding-weight download driven by `hfEndpoint`, performed by zg. Remote embedding is off by default and is a deployment decision |
238
238
  | Secret exclusion | Excluded by default, case-insensitively and after your own path rules: `*.pem` / `*.key` / `*.p12` / `*.pfx` / `*.keystore` / `*.jks` / `*.ppk` / `id_rsa*` / `id_ed25519*` (excludeSecrets=false to allow). Extensionless key files are not covered - declare them via ignoreFiles |
@@ -270,7 +270,7 @@ pnpm run check # typecheck (three tsconfig programs) → lint → both bundle
270
270
  ```
271
271
 
272
272
  - Tests come in three tiers: `test/*.test.ts` (unit + mocked host context), `test/integration/*` (real host services driven through `ctx.tools.execute()` / actual `fetch`), and `test/e2e/zg-cli.test.ts` (no plugin, no mock - the built command lines against the **real zg CLI**). Host-contract bugs surface in the middle tier: a mocked context can only agree with what this package already believes.
273
- - Coverage is **100%** across four metrics over the opted-in surface (`host.ts` + `lib/**`); the client half (`src/**`) is deliberately outside the denominator and is exercised through the bundle.
273
+ - Coverage is **100%** across four metrics over the opted-in surface (`host.ts` + `lib/**` + the two card-side sources `src/ui-messages.ts` / `src/rebuild-reader.ts`); only the pure browser entry `src/client-entry.ts` stays outside the denominator and is exercised through the bundle.
274
274
  - `host.js` / `client.js` are not committed; `prepare` / `prepack` rebuild them and two tests compare the on-disk bundle against an in-memory build byte for byte. Never hand-edit the bundles.
275
275
  - Manifest gates (`test/publish-manifest.test.ts`) guard the published surface: entry targets covered by `files`, host packages out of `dependencies`, `dsh-*` pinned exactly, no local paths in artifacts. `test/dist-size.test.ts` budgets bundle bytes; `test/readme-parity.test.ts` keeps both READMEs structurally in sync.
276
276
 
package/README.zh-CN.md CHANGED
@@ -11,8 +11,8 @@
11
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
- <img src="https://img.shields.io/badge/node-%3E%3D22.12-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.3-658EFF?style=flat-square" alt="dsh" />
14
+ <img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.5-658EFF?style=flat-square" alt="dsh" />
16
16
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
17
17
  </p>
18
18
 
@@ -33,32 +33,33 @@
33
33
 
34
34
  ## <img src="https://api.iconify.design/lucide/file-text.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 目录
35
35
 
36
- - [它做什么](#它做什么)
37
- - [安装](#安装)
38
- - [shared 的版本下限](#shared-的版本下限)
39
- - [确认它真的在工作](#确认它真的在工作)
40
- - [它不提供什么](#它不提供什么)
41
- - [在 dsh 里启用](#在-dsh-里启用)
42
- - [提供给模型的工具](#提供给模型的工具)
43
- - [zg_search](#zg_search)
44
- - [zg_index](#zg_index)
45
- - [zg_status](#zg_status)
36
+ - [ 目录](#-目录)
37
+ - [ 它做什么](#-它做什么)
38
+ - [ 安装](#-安装)
39
+ - [ shared 的版本下限](#-shared-的版本下限)
40
+ - [ 确认它真的在工作](#-确认它真的在工作)
41
+ - [ 它不提供什么](#-它不提供什么)
42
+ - [ 在 dsh 里启用](#-在-dsh-里启用)
43
+ - [ 提供给模型的工具](#-提供给模型的工具)
44
+ - [zg\_search](#zg_search)
45
+ - [zg\_index](#zg_index)
46
+ - [zg\_status](#zg_status)
46
47
  - [rg 开关](#rg-开关)
47
48
  - [root 判据](#root-判据)
48
- - [search-first 门禁](#search-first-门禁)
49
- - [设置项](#设置项)
49
+ - [ search-first 门禁](#-search-first-门禁)
50
+ - [ 设置项](#-设置项)
50
51
  - [远程 embedding](#远程-embedding)
51
52
  - [显式 root 前的确认](#显式-root-前的确认)
52
- - [支持面](#支持面)
53
- - [外部依赖](#外部依赖)
54
- - [守护进程](#守护进程)
55
- - [对外接口](#对外接口)
56
- - [后台作业面](#后台作业面)
57
- - [数据与隐私](#数据与隐私)
58
- - [已知边界](#已知边界)
59
- - [常见问题](#常见问题)
60
- - [开发](#开发)
61
- - [许可](#许可)
53
+ - [ 支持面](#-支持面)
54
+ - [ 外部依赖](#-外部依赖)
55
+ - [ 守护进程](#-守护进程)
56
+ - [ 对外接口](#-对外接口)
57
+ - [ 后台作业面](#-后台作业面)
58
+ - [ 数据与隐私](#-数据与隐私)
59
+ - [ 已知边界](#-已知边界)
60
+ - [ 常见问题](#-常见问题)
61
+ - [ 开发](#-开发)
62
+ - [ 许可](#-许可)
62
63
 
63
64
  ## <img src="https://api.iconify.design/lucide/shield.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 它做什么
64
65
 
@@ -76,11 +77,11 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
76
77
 
77
78
  卸载用 `dsh plugin --profile web remove @jayyuen66/dsh-zvec-grep`。包在公共 npm registry 上,不需要凭据,也不需要 scoped-registry 配置行。
78
79
 
79
- - **Node.js `>= 22.12`**(纯 ESM;正是这个下限让 `require()` 一枚 ESM 入口成为可能,`engines.node` 因此声明)。
80
- - **宿主 `dsh` 在 `0.2.1-rc.3` / `0.2.2-alpha.2` 这条线上。** 宿主读 `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` 里的精确钉版才是防「第二份宿主类型面」的编译期纪律——那不是宿主会去读的声明。
80
+ - **Node.js `>= 24.9`**(纯 ESM;正是这个下限让 `require()` 一枚 ESM 入口成为可能,`engines.node` 因此声明)。
81
+ - **宿主 `dsh` 在 `0.2.1-rc.5` 或 `0.2.2-alpha.3` 这条线上。** 宿主读 `engines.dsh`(`^0.2.1-rc.5 || ^0.2.2-alpha.3`)且**单独决定**——该字段在场时兼容性先于 `peerDependencies` 判定,prerelease 参与比较。`0.2.x` 里不低于 `0.2.1-rc.5` 的都通过宿主装载门;`0.2.2` 预发布线上,npm 的严格 peer 解析从 `0.2.2-alpha.3` 起算。`0.3.0` 及以上需要风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <确切版本> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证(判据是宿主 `--dump-config` 里本包的层行;设置卡与它的命名空间调用另在发布基线上全量取证一次),窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
82
+ - **按契约,`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.5 || ^0.2.2-alpha.3`),`devDependencies` 里的精确钉版才是防「第二份宿主类型面」的编译期纪律——那不是宿主会去读的声明。
82
83
  - **值导入都是必需 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
- - **随包发什么**:`host.js`、`client.js`、`cordis.patch.yml`、`icon.svg`、两份 README、`CHANGELOG.md`、`THIRD_PARTY_NOTICES.md`。产物由 `prepack` 现产,不入库。
84
+ - **随包发什么**:`host.js`、`client.js`、`cordis.patch.yml`、`icon.svg`、两份 README、`CHANGELOG.md`、`THIRD_PARTY_NOTICES.md`、`locale/zh.json` + `locale/en.json`、`docs/`(两份 DETAIL)。产物由 `prepack` 现产,不入库。
84
85
 
85
86
  ### <img src="https://api.iconify.design/lucide/arrow-down-to-line.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> shared 的版本下限
86
87
 
@@ -100,12 +101,12 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
100
101
  - **没有 CLI 子命令。** `dsh zvec-grep …` 不存在。
101
102
  - **不碰守护进程的生命周期。** `zg server on` 是用户的动作;本包只读就绪态。
102
103
  - **不依赖 ripgrep。** rg 只出现在门禁判据里。
103
- - **不向宿主数据目录写任何东西。** 唯一的落盘形状是被检索 root 下由 zg 写入的 `.zvec-grep/` 目录。
104
+ - **不向宿主数据目录写任何东西。** 落盘的都是 zg 的事:检索根下的 `.zvec-grep/` 索引与清单、zg 的全局 home `~/.zvec-grep`(config / 锁 / 模型)、以及按 `hfEndpoint` 下载的 embedding 权重缓存。
104
105
  - 必需的服务面:settings / shell / tools / systemPrompt / timer(全在 `inject` 里)。宿主 `jobs` 服务可选——没有它时重建路径拒绝且不 spawn,三枚工具照常工作。
105
106
 
106
107
  ## <img src="https://api.iconify.design/lucide/plug.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 在 dsh 里启用
107
108
 
108
- - `dsh.bundle.patch` 指向 `cordis.patch.yml`,其中唯一的注册行是 `- id: zvec-grep`、`name: "@jayyuen66/dsh-zvec-grep"`——让宿主扫描 client 半的是**裸包名**。bundle 安装走 pnpm(>= 12.3.0)。
109
+ - `dsh.bundle.patch` 指向 `cordis.patch.yml`,其 `insert:` 块带**两条条目**:`- name: "@jayyuen66/dsh-plugin-shared"`(卡片组件的供应行,**刻意不写 `id`**,所以插件页不会把它列成可停用组件)与 `- id: zvec-grep`、`name: "@jayyuen66/dsh-zvec-grep"`——让宿主扫描 client 半的是**裸包名**。bundle 安装走 pnpm(>= 12.3.0)。
109
110
  - 缺任一注入服务面,cordis 就不激活本条目(启动诊断点名 `pending (waiting for service: …)`);ctx 形状不对时 apply 抛 `required services … missing`。
110
111
  - 卡片注册在 `plugins.bundle.config` 槽的 **bundle 包名**键下;设置命名空间与 `configForms` 的读仍走裸条目 id `zvec-grep`(按条目 id 隐式注册)。
111
112
  - 重建读面注册在 apply fiber 上——不声明 `webServer`、没有子 fiber。TUI 宿主上服务照常注册,只是卡片没有地方渲染。
@@ -142,7 +143,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
142
143
  ### rg 开关
143
144
 
144
145
  - `rg` 留空:工作区**及其向上各级**都没有索引时自动改走穷举匹配,并在结果前声明「这是逐行字面匹配,不是语义排序」。`rg=true` 强制;`rg=false` 拒绝改道(zg 报 `WORKSPACE_INDEX_NOT_FOUND`)。
145
- - 穷举检索**不发放** grep/rg 配额:它不读索引。冲突旗标(`preview` / `refresh` / `symbol-type` / `prefer-symbol` / `fuse` / `fts` / `vector`、`trace`)在构造期拒绝并列出;没有 `hits:` 计数行,命中摘要自动不出。
146
+ - 穷举检索**不发放** grep/rg 配额:它不读索引。冲突旗标(`preview` / `refresh` / `symbol-type` / `prefer-symbol` / `fuse` / `fts` / `vector`、`trace`,以及非空 `queries`——穷举通道只认单条 `query`)在构造期拒绝并列出;没有 `hits:` 计数行,命中摘要自动不出。
146
147
 
147
148
  ### root 判据
148
149
 
@@ -203,7 +204,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
203
204
 
204
205
  - direct 与 server 是**两种能力面**,不是快慢之分:direct 每次查询都冷加载 embedding 模型;增量刷新(watcher)、`refresh=background` 与常驻模型池只在 server 模式下存在。上游对 `auto` 只做就绪探测、不拉起 daemon。
205
206
  - 本包也不拉——`zg server on` 会留下 detached 进程与 token 文件,那是用户的决定。本包做的是把差异**显式化**:按 60 秒 TTL 缓存 `zg server status --check-ready` 的退出码(探测失败按未就绪收口,绝不外抛基础设施故障),据此收口 `refresh=background`,并在 `zg_status` 输出尾与卡片各回显一行。探测只由 `roots()` 读面发出。
206
- - 卡片的 `serverReady` 只可能是 `true` / `false`;探测答不出时该臂什么都不显示,而不是说成「未就绪」。想要红利就在终端里跑 `zg server on`。
207
+ - 卡片的 `serverReady` 在卡片层只可能是 `true` / `false`——探测失败按未就绪收口,就绪行恒渲染。`undefined` 只会出现在旧快照的 `roots()` 原始载荷里(那一次探测压根没跑),实时卡片把它折成 `false`。想要红利就在终端里跑 `zg server on`。
207
208
 
208
209
  ## <img src="https://api.iconify.design/lucide/network.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 对外接口
209
210
 
@@ -211,7 +212,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
211
212
 
212
213
  | 方法 | 入参 | 回执 |
213
214
  | --- | --- | --- |
214
- | `roots()` | - | `{ roots, serverReady }`——观测白名单加就绪行;探测答不出时 `serverReady` 为 `undefined` |
215
+ | `roots()` | - | `{ roots, serverReady }`——观测白名单加就绪行;探测失败折成 `false`(`undefined` 只标记旧快照里那次探测没跑过) |
215
216
  | `rebuild({ root })` | 一个绝对 root | `{ ok: true, jobId, reused? }` 或 `{ ok: false, error, status }` |
216
217
  | `status({ jobId })` | 本包发的作业号 | `{ status, exitCode, root, output }`(有沙箱时带 `sandbox`)或 `{ ok: false, error, status: 404 \| 503 }` |
217
218
 
@@ -232,7 +233,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
232
233
 
233
234
  | 口径 | 内容 |
234
235
  | --- | --- |
235
- | 写盘 | 本包不写任何文件。唯一落盘形状是被检索 root 下由 zg 写入的 `.zvec-grep/` 索引目录;宿主数据目录里什么都不落 |
236
+ | 写盘 | 本包不写任何文件。落盘形状归 zg:检索根下的 `.zvec-grep/` 索引目录、全局 home `~/.zvec-grep`(config/锁/模型)与 embedding 权重缓存;宿主数据目录里什么都不落 |
236
237
  | 本包读什么 | 索引探测:一次存在性检查加读一次清单 |
237
238
  | 网络 | 只有 zg 按 hfEndpoint 下载 embedding 权重。远程 embedding 默认关闭、属部署决定 |
238
239
  | 密钥排除 | 默认排除、大小写不敏感、且排在你的路径规则之后:`*.pem` / `*.key` / `*.p12` / `*.pfx` / `*.keystore` / `*.jks` / `*.ppk` / `id_rsa*` / `id_ed25519*`(excludeSecrets=false 可关)。**无扩展名**的密钥文件不覆盖——走 ignoreFiles 声明 |
@@ -270,7 +271,7 @@ pnpm run check # 类型检查(三个 tsconfig 程序)→ lint → 两个 b
270
271
  ```
271
272
 
272
273
  - 测试分三层:`test/*.test.ts`(单测 + mock 宿主上下文)、`test/integration/*`(真宿主服务,经 `ctx.tools.execute()` / 真 `fetch` 驱动)、`test/e2e/zg-cli.test.ts`(无插件无替身——构造出的命令行直喂**真 zg CLI**)。宿主契约的缺陷出在中间层:mock 上下文只会同意本包已经相信的事。
273
- - 覆盖率四项 **100%**,分母是选入的面(`host.ts` + `lib/**`);客户端半(`src/**`)刻意在分母外,经 bundle 覆盖。
274
+ - 覆盖率四项 **100%**,分母是选入的面(`host.ts` + `lib/**`,以及卡片侧两个可单测源文件 `src/ui-messages.ts` / `src/rebuild-reader.ts`);只有纯浏览器入口 `src/client-entry.ts` 在分母外,经 bundle 覆盖。
274
275
  - `host.js` / `client.js` 不入库;`prepare` / `prepack` 现产,两条测试拿磁盘产物与内存构建逐字节比。发布物不手改。
275
276
  - manifest 门(`test/publish-manifest.test.ts`)守发布面:入口目标被 `files` 覆盖、宿主包不进 `dependencies`、`dsh-*` 精确钉、产物无本机路径。`test/dist-size.test.ts` 设体积预算,`test/readme-parity.test.ts` 钉两份 README 的结构对等。
276
277