btcp-browser-agent 0.1.6 → 0.1.7
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 -21
- package/README.md +306 -306
- package/package.json +69 -69
- package/packages/core/dist/actions.js +43 -39
- package/packages/core/dist/snapshot.d.ts +31 -4
- package/packages/core/dist/snapshot.js +633 -5
- package/packages/core/dist/types.d.ts +28 -3
- package/packages/extension/dist/index.d.ts +6 -2
- package/packages/extension/dist/index.js +5 -1
|
@@ -93,12 +93,19 @@ export interface GrepOptions {
|
|
|
93
93
|
/** Treat pattern as fixed string, not regex (grep -F) */
|
|
94
94
|
fixedStrings?: boolean;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Snapshot mode determines what content to capture
|
|
98
|
+
*/
|
|
99
|
+
export type SnapshotMode = 'interactive' | 'outline' | 'content';
|
|
100
|
+
/**
|
|
101
|
+
* Snapshot output format
|
|
102
|
+
*/
|
|
103
|
+
export type SnapshotFormat = 'tree' | 'html' | 'markdown';
|
|
96
104
|
export interface SnapshotCommand extends BaseCommand {
|
|
97
105
|
action: 'snapshot';
|
|
98
106
|
selector?: Selector;
|
|
99
107
|
maxDepth?: number;
|
|
100
108
|
includeHidden?: boolean;
|
|
101
|
-
interactive?: boolean;
|
|
102
109
|
compact?: boolean;
|
|
103
110
|
minDepth?: number;
|
|
104
111
|
samplingStrategy?: 'importance' | 'balanced' | 'depth-first';
|
|
@@ -106,10 +113,28 @@ export interface SnapshotCommand extends BaseCommand {
|
|
|
106
113
|
landmarks?: boolean;
|
|
107
114
|
incremental?: boolean;
|
|
108
115
|
baseSnapshot?: SnapshotData;
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Snapshot mode:
|
|
118
|
+
* - 'interactive': Find clickable elements (default)
|
|
119
|
+
* - 'outline': Understand page structure with xpaths + metadata
|
|
120
|
+
* - 'content': Extract text content from sections
|
|
121
|
+
*/
|
|
122
|
+
mode?: SnapshotMode;
|
|
123
|
+
/**
|
|
124
|
+
* Output format:
|
|
125
|
+
* - 'tree': Flat accessibility tree (default)
|
|
126
|
+
* - 'html': Raw HTML
|
|
127
|
+
* - 'markdown': Markdown formatted content
|
|
128
|
+
*/
|
|
129
|
+
format?: SnapshotFormat;
|
|
111
130
|
/** Filter output lines - simple string or full grep options */
|
|
112
131
|
grep?: string | GrepOptions;
|
|
132
|
+
/** Max chars per section in content mode */
|
|
133
|
+
maxLength?: number;
|
|
134
|
+
/** Include links as [text](url) in markdown format */
|
|
135
|
+
includeLinks?: boolean;
|
|
136
|
+
/** Include images as  in markdown format */
|
|
137
|
+
includeImages?: boolean;
|
|
113
138
|
}
|
|
114
139
|
export interface QuerySelectorCommand extends BaseCommand {
|
|
115
140
|
action: 'querySelector';
|
|
@@ -87,9 +87,13 @@ export interface Client {
|
|
|
87
87
|
snapshot(options?: {
|
|
88
88
|
selector?: string;
|
|
89
89
|
maxDepth?: number;
|
|
90
|
-
|
|
90
|
+
mode?: 'interactive' | 'outline' | 'content';
|
|
91
91
|
compact?: boolean;
|
|
92
|
-
format?: 'tree' | 'html';
|
|
92
|
+
format?: 'tree' | 'html' | 'markdown';
|
|
93
|
+
grep?: string;
|
|
94
|
+
maxLength?: number;
|
|
95
|
+
includeLinks?: boolean;
|
|
96
|
+
includeImages?: boolean;
|
|
93
97
|
}): Promise<string>;
|
|
94
98
|
/**
|
|
95
99
|
* Click an element
|
|
@@ -175,9 +175,13 @@ export function createClient() {
|
|
|
175
175
|
action: 'snapshot',
|
|
176
176
|
selector: options?.selector,
|
|
177
177
|
maxDepth: options?.maxDepth,
|
|
178
|
-
|
|
178
|
+
mode: options?.mode,
|
|
179
179
|
compact: options?.compact,
|
|
180
180
|
format: options?.format,
|
|
181
|
+
grep: options?.grep,
|
|
182
|
+
maxLength: options?.maxLength,
|
|
183
|
+
includeLinks: options?.includeLinks,
|
|
184
|
+
includeImages: options?.includeImages,
|
|
181
185
|
});
|
|
182
186
|
assertSuccess(response);
|
|
183
187
|
return response.data;
|