@jayyuen66/dsh-zvec-grep 0.1.17 → 0.1.19
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 +28 -0
- package/README.md +10 -2
- package/README.zh-CN.md +10 -2
- package/client.js +3 -1662
- package/cordis.patch.yml +4 -0
- package/docs/DETAIL.md +7 -1
- package/docs/DETAIL.zh.md +7 -1
- package/host.js +42 -37
- package/package.json +6 -3
package/cordis.patch.yml
CHANGED
|
@@ -12,5 +12,9 @@
|
|
|
12
12
|
# 行按裸包名引用本包(client-modules 只扫描裸包名条目的 dsh.client 声明)。
|
|
13
13
|
# 注意 pnpm ≥12.3.0:12.0.0 的 add 本地目录有 #14437 bug。
|
|
14
14
|
- insert:
|
|
15
|
+
# 固定 id:该供应行必须保持开启;停用后本包设置卡会失去 shared 客户端供应。
|
|
16
|
+
# 多个插件共用同一个 id,宿主会把开关标成“无法唯一定位”并禁用。
|
|
17
|
+
- id: dsh-plugin-shared
|
|
18
|
+
name: "@jayyuen66/dsh-plugin-shared"
|
|
15
19
|
- id: zvec-grep
|
|
16
20
|
name: "@jayyuen66/dsh-zvec-grep"
|
package/docs/DETAIL.md
CHANGED
|
@@ -24,7 +24,7 @@ The card's Rebuild button runs the equivalent of `zg --index --rebuild` for a wo
|
|
|
24
24
|
|
|
25
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
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 that row's `id` / `name
|
|
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
28
|
|
|
29
29
|
## What it needs from outside
|
|
30
30
|
|
|
@@ -33,3 +33,9 @@ The external `zg` CLI (`@zvec/zvec-grep`, installed with `npm install -g @zvec/z
|
|
|
33
33
|
## Further detail
|
|
34
34
|
|
|
35
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.
|
package/docs/DETAIL.zh.md
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
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
26
|
|
|
27
|
-
「工作区内容能不能离开本机」被当成部署决定,而不是给模型选的开关,所以远程嵌入那三枚既不在卡上也不在工具参数里;即便开了,`zg` 自己仍要求 `--allow-remote`(部署开放后本插件在远程引用的索引命令上自动补)或一次 `zg --auth grant` 持久授权。这些值都写在**自己 profile 的 `cordis.yml`** 里本插件注册行的 `config:` 块(随包那份 `cordis.patch.yml`
|
|
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
28
|
|
|
29
29
|
## 需要外部提供什么
|
|
30
30
|
|
|
@@ -33,3 +33,9 @@
|
|
|
33
33
|
## 更完整的说明
|
|
34
34
|
|
|
35
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 客户端供应行有没有被物化。
|
package/host.js
CHANGED
|
@@ -4,12 +4,15 @@ import { randomBytes } from "node:crypto";
|
|
|
4
4
|
import { accessSync, constants, existsSync, readFileSync, statSync } from "node:fs";
|
|
5
5
|
import { homedir, tmpdir } from "node:os";
|
|
6
6
|
import nodePath from "node:path";
|
|
7
|
+
import { fillPlaceholders } from "@jayyuen66/dsh-plugin-shared/lib/placeholder";
|
|
7
8
|
import { scopeOf } from "@deepseek-ai/dsh-scope";
|
|
8
|
-
import { isRecord
|
|
9
|
+
import { isRecord } from "@jayyuen66/dsh-plugin-shared/lib/record";
|
|
9
10
|
import { errorText } from "@jayyuen66/dsh-plugin-shared/lib/errors";
|
|
10
11
|
import { HarnessError } from "@deepseek-ai/dsh-error";
|
|
12
|
+
import { registerSkill } from "@jayyuen66/dsh-plugin-shared/lib/skill";
|
|
11
13
|
import { LOCALE_SETTINGS_NAMESPACE, messagesFor, resolveLocalePreference } from "@jayyuen66/dsh-plugin-shared/lib/locale";
|
|
12
14
|
import { truncateEnd, truncateStart } from "@jayyuen66/dsh-plugin-shared/lib/text";
|
|
15
|
+
import { claimInstance } from "@jayyuen66/dsh-plugin-shared/lib/instance-lock";
|
|
13
16
|
import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
14
17
|
import { jobOutcomeOf } from "@jayyuen66/dsh-plugin-shared/lib/job-outcome";
|
|
15
18
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
@@ -473,17 +476,15 @@ const MESSAGES = {
|
|
|
473
476
|
/**
|
|
474
477
|
* `{name}` 占位符插值(与官方 locale 的 Translate 参数语义同源)。
|
|
475
478
|
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
479
|
+
* 实现已收进 shared 的 `@jayyuen66/dsh-plugin-shared/lib/placeholder`。本包此前缺键即替空串,
|
|
480
|
+
* 现在统一成「缺值保留原文」:写错占位符时原样留着的 `{xxx}` 一眼可见,比一句悄悄塌掉的
|
|
481
|
+
* 文案好排障。`null` 仍照实渲染成 `"null"`(`exitCode` 这类字段的正常取值)。
|
|
478
482
|
* @param template - 字典里的模板。
|
|
479
|
-
* @param params - 占位符名 →
|
|
483
|
+
* @param params - 占位符名 → 值。
|
|
480
484
|
* @returns 填好的文本。
|
|
481
485
|
*/
|
|
482
486
|
function fill(template, params) {
|
|
483
|
-
return template
|
|
484
|
-
const value = Object.hasOwn(params, key) ? params[key] : void 0;
|
|
485
|
-
return value === void 0 ? "" : String(value);
|
|
486
|
-
});
|
|
487
|
+
return fillPlaceholders(template, params);
|
|
487
488
|
}
|
|
488
489
|
// lib/platform.ts
|
|
489
490
|
/** 把 Node 的 platform 收成两档:win32 单独一档,其余都按 POSIX。 */
|
|
@@ -2022,7 +2023,7 @@ function zgToolProblem(name, args, execution, messages, platform) {
|
|
|
2022
2023
|
*/
|
|
2023
2024
|
function zgGuard(execution, messages, platform = "posix") {
|
|
2024
2025
|
const { name } = execution;
|
|
2025
|
-
const args = isRecord
|
|
2026
|
+
const args = isRecord(execution.arguments) ? execution.arguments : {};
|
|
2026
2027
|
let reason;
|
|
2027
2028
|
if (isZgToolName(name)) reason = zgToolProblem(name, args, execution, messages, platform);
|
|
2028
2029
|
return reason;
|
|
@@ -2209,7 +2210,7 @@ function nativeGrepProblem(args, cwd, deps, messages) {
|
|
|
2209
2210
|
*/
|
|
2210
2211
|
function searchFirstGuard(execution, deps, messages) {
|
|
2211
2212
|
const { name } = execution;
|
|
2212
|
-
const args = isRecord
|
|
2213
|
+
const args = isRecord(execution.arguments) ? execution.arguments : {};
|
|
2213
2214
|
const cwd = sessionHeaderCwd$1(execution);
|
|
2214
2215
|
let reason;
|
|
2215
2216
|
if (deps.enabled && cwd !== void 0 && searchAdmitted(execution)) {
|
|
@@ -2519,30 +2520,23 @@ function tooOldZgVersion(stdout) {
|
|
|
2519
2520
|
// lib/skill.ts
|
|
2520
2521
|
/** skill 名:kebab-case,也是模型用 skill 工具加载时的入参。 */
|
|
2521
2522
|
const SKILL_NAME = "zvec-grep";
|
|
2522
|
-
/** 收窄判定:只认「有 register 且是函数」的对象,空对象不能冒充 skill 服务。 */
|
|
2523
|
-
function isSkillsFace(value) {
|
|
2524
|
-
if (typeof value !== "object" || value === null) return false;
|
|
2525
|
-
return typeof Reflect.get(value, "register") === "function";
|
|
2526
|
-
}
|
|
2527
2523
|
/**
|
|
2528
2524
|
* 注册(或重新注册)本包的检索规则 skill。
|
|
2529
2525
|
*
|
|
2530
2526
|
* 文案随调用点传入而不是在这里取:语言由 apply 时的官方 locale 偏好决定,与工具描述、
|
|
2531
2527
|
* 参数说明同源——三处各取一次就会出现「工具描述是中文、skill 正文是英文」那种错位。
|
|
2532
|
-
* @param ctx - 只需 `get`(读可选服务),不要求 skills 进 inject
|
|
2528
|
+
* @param ctx - 只需 `get`(读可选服务),不要求 skills 进 inject;带上 `effect` 时注册的
|
|
2529
|
+
* 撤销权交给插件 fiber(见文件头)
|
|
2533
2530
|
* @param content - 规则全文(`messages.routingText`)
|
|
2534
2531
|
* @param description - skill 目录里那行说明(模型据此决定要不要加载)
|
|
2535
|
-
* @returns 注册成功与否;未装载 skill
|
|
2532
|
+
* @returns 注册成功与否;未装载 skill 服务或正文为空时为 false(不抛,摘要段照旧生效)
|
|
2536
2533
|
*/
|
|
2537
2534
|
function registerRoutingSkill(ctx, content, description) {
|
|
2538
|
-
|
|
2539
|
-
if (!isSkillsFace(found)) return false;
|
|
2540
|
-
found.register({
|
|
2535
|
+
return registerSkill(ctx, {
|
|
2541
2536
|
name: SKILL_NAME,
|
|
2542
2537
|
description,
|
|
2543
2538
|
content
|
|
2544
2539
|
});
|
|
2545
|
-
return true;
|
|
2546
2540
|
}
|
|
2547
2541
|
// lib/index-preflight.ts
|
|
2548
2542
|
/**
|
|
@@ -3309,7 +3303,7 @@ let ZvecRebuildService = (() => {
|
|
|
3309
3303
|
*/
|
|
3310
3304
|
async rebuild(request) {
|
|
3311
3305
|
const started = this.deps.messages();
|
|
3312
|
-
const accepted = acceptableRoot(isRecord
|
|
3306
|
+
const accepted = acceptableRoot(isRecord(request) ? request.root : void 0, this.deps.ledger, started, this.deps.platform);
|
|
3313
3307
|
if ("error" in accepted) return {
|
|
3314
3308
|
ok: false,
|
|
3315
3309
|
error: accepted.error.value,
|
|
@@ -3372,7 +3366,7 @@ let ZvecRebuildService = (() => {
|
|
|
3372
3366
|
*/
|
|
3373
3367
|
status(request) {
|
|
3374
3368
|
const marks = this.deps.messages();
|
|
3375
|
-
const raw = isRecord
|
|
3369
|
+
const raw = isRecord(request) ? request.jobId : void 0;
|
|
3376
3370
|
const record = typeof raw === "string" && raw.length > 0 ? this.deps.records.get(raw) : void 0;
|
|
3377
3371
|
if (record === void 0) return {
|
|
3378
3372
|
ok: false,
|
|
@@ -3425,7 +3419,7 @@ let ZvecRebuildService = (() => {
|
|
|
3425
3419
|
* @param deps - 重建读取接口的全部依赖(见 ZvecRebuildDeps)
|
|
3426
3420
|
*/
|
|
3427
3421
|
function installRebuildRemote(ctx, deps) {
|
|
3428
|
-
if (!isRecord
|
|
3422
|
+
if (!isRecord(ctx) || !isRecord(ctx.reflect) || typeof ctx.reflect.provide !== "function") return false;
|
|
3429
3423
|
new ZvecRebuildService(ctx, deps);
|
|
3430
3424
|
ctx.effect(() => () => {
|
|
3431
3425
|
releaseRebuildRecords(deps);
|
|
@@ -3568,9 +3562,6 @@ const SESSION_LOST_STATUS = /* @__PURE__ */ new Set([
|
|
|
3568
3562
|
]);
|
|
3569
3563
|
/** 握手与工具调用的 JSON-RPC 常量。 */
|
|
3570
3564
|
const JSONRPC = "2.0";
|
|
3571
|
-
function isRecord(value) {
|
|
3572
|
-
return typeof value === "object" && value !== null;
|
|
3573
|
-
}
|
|
3574
3565
|
/** 从 SSE 正文收集全部 `data:` 行的 JSON 载荷;解析不了的行(心跳/注释)跳过。 */
|
|
3575
3566
|
function ssePayloads(body) {
|
|
3576
3567
|
const payloads = [];
|
|
@@ -3865,11 +3856,18 @@ const MAX_LEDGER_ROOTS = 64;
|
|
|
3865
3856
|
const LEDGER_TTL_MS = 864e5;
|
|
3866
3857
|
/** 成功执行里回显 stderr 的尾部长度(降级提示常就在这一行)。 */
|
|
3867
3858
|
const STDERR_NOTE_CHARS = 400;
|
|
3859
|
+
/**
|
|
3860
|
+
* 单实例锁的服务名。dshmarket 热挂子树与 bundle 层会各跑一次 `apply`,第二遍的注册面会撞
|
|
3861
|
+
* 「同名已注册」而把 fiber 打成 failed;抢这把锁能把第二遍安静地挡在注册面之外。
|
|
3862
|
+
* 取包名形态而**不带随机后缀**:名字必须每一份实例都算出同一个串才可能互斥,随机后缀等于
|
|
3863
|
+
* 谁都能抢到。判据与边界见 shared 的 `lib/instance-lock` 头注释。
|
|
3864
|
+
*/
|
|
3865
|
+
const INSTANCE_LOCK_KEY = "@jayyuen66/dsh-zvec-grep/instance";
|
|
3868
3866
|
/** 具名方法在位(typeof 函数)——只看 `typeof x === "object"` 会放过 null、
|
|
3869
3867
|
* 也会放过「是个对象但没注册方法」的错注入。 */
|
|
3870
3868
|
function hasMethod(value, name, keys) {
|
|
3871
3869
|
const member = value[name];
|
|
3872
|
-
return isRecord
|
|
3870
|
+
return isRecord(member) && keys.every((key) => typeof member[key] === "function");
|
|
3873
3871
|
}
|
|
3874
3872
|
/**
|
|
3875
3873
|
* host 是否为本插件所需宿主服务:五个注入都必须是**带相应方法的对象**,
|
|
@@ -3882,7 +3880,7 @@ function hasMethod(value, name, keys) {
|
|
|
3882
3880
|
* 探它们等于断言一条没有测试撑着的能力。
|
|
3883
3881
|
*/
|
|
3884
3882
|
function isZvecGrepHost(value) {
|
|
3885
|
-
if (!isRecord
|
|
3883
|
+
if (!isRecord(value)) return false;
|
|
3886
3884
|
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";
|
|
3887
3885
|
}
|
|
3888
3886
|
/** 当前会话工作区(root 缺省回退源);非字符串视为缺(读取方式见 lib/routing.ts 的 SessionFace)。 */
|
|
@@ -3900,7 +3898,7 @@ function stringifyJson(value) {
|
|
|
3900
3898
|
return JSON.stringify(value, null, 2);
|
|
3901
3899
|
}
|
|
3902
3900
|
function textBlock(value) {
|
|
3903
|
-
const { text: textValue } = isRecord
|
|
3901
|
+
const { text: textValue } = isRecord(value) ? value : {};
|
|
3904
3902
|
if (typeof textValue === "string") return [{
|
|
3905
3903
|
type: "text",
|
|
3906
3904
|
text: textValue
|
|
@@ -4497,11 +4495,11 @@ function manifestCoversRoot(manifestPath, dir, platform) {
|
|
|
4497
4495
|
} catch {
|
|
4498
4496
|
return false;
|
|
4499
4497
|
}
|
|
4500
|
-
if (!isRecord
|
|
4498
|
+
if (!isRecord(parsed)) return false;
|
|
4501
4499
|
const version = parsed["indexVersion"];
|
|
4502
4500
|
if (typeof version !== "number" || !Number.isSafeInteger(version) || version < MINIMUM_INDEX_VERSION) return false;
|
|
4503
4501
|
const { sourceRoot } = parsed;
|
|
4504
|
-
if (!isRecord
|
|
4502
|
+
if (!isRecord(sourceRoot)) return false;
|
|
4505
4503
|
const recorded = sourceRoot["recordedPath"];
|
|
4506
4504
|
return typeof recorded === "string" && recorded.length > 0 && comparablePath(normalizeRoot(recorded, platform), process.platform) === comparablePath(normalizeRoot(dir, platform), process.platform);
|
|
4507
4505
|
}
|
|
@@ -4620,7 +4618,7 @@ function define(host, spec) {
|
|
|
4620
4618
|
description: spec.description,
|
|
4621
4619
|
parameters,
|
|
4622
4620
|
timeoutMs: spec.timeoutMs,
|
|
4623
|
-
presentCall: (rawArgs) => spec.presentCall(isRecord
|
|
4621
|
+
presentCall: (rawArgs) => spec.presentCall(isRecord(rawArgs) ? rawArgs : {}),
|
|
4624
4622
|
isConcurrencySafe: () => spec.concurrencySafe,
|
|
4625
4623
|
output: {
|
|
4626
4624
|
schema: TEXT_OUTPUT_SCHEMA,
|
|
@@ -4628,7 +4626,7 @@ function define(host, spec) {
|
|
|
4628
4626
|
},
|
|
4629
4627
|
execute: async (rawArgs, exec) => {
|
|
4630
4628
|
const messages = spec.messages();
|
|
4631
|
-
if (!isRecord
|
|
4629
|
+
if (!isRecord(rawArgs)) throw new ZgToolError(ZG_TOOL_ERROR_CODES.badArguments, fill(messages.argsMustBeObject, {
|
|
4632
4630
|
name: spec.name,
|
|
4633
4631
|
received: rawArgs === null ? "null" : typeof rawArgs
|
|
4634
4632
|
}));
|
|
@@ -5095,7 +5093,7 @@ function daemonFailure(text, messages) {
|
|
|
5095
5093
|
}
|
|
5096
5094
|
/** daemon 调用的传输层失败(fetch 层):取消/超时与 CLI lane 同一套归因。 */
|
|
5097
5095
|
function daemonTransportFailure(error, exec, messages, token) {
|
|
5098
|
-
if (!(isRecord
|
|
5096
|
+
if (!(isRecord(error) && error["name"] === "AbortError")) {
|
|
5099
5097
|
const detail = redactToken(errorText(error), token);
|
|
5100
5098
|
return new ZgToolError(ZG_TOOL_ERROR_CODES.daemonUnavailable, fill(messages.mcpCallFailed, { detail }), { cause: error });
|
|
5101
5099
|
}
|
|
@@ -5129,7 +5127,7 @@ async function runSearchViaDaemon(runtime, searchArgs, messages, exec, wait) {
|
|
|
5129
5127
|
signal: exec.signal
|
|
5130
5128
|
}));
|
|
5131
5129
|
} catch (error) {
|
|
5132
|
-
const aborted = isRecord
|
|
5130
|
+
const aborted = isRecord(error) && error["name"] === "AbortError";
|
|
5133
5131
|
if (!aborted) runtime.serverGate.invalidate();
|
|
5134
5132
|
throw new DaemonCallFailureError(daemonTransportFailure(error, exec, messages, runtime.daemon.tokenOf()).message, aborted);
|
|
5135
5133
|
}
|
|
@@ -5530,7 +5528,7 @@ function registerRoutingSection(host, registered) {
|
|
|
5530
5528
|
*/
|
|
5531
5529
|
/** 该不该为这次调用问一句;不该问就交回 undefined(调用方转交 next())。 */
|
|
5532
5530
|
function explicitRootAsk(execution, ledger, messages, platform) {
|
|
5533
|
-
const raw = (isRecord
|
|
5531
|
+
const raw = (isRecord(execution.arguments) ? execution.arguments : void 0)?.["root"];
|
|
5534
5532
|
let question;
|
|
5535
5533
|
if (typeof raw === "string" && raw.trim().length > 0) {
|
|
5536
5534
|
const decision = judgeRoot(raw, sessionHeaderCwd(execution), messages, ledger, platform);
|
|
@@ -5602,6 +5600,13 @@ function apply(ctx, config) {
|
|
|
5602
5600
|
if (!isZvecGrepHost(ctx)) throw new Error("[zvec-grep] required services (settings/shell/tools/systemPrompt/timer/get) missing");
|
|
5603
5601
|
const host = ctx;
|
|
5604
5602
|
const platform = runtimePlatform();
|
|
5603
|
+
if (!claimInstance({
|
|
5604
|
+
get: host.get,
|
|
5605
|
+
reflect: host.reflect
|
|
5606
|
+
}, INSTANCE_LOCK_KEY)) {
|
|
5607
|
+
console.warn("[zvec-grep] 检测到本插件已在同一作用域内装载:本次装配让路,工具与设置卡由在册的那一份提供。");
|
|
5608
|
+
return;
|
|
5609
|
+
}
|
|
5605
5610
|
configureSettingsPage(host);
|
|
5606
5611
|
const localeMessages = createLocaleMessages(host);
|
|
5607
5612
|
const ledger = createRootLedger(localeMessages(), MAX_LEDGER_ROOTS, Date.now, LEDGER_TTL_MS, platform);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jayyuen66/dsh-zvec-grep",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "dsh 工作区语义检索插件(zg):zg_search / zg_index / zg_status + 本地 embedding 设置卡片 + systemPrompt 路由规则 + guard 安全兜底。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cordis",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"registry": "https://registry.npmjs.org"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@jayyuen66/dsh-plugin-shared": "^0.2.
|
|
54
|
+
"@jayyuen66/dsh-plugin-shared": "^0.2.10",
|
|
55
55
|
"zod": "4.6.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
@@ -134,7 +134,10 @@
|
|
|
134
134
|
},
|
|
135
135
|
"client": {
|
|
136
136
|
"platform": "web",
|
|
137
|
-
"immediately": true
|
|
137
|
+
"immediately": true,
|
|
138
|
+
"external": [
|
|
139
|
+
"@jayyuen66/dsh-plugin-shared/client"
|
|
140
|
+
]
|
|
138
141
|
}
|
|
139
142
|
},
|
|
140
143
|
"scripts": {
|