kimi-webbridge-dsh 1.4.1 → 1.4.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/README.md +29 -22
- package/lib/index.js +59 -59
- package/package.json +5 -6
- package/skill.md +85 -0
package/README.md
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
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 个动作);
|
|
7
|
+
3. **注册一个瘦工具 `kimi_webbridge`**:只有 `status` 一个动作(守护进程 + 扩展健康检查),作为其他 skill(如 x-cli 系列)的桥健康锚点。
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
dsh plugin --profile web add kimi-webbridge-dsh
|
|
9
|
-
```
|
|
9
|
+
## 架构
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
| 层 | 角色 |
|
|
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 |
|
|
15
|
+
| 瘦工具 `kimi_webbridge` | 仅 `status` 健康检查(自带守护进程自愈) |
|
|
16
|
+
|
|
17
|
+
## 安装(一次性,零手工配置)
|
|
12
18
|
|
|
13
19
|
```powershell
|
|
14
|
-
dsh web
|
|
20
|
+
dsh plugin --profile web add kimi-webbridge-dsh
|
|
15
21
|
```
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
本包声明了 `dsh.bundle.patch`:`dsh plugin add` 会自动把它登记进 profile 的 bundle 层(`dsh.profile.bundles`),**无需手动编辑任何 cordis.patch.yml**。重启一次 `dsh web`:启动时插件同步 skill 文件,新会话的 skill 目录中即出现 `kimi-webbridge`。
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
## 用法(模型视角)
|
|
20
26
|
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- **守护进程不可达**:工具会自动启动;二进制缺失时自动从官方 CDN 下载安装。
|
|
27
|
+
1. 需要真实浏览器时,加载 `kimi-webbridge` skill(触发词:browser / webpage / open URL / 浏览器 / 网页 / 截图……);
|
|
28
|
+
2. 先用 `kimi_webbridge` 工具的 `status` 确认守护进程 + 扩展健康(插件自动补装/拉起二进制);
|
|
29
|
+
3. 按 skill 文档向 `POST http://127.0.0.1:10086/command` 发送 `{action, args, session}` 行使浏览器能力。Windows 上必须用临时文件承载 JSON(shell 会破坏非 ASCII 文本),skill 里有完整说明。
|
|
25
30
|
|
|
26
31
|
## 依赖
|
|
27
32
|
|
|
28
|
-
- **浏览器扩展**:需安装并连接 Kimi WebBridge 浏览器扩展 —— 从 [Chrome Web Store](https://chromewebstore.google.com/detail/kimi-webbridge/fldmhceldgbpfpkbgopacenieobmligc) 安装(`
|
|
33
|
+
- **浏览器扩展**:需安装并连接 Kimi WebBridge 浏览器扩展 —— 从 [Chrome Web Store](https://chromewebstore.google.com/detail/kimi-webbridge/fldmhceldgbpfpkbgopacenieobmligc) 安装(`kimi_webbridge status` 显示 `extension_connected: true`;扩展版本应与守护进程一致)。
|
|
29
34
|
- **守护进程**:无需预装。插件在守护进程不可达时会自动启动它;二进制缺失时会自动从官方 CDN(cdn.kimi.com,与官方安装器同源)下载安装——全程无需手动运行任何安装命令。
|
|
30
35
|
|
|
31
36
|
### 跨平台支持
|
|
@@ -53,15 +58,16 @@ dsh web
|
|
|
53
58
|
|
|
54
59
|
下载流程:先落盘为临时文件(`kimi-webbridge(.exe).tmp-{pid}-{时间戳}`)→ SHA-256 与官方清单核对 → 匹配才重命名为最终路径;不匹配则删除临时文件并中止,任何未验证的二进制都不会留在磁盘。该路径与官方安装器 / `kimi-webbridge upgrade` 命令完全一致,插件、官方工具共用同一份守护进程。
|
|
55
60
|
|
|
56
|
-
##
|
|
61
|
+
## 功能(skill 承载,17 个动作)
|
|
57
62
|
|
|
58
|
-
| 能力 |
|
|
63
|
+
| 能力 | 动作 |
|
|
59
64
|
|---|---|
|
|
60
|
-
|
|
|
61
|
-
| 读页面 | `snapshot
|
|
62
|
-
|
|
|
63
|
-
| JS
|
|
64
|
-
|
|
|
65
|
+
| 导航 / 标签 | `navigate`、`find_tab`、`list_tabs`、`close_tab`、`close_session` |
|
|
66
|
+
| 读页面 | `snapshot`(accessibility tree + `@e` 引用) |
|
|
67
|
+
| 点击 / 输入 | `click`、`mouse_click`(真实鼠标,可信输入)、`fill`、`key_type`(键入,可信)、`send_keys`(组合键) |
|
|
68
|
+
| JS / CDP | `evaluate`(页面上下文)、`cdp`(chrome.debugger 直通) |
|
|
69
|
+
| 截图 / PDF | `screenshot`、`save_as_pdf`(写文件、返回路径) |
|
|
70
|
+
| 网络 / 上传 | `network`(请求捕获)、`upload`(文件上传) |
|
|
65
71
|
| 会话分组 | 一个任务 = 一个 session = 一个标签页组,可一键清理 |
|
|
66
72
|
|
|
67
73
|
## 配置(可选)
|
|
@@ -82,6 +88,7 @@ dsh web
|
|
|
82
88
|
| `autoStartDaemon` | `true` | 守护进程未运行时自动启动 |
|
|
83
89
|
| `autoInstallDaemon` | `true` | 二进制缺失时自动从官方 CDN 下载安装(关闭后需手动[从官方安装](https://www.kimi.ai/products/kimi-webbridge)) |
|
|
84
90
|
| `daemonVersion` | `latest` | 自动安装时的版本(可固定如 `0.3.0`) |
|
|
91
|
+
| `generateSkill` | `true` | 启动时同步 `kimi-webbridge` skill 文件(关闭后不生成/更新) |
|
|
85
92
|
|
|
86
93
|
## 移除
|
|
87
94
|
|
|
@@ -89,4 +96,4 @@ dsh web
|
|
|
89
96
|
dsh plugin --profile web remove kimi-webbridge-dsh
|
|
90
97
|
```
|
|
91
98
|
|
|
92
|
-
自动从 bundle 层移除(无需手动删补丁行),重启后生效。
|
|
99
|
+
自动从 bundle 层移除(无需手动删补丁行),重启后生效。skill 文件(`~/.dsh/skills/kimi-webbridge/`)如需一并删除可手动清理。
|
package/lib/index.js
CHANGED
|
@@ -4,27 +4,26 @@ import { HarnessError } from "@deepseek-ai/dsh-llm";
|
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { createWriteStream, existsSync } from "node:fs";
|
|
7
|
-
import { chmod, mkdir, readFile, rename, rm } from "node:fs/promises";
|
|
7
|
+
import { chmod, mkdir, readFile, rename, rm, writeFile } 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";
|
|
11
11
|
import { dirname, join } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Kimi WebBridge plugin for dsh.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* Infrastructure-only bridge plugin:
|
|
18
|
+
* - provisions the daemon binary (official Kimi CDN, SHA-256 verified) and
|
|
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;
|
|
23
|
+
* - registers one thin tool `kimi_webbridge` whose only action is `status`
|
|
24
|
+
* (daemon + extension health check) as an anchor for other skills.
|
|
19
25
|
*
|
|
20
|
-
*
|
|
21
|
-
* downloaded from the official Kimi CDN (the same source the official
|
|
22
|
-
* installer uses) and started automatically, so no external installer
|
|
23
|
-
* command is required. A browser extension must still be connected for
|
|
24
|
-
* browser actions to work.
|
|
25
|
-
*
|
|
26
|
-
* All requests go straight to the daemon over HTTP, so there are none of the
|
|
27
|
-
* shell-quoting / non-ASCII corruption issues of curl-based integration.
|
|
26
|
+
* A browser extension must still be connected for browser actions to work.
|
|
28
27
|
*
|
|
29
28
|
* @module kimi-webbridge-dsh
|
|
30
29
|
*/
|
|
@@ -35,24 +34,8 @@ const name = "kimi-webbridge";
|
|
|
35
34
|
/** Services required by this plugin. */
|
|
36
35
|
const inject = ["tools", "systemPrompt"];
|
|
37
36
|
|
|
38
|
-
/**
|
|
39
|
-
const ACTIONS = [
|
|
40
|
-
"status",
|
|
41
|
-
"navigate",
|
|
42
|
-
"find_tab",
|
|
43
|
-
"snapshot",
|
|
44
|
-
"click",
|
|
45
|
-
"fill",
|
|
46
|
-
"evaluate",
|
|
47
|
-
"cdp",
|
|
48
|
-
"screenshot",
|
|
49
|
-
"network",
|
|
50
|
-
"upload",
|
|
51
|
-
"save_as_pdf",
|
|
52
|
-
"list_tabs",
|
|
53
|
-
"close_tab",
|
|
54
|
-
"close_session"
|
|
55
|
-
];
|
|
37
|
+
/** The single action of the thin bridge tool. The full browser protocol lives in the generated skill. */
|
|
38
|
+
const ACTIONS = ["status"];
|
|
56
39
|
|
|
57
40
|
/** Runtime configuration schema for the plugin. */
|
|
58
41
|
const Config = z.object({
|
|
@@ -60,7 +43,8 @@ const Config = z.object({
|
|
|
60
43
|
requestTimeoutMs: z.number().step(1).min(1000).default(120000),
|
|
61
44
|
autoStartDaemon: z.boolean().default(true),
|
|
62
45
|
autoInstallDaemon: z.boolean().default(true),
|
|
63
|
-
daemonVersion: z.string().default("latest")
|
|
46
|
+
daemonVersion: z.string().default("latest"),
|
|
47
|
+
generateSkill: z.boolean().default(true)
|
|
64
48
|
});
|
|
65
49
|
|
|
66
50
|
/** Official release CDN base. */
|
|
@@ -104,6 +88,39 @@ function manualInstallHint() {
|
|
|
104
88
|
return `run \"curl -fsSL https://cdn.kimi.com/webbridge/install.sh | bash\" (or install from ${page})`;
|
|
105
89
|
}
|
|
106
90
|
|
|
91
|
+
/** Directory the DSH skill loader scans for the generated skill. */
|
|
92
|
+
function skillDir() {
|
|
93
|
+
return join(homedir(), ".dsh", "skills", "kimi-webbridge");
|
|
94
|
+
}
|
|
95
|
+
|
|
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.
|
|
101
|
+
*/
|
|
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
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
107
124
|
/**
|
|
108
125
|
* One HTTP JSON round-trip with a timeout and caller-abort support.
|
|
109
126
|
* @param url - absolute URL.
|
|
@@ -300,33 +317,27 @@ function apply(ctx, config = {}) {
|
|
|
300
317
|
requestTimeoutMs = 120000,
|
|
301
318
|
autoStartDaemon = true,
|
|
302
319
|
autoInstallDaemon = true,
|
|
303
|
-
daemonVersion = "latest"
|
|
320
|
+
daemonVersion = "latest",
|
|
321
|
+
generateSkill = true
|
|
304
322
|
} = config;
|
|
305
323
|
|
|
324
|
+
if (generateSkill) void syncSkill();
|
|
325
|
+
|
|
306
326
|
ctx.systemPrompt.section({
|
|
307
327
|
name: "tool:kimi-webbridge",
|
|
308
328
|
order: 105,
|
|
309
|
-
text: "
|
|
329
|
+
text: "kimi-webbridge: the local kimi-webbridge daemon (127.0.0.1:10086) bridges to the user's real browser with their login sessions; this plugin provisions the daemon binary and keeps it running. The `kimi_webbridge` tool is only the status health check (daemon + extension). For any browser automation (navigation, reading pages, clicking, typing, filling forms, screenshots, JS evaluation, CDP, uploads, PDF export, tab management), load the kimi-webbridge skill and drive the daemon over HTTP exactly as that skill documents."
|
|
310
330
|
});
|
|
311
331
|
|
|
312
332
|
ctx.tools.register(defineTool({
|
|
313
333
|
name: "kimi_webbridge",
|
|
314
|
-
description: "
|
|
334
|
+
description: "Health check for the local kimi-webbridge bridge (daemon at " + baseUrl + " and the browser extension). The plugin auto-provisions the daemon: it installs the binary from the official Kimi CDN when missing and starts it, then retries once. Returns daemon version/uptime and extension_connected. This tool does NOT perform browser actions — for navigation, clicking, typing, reading pages, screenshots, JS evaluation, CDP, uploads, PDF export and tab management, load the kimi-webbridge skill, which documents the full 17-action HTTP protocol (POST " + baseUrl + "/command) to drive the user's real browser.",
|
|
315
335
|
parameters: {
|
|
316
336
|
action: {
|
|
317
337
|
type: "string",
|
|
318
338
|
required: true,
|
|
319
339
|
enum: ACTIONS,
|
|
320
|
-
description: "
|
|
321
|
-
},
|
|
322
|
-
session: {
|
|
323
|
-
type: "string",
|
|
324
|
-
description: "Task session name — one session per task, passed on every call so all tabs land in one group (e.g. \"camping-research\"). Defaults to \"default\"."
|
|
325
|
-
},
|
|
326
|
-
args: {
|
|
327
|
-
type: "object",
|
|
328
|
-
additionalProperties: true,
|
|
329
|
-
description: "Action-specific arguments (see the tool description for each action's fields)."
|
|
340
|
+
description: "The single supported action: status — check daemon and browser-extension health."
|
|
330
341
|
}
|
|
331
342
|
},
|
|
332
343
|
output: {
|
|
@@ -342,18 +353,7 @@ function apply(ctx, config = {}) {
|
|
|
342
353
|
return false;
|
|
343
354
|
},
|
|
344
355
|
async execute(args, exec) {
|
|
345
|
-
const
|
|
346
|
-
const session = args.session ?? "default";
|
|
347
|
-
const actionArgs = args.args ?? {};
|
|
348
|
-
const target = action === "status" ? `${baseUrl}/status` : `${baseUrl}/command`;
|
|
349
|
-
const attempt = () => action === "status"
|
|
350
|
-
? httpJson(target, { method: "GET", timeoutMs: requestTimeoutMs, signal: exec.signal })
|
|
351
|
-
: httpJson(target, {
|
|
352
|
-
method: "POST",
|
|
353
|
-
body: { action, args: actionArgs, session },
|
|
354
|
-
timeoutMs: requestTimeoutMs,
|
|
355
|
-
signal: exec.signal
|
|
356
|
-
});
|
|
356
|
+
const attempt = () => httpJson(`${baseUrl}/status`, { method: "GET", timeoutMs: requestTimeoutMs, signal: exec.signal });
|
|
357
357
|
let result;
|
|
358
358
|
try {
|
|
359
359
|
result = await attempt();
|
|
@@ -394,9 +394,9 @@ function apply(ctx, config = {}) {
|
|
|
394
394
|
presentCall(callArgs) {
|
|
395
395
|
return {
|
|
396
396
|
card: "generic",
|
|
397
|
-
title:
|
|
398
|
-
rawInput: JSON.stringify({
|
|
399
|
-
content: [{ type: "text", text:
|
|
397
|
+
title: "kimi_webbridge status",
|
|
398
|
+
rawInput: JSON.stringify({ action: callArgs.action ?? "status" }),
|
|
399
|
+
content: [{ type: "text", text: "checking daemon + extension health" }]
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
402
|
}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kimi-webbridge-dsh",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "1.4.
|
|
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",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [
|
|
@@ -31,14 +31,13 @@
|
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"lib/index.js",
|
|
34
|
+
"skill.md",
|
|
34
35
|
"README.md",
|
|
35
36
|
"cordis.patch.yml"
|
|
36
37
|
],
|
|
37
38
|
"peerDependencies": {
|
|
38
|
-
"@deepseek-ai/dsh-tools": "
|
|
39
|
-
"@deepseek-ai/dsh-llm": "
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
39
|
+
"@deepseek-ai/dsh-tools": "^0.1.0-rc.7 || ^0.1.1-rc.2",
|
|
40
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.7 || ^0.1.1-rc.2",
|
|
42
41
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
43
42
|
}
|
|
44
43
|
}
|
package/skill.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
# Kimi WebBridge
|
|
8
|
+
|
|
9
|
+
Control the user's real browser (their login sessions) through the local daemon at `http://127.0.0.1:10086`.
|
|
10
|
+
|
|
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.
|
|
12
|
+
|
|
13
|
+
## Health check first
|
|
14
|
+
|
|
15
|
+
Before driving the browser, call the **`kimi_webbridge` tool with action `status`**. It reports daemon + extension health and auto-provisions the daemon (downloads the binary from the official Kimi CDN when missing and starts it, then retries once). `extension_connected: true` means the browser extension is ready; if false, tell the user to install/connect the Kimi WebBridge extension.
|
|
16
|
+
|
|
17
|
+
## The 17 actions
|
|
18
|
+
|
|
19
|
+
Every action is one HTTP call: `POST http://127.0.0.1:10086/command` with body `{"action": "<name>", "args": {...}, "session": "<task-name>"}`.
|
|
20
|
+
|
|
21
|
+
| action | args | returns | notes |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| `navigate` | `url` (required), `newTab?`, `group_title?` | `{success, url, tabId}` | first call opens a tab |
|
|
24
|
+
| `find_tab` | `url` (required), `active?` | `{success, url, tabId, borrowed}` | re-select a session tab; `active:true` borrows the tab the user is viewing |
|
|
25
|
+
| `snapshot` | — | `{url, title, tree}` | accessibility tree with `@e` refs — read pages with this |
|
|
26
|
+
| `click` | `selector` (`@e` or CSS) | `{success, tag, text}` | synthetic `el.click()` |
|
|
27
|
+
| `mouse_click` | `selector` (`@e` or CSS) | `{success, x, y, tag, text}` | real mouse click at element center (CDP input) — trusted |
|
|
28
|
+
| `fill` | `selector`, `value` | `{success, tag, mode}` | inputs/textareas/contenteditable; clear-and-insert |
|
|
29
|
+
| `key_type` | `text` | `{success, length}` | types into the focused element (CDP input) — trusted |
|
|
30
|
+
| `send_keys` | `keys`, `repeat?` (1–100) | `{success, dispatched, os}` | named keys/shortcuts, e.g. "Enter", "Mod+A", "Enter Escape" |
|
|
31
|
+
| `evaluate` | `code` (async ok) | `{type, value}` | JS in the page realm |
|
|
32
|
+
| `cdp` | `method`, `params` | raw CDP response | chrome.debugger passthrough |
|
|
33
|
+
| `screenshot` | `format?` png/jpeg, `quality?`, `selector?`, `path?` | `{format, path, sizeBytes, mimeType}` | writes a file, returns the path |
|
|
34
|
+
| `network` | `cmd` start/stop/list/detail, `filter?`, `requestId?` | request/response data | |
|
|
35
|
+
| `upload` | `selector`, `files` (array of local paths) | `{success, fileCount}` | |
|
|
36
|
+
| `save_as_pdf` | `paper_format?` letter/a4/legal/a3/tabloid, `landscape?`, `scale?` 0.1–2.0, `print_background?`, `path?` | `{path, sizeBytes, mimeType, pageTitle}` | |
|
|
37
|
+
| `list_tabs` | — | `{success, tabs:[{tabId,url,title,active,groupTitle}]}` | |
|
|
38
|
+
| `close_tab` | — | `{success, closed}` | |
|
|
39
|
+
| `close_session` | — | `{success, closed}` | close all session tabs — only when the user asks |
|
|
40
|
+
|
|
41
|
+
## Sending requests (shell-proof)
|
|
42
|
+
|
|
43
|
+
On **Windows (PowerShell)**, inline JSON with non-ASCII text gets corrupted by the shell — **always** send the body via a temp file: write the JSON to a uniquely-named temp file with your file-write tool, then:
|
|
44
|
+
|
|
45
|
+
```powershell
|
|
46
|
+
curl.exe -s -X POST http://127.0.0.1:10086/command -H "Content-Type: application/json" --data-binary "@$env:TEMP\wb-<random>.json"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
then delete the temp file. Always `curl.exe`, never bare `curl` (PowerShell aliases it to Invoke-WebRequest).
|
|
50
|
+
|
|
51
|
+
On **macOS / Linux**, inline `-d '{...}'` is fine; if a call fails with a shell quoting error or HTTP 400, switch to the temp-file form above.
|
|
52
|
+
|
|
53
|
+
## Sessions
|
|
54
|
+
|
|
55
|
+
One task = one session = one tab group. Pick a task-named session (`camping-research`) and pass it on **every** call, never switching mid-task. `group_title` (in the user's language) on the first `navigate` labels the group. Example body:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{"action":"navigate","args":{"url":"https://example.com","newTab":true,"group_title":"Research"},"session":"research"}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Call `close_session` only when the user explicitly asks to close the tabs.
|
|
62
|
+
|
|
63
|
+
## Reading and interacting
|
|
64
|
+
|
|
65
|
+
- Prefer `snapshot` + `@e` refs over hand-written CSS selectors.
|
|
66
|
+
- `find_tab` searches only this session's tabs; pass the exact URL (a bare domain may miss www/subdomain variants). On "no tab matching", `navigate` with `newTab:true`. With `active:true` it borrows the user's currently-viewed tab and operates it in place.
|
|
67
|
+
- `evaluate`: wrap re-declarations in an IIFE; return compact `JSON.stringify` (never pretty-print).
|
|
68
|
+
- `fill` is clear-and-insert; to append, read the current value via `evaluate` first.
|
|
69
|
+
- Trusted input: on sites that reject synthetic events (`event.isTrusted` checks — banking portals, captchas), use `mouse_click` instead of `click` and `key_type`/`send_keys` instead of `fill`. If those still fail, tell the user the page needs manual interaction.
|
|
70
|
+
- `send_keys` keys: Enter/Return, Escape/Esc, Tab, Backspace, Delete, Space, ArrowUp/Down/Left/Right, Home/End, PageUp/PageDown, F1–F12, single letters/digits. Modifiers: Alt/Ctrl/Control/Cmd/Meta/Shift, or `Mod` (Cmd on Mac, Ctrl elsewhere). Join with `+` ("Mod+A", "Shift+Tab"); space-separate several ("Enter Escape").
|
|
71
|
+
- Cross-origin iframes are not covered — navigate to the iframe URL directly.
|
|
72
|
+
|
|
73
|
+
## Screenshots and PDF
|
|
74
|
+
|
|
75
|
+
`screenshot` and `save_as_pdf` write files and return a path — open it with your read tool. A caller-supplied `path` is honored verbatim (parent dirs created, existing files overwritten). PDF decoded cap is 100 MB; reduce `scale` to shrink.
|
|
76
|
+
|
|
77
|
+
## Daemon or extension problems
|
|
78
|
+
|
|
79
|
+
- Call the `kimi_webbridge` tool (`status`) — the plugin auto-provisions and starts the daemon. Never run `stop` / `restart` / `uninstall` yourself.
|
|
80
|
+
- If an error mentions "Please update the Kimi WebBridge extension", the extension is outdated — ask the user to update it (https://www.kimi.com/features/webbridge).
|
|
81
|
+
- If the daemon stays unreachable after the status tool's retry, point the user to the help page instead of deep-troubleshooting.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
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.
|