finch-web-assistant 1.0.1
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/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +424 -0
- package/dist/index.js.map +1 -0
- package/icon.png +0 -0
- package/package.json +76 -0
- package/skills/kimi-webbridge/SKILL.md +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kingArthur
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Web Assistant
|
|
2
|
+
|
|
3
|
+
Let Finch operate websites in your Chrome browser.
|
|
4
|
+
|
|
5
|
+
> This is a community mini tool, not an official Kimi product. Browser connectivity is provided by Kimi WebBridge. Kimi, Chrome, and related trademarks belong to their respective owners.
|
|
6
|
+
|
|
7
|
+
You can ask Finch to:
|
|
8
|
+
|
|
9
|
+
- "Open this website and find the registration link."
|
|
10
|
+
- "Fill in this form, but ask me before submitting."
|
|
11
|
+
- "Capture a screenshot of this webpage."
|
|
12
|
+
- "Save this page as a PDF."
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Install `finch-web-assistant` with Finch's mini tool manager after it is published to npm. Once approved for the community catalog, it can also be discovered and installed directly from Finch Toolcase.
|
|
17
|
+
|
|
18
|
+
## First-time connection
|
|
19
|
+
|
|
20
|
+
1. Install and enable **Web Assistant** in Finch.
|
|
21
|
+
2. Choose **Connect Chrome** in the onboarding prompt.
|
|
22
|
+
3. Confirm **Add extension** in the Chrome Web Store page that opens automatically.
|
|
23
|
+
|
|
24
|
+
Web Assistant completes the remaining setup automatically. Users do not need to open a terminal, copy commands, or understand the local service.
|
|
25
|
+
|
|
26
|
+
If you choose **Not Now**, use the Web Assistant button near the Composer at any time to:
|
|
27
|
+
|
|
28
|
+
- Check Connection
|
|
29
|
+
- Connect Chrome
|
|
30
|
+
- Open Help
|
|
31
|
+
|
|
32
|
+
## Connection states
|
|
33
|
+
|
|
34
|
+
- **Connected**: browser operations are ready.
|
|
35
|
+
- **Waiting**: confirm that the browser extension is installed and enabled.
|
|
36
|
+
- **Reconnect**: select the browser connection action to recover automatically.
|
|
37
|
+
- **Offline**: choose Connect Chrome to complete setup.
|
|
38
|
+
|
|
39
|
+
## Safety boundaries
|
|
40
|
+
|
|
41
|
+
- Web Assistant operates only tabs created for the current task by default.
|
|
42
|
+
- It uses the tab you are currently viewing or closes tabs only when you explicitly ask.
|
|
43
|
+
- Final actions with external impact—such as sending, publishing, paying, deleting, or submitting forms—still require your confirmation.
|
|
44
|
+
- CAPTCHAs, banking websites, and interactions with strict trusted-event checks may require manual input.
|
|
45
|
+
- Operations happen in your real Chrome browser and reuse its existing signed-in state, so page and tab changes remain visible.
|
|
46
|
+
|
|
47
|
+
## Technical details
|
|
48
|
+
|
|
49
|
+
Kimi WebBridge provides browser connectivity and runs only on the local machine:
|
|
50
|
+
|
|
51
|
+
- The local service is fixed at `http://127.0.0.1:10086` and is not exposed to the LAN.
|
|
52
|
+
- The local daemon and Chrome extension must use compatible versions.
|
|
53
|
+
- Web Assistant never runs `stop`, `restart`, `uninstall`, or forced upgrades automatically.
|
|
54
|
+
- When the connection fails, it safely attempts to start the service once. If recovery fails, it provides the official help page.
|
|
55
|
+
- Official installation sources:
|
|
56
|
+
- Windows: `https://cdn.kimi.com/webbridge/install.ps1`
|
|
57
|
+
- macOS / Linux: `https://cdn.kimi.com/webbridge/install.sh`
|
|
58
|
+
- Help: <https://www.kimi.com/zh-cn/features/webbridge>
|
|
59
|
+
|
|
60
|
+
The internal `kimi-webbridge` ID, Composer action ID, and `kimi_webbridge_*` Agent tool names remain unchanged for compatibility. The npm package name is `finch-web-assistant`.
|
|
61
|
+
|
|
62
|
+
## Privacy and permissions
|
|
63
|
+
|
|
64
|
+
- No API key is required, and Web Assistant does not store website credentials.
|
|
65
|
+
- `network` accesses the local WebBridge service and official Kimi installation sources.
|
|
66
|
+
- `shell` installs or starts the local component and opens browser help or extension pages.
|
|
67
|
+
- Browser operations reuse the existing browser session. Verify the page and target account before sensitive actions.
|
|
68
|
+
|
|
69
|
+
## Development
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install
|
|
73
|
+
npm run check
|
|
74
|
+
npm run build
|
|
75
|
+
npx @finchtoys/minitools doctor .
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Internal capabilities
|
|
79
|
+
|
|
80
|
+
Web Assistant provides atomic tools for connection recovery, navigation, tab selection, page reading, clicking, filling, JavaScript, CDP, screenshots, network inspection, file uploads, PDF export, and tab management. Users do not need to select these tools manually; Finch chooses them from natural-language requests.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
// @ts-nocheck — recovered from the verified 0.3.0 runtime bundle after local source loss.
|
|
2
|
+
import { execFile } from 'node:child_process';
|
|
3
|
+
import { homedir, platform } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
const BASE_URL = 'http://127.0.0.1:10086';
|
|
8
|
+
const HELP_URL = 'https://www.kimi.com/zh-cn/features/webbridge';
|
|
9
|
+
const CHROME_STORE_URL = 'https://chromewebstore.google.com/detail/kimi-webbridge/fldmhceldgbpfpkbgopacenieobmligc';
|
|
10
|
+
const ONBOARDING_KEY = 'onboardingPrompted.0.2';
|
|
11
|
+
const BINARY = platform() === 'win32'
|
|
12
|
+
? join(homedir(), '.kimi-webbridge', 'bin', 'kimi-webbridge.exe')
|
|
13
|
+
: join(homedir(), '.kimi-webbridge', 'bin', 'kimi-webbridge');
|
|
14
|
+
function result(value, isError = false) {
|
|
15
|
+
const text = typeof value === 'string' ? value : JSON.stringify(value);
|
|
16
|
+
return { content: [{ type: 'text', text }], isError };
|
|
17
|
+
}
|
|
18
|
+
function errorMessage(error) {
|
|
19
|
+
return error instanceof Error ? error.message : String(error);
|
|
20
|
+
}
|
|
21
|
+
async function requestJson(path, init, signal) {
|
|
22
|
+
const timeout = AbortSignal.timeout(30_000);
|
|
23
|
+
const combined = signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
24
|
+
const response = await fetch(`${BASE_URL}${path}`, { ...init, signal: combined });
|
|
25
|
+
const text = await response.text();
|
|
26
|
+
let body = text;
|
|
27
|
+
try {
|
|
28
|
+
body = text ? JSON.parse(text) : {};
|
|
29
|
+
}
|
|
30
|
+
catch { /* keep text */ }
|
|
31
|
+
if (!response.ok)
|
|
32
|
+
throw new Error(`Web Assistant connection failed (HTTP ${response.status}): ${text}`);
|
|
33
|
+
return body;
|
|
34
|
+
}
|
|
35
|
+
async function getStatus(signal) {
|
|
36
|
+
return await requestJson('/status', undefined, signal);
|
|
37
|
+
}
|
|
38
|
+
async function runBinary(args) {
|
|
39
|
+
const { stdout, stderr } = await execFileAsync(BINARY, args, {
|
|
40
|
+
timeout: 60_000,
|
|
41
|
+
maxBuffer: 2 * 1024 * 1024,
|
|
42
|
+
});
|
|
43
|
+
return [stdout, stderr].filter(Boolean).join('\n').trim();
|
|
44
|
+
}
|
|
45
|
+
async function startDaemon() {
|
|
46
|
+
await runBinary(['start']);
|
|
47
|
+
}
|
|
48
|
+
async function callBridge(action, input, exec) {
|
|
49
|
+
const session = typeof input.session === 'string' && input.session.trim()
|
|
50
|
+
? input.session.trim()
|
|
51
|
+
: `finch-${exec.sessionId.slice(0, 12)}`;
|
|
52
|
+
const args = { ...input };
|
|
53
|
+
delete args.session;
|
|
54
|
+
if (action === 'upload' && (!Array.isArray(args.files) || args.files.length === 0)) {
|
|
55
|
+
return result({ error: 'files must contain at least one local file path.' }, true);
|
|
56
|
+
}
|
|
57
|
+
const post = () => requestJson('/command', {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: { 'Content-Type': 'application/json' },
|
|
60
|
+
body: JSON.stringify({ action, args, session }),
|
|
61
|
+
}, exec.signal);
|
|
62
|
+
try {
|
|
63
|
+
return result(await post());
|
|
64
|
+
}
|
|
65
|
+
catch (firstError) {
|
|
66
|
+
const message = errorMessage(firstError);
|
|
67
|
+
const unreachable = /fetch failed|ECONNREFUSED|connection refused|Could not connect/i.test(message);
|
|
68
|
+
if (!unreachable)
|
|
69
|
+
return result({ error: message, help: HELP_URL }, true);
|
|
70
|
+
try {
|
|
71
|
+
await startDaemon();
|
|
72
|
+
return result(await post());
|
|
73
|
+
}
|
|
74
|
+
catch (retryError) {
|
|
75
|
+
return result({
|
|
76
|
+
error: errorMessage(retryError),
|
|
77
|
+
recovery: 'The local connection recovery attempt failed. Make sure the browser extension is installed and enabled.',
|
|
78
|
+
help: HELP_URL,
|
|
79
|
+
}, true);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const sessionProperty = {
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: 'A short English session name reused throughout this browser task. Do not switch sessions mid-task.',
|
|
86
|
+
minLength: 1,
|
|
87
|
+
};
|
|
88
|
+
function commandTool(ctx, name, title, description, action, properties, required = [], risk = 'high') {
|
|
89
|
+
return ctx.tools.register({
|
|
90
|
+
name,
|
|
91
|
+
title,
|
|
92
|
+
description,
|
|
93
|
+
defaultEnabled: true,
|
|
94
|
+
risk,
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: { session: sessionProperty, ...properties },
|
|
98
|
+
required: ['session', ...required],
|
|
99
|
+
additionalProperties: false,
|
|
100
|
+
},
|
|
101
|
+
callDisplay: { inline: { mode: 'join', fields: [
|
|
102
|
+
{ path: 'session', label: 'session', format: 'truncate', maxLength: 24 },
|
|
103
|
+
{ path: 'url', format: 'truncate', maxLength: 60 },
|
|
104
|
+
{ path: 'selector', format: 'truncate', maxLength: 36 },
|
|
105
|
+
] } },
|
|
106
|
+
async execute(input, exec) { return await callBridge(action, input, exec); },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async function installBridge() {
|
|
110
|
+
if (platform() === 'win32') {
|
|
111
|
+
const script = 'irm https://cdn.kimi.com/webbridge/install.ps1 | iex';
|
|
112
|
+
const { stdout, stderr } = await execFileAsync('powershell.exe', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', script], {
|
|
113
|
+
timeout: 180_000,
|
|
114
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
115
|
+
});
|
|
116
|
+
return [stdout, stderr].filter(Boolean).join('\n').trim();
|
|
117
|
+
}
|
|
118
|
+
const script = 'curl -fsSL https://cdn.kimi.com/webbridge/install.sh | bash';
|
|
119
|
+
const { stdout, stderr } = await execFileAsync('/bin/bash', ['-lc', script], {
|
|
120
|
+
timeout: 180_000,
|
|
121
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
122
|
+
});
|
|
123
|
+
return [stdout, stderr].filter(Boolean).join('\n').trim();
|
|
124
|
+
}
|
|
125
|
+
async function openUrl(url, useChrome = false) {
|
|
126
|
+
if (platform() === 'win32') {
|
|
127
|
+
await execFileAsync('powershell.exe', ['-NoProfile', '-Command', 'Start-Process', url], { timeout: 30_000 });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (platform() === 'darwin') {
|
|
131
|
+
const args = useChrome ? ['-a', 'Google Chrome', url] : [url];
|
|
132
|
+
try {
|
|
133
|
+
await execFileAsync('/usr/bin/open', args, { timeout: 30_000 });
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
await execFileAsync('/usr/bin/open', [url], { timeout: 30_000 });
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
await execFileAsync('xdg-open', [url], { timeout: 30_000 });
|
|
141
|
+
}
|
|
142
|
+
async function openExtensionStore() {
|
|
143
|
+
await openUrl(CHROME_STORE_URL, true);
|
|
144
|
+
}
|
|
145
|
+
async function ensureDaemon() {
|
|
146
|
+
try {
|
|
147
|
+
const status = await getStatus();
|
|
148
|
+
return { installed: false, status };
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
try {
|
|
152
|
+
await startDaemon();
|
|
153
|
+
return { installed: false, status: await getStatus() };
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
const output = await installBridge();
|
|
157
|
+
return { installed: true, output, status: await getStatus() };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async function waitForExtension(timeoutMs = 120_000) {
|
|
162
|
+
const deadline = Date.now() + timeoutMs;
|
|
163
|
+
let last = {};
|
|
164
|
+
while (Date.now() < deadline) {
|
|
165
|
+
try {
|
|
166
|
+
last = await getStatus();
|
|
167
|
+
if (last.running && last.extension_connected)
|
|
168
|
+
return last;
|
|
169
|
+
}
|
|
170
|
+
catch { /* keep waiting */ }
|
|
171
|
+
await new Promise(resolve => setTimeout(resolve, 3_000));
|
|
172
|
+
}
|
|
173
|
+
return last;
|
|
174
|
+
}
|
|
175
|
+
async function setupBridge() {
|
|
176
|
+
const daemon = await ensureDaemon();
|
|
177
|
+
if (daemon.status.running && daemon.status.extension_connected) {
|
|
178
|
+
return { ...daemon, storeOpened: false };
|
|
179
|
+
}
|
|
180
|
+
await openExtensionStore();
|
|
181
|
+
const status = await waitForExtension();
|
|
182
|
+
return { ...daemon, status, storeOpened: true };
|
|
183
|
+
}
|
|
184
|
+
export function activate(ctx) {
|
|
185
|
+
const tools = [];
|
|
186
|
+
tools.push(ctx.tools.register({
|
|
187
|
+
name: 'kimi_webbridge_check_status',
|
|
188
|
+
title: 'Check Web Assistant',
|
|
189
|
+
description: 'Check Web Assistant, the local connection, and the browser extension. Use after initial setup or when browser operations fail. Read-only.',
|
|
190
|
+
defaultEnabled: true,
|
|
191
|
+
risk: 'low',
|
|
192
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
193
|
+
async execute(_input, exec) {
|
|
194
|
+
try {
|
|
195
|
+
const status = await getStatus(exec.signal);
|
|
196
|
+
return result({ ...status, ready: status.running === true && status.extension_connected === true, help: HELP_URL });
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
return result({ running: false, extension_connected: false, error: errorMessage(error), help: HELP_URL }, true);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
}));
|
|
203
|
+
tools.push(ctx.tools.register({
|
|
204
|
+
name: 'kimi_webbridge_start_daemon',
|
|
205
|
+
title: 'Recover Web Assistant Connection',
|
|
206
|
+
description: 'Safely attempt to recover Web Assistant only when the local connection fails, then check status. Never use this tool to restart or stop the service.',
|
|
207
|
+
defaultEnabled: true,
|
|
208
|
+
risk: 'high',
|
|
209
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
210
|
+
async execute() {
|
|
211
|
+
try {
|
|
212
|
+
await startDaemon();
|
|
213
|
+
return result(await getStatus());
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
return result({ error: errorMessage(error), help: HELP_URL }, true);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
}));
|
|
220
|
+
tools.push(ctx.tools.register({
|
|
221
|
+
name: 'kimi_webbridge_install_bridge',
|
|
222
|
+
title: 'Connect Web Assistant',
|
|
223
|
+
description: 'When the user explicitly asks to connect Web Assistant, check and configure the local component, open the Chrome Web Store, and wait for the connection. The user only needs to confirm extension installation. Downloads and executes code from official Kimi sources.',
|
|
224
|
+
defaultEnabled: true,
|
|
225
|
+
risk: 'high',
|
|
226
|
+
inputSchema: { type: 'object', properties: {}, additionalProperties: false },
|
|
227
|
+
async execute() {
|
|
228
|
+
try {
|
|
229
|
+
const setup = await setupBridge();
|
|
230
|
+
const ready = setup.status.running === true && setup.status.extension_connected === true;
|
|
231
|
+
return result({
|
|
232
|
+
installed: setup.installed,
|
|
233
|
+
store_opened: setup.storeOpened,
|
|
234
|
+
ready,
|
|
235
|
+
status: setup.status,
|
|
236
|
+
output: setup.output?.slice(-4000),
|
|
237
|
+
next_step: ready ? 'Web Assistant is connected and ready for browser operations.' : 'The browser store is open. Click Add extension, and Web Assistant will finish connecting automatically.',
|
|
238
|
+
help: HELP_URL,
|
|
239
|
+
}, !setup.status.running);
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
return result({ installed: false, ready: false, error: errorMessage(error), help: HELP_URL }, true);
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
}));
|
|
246
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_navigate', 'Open Website', 'Navigate in the real Chrome browser. On the first call for a task, use newTab:true and provide a localized group_title. Reuse the same session throughout the task.', 'navigate', {
|
|
247
|
+
url: { type: 'string', description: 'A complete http or https URL.', minLength: 1 },
|
|
248
|
+
newTab: { type: 'boolean', description: 'Whether to open a new tab. Usually true for the first page in a task.' },
|
|
249
|
+
group_title: { type: 'string', description: 'A user-facing tab group title for the task.' },
|
|
250
|
+
}, ['url']));
|
|
251
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_find_tab', 'Select Browser Tab', 'Select a tab opened by this session. Set active:true only when the user explicitly asks to use the tab they are currently viewing.', 'find_tab', {
|
|
252
|
+
url: { type: 'string', description: 'Prefer a complete URL returned by list_tabs.' },
|
|
253
|
+
active: { type: 'boolean', description: 'When true, use the tab the user is currently viewing. Requires explicit user authorization.' },
|
|
254
|
+
}, ['url']));
|
|
255
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_snapshot_page', 'Read Page Structure', 'Read the current page accessibility tree and return @e element references. Prefer this tool for page reading and interaction targeting.', 'snapshot', {}, [], 'low'));
|
|
256
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_click_element', 'Click Page Element', 'Click an element on the current page. Prefer an @e reference returned by snapshot. This performs a synthetic DOM click.', 'click', {
|
|
257
|
+
selector: { type: 'string', description: 'An @e reference from snapshot or a CSS selector.' },
|
|
258
|
+
}, ['selector']));
|
|
259
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_fill_element', 'Fill Page Element', 'Clear and replace the content of an input, textarea, or contenteditable element, then dispatch input events.', 'fill', {
|
|
260
|
+
selector: { type: 'string', description: 'An @e reference from snapshot or a CSS selector.' },
|
|
261
|
+
value: { type: 'string', description: 'The complete replacement value.' },
|
|
262
|
+
}, ['selector', 'value']));
|
|
263
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_evaluate_script', 'Run Page JavaScript', 'Run JavaScript on the current page only when snapshot and @e references are insufficient. Use an IIFE and return compact data.', 'evaluate', {
|
|
264
|
+
code: { type: 'string', description: 'JavaScript with async/await support. Prefer an IIFE.' },
|
|
265
|
+
}, ['code']));
|
|
266
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_call_cdp', 'Call Chrome CDP', 'Low-level Chrome DevTools Protocol escape hatch. Use only when standard tools and evaluate cannot complete the task.', 'cdp', {
|
|
267
|
+
method: { type: 'string', description: 'A CDP method such as Page.captureScreenshot.' },
|
|
268
|
+
params: { type: 'object', description: 'CDP parameters.' },
|
|
269
|
+
}, ['method']));
|
|
270
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_capture_screenshot', 'Capture Webpage Screenshot', 'Capture the visible page or a selected element and return a local file path. Use Read to inspect the image afterward.', 'screenshot', {
|
|
271
|
+
format: { type: 'string', enum: ['png', 'jpeg'] },
|
|
272
|
+
quality: { type: 'integer', minimum: 0, maximum: 100 },
|
|
273
|
+
selector: { type: 'string', description: 'Optional @e reference or CSS selector for an element-only capture.' },
|
|
274
|
+
path: { type: 'string', description: 'Optional unique output path. Existing files are overwritten.' },
|
|
275
|
+
}));
|
|
276
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_inspect_network', 'Inspect Page Network', 'Start, stop, list, or inspect network requests for the current page.', 'network', {
|
|
277
|
+
cmd: { type: 'string', enum: ['start', 'stop', 'list', 'detail'] },
|
|
278
|
+
filter: { type: 'string', description: 'Optional request filter.' },
|
|
279
|
+
requestId: { type: 'string', description: 'Request ID used with the detail command.' },
|
|
280
|
+
}, ['cmd'], 'low'));
|
|
281
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_upload_files', 'Upload Files to Page', 'Set local files on a file input in the current page. The files must be local paths the user has authorized.', 'upload', {
|
|
282
|
+
selector: { type: 'string', description: 'An @e reference or CSS selector for the file input.' },
|
|
283
|
+
files: { type: 'array', items: { type: 'string' }, description: 'At least one absolute local file path.' },
|
|
284
|
+
}, ['selector', 'files']));
|
|
285
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_save_page_pdf', 'Save Page as PDF', 'Print the current page to PDF and return the local file path.', 'save_as_pdf', {
|
|
286
|
+
paper_format: { type: 'string', enum: ['letter', 'a4', 'legal', 'a3', 'tabloid'] },
|
|
287
|
+
landscape: { type: 'boolean' },
|
|
288
|
+
scale: { type: 'number', minimum: 0.1, maximum: 2 },
|
|
289
|
+
print_background: { type: 'boolean' },
|
|
290
|
+
path: { type: 'string', description: 'Optional unique output path. Existing files are overwritten.' },
|
|
291
|
+
}));
|
|
292
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_list_session_tabs', 'List Task Tabs', 'List the tabs managed by this session, including URLs, titles, and active state.', 'list_tabs', {}, [], 'low'));
|
|
293
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_close_current_tab', 'Close Current Task Tab', 'Close the current tab for this session only when the user explicitly asks.', 'close_tab', {}));
|
|
294
|
+
tools.push(commandTool(ctx, 'kimi_webbridge_close_task_session', 'Close Task Tab Group', 'Close all tabs created by this session only when the user explicitly asks to close or clean up the task pages.', 'close_session', {}));
|
|
295
|
+
ctx.subscriptions.push(...tools);
|
|
296
|
+
let lastBadge = '';
|
|
297
|
+
const statusAction = ctx.composerActions.register('kimi-webbridge-status', {
|
|
298
|
+
async getBadge() {
|
|
299
|
+
try {
|
|
300
|
+
const status = await getStatus();
|
|
301
|
+
if (status.running && status.extension_connected)
|
|
302
|
+
return { text: 'Connected', active: true };
|
|
303
|
+
if (status.running)
|
|
304
|
+
return 'Waiting';
|
|
305
|
+
return 'Reconnect';
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
return 'Offline';
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
async getIcon() {
|
|
312
|
+
try {
|
|
313
|
+
const status = await getStatus();
|
|
314
|
+
return status.running && status.extension_connected ? 'globe' : 'puzzle';
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
return 'puzzle';
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
async getMenu() {
|
|
321
|
+
let description = 'Browser not connected';
|
|
322
|
+
try {
|
|
323
|
+
const status = await getStatus();
|
|
324
|
+
description = status.running
|
|
325
|
+
? (status.extension_connected ? 'Browser connected' : 'Waiting for browser connection')
|
|
326
|
+
: 'Connection recovery required';
|
|
327
|
+
}
|
|
328
|
+
catch { /* default */ }
|
|
329
|
+
return [
|
|
330
|
+
{ id: 'check', label: 'Check Connection', description, iconName: 'check' },
|
|
331
|
+
{ id: 'setup-chrome', label: 'Connect Chrome', description: 'Automatic setup; you only confirm extension installation', iconName: 'zap' },
|
|
332
|
+
{ id: 'help', label: 'Help', description: 'Open the official Web Assistant help page', iconName: 'puzzle' },
|
|
333
|
+
];
|
|
334
|
+
},
|
|
335
|
+
async execute(_actionCtx, itemId) {
|
|
336
|
+
if (itemId === 'check') {
|
|
337
|
+
try {
|
|
338
|
+
const status = await getStatus();
|
|
339
|
+
await ctx.ui.showToast({
|
|
340
|
+
title: status.running && status.extension_connected ? 'Browser Connected' : 'Browser Not Connected',
|
|
341
|
+
description: status.extension_connected ? 'Web Assistant is ready to use' : 'Choose a browser and confirm extension installation',
|
|
342
|
+
variant: status.running && status.extension_connected ? 'success' : 'warning',
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
await ctx.ui.showToast({ title: 'Chrome Not Connected', description: 'Choose Connect Chrome and confirm extension installation', variant: 'warning' });
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (itemId === 'setup-chrome') {
|
|
350
|
+
await ctx.ui.showToast({ title: 'Connecting Browser', description: 'Web Assistant is completing the setup. Please wait.', variant: 'info' });
|
|
351
|
+
try {
|
|
352
|
+
const setup = await setupBridge();
|
|
353
|
+
const ready = setup.status.running && setup.status.extension_connected;
|
|
354
|
+
await ctx.ui.showToast({
|
|
355
|
+
title: ready ? 'Browser Connected' : 'Confirm Extension Installation',
|
|
356
|
+
description: ready ? 'Finch can now operate websites in your browser' : 'Web Assistant will connect automatically after you confirm installation',
|
|
357
|
+
variant: ready ? 'success' : 'info',
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
catch (error) {
|
|
361
|
+
await ctx.ui.showToast({ title: 'Automatic Setup Incomplete', description: errorMessage(error), variant: 'error' });
|
|
362
|
+
}
|
|
363
|
+
statusAction.notifyUpdate();
|
|
364
|
+
}
|
|
365
|
+
if (itemId === 'help')
|
|
366
|
+
await openUrl(HELP_URL);
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
ctx.subscriptions.push(statusAction);
|
|
370
|
+
const timer = setInterval(async () => {
|
|
371
|
+
let badge = 'offline';
|
|
372
|
+
try {
|
|
373
|
+
const status = await getStatus();
|
|
374
|
+
badge = `${status.running}:${status.extension_connected}:${status.version}`;
|
|
375
|
+
}
|
|
376
|
+
catch { /* offline */ }
|
|
377
|
+
if (badge !== lastBadge) {
|
|
378
|
+
lastBadge = badge;
|
|
379
|
+
statusAction.notifyUpdate();
|
|
380
|
+
}
|
|
381
|
+
}, 10_000);
|
|
382
|
+
ctx.subscriptions.push({ dispose: () => clearInterval(timer) });
|
|
383
|
+
const onboardingTimer = setTimeout(async () => {
|
|
384
|
+
try {
|
|
385
|
+
const status = await getStatus();
|
|
386
|
+
if (status.running && status.extension_connected)
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
catch { /* continue to onboarding */ }
|
|
390
|
+
if (await ctx.storage.get(ONBOARDING_KEY))
|
|
391
|
+
return;
|
|
392
|
+
await ctx.storage.set(ONBOARDING_KEY, true);
|
|
393
|
+
const choice = await ctx.ui.showModalDialog({
|
|
394
|
+
title: 'Connect Your Browser',
|
|
395
|
+
description: 'Once connected, Finch can operate websites on your behalf',
|
|
396
|
+
message: 'Web Assistant will configure Chrome automatically.\n\nYou only need to confirm extension installation in the browser.',
|
|
397
|
+
actions: [
|
|
398
|
+
{ id: 'chrome', label: 'Connect Chrome', variant: 'primary' },
|
|
399
|
+
{ id: 'later', label: 'Not Now', variant: 'secondary' },
|
|
400
|
+
],
|
|
401
|
+
});
|
|
402
|
+
if (choice.action !== 'chrome')
|
|
403
|
+
return;
|
|
404
|
+
await ctx.ui.showToast({ title: 'Connecting Browser', description: 'Web Assistant is completing the setup. Please wait.', variant: 'info' });
|
|
405
|
+
try {
|
|
406
|
+
const setup = await setupBridge();
|
|
407
|
+
const ready = setup.status.running && setup.status.extension_connected;
|
|
408
|
+
await ctx.ui.showToast({
|
|
409
|
+
title: ready ? 'Browser Connected' : 'Confirm Extension Installation',
|
|
410
|
+
description: ready ? 'Finch can now operate websites in your browser' : 'Web Assistant will connect automatically after you confirm installation',
|
|
411
|
+
variant: ready ? 'success' : 'info',
|
|
412
|
+
});
|
|
413
|
+
statusAction.notifyUpdate();
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
await ctx.ui.showToast({ title: 'Automatic Setup Incomplete', description: errorMessage(error), variant: 'error' });
|
|
417
|
+
}
|
|
418
|
+
}, 1_500);
|
|
419
|
+
ctx.subscriptions.push({ dispose: () => clearTimeout(onboardingTimer) });
|
|
420
|
+
ctx.logger.info('Finch Web Assistant mini tool activated');
|
|
421
|
+
}
|
|
422
|
+
export function deactivate() { }
|
|
423
|
+
//# sourceMappingURL=index.js.map
|
|
424
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAC1C,MAAM,QAAQ,GAAG,+CAA+C,CAAC;AACjE,MAAM,gBAAgB,GAAG,0FAA0F,CAAC;AACpH,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAChD,MAAM,MAAM,GAAG,QAAQ,EAAE,KAAK,OAAO;IACjC,CAAC,CAAC,IAAI,CAAC,OAA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AU,KAAK,CAAC;AAChC,iCAAiC"}
|
package/icon.png
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "finch-web-assistant",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Let Finch operate websites in your Chrome browser.",
|
|
5
|
+
"author": "Arthur",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/BlessedChild/finch-web-assistant.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/BlessedChild/finch-web-assistant#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/BlessedChild/finch-web-assistant/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"finch",
|
|
17
|
+
"finch-mini-tool",
|
|
18
|
+
"kimi",
|
|
19
|
+
"webbridge",
|
|
20
|
+
"browser-automation",
|
|
21
|
+
"chrome"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "dist/index.js",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"skills",
|
|
31
|
+
"icon.png",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.json",
|
|
37
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
38
|
+
"doctor": "npx @finchtoys/minitools doctor .",
|
|
39
|
+
"prepublishOnly": "npm run check && npm run build && npm run doctor"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@finchtoys/minitool-api": "latest",
|
|
43
|
+
"@types/node": "^22.0.0",
|
|
44
|
+
"typescript": "^5.8.0"
|
|
45
|
+
},
|
|
46
|
+
"finch": {
|
|
47
|
+
"manifestVersion": 1,
|
|
48
|
+
"id": "kimi-webbridge",
|
|
49
|
+
"name": "Web Assistant",
|
|
50
|
+
"description": "Let Finch open websites, click, fill forms, capture screenshots, and save content in Chrome. Connect your browser once to get started.",
|
|
51
|
+
"miniToolType": "community",
|
|
52
|
+
"categories": [
|
|
53
|
+
"productivity"
|
|
54
|
+
],
|
|
55
|
+
"main": "dist/index.js",
|
|
56
|
+
"activationEvents": [
|
|
57
|
+
"onStartup"
|
|
58
|
+
],
|
|
59
|
+
"contributes": {
|
|
60
|
+
"tools": true,
|
|
61
|
+
"skills": true,
|
|
62
|
+
"composerActions": [
|
|
63
|
+
{
|
|
64
|
+
"id": "kimi-webbridge-status",
|
|
65
|
+
"icon": "globe",
|
|
66
|
+
"tooltip": "Web Assistant"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"permissions": {
|
|
71
|
+
"filesystem": "none",
|
|
72
|
+
"network": true,
|
|
73
|
+
"shell": true
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kimi-webbridge
|
|
3
|
+
description: Use the user's real Chrome session for website navigation, clicking, filling, reading, screenshots, PDF downloads, and browser automation. Trigger when the user mentions a browser, website, URL, signed-in page, or web automation.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.11.3-finch.6"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Web Assistant
|
|
9
|
+
|
|
10
|
+
Use the user's real Chrome session to operate websites. Internally, Kimi WebBridge connects the `kimi_webbridge_*` tools to the local service at `127.0.0.1:10086`; ordinary users do not need these implementation details.
|
|
11
|
+
|
|
12
|
+
## Required rules
|
|
13
|
+
|
|
14
|
+
- Choose one short English `session` name per task and reuse it for every call, even when the website changes.
|
|
15
|
+
- On the first `navigate` call, use `newTab:true` and provide a `group_title` in the user's language. Tell the user the pages are grouped and can be closed on request.
|
|
16
|
+
- Operate only tabs created by the current session by default. Use `find_tab(active:true)` only when the user explicitly asks to use the page they are currently viewing.
|
|
17
|
+
- Call `snapshot` first. Prefer stable `@e` references for `click` and `fill`; use `evaluate` only when references are insufficient, and use `cdp` only as a final escape hatch.
|
|
18
|
+
- Wrap `evaluate` code in an IIFE and return compact JSON. Do not use `JSON.stringify(data, null, 2)`.
|
|
19
|
+
- `fill` clears and replaces the current value. Submit forms by clicking the submit button; do not assume an Enter-key tool exists.
|
|
20
|
+
- Screenshot tools return a local file path. Use Finch Read to inspect the image afterward.
|
|
21
|
+
- Close tabs or sessions only when the user explicitly asks. Never automatically stop, restart, uninstall, or upgrade the daemon.
|
|
22
|
+
- If the connection fails, the browser tool attempts one idempotent start and retry. If recovery still fails, open or provide https://www.kimi.com/zh-cn/features/webbridge.
|
|
23
|
+
- If the page reports "Please update the Kimi WebBridge extension," ask the user to update it. Do not coordinate versions automatically.
|
|
24
|
+
- Obtain user confirmation before the final click for actions with external impact, including sending, publishing, paying, or deleting.
|
|
25
|
+
|
|
26
|
+
## Known limitations
|
|
27
|
+
|
|
28
|
+
- CAPTCHAs, banking websites, and interactions that strictly check `event.isTrusted` may require manual input.
|
|
29
|
+
- Tools operate on the top-level frame by default. Navigate directly to a cross-origin iframe URL when necessary.
|
|
30
|
+
- WebBridge uses the real browser rather than a headless environment, so tab and page changes are visible to the user.
|