mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
feat: add bsk network read-only command
Add `bsk network` as a sibling of the `console` command from #7, reading the buffered network responses / failures for a tab. Fills the remaining half of the request in #2 (console landed in #7; network did not). Mirrors the console command's conventions exactly: bsk network --session <id> [--tab-id N] [--since C] [--limit N] [--max-text-chars N] The extension enables `Network` on attach (best-effort) and buffers `responseReceived` / `loadingFailed` events per tab with a monotonic sequence, correlating them to `requestWillBeSent` for method/URL. Reads are cursor-paginated (`since` -> `next_since`) and bounded (`limit`, `max_text_chars`) for agent-context safety, same as console. Entries carry the real HTTP status code (response) or the CDP failure reason (failure) — things `performance.getEntriesByType('resource')` can't give. Classified read-only (pass-through under the pending-interrupt gate); defaults to the Agent Window's active tab. Wires bsk-protocol (Method + params/result/entry structs + schema), bsk-cli (network subcommand + daemon dispatch allow-list) and the extension (handler + dispatcher route), with unit / parse / IPC tests paralleling the console command. Refs #2.
This commit is contained in:
1 parent
3d6c95c22a
commit
259b4826b7
19 files changed
+1156
-3
No files matched your search
@@ -172,6 +172,37 @@ export interface ConsoleResult {
|
||||
truncated: boolean;
|
||||
}
|
||||
|
||||
export type NetworkEntryKind = "response" | "failure";
|
||||
|
||||
export interface NetworkEntry {
|
||||
sequence: number;
|
||||
kind: NetworkEntryKind;
|
||||
method?: string;
|
||||
url: string;
|
||||
status?: number;
|
||||
status_text?: string;
|
||||
mime_type?: string;
|
||||
resource_type?: string;
|
||||
error_text?: string;
|
||||
timestamp?: number;
|
||||
truncated: boolean;
|
||||
}
|
||||
|
||||
export interface NetworkParams {
|
||||
session_id: string;
|
||||
tab_id?: number;
|
||||
since?: number;
|
||||
limit?: number;
|
||||
max_text_chars?: number;
|
||||
}
|
||||
|
||||
export interface NetworkResult {
|
||||
tab_id: number;
|
||||
entries: NetworkEntry[];
|
||||
next_since: number;
|
||||
truncated: boolean;
|
||||
}
|
||||
|
||||
export type TabScopeFilter = "user" | "agent" | "all";
|
||||
|
||||
export interface TabInfo {
|
||||
|
||||
Reference in new issue
Block a user