kimi-webbridge-dsh 1.4.5 → 1.4.6

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/README.md CHANGED
@@ -1,17 +1,17 @@
1
1
  # kimi-webbridge-dsh
2
2
 
3
- Kimi WebBridge 的 dsh 插件(**基础设施 + 技能生成**)。插件本身不代理浏览器操作,而是负责:
3
+ Kimi WebBridge 的 dsh 插件(**基础设施 + 技能注册**)。插件本身不代理浏览器操作,而是负责:
4
4
 
5
5
  1. **保障桥完好**:守护进程二进制缺失时自动从官方 CDN 下载(跨平台、SHA-256 校验),守护进程未运行时自动拉起;
6
- 2. **生成 skill**:启动时把随包内置的 `skill.md` 同步到 `~/.dsh/skills/kimi-webbridge/SKILL.md`,模型通过 `skill` 工具加载它,按文档用 HTTP 行使全部浏览器能力(17 个动作);
6
+ 2. **注册 skill**:启动时把随包内置的 `skill.md` 注册为运行时 skill(`ctx.skills.register`,`source: bundled`),模型通过 `skill` 工具加载它,按文档用 HTTP 行使全部浏览器能力(17 个动作);
7
7
  3. **注册一个瘦工具 `kimi_webbridge`**:只有 `status` 一个动作(守护进程 + 扩展健康检查),作为其他 skill(如 x-cli 系列)的桥健康锚点。
8
8
 
9
9
  ## 架构
10
10
 
11
11
  | 层 | 角色 |
12
12
  |---|---|
13
- | 插件(本包) | 守护进程二进制供应 + 自动启动;apply() 时同步 skill 文件 |
14
- | skill(`~/.dsh/skills/kimi-webbridge/SKILL.md`) | 模型经 `skill` 工具加载,按文档驱动守护进程:navigate / find_tab / snapshot / click / mouse_click / fill / key_type / send_keys / evaluate / cdp / screenshot / network / upload / save_as_pdf / list_tabs / close_tab / close_session |
13
+ | 插件(本包) | 守护进程二进制供应 + 自动启动;apply() 时注册运行时 skill |
14
+ | skill(运行时注册,随包内置 `skill.md`) | 模型经 `skill` 工具加载,按文档驱动守护进程:navigate / find_tab / snapshot / click / mouse_click / fill / key_type / send_keys / evaluate / cdp / screenshot / network / upload / save_as_pdf / list_tabs / close_tab / close_session |
15
15
  | 瘦工具 `kimi_webbridge` | 仅 `status` 健康检查(自带守护进程自愈) |
16
16
 
17
17
  ## 安装(一次性,零手工配置)
@@ -20,7 +20,7 @@ Kimi WebBridge 的 dsh 插件(**基础设施 + 技能生成**)。插件本
20
20
  dsh plugin --profile web add kimi-webbridge-dsh
21
21
  ```
22
22
 
23
- 本包声明了 `dsh.bundle.patch`:`dsh plugin add` 会自动把它登记进 profile 的 bundle 层(`dsh.profile.bundles`),**无需手动编辑任何 cordis.patch.yml**。重启一次 `dsh web`:启动时插件同步 skill 文件,新会话的 skill 目录中即出现 `kimi-webbridge`。
23
+ 本包声明了 `dsh.bundle.patch`:`dsh plugin add` 会自动把它登记进 profile 的 bundle 层(`dsh.profile.bundles`),**无需手动编辑任何 cordis.patch.yml**。重启一次 `dsh web`:启动时插件把 skill 注册进运行时 registry,新会话的 skill 目录中即出现 `kimi-webbridge`。
24
24
 
25
25
  ## 用法(模型视角)
26
26
 
@@ -78,7 +78,7 @@ dsh plugin --profile web add kimi-webbridge-dsh
78
78
  - id: kimi-webbridge
79
79
  config:
80
80
  autoInstallDaemon: false
81
- daemonVersion: 0.3.0
81
+ daemonVersion: v1.11.6
82
82
  ```
83
83
 
84
84
  | 配置项 | 默认值 | 说明 |
@@ -87,8 +87,8 @@ dsh plugin --profile web add kimi-webbridge-dsh
87
87
  | `requestTimeoutMs` | `120000` | 单次请求超时(毫秒) |
88
88
  | `autoStartDaemon` | `true` | 守护进程未运行时自动启动 |
89
89
  | `autoInstallDaemon` | `true` | 二进制缺失时自动从官方 CDN 下载安装(关闭后需手动[从官方安装](https://www.kimi.ai/products/kimi-webbridge)) |
90
- | `daemonVersion` | `latest` | 自动安装时的版本(可固定如 `0.3.0`) |
91
- | `generateSkill` | `true` | 启动时同步 `kimi-webbridge` skill 文件(关闭后不生成/更新) |
90
+ | `daemonVersion` | `latest` | 自动安装时的版本(可固定如 `v1.11.6`,需带 `v` 前缀与 CDN 路径一致) |
91
+ | `registerSkill` | `true` | 启动时把 `kimi-webbridge` skill 注册进运行时 registry(关闭后不注册) |
92
92
 
93
93
  ## 移除
94
94
 
@@ -96,4 +96,4 @@ dsh plugin --profile web add kimi-webbridge-dsh
96
96
  dsh plugin --profile web remove kimi-webbridge-dsh
97
97
  ```
98
98
 
99
- 自动从 bundle 层移除(无需手动删补丁行),重启后生效。skill 文件(`~/.dsh/skills/kimi-webbridge/`)如需一并删除可手动清理。
99
+ 自动从 bundle 层移除(无需手动删补丁行),重启后生效。skill 为运行时注册,移除插件即随之消失,无残留文件。
package/lib/index.js CHANGED
@@ -3,8 +3,8 @@ import { TOOL_ABORTED, defineTool } from "@deepseek-ai/dsh-tools";
3
3
  import { HarnessError } from "@deepseek-ai/dsh-llm";
4
4
  import { spawn } from "node:child_process";
5
5
  import { createHash } from "node:crypto";
6
- import { createWriteStream, existsSync } from "node:fs";
7
- import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
6
+ import { createWriteStream, existsSync, readFileSync } from "node:fs";
7
+ import { chmod, mkdir, readFile, rename, rm } from "node:fs/promises";
8
8
  import { request as httpRequest } from "node:http";
9
9
  import { request as httpsRequest } from "node:https";
10
10
  import { homedir } from "node:os";
@@ -17,9 +17,8 @@ import { fileURLToPath } from "node:url";
17
17
  * Infrastructure-only bridge plugin:
18
18
  * - provisions the daemon binary (official Kimi CDN, SHA-256 verified) and
19
19
  * auto-starts it, keeping the bridge healthy;
20
- * - syncs the packaged skill.md into ~/.dsh/skills/kimi-webbridge/SKILL.md,
21
- * the model-facing skill that documents the full 17-action HTTP protocol
22
- * for driving the user's real browser;
20
+ * - registers the packaged skill.md (the full 17-action HTTP protocol for
21
+ * driving the user's real browser) as a runtime skill via ctx.skills;
23
22
  * - registers one thin tool `kimi_webbridge` whose only action is `status`
24
23
  * (daemon + extension health check) as an anchor for other skills.
25
24
  *
@@ -32,7 +31,7 @@ import { fileURLToPath } from "node:url";
32
31
  const name = "kimi-webbridge";
33
32
 
34
33
  /** Services required by this plugin. */
35
- const inject = ["tools", "systemPrompt"];
34
+ const inject = ["tools", "systemPrompt", "skills"];
36
35
 
37
36
  /** The single action of the thin bridge tool. The full browser protocol lives in the generated skill. */
38
37
  const ACTIONS = ["status"];
@@ -44,7 +43,7 @@ const Config = z.object({
44
43
  autoStartDaemon: z.boolean().default(true),
45
44
  autoInstallDaemon: z.boolean().default(true),
46
45
  daemonVersion: z.string().default("latest"),
47
- generateSkill: z.boolean().default(true)
46
+ registerSkill: z.boolean().default(true)
48
47
  });
49
48
 
50
49
  /** Official release CDN base. */
@@ -88,37 +87,18 @@ function manualInstallHint() {
88
87
  return `run \"curl -fsSL https://cdn.kimi.com/webbridge/install.sh | bash\" (or install from ${page})`;
89
88
  }
90
89
 
91
- /** Directory the DSH skill loader scans for the generated skill. */
92
- function skillDir() {
93
- return join(homedir(), ".dsh", "skills", "kimi-webbridge");
94
- }
90
+ /** Skill identity registered into the host skill registry. */
91
+ const SKILL_NAME = "kimi-webbridge";
92
+
93
+ /** Model-facing routing description shown in the skill catalog. */
94
+ const SKILL_DESCRIPTION = `Drive the user's real browser (with their login sessions) through the local kimi-webbridge daemon at 127.0.0.1:10086: navigate, click, type, read, screenshot, evaluate JS, raw CDP, network capture, file upload, PDF export, and tab/session management. Use this skill whenever the user wants to interact with websites, automate browser tasks, scrape web content, or do anything that needs a real browser — even simple-sounding requests. Also use when the user mentions "browser", "webpage", "open URL", "screenshot", or asks to read/interact with any website (浏览器 / 网页 / 打开网页 / 截图 / 页面).`;
95
95
 
96
96
  /**
97
- * Sync the packaged skill.md into the DSH skills directory so the model can
98
- * load it with the skill tool. Rewrites only when missing or changed, so
99
- * restarts stay cheap and updates propagate automatically.
100
- * @returns true when the file was (re)written.
97
+ * Read the packaged skill body (markdown instructions, no frontmatter).
98
+ * @returns the skill body text.
101
99
  */
102
- async function syncSkill() {
103
- try {
104
- const source = join(dirname(fileURLToPath(import.meta.url)), "..", "skill.md");
105
- const content = await readFile(source, "utf8");
106
- const dest = join(skillDir(), "SKILL.md");
107
- let existing = null;
108
- try {
109
- existing = await readFile(dest, "utf8");
110
- } catch {
111
- // missing — created below
112
- }
113
- if (existing === content) return false;
114
- await mkdir(skillDir(), { recursive: true });
115
- await writeFile(dest, content, "utf8");
116
- return true;
117
- } catch (error) {
118
- // Never break plugin startup over skill syncing; the health tool still works.
119
- console.warn(`kimi-webbridge: skill sync failed: ${error?.message ?? error}`);
120
- return false;
121
- }
100
+ function readSkillBody() {
101
+ return readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "skill.md"), "utf8");
122
102
  }
123
103
 
124
104
  /**
@@ -318,10 +298,22 @@ function apply(ctx, config = {}) {
318
298
  autoStartDaemon = true,
319
299
  autoInstallDaemon = true,
320
300
  daemonVersion = "latest",
321
- generateSkill = true
301
+ registerSkill = true
322
302
  } = config;
323
303
 
324
- if (generateSkill) void syncSkill();
304
+ if (registerSkill) {
305
+ try {
306
+ ctx.skills.register({
307
+ name: SKILL_NAME,
308
+ description: SKILL_DESCRIPTION,
309
+ source: "bundled",
310
+ content: readSkillBody()
311
+ });
312
+ } catch (error) {
313
+ // Never break plugin startup over skill registration; the status tool still works.
314
+ console.warn(`kimi-webbridge: skill registration failed: ${error?.message ?? error}`);
315
+ }
316
+ }
325
317
 
326
318
  ctx.systemPrompt.section({
327
319
  name: "tool:kimi-webbridge",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kimi-webbridge-dsh",
3
- "description": "Infrastructure plugin for dsh: provisions the kimi-webbridge daemon (auto-install with SHA-256 verification, auto-start) and generates the kimi-webbridge skill that documents the full 17-action browser protocol. Registers a thin kimi_webbridge tool (status health check only).",
4
- "version": "1.4.5",
3
+ "description": "Infrastructure plugin for dsh: provisions the kimi-webbridge daemon (auto-install with SHA-256 verification, auto-start) and registers the kimi-webbridge skill that documents the full 17-action browser protocol. Registers a thin kimi_webbridge tool (status health check only).",
4
+ "version": "1.4.6",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "keywords": [
package/skill.md CHANGED
@@ -1,14 +1,8 @@
1
- ---
2
- name: kimi-webbridge
3
- description: |
4
- Drive the user's real browser (with their login sessions) through the local kimi-webbridge daemon at 127.0.0.1:10086: navigate, click, type, read, screenshot, evaluate JS, raw CDP, network capture, file upload, PDF export, and tab/session management. Use this skill whenever the user wants to interact with websites, automate browser tasks, scrape web content, or do anything that needs a real browser — even simple-sounding requests. Also use when the user mentions "browser", "webpage", "open URL", "screenshot", or asks to read/interact with any website (浏览器 / 网页 / 打开网页 / 截图 / 页面).
5
- ---
6
-
7
1
  # Kimi WebBridge
8
2
 
9
3
  Control the user's real browser (their login sessions) through the local daemon at `http://127.0.0.1:10086`.
10
4
 
11
- > This skill file is generated by the `kimi-webbridge-dsh` plugin (plugin v1.4.5 / daemon v1.11.6) and re-synced on plugin updates. Do not hand-edit it.
5
+ > This skill is registered by the `kimi-webbridge-dsh` plugin (plugin v1.4.6 / daemon v1.11.6). Do not hand-edit it.
12
6
 
13
7
  ## Health check first
14
8
 
@@ -82,4 +76,4 @@ Call `close_session` only when the user explicitly asks to close the tabs.
82
76
 
83
77
  ---
84
78
 
85
- Protocol and workflow adapted from the Kimi WebBridge community skill (Apache-2.0). Daemon binary and browser extension by Kimi. This file is generated by kimi-webbridge-dsh.
79
+ Protocol and workflow adapted from the Kimi WebBridge community skill (Apache-2.0). Daemon binary and browser extension by Kimi. This skill is registered by kimi-webbridge-dsh.