@jayyuen66/dsh-zvec-grep 0.1.14 → 0.1.15

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,15 @@
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.15
6
+
7
+ 宿主开发基线抬到 `0.2.2-rc.2`,支持窗口收到 `^0.2.2-rc.1`。zg 检索工具与路由行为不变。
8
+
9
+ ### Changed
10
+
11
+ - **宿主开发基线抬到 `0.2.2-rc.2`**:`devDependencies` 整组 `@deepseek-ai/dsh-*` 抬到 `0.2.2-rc.2`,并补上 rc.2 新增的 `@deepseek-ai/dsh-error`(`dsh-llm` 的精确 peer,`autoInstallPeers: false` 下须显式声明)。
12
+ - **支持窗口收到 `^0.2.2-rc.1`**:`engines.dsh` 与 `@deepseek-ai/dsh*` peer 由 `^0.2.1-rc.5 || ^0.2.2-alpha.3` 改为 `^0.2.2-rc.1`(单条 0.2.2 线);`@deepseek-ai/schemastery` peer 由 `^3.18.5 || ^3.18.6-alpha.1` 收到 `^3.19.0`。devDependencies 仍精确钉版。
13
+
5
14
  ## 0.1.14
6
15
 
7
16
  修复 0.1.13 引入的 web 启动隐患:卡片组件收回 `client.js` 内联,移除对 `@jayyuen66/dsh-plugin-shared/client` 的模块表外置与 `cordis.patch.yml` 里的 shared 供应行。zg 命令面与 MCP 传输层不变。
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <a href="https://github.com/JayYuen666/dsh-zvec-grep/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-zvec-grep/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
13
13
  <img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
14
14
  <img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.5-658EFF?style=flat-square" alt="dsh" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.1-658EFF?style=flat-square" alt="dsh" />
16
16
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
17
17
  </p>
18
18
 
@@ -33,32 +33,33 @@
33
33
 
34
34
  ## <img src="https://api.iconify.design/lucide/file-text.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Contents
35
35
 
36
- - [What it does](#what-it-does)
37
- - [Install](#install)
38
- - [Shared version floor](#shared-version-floor)
39
- - [Verify it is live](#verify-it-is-live)
40
- - [What it does not provide](#what-it-does-not-provide)
41
- - [Enabling it in dsh](#enabling-it-in-dsh)
42
- - [Tools exposed to the model](#tools-exposed-to-the-model)
43
- - [zg_search](#zg_search)
44
- - [zg_index](#zg_index)
45
- - [zg_status](#zg_status)
36
+ - [ Contents](#-contents)
37
+ - [ What it does](#-what-it-does)
38
+ - [ Install](#-install)
39
+ - [ Shared version floor](#-shared-version-floor)
40
+ - [ Verify it is live](#-verify-it-is-live)
41
+ - [ What it does not provide](#-what-it-does-not-provide)
42
+ - [ Enabling it in dsh](#-enabling-it-in-dsh)
43
+ - [ Tools exposed to the model](#-tools-exposed-to-the-model)
44
+ - [zg\_search](#zg_search)
45
+ - [zg\_index](#zg_index)
46
+ - [zg\_status](#zg_status)
46
47
  - [The rg switch](#the-rg-switch)
47
48
  - [Root rules](#root-rules)
48
- - [The search-first gate](#the-search-first-gate)
49
- - [Settings](#settings)
49
+ - [ The search-first gate](#-the-search-first-gate)
50
+ - [ Settings](#-settings)
50
51
  - [Remote embedding](#remote-embedding)
51
52
  - [Asking before an explicit root](#asking-before-an-explicit-root)
52
- - [Support surface](#support-surface)
53
- - [External dependency](#external-dependency)
54
- - [Daemon (server mode)](#daemon-server-mode)
55
- - [Public interface](#public-interface)
56
- - [The background job surface](#the-background-job-surface)
57
- - [Data and privacy](#data-and-privacy)
58
- - [Known boundaries](#known-boundaries)
59
- - [FAQ](#faq)
60
- - [Development](#development)
61
- - [License](#license)
53
+ - [ Support surface](#-support-surface)
54
+ - [ External dependency](#-external-dependency)
55
+ - [ Daemon (server mode)](#-daemon-server-mode)
56
+ - [ Public interface](#-public-interface)
57
+ - [ The background job surface](#-the-background-job-surface)
58
+ - [ Data and privacy](#-data-and-privacy)
59
+ - [ Known boundaries](#-known-boundaries)
60
+ - [ FAQ](#-faq)
61
+ - [ Development](#-development)
62
+ - [ License](#-license)
62
63
 
63
64
  ## <img src="https://api.iconify.design/lucide/shield.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> What it does
64
65
 
@@ -77,8 +78,8 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
77
78
  Remove with `dsh plugin --profile web remove @jayyuen66/dsh-zvec-grep`. The package is on the public npm registry; no credentials, no scoped-registry line.
78
79
 
79
80
  - **Node.js `>= 24.9`** (ESM-only; that floor is what makes `require()` of an ESM entry work, hence `engines.node`).
80
- - **Host `dsh` on the `0.2.1-rc.5` or `0.2.2-alpha.3` line.** The host reads `engines.dsh` (`^0.2.1-rc.5 || ^0.2.2-alpha.3`) and it **decides alone** - with that field present, compatibility is judged before `peerDependencies` is ever consulted, prereleases included. Any `0.2.x` at or above `0.2.1-rc.5` passes the host gate; on the `0.2.2` prerelease line, strict npm peer resolution starts at `0.2.2-alpha.3`. `0.3.0` and later need the risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`. The support window rolls: at publish time this package is checked against every released host version inside the window - the judgement is the host's `--dump-config` layer line for this package, while the settings card and its namespace calls are verified once in full on the release's development baseline - and re-verified once the window moves, so the version number in this bullet is not a standing promise.
81
- - **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts`). Profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package there becomes a real second copy; `@deepseek-ai/dsh-tools` keys its scheduler with a plain `Symbol`, so **every native tool call throws** in that profile while build, typecheck and coverage stay green. The `@deepseek-ai/dsh*` peers carry the same support-window range (`^0.2.1-rc.5 || ^0.2.2-alpha.3`), while the exact pins in `devDependencies` are the compile-time discipline against a second host type surface - not a claim the host consults.
81
+ - **Host `dsh` on the `0.2.2-rc.1` line or later.** The host reads `engines.dsh` (`^0.2.2-rc.1`) 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.1` passes the host gate; strict npm peer resolution starts at `0.2.2-rc.1`. `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.
82
+ - **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.1`), while the exact pins in `devDependencies` are the compile-time discipline against a second host type surface - not a claim the host consults.
82
83
  - **Value imports are required peers.** `@deepseek-ai/schemastery` is the host fork (only its `resolve` wraps `.volatile()` fields); `@deepseek-ai/dsh-typert-protocol` provides `TypertRemoteService`, a class to `extends`; `@deepseek-ai/dsh-scope` provides `scopeOf` for the step-admission lookup; shared's `lib/text` value-imports `@deepseek-ai/dsh-output-retention`. Each sits in `peerDependencies` plus the same exact pin in `devDependencies` - missing one is `ERR_MODULE_NOT_FOUND` at load, not a graceful downgrade. `dependencies` holds `@jayyuen66/dsh-plugin-shared` and `zod` (the latter versioned through the umbrella catalog, used by the settings card's strict codecs).
83
84
  - **What ships**: `host.js`, `client.js`, `cordis.patch.yml`, `icon.svg`, both READMEs, `CHANGELOG.md`, `THIRD_PARTY_NOTICES.md`, `locale/zh.json` + `locale/en.json`, and `docs/` (both DETAIL files). Artifacts are rebuilt by `prepack`, never committed.
84
85
 
package/README.zh-CN.md CHANGED
@@ -12,7 +12,7 @@
12
12
  <a href="https://github.com/JayYuen666/dsh-zvec-grep/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-zvec-grep/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
13
13
  <img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
14
14
  <img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.5-658EFF?style=flat-square" alt="dsh" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.1-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
 
@@ -46,7 +46,7 @@
46
46
  - [zg\_status](#zg_status)
47
47
  - [rg 开关](#rg-开关)
48
48
  - [root 判据](#root-判据)
49
- - [ search-first 检查](#-search-first-检查)
49
+ - [ search-first 门禁](#-search-first-门禁)
50
50
  - [ 设置项](#-设置项)
51
51
  - [远程 embedding](#远程-embedding)
52
52
  - [显式 root 前的确认](#显式-root-前的确认)
@@ -78,8 +78,8 @@ dsh plugin --profile web add @jayyuen66/dsh-zvec-grep
78
78
  卸载用 `dsh plugin --profile web remove @jayyuen66/dsh-zvec-grep`。包在公共 npm registry 上,不需要凭据,也不需要 scoped-registry 配置行。
79
79
 
80
80
  - **Node.js `>= 24.9`**(纯 ESM;正是这个下限让 `require()` 一枚 ESM 入口成为可能,`engines.node` 因此声明)。
81
- - **宿主 `dsh` 在 `0.2.1-rc.5` 或 `0.2.2-alpha.3` 这条线上。** 宿主读 `engines.dsh`(`^0.2.1-rc.5 || ^0.2.2-alpha.3`)且**单独决定**——该字段在场时兼容性先于 `peerDependencies` 判定,prerelease 参与比较。`0.2.x` 里不低于 `0.2.1-rc.5` 的都通过宿主装载门;`0.2.2` 预发布线上,npm 的严格 peer 解析从 `0.2.2-alpha.3` 起算。`0.3.0` 及以上需要风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <确切版本> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证(判据是宿主 `--dump-config` 里本包的层行;设置卡与它的命名空间调用另在发布基线上全量取证一次),窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
82
- - **按约定,`dependencies` 下不放任何 `@deepseek-ai/*`**(`test/publish-manifest.test.ts` 钉住)。profile 以 `nodeLinker: hoisted` 与 `autoInstallPeers: false` 安装,宿主包在那里会落成真实的第二份副本;`@deepseek-ai/dsh-tools` 用普通 `Symbol` 给调度器做键,那个 profile 里**每一次原生工具调用都抛错**,而构建、类型检查与覆盖率照绿。`@deepseek-ai/dsh*` 的 peer 写同一条支持窗口范围(`^0.2.1-rc.5 || ^0.2.2-alpha.3`),`devDependencies` 里的精确钉版才是防「第二份宿主类型」的编译期纪律——那不是宿主会去读的声明。
81
+ - **宿主 `dsh` 在 `0.2.2-rc.1` 或更新的 `0.2.2` 这条线上。** 宿主读 `engines.dsh`(`^0.2.2-rc.1`)且**单独决定**——该字段在场时兼容性先于 `peerDependencies` 判定,prerelease 参与比较。`0.2.x` 里不低于 `0.2.2-rc.1` 的都通过宿主装载门;npm 的严格 peer 解析从 `0.2.2-rc.1` 起算。`0.3.0` 及以上需要风险授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <确切版本> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证(判据是宿主 `--dump-config` 里本包的层行;设置卡与它的命名空间调用另在发布基线上全量取证一次),窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
82
+ - **按约定,`dependencies` 下不放任何 `@deepseek-ai/*`**(`test/publish-manifest.test.ts` 钉住)。profile 以 `nodeLinker: hoisted` 与 `autoInstallPeers: false` 安装,宿主包在那里会落成真实的第二份副本;`@deepseek-ai/dsh-tools` 用普通 `Symbol` 给调度器做键,那个 profile 里**每一次原生工具调用都抛错**,而构建、类型检查与覆盖率照绿。`@deepseek-ai/dsh*` 的 peer 写同一条支持窗口范围(`^0.2.2-rc.1`),`devDependencies` 里的精确钉版才是防「第二份宿主类型」的编译期纪律——那不是宿主会去读的声明。
83
83
  - **值导入都是必需 peer。** `@deepseek-ai/schemastery` 是宿主 fork(只有它的 `resolve` 认 `.volatile()` 字段);`@deepseek-ai/dsh-typert-protocol` 提供 `TypertRemoteService` 这个要 `extends` 的类;`@deepseek-ai/dsh-scope` 提供步骤准入判定用的 `scopeOf`;shared 的 `lib/text` 自己值导入 `@deepseek-ai/dsh-output-retention`。四者都落 peer 加同版精确钉的 devDependencies——缺一枚就是装载期 `ERR_MODULE_NOT_FOUND`,不是优雅降级。`dependencies` 里是 `@jayyuen66/dsh-plugin-shared` 与 `zod`(后者版本走伞根 catalog,供设置卡的 strict codec 校验)。
84
84
  - **随包发什么**:`host.js`、`client.js`、`cordis.patch.yml`、`icon.svg`、两份 README、`CHANGELOG.md`、`THIRD_PARTY_NOTICES.md`、`locale/zh.json` + `locale/en.json`、`docs/`(两份 DETAIL)。产物由 `prepack` 现产,不入库。
85
85
 
package/client.js CHANGED
@@ -88,7 +88,7 @@ const REMOTE_EMBEDDING_CATALOG = Object.freeze([
88
88
  dimension: 1024
89
89
  }
90
90
  ].map((entry) => Object.freeze(entry)));
91
- // node_modules/@jayyuen66/dsh-plugin-shared/dist/card-ui-C1lrHILm.js
91
+ // node_modules/@jayyuen66/dsh-plugin-shared/dist/card-ui-D2cuQvLS.js
92
92
  const c = `
93
93
  .dsu-form{display:flex;flex-direction:column}
94
94
  .dsu-section{margin-top:24px;padding-top:24px;border-top:.5px solid var(--dsw-alias-border-l1)}
@@ -134,7 +134,7 @@ const c = `
134
134
  .dsu-selectValue{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
135
135
  .dsu-chevron{flex:none;color:var(--dsw-alias-label-tertiary);transition:transform .16s}
136
136
  .dsu-select[aria-expanded="true"] .dsu-chevron{transform:rotate(180deg)}
137
- .dsu-menu{position:fixed;z-index:70;padding:4px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);border-radius:12px;box-shadow:0 12px 32px rgb(0 0 0 / 50%);max-height:280px;overflow:auto}
137
+ .dsu-menu{position:fixed;position-area:block-end span-inline-start;justify-self:start;margin-top:6px;z-index:70;padding:4px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);border-radius:12px;box-shadow:0 12px 32px rgb(0 0 0 / 50%);max-height:280px;overflow:auto}
138
138
  .dsu-option{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.4;width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 10px;border-radius:8px;cursor:pointer;text-align:left}
139
139
  .dsu-option:hover,.dsu-option[data-active="true"]{background:var(--dsw-alias-bg-layer-3)}
140
140
  .dsu-option:disabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}
@@ -400,60 +400,66 @@ function y(t) {
400
400
  controlId: l
401
401
  }, t.multiline === !0 ? (0, react.createElement)(`textarea`, d) : (0, react.createElement)(`input`, d));
402
402
  }
403
- function x(c) {
404
- let [l, u] = (0, react.useState)(!1), [d, f] = (0, react.useState)(0), p = (0, react.useRef)(null), m = (0, react.useRef)(null), h = (0, react.useId)(), _ = (0, react.useId)(), v = c.hint === void 0 ? void 0 : `${_}-hint`, { disabled: y, value: b, options: x, onChange: S } = c, C = (0, react.useMemo)(() => x.map((e, t) => ({
403
+ function x() {
404
+ return `happyDOM` in globalThis ? !1 : typeof CSS < `u` && typeof CSS.supports == `function` && CSS.supports(`position-area: block-end`);
405
+ }
406
+ function S(c) {
407
+ let [l, u] = (0, react.useState)(!1), [d, f] = (0, react.useState)(0), p = (0, react.useRef)(null), m = (0, react.useRef)(null), h = (0, react.useId)(), _ = (0, react.useId)(), v = `--dsu-${_.replaceAll(/[^a-zA-Z0-9]/gu, ``)}`, y = c.hint === void 0 ? void 0 : `${_}-hint`, { disabled: b, value: S, options: C, onChange: w } = c, T = (0, react.useMemo)(() => C.map((e, t) => ({
405
408
  option: e,
406
409
  index: t
407
- })).filter((e) => e.option.disabled !== !0), [x]), w = x.find((e) => e.value === b)?.label ?? b, T = x[d], E = T !== void 0 && T.disabled !== !0, D = (0, react.useCallback)(() => {
410
+ })).filter((e) => e.option.disabled !== !0), [C]), E = C.find((e) => e.value === S)?.label ?? S, D = C[d], O = D !== void 0 && D.disabled !== !0, k = (0, react.useCallback)(() => {
408
411
  let e = p.current, t = m.current;
409
412
  /* v8 ignore next 3 -- place 只在 open 的 layout effect 里调用;refs 为空只可能是卸载竞态 */
410
413
  if (e === null || t === null) return;
411
- let n = e.getBoundingClientRect(), r = Math.min(n.width, window.innerWidth - 16), { left: i } = n;
414
+ let n = e.getBoundingClientRect(), r = Math.min(n.width, window.innerWidth - 16);
415
+ if (t.style.width = `${r}px`, x()) return;
416
+ t.style.marginTop = `0px`;
417
+ let { left: i } = n;
412
418
  i + r > window.innerWidth - 8 && (i = window.innerWidth - r - 8);
413
419
  let a = t.offsetHeight, o = n.bottom + 6;
414
420
  o + a > window.innerHeight - 8 && (o = n.top - a - 6);
415
421
  let s = Math.max(8, window.innerWidth - r - 8), c = Math.max(8, window.innerHeight - a - 8);
416
- t.style.width = `${r}px`, t.style.left = `${Math.min(Math.max(8, i), s)}px`, t.style.top = `${Math.min(Math.max(8, o), c)}px`;
417
- }, []), O = (0, react.useCallback)(() => {
422
+ t.style.left = `${Math.min(Math.max(8, i), s)}px`, t.style.top = `${Math.min(Math.max(8, o), c)}px`;
423
+ }, []), A = (0, react.useCallback)(() => {
418
424
  u(!1);
419
- }, []), k = (0, react.useCallback)(() => {
420
- if (y === !0) return;
421
- let e = C.find((e) => e.option.value === b) ?? C.at(0);
425
+ }, []), j = (0, react.useCallback)(() => {
426
+ if (b === !0) return;
427
+ let e = T.find((e) => e.option.value === S) ?? T.at(0);
422
428
  e !== void 0 && (f(e.index), u(!0));
423
429
  }, [
424
- y,
425
430
  b,
426
- C
427
- ]), A = (0, react.useCallback)((e) => {
431
+ S,
432
+ T
433
+ ]), M = (0, react.useCallback)((e) => {
428
434
  /* v8 ignore next 3 -- 浮层只能经由 openMenu 打开;组件禁用时打不开 */
429
- if (y === !0) return;
430
- let t = x[e];
431
- /* v8 ignore next 3 -- disabled 选项在浏览器里不派发 click;越界下标由调用面保证 */
432
- t !== void 0 && t.disabled !== !0 && (S(t.value), O(), p.current?.focus());
435
+ if (b === !0) return;
436
+ let t = C[e];
437
+ /* v8 ignore next 3 -- disabled 选项在浏览器里不派发 click;越界下标由调用方保证 */
438
+ t !== void 0 && t.disabled !== !0 && (w(t.value), A(), p.current?.focus());
433
439
  }, [
434
- y,
435
- x,
436
- S,
437
- O
438
- ]), j = (0, react.useCallback)((e) => {
439
- let t = C.findIndex((e) => e.index === d);
440
+ b,
441
+ C,
442
+ w,
443
+ A
444
+ ]), N = (0, react.useCallback)((e) => {
445
+ let t = T.findIndex((e) => e.index === d);
440
446
  /* v8 ignore next 5 -- open 时归一 effect 已保证 enabled 非空且 active 落在可用项上 */
441
- if (t === -1 || C.length === 0) return;
442
- let n = (t + e + C.length) % C.length, r = C[n];
447
+ if (t === -1 || T.length === 0) return;
448
+ let n = (t + e + T.length) % T.length, r = T[n];
443
449
  /* v8 ignore next 3 -- next 由取模保证在界内 */
444
450
  r !== void 0 && f(r.index);
445
- }, [d, C]);
451
+ }, [d, T]);
446
452
  (0, react.useLayoutEffect)(() => {
447
453
  if (!l) return () => {};
448
- D();
454
+ k();
449
455
  let e = (e) => {
450
456
  let t = e.target;
451
- m.current?.contains(t) !== !0 && p.current?.contains(t) !== !0 && O();
457
+ m.current?.contains(t) !== !0 && p.current?.contains(t) !== !0 && A();
452
458
  }, t = (e) => {
453
459
  let { target: t } = e;
454
- t instanceof Node && m.current?.contains(t) === !0 || O();
460
+ t instanceof Node && m.current?.contains(t) === !0 || A();
455
461
  }, n = () => {
456
- D();
462
+ k();
457
463
  };
458
464
  return document.addEventListener(`pointerdown`, e, !0), window.addEventListener(`scroll`, t, !0), window.addEventListener(`resize`, n), () => {
459
465
  document.removeEventListener(`pointerdown`, e, !0), window.removeEventListener(`scroll`, t, !0), window.removeEventListener(`resize`, n);
@@ -461,26 +467,26 @@ function x(c) {
461
467
  }, [
462
468
  l,
463
469
  c.options,
464
- D,
465
- O
470
+ k,
471
+ A
466
472
  ]), (0, react.useEffect)(() => {
467
473
  if (!l) return;
468
- if (y === !0 || C.length === 0) {
469
- O();
474
+ if (b === !0 || T.length === 0) {
475
+ A();
470
476
  return;
471
477
  }
472
- if (C.some((e) => e.index === d)) return;
473
- let e = C.find((e) => e.option.value === b) ?? C.at(0);
478
+ if (T.some((e) => e.index === d)) return;
479
+ let e = T.find((e) => e.option.value === S) ?? T.at(0);
474
480
  /* v8 ignore next 3 -- enabled 非空在上一分支已保证 */
475
481
  e !== void 0 && f(e.index);
476
482
  }, [
477
483
  l,
478
- y,
479
484
  b,
480
- x,
485
+ S,
486
+ C,
481
487
  d,
482
- O,
483
- C
488
+ A,
489
+ T
484
490
  ]), (0, react.useLayoutEffect)(() => {
485
491
  if (!l) return;
486
492
  let e = m.current;
@@ -492,34 +498,34 @@ function x(c) {
492
498
  }, [
493
499
  l,
494
500
  d,
495
- x
501
+ C
496
502
  ]);
497
- let M = (e) => {
503
+ let P = (e) => {
498
504
  if (e.key === `ArrowDown` || e.key === `ArrowUp`) {
499
505
  if (e.preventDefault(), !l) {
500
- k();
506
+ j();
501
507
  return;
502
508
  }
503
- j(e.key === `ArrowDown` ? 1 : -1);
509
+ N(e.key === `ArrowDown` ? 1 : -1);
504
510
  } else if (e.key === `Home` || e.key === `End`) {
505
- if (e.preventDefault(), l || k(), C.length === 0) return;
506
- let t = e.key === `Home` ? C.at(0) : C.at(-1);
511
+ if (e.preventDefault(), l || j(), T.length === 0) return;
512
+ let t = e.key === `Home` ? T.at(0) : T.at(-1);
507
513
  /* v8 ignore next 3 -- enabled 为空已在上一条返回 */
508
514
  if (t === void 0) return;
509
515
  f(t.index);
510
516
  } else if (e.key === `Enter` || e.key === ` `) {
511
517
  if (e.preventDefault(), !l) {
512
- k();
518
+ j();
513
519
  return;
514
520
  }
515
- A(d);
516
- } else (e.key === `Tab` || e.key === `Escape`) && O();
517
- }, N = [], P;
518
- for (let [t, n] of x.entries()) n.group !== P && (n.group !== void 0 && N.push((0, react.createElement)(`div`, {
521
+ M(d);
522
+ } else (e.key === `Tab` || e.key === `Escape`) && A();
523
+ }, F = [], I;
524
+ for (let [t, n] of C.entries()) n.group !== I && (n.group !== void 0 && F.push((0, react.createElement)(`div`, {
519
525
  key: `group-${t}-${n.group}`,
520
526
  className: `dsu-optionGroup`,
521
527
  role: `presentation`
522
- }, n.group)), P = n.group), N.push((0, react.createElement)(`button`, {
528
+ }, n.group)), I = n.group), F.push((0, react.createElement)(`button`, {
523
529
  key: `option-${n.value}`,
524
530
  type: `button`,
525
531
  role: `option`,
@@ -533,7 +539,7 @@ function x(c) {
533
539
  e.preventDefault();
534
540
  },
535
541
  onClick: () => {
536
- A(t);
542
+ M(t);
537
543
  },
538
544
  onMouseEnter: () => {
539
545
  /* v8 ignore next -- happy-dom 对 disabled 元素不派发 mouse 事件;浏览器实现各有差异,保留禁用检查 */
@@ -560,26 +566,27 @@ function x(c) {
560
566
  className: `dsu-selectWrap`,
561
567
  onBlur: (e) => {
562
568
  let t = e.relatedTarget;
563
- t instanceof Node && e.currentTarget.contains(t) || O();
569
+ t instanceof Node && e.currentTarget.contains(t) || A();
564
570
  }
565
571
  }, (0, react.createElement)(`button`, {
566
572
  ref: p,
567
573
  type: `button`,
568
574
  id: _,
575
+ style: { anchorName: v },
569
576
  className: `dsu-select dsu-input`,
570
577
  role: `combobox`,
571
578
  "aria-haspopup": `listbox`,
572
579
  "aria-expanded": l,
573
580
  "aria-controls": `${h}-list`,
574
- "aria-activedescendant": l && E ? `${h}-${d}` : void 0,
575
- "aria-describedby": v,
581
+ "aria-activedescendant": l && O ? `${h}-${d}` : void 0,
582
+ "aria-describedby": y,
576
583
  "data-field": c.field,
577
- disabled: y === !0 || x.length === 0,
584
+ disabled: b === !0 || C.length === 0,
578
585
  onClick: () => {
579
- l ? O() : k();
586
+ l ? A() : j();
580
587
  },
581
- onKeyDown: M
582
- }, (0, react.createElement)(`span`, { className: `dsu-selectValue` }, w), (0, react.createElement)(`svg`, {
588
+ onKeyDown: P
589
+ }, (0, react.createElement)(`span`, { className: `dsu-selectValue` }, E), (0, react.createElement)(`svg`, {
583
590
  className: `dsu-chevron`,
584
591
  width: 14,
585
592
  height: 14,
@@ -597,11 +604,15 @@ function x(c) {
597
604
  id: `${h}-list`,
598
605
  role: `listbox`,
599
606
  className: `dsu-menu`,
607
+ style: {
608
+ positionAnchor: v,
609
+ positionTryFallbacks: `flip-block, flip-inline`
610
+ },
600
611
  "aria-label": c.label,
601
612
  hidden: !l
602
- }, ...N)));
613
+ }, ...F)));
603
614
  }
604
- function S(t) {
615
+ function C(t) {
605
616
  let n = !t.writable || t.busy || !t.dirty, r;
606
617
  return r = t.error === null ? t.writable ? t.dirty ? t.dirtyLabel : t.cleanLabel : t.readOnlyLabel : t.error, (0, react.createElement)(`div`, {
607
618
  className: `dsu-savebar`,
@@ -1189,7 +1200,7 @@ function numberDisplay(display, schema) {
1189
1200
  /** 检索模型小节:embedding 下拉(按本地后端分组)+ 每组结果数。 */
1190
1201
  function buildModelSection(deps) {
1191
1202
  const { editable, fields, setField, t } = deps;
1192
- const embedding = (0, react.createElement)(x, {
1203
+ const embedding = (0, react.createElement)(S, {
1193
1204
  label: t("embeddingLabel"),
1194
1205
  ...l(t("embeddingHint")),
1195
1206
  field: "defaultEmbedding",
@@ -1277,7 +1288,7 @@ function buildRebuildStatusRow(deps) {
1277
1288
  /** 网络与索引小节:传输三档、镜像地址、search-first 开关、配额与时效、工作区重建与守护进程状态。 */
1278
1289
  function buildIndexSection(deps) {
1279
1290
  const { editable, fields, setField, t } = deps;
1280
- const transport = (0, react.createElement)(x, {
1291
+ const transport = (0, react.createElement)(S, {
1281
1292
  label: t("transportLabel"),
1282
1293
  ...l(t("transportHint")),
1283
1294
  field: "transport",
@@ -1345,7 +1356,7 @@ function buildIndexSection(deps) {
1345
1356
  /** 卡片主体:检索模型 / 网络与索引两节 + 保存条。 */
1346
1357
  function buildCardBody(deps) {
1347
1358
  const { t } = deps;
1348
- const saveBar = (0, react.createElement)(S, {
1359
+ const saveBar = (0, react.createElement)(C, {
1349
1360
  dirty: deps.dirty,
1350
1361
  busy: deps.busy,
1351
1362
  writable: deps.writable,
package/host.js CHANGED
@@ -5,7 +5,7 @@ import { accessSync, constants, existsSync, readFileSync, statSync } from "node:
5
5
  import { homedir, tmpdir } from "node:os";
6
6
  import nodePath from "node:path";
7
7
  import { scopeOf } from "@deepseek-ai/dsh-scope";
8
- import { isRecord } from "@jayyuen66/dsh-plugin-shared/lib/record";
8
+ import { isRecord as isRecord$1 } from "@jayyuen66/dsh-plugin-shared/lib/record";
9
9
  import { errorText } from "@jayyuen66/dsh-plugin-shared/lib/errors";
10
10
  import { LOCALE_SETTINGS_NAMESPACE, messagesFor, resolveLocalePreference } from "@jayyuen66/dsh-plugin-shared/lib/locale";
11
11
  import { truncateEnd, truncateStart } from "@jayyuen66/dsh-plugin-shared/lib/text";
@@ -1995,7 +1995,7 @@ function zgToolProblem(name, args, execution, messages, platform) {
1995
1995
  */
1996
1996
  function zgGuard(execution, messages, platform = "posix") {
1997
1997
  const { name } = execution;
1998
- const args = isRecord(execution.arguments) ? execution.arguments : {};
1998
+ const args = isRecord$1(execution.arguments) ? execution.arguments : {};
1999
1999
  let reason;
2000
2000
  if (isZgToolName(name)) reason = zgToolProblem(name, args, execution, messages, platform);
2001
2001
  return reason;
@@ -2182,7 +2182,7 @@ function nativeGrepProblem(args, cwd, deps, messages) {
2182
2182
  */
2183
2183
  function searchFirstGuard(execution, deps, messages) {
2184
2184
  const { name } = execution;
2185
- const args = isRecord(execution.arguments) ? execution.arguments : {};
2185
+ const args = isRecord$1(execution.arguments) ? execution.arguments : {};
2186
2186
  const cwd = sessionHeaderCwd$1(execution);
2187
2187
  let reason;
2188
2188
  if (deps.enabled && cwd !== void 0 && searchAdmitted(execution)) {
@@ -2665,6 +2665,46 @@ function readClientMode(config, messages) {
2665
2665
  return clientModeOf(config.clientMode, messages);
2666
2666
  }
2667
2667
  // lib/rebuild-remote.ts
2668
+ var __runInitializers = function(thisArg, initializers, value) {
2669
+ var useValue = arguments.length > 2;
2670
+ for (var i = 0; i < initializers.length; i++) value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
2671
+ return useValue ? value : void 0;
2672
+ };
2673
+ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2674
+ function accept(f) {
2675
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
2676
+ return f;
2677
+ }
2678
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
2679
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
2680
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
2681
+ var _, done = false;
2682
+ for (var i = decorators.length - 1; i >= 0; i--) {
2683
+ var context = {};
2684
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
2685
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
2686
+ context.addInitializer = function(f) {
2687
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
2688
+ extraInitializers.push(accept(f || null));
2689
+ };
2690
+ var result = (0, decorators[i])(kind === "accessor" ? {
2691
+ get: descriptor.get,
2692
+ set: descriptor.set
2693
+ } : descriptor[key], context);
2694
+ if (kind === "accessor") {
2695
+ if (result === void 0) continue;
2696
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
2697
+ if (_ = accept(result.get)) descriptor.get = _;
2698
+ if (_ = accept(result.set)) descriptor.set = _;
2699
+ if (_ = accept(result.init)) initializers.unshift(_);
2700
+ } else if (_ = accept(result)) {
2701
+ if (kind === "field") initializers.unshift(_);
2702
+ else descriptor[key] = _;
2703
+ }
2704
+ }
2705
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
2706
+ done = true;
2707
+ };
2668
2708
  /** 本包作业的 kind(宿主据此发出的 id 形如 `zvec-grep-rebuild-<hex>`)。 */
2669
2709
  const REBUILD_JOB_KIND = "zvec-grep-rebuild";
2670
2710
  /** 卡片视图的尾部长度(打标文案在 lib/messages.ts,随语言走)。 */
@@ -3096,159 +3136,183 @@ function releaseRebuildRecords(deps) {
3096
3136
  * 本包也不把 `jobs` 列进 `inject` 名单:那会让缺席的整条 client 入口都不激活,而缺席只该让
3097
3137
  * 「启动/轮询」这一档不可用。
3098
3138
  */
3099
- var ZvecRebuildService = class extends TypertRemoteService {
3100
- deps;
3101
- constructor(ctx, deps) {
3102
- super(ctx, REBUILD_REMOTE_NAMESPACE);
3103
- this.deps = deps;
3104
- }
3105
- /** 引导读取接口:白名单里的工作区 + 守护进程就绪态(都是本插件自己的数据)。 */
3106
- async roots() {
3107
- let serverReady = false;
3108
- try {
3109
- serverReady = await this.deps.serverGate.ready();
3110
- } catch {}
3111
- return {
3112
- roots: this.deps.ledger.list(),
3113
- serverReady
3114
- };
3115
- }
3116
- /**
3117
- * 起一条重建(或跟随同根已在跑的那条)。
3118
- *
3119
- * 占位是**互斥的唯一依据**,必须落在第一个 await 之前。先「查在不在跑」再占位,
3120
- * 两次并发点击会同时通过那次查询、各自 spawn——两个进程在同一份索引上互相啃,
3121
- * 后一条被 zg 的写锁直接顶掉并报成「启动失败」。改成「先占位、抢不到就跟随」,
3122
- * 这条竞态就没有窗口了。
3123
- */
3124
- async rebuild(request) {
3125
- const started = this.deps.messages();
3126
- const accepted = acceptableRoot(isRecord(request) ? request.root : void 0, this.deps.ledger, started, this.deps.platform);
3127
- if ("error" in accepted) return {
3128
- ok: false,
3129
- error: accepted.error.value,
3130
- status: accepted.error.status
3131
- };
3132
- const { root } = accepted;
3133
- const jobs = this.deps.jobsOf();
3134
- if (jobs === void 0) return {
3135
- ok: false,
3136
- error: started.endpointJobsUnavailable,
3137
- status: 503
3138
- };
3139
- const claimed = this.deps.rebuilds.claim(root, "card");
3140
- if (claimed === null) {
3141
- const following = followRunningRebuild(jobs, this.deps.records, root);
3142
- return following === void 0 ? {
3139
+ let ZvecRebuildService = (() => {
3140
+ let _classSuper = TypertRemoteService;
3141
+ let _instanceExtraInitializers = [];
3142
+ let _roots_decorators;
3143
+ let _rebuild_decorators;
3144
+ let _status_decorators;
3145
+ return class ZvecRebuildService extends _classSuper {
3146
+ static {
3147
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
3148
+ _roots_decorators = [Remote("roots")];
3149
+ _rebuild_decorators = [Remote("rebuild")];
3150
+ _status_decorators = [Remote("status")];
3151
+ __esDecorate(this, null, _roots_decorators, {
3152
+ kind: "method",
3153
+ name: "roots",
3154
+ static: false,
3155
+ private: false,
3156
+ access: {
3157
+ has: (obj) => "roots" in obj,
3158
+ get: (obj) => obj.roots
3159
+ },
3160
+ metadata: _metadata
3161
+ }, null, _instanceExtraInitializers);
3162
+ __esDecorate(this, null, _rebuild_decorators, {
3163
+ kind: "method",
3164
+ name: "rebuild",
3165
+ static: false,
3166
+ private: false,
3167
+ access: {
3168
+ has: (obj) => "rebuild" in obj,
3169
+ get: (obj) => obj.rebuild
3170
+ },
3171
+ metadata: _metadata
3172
+ }, null, _instanceExtraInitializers);
3173
+ __esDecorate(this, null, _status_decorators, {
3174
+ kind: "method",
3175
+ name: "status",
3176
+ static: false,
3177
+ private: false,
3178
+ access: {
3179
+ has: (obj) => "status" in obj,
3180
+ get: (obj) => obj.status
3181
+ },
3182
+ metadata: _metadata
3183
+ }, null, _instanceExtraInitializers);
3184
+ }
3185
+ constructor(ctx, deps) {
3186
+ super(ctx, REBUILD_REMOTE_NAMESPACE);
3187
+ __runInitializers(this, _instanceExtraInitializers);
3188
+ this.deps = deps;
3189
+ }
3190
+ /** 引导读取接口:白名单里的工作区 + 守护进程就绪态(都是本插件自己的数据)。 */
3191
+ async roots() {
3192
+ let serverReady = false;
3193
+ try {
3194
+ serverReady = await this.deps.serverGate.ready();
3195
+ } catch {}
3196
+ return {
3197
+ roots: this.deps.ledger.list(),
3198
+ serverReady
3199
+ };
3200
+ }
3201
+ /**
3202
+ * 起一条重建(或跟随同根已在跑的那条)。
3203
+ *
3204
+ * 占位是**互斥的唯一依据**,必须落在第一个 await 之前。先「查在不在跑」再占位,
3205
+ * 两次并发点击会同时通过那次查询、各自 spawn——两个进程在同一份索引上互相啃,
3206
+ * 后一条被 zg 的写锁直接顶掉并报成「启动失败」。改成「先占位、抢不到就跟随」,
3207
+ * 这条竞态就没有窗口了。
3208
+ */
3209
+ async rebuild(request) {
3210
+ const started = this.deps.messages();
3211
+ const accepted = acceptableRoot(isRecord$1(request) ? request.root : void 0, this.deps.ledger, started, this.deps.platform);
3212
+ if ("error" in accepted) return {
3143
3213
  ok: false,
3144
- error: started.endpointRebuildInFlight,
3145
- status: 409
3146
- } : {
3214
+ error: accepted.error.value,
3215
+ status: accepted.error.status
3216
+ };
3217
+ const { root } = accepted;
3218
+ const jobs = this.deps.jobsOf();
3219
+ if (jobs === void 0) return {
3220
+ ok: false,
3221
+ error: started.endpointJobsUnavailable,
3222
+ status: 503
3223
+ };
3224
+ const claimed = this.deps.rebuilds.claim(root, "card");
3225
+ if (claimed === null) {
3226
+ const following = followRunningRebuild(jobs, this.deps.records, root);
3227
+ return following === void 0 ? {
3228
+ ok: false,
3229
+ error: started.endpointRebuildInFlight,
3230
+ status: 409
3231
+ } : {
3232
+ ok: true,
3233
+ jobId: following,
3234
+ reused: true
3235
+ };
3236
+ }
3237
+ const embedding = readDefaultEmbedding(this.deps.config);
3238
+ const spawned = await spawnIndexWrite(this.deps, started, {
3239
+ root,
3240
+ embedding,
3241
+ rebuild: true
3242
+ }, embedding);
3243
+ if ("error" in spawned) {
3244
+ this.deps.rebuilds.release(root, claimed);
3245
+ return {
3246
+ ok: false,
3247
+ error: spawned.error,
3248
+ status: spawned.status
3249
+ };
3250
+ }
3251
+ const attached = attachIndexWrite(this.deps, root, started, spawned, claimed);
3252
+ if ("error" in attached) {
3253
+ this.deps.rebuilds.release(root, claimed);
3254
+ return {
3255
+ ok: false,
3256
+ error: attached.error,
3257
+ status: attached.status
3258
+ };
3259
+ }
3260
+ this.deps.rebuilds.attach(root, attached.jobId, claimed);
3261
+ return {
3147
3262
  ok: true,
3148
- jobId: following,
3149
- reused: true
3263
+ jobId: attached.jobId
3150
3264
  };
3151
3265
  }
3152
- const embedding = readDefaultEmbedding(this.deps.config);
3153
- const spawned = await spawnIndexWrite(this.deps, started, {
3154
- root,
3155
- embedding,
3156
- rebuild: true
3157
- }, embedding);
3158
- if ("error" in spawned) {
3159
- this.deps.rebuilds.release(root, claimed);
3160
- return {
3266
+ /**
3267
+ * 轮询读取接口:官方状态投影 + 退出码/沙箱事实 + 打标后的输出尾窗(卡片每 2s 敲一次)。
3268
+ *
3269
+ * 侧表就是这条投影的授权边界:官方 id 是可预测的 `<kind>-<hex>`(宿主 bash 工具的
3270
+ * `bash-1` 同样猜得到),而它不在本包表里 ⇒ 一律拒绝,绝不代读别人的作业。
3271
+ */
3272
+ status(request) {
3273
+ const marks = this.deps.messages();
3274
+ const raw = isRecord$1(request) ? request.jobId : void 0;
3275
+ const record = typeof raw === "string" && raw.length > 0 ? this.deps.records.get(raw) : void 0;
3276
+ if (record === void 0) return {
3161
3277
  ok: false,
3162
- error: spawned.error,
3163
- status: spawned.status
3278
+ error: fill(marks.unknownJobId, { maxJobs: 10 }),
3279
+ status: 404
3164
3280
  };
3165
- }
3166
- const attached = attachIndexWrite(this.deps, root, started, spawned, claimed);
3167
- if ("error" in attached) {
3168
- this.deps.rebuilds.release(root, claimed);
3169
- return {
3281
+ const jobs = this.deps.jobsOf();
3282
+ if (jobs === void 0) return {
3170
3283
  ok: false,
3171
- error: attached.error,
3172
- status: attached.status
3284
+ error: marks.endpointJobsUnavailable,
3285
+ status: 503
3286
+ };
3287
+ const output = readRebuildOutput(jobs, record.id);
3288
+ if (output === null) return {
3289
+ ok: false,
3290
+ error: fill(marks.unknownJobId, { maxJobs: 10 }),
3291
+ status: 404
3292
+ };
3293
+ if (!sameJob(record.state, output.view)) return {
3294
+ ok: false,
3295
+ error: fill(marks.unknownJobId, { maxJobs: 10 }),
3296
+ status: 404
3297
+ };
3298
+ const { view, retained } = output;
3299
+ const text = retained.chunks.map((chunk) => chunk.text).join("");
3300
+ const shown = truncateStart(text, JOB_OUT_VIEW_CHARS);
3301
+ const viewMark = text.length > JOB_OUT_VIEW_CHARS ? fill(marks.jobOutputView, {
3302
+ shown: JOB_OUT_VIEW_CHARS,
3303
+ total: text.length
3304
+ }) : "";
3305
+ return {
3306
+ ok: true,
3307
+ status: view.status,
3308
+ exitCode: record.proc.exitCode,
3309
+ root: record.root,
3310
+ ...record.proc.sandbox === void 0 ? {} : { sandbox: record.proc.sandbox },
3311
+ output: (view.output.earliest > 0 ? marks.jobOutputTruncated : "") + (record.state.lost ? marks.jobOutputLost : "") + (record.state.timeoutNote ?? "") + (procSandboxNote(record.proc, marks) ?? "") + viewMark + shown
3173
3312
  };
3174
- }
3175
- this.deps.rebuilds.attach(root, attached.jobId, claimed);
3176
- return {
3177
- ok: true,
3178
- jobId: attached.jobId
3179
- };
3180
- }
3181
- /**
3182
- * 轮询读取接口:官方状态投影 + 退出码/沙箱事实 + 打标后的输出尾窗(卡片每 2s 敲一次)。
3183
- *
3184
- * 侧表就是这条投影的授权边界:官方 id 是可预测的 `<kind>-<hex>`(宿主 bash 工具的
3185
- * `bash-1` 同样猜得到),而它不在本包表里 ⇒ 一律拒绝,绝不代读别人的作业。
3186
- */
3187
- status(request) {
3188
- const marks = this.deps.messages();
3189
- const raw = isRecord(request) ? request.jobId : void 0;
3190
- const record = typeof raw === "string" && raw.length > 0 ? this.deps.records.get(raw) : void 0;
3191
- if (record === void 0) return {
3192
- ok: false,
3193
- error: fill(marks.unknownJobId, { maxJobs: 10 }),
3194
- status: 404
3195
- };
3196
- const jobs = this.deps.jobsOf();
3197
- if (jobs === void 0) return {
3198
- ok: false,
3199
- error: marks.endpointJobsUnavailable,
3200
- status: 503
3201
- };
3202
- const output = readRebuildOutput(jobs, record.id);
3203
- if (output === null) return {
3204
- ok: false,
3205
- error: fill(marks.unknownJobId, { maxJobs: 10 }),
3206
- status: 404
3207
- };
3208
- if (!sameJob(record.state, output.view)) return {
3209
- ok: false,
3210
- error: fill(marks.unknownJobId, { maxJobs: 10 }),
3211
- status: 404
3212
- };
3213
- const { view, retained } = output;
3214
- const text = retained.chunks.map((chunk) => chunk.text).join("");
3215
- const shown = truncateStart(text, JOB_OUT_VIEW_CHARS);
3216
- const viewMark = text.length > JOB_OUT_VIEW_CHARS ? fill(marks.jobOutputView, {
3217
- shown: JOB_OUT_VIEW_CHARS,
3218
- total: text.length
3219
- }) : "";
3220
- return {
3221
- ok: true,
3222
- status: view.status,
3223
- exitCode: record.proc.exitCode,
3224
- root: record.root,
3225
- ...record.proc.sandbox === void 0 ? {} : { sandbox: record.proc.sandbox },
3226
- output: (view.output.earliest > 0 ? marks.jobOutputTruncated : "") + (record.state.lost ? marks.jobOutputLost : "") + (record.state.timeoutNote ?? "") + (procSandboxNote(record.proc, marks) ?? "") + viewMark + shown
3227
- };
3228
- }
3229
- };
3230
- /**
3231
- * 标准装饰器的**程序化调用**:`@Remote` 的全部作用就是往类原型写一枚描述符,而标准装饰器
3232
- * 语法需要走一条 tsc 降级流水线(本仓的测试/构建解析器都不降级它)。这里直接按 TC39 的
3233
- * `ClassMethodDecoratorContext` 形状调同一个 decorator 函数,把标记落到真正的原型上,
3234
- * 于是源码里不再需要装饰器语法,构建与测试都不必再挂那枚预转换插件。
3235
- */
3236
- function markRemote(prototype, methodName) {
3237
- const context = {
3238
- kind: "method",
3239
- name: methodName,
3240
- static: false,
3241
- private: false,
3242
- addInitializer: (initializer) => {
3243
- Reflect.apply(initializer, Object.create(prototype), []);
3244
3313
  }
3245
3314
  };
3246
- const decorate = Remote(methodName);
3247
- Reflect.apply(decorate, void 0, [Reflect.get(prototype, methodName), context]);
3248
- }
3249
- markRemote(ZvecRebuildService.prototype, "roots");
3250
- markRemote(ZvecRebuildService.prototype, "rebuild");
3251
- markRemote(ZvecRebuildService.prototype, "status");
3315
+ })();
3252
3316
  /**
3253
3317
  *
3254
3318
  * 为什么是一枚函数而不是让调用方直接 `new`:这枚 `new` 的**全部意义在构造期的注册副作用**
@@ -3260,7 +3324,7 @@ markRemote(ZvecRebuildService.prototype, "status");
3260
3324
  * @param deps - 重建读取接口的全部依赖(见 ZvecRebuildDeps)
3261
3325
  */
3262
3326
  function installRebuildRemote(ctx, deps) {
3263
- if (!isRecord(ctx) || !isRecord(ctx.reflect) || typeof ctx.reflect.provide !== "function") return false;
3327
+ if (!isRecord$1(ctx) || !isRecord$1(ctx.reflect) || typeof ctx.reflect.provide !== "function") return false;
3264
3328
  new ZvecRebuildService(ctx, deps);
3265
3329
  ctx.effect(() => () => {
3266
3330
  releaseRebuildRecords(deps);
@@ -3403,7 +3467,7 @@ const SESSION_LOST_STATUS = /* @__PURE__ */ new Set([
3403
3467
  ]);
3404
3468
  /** 握手与工具调用的 JSON-RPC 常量。 */
3405
3469
  const JSONRPC = "2.0";
3406
- function isRecord$1(value) {
3470
+ function isRecord(value) {
3407
3471
  return typeof value === "object" && value !== null;
3408
3472
  }
3409
3473
  /** 从 SSE 正文收集全部 `data:` 行的 JSON 载荷;解析不了的行(心跳/注释)跳过。 */
@@ -3429,12 +3493,12 @@ function responsePayloads(contentType, body) {
3429
3493
  }
3430
3494
  /** tools/call 的 JSON-RPC 应答块:错误对象或结果对象二者之一。 */
3431
3495
  function replyOf(payloads, requestId) {
3432
- const found = payloads.find((payload) => isRecord$1(payload) && payload["id"] === requestId);
3433
- return isRecord$1(found) ? found : void 0;
3496
+ const found = payloads.find((payload) => isRecord(payload) && payload["id"] === requestId);
3497
+ return isRecord(found) ? found : void 0;
3434
3498
  }
3435
3499
  /** 把 MCP result 的 content 拼成文本(只收 text 块)。 */
3436
3500
  function resultText(result) {
3437
- return (isRecord$1(result) && Array.isArray(result["content"]) ? result["content"] : []).map((block) => isRecord$1(block) && block["type"] === "text" ? block["text"] : void 0).filter((piece) => typeof piece === "string").join("\n");
3501
+ return (isRecord(result) && Array.isArray(result["content"]) ? result["content"] : []).map((block) => isRecord(block) && block["type"] === "text" ? block["text"] : void 0).filter((piece) => typeof piece === "string").join("\n");
3438
3502
  }
3439
3503
  /**
3440
3504
  * 协议层失败:daemon **已经应答**(JSON-RPC error / 应答形状不符)。这类失败是确定性的,
@@ -3575,11 +3639,11 @@ async function callOnce(state, session, callOptions, requestId, deadline) {
3575
3639
  if (status !== 200) throw new DaemonProtocolError(`tools/call failed with HTTP ${status}`);
3576
3640
  const reply = replyOf(payloads, requestId);
3577
3641
  if (reply === void 0) throw new DaemonProtocolError("tools/call reply missing from response");
3578
- if (isRecord$1(reply["error"])) throw new DaemonProtocolError(JSON.stringify(reply["error"]));
3642
+ if (isRecord(reply["error"])) throw new DaemonProtocolError(JSON.stringify(reply["error"]));
3579
3643
  const { result } = reply;
3580
3644
  return {
3581
3645
  text: resultText(result),
3582
- isError: isRecord$1(result) && result["isError"] === true
3646
+ isError: isRecord(result) && result["isError"] === true
3583
3647
  };
3584
3648
  }
3585
3649
  function createDaemonClient(options) {
@@ -3598,7 +3662,7 @@ function createDaemonClient(options) {
3598
3662
  releaseSession(state, first, true);
3599
3663
  return result;
3600
3664
  } catch (error) {
3601
- if (isRecord$1(error) && error["name"] === "AbortError") {
3665
+ if (isRecord(error) && error["name"] === "AbortError") {
3602
3666
  releaseSession(state, first, false);
3603
3667
  throw error;
3604
3668
  }
@@ -3704,7 +3768,7 @@ const STDERR_NOTE_CHARS = 400;
3704
3768
  * 也会放过「是个对象但没注册方法」的错注入。 */
3705
3769
  function hasMethod(value, name, keys) {
3706
3770
  const member = value[name];
3707
- return isRecord(member) && keys.every((key) => typeof member[key] === "function");
3771
+ return isRecord$1(member) && keys.every((key) => typeof member[key] === "function");
3708
3772
  }
3709
3773
  /**
3710
3774
  * host 是否为本插件所需宿主服务:五个注入都必须是**带相应方法的对象**,
@@ -3717,7 +3781,7 @@ function hasMethod(value, name, keys) {
3717
3781
  * 探它们等于断言一条没有测试撑着的能力。
3718
3782
  */
3719
3783
  function isZvecGrepHost(value) {
3720
- if (!isRecord(value)) return false;
3784
+ if (!isRecord$1(value)) return false;
3721
3785
  return hasMethod(value, "settings", ["describe"]) && hasMethod(value, "shell", ["resolve", "execute"]) && hasMethod(value, "tools", ["register", "guard"]) && hasMethod(value, "systemPrompt", ["section"]) && hasMethod(value, "timer", ["timeout"]) && typeof value["get"] === "function";
3722
3786
  }
3723
3787
  /** 当前会话工作区(root 缺省回退源);非字符串视为缺(读取方式见 lib/routing.ts 的 SessionFace)。 */
@@ -3735,7 +3799,7 @@ function stringifyJson(value) {
3735
3799
  return JSON.stringify(value, null, 2);
3736
3800
  }
3737
3801
  function textBlock(value) {
3738
- const { text: textValue } = isRecord(value) ? value : {};
3802
+ const { text: textValue } = isRecord$1(value) ? value : {};
3739
3803
  if (typeof textValue === "string") return [{
3740
3804
  type: "text",
3741
3805
  text: textValue
@@ -4332,11 +4396,11 @@ function manifestCoversRoot(manifestPath, dir, platform) {
4332
4396
  } catch {
4333
4397
  return false;
4334
4398
  }
4335
- if (!isRecord(parsed)) return false;
4399
+ if (!isRecord$1(parsed)) return false;
4336
4400
  const version = parsed["indexVersion"];
4337
4401
  if (typeof version !== "number" || !Number.isSafeInteger(version) || version < MINIMUM_INDEX_VERSION) return false;
4338
4402
  const { sourceRoot } = parsed;
4339
- if (!isRecord(sourceRoot)) return false;
4403
+ if (!isRecord$1(sourceRoot)) return false;
4340
4404
  const recorded = sourceRoot["recordedPath"];
4341
4405
  return typeof recorded === "string" && recorded.length > 0 && comparablePath(normalizeRoot(recorded, platform), process.platform) === comparablePath(normalizeRoot(dir, platform), process.platform);
4342
4406
  }
@@ -4405,7 +4469,7 @@ function define(host, spec) {
4405
4469
  },
4406
4470
  execute: async (rawArgs, exec) => {
4407
4471
  const messages = spec.messages();
4408
- if (!isRecord(rawArgs)) throw new Error(fill(messages.argsMustBeObject, {
4472
+ if (!isRecord$1(rawArgs)) throw new Error(fill(messages.argsMustBeObject, {
4409
4473
  name: spec.name,
4410
4474
  received: rawArgs === null ? "null" : typeof rawArgs
4411
4475
  }));
@@ -4872,7 +4936,7 @@ function daemonFailure(text, messages) {
4872
4936
  }
4873
4937
  /** daemon 调用的传输层失败(fetch 层):取消/超时与 CLI lane 同一套归因。 */
4874
4938
  function daemonTransportFailure(error, exec, messages, token) {
4875
- if (!(isRecord(error) && error["name"] === "AbortError")) {
4939
+ if (!(isRecord$1(error) && error["name"] === "AbortError")) {
4876
4940
  const detail = redactToken(errorText(error), token);
4877
4941
  return new Error(fill(messages.mcpCallFailed, { detail }), { cause: error });
4878
4942
  }
@@ -4906,7 +4970,7 @@ async function runSearchViaDaemon(runtime, searchArgs, messages, exec, wait) {
4906
4970
  signal: exec.signal
4907
4971
  }));
4908
4972
  } catch (error) {
4909
- const aborted = isRecord(error) && error["name"] === "AbortError";
4973
+ const aborted = isRecord$1(error) && error["name"] === "AbortError";
4910
4974
  if (!aborted) runtime.serverGate.invalidate();
4911
4975
  throw new DaemonCallFailureError(daemonTransportFailure(error, exec, messages, runtime.daemon.tokenOf()).message, aborted);
4912
4976
  }
@@ -5283,7 +5347,7 @@ function registerRoutingSection(host, registered) {
5283
5347
  */
5284
5348
  /** 该不该为这次调用问一句;不该问就交回 undefined(调用方转交 next())。 */
5285
5349
  function explicitRootAsk(execution, ledger, messages, platform) {
5286
- const raw = (isRecord(execution.arguments) ? execution.arguments : void 0)?.["root"];
5350
+ const raw = (isRecord$1(execution.arguments) ? execution.arguments : void 0)?.["root"];
5287
5351
  let question;
5288
5352
  if (typeof raw === "string" && raw.trim().length > 0) {
5289
5353
  const decision = judgeRoot(raw, sessionHeaderCwd(execution), messages, ledger, platform);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayyuen66/dsh-zvec-grep",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "dsh 工作区语义检索插件(zg):zg_search / zg_index / zg_status + 本地 embedding 设置卡片 + systemPrompt 路由规则 + guard 安全兜底。",
5
5
  "keywords": [
6
6
  "cordis",
@@ -51,44 +51,45 @@
51
51
  "registry": "https://registry.npmjs.org"
52
52
  },
53
53
  "dependencies": {
54
- "@jayyuen66/dsh-plugin-shared": "^0.2.4",
54
+ "@jayyuen66/dsh-plugin-shared": "^0.2.5",
55
55
  "zod": "4.6.7"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@deepseek-ai/cordis": "4.1.0",
59
59
  "@deepseek-ai/cordis-plugin-group": "1.1.0",
60
60
  "@deepseek-ai/cordis-plugin-timer": "1.2.0",
61
- "@deepseek-ai/dsh-agent": "0.2.2-rc.1",
62
- "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.1",
63
- "@deepseek-ai/dsh-bash-local": "0.2.2-rc.1",
64
- "@deepseek-ai/dsh-client-locale": "0.2.2-rc.1",
65
- "@deepseek-ai/dsh-client-store": "0.2.2-rc.1",
66
- "@deepseek-ai/dsh-client-ui-layout": "0.2.2-rc.1",
67
- "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.2-rc.1",
68
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.1",
69
- "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.1",
70
- "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.1",
71
- "@deepseek-ai/dsh-host-webserver": "0.2.2-rc.1",
72
- "@deepseek-ai/dsh-http-proxy": "0.2.2-rc.1",
73
- "@deepseek-ai/dsh-jobs": "0.2.2-rc.1",
74
- "@deepseek-ai/dsh-jobs-local": "0.2.2-rc.1",
75
- "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
76
- "@deepseek-ai/dsh-output-retention": "0.2.2-rc.1",
77
- "@deepseek-ai/dsh-package-manifest": "0.2.2-rc.1",
78
- "@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
79
- "@deepseek-ai/dsh-scope": "0.2.2-rc.1",
80
- "@deepseek-ai/dsh-session": "0.2.2-rc.1",
81
- "@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
82
- "@deepseek-ai/dsh-settings": "0.2.2-rc.1",
83
- "@deepseek-ai/dsh-shell": "0.2.2-rc.1",
84
- "@deepseek-ai/dsh-subprocess": "0.2.2-rc.1",
85
- "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.1",
86
- "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
87
- "@deepseek-ai/dsh-timeout": "0.2.2-rc.1",
88
- "@deepseek-ai/dsh-tool-executor-native": "0.2.2-rc.1",
89
- "@deepseek-ai/dsh-tools": "0.2.2-rc.1",
90
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
91
- "@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
61
+ "@deepseek-ai/dsh-agent": "0.2.2-rc.2",
62
+ "@deepseek-ai/dsh-api-remotes": "0.2.2-rc.2",
63
+ "@deepseek-ai/dsh-bash-local": "0.2.2-rc.2",
64
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.2",
65
+ "@deepseek-ai/dsh-client-store": "0.2.2-rc.2",
66
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.2-rc.2",
67
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.2-rc.2",
68
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.2",
69
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.2",
70
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.2",
71
+ "@deepseek-ai/dsh-error": "0.2.2-rc.2",
72
+ "@deepseek-ai/dsh-host-webserver": "0.2.2-rc.2",
73
+ "@deepseek-ai/dsh-http-proxy": "0.2.2-rc.2",
74
+ "@deepseek-ai/dsh-jobs": "0.2.2-rc.2",
75
+ "@deepseek-ai/dsh-jobs-local": "0.2.2-rc.2",
76
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.2",
77
+ "@deepseek-ai/dsh-output-retention": "0.2.2-rc.2",
78
+ "@deepseek-ai/dsh-package-manifest": "0.2.2-rc.2",
79
+ "@deepseek-ai/dsh-sandbox": "0.2.2-rc.2",
80
+ "@deepseek-ai/dsh-scope": "0.2.2-rc.2",
81
+ "@deepseek-ai/dsh-session": "0.2.2-rc.2",
82
+ "@deepseek-ai/dsh-session-projection": "0.2.2-rc.2",
83
+ "@deepseek-ai/dsh-settings": "0.2.2-rc.2",
84
+ "@deepseek-ai/dsh-shell": "0.2.2-rc.2",
85
+ "@deepseek-ai/dsh-subprocess": "0.2.2-rc.2",
86
+ "@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.2",
87
+ "@deepseek-ai/dsh-system-prompt": "0.2.2-rc.2",
88
+ "@deepseek-ai/dsh-timeout": "0.2.2-rc.2",
89
+ "@deepseek-ai/dsh-tool-executor-native": "0.2.2-rc.2",
90
+ "@deepseek-ai/dsh-tools": "0.2.2-rc.2",
91
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.2",
92
+ "@deepseek-ai/dsh-user-approval": "0.2.2-rc.2",
92
93
  "@deepseek-ai/schemastery": "3.19.0",
93
94
  "@e18e/eslint-plugin": "0.8.1",
94
95
  "@types/node": "26.6.6",
@@ -98,21 +99,21 @@
98
99
  "eslint-plugin-sonarjs": "4.2.2",
99
100
  "eslint-plugin-zod": "5.2.2",
100
101
  "fast-check": "4.10.2",
101
- "oxfmt": "0.76.0",
102
- "oxlint": "1.91.0",
103
- "oxlint-tsgolint": "7.0.2005",
102
+ "oxfmt": "0.78.0",
103
+ "oxlint": "1.93.0",
104
+ "oxlint-tsgolint": "7.0.2006",
104
105
  "react": "^19.3.0",
105
- "rolldown": "1.2.16",
106
+ "rolldown": "1.3.2",
106
107
  "typescript": "7.0.2",
107
- "vite": "8.3.6",
108
+ "vite": "8.3.8",
108
109
  "vitest": "5.1.0"
109
110
  },
110
111
  "peerDependencies": {
111
- "@deepseek-ai/dsh": "^0.2.1-rc.5 || ^0.2.2-alpha.3",
112
- "@deepseek-ai/dsh-output-retention": "^0.2.1-rc.5 || ^0.2.2-alpha.3",
113
- "@deepseek-ai/dsh-scope": "^0.2.1-rc.5 || ^0.2.2-alpha.3",
114
- "@deepseek-ai/dsh-typert-protocol": "^0.2.1-rc.5 || ^0.2.2-alpha.3",
115
- "@deepseek-ai/schemastery": "^3.18.5 || ^3.18.6-alpha.1"
112
+ "@deepseek-ai/dsh": "^0.2.2-rc.1",
113
+ "@deepseek-ai/dsh-output-retention": "^0.2.2-rc.1",
114
+ "@deepseek-ai/dsh-scope": "^0.2.2-rc.1",
115
+ "@deepseek-ai/dsh-typert-protocol": "^0.2.2-rc.1",
116
+ "@deepseek-ai/schemastery": "^3.19.0"
116
117
  },
117
118
  "peerDependenciesMeta": {
118
119
  "@deepseek-ai/dsh": {
@@ -121,7 +122,7 @@
121
122
  },
122
123
  "icon": "icon.svg",
123
124
  "engines": {
124
- "dsh": "^0.2.1-rc.5 || ^0.2.2-alpha.3",
125
+ "dsh": "^0.2.2-rc.1",
125
126
  "node": ">=24.9.0"
126
127
  },
127
128
  "dsh": {