@liustack/modlens 3.18.3 → 3.18.5
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 +10 -0
- package/README.md +1 -1
- package/README.zh-CN.md +2 -2
- package/dist/main.js +56 -23
- package/docs/harness-setup.md +2 -2
- package/docs/harness-setup.zh-CN.md +2 -2
- package/docs/troubleshooting.md +2 -2
- package/docs/troubleshooting.zh-CN.md +2 -2
- package/dsh/client.js +1 -1
- package/dsh/index.js +36 -7
- package/dsh/spawnHidden.d.ts +13 -0
- package/dsh/spawnHidden.js +20 -0
- package/package.json +1 -1
- package/skills/modlens/SKILL.md +4 -4
- package/skills/modlens/references/runtime.md +1 -1
- package/skills/modlens/scripts/run.ps1 +1 -1
- package/skills/modlens/scripts/run.sh +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.18.5 - 2026-08-18
|
|
4
|
+
|
|
5
|
+
- **dsh: the settings card is back on harness 0.1.0-rc.7 ([#61](https://github.com/liustack/modlens/issues/61), [#65](https://github.com/liustack/modlens/issues/65)).** rc.7 changed the settings page twice over, and both changes land on plugin cards. The slot cards register into became keyed, so the old registration throws, which is the console error both reports carry. And a card now renders only when its key matches a settings namespace the host serves, where the old page rendered every registered card, so adding the key the error asks for fixes only the error: the card still never appears, and no console message points at why. The browser half now registers with both the id the old list slot required and the key the new keyed slot requires, one file serving both harness versions, and the host half registers an empty pass-through `modlens` namespace so the key has something to match. That namespace exists to make the card dispatchable and holds nothing: modlens configuration stays in `~/.modlens/config.json` behind the loopback route, where the CLI and every other harness read it, and the schema is duck-typed rather than imported from a harness package, so the plugin stays unpinned from harness versions. Verified in a browser against rc.7 both ways, card absent before and rendering with live values after. Thanks to @zeng111234, whose report named the missing key and read the keyed-slot contract, and to @blackboard1809 and @kaiwenyao for pinning the scope with a two-plugin reproduction.
|
|
6
|
+
|
|
7
|
+
## 3.18.4 - 2026-08-18
|
|
8
|
+
|
|
9
|
+
- **Windows: cleaning up after a read can no longer take the whole process down with it ([#58](https://github.com/liustack/modlens/issues/58)).** Node 24.0.0 through 24.13.0 carry an upstream bug where `fs.rmSync` aborts the process outright (exit `0xC0000409`) instead of throwing, when the path handed to it holds non-ASCII characters (nodejs/node#58759, fixed upstream in 24.13.1). The throwaway directory each isolated CLI read runs in lives under the system temp directory, so a Windows machine whose temp path holds non-ASCII characters, a non-ASCII user name being the common way, hit that abort on the cleanup of every read, and an abort is not something a `try`/`catch` can stop. Removal now goes through the asynchronous `fs.rm`, which never reaches the affected code, keeps the one delayed retry for a directory the provider still holds open (#50), and is awaited, so a read returns only after its directory is gone or formally given up on. Thanks to @Vaking02 for the exit code and the failing path, which is what made the crash findable upstream.
|
|
10
|
+
- **A schema mismatch on the openai route now names the setting that fixes it ([#59](https://github.com/liustack/modlens/issues/59)).** The error used to say "switch to gemini-api / anthropic for enforced schemas", which is advice to abandon an endpoint that one config line would have fixed, and on the Kimi Code endpoint it cost a reader a debugging round of blaming the model. The message now says what actually applies: a cut-off answer points at the token limit, a gateway that stopped for its own reason is quoted rather than diagnosed, a `response_format` of your own in `extraBody` is named as the thing deciding the shape, plain `structuredOutput: false` gets the one-liner that turns enforcement on, and only when the schema was genuinely sent and still missed does the switch-providers advice remain. Both failure branches, JSON that will not parse and JSON that parses into the wrong shape, read the same rule the request itself uses, so the advice and the request can no longer disagree. The issue also carries @StarChen-Cycler's verified recipe for the Kimi Code coding endpoint, worth finding if you run one.
|
|
11
|
+
- **Windows: reads from a console-less host no longer flash a black console window per child ([#60](https://github.com/liustack/modlens/issues/60)).** A child process started from a host without a console of its own gets one allocated, and Windows shows its window. The desktop app is exactly such a host, so every read popped a console window for the provider child, and the probes and the config-file opener could do the same. Node's `windowsHide` suppresses it and defaults to off, and it was passed nowhere. Every child, in the core and in the dsh plugin, is now started through a wrapper that writes the option after the caller's, and a contract test holds the boundary: no shipped file other than the two wrappers may reach `child_process` at all, so the next child someone adds cannot forget an option it never sees. Thanks to @DoiiarX for the report and the call-site list.
|
|
12
|
+
|
|
3
13
|
## 3.18.3 - 2026-08-17
|
|
4
14
|
|
|
5
15
|
- **dsh: a `(modlens vision)` route now inherits the retry policy its upstream already had ([#57](https://github.com/liustack/modlens/issues/57)).** A user set `maxRetries: 50` on their route and watched the vision group give up after 2, the harness default. The wrapper registers an adapter of its own, and the method dsh reads that policy from was returning nothing, which asks for the default on a synthetic route that ultimately calls the real one. It delegates now.
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Issues are welcome any time: [open one](https://github.com/liustack/modlens/issu
|
|
|
34
34
|
|
|
35
35
|
## Highlights
|
|
36
36
|
|
|
37
|
-
**🥇 The most capable vision plugin for DeepSeek Harness (dsh):** one command, `npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.
|
|
37
|
+
**🥇 The most capable vision plugin for DeepSeek Harness (dsh):** one command, `npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.5`, and the text-only DeepSeek model behind dsh reads images through a native `modlens_read_image` tool. Updating is the same command again. The version is named rather than `@latest` on purpose: pnpm 11 holds back releases published in the last 24 hours and resolves the tag against what survives, so `@latest` would install whatever shipped a day ago ([details](docs/harness-setup.md#keeping-it-up-to-date)).
|
|
38
38
|
|
|
39
39
|
Pasting an image works two ways. **① Just paste.** On a text-only model the pasted image lands as a private temp file and its path enters the composer — the same interaction OpenCode and Pi ship — and the `modlens_read_image` tool takes it from there. **② Pick a `(modlens vision)` entry** in the model selector (it remembers your choice, so once is enough), then paste: the thumbnail stays visible in your message, closer to the Codex app feel, and the image is converted to structured evidence at request time, answered by the same underlying route. The plugin auto-discovers every provider route carrying text-only DeepSeek or GLM models and adds a wrapped entry per route (a stock install gets **`DeepSeek-V4-Flash (modlens vision)`** and **`DeepSeek-V4-Pro (modlens vision)`**; extra routes like opencode-go or zai get their own); the two families' own vision models are excluded automatically. Which paste route applies is the host's per-model call: only a model its metadata positively confirms text-only is taken over, anything unconfirmed is left alone, so vision models keep their native paste ([details](docs/harness-setup.md)).
|
|
40
40
|
|
package/README.zh-CN.md
CHANGED
|
@@ -34,7 +34,7 @@ DeepSeek 和 GLM 的主力对话模型是纯文本的,无法进行图片识别
|
|
|
34
34
|
|
|
35
35
|
## 亮点
|
|
36
36
|
|
|
37
|
-
**🥇 全网最强的 DeepSeek Harness(dsh)外挂视觉识别插件:**一条命令 `npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.
|
|
37
|
+
**🥇 全网最强的 DeepSeek Harness(dsh)外挂视觉识别插件:**一条命令 `npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.5`,dsh 背后的纯文本 DeepSeek 模型即可通过原生 `modlens_read_image` 工具读图。更新就是再跑一遍同一条命令。这里点名版本号而不用 `@latest` 是有意的:pnpm 11 会扣住最近 24 小时内发布的版本,dist-tag 只在剩下的里面解析,用 `@latest` 装到的会是一天前发布的那个([细节](docs/harness-setup.zh-CN.md#保持更新))。
|
|
38
38
|
|
|
39
39
|
DeepSeek Harness 粘贴识图有两种玩法。
|
|
40
40
|
|
|
@@ -69,7 +69,7 @@ agy # 浏览器完成
|
|
|
69
69
|
**DeepSeek Harness(dsh)用户不走 skill 流程**,本包就是原生 dsh 插件:
|
|
70
70
|
|
|
71
71
|
```sh
|
|
72
|
-
npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.
|
|
72
|
+
npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.5
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
装完即有 `modlens_read_image` 工具,选「(modlens vision)」模型变体即可直接粘贴识图。引擎配置同样在 `~/.modlens`,详见[宿主接入](docs/harness-setup.zh-CN.md)。
|
package/dist/main.js
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
|
-
import * as childProcess from "child_process";
|
|
6
|
-
import { execFileSync, spawn } from "child_process";
|
|
7
5
|
import * as os from "os";
|
|
8
6
|
import { fileURLToPath } from "url";
|
|
9
7
|
import { fetch as fetch$1, Agent, ProxyAgent, EnvHttpProxyAgent } from "undici";
|
|
10
8
|
import * as dns from "dns/promises";
|
|
11
9
|
import { isIP } from "net";
|
|
10
|
+
import { execFileSync, spawn } from "child_process";
|
|
12
11
|
import { createRequire } from "module";
|
|
13
12
|
import * as crypto from "crypto";
|
|
14
13
|
import * as readline from "readline";
|
|
@@ -1421,6 +1420,27 @@ const kimiCliProvider = {
|
|
|
1421
1420
|
// it gets a throwaway directory holding only the image.
|
|
1422
1421
|
isolateWorkdir: true
|
|
1423
1422
|
};
|
|
1423
|
+
function derivedSchemaSent(settings) {
|
|
1424
|
+
return Boolean(settings?.structuredOutput) && settings?.extraBody?.response_format === void 0;
|
|
1425
|
+
}
|
|
1426
|
+
function requestShapeAdvice(settings) {
|
|
1427
|
+
if (settings?.extraBody?.response_format !== void 0) {
|
|
1428
|
+
return "The response_format in your extraBody replaces the schema modlens derives, so yours decides the shape here. Check it against the contract, or drop it to hand enforcement back to modlens.";
|
|
1429
|
+
}
|
|
1430
|
+
if (!derivedSchemaSent(settings)) {
|
|
1431
|
+
return "The gateway was never asked to enforce the shape, so this is the model free-handing it. Ask the gateway instead: modlens config set openai.structuredOutput true.";
|
|
1432
|
+
}
|
|
1433
|
+
return "The gateway was asked to enforce the shape and answered with this anyway. Retry, or switch to gemini-api / anthropic for enforced schemas.";
|
|
1434
|
+
}
|
|
1435
|
+
function unusableOutputAdvice(finishReason, settings, quoteReason, whenFinished) {
|
|
1436
|
+
if (finishReason === "length") {
|
|
1437
|
+
return `The answer was cut off (finish_reason=length), so this is a length limit rather than a shape problem. Raise it, e.g. modlens config set openai.extraBody '{"max_tokens":4096}'.`;
|
|
1438
|
+
}
|
|
1439
|
+
if (finishReason !== void 0 && finishReason !== "stop") {
|
|
1440
|
+
return `The gateway ended the answer with finish_reason=${quoteReason(finishReason)}, so it may be incomplete for a reason of its own. Check what that reason means for this endpoint before changing the request.`;
|
|
1441
|
+
}
|
|
1442
|
+
return `${whenFinished} ${requestShapeAdvice(settings)}`;
|
|
1443
|
+
}
|
|
1424
1444
|
async function executeOpenaiCompat(options) {
|
|
1425
1445
|
assertNoRetiredEndpointBinding("openai", options.settings ?? {});
|
|
1426
1446
|
const apiKey = options.settings?.apiKey;
|
|
@@ -1458,7 +1478,7 @@ ${JSON_TEMPLATE_INSTRUCTION}`;
|
|
|
1458
1478
|
// caller supplied wins outright rather than being
|
|
1459
1479
|
// merged into ours, since the two describe the same
|
|
1460
1480
|
// thing and a blend of them describes neither.
|
|
1461
|
-
...options.settings
|
|
1481
|
+
...derivedSchemaSent(options.settings) ? { response_format: visionResponseFormat() } : {},
|
|
1462
1482
|
messages: [
|
|
1463
1483
|
{
|
|
1464
1484
|
role: "user",
|
|
@@ -1490,8 +1510,12 @@ ${JSON_TEMPLATE_INSTRUCTION}`;
|
|
|
1490
1510
|
}
|
|
1491
1511
|
const rawResult = extractJson(text);
|
|
1492
1512
|
if (rawResult === null) {
|
|
1493
|
-
const
|
|
1494
|
-
|
|
1513
|
+
const advice = unusableOutputAdvice(
|
|
1514
|
+
payload.choices?.[0]?.finish_reason,
|
|
1515
|
+
options.settings,
|
|
1516
|
+
(reason) => quote(reason, (clipped) => truncate(clipped, 80)),
|
|
1517
|
+
"The answer ended normally but no complete JSON object could be read from it."
|
|
1518
|
+
);
|
|
1495
1519
|
throw new Error(
|
|
1496
1520
|
`OpenAI-compatible API returned non-JSON output. ${advice} Output ended with: ${quote(text, tail)}`
|
|
1497
1521
|
);
|
|
@@ -1499,8 +1523,14 @@ ${JSON_TEMPLATE_INSTRUCTION}`;
|
|
|
1499
1523
|
const result = normalizeVisionResult(rawResult);
|
|
1500
1524
|
const missing = missingSchemaFields(result);
|
|
1501
1525
|
if (missing.length > 0) {
|
|
1526
|
+
const advice = unusableOutputAdvice(
|
|
1527
|
+
payload.choices?.[0]?.finish_reason,
|
|
1528
|
+
options.settings,
|
|
1529
|
+
(reason) => quote(reason, (clipped) => truncate(clipped, 80)),
|
|
1530
|
+
"The answer ended normally and parsed, but not into the contract."
|
|
1531
|
+
);
|
|
1502
1532
|
throw new Error(
|
|
1503
|
-
`OpenAI-compatible API returned JSON that does not match the vision schema (wrong or missing: ${missing.join(", ")}).
|
|
1533
|
+
`OpenAI-compatible API returned JSON that does not match the vision schema (wrong or missing: ${missing.join(", ")}). ${advice} Got: ${quote(text)}`
|
|
1504
1534
|
);
|
|
1505
1535
|
}
|
|
1506
1536
|
return {
|
|
@@ -2019,6 +2049,12 @@ function providerChain(kind, config2, env = process.env) {
|
|
|
2019
2049
|
}
|
|
2020
2050
|
return names.filter((name) => providerAvailable(name, config2, env)).map((name) => resolveProvider(name));
|
|
2021
2051
|
}
|
|
2052
|
+
function spawnHidden(command, args, options) {
|
|
2053
|
+
return spawn(command, args, { ...options, windowsHide: true });
|
|
2054
|
+
}
|
|
2055
|
+
function execFileSyncHidden(file, args, options) {
|
|
2056
|
+
return execFileSync(file, args, { ...options, windowsHide: true });
|
|
2057
|
+
}
|
|
2022
2058
|
function existenceOf(target) {
|
|
2023
2059
|
try {
|
|
2024
2060
|
fs.statSync(target);
|
|
@@ -2332,7 +2368,7 @@ const DEFAULT_TTL_MS = 6 * 60 * 60 * 1e3;
|
|
|
2332
2368
|
const CLI_TIMEOUT_MS = 1e4;
|
|
2333
2369
|
function defaultRunCli(bin, args, timeoutMs) {
|
|
2334
2370
|
const plan = resolveSpawnPlan(bin, args);
|
|
2335
|
-
return
|
|
2371
|
+
return execFileSyncHidden(plan.command, plan.args, {
|
|
2336
2372
|
encoding: "utf-8",
|
|
2337
2373
|
timeout: timeoutMs,
|
|
2338
2374
|
stdio: "pipe",
|
|
@@ -2920,7 +2956,7 @@ function fetchPiKey(piPath, modelId, provider, timeoutMs) {
|
|
|
2920
2956
|
"--provider",
|
|
2921
2957
|
provider
|
|
2922
2958
|
]);
|
|
2923
|
-
const key =
|
|
2959
|
+
const key = execFileSyncHidden(plan.command, plan.args, {
|
|
2924
2960
|
encoding: "utf-8",
|
|
2925
2961
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2926
2962
|
timeout: timeoutMs,
|
|
@@ -3184,7 +3220,7 @@ async function runProvider(provider, model, options, resolvedInput, timeoutMs, c
|
|
|
3184
3220
|
);
|
|
3185
3221
|
parsed = parseOutput(commandResult.stdout);
|
|
3186
3222
|
} finally {
|
|
3187
|
-
isolation?.cleanup();
|
|
3223
|
+
await isolation?.cleanup();
|
|
3188
3224
|
}
|
|
3189
3225
|
} else {
|
|
3190
3226
|
throw new Error(
|
|
@@ -3225,19 +3261,16 @@ function validateInputFile(filePath) {
|
|
|
3225
3261
|
throw new Error(`Input is not a file: ${filePath}`);
|
|
3226
3262
|
}
|
|
3227
3263
|
}
|
|
3228
|
-
function removeWorkdir(workdir) {
|
|
3264
|
+
async function removeWorkdir(workdir) {
|
|
3229
3265
|
try {
|
|
3230
|
-
fs.
|
|
3231
|
-
|
|
3266
|
+
await fs.promises.rm(workdir, {
|
|
3267
|
+
recursive: true,
|
|
3268
|
+
force: true,
|
|
3269
|
+
maxRetries: 1,
|
|
3270
|
+
retryDelay: 500
|
|
3271
|
+
});
|
|
3232
3272
|
} catch {
|
|
3233
3273
|
}
|
|
3234
|
-
const retry = setTimeout(() => {
|
|
3235
|
-
try {
|
|
3236
|
-
fs.rmSync(workdir, { recursive: true, force: true });
|
|
3237
|
-
} catch {
|
|
3238
|
-
}
|
|
3239
|
-
}, 500);
|
|
3240
|
-
retry.unref();
|
|
3241
3274
|
}
|
|
3242
3275
|
function isolateImage(source) {
|
|
3243
3276
|
const workdir = fs.mkdtempSync(path.join(os.tmpdir(), "modlens-work-"));
|
|
@@ -3268,7 +3301,7 @@ function runCommand(providerName, invocation, timeoutMs, describeFailure) {
|
|
|
3268
3301
|
invocation.cwd
|
|
3269
3302
|
);
|
|
3270
3303
|
const spawnEnv = plan.env ?? childEnv;
|
|
3271
|
-
const child =
|
|
3304
|
+
const child = spawnHidden(plan.command, plan.args, {
|
|
3272
3305
|
cwd: invocation.cwd,
|
|
3273
3306
|
stdio: ["ignore", "pipe", "pipe"],
|
|
3274
3307
|
// A provider may mark its own child, which is how kimi-cli tells a
|
|
@@ -3418,7 +3451,7 @@ function detectHarnessDetailed() {
|
|
|
3418
3451
|
}
|
|
3419
3452
|
if (process.platform !== "win32") {
|
|
3420
3453
|
try {
|
|
3421
|
-
const ps =
|
|
3454
|
+
const ps = execFileSyncHidden("ps", ["-Ao", "pid=,ppid=,command="], {
|
|
3422
3455
|
encoding: "utf-8",
|
|
3423
3456
|
maxBuffer: 16 * 1024 * 1024,
|
|
3424
3457
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -4565,7 +4598,7 @@ function parsePositiveInt(raw, flag) {
|
|
|
4565
4598
|
}
|
|
4566
4599
|
return Number.parseInt(raw, 10);
|
|
4567
4600
|
}
|
|
4568
|
-
program.name("modlens").description("Plug-in vision for text-only LLMs: image in, structured JSON evidence out").version("3.18.
|
|
4601
|
+
program.name("modlens").description("Plug-in vision for text-only LLMs: image in, structured JSON evidence out").version("3.18.5");
|
|
4569
4602
|
program.command("analyze", { isDefault: true }).description("Analyze an image into structured JSON evidence (default command)").requiredOption("-i, --input <path|url>", "Input image path or https URL").option("-o, --output <path>", "Write result JSON to a file").option("-m, --model <name>", "Provider model name").option("-p, --provider <name>", `Vision provider (${listProviders().join(", ")})`).option("--prompt <text>", "Extra focus for this image").option("--timeout <ms>", "Provider timeout in milliseconds", "180000").option("--provider-bin <path>", "Provider binary path (default: agy)").option("--workdir <path>", "Working directory for the provider").option(
|
|
4570
4603
|
"--extra-body <json>",
|
|
4571
4604
|
`JSON merged into the API request body, e.g. '{"thinking":{"type":"disabled"}}'`
|
|
@@ -4675,7 +4708,7 @@ program.command("doctor").description(
|
|
|
4675
4708
|
configPath: CONFIG_PATH,
|
|
4676
4709
|
// Lets doctor name an installed skill copy that is older than
|
|
4677
4710
|
// the CLI reporting on it (issue #33).
|
|
4678
|
-
version: "3.18.
|
|
4711
|
+
version: "3.18.5"
|
|
4679
4712
|
});
|
|
4680
4713
|
const output = options.json ? JSON.stringify(report, null, 2) : renderDoctorReport(report);
|
|
4681
4714
|
process.stdout.write(`${output}
|
package/docs/harness-setup.md
CHANGED
|
@@ -55,7 +55,7 @@ OpenCode with DeepSeek: `opencode auth login`, pick DeepSeek and paste the key (
|
|
|
55
55
|
dsh is different from the other harnesses: modlens plugs in as a native tool, not a prompt-triggered skill. The package itself is a dsh bundle, so one command installs it into a profile:
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
|
-
npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.
|
|
58
|
+
npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.5
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
This registers a `modlens_read_image` tool whose schema reaches the model on every request (no trigger heuristics), runs the modlens CLI shipped inside the same package, and returns the structured evidence as the tool's canonical JSON output. Engines, reuse grants, and guard rules stay in `~/.modlens/config.json`, shared with every other harness. dsh is in developer preview and its plugin surface may change; the plugin keeps its touch small (raw tool registration, the llm adapter surface for the vision variants, the attachment reader, and one agent pre-step hook) and degrades loudly if any of them moves.
|
|
@@ -81,7 +81,7 @@ modlens ships often, and both install shapes freeze at whatever version they
|
|
|
81
81
|
got. On dsh, re-run the install with the version named:
|
|
82
82
|
|
|
83
83
|
```sh
|
|
84
|
-
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.
|
|
84
|
+
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.5
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
`npm view @liustack/modlens version` prints the current one, and this page is
|
|
@@ -55,7 +55,7 @@ OpenCode 接 DeepSeek:执行 `opencode auth login`,选择 DeepSeek 并粘贴
|
|
|
55
55
|
dsh 与其他 harness 不同:modlens 以原生工具的形式接入,而不是靠提示词触发的 skill。本包自身就是一个 dsh bundle,一条命令即可装进某个 profile:
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
|
-
npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.
|
|
58
|
+
npx -y @deepseek-ai/dsh plugin --profile web add @liustack/modlens@3.18.5
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
这会注册一个 `modlens_read_image` 工具,它的 schema 随每次请求抵达模型(不靠触发启发式),运行同一个包里自带的 modlens CLI,并把结构化证据作为工具的标准 JSON 输出返回。引擎、复用授权和 guard 规则仍在 `~/.modlens/config.json` 里,与其他所有 harness 共享。dsh 还在开发者预览阶段,插件接口可能变化。这个插件刻意保持很小的接触面(原生工具注册、视觉变体所用的 llm 适配层、附件读取器,以及一个 agent 执行前钩子),其中任何一处变动,它都会大声报错而不是无声退化。
|
|
@@ -71,7 +71,7 @@ dsh 的网页用户面前没有终端,所以引擎设置有一张卡片,在*
|
|
|
71
71
|
modlens 发布很频繁,而两种安装形态都会冻结在装进来的那个版本上。dsh 上重跑一遍安装即可,版本号要点名:
|
|
72
72
|
|
|
73
73
|
```sh
|
|
74
|
-
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.
|
|
74
|
+
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.5
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
`npm view @liustack/modlens version` 可以查到当前版本号,本页的版本号则由发布流程自动写入。
|
package/docs/troubleshooting.md
CHANGED
|
@@ -163,7 +163,7 @@ simply lands on an older one. Name the exact version instead, which pnpm treats
|
|
|
163
163
|
as a deliberate request rather than a resolution:
|
|
164
164
|
|
|
165
165
|
```sh
|
|
166
|
-
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.
|
|
166
|
+
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.5
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
`npm view @liustack/modlens version` prints the current one. pnpm 11 installs a named
|
|
@@ -178,7 +178,7 @@ file:
|
|
|
178
178
|
|
|
179
179
|
```yaml
|
|
180
180
|
minimumReleaseAgeExclude:
|
|
181
|
-
- '@liustack/modlens@3.18.
|
|
181
|
+
- '@liustack/modlens@3.18.5'
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
Or lift the gate for a single command, which lifts it for everything that
|
|
@@ -144,7 +144,7 @@ dsh profile 装到的是旧版 modlens。`dsh.bundle` 声明从 3.9.0 起才存
|
|
|
144
144
|
`@latest` 绕不开这一层,本页早先的说法是错的。冷静期先把候选版本过滤掉,dist-tag 才在剩下的里面解析,于是它直接落到了更旧的那个上。改成写死精确版本号,pnpm 会把它当作一次明确的指定,而不是一次解析:
|
|
145
145
|
|
|
146
146
|
```sh
|
|
147
|
-
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.
|
|
147
|
+
npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.5
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
`npm view @liustack/modlens version` 可以查到当前版本号。pnpm 11 会装上被点名的版本,11.1.3 起还会把它作为一条已批准的例外写进该 profile 的 `pnpm-workspace.yaml`,其余所有包和 modlens 以后的版本仍然留在窗口后面。
|
|
@@ -153,7 +153,7 @@ npx -y @deepseek-ai/dsh plugin --profile <name> add @liustack/modlens@3.18.3
|
|
|
153
153
|
|
|
154
154
|
```yaml
|
|
155
155
|
minimumReleaseAgeExclude:
|
|
156
|
-
- '@liustack/modlens@3.18.
|
|
156
|
+
- '@liustack/modlens@3.18.5'
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
或者只为这一条命令解除冷静期,注意它解除的是这条命令解析到的所有包,不只 modlens:
|
package/dsh/client.js
CHANGED
|
@@ -864,7 +864,7 @@ window.__ModuleLoader__.load({
|
|
|
864
864
|
var ui = require('@deepseek-ai/dsh-client-ui-primitives')
|
|
865
865
|
var Card = ConfigCard(react, ui)
|
|
866
866
|
ctx.slots.inject('settings.plugin.item', function* () {
|
|
867
|
-
yield ctx.slots.register({ name: 'settings.plugin.item', id: 'modlens', order: 30 }, Card)
|
|
867
|
+
yield ctx.slots.register({ name: 'settings.plugin.item', id: 'modlens', key: 'modlens', order: 30 }, Card)
|
|
868
868
|
})
|
|
869
869
|
}
|
|
870
870
|
|
package/dsh/index.js
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
// Loaded via the cordis.patch.yml row `@liustack/modlens/dsh` (see the
|
|
11
11
|
// package.json `dsh.bundle` manifest). Providers, reuse grants, and guard
|
|
12
12
|
// rules keep living in ~/.modlens/config.json, shared with every harness.
|
|
13
|
-
import { spawn } from 'node:child_process'
|
|
14
13
|
import { chmodSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
15
14
|
import { homedir, tmpdir } from 'node:os'
|
|
16
15
|
import { dirname, join } from 'node:path'
|
|
17
16
|
import { fileURLToPath } from 'node:url'
|
|
17
|
+
import { spawnHidden } from './spawnHidden.js'
|
|
18
18
|
|
|
19
19
|
const CLI_PATH = fileURLToPath(new URL('../dist/main.js', import.meta.url))
|
|
20
20
|
// Kept in lockstep with src/schema.ts by a repo test; the plugin file cannot
|
|
@@ -74,10 +74,10 @@ export function apply(ctx, config = {}) {
|
|
|
74
74
|
}
|
|
75
75
|
// Same web server, a separate switch: turning paste-to-path off is a
|
|
76
76
|
// statement about how images enter, not about whether the engine can
|
|
77
|
-
// be configured.
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
// (issue #39).
|
|
77
|
+
// be configured. The card the browser half contributes talks to this
|
|
78
|
+
// route rather than to a settings schema, because modlens config lives
|
|
79
|
+
// in ~/.modlens/config.json and is shared with the CLI and every other
|
|
80
|
+
// harness (issue #39).
|
|
81
81
|
if (config.settingsCard !== false) {
|
|
82
82
|
try {
|
|
83
83
|
registerConfigRoute(scope)
|
|
@@ -87,6 +87,31 @@ export function apply(ctx, config = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
})
|
|
89
89
|
}
|
|
90
|
+
// Since rc.7 the settings page dispatches plugin cards by served settings
|
|
91
|
+
// namespace: a card renders only when its slot key matches a namespace the
|
|
92
|
+
// host answers for in settings.describe (issues #61, #65). The namespace
|
|
93
|
+
// registered here is an empty pass-through object, because its whole job is
|
|
94
|
+
// to make the card dispatchable; the values stay in ~/.modlens/config.json,
|
|
95
|
+
// behind the loopback route above, where every other harness can read them.
|
|
96
|
+
// The schema is duck-typed to what the seam calls on it, callable plus
|
|
97
|
+
// toJSON, the same stance the LlmAdapter takes: importing a dsh package for
|
|
98
|
+
// it would pin this plugin to one harness version. Harnesses without the
|
|
99
|
+
// settings service never run the closure, and their older settings page
|
|
100
|
+
// rendered every registered card anyway.
|
|
101
|
+
if (config.settingsCard !== false && typeof ctx.inject === 'function') {
|
|
102
|
+
ctx.inject(['settings'], (scope) => {
|
|
103
|
+
try {
|
|
104
|
+
const passThrough = (value) => ({ ...(value ?? {}) })
|
|
105
|
+
passThrough.toJSON = () => ({
|
|
106
|
+
uid: 0,
|
|
107
|
+
refs: { 0: { type: 'object', meta: { default: {} }, dict: {} } },
|
|
108
|
+
})
|
|
109
|
+
scope.settings.register('modlens', passThrough, { base: {} })
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.error(`[modlens] settings namespace skipped: ${error}`)
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
}
|
|
90
115
|
// Registered as a raw JSON-Schema tool definition (no dsh package imports:
|
|
91
116
|
// the developer-preview registry accepts these and out-of-tree resolution
|
|
92
117
|
// of @deepseek-ai/dsh-tools is not yet reliable), so this plugin owns its
|
|
@@ -1023,7 +1048,7 @@ async function readImageBlock(ctx, block, signal) {
|
|
|
1023
1048
|
|
|
1024
1049
|
function run(command, args, signal) {
|
|
1025
1050
|
return new Promise((resolve, reject) => {
|
|
1026
|
-
const child =
|
|
1051
|
+
const child = spawnHidden(command, args, {
|
|
1027
1052
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
1028
1053
|
signal,
|
|
1029
1054
|
// In the packaged desktop app process.execPath is the Electron binary;
|
|
@@ -1349,7 +1374,11 @@ function openConfigFile() {
|
|
|
1349
1374
|
: process.platform === 'win32'
|
|
1350
1375
|
? ['cmd', ['/c', 'start', '', file]]
|
|
1351
1376
|
: ['xdg-open', [file]]
|
|
1352
|
-
|
|
1377
|
+
// Hiding applies to the `cmd` that runs `start`, not to the editor it hands
|
|
1378
|
+
// off to: `start` opens the file through its association in a process of its
|
|
1379
|
+
// own. Windows ignores CREATE_NO_WINDOW next to DETACHED_PROCESS, so what
|
|
1380
|
+
// this leaves is SW_HIDE on the middleman.
|
|
1381
|
+
spawnHidden(command, args, { detached: true, stdio: 'ignore' }).unref()
|
|
1353
1382
|
}
|
|
1354
1383
|
|
|
1355
1384
|
/** localhost, ::1, or anything in 127/8, matching dsh's own /api fence. */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChildProcess, SpawnOptions } from 'child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Starts a child with its console window hidden, whatever the caller asked for
|
|
5
|
+
* (issue #60). `windowsHide` is accepted and ignored rather than refused: the
|
|
6
|
+
* plugin is plain JavaScript, so refusing it in the types would stop nothing,
|
|
7
|
+
* and the wrapper overwrites it either way.
|
|
8
|
+
*/
|
|
9
|
+
export declare function spawnHidden(
|
|
10
|
+
command: string,
|
|
11
|
+
args: readonly string[],
|
|
12
|
+
options: SpawnOptions,
|
|
13
|
+
): ChildProcess;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The only place this plugin starts a child process.
|
|
2
|
+
//
|
|
3
|
+
// The desktop app has no console of its own, so on Windows every child it
|
|
4
|
+
// starts would be given one and shown its window: a black box per read
|
|
5
|
+
// (issue #60). `windowsHide` suppresses that, defaults to false in Node, and is
|
|
6
|
+
// ignored elsewhere.
|
|
7
|
+
//
|
|
8
|
+
// It lives in a file of its own, apart from its callers, so the rule can be
|
|
9
|
+
// checked by looking at which files reach `child_process` at all rather than at
|
|
10
|
+
// what each call passes. A call site cannot forget an option it never writes,
|
|
11
|
+
// and writing the option after the caller's leaves nothing to override it.
|
|
12
|
+
//
|
|
13
|
+
// The core has its own copy in src/util/spawnHidden.ts. The duplication is on
|
|
14
|
+
// purpose: this plugin ships as a unit and must not import from the CLI it
|
|
15
|
+
// drives.
|
|
16
|
+
import { spawn } from 'node:child_process'
|
|
17
|
+
|
|
18
|
+
export function spawnHidden(command, args, options) {
|
|
19
|
+
return spawn(command, args, { ...options, windowsHide: true })
|
|
20
|
+
}
|
package/package.json
CHANGED
package/skills/modlens/SKILL.md
CHANGED
|
@@ -20,11 +20,11 @@ powershell -ExecutionPolicy Bypass -File <skill-dir>\scripts\run.ps1 <args>
|
|
|
20
20
|
|
|
21
21
|
It resolves a working runtime (PATH `modlens`, then `npx`, then `bunx`) and forwards your arguments unchanged. Exit 78 means no runtime: relay the `nextSteps` from its stderr JSON instead of retrying.
|
|
22
22
|
|
|
23
|
-
If your harness forbids running scripts, reason through the same order by hand and run the first line that works (the pinned version is 3.18.
|
|
23
|
+
If your harness forbids running scripts, reason through the same order by hand and run the first line that works (the pinned version is 3.18.5):
|
|
24
24
|
|
|
25
|
-
1. A `modlens` on `PATH` whose major version is 3 and is at least 3.18.
|
|
26
|
-
2. Otherwise, if `npx` exists: `npx --yes --package @liustack/modlens@3.18.
|
|
27
|
-
3. Otherwise, if `bunx` exists: `bunx --bun @liustack/modlens@3.18.
|
|
25
|
+
1. A `modlens` on `PATH` whose major version is 3 and is at least 3.18.5: `modlens <args>`.
|
|
26
|
+
2. Otherwise, if `npx` exists: `npx --yes --package @liustack/modlens@3.18.5 modlens <args>`.
|
|
27
|
+
3. Otherwise, if `bunx` exists: `bunx --bun @liustack/modlens@3.18.5 <args>`.
|
|
28
28
|
4. Otherwise tell the user no JavaScript runtime was found and that installing Node 22.19+ (https://nodejs.org) or Bun (https://bun.sh) is the next step. Do not claim modlens itself failed.
|
|
29
29
|
|
|
30
30
|
`references/runtime.md` documents the pin and the diagnostic fields.
|
|
@@ -24,7 +24,7 @@ $ErrorActionPreference = 'Stop'
|
|
|
24
24
|
# package.json version, and the release script rewrites it on every bump.
|
|
25
25
|
$Package = '@liustack/modlens'
|
|
26
26
|
$Bin = 'modlens'
|
|
27
|
-
$Pinned = '3.18.
|
|
27
|
+
$Pinned = '3.18.5'
|
|
28
28
|
# -------------------------------------------------------------------------------
|
|
29
29
|
|
|
30
30
|
$NativeNote = 'no native artifact is published for this tool yet; phase A ships npm launch paths only'
|
|
@@ -22,7 +22,7 @@ set -eu
|
|
|
22
22
|
# package.json version, and the release script rewrites it on every bump.
|
|
23
23
|
PKG="@liustack/modlens"
|
|
24
24
|
BIN="modlens"
|
|
25
|
-
PINNED="3.18.
|
|
25
|
+
PINNED="3.18.5"
|
|
26
26
|
# -------------------------------------------------------------------------------
|
|
27
27
|
|
|
28
28
|
NATIVE_NOTE="no native artifact is published for this tool yet; phase A ships npm launch paths only"
|