@jayyuen66/dsh-zvec-grep 0.1.20 → 0.1.22

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,20 @@
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.22
6
+
7
+ Moved to the shared 0.3.1 runtime entry points (`./tool` / `./client`) and rebuilt the host through `toolImportTransform` (the client still externalises `/client`). Path validation/normalisation (`assertAbsoluteRoot`, `normalizeAbsolutePath`), `shq` and `versionAtLeast` now come from shared; `lib/cli.ts` keeps only the message-table adapters, and the win32 path regressions move to a dedicated test. Remote readers use shared `parseOrThrow` / `remoteMounterOf`; the settings card uses `useCardDraft`. `@deepseek-ai/dsh-fs-patch` and `@rolldown/plugin-transform-imports` were added to devDependencies (peer window kept in step). The root-session key now follows `parentSession` only when `origin` is `subagent`; side sessions and ordinary forks keep their own quota. The zg 0.3.x contract and the tool surface are unchanged.
8
+
9
+ - 发布面不再随包发 `types/` 声明;`exports["."]` 回到纯运行期映射。
10
+
11
+ ### Fixed
12
+
13
+ - **sandboxPolicy 随会话下发(issue #4)**:`zg_search` / `zg_index` 前台与模型侧后台索引都按当前会话 `resolve({ session })` 并把结果交给 `shell.resolve`;此前不带字段时宿主回落到无会话默认策略(workspace-write 的 root 是部署目录),会话工作区里的 `.zvec-grep/locks/write-intent` 被判只读、检索与 grep/rg 门禁整体死锁。服务缺席、无会话、`resolve` 抛错三档都不带字段、不抛错,降级事实以结果尾注点名原因;远程重建那条入口没有会话,仍按「不带字段」处理。
14
+
15
+ ## 0.1.21
16
+
17
+ 宿主基线切到 `dsh 0.2.3-alpha.2`(Node `^24.22.3 || >=26.13.1`),shared 经 catalog 抬到 `^0.2.13`。root 判据改用会话的活动工作目录(`workingDirectory` 活值优先、服务缺席或无值回落 `header.cwd`),`cd` 之后相对 root 仍按当前目录解析。设置卡随 shared v3 视觉层更新,并新增 `ZgPanelSection` 会话面板段与 roots/server 就绪文案;客户端槽位/清理与路由用例同步。
18
+
5
19
  ## 0.1.20
6
20
 
7
21
  宿主基线抬到 `0.2.2-rc.5`;daemon token 的原子落盘换官方件;上游 zg 0.3.1 的密钥跳过行为对齐。
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%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.5-658EFF?style=flat-square" alt="dsh" />
14
+ <img src="https://img.shields.io/badge/node-%5E24.22.3%7C%7C%3E%3D26.13.1-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.3--alpha.3-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
 
@@ -78,16 +78,18 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
78
78
 
79
79
  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.
80
80
 
81
- - **Node.js `>= 24.9`** (ESM-only; that floor is what makes `require()` of an ESM entry work, hence `engines.node`).
82
- - **Host `dsh` on the `0.2.2-rc.5` line or later.** The host reads `engines.dsh` (`^0.2.2-rc.5`) 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.2-rc.5` passes the host gate; strict npm peer resolution starts at `0.2.2-rc.5`. `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.
83
- - **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.2-rc.5`), while the exact pins in `devDependencies` are the compile-time discipline against a second host type surface - not a claim the host consults.
84
- - **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).
81
+ - **Node.js `^24.22.3 || >=26.13.1`** (ESM-only; `engines.node` follows the host floor, so an installer rejects a Node the host itself will not start on).
82
+ - **Host `dsh` on the `0.2.3-alpha.3` line or later.** The host reads `engines.dsh` (`^0.2.3-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.3-alpha.3` passes the host gate; strict npm peer resolution starts at `0.2.3-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.
83
+ - **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` once keyed its scheduler with a plain `Symbol` on the `0.2.2` host line (removed in `0.2.3`), 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.3-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.
84
+ - **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; `@deepseek-ai/dsh-error` supplies the `HarnessError` base and `@deepseek-ai/dsh-atomic-write` the atomic writer; shared's text helper (`internal/tool/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).
85
85
  - **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.
86
86
 
87
87
  ### <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
88
88
 
89
89
  If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entry, that pin must be at least the version this package declares. A lower pin installs a copy without the names imported at runtime, and the host reports `N entries did not activate` with `does not provide an export named ...` at boot - installs fine, never loads, invisible to per-repository CI.
90
90
 
91
+ Bundle order decides it too: from alpha.3 on, when several bundles insert the same `dsh-plugin-shared` row, the first bundle in `dsh.profile.bundles` that declares the dependency decides which copy loads. Keep that copy at or above the version this package declares, and upgrade mixed old/new plugin sets together. From this release on, the client stylesheets (`meta.stylesheets`) and `ProgressBar` require shared `0.3.2` or later; the `^0.3.1` range only keeps older plugins compatible, so treat `0.3.2` as the effective floor for releases and single-repository CI.
92
+
91
93
  ## <img src="https://api.iconify.design/lucide/circle-check.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Verify it is live
92
94
 
93
95
  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>`.
@@ -117,7 +119,7 @@ If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entr
117
119
 
118
120
  ## <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
119
121
 
120
- 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.
122
+ 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's working directory 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.
121
123
 
122
124
  ### zg_search
123
125
 
@@ -149,8 +151,8 @@ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status);
149
151
 
150
152
  ### Root rules
151
153
 
152
- - `root` is optional in all three tools (defaults to the session workspace). Validation: absolute path starting with `/`, lexically normalised; empty/non-string/NUL/relative/escaping `..` and `/` itself are refused; a missing directory is reported as such, not as a spawn ENOENT.
153
- - A root outside the session workspace passes only via the "ancestor or descendant" branch of the shared predicate (`judgeRoot`), and every accepted root is registered in the observed-workspace whitelist the card's rebuild draws on. Guard and execute share the predicate - nothing is refused twice with different wording.
154
+ - `root` is optional in all three tools (defaults to the session's active working directory — the live `workingDirectory` when the host service provides one, `header.cwd` otherwise; after a `cd`, a relative root still resolves against the current directory). Validation: absolute path starting with `/`, lexically normalised; empty/non-string/NUL/relative/escaping `..` and `/` itself are refused; a missing directory is reported as such, not as a spawn ENOENT.
155
+ - A root outside the session's active working directory passes only via the "ancestor or descendant" branch of the shared predicate (`judgeRoot`), and every accepted root is registered in the observed-workspace whitelist the card's rebuild draws on. Guard and execute share the predicate - nothing is refused twice with different wording.
154
156
 
155
157
  ## <img src="https://api.iconify.design/lucide/ban.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> The search-first gate
156
158
 
@@ -164,36 +166,34 @@ Output is plain text; timeouts 5 min (search) / 10 min (index) / 60 s (status);
164
166
 
165
167
  ## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Settings
166
168
 
167
- 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. An out-of-range numeric draft never reaches `onChange`, so **Save** is blocked while any numeric field is invalid; **Revert** stays enabled, and the save bar names the reason.
169
+ 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. Every visible field carries a one-line hint in the host's language. Defaults, ranges, and effects stay on the card, so this README does not keep a second field table that can drift. `defaultLimit` is the concise exception: the card validates 1–50, and the value sets the default hits per result group when `zg_search` omits `limit` (default 10).
170
+
171
+ An out-of-range numeric draft never reaches `onChange`, so **Save** is blocked while any numeric field is invalid; **Revert** stays enabled, and the save bar names the reason.
172
+
173
+ **Quota semantics.** Each successful index-reading `zg_search` re-arms `grepBudgetPerSearch` grep/rg calls for `unlockWindowMin` minutes, partitioned by root session × index root. Exhaustive lexical search and file listing grant no quota. A same-root rebuild temporarily allows in-scope grep/rg without consuming quota, and a step whose admission excludes `zg_search` is not forced to call it.
174
+
175
+ **Transport and daemon security.** `transport=auto` uses MCP when a daemon is ready and CLI otherwise; `cli` never starts one; `mcp` starts and owns a daemon when absent, with no silent CLI fallback. The default endpoint is loopback `http://127.0.0.1:7999/mcp`; `clientMode` separately controls the CLI's `--mode`. A self-started daemon's random token is persisted with mode 0600 and shared through CLI env plus the MCP Bearer; a user-started daemon is only probed, never stopped.
168
176
 
169
- | Field | Type | Default | Purpose |
170
- | --- | --- | --- | --- |
171
- | `defaultEmbedding` | string | `local/qwen3-embedding-0.6b` | Embedding for **new** indexes; switching an existing one needs a rebuild |
172
- | `defaultLimit` | natural, 1-50 | `10` | Default hit limit for `zg_search` |
173
- | `hfEndpoint` | string | China-reachable HF-compatible mirror | Another mirror, or empty for the official HF |
174
- | `enforceSearchFirst` | boolean | `true` | The search-first gate |
175
- | `grepBudgetPerSearch` | natural, 1-20 | `3` | grep/rg calls each successful search re-arms |
176
- | `unlockWindowMin` | natural, 1-240 | `10` | Minutes that quota stays valid |
177
+ **Rebuild is not a setting.** The card calls `zvecGrepRebuild.roots()`, `rebuild({ root })`, and `status({ jobId })` through the host gateway. `rebuild` returns a `jobId` (or `reused: true` for the same-root running job), and `status` polls that job. This Remote path does not pass through tool admission, so explicit-root approval does not fire; the observed-root whitelist and same-root lock guard it. Without the host job registry it refuses and spawns nothing.
177
178
 
178
- 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.
179
+ 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`, `stdoutMaxBytes=400000`, `rebuildWaitMs=120000`, `clientMode=auto`, `daemonUrl=http://127.0.0.1:7999/mcp`, the remote-embedding trio, and `requireApprovalForExplicitRoot`. Card fields use card runtime value > row config > `.default()`; deployment-only values use row config > `.default()`.
179
180
 
180
181
  ### Remote embedding
181
182
 
182
- Off by default: `allowRemoteEmbedding=false`, `remoteEmbeddingEndpoint=""`, `remoteEmbeddingApiKeyFrom=""`. While off, an explicit embedding must be in the local catalog at assembly time. Once open:
183
+ Off by default: `allowRemoteEmbedding=false`, `remoteEmbeddingEndpoint=""`, `remoteEmbeddingApiKeyFrom=""`. While off, an explicit embedding must be in the local catalog. Once open, only the three remote qwen entries are accepted; workspace content leaves the machine, and zg still requires `--allow-remote` or a one-time grant such as `zg --auth grant <root> --capability embedding --scope workspace`.
183
184
 
184
- - Endpoint and credential reach zg **only via environment variables** (`ZVEC_GREP_ENDPOINT` / `ZVEC_GREP_API_KEY`), never argv - the command string is echoed as a job label on the card.
185
+ - Endpoint and credential reach zg only through `ZVEC_GREP_ENDPOINT` / `ZVEC_GREP_API_KEY`, never argv.
185
186
  - The credential field holds the **name** of the host env var carrying the secret, not the secret; the host scrubs inherited KEY/SECRET/TOKEN names, so only an explicit forward reaches zg.
186
- - The plugin does **not** pass `--allow-remote`: zg still requires a one-time `zg auth grant <root> --capability embedding --scope workspace`.
187
187
 
188
188
  ### Asking before an explicit root
189
189
 
190
- `requireApprovalForExplicitRoot=false` by default. When on, an explicit `root` that would pass via the "ancestor or descendant" branch triggers one user confirmation (`tools/pre-execute` → `{kind:'ask'}` → `ctx.approval`). The ask shares the root predicate (`judgeRoot`), so calls that would be refused anyway - or need no authorization - are not bothered. Three dead ends are known: `never`-approval presets reject the ask deterministically, delegated subagents are pinned to `never` (the switch has no effect there), and a missing approval service fails closed. The confirmation **only ever adds** a step: an out-of-scope root stays refused even after approval.
190
+ `requireApprovalForExplicitRoot=false` by default. When on, an explicit `root` that would pass via the ancestor/descendant branch triggers one user confirmation through `tools/pre-execute` and `ctx.approval`. The session workspace itself and already observed roots do not ask; invalid or out-of-scope roots stay refused. `never` presets reject deterministically, delegated subagents are pinned to `never`, and a missing approval service fails closed. The confirmation only ever adds a step.
191
191
 
192
192
  ## <img src="https://api.iconify.design/lucide/monitor.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Support surface
193
193
 
194
194
  - **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).
195
195
  - **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`).
196
- - **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.
196
+ - **CI splits accordingly**: the ubuntu job is the full gate (including the four 100% coverage thresholds); other platforms run the same typecheck / lint / both bundle builds / full test suite / format check through `check:platform`, without judging coverage.
197
197
 
198
198
  ## <img src="https://api.iconify.design/lucide/cpu.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> External dependency
199
199
 
@@ -237,7 +237,7 @@ A "rebuild workspace" run is one **unowned** job in the host's `ctx.jobs` (`kind
237
237
 
238
238
  | Aspect | Content |
239
239
  | --- | --- |
240
- | 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 |
240
+ | Written to disk | Only one file by this package: the self-started daemon's token at `<ZVEC_GREP_HOME or ~/.zvec-grep>/dsh-zvec-grep.token` (mode 0600), removed after a successful daemon stop. Everything else is zg's: 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 |
241
241
  | What it reads | The index probe: one existence check plus one manifest read |
242
242
  | Network | Only the embedding-weight download driven by `hfEndpoint`, performed by zg. Remote embedding is off by default and is a deployment decision |
243
243
  | 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 |
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%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.5-658EFF?style=flat-square" alt="dsh" />
14
+ <img src="https://img.shields.io/badge/node-%5E24.22.3%7C%7C%3E%3D26.13.1-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.3--alpha.3-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
 
@@ -78,16 +78,18 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
78
78
 
79
79
  卸载用 `dsh plugin --profile web remove @jayyuen66/dsh-zvec-grep`。包在公共 npm registry 上,不需要凭据,也不需要 scoped-registry 配置行。
80
80
 
81
- - **Node.js `>= 24.9`**(纯 ESM;正是这个下限让 `require()` 一枚 ESM 入口成为可能,`engines.node` 因此声明)。
82
- - **宿主 `dsh` 在 `0.2.2-rc.5` 或更新的 `0.2.2` 这条线上。** 宿主读 `engines.dsh`(`^0.2.2-rc.5`)且**单独决定**——该字段在场时兼容性先于 `peerDependencies` 判定,prerelease 参与比较。`0.2.x` 里不低于 `0.2.2-rc.5` 的都通过宿主装载门;npm 的严格 peer 解析从 `0.2.2-rc.5` 起算。`0.3.0` 及以上需要风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <确切版本> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证(判据是宿主 `--dump-config` 里本包的层行;设置卡与它的命名空间调用另在发布基线上全量取证一次),窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
83
- - **按约定,`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.2-rc.5`),`devDependencies` 里的精确钉版才是防「第二份宿主类型」的编译期纪律——那不是宿主会去读的声明。
84
- - **值导入都是必需 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 校验)。
81
+ - **Node.js `^24.22.3 || >=26.13.1`**(纯 ESM;`engines.node` 跟随宿主下限,安装器会拒掉宿主自己都起不来的 Node)。
82
+ - **宿主 `dsh` 在 `0.2.3-alpha.3` 这条线上(含更晚的 `0.2.x`)。** 宿主读 `engines.dsh`(`^0.2.3-alpha.3`)且**单独决定**——该字段在场时兼容性先于 `peerDependencies` 判定,prerelease 参与比较。`0.2.x` 里不低于 `0.2.3-alpha.3` 的都通过宿主装载门;npm 的严格 peer 解析从 `0.2.3-alpha.3` 起算。`0.3.0` 及以上需要风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <确切版本> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证(判据是宿主 `--dump-config` 里本包的层行;设置卡与它的命名空间调用另在发布基线上全量取证一次),窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
83
+ - **按约定,`dependencies` 下不放任何 `@deepseek-ai/*`**(`test/publish-manifest.test.ts` 钉住)。profile 以 `nodeLinker: hoisted` 与 `autoInstallPeers: false` 安装,宿主包在那里会落成真实的第二份副本;`@deepseek-ai/dsh-tools` 曾在宿主 `0.2.2` 线用普通 `Symbol` 给调度器做键(该键在 `0.2.3` 源码里已移除),那个 profile 里**每一次原生工具调用都抛错**,而构建、类型检查与覆盖率照绿。`@deepseek-ai/dsh*` 的 peer 写同一条支持窗口范围(`^0.2.3-alpha.3`),`devDependencies` 里的精确钉版才是防「第二份宿主类型」的编译期纪律——那不是宿主会去读的声明。
84
+ - **值导入都是必需 peer。** `@deepseek-ai/schemastery` 是宿主 fork(只有它的 `resolve` 认 `.volatile()` 字段);`@deepseek-ai/dsh-typert-protocol` 提供 `TypertRemoteService` 这个要 `extends` 的类;`@deepseek-ai/dsh-scope` 提供步骤准入判定用的 `scopeOf`;`@deepseek-ai/dsh-error` 提供 `HarnessError` 基类、`@deepseek-ai/dsh-atomic-write` 提供原子写入;shared 的文本模块(`internal/tool/text`)自己值导入 `@deepseek-ai/dsh-output-retention`。六者都落 peer 加同版精确钉的 devDependencies——缺一枚就是装载期 `ERR_MODULE_NOT_FOUND`,不是优雅降级。`dependencies` 里是 `@jayyuen66/dsh-plugin-shared` 与 `zod`(后者版本走伞根 catalog,供设置卡的 strict codec 校验)。
85
85
  - **随包发什么**:`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` 现产,不入库。
86
86
 
87
87
  ### <img src="https://api.iconify.design/lucide/arrow-down-to-line.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> shared 的版本下限
88
88
 
89
89
  如果你的 profile 用 pnpm `overrides` 把 `@jayyuen66/dsh-plugin-shared` 钉在某个版本,那个值必须不低于本包声明的版本。钉得更低就会装到一份缺少运行期所导入名字的产物,宿主起来时报 `N entries did not activate` 加 `does not provide an export named ...`——包装得上、永远不加载,单仓 CI 看不见。
90
90
 
91
+ bundle 顺序也会决定这件事:alpha.3 起,多个 bundle 插入同名 `dsh-plugin-shared` 行时,由 `dsh.profile.bundles` 里最靠前且声明该依赖的 bundle 决定加载哪份。请让最终拿到的那份不低于本包声明的版本;混装新旧插件时先统一升级。 本版起的客户端样式表(`meta.stylesheets`)与 `ProgressBar` 需要 shared `0.3.2` 或更晚;`^0.3.1` 的范围只为兼容旧插件,发布与单仓 CI 请以 `0.3.2` 作为实际下限。
92
+
91
93
  ## <img src="https://api.iconify.design/lucide/circle-check.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 确认它真的在工作
92
94
 
93
95
  1. **层已经进栈。** `dsh --profile web --dump-config` 末尾出现 `# == @jayyuen66/dsh-zvec-grep` 加 `- id: zvec-grep`。这条命令是唯一被接受的判据,而且**不是只读命令**——层行从 stdout 读,**并且**单独检查 stderr;`# == <layer>` 与 `# == <layer>, patched by <path>` 两种形态都要认。
@@ -117,7 +119,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
117
119
 
118
120
  ## <img src="https://api.iconify.design/lucide/search.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 提供给模型的工具
119
121
 
120
- 输出为纯文本;超时 5 分钟(search)/ 10 分钟(index)/ 60 秒(status);stdout 上限 400000 字节,超限截尾并提示。沙箱 runner 失败、策略拒绝与 zg 自身失败分开归因;结果可能不完整时显式打标。`root` 必须是字符串,构造出的命令按 UTF-8 字节(不是码元)封顶:非字符串的 root 与超长命令直接拒绝,不会回落到会话工作区,也不会撞上内核参数上限。`limit` 越出 1-50 同样直接拒绝并点名区间,不会静默钳制——钳过的少结果会被模型当成这次检索的事实;省略则用默认值。
122
+ 输出为纯文本;超时 5 分钟(search)/ 10 分钟(index)/ 60 秒(status);stdout 上限 400000 字节,超限截尾并提示。沙箱 runner 失败、策略拒绝与 zg 自身失败分开归因;结果可能不完整时显式打标。`root` 必须是字符串,构造出的命令按 UTF-8 字节(不是码元)封顶:非字符串的 root 与超长命令直接拒绝,不会回落到会话的工作目录,也不会撞上内核参数上限。`limit` 越出 1-50 同样直接拒绝并点名区间,不会静默钳制——钳过的少结果会被模型当成这次检索的事实;省略则用默认值。
121
123
 
122
124
  ### zg_search
123
125
 
@@ -149,8 +151,8 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
149
151
 
150
152
  ### root 判据
151
153
 
152
- - 三者的 root 都可省略(缺省=当前会话工作区)。校验:以 `/` 开头的绝对路径、词典归一;空串/非字符串/NUL/相对路径/越界的 `..`、归一后为 `/` 都拒;目录不存在单报「root 目录不存在」,不冒成 spawn ENOENT。
153
- - 会话工作区之外的 root 只有走共享判据(`judgeRoot`)的「祖先/后代」分支才放行,且每个过判据的 root 都登记进卡片重建所用的观测白名单。guard 与 execute 同一套判据——不会同一件事拒两遍、说法还不同。
154
+ - 三者的 root 都可省略(缺省=会话的活动工作目录:宿主服务在场且给出活值时用它,否则回落 `header.cwd`;`cd` 之后相对 root 仍按当前目录解析)。校验:以 `/` 开头的绝对路径、词典归一;空串/非字符串/NUL/相对路径/越界的 `..`、归一后为 `/` 都拒;目录不存在单报「root 目录不存在」,不冒成 spawn ENOENT。
155
+ - 会话活动工作目录之外的 root 只有走共享判据(`judgeRoot`)的「祖先/后代」分支才放行,且每个过判据的 root 都登记进卡片重建所用的观测白名单。guard 与 execute 同一套判据——不会同一件事拒两遍、说法还不同。
154
156
 
155
157
  ## <img src="https://api.iconify.design/lucide/ban.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> search-first 门禁
156
158
 
@@ -164,36 +166,34 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
164
166
 
165
167
  ## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 设置项
166
168
 
167
- 命名空间 `zvec-grep` 即设置条目 id;schema 共 18 个字段、逐字段带内置默认,其中卡上那 7 枚标 `.volatile()`。越界数字草稿不会进 `onChange`,所以只要有数字字段越界,**保存**就被禁用(**撤销**保持可点),保存条同时点名原因。
169
+ 命名空间 `zvec-grep` 即设置条目 id;schema 共 18 个字段、逐字段带内置默认,其中卡上那 7 枚标 `.volatile()`。每个可见字段都自带一行随宿主语言显示的提示。默认值、范围与作用以卡片为准,本文不再重复字段表。`defaultLimit` 只补一条简短说明:卡片校验 1–50,该值决定 `zg_search` 省略 `limit` 时每组结果默认返回多少条命中(默认 10)。
170
+
171
+ 越界数字草稿不会进 `onChange`,所以只要有数字字段越界,**保存**就被禁用(**撤销**保持可点),保存条同时点名原因。
172
+
173
+ **配额语义。** 每次成功读取索引的 `zg_search` 重新发放 `grepBudgetPerSearch` 次、`unlockWindowMin` 分钟有效的 grep/rg 配额,按「根会话 × 索引根」分片。穷举词法检索与文件清单不发放配额。同根重建期间,界内 grep/rg 临时放行且不消耗配额;本步骤准入不含 `zg_search` 时,门禁不强迫模型调用它。
174
+
175
+ **传输与守护进程安全。** `transport=auto` 在 daemon 就绪时走 MCP,否则走 CLI;`cli` 永不主动启动 daemon;`mcp` 缺席时自启并持有 daemon,失败时不静默回退 CLI。默认端点是回环地址 `http://127.0.0.1:7999/mcp`;`clientMode` 另控 CLI 的 `--mode`。自启 daemon 的随机 token 以 0600 权限持久化,同时经 CLI 环境变量与 MCP Bearer 使用;用户自启的 daemon 只被探测,插件不会停掉它。
168
176
 
169
- | 字段 | 类型 | 默认值 | 作用 |
170
- | --- | --- | --- | --- |
171
- | `defaultEmbedding` | string | `local/qwen3-embedding-0.6b` | **新建**索引用的 embedding;已有索引切换后需重建 |
172
- | `defaultLimit` | natural,1-50 | `10` | zg_search 默认命中条数上限 |
173
- | `hfEndpoint` | string | 国内可达的 HF 兼容镜像 | 可改别的镜像,留空走官方 HF |
174
- | `enforceSearchFirst` | boolean | `true` | search-first 门禁 |
175
- | `grepBudgetPerSearch` | natural,1-20 | `3` | 每次成功检索重新武装的 grep/rg 次数 |
176
- | `unlockWindowMin` | natural,1-240 | `10` | 配额有效分钟数 |
177
+ **Rebuild 不是设置项。** 卡片经宿主网关调用 `zvecGrepRebuild.roots()`、`rebuild({ root })` 与 `status({ jobId })`。`rebuild` 交回 `jobId`(同根已有作业时交回 `reused: true`),`status` 轮询该作业。这条 Remote 路径不走工具准入,因此显式 root 审批不会触发;观测根白名单与同根锁负责约束。宿主没有作业注册表时明确拒绝且不启动进程。
177
178
 
178
- 另有**非 volatile 部署值**,共 11 枚不进卡片,cordis.yml 行 `config:` 是唯一改值入口:searchTimeoutMs=300000、statusTimeoutMs=60000、indexTimeoutMs=600000(也是重建 kill 定时器时长)、stdoutMaxBytes=400000、clientMode=auto、daemonUrl=http://127.0.0.1:7999/mcp、rebuildWaitMs=120000,加远程 embedding 三件套与 requireApprovalForExplicitRoot(见下两小节)。优先级:卡值 > 行 config > `.default()`;行里显式缺省的字段不覆盖默认。
179
+ 另有**非 volatile 部署值**,共 11 枚不进卡片,`cordis.yml` 行 `config:` 是唯一改值入口:`searchTimeoutMs=300000`、`statusTimeoutMs=60000`、`indexTimeoutMs=600000`、`stdoutMaxBytes=400000`、`rebuildWaitMs=120000`、`clientMode=auto`、`daemonUrl=http://127.0.0.1:7999/mcp`、远程 embedding 三件套与 `requireApprovalForExplicitRoot`。卡片字段的优先级是卡片运行时值 > 行 config > `.default()`;仅部署值没有卡片层,优先级是行 config > `.default()`。
179
180
 
180
181
  ### 远程 embedding
181
182
 
182
- 默认全关:`allowRemoteEmbedding=false`、`remoteEmbeddingEndpoint=""`、`remoteEmbeddingApiKeyFrom=""`。关着时,显式 embedding 必须落在本地候选清单里。打开后:
183
+ 默认全关:`allowRemoteEmbedding=false`、`remoteEmbeddingEndpoint=""`、`remoteEmbeddingApiKeyFrom=""`。关着时,显式 embedding 必须落在本地候选清单里。打开后只接受三枚远程 qwen;工作区内容会离开本机,zg 仍要求 `--allow-remote` 或一次工作区授权,例如 `zg --auth grant <root> --capability embedding --scope workspace`。
183
184
 
184
- - 端点与凭据**只经环境变量**下发(`ZVEC_GREP_ENDPOINT` / `ZVEC_GREP_API_KEY`),绝不进 argv——整条命令会作为作业 label 回显在卡片上。
185
+ - 端点与凭据只经 `ZVEC_GREP_ENDPOINT` / `ZVEC_GREP_API_KEY` 交给 zg,绝不进入 argv。
185
186
  - 凭据那项填的是**宿主进程里装凭据的环境变量名**,不是密钥本身;宿主会剔掉名字含 KEY/SECRET/TOKEN 的继承变量,必须由本插件显式转发才到得了 zg。
186
- - 本插件**不代传 `--allow-remote`**:zg 还要用户自己跑一次 `zg auth grant <root> --capability embedding --scope workspace`。
187
187
 
188
188
  ### 显式 root 前的确认
189
189
 
190
- `requireApprovalForExplicitRoot` 默认 `false`。打开后,显式给了 root、且要靠「祖先/后代」分支放行的调用会经官方 `tools/pre-execute` → `{kind:'ask'}` → `ctx.approval` 弹一次用户确认。发问判据与 root 判据同源(`judgeRoot`),注定被拒或本就无需授权的调用不受打扰。三处死路已知:`never` 审批预设确定性拒绝、委派子代理被钉死 `never`(开关对其无效)、无 approval 服务时 fail-closed。这道确认**只加不减**:越界的 root 即便「已批准」照旧被拒。
190
+ `requireApprovalForExplicitRoot` 默认 `false`。打开后,显式给了 root、且要靠「祖先/后代」分支放行的调用会经 `tools/pre-execute` 与 `ctx.approval` 弹一次用户确认。会话工作区本身与已经观测过的 root 不问;非法或越界 root 照旧拒绝。`never` 预设会确定性拒绝,委派子代理被钉死 `never`,缺少审批服务时 fail-closed。这道确认**只加不减**:越界 root 即便「已批准」照旧被拒。
191
191
 
192
192
  ## <img src="https://api.iconify.design/lucide/monitor.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 支持面
193
193
 
194
194
  - **POSIX 与 Windows 宿主。** root 判据在 POSIX 上收 `/…`,在 Windows 上收盘符(`C:\…`、`C:/…`)与 UNC(`\\server\share\…`);命令行在 POSIX 上用 bash 单引号转义、在 Windows 上用 pwsh 转义;grep/rg 门禁的切词跟同一方言(POSIX 反斜杠转义,Windows 反引号转义并认 `rg.exe`/`grep.exe`)。
195
195
  - **Windows 有测试兜着,不是猜的。** 平台注入的 win32 夹具在任意宿主上跑;CI 的 `windows-latest` 格跑真实临时工作区用例;ubuntu 格仍是唯一判四项 100% 覆盖率阈值的格子(分工理由见 `.github/workflows/ci.yml`)。
196
- - **CI 照此分工**:ubuntu 格是全部门禁(含四项 100% 覆盖率);其它平台只跑不依赖盘上真工作区的检查、不判覆盖率。
196
+ - **CI 照此分工**:ubuntu 格是全部门禁(含四项 100% 覆盖率);其它平台经 `check:platform` 跑同一套 typecheck / lint / 两个 bundle / 全量用例 / 格式检查,只是不判覆盖率。
197
197
 
198
198
  ## <img src="https://api.iconify.design/lucide/cpu.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 外部依赖
199
199
 
@@ -237,7 +237,7 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
237
237
 
238
238
  | 规则 | 内容 |
239
239
  | --- | --- |
240
- | 写盘 | 本包不写任何文件。写到磁盘形状归 zg:检索根下的 `.zvec-grep/` 索引目录、全局 home `~/.zvec-grep`(config/锁/模型)与 embedding 权重缓存;宿主数据目录里什么都不落 |
240
+ | 写盘 | 本包只写一个文件:自启 daemon 的 token,位于 `<ZVEC_GREP_HOME 或 ~/.zvec-grep>/dsh-zvec-grep.token`(0600),停 daemon 成功后删除。写到磁盘的其余形状归 zg:检索根下的 `.zvec-grep/` 索引目录、全局 home `~/.zvec-grep`(config/锁/模型)与 embedding 权重缓存;宿主数据目录里什么都不落 |
241
241
  | 本包读什么 | 索引探测:一次存在性检查加读一次清单 |
242
242
  | 网络 | 只有 zg 按 hfEndpoint 下载 embedding 权重。远程 embedding 默认关闭、属部署决定 |
243
243
  | 密钥排除 | 默认排除、大小写不敏感、且排在你的路径规则之后:`*.pem` / `*.key` / `*.p12` / `*.pfx` / `*.keystore` / `*.jks` / `*.ppk` / `id_rsa*` / `id_ed25519*`(excludeSecrets=false 可关)。**无扩展名**的密钥文件不覆盖——走 ignoreFiles 声明 |
@@ -13,14 +13,14 @@
13
13
  上游由用户自行 `npm install -g @zvec/zvec-grep` 安装。正因如此,本包不随包附上游的许可文本:
14
14
  Apache-2.0 第 4 条的再分发条件挂在「被再分发的第三方代码」上,而本包里没有那段代码。若把两者
15
15
  打包在一起再分发,请按各自许可分别保留声明。
16
- - 派生数据:`lib/embedding-catalog.ts` 的本地模型条目抄自上游 `0.2.2` 的 `EMBEDDING_MODEL_CATALOG`
16
+ - 派生数据:`lib/embedding-catalog.ts` 的本地模型条目抄自上游 `0.3.0` 的模型目录
17
17
  (只取「引用 / 后端 / 维度」三列),`lib/routing.ts` 的工作区清单文件名等常量与上游同名同值。这些
18
18
  是名称与数值一类的派生数据,不含上游实现代码;上游改了名称表时由 `verify:env` 与这一族用例发现。
19
19
  再分发时请连同上游的 Apache-2.0 声明一起保留。
20
- - 版本契约:命令形态与旗标名按 `0.2.2` 书写;低于该版本本包在下发任何命令之前停住并点名实际版本
20
+ - 版本契约:命令形态与旗标名按 `0.3.0` 书写;低于该版本本包在下发任何命令之前停住并点名实际版本
21
21
  (判据在 `lib/zg-version.ts`)。这是本包自负的责任边界——上游改了旗标语义却没升主版本时,只有
22
22
  这一族用例与那道版本门能发现。这道门是 **fail-open**:只认「整串就是一个三段数字」(`v` 前缀与
23
- 首尾空白容忍),读不懂(多行、`0.2.2-rc.1`、`>=0.2.2`、探测失败)一律放行而不是拦死命令——把
23
+ 首尾空白容忍),读不懂(多行、`0.3.0-rc.1`、`>=0.3.0`、探测失败)一律放行而不是拦死命令——把
24
24
  「探测不到」判成「太旧」,等于拿一个猜出来的版本拦住真实用户。
25
25
  - 数据边界:索引与向量库(`.zvec-grep/`、`manifest.json`)由上游读写。本包只读 `manifest.json` 的
26
26
  `manifestVersion` 与 `rootPaths[].absolutePath`,用于「这份清单是不是本包认得的索引、覆不覆盖目标根」
package/client.js CHANGED
@@ -5,7 +5,7 @@ window.__ModuleLoader__.load({
5
5
  'use strict';
6
6
  const module = { exports: {} };
7
7
  let exports = module.exports;
8
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("zod"),n=require("@jayyuen66/dsh-plugin-shared/client");const r=`transformers-js`,i=Object.freeze([{reference:`local/qwen3-embedding-0.6b`,backend:`llama-cpp`,dimension:1024},{reference:`local/embeddinggemma-300m`,backend:`llama-cpp`,dimension:768},{reference:`local/potion-code-16m-v2`,backend:`model2vec`,dimension:256},{reference:`local/potion-multilingual-128m`,backend:`model2vec`,dimension:256},{reference:`local/potion-retrieval-32m`,backend:`model2vec`,dimension:512},{reference:`local/bge-small-en-v1.5`,backend:r,dimension:384},{reference:`local/all-minilm-l6-v2`,backend:r,dimension:384},{reference:`local/multilingual-e5-small`,backend:r,dimension:384},{reference:`local/jina-embeddings-v2-base-code`,backend:r,dimension:768},{reference:`local/gte-modernbert-base`,backend:r,dimension:768},{reference:`local/nomic-embed-text-v1.5`,backend:r,dimension:768}].map(e=>Object.freeze(e))),a=Object.freeze([{reference:`qwen/qwen3-vl-embedding`,dimension:2560},{reference:`qwen/qwen3.7-text-embedding`,dimension:1024},{reference:`qwen/text-embedding-v4`,dimension:1024}].map(e=>Object.freeze(e)));function o(e,t){return Object.hasOwn(e,t)}function s(e,t,n){return o(e,n)?e[n]:Object.hasOwn(t,n)?t[n]:void 0}function c(e,t){return typeof e==`number`&&Number.isFinite(e)?String(e):t}function l(e){let t;return e===!0?t=`daemonReadyNote`:e===!1&&(t=`daemonOfflineNote`),t}function u(e){let t={status:`loading`,writable:!1,value:{}},n=null,r=t;return{getSnapshot(){let t=e.getSnapshot();return t!==n&&(n=t,r={status:t.status,writable:t.writable,value:t.value??{}}),r},subscribe(t){return e.subscribe(t)}}}function d(e,t,n,r){let i=s(e,t,n);return i===void 0?o(e,n)?``:r:c(i,r)}const f=t.z.url({protocol:/^https?$/u});function p(e,t){if(Object.hasOwn(e,`hfEndpoint`)){let t=e.hfEndpoint;return typeof t==`string`?t:``}let n=t.hfEndpoint;return typeof n==`string`&&f.safeParse(n).success?n:``}function m(e,t){let n=s(e,t,`defaultEmbedding`),r=s(e,t,`enforceSearchFirst`),i=s(e,t,`transport`);return{embedding:typeof n==`string`&&n.length>0?n:`local/qwen3-embedding-0.6b`,limitDisplay:d(e,t,`defaultLimit`,`10`),hfEndpoint:p(e,t),enforceSearchFirst:r!==!1,grepBudget:d(e,t,`grepBudgetPerSearch`,`3`),unlockWindow:d(e,t,`unlockWindowMin`,`10`),transport:i===`cli`||i===`mcp`||i===`auto`?i:`auto`}}const h=t.z.int().min(1).max(50),g=t.z.int().min(1).max(20),_=t.z.int().min(1).max(240),v=[`running`,`stopping`,`completed`,`killed`,`failed`],y=t.z.object({status:t.z.preprocess(e=>typeof e==`string`&&v.some(t=>t===e)?e:void 0,t.z.enum(v).optional()),exitCode:t.z.preprocess(e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,t.z.number().optional()),output:t.z.preprocess(e=>typeof e==`string`?e:void 0,t.z.string().optional())});function b(e,t){let n=y.safeParse(e),{status:r,exitCode:i,output:a}=n.success?n.data:{},o=a??``;if(r===`running`||r===`stopping`)return{phase:`running`,output:o.length>0?o:t(`rebuildRunning`)};if(r===`completed`&&i===0)return{phase:`done`,output:o};let s;return s=r===`killed`?t(`rebuildKilled`):r===`failed`?t(`rebuildFailed`):typeof i==`number`&&Number.isFinite(i)?t(`rebuildExitCode`,{exitCode:i}):t(`rebuildExitUnknown`),{phase:`error`,output:o.length>0?`${s}\n${o}`:s}}function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const S=e=>x(e)&&typeof e.$mount==`function`,C=`zvecGrepRebuild`,w=`remote.${C}`,T=`@jayyuen66/dsh-zvec-grep`;function E(e,n){let r=e.safeParse(n);if(!r.success)throw TypeError(t.z.prettifyError(r.error));return r.data}const D=t.z.object({root:t.z.string({error:`rebuild request requires a string root`}).trim().min(1,{error:`rebuild request requires a non-empty root`})},{error:`rebuild request requires a string root`}),O=t.z.object({jobId:t.z.string({error:`rebuild status request requires a string jobId`}).trim().min(1,{error:`rebuild status request requires a non-empty jobId`})},{error:`rebuild status request requires a string jobId`}),ee=[{id:`${T}#${C}/roots`,service:C,namespace:C,method:`roots`,invocation:{kind:`direct`},parameters:[],result:{mode:`src-json`}},{id:`${T}#${C}/rebuild`,service:C,namespace:C,method:`rebuild`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${T}#rebuild-request`,create:()=>({parse(e){return E(D,e)}})}}],result:{mode:`src-json`}},{id:`${T}#${C}/status`,service:C,namespace:C,method:`status`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${T}#rebuild-status-request`,create:()=>({parse(e){return E(O,e)}})}}],result:{mode:`src-json`}}],k=e=>(0,n.isRecord)(e)&&typeof e.roots==`function`&&typeof e.rebuild==`function`&&typeof e.status==`function`;async function A(e){let t=await e;if(t.ok)return t.value;throw Error(`${t.error.code}: ${t.error.message}`)}function j(e,t){let n,r=async()=>{let r=e.get?.(`remote`);if(!S(r))throw Error(t.remoteMissing());try{n??=r.$mount({package:T,descriptors:ee}),await n}catch(e){throw n=void 0,e}let i=e.get?.(w);if(!k(i))throw Error(t.namespaceMissing(w));return i};return{async roots(){return A((await r()).roots())},async rebuild(e){let t=await A((await r()).rebuild({root:e}));if(t.ok)return t;throw Error(t.error)},async status(e){let t=await A((await r()).status({jobId:e}));if(t.ok)return{...t};throw Error(t.error)}}}function M(e,t){return typeof e.get==`function`?j(e,t):void 0}const N=`https://modelscope.cn/models`,te={zh:{statusReadOnly:`当前作用域只读`,statusClean:`无未保存的修改`,dirtyCount:`已修改 {count} 项`,save:`保存`,saving:`保存中…`,revert:`撤销`,saveFailed:`保存失败:{reason}`,invalidFields:`有字段超出范围,先修正或撤销后再保存。`,saveRejected:`保存被宿主拒绝(配置校验未通过或写入被跳过),修改未生效`,modelSection:`检索模型`,fieldCount:`{count} 字段`,indexSection:`网络与索引`,unitResults:`条`,unitTimes:`次`,unitMinutes:`分钟`,outOfRange:`超出允许范围,未保存`,embeddingLabel:`默认 embedding`,embeddingHint:`本地模型直接可选;远程 qwen 模型需在插件部署配置里打开 allowRemoteEmbedding(内容会送往外部端点,首次索引需 zg --auth grant 授权)。只影响「新建」索引;切换并保存后,已有索引需点下方「重建」重新 embedding`,transportLabel:`检索传输方式`,transportHint:`自动 = 守护进程在跑时检索走 MCP(常驻模型池、队列调度),否则走 CLI;仅 CLI = 永不碰守护进程;仅 MCP = 检索恒走守护进程,缺席时由插件自动拉起(会开 127.0.0.1:7999 回环端口;拉起失败会明确报错而不是回退 CLI)`,transportAuto:`自动(守护进程在跑走 MCP,否则 CLI)`,transportCli:`仅 CLI(每次 spawn zg 进程)`,transportMcp:`仅 MCP(走守护进程,缺席自动拉起)`,backendRemote:`qwen 远程(内容出本机,需部署开放并授权)`,limitLabel:`默认每组结果数`,limitInvalid:`请输入 {min}-{max} 的整数`,limitClamped:`已钳到 {min}-{max} 范围:{value}`,endpointLabel:`HuggingFace 镜像地址`,endpointHint:`留空走 huggingface.co;国内网络可填 ${N} 等兼容镜像(仅 llama-cpp 后端生效,如 qwen3)`,enforceLabel:`强制 search-first(先 zg_search 再 grep/rg)`,enforceHint:`开启后,已建索引工作区内的 grep/rg 受配额门禁约束:每次成功 zg_search 解锁下方次数的 grep/rg(时效见下),用尽或过期后再次拦截(提高检索覆盖与准确性)`,budgetLabel:`每次 zg_search 解锁的 grep/rg 次数`,budgetHint:`配额越小语义检索越频繁、准确性约束越强;清空恢复默认 {default}`,windowLabel:`解锁时效`,windowHint:`超过该时长未再次 zg_search,配额整体过期;清空恢复默认 {default}(单位:分钟)`,rebuildLabel:`工作区重建(切换 embedding 并保存后执行)`,rebuildInputPlaceholder:`/workspace 的绝对路径`,daemonReadyNote:`守护进程:就绪(zg --server 在跑)。`,daemonOfflineNote:"守护进程:未就绪。守护进程提供的索引增量刷新、refresh=background 与常驻模型池在缺席时都不可用;需要时在终端执行 `zg --server on`。",rebuildHint:`以当前默认模型重建:{embedding};等价于 zg --index --rebuild。{roots}`,rootsNoteWith:`候选工作区来自本 daemon 已打开过的会话(服务端白名单)。`,rootsNoteEmpty:`尚无可选工作区:先在该工作区里开一个会话(任一次工具调用即登记)。`,rebuildButton:`重建索引(动作,点击即执行)`,rebuildRunning:`重建中…`,rebuildDone:`重建完成`,rebuildStatusTitle:`重建作业`,rebuildStarting:`正在后台重建索引…(首次会下载 embedding 模型,可能较慢)`,rebuildKilled:`重建进程被终止`,rebuildFailed:`重建作业被宿主注册表判定失败(没拿到进程退出码)`,rebuildExitCode:`重建进程退出码 {exitCode}(zg 未安装/权限不足/沙箱拒绝都会走到这里)`,rebuildExitUnknown:`重建没有可判定的结果(应答的 status 无法识别,或缺少进程退出码)`,rebuildMissingJobId:`启动重建失败:应答缺 jobId`,rebuildRootNotAbsolute:`root 必须是绝对路径(以 / 开头)`,rebuildUnavailable:`宿主没有提供工作区重建读面(未装远程服务)`,rebuildRemoteMissing:`工作区重建读面不可用:宿主网关没有提供 remote 服务`,rebuildNamespaceMissing:`{serviceKey} 未提供:宿主网关没有挂上这枚命名空间`,modelOption:`{reference}({dimension}维)`,backendLlamaCpp:`llama-cpp(原生,需 node-llama-cpp)`,backendTransformersJs:`transformers-js(纯 JS ONNX)`,backendModel2Vec:`model2vec(纯 JS worker,最轻)`},en:{statusReadOnly:`This scope is read-only`,statusClean:`No unsaved changes`,dirtyCount:`{count} changed`,save:`Save`,saving:`Saving…`,revert:`Revert`,saveFailed:`save failed: {reason}`,invalidFields:`Some fields are out of range; fix them or revert before saving.`,saveRejected:`save rejected by host (validation failed or write skipped) — changes not applied`,modelSection:`Retrieval model`,fieldCount:`{count} fields`,indexSection:`Network and index`,unitResults:`hits`,unitTimes:`times`,unitMinutes:`minutes`,outOfRange:`Out of the allowed range — not saved`,embeddingLabel:`Default embedding`,embeddingHint:`Local models are always selectable; the remote qwen models additionally require allowRemoteEmbedding in the deployment config (content leaves the machine, and the first index build needs a zg --auth grant). Affects newly built indexes only; after switching and saving, press Rebuild below to re-embed existing indexes`,transportLabel:`Search transport`,transportHint:`auto = searches go through the daemon (MCP) when it is running, CLI otherwise; CLI-only = never touch the daemon; MCP-only = searches always go through the daemon, auto-starting it when absent (opens the 127.0.0.1:7999 loopback port; a failed start is reported explicitly, never silently downgraded to CLI)`,transportAuto:`auto (daemon → MCP, otherwise CLI)`,transportCli:`CLI only (spawn zg each call)`,transportMcp:`MCP only (via daemon, auto-started when absent)`,backendRemote:`qwen remote (content leaves the machine; needs the deployment switch + grant)`,limitLabel:`Default hits per group`,limitInvalid:`enter an integer between {min} and {max}`,limitClamped:`clamped into the {min}-{max} range: {value}`,endpointLabel:`HuggingFace mirror URL`,endpointHint:`Leave empty for huggingface.co; on networks that cannot reach HF, fill a compatible mirror such as ${N} (llama-cpp backends only, e.g. qwen3)`,enforceLabel:`Enforce search-first (zg_search before grep/rg)`,enforceHint:`When on, grep/rg inside indexed workspaces is quota-gated: each successful zg_search unlocks the number of grep/rg calls below (valid for the window below), and the gate blocks again once it is spent or expired (better coverage and relevance)`,budgetLabel:`grep/rg calls unlocked per zg_search`,budgetHint:`A smaller quota means more semantic searches and a stronger relevance constraint; clear to restore the default {default}`,windowLabel:`Unlock window`,windowHint:`Without another zg_search inside this window the whole quota expires; clear to restore the default {default} (minutes)`,rebuildLabel:`Workspace rebuild (run after switching embedding and saving)`,rebuildInputPlaceholder:`absolute path to a /workspace`,daemonReadyNote:`Daemon: ready (zg --server is running).`,daemonOfflineNote:"Daemon: not ready. What the daemon provides — incremental index refresh, refresh=background and the resident embedding model pool — is unavailable while it is absent; run `zg --server on` in a terminal when you want it.",rebuildHint:`Rebuild with the current default model: {embedding}; same as zg --index --rebuild. {roots}`,rootsNoteWith:`Candidates come from sessions this daemon already opened (server-side whitelist).`,rootsNoteEmpty:`No workspace to pick yet: open a session in that workspace first (any tool call registers it).`,rebuildButton:`Rebuild index (action, runs on click)`,rebuildRunning:`rebuilding…`,rebuildDone:`rebuild finished`,rebuildStatusTitle:`rebuild job`,rebuildStarting:`Rebuilding in the background… (the first run downloads the embedding model and may be slow)`,rebuildKilled:`the rebuild process was terminated`,rebuildFailed:`the host job registry reported the rebuild as failed (no process exit code)`,rebuildExitCode:`the rebuild process exited with code {exitCode} (missing zg, insufficient permissions and sandbox denials all land here)`,rebuildExitUnknown:`the rebuild has no determinable outcome (the response status is unrecognized, or its exit code is missing)`,rebuildMissingJobId:`failed to start the rebuild: the response has no jobId`,rebuildRootNotAbsolute:`root must be an absolute path (starting with /)`,rebuildUnavailable:`the host does not expose the rebuild Remote API`,rebuildRemoteMissing:`the rebuild Remote API is unavailable: the host gateway provides no remote service`,rebuildNamespaceMissing:`{serviceKey} was not provided: the host gateway did not mount this namespace`,modelOption:`{reference} ({dimension} dims)`,backendLlamaCpp:`llama-cpp (native, requires node-llama-cpp)`,backendTransformersJs:`transformers-js (pure JS ONNX)`,backendModel2Vec:`model2vec (pure JS worker, lightest)`}},P=String.fromCodePoint(92),F=/^[A-Za-z]:[\\/]/u,I=`zvec-grep`,L=[`llama-cpp`,`transformers-js`,`model2vec`],R=`zgc-rebuild-root-options`,z={"llama-cpp":`backendLlamaCpp`,"transformers-js":`backendTransformersJs`,model2vec:`backendModel2Vec`};function B(e){return e.value}function V(e,t,n){return e(`modelOption`,{reference:t,dimension:n})}function H(e,t,n){return e(`rebuildHint`,{embedding:t,roots:e(n?`rootsNoteWith`:`rootsNoteEmpty`)})}function U(e){let t=[];for(let n of L)for(let r of i)r.backend===n&&t.push({value:r.reference,label:V(e,r.reference,r.dimension),group:e(z[n])});for(let n of a)t.push({value:n.reference,label:V(e,n.reference,n.dimension),group:e(`backendRemote`)});return t}const W=[{value:`auto`},{value:`cli`},{value:`mcp`}],G={auto:`transportAuto`,cli:`transportCli`,mcp:`transportMcp`};function K(e){return W.map(t=>({value:t.value,label:e(G[t.value])}))}function q(e,t){let n=t.safeParse(e===``?NaN:Number(e));return n.success?n.data:void 0}function J(t){let{editable:r,fields:i,setField:a,t:o}=t,s=(0,e.createElement)(n.SelectField,{label:o(`embeddingLabel`),...(0,n.splitHint)(o(`embeddingHint`)),field:`defaultEmbedding`,value:i.embedding,options:U(o),disabled:!r,onChange:e=>{a(`defaultEmbedding`,e)}}),c=(0,e.createElement)(n.NumberField,{label:o(`limitLabel`),hint:o(`limitInvalid`,{min:1,max:50}),field:`defaultLimit`,value:q(i.limitDisplay,h),min:h.minValue??1,max:h.maxValue??50,step:1,unit:o(`unitResults`),invalidHint:o(`outOfRange`),disabled:!r,resetToken:t.resetToken,onInvalidChange:e=>{t.reportInvalid(`defaultLimit`,e)},onChange:e=>{a(`defaultLimit`,e)}});return(0,e.createElement)(n.Section,{title:o(`modelSection`),count:o(`fieldCount`,{count:`2`})},s,c)}function Y(t){let{fields:r,rebuild:i,root:a,roots:o,setRoot:s,t:c}=t,l=o.map(t=>(0,e.createElement)(`option`,{key:t,value:t})),u=(0,e.createElement)(`datalist`,{id:R},...l),d=(0,e.createElement)(`input`,{className:`dsu-input zgc-rebuildInput`,value:a,list:R,placeholder:c(`rebuildInputPlaceholder`),onChange:e=>{s(e.target.value)}}),f=(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn`,"data-field":`rebuild`,disabled:i.phase===`running`,onClick:t.onRebuild},i.phase===`running`?c(`rebuildRunning`):c(`rebuildButton`));return(0,e.createElement)(n.Field,{label:c(`rebuildLabel`),...(0,n.splitHint)(H(c,r.embedding,o.length>0)),wide:!0},u,d,f)}function X(t){let{t:n}=t,r=l(t.serverReady);return r===void 0?null:(0,e.createElement)(`p`,{className:`dsu-hint`},n(r))}function Z(t){let{rebuild:r,t:i}=t;if(r.phase===`idle`)return null;if(r.phase===`error`)return(0,e.createElement)(n.Callout,{tone:`err`},r.output);let a;return a=r.output===``?r.phase===`done`?i(`rebuildDone`):``:r.output,(0,e.createElement)(n.LogPanel,{label:i(`rebuildStatusTitle`),tone:r.phase===`done`?`ok`:`mute`},a)}function ne(t){let{editable:r,fields:i,setField:a,t:o}=t,s=(0,e.createElement)(n.SelectField,{label:o(`transportLabel`),...(0,n.splitHint)(o(`transportHint`)),field:`transport`,value:i.transport,options:K(o),disabled:!r,onChange:e=>{a(`transport`,e)}}),c=(0,e.createElement)(n.TextField,{label:o(`endpointLabel`),...(0,n.splitHint)(o(`endpointHint`)),field:`hfEndpoint`,value:i.hfEndpoint,placeholder:N,monospace:!0,disabled:!r,onChange:e=>{a(`hfEndpoint`,e.trim()===``?void 0:e.trim())}}),l=(0,e.createElement)(n.ToggleField,{label:o(`enforceLabel`),...(0,n.splitHint)(o(`enforceHint`)),field:`enforceSearchFirst`,checked:i.enforceSearchFirst,disabled:!r,onChange:e=>{a(`enforceSearchFirst`,e)}}),u=(0,e.createElement)(n.NumberField,{label:o(`budgetLabel`),...(0,n.splitHint)(o(`budgetHint`,{default:3})),field:`grepBudgetPerSearch`,value:q(i.grepBudget,g),min:g.minValue??1,max:g.maxValue??20,step:1,unit:o(`unitTimes`),invalidHint:o(`outOfRange`),disabled:!r,resetToken:t.resetToken,onInvalidChange:e=>{t.reportInvalid(`grepBudgetPerSearch`,e)},onChange:e=>{a(`grepBudgetPerSearch`,e)}}),d=(0,e.createElement)(n.NumberField,{label:o(`windowLabel`),...(0,n.splitHint)(o(`windowHint`,{default:10})),field:`unlockWindowMin`,value:q(i.unlockWindow,_),min:_.minValue??1,max:_.maxValue??240,step:1,unit:o(`unitMinutes`),invalidHint:o(`outOfRange`),disabled:!r,resetToken:t.resetToken,onInvalidChange:e=>{t.reportInvalid(`unlockWindowMin`,e)},onChange:e=>{a(`unlockWindowMin`,e)}});return(0,e.createElement)(n.Section,{title:o(`indexSection`),count:o(`fieldCount`,{count:`5`})},s,c,l,(0,e.createElement)(n.FieldTwoCol,null,u,d),X(t),Y(t),Z(t))}function re(t){let{t:r}=t,i=(0,e.createElement)(n.SaveBar,{dirty:t.dirty,blocked:t.blocked,busy:t.busy,writable:t.writable,error:t.saveError??(t.blocked?r(`invalidFields`):null),saveLabel:r(`save`),savingLabel:r(`saving`),revertLabel:r(`revert`),dirtyLabel:r(`dirtyCount`,{count:t.dirtyCount}),cleanLabel:r(`statusClean`),readOnlyLabel:r(`statusReadOnly`),onSave:t.onSave,onDiscard:t.onDiscard});return(0,e.createElement)(n.CardForm,null,J(t),ne(t),i)}function ie(e,t,n,r){t===`defaultEmbedding`?e.push(r(`defaultEmbedding`,n)):t===`defaultLimit`?e.push(r(`defaultLimit`,n)):t===`hfEndpoint`?e.push(r(`hfEndpoint`,n)):t===`enforceSearchFirst`?e.push(r(`enforceSearchFirst`,n)):t===`grepBudgetPerSearch`?e.push(r(`grepBudgetPerSearch`,n)):t===`unlockWindowMin`?e.push(r(`unlockWindowMin`,n)):t===`transport`&&e.push(r(`transport`,n))}function Q(e,t){if(e===void 0)throw Error(t(`rebuildUnavailable`));return e}const $={roots:[],serverReady:void 0};function ae(r,i){let[a,o]=(0,e.useState)(``),[s,c]=(0,e.useState)($),[l,u]=(0,e.useState)({phase:`idle`,output:``}),d=(0,e.useRef)(null),f=(0,e.useRef)(!1),p=(0,e.useRef)(null),m=(0,e.useRef)(!0),h=()=>m.current;function g(){p.current=null,d.current!==null&&(clearInterval(d.current),d.current=null)}(0,e.useEffect)(()=>(m.current=!0,()=>{m.current=!1,g()}),[]);let _=(0,e.useCallback)(async()=>{let e=await Q(i,r).roots(),t={roots:[...e.roots],serverReady:e.serverReady};return c(t),t},[i,r]);(0,e.useEffect)(()=>{(async()=>{try{await _()}catch{c($)}})()},[_]);async function v(e){if(!f.current&&h()&&p.current===e){f.current=!0;try{let t=await Q(i,r).status(e);if(!h()||p.current!==e)return;let n=b(t,r);n.phase!==`running`&&g(),u({phase:n.phase,output:n.output})}catch(t){if(!h()||p.current!==e)return;g(),u({phase:`error`,output:(0,n.errorText)(t)})}finally{f.current=!1}}}async function y(){let e=await Q(i,r).rebuild(a.trim()),n=t.z.object({jobId:t.z.string()}).safeParse(e);if(!n.success)throw TypeError(r(`rebuildMissingJobId`));let{jobId:o}=n.data;p.current=o,d.current=setInterval(()=>{v(o)},2e3)}async function x(){let e=a.trim();if(!(e.startsWith(`/`)||F.test(e)||e.startsWith(P+P)))u({phase:`error`,output:r(`rebuildRootNotAbsolute`)});else{g(),u({phase:`running`,output:r(`rebuildStarting`)});try{await y()}catch(e){g(),u({phase:`error`,output:(0,n.errorText)(e)})}}}return{root:a,roots:s.roots,serverReady:s.serverReady,state:l,setRoot:o,start:x}}function oe(t){let{t:r}=t,i=t.useCard(e=>e),{status:a,writable:o}=i,s=a===`ready`&&o,c=B(i),[l,u]=(0,e.useState)({}),[d,f]=(0,e.useState)(!1),[p,h]=(0,e.useState)(null),g=ae(r,t.rebuildRemote),_=m(l,c),v=(0,n.useInvalidFields)(),{blocked:y,fields:b,resetToken:x,reportInvalid:S}=v,C=new Set([...(0,n.diffTouched)(l,c),...b]).size,w=C>0||y,T=(e,t)=>{u(n=>({...n,[e]:t}))},E=async()=>{let e=(0,n.diffTouched)(l,c);if(e.length===0||y)return;f(!0),h(null);let i=[];for(let n of e){let e=l[n];e===void 0?i.push(t.unset(n)):ie(i,n,e,t.set)}try{if((await Promise.all(i)).some(e=>!e)){f(!1),h(r(`saveRejected`));return}}catch(e){f(!1),h(r(`saveFailed`,{reason:(0,n.errorText)(e)}));return}let a=new Set(e),o=Object.fromEntries(Object.entries(l).filter(([e])=>!a.has(e)));f(!1),u(o),v.clear()};return re({t:r,fields:_,writable:s,editable:s&&!d,roots:g.roots,serverReady:g.serverReady,root:g.root,rebuild:g.state,dirty:w,blocked:y,resetToken:x,reportInvalid:S,dirtyCount:C,busy:d,saveError:p,setField:T,setRoot:g.setRoot,onSave:()=>{E()},onDiscard:()=>{u({}),h(null),v.clear()},onRebuild:()=>{g.start()}})}const se=[`slots`,`configForms`,`locale`];exports.apply=function(e){e.effect(()=>{let e=(0,n.ensureCardUiCss)(),t=document.createElement(`style`);return t.id=`zvec-grep-card-css`,t.textContent=`.zgc-rebuildInput{flex:1 1 240px;min-width:0}`,document.head.append(t),()=>{t.remove(),e()}},`zvec-grep-card: styles`);let t=e.configForms.get(I),r=u(t);e.effect(()=>e.locale.register(I,te),`zvec-grep-card: locale dictionaries`);let i=e.locale.bind(I),a=M(e,{remoteMissing:()=>i(`rebuildRemoteMissing`),namespaceMissing:e=>i(`rebuildNamespaceMissing`,{serviceKey:e})}),o=async(e,n)=>{try{return await t.set(e,n)}catch(t){throw console.error(`[zvec-grep] set ${e} failed:`,t),t}},s=async e=>{try{return await t.unset(e)}catch(t){throw console.error(`[zvec-grep] unset ${e} failed:`,t),t}};e.slots.inject(`plugins.bundle.config`,()=>e.slots.register({name:`plugins.bundle.config`,key:`@jayyuen66/dsh-zvec-grep`,inject:()=>({t:i,hooks:{card:r},set:o,unset:s,rebuildRemote:a})},oe))},exports.cardStore=u,exports.draftFields=m,exports.inject=se,exports.parseRebuildPoll=b;
8
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("zod"),n=require("@jayyuen66/dsh-plugin-shared/client");const r=`transformers-js`,i=Object.freeze([{reference:`local/qwen3-embedding-0.6b`,backend:`llama-cpp`,dimension:1024},{reference:`local/embeddinggemma-300m`,backend:`llama-cpp`,dimension:768},{reference:`local/potion-code-16m-v2`,backend:`model2vec`,dimension:256},{reference:`local/potion-multilingual-128m`,backend:`model2vec`,dimension:256},{reference:`local/potion-retrieval-32m`,backend:`model2vec`,dimension:512},{reference:`local/bge-small-en-v1.5`,backend:r,dimension:384},{reference:`local/all-minilm-l6-v2`,backend:r,dimension:384},{reference:`local/multilingual-e5-small`,backend:r,dimension:384},{reference:`local/jina-embeddings-v2-base-code`,backend:r,dimension:768},{reference:`local/gte-modernbert-base`,backend:r,dimension:768},{reference:`local/nomic-embed-text-v1.5`,backend:r,dimension:768}].map(e=>Object.freeze(e))),a=Object.freeze([{reference:`qwen/qwen3-vl-embedding`,dimension:2560},{reference:`qwen/qwen3.7-text-embedding`,dimension:1024},{reference:`qwen/text-embedding-v4`,dimension:1024}].map(e=>Object.freeze(e)));function o(e,t){return Object.hasOwn(e,t)}function s(e,t,n){return o(e,n)?e[n]:Object.hasOwn(t,n)?t[n]:void 0}function c(e,t){return typeof e==`number`&&Number.isFinite(e)?String(e):t}function l(e){let t;return e===!0?t=`daemonReadyNote`:e===!1&&(t=`daemonOfflineNote`),t}function u(e){return e?`ok`:`warn`}function d(e){let t={status:`loading`,writable:!1,value:{}},n=null,r=t;return{getSnapshot(){let t=e.getSnapshot();return t!==n&&(n=t,r={status:t.status,writable:t.writable,value:t.value??{}}),r},subscribe(t){return e.subscribe(t)}}}function f(e,t,n,r){let i=s(e,t,n);return i===void 0?o(e,n)?``:r:c(i,r)}const p=t.z.url({protocol:/^https?$/u});function m(e,t){if(Object.hasOwn(e,`hfEndpoint`)){let t=e.hfEndpoint;return typeof t==`string`?t:``}let n=t.hfEndpoint;return typeof n==`string`&&p.safeParse(n).success?n:``}function h(e,t){let n=s(e,t,`defaultEmbedding`),r=s(e,t,`enforceSearchFirst`),i=s(e,t,`transport`);return{embedding:typeof n==`string`&&n.length>0?n:`local/qwen3-embedding-0.6b`,limitDisplay:f(e,t,`defaultLimit`,`10`),hfEndpoint:m(e,t),enforceSearchFirst:r!==!1,grepBudget:f(e,t,`grepBudgetPerSearch`,`3`),unlockWindow:f(e,t,`unlockWindowMin`,`10`),transport:i===`cli`||i===`mcp`||i===`auto`?i:`auto`}}const g=t.z.int().min(1).max(50),_=t.z.int().min(1).max(20),v=t.z.int().min(1).max(240),y=[`running`,`stopping`,`completed`,`killed`,`failed`],b=t.z.object({status:t.z.preprocess(e=>typeof e==`string`&&y.some(t=>t===e)?e:void 0,t.z.enum(y).optional()),exitCode:t.z.preprocess(e=>typeof e==`number`&&Number.isFinite(e)?e:void 0,t.z.number().optional()),output:t.z.preprocess(e=>typeof e==`string`?e:void 0,t.z.string().optional())});function x(e,t){let n=b.safeParse(e),{status:r,exitCode:i,output:a}=n.success?n.data:{},o=a??``;if(r===`running`||r===`stopping`)return{phase:`running`,output:o.length>0?o:t(`rebuildRunning`)};if(r===`completed`&&i===0)return{phase:`done`,output:o};let s;return s=r===`killed`?t(`rebuildKilled`):r===`failed`?t(`rebuildFailed`):typeof i==`number`&&Number.isFinite(i)?t(`rebuildExitCode`,{exitCode:i}):t(`rebuildExitUnknown`),{phase:`error`,output:o.length>0?`${s}\n${o}`:s}}const S=`zvecGrepRebuild`,C=`remote.${S}`,w=`@jayyuen66/dsh-zvec-grep`,T=t.z.object({root:t.z.string({error:`rebuild request requires a string root`}).trim().min(1,{error:`rebuild request requires a non-empty root`})},{error:`rebuild request requires a string root`}),E=t.z.object({jobId:t.z.string({error:`rebuild status request requires a string jobId`}).trim().min(1,{error:`rebuild status request requires a non-empty jobId`})},{error:`rebuild status request requires a string jobId`}),D=[{id:`${w}#${S}/roots`,service:S,namespace:S,method:`roots`,invocation:{kind:`direct`},parameters:[],result:{mode:`src-json`}},{id:`${w}#${S}/rebuild`,service:S,namespace:S,method:`rebuild`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${w}#rebuild-request`,create:()=>({parse(e){return(0,n.parseOrThrow)(T,e,t.z.prettifyError)}})}}],result:{mode:`src-json`}},{id:`${w}#${S}/status`,service:S,namespace:S,method:`status`,invocation:{kind:`direct`},parameters:[{name:`request`,wire:`request`,source:`json`,codec:{mode:`strict`,typeSymbol:`${w}#rebuild-status-request`,create:()=>({parse(e){return(0,n.parseOrThrow)(E,e,t.z.prettifyError)}})}}],result:{mode:`src-json`}}],O=e=>(0,n.isRecord)(e)&&typeof e.roots==`function`&&typeof e.rebuild==`function`&&typeof e.status==`function`;async function k(e){let t=await e;if(t.ok)return t.value;throw Error(`${t.error.code}: ${t.error.message}`)}function A(e,t){let r,i=async()=>{let i=(0,n.remoteMounterOf)(e,!0);if(i===void 0)throw Error(t.remoteMissing());try{r??=i.$mount({package:w,descriptors:D}),await r}catch(e){throw r=void 0,e}let a=e.get?.(C);if(!O(a))throw Error(t.namespaceMissing(C));return a};return{async roots(){return k((await i()).roots())},async rebuild(e){let t=await k((await i()).rebuild({root:e}));if(t.ok)return t;throw Error(t.error)},async status(e){let t=await k((await i()).status({jobId:e}));if(t.ok)return{...t};throw Error(t.error)}}}function ee(e,t){return typeof e.get==`function`?A(e,t):void 0}const j=`https://modelscope.cn/models`,M={zh:{statusReadOnly:`当前作用域只读`,statusClean:`无未保存的修改`,dirtyCount:`已修改 {count} 项`,save:`保存`,saving:`保存中…`,revert:`撤销`,saveFailed:`保存失败:{reason}`,invalidFields:`有字段超出范围,先修正或撤销后再保存。`,saveRejected:`保存被宿主拒绝(配置校验未通过或写入被跳过),修改未生效`,modelSection:`检索模型`,fieldCount:`{count} 字段`,indexSection:`网络与索引`,unitResults:`条`,unitTimes:`次`,unitMinutes:`分钟`,outOfRange:`超出允许范围,未保存`,embeddingLabel:`默认 embedding`,embeddingHint:`本地模型直接可选;远程 qwen 模型需在插件部署配置里打开 allowRemoteEmbedding(内容会送往外部端点,首次索引需 zg --auth grant 授权)。只影响「新建」索引;切换并保存后,已有索引需点下方「重建」重新 embedding`,transportLabel:`检索传输方式`,transportHint:`自动 = 守护进程在跑时检索走 MCP(常驻模型池、队列调度),否则走 CLI;仅 CLI = 永不碰守护进程;仅 MCP = 检索恒走守护进程,缺席时由插件自动拉起(会开 127.0.0.1:7999 回环端口;拉起失败会明确报错而不是回退 CLI)`,transportAuto:`自动(守护进程在跑走 MCP,否则 CLI)`,transportCli:`仅 CLI(每次 spawn zg 进程)`,transportMcp:`仅 MCP(走守护进程,缺席自动拉起)`,backendRemote:`qwen 远程(内容出本机,需部署开放并授权)`,limitLabel:`默认每组结果数`,limitInvalid:`请输入 {min}-{max} 的整数`,limitClamped:`已钳到 {min}-{max} 范围:{value}`,endpointLabel:`HuggingFace 镜像地址`,endpointHint:`留空走 huggingface.co;国内网络可填 ${j} 等兼容镜像(仅 llama-cpp 后端生效,如 qwen3)`,enforceLabel:`强制 search-first(先 zg_search 再 grep/rg)`,enforceHint:`开启后,已建索引工作区内的 grep/rg 受配额门禁约束:每次成功 zg_search 解锁下方次数的 grep/rg(时效见下),用尽或过期后再次拦截(提高检索覆盖与准确性)`,budgetLabel:`每次 zg_search 解锁的 grep/rg 次数`,budgetHint:`配额越小语义检索越频繁、准确性约束越强;清空恢复默认 {default}`,windowLabel:`解锁时效`,windowHint:`超过该时长未再次 zg_search,配额整体过期;清空恢复默认 {default}(单位:分钟)`,rebuildLabel:`工作区重建(切换 embedding 并保存后执行)`,rebuildInputPlaceholder:`/workspace 的绝对路径`,daemonReadyNote:`守护进程:就绪(zg --server 在跑)。`,daemonOfflineNote:"守护进程:未就绪。守护进程提供的索引增量刷新、refresh=background 与常驻模型池在缺席时都不可用;需要时在终端执行 `zg --server on`。",panelRoots:`索引根`,panelServer:`索引服务`,panelReady:`就绪`,panelNotReady:`未就绪`,rebuildHint:`以当前默认模型重建:{embedding};等价于 zg --index --rebuild。{roots}`,rootsNoteWith:`候选工作区来自本 daemon 已打开过的会话(服务端白名单)。`,rootsNoteEmpty:`尚无可选工作区:先在该工作区里开一个会话(任一次工具调用即登记)。`,rebuildButton:`重建索引(动作,点击即执行)`,rebuildRunning:`重建中…`,rebuildDone:`重建完成`,rebuildStatusTitle:`重建作业`,copy:`复制`,copied:`已复制`,rebuildStarting:`正在后台重建索引…(首次会下载 embedding 模型,可能较慢)`,rebuildKilled:`重建进程被终止`,rebuildFailed:`重建作业被宿主注册表判定失败(没拿到进程退出码)`,rebuildExitCode:`重建进程退出码 {exitCode}(zg 未安装/权限不足/沙箱拒绝都会走到这里)`,rebuildExitUnknown:`重建没有可判定的结果(应答的 status 无法识别,或缺少进程退出码)`,rebuildMissingJobId:`启动重建失败:应答缺 jobId`,rebuildRootNotAbsolute:`root 必须是绝对路径(以 / 开头)`,rebuildUnavailable:`宿主没有提供工作区重建读面(未装远程服务)`,rebuildRemoteMissing:`工作区重建读面不可用:宿主网关没有提供 remote 服务`,rebuildNamespaceMissing:`{serviceKey} 未提供:宿主网关没有挂上这枚命名空间`,modelOption:`{reference}({dimension}维)`,backendLlamaCpp:`llama-cpp(原生,需 node-llama-cpp)`,backendTransformersJs:`transformers-js(纯 JS ONNX)`,backendModel2Vec:`model2vec(纯 JS worker,最轻)`},en:{statusReadOnly:`This scope is read-only`,statusClean:`No unsaved changes`,dirtyCount:`{count} changed`,save:`Save`,saving:`Saving…`,revert:`Revert`,saveFailed:`save failed: {reason}`,invalidFields:`Some fields are out of range; fix them or revert before saving.`,saveRejected:`save rejected by host (validation failed or write skipped) — changes not applied`,modelSection:`Retrieval model`,fieldCount:`{count} fields`,indexSection:`Network and index`,unitResults:`hits`,unitTimes:`times`,unitMinutes:`minutes`,outOfRange:`Out of the allowed range — not saved`,embeddingLabel:`Default embedding`,embeddingHint:`Local models are always selectable; the remote qwen models additionally require allowRemoteEmbedding in the deployment config (content leaves the machine, and the first index build needs a zg --auth grant). Affects newly built indexes only; after switching and saving, press Rebuild below to re-embed existing indexes`,transportLabel:`Search transport`,transportHint:`auto = searches go through the daemon (MCP) when it is running, CLI otherwise; CLI-only = never touch the daemon; MCP-only = searches always go through the daemon, auto-starting it when absent (opens the 127.0.0.1:7999 loopback port; a failed start is reported explicitly, never silently downgraded to CLI)`,transportAuto:`auto (daemon → MCP, otherwise CLI)`,transportCli:`CLI only (spawn zg each call)`,transportMcp:`MCP only (via daemon, auto-started when absent)`,backendRemote:`qwen remote (content leaves the machine; needs the deployment switch + grant)`,limitLabel:`Default hits per group`,limitInvalid:`enter an integer between {min} and {max}`,limitClamped:`clamped into the {min}-{max} range: {value}`,endpointLabel:`HuggingFace mirror URL`,endpointHint:`Leave empty for huggingface.co; on networks that cannot reach HF, fill a compatible mirror such as ${j} (llama-cpp backends only, e.g. qwen3)`,enforceLabel:`Enforce search-first (zg_search before grep/rg)`,enforceHint:`When on, grep/rg inside indexed workspaces is quota-gated: each successful zg_search unlocks the number of grep/rg calls below (valid for the window below), and the gate blocks again once it is spent or expired (better coverage and relevance)`,budgetLabel:`grep/rg calls unlocked per zg_search`,budgetHint:`A smaller quota means more semantic searches and a stronger relevance constraint; clear to restore the default {default}`,windowLabel:`Unlock window`,windowHint:`Without another zg_search inside this window the whole quota expires; clear to restore the default {default} (minutes)`,rebuildLabel:`Workspace rebuild (run after switching embedding and saving)`,rebuildInputPlaceholder:`absolute path to a /workspace`,daemonReadyNote:`Daemon: ready (zg --server is running).`,daemonOfflineNote:"Daemon: not ready. What the daemon provides — incremental index refresh, refresh=background and the resident embedding model pool — is unavailable while it is absent; run `zg --server on` in a terminal when you want it.",rebuildHint:`Rebuild with the current default model: {embedding}; same as zg --index --rebuild. {roots}`,panelRoots:`Index roots`,panelServer:`Index server`,panelReady:`Ready`,panelNotReady:`Not ready`,rootsNoteWith:`Candidates come from sessions this daemon already opened (server-side whitelist).`,rootsNoteEmpty:`No workspace to pick yet: open a session in that workspace first (any tool call registers it).`,rebuildButton:`Rebuild index (action, runs on click)`,rebuildRunning:`rebuilding…`,rebuildDone:`rebuild finished`,rebuildStatusTitle:`rebuild job`,copy:`Copy`,copied:`Copied`,rebuildStarting:`Rebuilding in the background… (the first run downloads the embedding model and may be slow)`,rebuildKilled:`the rebuild process was terminated`,rebuildFailed:`the host job registry reported the rebuild as failed (no process exit code)`,rebuildExitCode:`the rebuild process exited with code {exitCode} (missing zg, insufficient permissions and sandbox denials all land here)`,rebuildExitUnknown:`the rebuild has no determinable outcome (the response status is unrecognized, or its exit code is missing)`,rebuildMissingJobId:`failed to start the rebuild: the response has no jobId`,rebuildRootNotAbsolute:`root must be an absolute path (starting with /)`,rebuildUnavailable:`the host does not expose the rebuild Remote API`,rebuildRemoteMissing:`the rebuild Remote API is unavailable: the host gateway provides no remote service`,rebuildNamespaceMissing:`{serviceKey} was not provided: the host gateway did not mount this namespace`,modelOption:`{reference} ({dimension} dims)`,backendLlamaCpp:`llama-cpp (native, requires node-llama-cpp)`,backendTransformersJs:`transformers-js (pure JS ONNX)`,backendModel2Vec:`model2vec (pure JS worker, lightest)`}},N=String.fromCodePoint(92),P=/^[A-Za-z]:[\\/]/u,F=`zvec-grep`,I=[`llama-cpp`,`transformers-js`,`model2vec`],L=`zgc-rebuild-root-options`,R={"llama-cpp":`backendLlamaCpp`,"transformers-js":`backendTransformersJs`,model2vec:`backendModel2Vec`};function z(e){return e.value}function B(e,t,n){return e(`modelOption`,{reference:t,dimension:n})}function V(e,t,n){return e(`rebuildHint`,{embedding:t,roots:e(n?`rootsNoteWith`:`rootsNoteEmpty`)})}function H(e){let t=[];for(let n of I)for(let r of i)r.backend===n&&t.push({value:r.reference,label:B(e,r.reference,r.dimension),group:e(R[n])});for(let n of a)t.push({value:n.reference,label:B(e,n.reference,n.dimension),group:e(`backendRemote`)});return t}const U=[{value:`auto`},{value:`cli`},{value:`mcp`}],W={auto:`transportAuto`,cli:`transportCli`,mcp:`transportMcp`};function G(e){return U.map(t=>({value:t.value,label:e(W[t.value])}))}function K(e,t){let n=t.safeParse(e===``?NaN:Number(e));return n.success?n.data:void 0}function q(t){let{editable:r,fields:i,setField:a,t:o}=t,s=(0,e.createElement)(n.SelectField,{label:o(`embeddingLabel`),...(0,n.splitHint)(o(`embeddingHint`)),field:`defaultEmbedding`,value:i.embedding,options:H(o),disabled:!r,onChange:e=>{a(`defaultEmbedding`,e)}}),c=(0,e.createElement)(n.NumberField,{label:o(`limitLabel`),hint:o(`limitInvalid`,{min:1,max:50}),field:`defaultLimit`,value:K(i.limitDisplay,g),...(0,n.numberBoundsOf)(g,{min:1,max:50}),step:1,unit:o(`unitResults`),invalidHint:o(`outOfRange`),disabled:!r,resetToken:t.resetToken,onInvalidChange:e=>{t.reportInvalid(`defaultLimit`,e)},onChange:e=>{a(`defaultLimit`,e)}});return(0,e.createElement)(n.Section,{title:o(`modelSection`),count:o(`fieldCount`,{count:`2`})},s,c)}function J(t){let{fields:r,rebuild:i,root:a,roots:o,setRoot:s,t:c}=t,l=o.map(t=>(0,e.createElement)(`option`,{key:t,value:t})),u=(0,e.createElement)(`datalist`,{id:L},...l),d=(0,e.createElement)(`input`,{className:`dsu-input dsu-grow`,value:a,list:L,placeholder:c(`rebuildInputPlaceholder`),onChange:e=>{s(e.target.value)}}),f=(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn`,"data-field":`rebuild`,disabled:i.phase===`running`,onClick:t.onRebuild},i.phase===`running`?c(`rebuildRunning`):c(`rebuildButton`));return(0,e.createElement)(n.Field,{label:c(`rebuildLabel`),...(0,n.splitHint)(V(c,r.embedding,o.length>0)),wide:!0},u,(0,e.createElement)(`div`,{className:`dsu-inlineRow`},d,f))}function Y(t){let{t:r}=t,i=l(t.serverReady);return i===void 0?null:(0,e.createElement)(`div`,{className:`dsu-inlineRow`,"data-field":`daemon-status`},(0,e.createElement)(n.StatusDot,{tone:u(t.serverReady===!0)}),(0,e.createElement)(`p`,{className:`dsu-hint`},r(i)))}function X(t){let{rebuild:r,t:i}=t;if(r.phase===`idle`)return null;if(r.phase===`error`)return(0,e.createElement)(n.Callout,{tone:`err`},r.output);let a;a=r.output===``?r.phase===`done`?i(`rebuildDone`):``:r.output;let o=(0,e.createElement)(n.LogPanel,{label:i(`rebuildStatusTitle`),tone:r.phase===`done`?`ok`:`mute`,semanticLines:!0,copyText:a,copyLabel:i(`copy`),copiedLabel:i(`copied`)},a);return r.phase===`running`?(0,e.createElement)(`div`,null,o,(0,e.createElement)(n.ProgressBar,{label:i(`rebuildRunning`)})):o}function te(t){let{editable:r,fields:i,setField:a,t:o}=t,s=(0,e.createElement)(n.SelectField,{label:o(`transportLabel`),...(0,n.splitHint)(o(`transportHint`)),field:`transport`,value:i.transport,options:G(o),disabled:!r,onChange:e=>{a(`transport`,e)}}),c=(0,e.createElement)(n.TextField,{label:o(`endpointLabel`),...(0,n.splitHint)(o(`endpointHint`)),field:`hfEndpoint`,value:i.hfEndpoint,placeholder:j,monospace:!0,disabled:!r,onChange:e=>{a(`hfEndpoint`,e.trim()===``?void 0:e.trim())}}),l=(0,e.createElement)(n.ToggleField,{label:o(`enforceLabel`),...(0,n.splitHint)(o(`enforceHint`)),field:`enforceSearchFirst`,checked:i.enforceSearchFirst,disabled:!r,onChange:e=>{a(`enforceSearchFirst`,e)}}),u=(0,e.createElement)(n.NumberField,{label:o(`budgetLabel`),...(0,n.splitHint)(o(`budgetHint`,{default:3})),field:`grepBudgetPerSearch`,value:K(i.grepBudget,_),...(0,n.numberBoundsOf)(_,{min:1,max:20}),step:1,unit:o(`unitTimes`),invalidHint:o(`outOfRange`),disabled:!r,resetToken:t.resetToken,onInvalidChange:e=>{t.reportInvalid(`grepBudgetPerSearch`,e)},onChange:e=>{a(`grepBudgetPerSearch`,e)}}),d=(0,e.createElement)(n.NumberField,{label:o(`windowLabel`),...(0,n.splitHint)(o(`windowHint`,{default:10})),field:`unlockWindowMin`,value:K(i.unlockWindow,v),...(0,n.numberBoundsOf)(v,{min:1,max:240}),step:1,unit:o(`unitMinutes`),invalidHint:o(`outOfRange`),disabled:!r,resetToken:t.resetToken,onInvalidChange:e=>{t.reportInvalid(`unlockWindowMin`,e)},onChange:e=>{a(`unlockWindowMin`,e)}});return(0,e.createElement)(n.Section,{title:o(`indexSection`),count:o(`fieldCount`,{count:`5`})},s,c,l,(0,e.createElement)(n.FieldTwoCol,null,u,d),Y(t),J(t),X(t))}function ne(t){let{t:r}=t,i=(0,e.createElement)(n.SaveBar,{dirty:t.dirty,blocked:t.blocked,busy:t.busy,writable:t.writable,error:t.saveError??(t.blocked?r(`invalidFields`):null),saveLabel:r(`save`),savingLabel:r(`saving`),revertLabel:r(`revert`),dirtyLabel:r(`dirtyCount`,{count:t.dirtyCount}),cleanLabel:r(`statusClean`),readOnlyLabel:r(`statusReadOnly`),onSave:t.onSave,onDiscard:t.onDiscard});return(0,e.createElement)(n.CardForm,null,q(t),te(t),i)}function re(e,t,n,r){t===`defaultEmbedding`?e.push(r(`defaultEmbedding`,n)):t===`defaultLimit`?e.push(r(`defaultLimit`,n)):t===`hfEndpoint`?e.push(r(`hfEndpoint`,n)):t===`enforceSearchFirst`?e.push(r(`enforceSearchFirst`,n)):t===`grepBudgetPerSearch`?e.push(r(`grepBudgetPerSearch`,n)):t===`unlockWindowMin`?e.push(r(`unlockWindowMin`,n)):t===`transport`&&e.push(r(`transport`,n))}function Z(e,t){if(e===void 0)throw Error(t(`rebuildUnavailable`));return e}const Q={roots:[],serverReady:void 0};function ie(r,i){let[a,o]=(0,e.useState)(``),[s,c]=(0,e.useState)(Q),[l,u]=(0,e.useState)({phase:`idle`,output:``}),d=(0,e.useRef)(null),f=(0,e.useRef)(!1),p=(0,e.useRef)(null),m=(0,e.useRef)(!0),h=()=>m.current;function g(){p.current=null,d.current!==null&&(clearInterval(d.current),d.current=null)}(0,e.useEffect)(()=>(m.current=!0,()=>{m.current=!1,g()}),[]);let _=(0,e.useCallback)(async()=>{let e=await Z(i,r).roots(),t={roots:[...e.roots],serverReady:e.serverReady};return c(t),t},[i,r]);(0,e.useEffect)(()=>{(async()=>{try{await _()}catch{c(Q)}})()},[_]);async function v(e){if(!f.current&&h()&&p.current===e){f.current=!0;try{let t=await Z(i,r).status(e);if(!h()||p.current!==e)return;let n=x(t,r);n.phase!==`running`&&g(),u({phase:n.phase,output:n.output})}catch(t){if(!h()||p.current!==e)return;g(),u({phase:`error`,output:(0,n.errorText)(t)})}finally{f.current=!1}}}async function y(){let e=await Z(i,r).rebuild(a.trim()),n=t.z.object({jobId:t.z.string()}).safeParse(e);if(!n.success)throw TypeError(r(`rebuildMissingJobId`));let{jobId:o}=n.data;p.current=o,d.current=setInterval(()=>{v(o)},2e3)}async function b(){let e=a.trim();if(!(e.startsWith(`/`)||P.test(e)||e.startsWith(N+N)))u({phase:`error`,output:r(`rebuildRootNotAbsolute`)});else{g(),u({phase:`running`,output:r(`rebuildStarting`)});try{await y()}catch(e){g(),u({phase:`error`,output:(0,n.errorText)(e)})}}}return{root:a,roots:s.roots,serverReady:s.serverReady,state:l,setRoot:o,start:b}}function ae(t){let{t:r}=t,i=t.useCard(e=>e),{status:a,writable:o}=i,s=a===`ready`&&o,c=z(i),[l,u]=(0,e.useState)(!1),[d,f]=(0,e.useState)(null),p=ie(r,t.rebuildRemote),{touched:m,setTouched:g,setField:_,discard:v,invalid:y,dirtyKeys:b}=(0,n.useCardDraft)(c,{onDiscard:()=>{f(null)}}),x=h(m,c),{blocked:S,fields:C,resetToken:w,reportInvalid:T}=y,E=new Set([...b,...C]).size,D=E>0||S,O=async()=>{let e=(0,n.diffTouched)(m,c);if(e.length===0||S)return;u(!0),f(null);let i=[];for(let n of e){let e=m[n];e===void 0?i.push(t.unset(n)):re(i,n,e,t.set)}try{if((await Promise.all(i)).some(e=>!e)){u(!1),f(r(`saveRejected`));return}}catch(e){u(!1),f(r(`saveFailed`,{reason:(0,n.errorText)(e)}));return}let a=new Set(e),o=Object.fromEntries(Object.entries(m).filter(([e])=>!a.has(e)));u(!1),g(o),y.clear()};return ne({t:r,fields:x,writable:s,editable:s&&!l,roots:p.roots,serverReady:p.serverReady,root:p.root,rebuild:p.state,dirty:D,blocked:S,resetToken:w,reportInvalid:T,dirtyCount:E,busy:l,saveError:d,setField:_,setRoot:p.setRoot,onSave:()=>{O()},onDiscard:v,onRebuild:()=>{p.start()}})}const $=`conversation.session.panel.section`;function oe(t){let{t:r,reader:i}=t,[a,o]=(0,e.useState)(null);if((0,e.useEffect)(()=>{let e=!0;return(async()=>{if(i!==void 0)try{let t=await i.roots();e&&o(t)}catch{}})(),()=>{e=!1}},[i]),i===void 0||a===null)return null;let s=a.serverReady===!0;return(0,e.createElement)(n.KpiGrid,null,(0,e.createElement)(n.KpiTile,{label:r(`panelRoots`),value:a.roots.length,count:a.roots.length}),(0,e.createElement)(n.KpiTile,{label:r(`panelServer`),value:r(s?`panelReady`:`panelNotReady`)}))}const se=[`slots`,`configForms`,`locale`];exports.apply=function(e){let t=e.configForms.get(F),n=d(t);e.effect(()=>e.locale.register(F,M),`zvec-grep-card: locale dictionaries`);let r=e.locale.bind(F),i=ee(e,{remoteMissing:()=>r(`rebuildRemoteMissing`),namespaceMissing:e=>r(`rebuildNamespaceMissing`,{serviceKey:e})}),a=async(e,n)=>{try{return await t.set(e,n)}catch(t){throw console.error(`[zvec-grep] set ${e} failed:`,t),t}},o=async e=>{try{return await t.unset(e)}catch(t){throw console.error(`[zvec-grep] unset ${e} failed:`,t),t}};e.slots.inject($,()=>e.slots.register({name:$,id:`zvec-index`,order:130,label:()=>r(`indexSection`),inject:()=>({t:r,reader:i})},oe)),e.slots.inject(`plugins.bundle.config`,()=>e.slots.register({name:`plugins.bundle.config`,key:`@jayyuen66/dsh-zvec-grep`,inject:()=>({t:r,hooks:{card:n},set:a,unset:o,rebuildRemote:i})},ae))},exports.cardStore=d,exports.draftFields=h,exports.inject=se,exports.parseRebuildPoll=x;
9
9
  return module.exports;
10
10
  },
11
11
  });
package/cordis.patch.yml CHANGED
@@ -8,7 +8,7 @@
8
8
  # hfEndpoint 默认 https://modelscope.cn/models(国内 HF 不可达,已实测可下载 qwen3)。
9
9
  #
10
10
  # 组合包层:本文件由 package.json 的 dsh.bundle.patch
11
- # 指向,随 `dsh plugin --profile web add/remove ./plugins/zvec-grep` 维护。
11
+ # 指向,随 `dsh plugin --profile web add/remove @jayyuen66/dsh-zvec-grep` 维护。
12
12
  # 行按裸包名引用本包(client-modules 只扫描裸包名条目的 dsh.client 声明)。
13
13
  # 注意 pnpm ≥12.3.0:12.0.0 的 add 本地目录有 #14437 bug。
14
14
  - insert:
package/docs/DETAIL.md CHANGED
@@ -1,41 +1,11 @@
1
1
  # Zvec indexed search
2
2
 
3
- Searches the workspace through a local index instead of raw grep, and can require an indexed search before plain `grep` / `rg` are allowed.
3
+ ![Semantic radar: three zg tools surrounded by the search-first quota, CLI/MCP transport, embedding catalog and Rebuild jobs.](images/capability-map.svg)
4
4
 
5
- ## What the card changes
5
+ ![Six stations: query and root, search-first gate, index embedding, daemon search, ranked results, optional rebuild.](images/search-flow.svg)
6
6
 
7
- - **Search model** — `defaultEmbedding` (default `local/qwen3-embedding-0.6b`, about 640 MB) applies to **new** indexes only; an existing index keeps its model until it is rebuilt. The dropdown has a local and a remote group: the remote qwen models (three, new in 0.3.0) additionally require `allowRemoteEmbedding` in the deployment config — remote embedding sends workspace content to an external endpoint, and the first index build needs a one-time user authorization via `zg --auth grant`. `defaultLimit` (1–50, default 10) is how many hits each result group returns.
8
- - **Network and indexing** — the **search transport** (`transport`, new in 0.3.0) has three settings: auto = searches go through the daemon (MCP) when it is running, CLI otherwise; CLI-only = never touch the daemon; MCP-only = searches always go through the daemon, auto-starting it when absent (opens the `127.0.0.1:7999` loopback port; a failed start is reported explicitly, never silently downgraded). `hfEndpoint` defaults to the ModelScope mirror (`https://modelscope.cn/models`); leaving it empty means huggingface.co, which this environment typically cannot reach, so the default should stay. `enforceSearchFirst` (on) gates `grep` / `rg` inside indexed workspaces. `grepBudgetPerSearch` (default 3) is how many plain searches each successful `zg_search` unlocks, and `unlockWindowMin` (default 10) is how many minutes that unlock stays valid. Expiry is checked whenever the budget is read, so an elapsed window stops granting searches without a restart; the per-session table keeps at most 256 sessions and evicts the least recently used one first. When the step's tool admission does not include `zg_search`, the gate stands down rather than forcing a call the step cannot make.
7
+ ![Settings card: seven fields in three groups — retrieval defaults, search-first gate, transport — with reading notes on the right.](images/settings-card.svg)
9
8
 
10
- These are read per call and take effect without restarting the host.
9
+ ![Eleven deployment values in three groups — time and buffers, process and endpoint, remote and approval — plus three external prerequisites.](images/deployment-boundary.svg)
11
10
 
12
- ## Concurrency and platforms
13
-
14
- - **Within one host**, concurrent cold starts coalesce into one `zg --server on`. **Multiple hosts** sharing the same `ZVEC_GREP_HOME` share one daemon (upstream `instance.lock`; a duplicate start exits 0 with the same PID). The token is claimed atomically with O_EXCL, so later processes read the same value instead of overwriting each other; only the process that created the file stops the daemon it started on unload.
15
- - One zg MCP session handles one `tools/call` at a time (measured: a second concurrent call on the same session hangs until the caller's deadline), so every concurrent tool call gets its own session and idle sessions are reused. Index-job concurrency (default 2) and same-root writer reuse belong to the upstream scheduler.
16
- - Searches wait only while a same-root index rebuild holds the write lock, bounded by `rebuildWaitMs`; cold starts do not queue.
17
- - **Platforms**: POSIX accepts `/…` roots and uses bash single-quote escaping; Windows accepts drive-letter/UNC roots, uses pwsh escaping (embedded `'` becomes `''`), strips executable extensions such as `.exe`/`.cmd` from command names, and lowers the command-size cap to 24,000 bytes for the CreateProcess limit. Real on-disk Windows behavior is exercised by the CI `windows-latest` grid; local runs cover the same predicates with platform-injected win32 fixtures.
18
-
19
- ## The Rebuild action is not a setting
20
-
21
- The card's Rebuild button runs the equivalent of `zg --index --rebuild` for a workspace the daemon has already observed; it is an action, not a stored preference. No approval prompt fires on this path: the pre-execute approval only covers the `zg_*` tools when they name an explicit root, and Remote methods do not go through tool admission. What guards the action is the daemon's list of observed roots (plus its own single-operation lock).
22
-
23
- ## Restart-only values
24
-
25
- Eleven deployment values stay off the card: `searchTimeoutMs` (300000), `statusTimeoutMs` (60000), `indexTimeoutMs` (600000), `stdoutMaxBytes` (400000), `rebuildWaitMs` (120000), `clientMode` (`auto` / `direct` / `server`), `daemonUrl` (`http://127.0.0.1:7999/mcp`, the MCP transport's daemon endpoint), `allowRemoteEmbedding` (false), `remoteEmbeddingEndpoint`, `remoteEmbeddingApiKeyFrom`, `requireApprovalForExplicitRoot` (false). None of these eleven has a card control; the only thing that makes them take effect is the `config:` block of the registration row in the next paragraph, and precedence is row `config:` > the `.default()` in code.
26
-
27
- Whether workspace content may leave the machine at all is treated as a deployment decision rather than a model-visible choice, which is why the remote-embedding trio appears in neither the card nor the tool parameters; and even when it is enabled, `zg` itself still requires `--allow-remote` (added automatically by this plugin to remote-reference index commands once the deployment switch is on) or a one-time persistent `zg --auth grant`. Set all of these in the `config:` block of this plugin's row in your profile's `cordis.yml` (the `cordis.patch.yml` shipped in this package carries the `dsh-plugin-shared` supplier row plus that row's `id` / `name`; the card components come from the shared client row, externalized as `@jayyuen66/dsh-plugin-shared/client`); they take effect on restart.
28
-
29
- ## What it needs from outside
30
-
31
- The external `zg` CLI (`@zvec/zvec-grep`, installed with `npm install -g @zvec/zvec-grep`). The plugin enforces a version floor of **0.3.0** (the Rust rewrite's CLI shape; 0.2.x is rejected at the gate) before it builds any command and says so when the installed one is older; a missing CLI is reported as such instead of failing a search. Incremental index refresh, `refresh=background` and the resident model pool need the daemon running (`zg --server on`, or `transport=mcp` lets the plugin start one) — when it is offline the card says so. Local embedding backends may require their own native dependency (llama-cpp needs `node-llama-cpp`; model2vec and transformers-js are pure JavaScript). When `allowRemoteEmbedding` is on, the plugin forwards two variables to `zg`: `ZVEC_GREP_ENDPOINT` carries the literal value of `remoteEmbeddingEndpoint` (the deployment endpoint, not a variable name), and `ZVEC_GREP_API_KEY` is the secret looked up from the variable named by `remoteEmbeddingApiKeyFrom`. The key is passed explicitly because the host's subprocess layer strips secret-shaped variables.
32
-
33
- ## Further detail
34
-
35
- The error-code table, the argument guards and the background-job surface are in the package README (`README.md` / `README.zh-CN.md`).
36
-
37
- ## Feedback
38
-
39
- Issues and pull requests are welcome: [https://github.com/JayYuen666/dsh-zvec-grep/issues](https://github.com/JayYuen666/dsh-zvec-grep/issues).
40
-
41
- If a plugin fails to boot, include the dsh host version, the profile install shape, and the browser console line. The `missed the module table` line is especially useful: it tells us whether the shared client row was materialized.
11
+ Issues and PRs: https://github.com/JayYuen666/dsh-zvec-grep/issues
package/docs/DETAIL.zh.md CHANGED
@@ -1,41 +1,11 @@
1
1
  # Zvec 索引检索
2
2
 
3
- 用本地索引检索工作区,而不是裸 grep;也可以要求先走一次索引检索,才允许用普通 `grep` / `rg`。
3
+ ![语义雷达:三枚 zg 工具,外围是 search-first 配额、CLI/MCP 传输、embedding 目录与 Rebuild 作业。](images/capability-map.zh.svg)
4
4
 
5
- ## 设置卡上改的是什么
5
+ ![六站检索流程:查询与 root、search-first 门、索引 embedding、daemon 检索、排序结果、可选 Rebuild。](images/search-flow.zh.svg)
6
6
 
7
- - **检索模型** — `defaultEmbedding`(默认 `local/qwen3-embedding-0.6b`,约 640 MB)只作用于**新建**的索引;已有索引沿用它自己的模型,要换得先重建。下拉分本地与远程两组:远程 qwen 模型(0.3.0 新增三枚)需在部署配置里打开 `allowRemoteEmbedding` 才可选——远程会把工作区内容送到外部端点,且首次索引要用户执行一次 `zg --auth grant` 授权。`defaultLimit`(1–50,默认 10)是每组结果返回多少条命中。
8
- - **网络与索引** — 「检索传输方式」(`transport`,0.3.0 起)三档:自动 = 守护进程在跑时检索走 MCP(常驻模型池、队列调度),否则走 CLI;仅 CLI = 永不碰守护进程;仅 MCP = 检索恒走守护进程,缺席时由插件自动拉起(会开 `127.0.0.1:7999` 回环端口;拉起失败明确报错,不静默回退)。`hfEndpoint` 默认指向 ModelScope 镜像(`https://modelscope.cn/models`);留空就是 huggingface.co,而这个环境通常连不上,所以默认值应当保留。`enforceSearchFirst`(默认开)在已建索引的工作区里拦住 `grep` / `rg`。`grepBudgetPerSearch`(默认 3)是一次**走索引的** `zg_search` 解锁多少次直查(无索引时自动改走穷举词法的检索同样成功,但不发配额),`unlockWindowMin`(默认 10)是这份解锁维持几分钟。配额按「会话 × 索引根」记录(索引根是 root 或最近的含索引祖先,最多上溯 8 层),不是全局一份;「让路」只在宿主提供了步骤准入(`toolSet`)且该视图不含 `zg_search` 时成立——不提供准入信息的宿主仍按原判据拦截。有效期在每次取用配额时现判,窗口一过就不再放行直查、不需要重启;分片表按会话数封顶 256,超出时先淘汰最久未用的那一份。该索引根上有活跃重建时,检查临时放行且**不消耗配额**:重建持着写锁,这期间语义检索必然失败,检查不能再把直查一起堵死。本步骤的工具准入不含 `zg_search` 时,检查让路,不强迫模型去调一个本步骤调不动的工具。
7
+ ![设置卡七字段三组:检索默认、search-first 门、传输;右侧是读法与卡外说明。](images/settings-card.zh.svg)
9
8
 
10
- 这些每次调用现读,改完不需要重启宿主。
9
+ ![十一项部署值分三组:时间与缓冲、进程与端点、远程与审批;另有三道外部前提。](images/deployment-boundary.zh.svg)
11
10
 
12
- ## 并发与平台
13
-
14
- - **同一宿主**内的并发冷启动合并成一发 `zg --server on`。**多个宿主**共用 `ZVEC_GREP_HOME` 时共享同一个守护进程(上游 `instance.lock`;重复启动退 0 并回同一个 PID)。token 用 O_EXCL 原子认领,后来者读回同一枚,不会互相覆盖;只有创建者会在卸载时停掉自己拉起的 daemon。
15
- - 同一条 zg MCP 会话一次只处理一个 `tools/call`(实测两发并发时第二条会挂到调用方超时),所以每个并发工具调用各用一条会话,空闲会话复用;不把并发请求塞进同一条会话。索引作业的并发上限(默认 2)与同根写作业复用由上游调度器负责。
16
- - 检索只在同根索引重建持写锁时等待,上限 `rebuildWaitMs`;冷启动本身不排队。
17
- - **平台**:POSIX 收 `/…` 根、bash 单引号转义;Windows 收盘符/UNC 根、pwsh 单引号转义(内嵌 `'` 写成 `''`)、命令名剥 `.exe`/`.cmd` 等扩展,并按 CreateProcess 余量把命令规模上限收到 24000 字节。Windows 的真盘行为由 CI 的 `windows-latest` 格验证;本地用平台注入的 win32 夹具覆盖同一套判据。
18
-
19
- ## Rebuild 不是设置项
20
-
21
- 卡上的 Rebuild 是对守护进程已经观察到的工作区跑一次等价于 `zg --index --rebuild` 的动作,不是被存起来的偏好。这条路上不会弹审批:pre-execute 审批只覆盖显式给了 root 的 `zg_*` 工具,Remote 方法不走工具准入;真正管住它的是守护进程那份已观测根白名单(以及它自己的单操作锁)。
22
-
23
- ## 要重启的值
24
-
25
- 十一项部署值刻意不进设置卡:`searchTimeoutMs`(300000)、`statusTimeoutMs`(60000)、`indexTimeoutMs`(600000)、`stdoutMaxBytes`(400000)、`rebuildWaitMs`(120000)、`clientMode`(`auto` / `direct` / `server`)、`daemonUrl`(`http://127.0.0.1:7999/mcp`,MCP 传输的守护进程端点)、`allowRemoteEmbedding`(false)、`remoteEmbeddingEndpoint`、`remoteEmbeddingApiKeyFrom`、`requireApprovalForExplicitRoot`(false)。这十一项在卡上没有入口,能生效的只有下一段那条注册行 `config:`;优先级是注册行 `config:` > 代码里的 `.default()`。
26
-
27
- 「工作区内容能不能离开本机」被当成部署决定,而不是给模型选的开关,所以远程嵌入那三枚既不在卡上也不在工具参数里;即便开了,`zg` 自己仍要求 `--allow-remote`(部署开放后本插件在远程引用的索引命令上自动补)或一次 `zg --auth grant` 持久授权。这些值都写在**自己 profile 的 `cordis.yml`** 里本插件注册行的 `config:` 块(随包那份 `cordis.patch.yml` 带 `dsh-plugin-shared` 供应行与本行的 `id` / `name`;卡片组件来自 shared 客户端行,以 `@jayyuen66/dsh-plugin-shared/client` 外置),改值随重启生效。
28
-
29
- ## 需要外部提供什么
30
-
31
- 外部 `zg` 命令行(`@zvec/zvec-grep`,装法是 `npm install -g @zvec/zvec-grep`)。本插件在拼出任何命令之前先校版本,下限是 **0.3.0**(上游 Rust 重写后的 CLI 形态与 0.2.x 不兼容,0.2.x 会在门槛处被拦下),装的版本低于它会直接说明;命令行不存在时按「未安装」报,而不是伪装成一次查不到。增量索引刷新、`refresh=background` 与常驻模型池都需要守护进程在跑(`zg --server on`),离线时卡上会写出来。本地嵌入的后端可能还要各自的依赖(llama-cpp 需要 `node-llama-cpp`;model2vec 与 transformers-js 是纯 JavaScript)。只有 `allowRemoteEmbedding` 开着时,插件才向 `zg` 转发这两个变量:`ZVEC_GREP_ENDPOINT` 放的是 `remoteEmbeddingEndpoint` 的字面值(部署端点,不是变量名),`ZVEC_GREP_API_KEY` 才是按 `remoteEmbeddingApiKeyFrom` 指的变量名去环境里查出来的密钥。密钥要显式转发,因为宿主的子进程层会抹掉形似密钥的变量。
32
-
33
- ## 更完整的说明
34
-
35
- 参数守卫、`root`判据与后台作业那一节都写在随包 README(`README.md` / `README.zh-CN.md`)。README 没有独立的错误码表:`zg` 不在 PATH 上按 `exit 127` 归到「未安装」(见「外部依赖」一节),其余失败按工具回执里的 `reason` 读。
36
-
37
- ## 反馈
38
-
39
- 欢迎提 issue 和 PR:[https://github.com/JayYuen666/dsh-zvec-grep/issues](https://github.com/JayYuen666/dsh-zvec-grep/issues)。
40
-
41
- 插件启动失败时,请附上 dsh 宿主版本、profile 安装形态和浏览器控制台原文。`missed the module table` 这一行尤其有用:它能直接说明 shared 客户端供应行有没有被物化。
11
+ 问题与 PR:https://github.com/JayYuen666/dsh-zvec-grep/issues