codebuff 1.0.152 → 1.0.154
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/browser-runner.js +11 -26
- package/dist/browser-runner.js.map +1 -1
- package/dist/chat-storage.js +7 -17
- package/dist/chat-storage.js.map +1 -1
- package/dist/cli.js +7 -17
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +16 -25
- package/dist/client.js.map +1 -1
- package/dist/code-map/languages.js +7 -17
- package/dist/code-map/languages.js.map +1 -1
- package/dist/code-map/parse.js +7 -17
- package/dist/code-map/parse.js.map +1 -1
- package/dist/code-map/tsconfig.tsbuildinfo +1 -1
- package/dist/common/actions.d.ts +136 -136
- package/dist/common/advanced-analyzer.d.ts +19 -0
- package/dist/common/advanced-analyzer.js +140 -0
- package/dist/common/advanced-analyzer.js.map +1 -0
- package/dist/common/browser-actions.d.ts +50 -50
- package/dist/common/message-image-handling.d.ts +41 -0
- package/dist/common/message-image-handling.js +57 -0
- package/dist/common/message-image-handling.js.map +1 -0
- package/dist/common/types/usage.d.ts +2 -2
- package/dist/common/util/credentials.d.ts +4 -4
- package/dist/common/util/lru-cache.d.ts +9 -0
- package/dist/common/util/lru-cache.js +42 -0
- package/dist/common/util/lru-cache.js.map +1 -0
- package/dist/common/util/string.d.ts +5 -0
- package/dist/common/util/string.js +15 -1
- package/dist/common/util/string.js.map +1 -1
- package/dist/common/websockets/websocket-schema.d.ts +272 -272
- package/dist/create-template-project.js +7 -17
- package/dist/create-template-project.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/menu.js +7 -17
- package/dist/menu.js.map +1 -1
- package/dist/project-files.js +7 -17
- package/dist/project-files.js.map +1 -1
- package/dist/tool-handlers.js +7 -17
- package/dist/tool-handlers.js.map +1 -1
- package/dist/utils/terminal.js +7 -17
- package/dist/utils/terminal.js.map +1 -1
- package/dist/web-scraper.js +3 -1
- package/dist/web-scraper.js.map +1 -1
- package/package.json +1 -1
- package/dist/common/logger.d.ts +0 -1
- package/dist/common/logger.js +0 -7
- package/dist/common/logger.js.map +0 -1
- package/dist/common/util/constants.d.ts +0 -1
- package/dist/common/util/constants.js +0 -7
- package/dist/common/util/constants.js.map +0 -1
- package/dist/common/util/helpers.d.ts +0 -1
- package/dist/common/util/helpers.js +0 -6
- package/dist/common/util/helpers.js.map +0 -1
- package/dist/common/util/messages.d.ts +0 -1
- package/dist/common/util/messages.js +0 -7
- package/dist/common/util/messages.js.map +0 -1
- package/dist/common/util/token-counter.d.ts +0 -3
- package/dist/common/util/token-counter.js +0 -27
- package/dist/common/util/token-counter.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BrowserResponse } from './browser-actions';
|
|
2
|
+
/**
|
|
3
|
+
* Each detected issue includes a type, severity, detection reason,
|
|
4
|
+
* and an optional recommendation for the user.
|
|
5
|
+
*/
|
|
6
|
+
export interface AnalysisIssue {
|
|
7
|
+
type: string;
|
|
8
|
+
severity: 'low' | 'medium' | 'high';
|
|
9
|
+
message: string;
|
|
10
|
+
recommendation?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AnalysisResult {
|
|
13
|
+
issues: AnalysisIssue[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Entrypoint function to run a suite of heuristic checks over
|
|
17
|
+
* logs, network events, performance metrics, etc.
|
|
18
|
+
*/
|
|
19
|
+
export declare function analyzeBrowserData(response: BrowserResponse): AnalysisResult;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analyzeBrowserData = analyzeBrowserData;
|
|
4
|
+
/**
|
|
5
|
+
* Entrypoint function to run a suite of heuristic checks over
|
|
6
|
+
* logs, network events, performance metrics, etc.
|
|
7
|
+
*/
|
|
8
|
+
function analyzeBrowserData(response) {
|
|
9
|
+
const issues = [];
|
|
10
|
+
// 1. Check logs for known error patterns or repeated errors
|
|
11
|
+
issues.push(...analyzeLogs(response));
|
|
12
|
+
// 2. Check network events for 4xx, 5xx, or suspicious patterns
|
|
13
|
+
issues.push(...analyzeNetwork(response));
|
|
14
|
+
// 3. Check performance metrics (TTFB, LCP, memory usage, etc.)
|
|
15
|
+
if (response.metrics) {
|
|
16
|
+
issues.push(...analyzePerformance(response.metrics));
|
|
17
|
+
}
|
|
18
|
+
// Return combined issues
|
|
19
|
+
return { issues };
|
|
20
|
+
}
|
|
21
|
+
function analyzeLogs(response) {
|
|
22
|
+
const issues = [];
|
|
23
|
+
const logs = response.logs || [];
|
|
24
|
+
// Check for high number of JavaScript errors
|
|
25
|
+
const jsErrors = logs.filter((log) => log.type === 'error');
|
|
26
|
+
if (jsErrors.length > 5) {
|
|
27
|
+
issues.push({
|
|
28
|
+
type: 'JS_ERROR_OVERFLOW',
|
|
29
|
+
severity: 'medium',
|
|
30
|
+
message: `Detected ${jsErrors.length} JavaScript errors in logs.`,
|
|
31
|
+
recommendation: 'Review the console logs for repeated error patterns. Fix the root cause or handle errors in code.'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
// Pattern-based error detection
|
|
35
|
+
const errorPatterns = {
|
|
36
|
+
'not defined': {
|
|
37
|
+
severity: 'medium',
|
|
38
|
+
recommendation: 'Check for missing script dependencies or undefined variables'
|
|
39
|
+
},
|
|
40
|
+
'Failed to fetch': {
|
|
41
|
+
severity: 'medium',
|
|
42
|
+
recommendation: 'Verify endpoint URLs and network connectivity'
|
|
43
|
+
},
|
|
44
|
+
'SSL': {
|
|
45
|
+
severity: 'high',
|
|
46
|
+
recommendation: 'SSL certificate error - check HTTPS configuration'
|
|
47
|
+
},
|
|
48
|
+
'ERR_NAME_NOT_RESOLVED': {
|
|
49
|
+
severity: 'medium',
|
|
50
|
+
recommendation: 'DNS resolution failed - check domain name'
|
|
51
|
+
},
|
|
52
|
+
'ERR_CONNECTION_TIMED_OUT': {
|
|
53
|
+
severity: 'medium',
|
|
54
|
+
recommendation: 'Connection timeout - check network or firewall'
|
|
55
|
+
},
|
|
56
|
+
'Navigation timeout': {
|
|
57
|
+
severity: 'medium',
|
|
58
|
+
recommendation: 'Page took too long to load - check performance or timeouts'
|
|
59
|
+
},
|
|
60
|
+
'Frame detached': {
|
|
61
|
+
severity: 'low',
|
|
62
|
+
recommendation: 'Target frame or element no longer exists'
|
|
63
|
+
},
|
|
64
|
+
'Node is detached': {
|
|
65
|
+
severity: 'low',
|
|
66
|
+
recommendation: 'Element was removed from DOM'
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
for (const log of jsErrors) {
|
|
70
|
+
for (const [pattern, { severity, recommendation }] of Object.entries(errorPatterns)) {
|
|
71
|
+
if (log.message.includes(pattern)) {
|
|
72
|
+
issues.push({
|
|
73
|
+
type: 'JS_ERROR',
|
|
74
|
+
severity,
|
|
75
|
+
message: `Error detected: ${log.message}`,
|
|
76
|
+
recommendation
|
|
77
|
+
});
|
|
78
|
+
break; // Stop after first matching pattern
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return issues;
|
|
83
|
+
}
|
|
84
|
+
function analyzeNetwork(response) {
|
|
85
|
+
const issues = [];
|
|
86
|
+
const netEvents = response.networkEvents || [];
|
|
87
|
+
// Count 4xx / 5xx
|
|
88
|
+
const errorEvents = netEvents.filter((evt) => (evt.status && evt.status >= 400) || evt.errorText);
|
|
89
|
+
if (errorEvents.length > 0) {
|
|
90
|
+
issues.push({
|
|
91
|
+
type: 'NETWORK_ERRORS',
|
|
92
|
+
severity: 'medium',
|
|
93
|
+
message: `${errorEvents.length} network request(s) failed with 4xx/5xx error(s).`,
|
|
94
|
+
recommendation: 'Check your API endpoints and resource URLs. Verify server logs for possible configuration or routing issues.'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// Detect repeated 404s
|
|
98
|
+
const fourOhFours = netEvents.filter((e) => e.status === 404);
|
|
99
|
+
if (fourOhFours.length > 2) {
|
|
100
|
+
issues.push({
|
|
101
|
+
type: 'MISSING_RESOURCES',
|
|
102
|
+
severity: 'low',
|
|
103
|
+
message: `${fourOhFours.length} resources returned 404 Not Found.`,
|
|
104
|
+
recommendation: 'Ensure static assets or pages exist at the requested path.'
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return issues;
|
|
108
|
+
}
|
|
109
|
+
function analyzePerformance(metrics) {
|
|
110
|
+
const issues = [];
|
|
111
|
+
// Check Time to First Byte
|
|
112
|
+
if ((metrics.ttfb ?? 0) > 1000) {
|
|
113
|
+
issues.push({
|
|
114
|
+
type: 'HIGH_TTFB',
|
|
115
|
+
severity: 'medium',
|
|
116
|
+
message: `Time to First Byte is ${metrics.ttfb}ms, which is high.`,
|
|
117
|
+
recommendation: 'Optimize server response times or check network constraints. Look for server-side bottlenecks.'
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Check memory usage
|
|
121
|
+
if (metrics.memoryUsage > 100_000_000) { // ~100MB in JS heap
|
|
122
|
+
issues.push({
|
|
123
|
+
type: 'HIGH_MEMORY_USAGE',
|
|
124
|
+
severity: 'medium',
|
|
125
|
+
message: `Memory usage reached ${metrics.memoryUsage} bytes in JS heap.`,
|
|
126
|
+
recommendation: 'Investigate potential memory leaks, unbounded data structures, or large on-page assets.'
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Check Largest Contentful Paint
|
|
130
|
+
if ((metrics.lcp ?? 0) > 4000) {
|
|
131
|
+
issues.push({
|
|
132
|
+
type: 'PERFORMANCE_LCP',
|
|
133
|
+
severity: 'medium',
|
|
134
|
+
message: `Largest Contentful Paint is ${metrics.lcp}ms (over 4s).`,
|
|
135
|
+
recommendation: 'Consider optimizing images, breaking up large bundle files, or deferring non-critical scripts.'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return issues;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=advanced-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AC;YACV,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,wBAAwB,OAAO,CAAC,WAAW,oBAAoB;YACxE,cAAc,EACZ,yFAAyF;SAC5F,CAAC,CAAA;IACJ,CAAC;IAED,iCAAiC;IACjC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,+BAA+B,OAAO,CAAC,GAAG,eAAe;YAClE,cAAc,EACZ,gGAAgG;SACnG,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -35,8 +35,8 @@ export declare const LogSchema: z.ZodObject<{
|
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
36
|
type: "error" | "warning" | "info" | "debug" | "verbose";
|
|
37
37
|
message: string;
|
|
38
|
-
source: "browser" | "tool";
|
|
39
38
|
timestamp: number;
|
|
39
|
+
source: "browser" | "tool";
|
|
40
40
|
location?: string | undefined;
|
|
41
41
|
stack?: string | undefined;
|
|
42
42
|
category?: string | undefined;
|
|
@@ -45,11 +45,11 @@ export declare const LogSchema: z.ZodObject<{
|
|
|
45
45
|
type: "error" | "warning" | "info" | "debug" | "verbose";
|
|
46
46
|
message: string;
|
|
47
47
|
timestamp: number;
|
|
48
|
-
source?: "browser" | "tool" | undefined;
|
|
49
48
|
location?: string | undefined;
|
|
50
49
|
stack?: string | undefined;
|
|
51
50
|
category?: string | undefined;
|
|
52
51
|
level?: number | undefined;
|
|
52
|
+
source?: "browser" | "tool" | undefined;
|
|
53
53
|
}>;
|
|
54
54
|
export type Log = z.infer<typeof LogSchema>;
|
|
55
55
|
export declare const MetricsSchema: z.ZodObject<{
|
|
@@ -90,14 +90,14 @@ export declare const NetworkEventSchema: z.ZodObject<{
|
|
|
90
90
|
errorText: z.ZodOptional<z.ZodString>;
|
|
91
91
|
timestamp: z.ZodNumber;
|
|
92
92
|
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
url: string;
|
|
94
93
|
timestamp: number;
|
|
94
|
+
url: string;
|
|
95
95
|
method: string;
|
|
96
96
|
status?: number | undefined;
|
|
97
97
|
errorText?: string | undefined;
|
|
98
98
|
}, {
|
|
99
|
-
url: string;
|
|
100
99
|
timestamp: number;
|
|
100
|
+
url: string;
|
|
101
101
|
method: string;
|
|
102
102
|
status?: number | undefined;
|
|
103
103
|
errorText?: string | undefined;
|
|
@@ -248,14 +248,14 @@ export declare const BrowserResponseChunkSchema: z.ZodObject<{
|
|
|
248
248
|
data: z.ZodString;
|
|
249
249
|
}, "strip", z.ZodTypeAny, {
|
|
250
250
|
id: string;
|
|
251
|
-
data: string;
|
|
252
251
|
total: number;
|
|
253
252
|
index: number;
|
|
253
|
+
data: string;
|
|
254
254
|
}, {
|
|
255
255
|
id: string;
|
|
256
|
-
data: string;
|
|
257
256
|
total: number;
|
|
258
257
|
index: number;
|
|
258
|
+
data: string;
|
|
259
259
|
}>;
|
|
260
260
|
export declare const ImageContentSchema: z.ZodObject<{
|
|
261
261
|
type: z.ZodLiteral<"image">;
|
|
@@ -265,26 +265,26 @@ export declare const ImageContentSchema: z.ZodObject<{
|
|
|
265
265
|
data: z.ZodString;
|
|
266
266
|
}, "strip", z.ZodTypeAny, {
|
|
267
267
|
type: "base64";
|
|
268
|
-
media_type: "image/jpeg";
|
|
269
268
|
data: string;
|
|
269
|
+
media_type: "image/jpeg";
|
|
270
270
|
}, {
|
|
271
271
|
type: "base64";
|
|
272
|
-
media_type: "image/jpeg";
|
|
273
272
|
data: string;
|
|
273
|
+
media_type: "image/jpeg";
|
|
274
274
|
}>;
|
|
275
275
|
}, "strip", z.ZodTypeAny, {
|
|
276
276
|
type: "image";
|
|
277
277
|
source: {
|
|
278
278
|
type: "base64";
|
|
279
|
-
media_type: "image/jpeg";
|
|
280
279
|
data: string;
|
|
280
|
+
media_type: "image/jpeg";
|
|
281
281
|
};
|
|
282
282
|
}, {
|
|
283
283
|
type: "image";
|
|
284
284
|
source: {
|
|
285
285
|
type: "base64";
|
|
286
|
-
media_type: "image/jpeg";
|
|
287
286
|
data: string;
|
|
287
|
+
media_type: "image/jpeg";
|
|
288
288
|
};
|
|
289
289
|
}>;
|
|
290
290
|
export type ImageContent = z.infer<typeof ImageContentSchema>;
|
|
@@ -299,26 +299,26 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
299
299
|
data: z.ZodString;
|
|
300
300
|
}, "strip", z.ZodTypeAny, {
|
|
301
301
|
type: "base64";
|
|
302
|
-
media_type: "image/jpeg";
|
|
303
302
|
data: string;
|
|
303
|
+
media_type: "image/jpeg";
|
|
304
304
|
}, {
|
|
305
305
|
type: "base64";
|
|
306
|
-
media_type: "image/jpeg";
|
|
307
306
|
data: string;
|
|
307
|
+
media_type: "image/jpeg";
|
|
308
308
|
}>;
|
|
309
309
|
}, "strip", z.ZodTypeAny, {
|
|
310
310
|
type: "image";
|
|
311
311
|
source: {
|
|
312
312
|
type: "base64";
|
|
313
|
-
media_type: "image/jpeg";
|
|
314
313
|
data: string;
|
|
314
|
+
media_type: "image/jpeg";
|
|
315
315
|
};
|
|
316
316
|
}, {
|
|
317
317
|
type: "image";
|
|
318
318
|
source: {
|
|
319
319
|
type: "base64";
|
|
320
|
-
media_type: "image/jpeg";
|
|
321
320
|
data: string;
|
|
321
|
+
media_type: "image/jpeg";
|
|
322
322
|
};
|
|
323
323
|
}>>;
|
|
324
324
|
logs: z.ZodArray<z.ZodObject<{
|
|
@@ -333,8 +333,8 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
333
333
|
}, "strip", z.ZodTypeAny, {
|
|
334
334
|
type: "error" | "warning" | "info" | "debug" | "verbose";
|
|
335
335
|
message: string;
|
|
336
|
-
source: "browser" | "tool";
|
|
337
336
|
timestamp: number;
|
|
337
|
+
source: "browser" | "tool";
|
|
338
338
|
location?: string | undefined;
|
|
339
339
|
stack?: string | undefined;
|
|
340
340
|
category?: string | undefined;
|
|
@@ -343,11 +343,11 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
343
343
|
type: "error" | "warning" | "info" | "debug" | "verbose";
|
|
344
344
|
message: string;
|
|
345
345
|
timestamp: number;
|
|
346
|
-
source?: "browser" | "tool" | undefined;
|
|
347
346
|
location?: string | undefined;
|
|
348
347
|
stack?: string | undefined;
|
|
349
348
|
category?: string | undefined;
|
|
350
349
|
level?: number | undefined;
|
|
350
|
+
source?: "browser" | "tool" | undefined;
|
|
351
351
|
}>, "many">;
|
|
352
352
|
metrics: z.ZodOptional<z.ZodObject<{
|
|
353
353
|
loadTime: z.ZodNumber;
|
|
@@ -387,14 +387,14 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
387
387
|
errorText: z.ZodOptional<z.ZodString>;
|
|
388
388
|
timestamp: z.ZodNumber;
|
|
389
389
|
}, "strip", z.ZodTypeAny, {
|
|
390
|
-
url: string;
|
|
391
390
|
timestamp: number;
|
|
391
|
+
url: string;
|
|
392
392
|
method: string;
|
|
393
393
|
status?: number | undefined;
|
|
394
394
|
errorText?: string | undefined;
|
|
395
395
|
}, {
|
|
396
|
-
url: string;
|
|
397
396
|
timestamp: number;
|
|
397
|
+
url: string;
|
|
398
398
|
method: string;
|
|
399
399
|
status?: number | undefined;
|
|
400
400
|
errorText?: string | undefined;
|
|
@@ -419,22 +419,22 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
419
419
|
data: z.ZodString;
|
|
420
420
|
}, "strip", z.ZodTypeAny, {
|
|
421
421
|
id: string;
|
|
422
|
-
data: string;
|
|
423
422
|
total: number;
|
|
424
423
|
index: number;
|
|
424
|
+
data: string;
|
|
425
425
|
}, {
|
|
426
426
|
id: string;
|
|
427
|
-
data: string;
|
|
428
427
|
total: number;
|
|
429
428
|
index: number;
|
|
429
|
+
data: string;
|
|
430
430
|
}>, "many">>;
|
|
431
431
|
}, "strip", z.ZodTypeAny, {
|
|
432
432
|
success: boolean;
|
|
433
433
|
logs: {
|
|
434
434
|
type: "error" | "warning" | "info" | "debug" | "verbose";
|
|
435
435
|
message: string;
|
|
436
|
-
source: "browser" | "tool";
|
|
437
436
|
timestamp: number;
|
|
437
|
+
source: "browser" | "tool";
|
|
438
438
|
location?: string | undefined;
|
|
439
439
|
stack?: string | undefined;
|
|
440
440
|
category?: string | undefined;
|
|
@@ -450,8 +450,8 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
450
450
|
type: "image";
|
|
451
451
|
source: {
|
|
452
452
|
type: "base64";
|
|
453
|
-
media_type: "image/jpeg";
|
|
454
453
|
data: string;
|
|
454
|
+
media_type: "image/jpeg";
|
|
455
455
|
};
|
|
456
456
|
} | undefined;
|
|
457
457
|
metrics?: {
|
|
@@ -466,17 +466,17 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
466
466
|
sessionDuration?: number | undefined;
|
|
467
467
|
} | undefined;
|
|
468
468
|
networkEvents?: {
|
|
469
|
-
url: string;
|
|
470
469
|
timestamp: number;
|
|
470
|
+
url: string;
|
|
471
471
|
method: string;
|
|
472
472
|
status?: number | undefined;
|
|
473
473
|
errorText?: string | undefined;
|
|
474
474
|
}[] | undefined;
|
|
475
475
|
chunks?: {
|
|
476
476
|
id: string;
|
|
477
|
-
data: string;
|
|
478
477
|
total: number;
|
|
479
478
|
index: number;
|
|
479
|
+
data: string;
|
|
480
480
|
}[] | undefined;
|
|
481
481
|
}, {
|
|
482
482
|
success: boolean;
|
|
@@ -484,11 +484,11 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
484
484
|
type: "error" | "warning" | "info" | "debug" | "verbose";
|
|
485
485
|
message: string;
|
|
486
486
|
timestamp: number;
|
|
487
|
-
source?: "browser" | "tool" | undefined;
|
|
488
487
|
location?: string | undefined;
|
|
489
488
|
stack?: string | undefined;
|
|
490
489
|
category?: string | undefined;
|
|
491
490
|
level?: number | undefined;
|
|
491
|
+
source?: "browser" | "tool" | undefined;
|
|
492
492
|
}[];
|
|
493
493
|
error?: string | undefined;
|
|
494
494
|
logFilter?: {
|
|
@@ -500,8 +500,8 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
500
500
|
type: "image";
|
|
501
501
|
source: {
|
|
502
502
|
type: "base64";
|
|
503
|
-
media_type: "image/jpeg";
|
|
504
503
|
data: string;
|
|
504
|
+
media_type: "image/jpeg";
|
|
505
505
|
};
|
|
506
506
|
} | undefined;
|
|
507
507
|
metrics?: {
|
|
@@ -516,17 +516,17 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
516
516
|
sessionDuration?: number | undefined;
|
|
517
517
|
} | undefined;
|
|
518
518
|
networkEvents?: {
|
|
519
|
-
url: string;
|
|
520
519
|
timestamp: number;
|
|
520
|
+
url: string;
|
|
521
521
|
method: string;
|
|
522
522
|
status?: number | undefined;
|
|
523
523
|
errorText?: string | undefined;
|
|
524
524
|
}[] | undefined;
|
|
525
525
|
chunks?: {
|
|
526
526
|
id: string;
|
|
527
|
-
data: string;
|
|
528
527
|
total: number;
|
|
529
528
|
index: number;
|
|
529
|
+
data: string;
|
|
530
530
|
}[] | undefined;
|
|
531
531
|
}>;
|
|
532
532
|
export declare const RequiredBrowserStartActionSchema: z.ZodObject<{
|
|
@@ -772,12 +772,12 @@ export declare const RequiredBrowserTypeActionSchema: z.ZodObject<{
|
|
|
772
772
|
text: z.ZodString;
|
|
773
773
|
}, "strip", z.ZodTypeAny, {
|
|
774
774
|
type: "type";
|
|
775
|
-
text: string;
|
|
776
775
|
selector: string;
|
|
776
|
+
text: string;
|
|
777
777
|
}, {
|
|
778
778
|
type: "type";
|
|
779
|
-
text: string;
|
|
780
779
|
selector: string;
|
|
780
|
+
text: string;
|
|
781
781
|
}>;
|
|
782
782
|
export declare const BrowserTypeActionSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
783
783
|
type: z.ZodLiteral<"type">;
|
|
@@ -816,8 +816,8 @@ export declare const BrowserTypeActionSchema: z.ZodObject<z.objectUtil.extendSha
|
|
|
816
816
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
817
817
|
}>, "strip", z.ZodTypeAny, {
|
|
818
818
|
type: "type";
|
|
819
|
-
text: string;
|
|
820
819
|
selector: string;
|
|
820
|
+
text: string;
|
|
821
821
|
debug?: boolean | undefined;
|
|
822
822
|
timeout?: number | undefined;
|
|
823
823
|
retryOptions?: {
|
|
@@ -833,8 +833,8 @@ export declare const BrowserTypeActionSchema: z.ZodObject<z.objectUtil.extendSha
|
|
|
833
833
|
delay?: number | undefined;
|
|
834
834
|
}, {
|
|
835
835
|
type: "type";
|
|
836
|
-
text: string;
|
|
837
836
|
selector: string;
|
|
837
|
+
text: string;
|
|
838
838
|
debug?: boolean | undefined;
|
|
839
839
|
timeout?: number | undefined;
|
|
840
840
|
retryOptions?: {
|
|
@@ -1320,8 +1320,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1320
1320
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
1321
1321
|
}>, "strip", z.ZodTypeAny, {
|
|
1322
1322
|
type: "type";
|
|
1323
|
-
text: string;
|
|
1324
1323
|
selector: string;
|
|
1324
|
+
text: string;
|
|
1325
1325
|
debug?: boolean | undefined;
|
|
1326
1326
|
timeout?: number | undefined;
|
|
1327
1327
|
retryOptions?: {
|
|
@@ -1337,8 +1337,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1337
1337
|
delay?: number | undefined;
|
|
1338
1338
|
}, {
|
|
1339
1339
|
type: "type";
|
|
1340
|
-
text: string;
|
|
1341
1340
|
selector: string;
|
|
1341
|
+
text: string;
|
|
1342
1342
|
debug?: boolean | undefined;
|
|
1343
1343
|
timeout?: number | undefined;
|
|
1344
1344
|
retryOptions?: {
|
|
@@ -1605,8 +1605,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1605
1605
|
visualThreshold?: number | undefined;
|
|
1606
1606
|
} | {
|
|
1607
1607
|
type: "type";
|
|
1608
|
-
text: string;
|
|
1609
1608
|
selector: string;
|
|
1609
|
+
text: string;
|
|
1610
1610
|
debug?: boolean | undefined;
|
|
1611
1611
|
timeout?: number | undefined;
|
|
1612
1612
|
retryOptions?: {
|
|
@@ -1727,8 +1727,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1727
1727
|
visualThreshold?: number | undefined;
|
|
1728
1728
|
} | {
|
|
1729
1729
|
type: "type";
|
|
1730
|
-
text: string;
|
|
1731
1730
|
selector: string;
|
|
1731
|
+
text: string;
|
|
1732
1732
|
debug?: boolean | undefined;
|
|
1733
1733
|
timeout?: number | undefined;
|
|
1734
1734
|
retryOptions?: {
|
|
@@ -2072,8 +2072,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2072
2072
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
2073
2073
|
}>, "strip", z.ZodTypeAny, {
|
|
2074
2074
|
type: "type";
|
|
2075
|
-
text: string;
|
|
2076
2075
|
selector: string;
|
|
2076
|
+
text: string;
|
|
2077
2077
|
debug?: boolean | undefined;
|
|
2078
2078
|
timeout?: number | undefined;
|
|
2079
2079
|
retryOptions?: {
|
|
@@ -2089,8 +2089,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2089
2089
|
delay?: number | undefined;
|
|
2090
2090
|
}, {
|
|
2091
2091
|
type: "type";
|
|
2092
|
-
text: string;
|
|
2093
2092
|
selector: string;
|
|
2093
|
+
text: string;
|
|
2094
2094
|
debug?: boolean | undefined;
|
|
2095
2095
|
timeout?: number | undefined;
|
|
2096
2096
|
retryOptions?: {
|
|
@@ -2357,8 +2357,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2357
2357
|
visualThreshold?: number | undefined;
|
|
2358
2358
|
} | {
|
|
2359
2359
|
type: "type";
|
|
2360
|
-
text: string;
|
|
2361
2360
|
selector: string;
|
|
2361
|
+
text: string;
|
|
2362
2362
|
debug?: boolean | undefined;
|
|
2363
2363
|
timeout?: number | undefined;
|
|
2364
2364
|
retryOptions?: {
|
|
@@ -2479,8 +2479,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2479
2479
|
visualThreshold?: number | undefined;
|
|
2480
2480
|
} | {
|
|
2481
2481
|
type: "type";
|
|
2482
|
-
text: string;
|
|
2483
2482
|
selector: string;
|
|
2483
|
+
text: string;
|
|
2484
2484
|
debug?: boolean | undefined;
|
|
2485
2485
|
timeout?: number | undefined;
|
|
2486
2486
|
retryOptions?: {
|
|
@@ -2607,8 +2607,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2607
2607
|
visualThreshold?: number | undefined;
|
|
2608
2608
|
} | {
|
|
2609
2609
|
type: "type";
|
|
2610
|
-
text: string;
|
|
2611
2610
|
selector: string;
|
|
2611
|
+
text: string;
|
|
2612
2612
|
debug?: boolean | undefined;
|
|
2613
2613
|
timeout?: number | undefined;
|
|
2614
2614
|
retryOptions?: {
|
|
@@ -2747,8 +2747,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2747
2747
|
visualThreshold?: number | undefined;
|
|
2748
2748
|
} | {
|
|
2749
2749
|
type: "type";
|
|
2750
|
-
text: string;
|
|
2751
2750
|
selector: string;
|
|
2751
|
+
text: string;
|
|
2752
2752
|
debug?: boolean | undefined;
|
|
2753
2753
|
timeout?: number | undefined;
|
|
2754
2754
|
retryOptions?: {
|
|
@@ -3076,8 +3076,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3076
3076
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
3077
3077
|
}>, "strip", z.ZodTypeAny, {
|
|
3078
3078
|
type: "type";
|
|
3079
|
-
text: string;
|
|
3080
3079
|
selector: string;
|
|
3080
|
+
text: string;
|
|
3081
3081
|
debug?: boolean | undefined;
|
|
3082
3082
|
timeout?: number | undefined;
|
|
3083
3083
|
retryOptions?: {
|
|
@@ -3093,8 +3093,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3093
3093
|
delay?: number | undefined;
|
|
3094
3094
|
}, {
|
|
3095
3095
|
type: "type";
|
|
3096
|
-
text: string;
|
|
3097
3096
|
selector: string;
|
|
3097
|
+
text: string;
|
|
3098
3098
|
debug?: boolean | undefined;
|
|
3099
3099
|
timeout?: number | undefined;
|
|
3100
3100
|
retryOptions?: {
|
|
@@ -3578,8 +3578,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3578
3578
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
3579
3579
|
}>, "strip", z.ZodTypeAny, {
|
|
3580
3580
|
type: "type";
|
|
3581
|
-
text: string;
|
|
3582
3581
|
selector: string;
|
|
3582
|
+
text: string;
|
|
3583
3583
|
debug?: boolean | undefined;
|
|
3584
3584
|
timeout?: number | undefined;
|
|
3585
3585
|
retryOptions?: {
|
|
@@ -3595,8 +3595,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3595
3595
|
delay?: number | undefined;
|
|
3596
3596
|
}, {
|
|
3597
3597
|
type: "type";
|
|
3598
|
-
text: string;
|
|
3599
3598
|
selector: string;
|
|
3599
|
+
text: string;
|
|
3600
3600
|
debug?: boolean | undefined;
|
|
3601
3601
|
timeout?: number | undefined;
|
|
3602
3602
|
retryOptions?: {
|
|
@@ -3863,8 +3863,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3863
3863
|
visualThreshold?: number | undefined;
|
|
3864
3864
|
} | {
|
|
3865
3865
|
type: "type";
|
|
3866
|
-
text: string;
|
|
3867
3866
|
selector: string;
|
|
3867
|
+
text: string;
|
|
3868
3868
|
debug?: boolean | undefined;
|
|
3869
3869
|
timeout?: number | undefined;
|
|
3870
3870
|
retryOptions?: {
|
|
@@ -3985,8 +3985,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3985
3985
|
visualThreshold?: number | undefined;
|
|
3986
3986
|
} | {
|
|
3987
3987
|
type: "type";
|
|
3988
|
-
text: string;
|
|
3989
3988
|
selector: string;
|
|
3989
|
+
text: string;
|
|
3990
3990
|
debug?: boolean | undefined;
|
|
3991
3991
|
timeout?: number | undefined;
|
|
3992
3992
|
retryOptions?: {
|
|
@@ -4113,8 +4113,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
4113
4113
|
visualThreshold?: number | undefined;
|
|
4114
4114
|
} | {
|
|
4115
4115
|
type: "type";
|
|
4116
|
-
text: string;
|
|
4117
4116
|
selector: string;
|
|
4117
|
+
text: string;
|
|
4118
4118
|
debug?: boolean | undefined;
|
|
4119
4119
|
timeout?: number | undefined;
|
|
4120
4120
|
retryOptions?: {
|
|
@@ -4253,8 +4253,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
4253
4253
|
visualThreshold?: number | undefined;
|
|
4254
4254
|
} | {
|
|
4255
4255
|
type: "type";
|
|
4256
|
-
text: string;
|
|
4257
4256
|
selector: string;
|
|
4257
|
+
text: string;
|
|
4258
4258
|
debug?: boolean | undefined;
|
|
4259
4259
|
timeout?: number | undefined;
|
|
4260
4260
|
retryOptions?: {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Message } from './actions';
|
|
2
|
+
/**
|
|
3
|
+
* Contexts where message processing may occur
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ProcessingContext {
|
|
6
|
+
ModelCall = "model-call",
|
|
7
|
+
FileCache = "file-cache",
|
|
8
|
+
WarmCache = "warm-cache"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Interface for provider-specific image handling
|
|
12
|
+
*/
|
|
13
|
+
export interface IImageHandler {
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether images should be passed along in the given context
|
|
16
|
+
*/
|
|
17
|
+
supportsImages(context: ProcessingContext): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Transform a message by either stripping, replacing, or modifying image blocks
|
|
20
|
+
*/
|
|
21
|
+
transformMessage(message: Message, context: ProcessingContext): Message;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Base handler that removes all images unless explicitly allowed
|
|
25
|
+
*/
|
|
26
|
+
export declare class DefaultImageHandler implements IImageHandler {
|
|
27
|
+
supportsImages(context: ProcessingContext): boolean;
|
|
28
|
+
transformMessage(message: Message, context: ProcessingContext): Message;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Register a new image handler for a provider
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerImageHandler(provider: string, handler: IImageHandler): void;
|
|
34
|
+
/**
|
|
35
|
+
* Transform a message for a specific provider and context
|
|
36
|
+
*/
|
|
37
|
+
export declare function transformMessageForProvider(message: Message, provider: string, context: ProcessingContext): Message;
|
|
38
|
+
/**
|
|
39
|
+
* Transform an array of messages for a specific provider and context
|
|
40
|
+
*/
|
|
41
|
+
export declare function transformMessagesForProvider(messages: Message[], provider: string, context: ProcessingContext): Message[];
|