@kernel.chat/kbot 3.85.0 → 3.87.0
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/dist/tools/index.js
CHANGED
|
@@ -317,6 +317,8 @@ const LAZY_MODULE_IMPORTS = [
|
|
|
317
317
|
{ path: './streaming.js', registerFn: 'registerStreamingTools' },
|
|
318
318
|
{ path: './stream-character.js', registerFn: 'registerStreamCharacterTools' },
|
|
319
319
|
{ path: './stream-renderer.js', registerFn: 'registerStreamRendererTools' },
|
|
320
|
+
{ path: './kbot-browser.js', registerFn: 'registerKBotBrowserTools' },
|
|
321
|
+
{ path: './kbot-terminal.js', registerFn: 'registerKBotTerminalTools' },
|
|
320
322
|
];
|
|
321
323
|
/** Track whether lazy tools have been registered */
|
|
322
324
|
let lazyToolsRegistered = false;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export interface KBotBrowser {
|
|
2
|
+
tabs: BrowserTab[];
|
|
3
|
+
activeTab: number;
|
|
4
|
+
history: string[];
|
|
5
|
+
bookmarks: string[];
|
|
6
|
+
cookies: Map<string, string>;
|
|
7
|
+
userAgent: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BrowserTab {
|
|
10
|
+
url: string;
|
|
11
|
+
title: string;
|
|
12
|
+
content: string;
|
|
13
|
+
links: PageLink[];
|
|
14
|
+
forms: PageForm[];
|
|
15
|
+
status: 'loading' | 'loaded' | 'error';
|
|
16
|
+
html: string;
|
|
17
|
+
screenshot: string[];
|
|
18
|
+
scrollY: number;
|
|
19
|
+
loadedAt: number;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface PageLink {
|
|
23
|
+
text: string;
|
|
24
|
+
url: string;
|
|
25
|
+
index: number;
|
|
26
|
+
}
|
|
27
|
+
export interface PageForm {
|
|
28
|
+
action: string;
|
|
29
|
+
method: string;
|
|
30
|
+
fields: Array<{
|
|
31
|
+
name: string;
|
|
32
|
+
type: string;
|
|
33
|
+
value: string;
|
|
34
|
+
placeholder: string;
|
|
35
|
+
}>;
|
|
36
|
+
index: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function getBrowser(): KBotBrowser;
|
|
39
|
+
/** Reset browser state (for testing or cleanup) */
|
|
40
|
+
export declare function resetBrowser(): void;
|
|
41
|
+
/** Extract readable content from HTML (reader mode) */
|
|
42
|
+
export declare function extractReadableContent(html: string): string;
|
|
43
|
+
export declare function renderPageToAscii(tab: BrowserTab, width?: number, height?: number): string[];
|
|
44
|
+
/** Navigate the active tab (or create one) to a URL */
|
|
45
|
+
export declare function navigateTo(browser: KBotBrowser, url: string): Promise<BrowserTab>;
|
|
46
|
+
/** Click a link by index on the current page */
|
|
47
|
+
export declare function clickLink(browser: KBotBrowser, linkIndex: number): Promise<BrowserTab>;
|
|
48
|
+
/** Fill and submit a form by index */
|
|
49
|
+
export declare function fillForm(browser: KBotBrowser, formIndex: number, values: Record<string, string>): Promise<BrowserTab>;
|
|
50
|
+
/** Search the web via DuckDuckGo HTML (no JS needed) */
|
|
51
|
+
export declare function search(browser: KBotBrowser, query: string): Promise<BrowserTab>;
|
|
52
|
+
/** Scroll the current page */
|
|
53
|
+
export declare function scroll(browser: KBotBrowser, direction: 'up' | 'down'): BrowserTab | null;
|
|
54
|
+
/** Go back in history */
|
|
55
|
+
export declare function goBack(browser: KBotBrowser): Promise<BrowserTab | null>;
|
|
56
|
+
/** Open a new tab */
|
|
57
|
+
export declare function newTab(browser: KBotBrowser, url?: string): void;
|
|
58
|
+
/** Close a tab */
|
|
59
|
+
export declare function closeTab(browser: KBotBrowser, tabIndex: number): void;
|
|
60
|
+
/** Switch to a tab */
|
|
61
|
+
export declare function switchTab(browser: KBotBrowser, tabIndex: number): void;
|
|
62
|
+
/** Draw a browser panel on a canvas (for stream overlay) */
|
|
63
|
+
export declare function drawBrowserPanel(ctx: CanvasRenderingContext2D, browser: KBotBrowser, x: number, y: number, width: number, height: number, frame: number): void;
|
|
64
|
+
/** Parse stream chat commands for browser interaction. Returns action string or null. */
|
|
65
|
+
export declare function parseStreamBrowserCommand(message: string): {
|
|
66
|
+
command: string;
|
|
67
|
+
args: string;
|
|
68
|
+
} | null;
|
|
69
|
+
/** Handle a stream chat browser command. Returns a response string for the chat. */
|
|
70
|
+
export declare function handleStreamBrowserCommand(command: string, args: string): Promise<{
|
|
71
|
+
response: string;
|
|
72
|
+
mood?: string;
|
|
73
|
+
}>;
|
|
74
|
+
export declare function registerKBotBrowserTools(): void;
|
|
75
|
+
//# sourceMappingURL=kbot-browser.d.ts.map
|