codebuff 1.0.178 → 1.0.180

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.
@@ -1,140 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"advanced-analyzer.js","sourceRoot":"","sources":["../src/advanced-analyzer.ts"],"names":[],"mappings":";;AAqBA,gDAgBC;AApBD;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,QAAyB;IAC1D,MAAM,MAAM,GAAoB,EAAE,CAAA;IAElC,4DAA4D;IAC5D,MAAM,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAA;IAErC,+DAA+D;IAC/D,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;IAExC,+DAA+D;IAC/D,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IACtD,CAAC;IAED,yBAAyB;IACzB,OAAO,EAAE,MAAM,EAAE,CAAA;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,QAAyB;IAC5C,MAAM,MAAM,GAAoB,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAA;IAEhC,6CAA6C;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG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AS,kBAAkB,CAAC,OAA6C;IACvE,MAAM,MAAM,GAAoB,EAAE,CAAA;IAElC,2BAA2B;IAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,yBAAyB,OAAO,CAAC,IAAI,oBAAoB;YAClE,cAAc,EACZ,gGAAgG;SACnG,CAAC,CAAA;IACJ,CAAC;IAED,qBAAqB;IACrB,IAAI,OAAO,CAAC,WAAW,GAAG,WAAW,EAAE,CAAC,CAAC,oBAAoB;QAC3D,MAAM,CAAC,IAAI,CAAC;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"}
@@ -1,41 +0,0 @@
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[];
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultImageHandler = exports.ProcessingContext = void 0;
4
- exports.registerImageHandler = registerImageHandler;
5
- exports.transformMessageForProvider = transformMessageForProvider;
6
- exports.transformMessagesForProvider = transformMessagesForProvider;
7
- /**
8
- * Contexts where message processing may occur
9
- */
10
- var ProcessingContext;
11
- (function (ProcessingContext) {
12
- ProcessingContext["ModelCall"] = "model-call";
13
- ProcessingContext["FileCache"] = "file-cache";
14
- ProcessingContext["WarmCache"] = "warm-cache";
15
- })(ProcessingContext || (exports.ProcessingContext = ProcessingContext = {}));
16
- /**
17
- * Base handler that removes all images unless explicitly allowed
18
- */
19
- class DefaultImageHandler {
20
- supportsImages(context) {
21
- return context === ProcessingContext.FileCache;
22
- }
23
- transformMessage(message, context) {
24
- if (!this.supportsImages(context)) {
25
- const transformed = Array.isArray(message.content)
26
- ? message.content.filter(block => typeof block === 'string' ? true : block.type !== 'image')
27
- : message.content;
28
- return { ...message, content: transformed };
29
- }
30
- return message;
31
- }
32
- }
33
- exports.DefaultImageHandler = DefaultImageHandler;
34
- /**
35
- * Registry mapping provider names to their image handlers
36
- */
37
- const imageHandlerRegistry = {};
38
- /**
39
- * Register a new image handler for a provider
40
- */
41
- function registerImageHandler(provider, handler) {
42
- imageHandlerRegistry[provider] = handler;
43
- }
44
- /**
45
- * Transform a message for a specific provider and context
46
- */
47
- function transformMessageForProvider(message, provider, context) {
48
- const handler = imageHandlerRegistry[provider] || new DefaultImageHandler();
49
- return handler.transformMessage(message, context);
50
- }
51
- /**
52
- * Transform an array of messages for a specific provider and context
53
- */
54
- function transformMessagesForProvider(messages, provider, context) {
55
- return messages.map(message => transformMessageForProvider(message, provider, context));
56
- }
57
- //# sourceMappingURL=message-image-handling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message-image-handling.js","sourceRoot":"","sources":["../src/message-image-handling.ts"],"names":[],"mappings":";;;AAuDA,oDAEC;AAKD,kEAOC;AAKD,oEAMC;AA9ED;;GAEG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,6CAAwB,CAAA;IACxB,6CAAwB,CAAA;IACxB,6CAAwB,CAAA;AAC1B,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAiBD;;GAEG;AACH,MAAa,mBAAmB;IAC9B,cAAc,CAAC,OAA0B;QACvC,OAAO,OAAO,KAAK,iBAAiB,CAAC,SAAS,CAAC;IACjD,CAAC;IAED,gBAAgB,CAAC,OAAgB,EAAE,OAA0B;QAC3D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;gBAChD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC7B,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAC1D;gBACH,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;YACpB,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAC9C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAhBD,kDAgBC;AAED;;GAEG;AACH,MAAM,oBAAoB,GAAkC,EAAE,CAAC;AAE/D;;GAEG;AACH,SAAgB,oBAAoB,CAAC,QAAgB,EAAE,OAAsB;IAC3E,oBAAoB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CACzC,OAAgB,EAChB,QAAgB,EAChB,OAA0B;IAE1B,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC,IAAI,IAAI,mBAAmB,EAAE,CAAC;IAC5E,OAAO,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAC1C,QAAmB,EACnB,QAAgB,EAChB,OAA0B;IAE1B,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1F,CAAC"}
@@ -1,8 +0,0 @@
1
- export declare function processStreamWithTags<T extends string>(stream: AsyncGenerator<T> | ReadableStream<T>, tags: {
2
- [tagName: string]: {
3
- attributeNames: string[];
4
- onTagStart: (attributes: Record<string, string>) => void;
5
- onTagEnd: (content: string, attributes: Record<string, string>) => boolean;
6
- };
7
- }): AsyncGenerator<string, void, unknown>;
8
- export declare function parseAttributes(attributesString: string, attributeNames: string[]): Record<string, string>;
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processStreamWithTags = processStreamWithTags;
4
- exports.parseAttributes = parseAttributes;
5
- async function* processStreamWithTags(stream, tags) {
6
- let buffer = '';
7
- let insideTag = null;
8
- let currentAttributes = {};
9
- let streamCompleted = false;
10
- const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
11
- const tagNames = Object.keys(tags);
12
- const openTagRegex = new RegExp(`<(${tagNames.map(escapeRegExp).join('|')})\\s*([^>]*)>`);
13
- const closeTagRegex = new RegExp(`</(${tagNames.map(escapeRegExp).join('|')})>`);
14
- function* parseBuffer(chunk) {
15
- const isEOF = chunk === undefined;
16
- if (chunk) {
17
- yield chunk;
18
- }
19
- let didParse = true;
20
- while (!streamCompleted && didParse) {
21
- didParse = false;
22
- if (insideTag === null) {
23
- // Outside a tag: try to find the next opening tag
24
- const openMatch = buffer.match(openTagRegex);
25
- if (openMatch && openMatch.index !== undefined) {
26
- const [fullMatch, openTag, attributesString] = openMatch;
27
- const beforeTag = buffer.slice(0, openMatch.index);
28
- const afterMatchIndex = openMatch.index + fullMatch.length;
29
- // Move buffer forward
30
- buffer = buffer.slice(afterMatchIndex);
31
- // We are now inside this tag
32
- insideTag = openTag;
33
- currentAttributes = parseAttributes(attributesString, tags[openTag].attributeNames);
34
- // Call onTagStart
35
- tags[openTag].onTagStart(currentAttributes);
36
- didParse = true;
37
- }
38
- else {
39
- // No opening tag found. If it's EOF, yield remaining text.
40
- if (isEOF && buffer.length > 0) {
41
- buffer = '';
42
- }
43
- }
44
- }
45
- else {
46
- // Inside a tag: try to find the closing tag
47
- const closeMatch = buffer.match(closeTagRegex);
48
- if (closeMatch && closeMatch.index !== undefined) {
49
- const [fullMatch, closeTag] = closeMatch;
50
- const content = buffer.slice(0, closeMatch.index);
51
- // Move buffer forward
52
- buffer = buffer.slice(closeMatch.index + fullMatch.length);
53
- // Close the tag
54
- const complete = tags[insideTag].onTagEnd(content, currentAttributes);
55
- insideTag = null;
56
- currentAttributes = {};
57
- if (complete) {
58
- // If onTagEnd signals completion, set streamCompleted and return
59
- streamCompleted = true;
60
- return;
61
- }
62
- didParse = true;
63
- }
64
- else if (isEOF) {
65
- // We reached EOF without finding a closing tag
66
- // Treat remaining buffer as content and close the tag
67
- if (buffer.length > 0) {
68
- const complete = tags[insideTag].onTagEnd(buffer, currentAttributes);
69
- yield '</' + insideTag + '>';
70
- buffer = '';
71
- insideTag = null;
72
- currentAttributes = {};
73
- if (complete) {
74
- streamCompleted = true;
75
- return;
76
- }
77
- }
78
- }
79
- }
80
- }
81
- }
82
- for await (const chunk of stream) {
83
- if (streamCompleted)
84
- continue;
85
- buffer += chunk;
86
- yield* parseBuffer(chunk);
87
- }
88
- if (!streamCompleted) {
89
- // After the stream ends, try parsing one last time in case there's leftover text
90
- yield* parseBuffer(undefined);
91
- }
92
- }
93
- function parseAttributes(attributesString, attributeNames) {
94
- const attributes = {};
95
- const regex = new RegExp(`(${attributeNames.join('|')})="([^"]*)"`, 'g');
96
- let match;
97
- while ((match = regex.exec(attributesString)) !== null) {
98
- attributes[match[1]] = match[2];
99
- }
100
- return attributes;
101
- }
102
- //# sourceMappingURL=process-stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process-stream.js","sourceRoot":"","sources":["../../src/util/process-stream.ts"],"names":[],"mappings":";;AAAA,sDAoHC;AAED,0CAWC;AAjIM,KAAK,SAAS,CAAC,CAAC,qBAAqB,CAC1C,MAA6C,EAC7C,IAMC;IAED,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI,SAAS,GAAkB,IAAI,CAAA;IACnC,IAAI,iBAAiB,GAA2B,EAAE,CAAA;IAClD,IAAI,eAAe,GAAG,KAAK,CAAA;IAE3B,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,EAAE,CACtC,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClC,MAAM,YAAY,GAAG,IAAI,MAAM,CAC7B,KAAK,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CACzD,CAAA;IACD,MAAM,aAAa,GAAG,IAAI,MAAM,CAC9B,MAAM,QAAQ,CAAC,GAAG,CA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