circle-ir-ai 2.7.3 → 2.7.5
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/CHANGELOG.md +93 -0
- package/dist/agents/mastra/swarm.d.ts.map +1 -1
- package/dist/agents/mastra/swarm.js +11 -3
- package/dist/agents/mastra/swarm.js.map +1 -1
- package/dist/cache/file-cache.d.ts +13 -3
- package/dist/cache/file-cache.d.ts.map +1 -1
- package/dist/cache/file-cache.js +21 -8
- package/dist/cache/file-cache.js.map +1 -1
- package/dist/dead-code/detector.d.ts.map +1 -1
- package/dist/dead-code/detector.js +23 -4
- package/dist/dead-code/detector.js.map +1 -1
- package/dist/health-score/calculator.d.ts.map +1 -1
- package/dist/health-score/calculator.js +11 -1
- package/dist/health-score/calculator.js.map +1 -1
- package/dist/llm/ax-client.d.ts.map +1 -1
- package/dist/llm/ax-client.js +16 -0
- package/dist/llm/ax-client.js.map +1 -1
- package/dist/security-scan/scanner.d.ts.map +1 -1
- package/dist/security-scan/scanner.js +10 -30
- package/dist/security-scan/scanner.js.map +1 -1
- package/dist/specifica/generator.d.ts.map +1 -1
- package/dist/specifica/generator.js +11 -1
- package/dist/specifica/generator.js.map +1 -1
- package/dist/utils/file-skip.d.ts +44 -0
- package/dist/utils/file-skip.d.ts.map +1 -0
- package/dist/utils/file-skip.js +82 -0
- package/dist/utils/file-skip.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared pre-flight skip heuristics for file walkers.
|
|
3
|
+
*
|
|
4
|
+
* #53: Tree-sitter parses are SYNCHRONOUS inside the WASM module —
|
|
5
|
+
* pathological inputs (auto-generated type defs, vendored module
|
|
6
|
+
* loaders, large integration-test fixtures, deeply nested const
|
|
7
|
+
* initializers) wedge the JS event loop entirely. That defeats
|
|
8
|
+
* Promise-based withTimeout() since the setTimeout callback can't fire
|
|
9
|
+
* while the loop is blocked. We can't kill a wedged parse without
|
|
10
|
+
* worker_threads (real fix, larger scope).
|
|
11
|
+
*
|
|
12
|
+
* The pragmatic mitigation is a set of pre-flight skip heuristics that
|
|
13
|
+
* refuse pathological inputs before they reach the parser. These three
|
|
14
|
+
* caps cover the common offenders the user reported (deno-types.ts,
|
|
15
|
+
* monaco loader, *IT.java fixtures, ReadOnlyKerberos*Delegate.java):
|
|
16
|
+
*
|
|
17
|
+
* 1. File size > 1 MB — bundles, vendored output
|
|
18
|
+
* 2. Longest line > 50 000 chars — minified
|
|
19
|
+
* 3. Total lines > MAX_FILE_LINES — auto-generated mega-files
|
|
20
|
+
*
|
|
21
|
+
* All three caps can be overridden via env vars for advanced users:
|
|
22
|
+
* MAX_FILE_BYTES (default 1_000_000)
|
|
23
|
+
* MAX_LINE_LENGTH (default 50_000)
|
|
24
|
+
* MAX_FILE_LINES (default 50_000)
|
|
25
|
+
*/
|
|
26
|
+
export interface SkipResult {
|
|
27
|
+
/** True if the caller should skip this file (don't call analyze()). */
|
|
28
|
+
skip: boolean;
|
|
29
|
+
/** Human-readable reason for the skip, suitable for logging. */
|
|
30
|
+
reason?: string;
|
|
31
|
+
/** File content if it was already read (saves a re-read by the caller). */
|
|
32
|
+
content?: string;
|
|
33
|
+
/** Stat info if it was already collected. */
|
|
34
|
+
size?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Pre-flight skip check for a single file. Reads content as a side
|
|
38
|
+
* effect so the caller doesn't double-read.
|
|
39
|
+
*
|
|
40
|
+
* @returns `skip: false, content: '...'` when the file is safe to parse,
|
|
41
|
+
* or `skip: true, reason: '...'` when it should be refused.
|
|
42
|
+
*/
|
|
43
|
+
export declare function preFlightSkip(filePath: string): SkipResult;
|
|
44
|
+
//# sourceMappingURL=file-skip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-skip.d.ts","sourceRoot":"","sources":["../../src/utils/file-skip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,IAAI,EAAE,OAAO,CAAC;IACd,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CA+C1D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared pre-flight skip heuristics for file walkers.
|
|
3
|
+
*
|
|
4
|
+
* #53: Tree-sitter parses are SYNCHRONOUS inside the WASM module —
|
|
5
|
+
* pathological inputs (auto-generated type defs, vendored module
|
|
6
|
+
* loaders, large integration-test fixtures, deeply nested const
|
|
7
|
+
* initializers) wedge the JS event loop entirely. That defeats
|
|
8
|
+
* Promise-based withTimeout() since the setTimeout callback can't fire
|
|
9
|
+
* while the loop is blocked. We can't kill a wedged parse without
|
|
10
|
+
* worker_threads (real fix, larger scope).
|
|
11
|
+
*
|
|
12
|
+
* The pragmatic mitigation is a set of pre-flight skip heuristics that
|
|
13
|
+
* refuse pathological inputs before they reach the parser. These three
|
|
14
|
+
* caps cover the common offenders the user reported (deno-types.ts,
|
|
15
|
+
* monaco loader, *IT.java fixtures, ReadOnlyKerberos*Delegate.java):
|
|
16
|
+
*
|
|
17
|
+
* 1. File size > 1 MB — bundles, vendored output
|
|
18
|
+
* 2. Longest line > 50 000 chars — minified
|
|
19
|
+
* 3. Total lines > MAX_FILE_LINES — auto-generated mega-files
|
|
20
|
+
*
|
|
21
|
+
* All three caps can be overridden via env vars for advanced users:
|
|
22
|
+
* MAX_FILE_BYTES (default 1_000_000)
|
|
23
|
+
* MAX_LINE_LENGTH (default 50_000)
|
|
24
|
+
* MAX_FILE_LINES (default 50_000)
|
|
25
|
+
*/
|
|
26
|
+
import * as fs from 'fs';
|
|
27
|
+
const MAX_FILE_BYTES = () => parseInt(process.env.MAX_FILE_BYTES || '1000000', 10);
|
|
28
|
+
const MAX_LINE_LENGTH = () => parseInt(process.env.MAX_LINE_LENGTH || '50000', 10);
|
|
29
|
+
const MAX_FILE_LINES = () => parseInt(process.env.MAX_FILE_LINES || '50000', 10);
|
|
30
|
+
/**
|
|
31
|
+
* Pre-flight skip check for a single file. Reads content as a side
|
|
32
|
+
* effect so the caller doesn't double-read.
|
|
33
|
+
*
|
|
34
|
+
* @returns `skip: false, content: '...'` when the file is safe to parse,
|
|
35
|
+
* or `skip: true, reason: '...'` when it should be refused.
|
|
36
|
+
*/
|
|
37
|
+
export function preFlightSkip(filePath) {
|
|
38
|
+
let stat;
|
|
39
|
+
try {
|
|
40
|
+
stat = fs.statSync(filePath);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return { skip: true, reason: 'unreadable' };
|
|
44
|
+
}
|
|
45
|
+
const sizeMax = MAX_FILE_BYTES();
|
|
46
|
+
if (stat.size > sizeMax) {
|
|
47
|
+
return {
|
|
48
|
+
skip: true,
|
|
49
|
+
reason: `file too large (${(stat.size / 1024).toFixed(0)} KB > ${(sizeMax / 1024).toFixed(0)} KB; likely bundle/vendored)`,
|
|
50
|
+
size: stat.size,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
let content;
|
|
54
|
+
try {
|
|
55
|
+
content = fs.readFileSync(filePath, 'utf-8');
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return { skip: true, reason: 'unreadable' };
|
|
59
|
+
}
|
|
60
|
+
const lines = content.split('\n');
|
|
61
|
+
const lineMax = MAX_LINE_LENGTH();
|
|
62
|
+
const maxLineLength = lines.reduce((m, l) => Math.max(m, l.length), 0);
|
|
63
|
+
if (maxLineLength > lineMax) {
|
|
64
|
+
return {
|
|
65
|
+
skip: true,
|
|
66
|
+
reason: `line too long (${maxLineLength} chars > ${lineMax}; likely minified)`,
|
|
67
|
+
content,
|
|
68
|
+
size: stat.size,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const countMax = MAX_FILE_LINES();
|
|
72
|
+
if (lines.length > countMax) {
|
|
73
|
+
return {
|
|
74
|
+
skip: true,
|
|
75
|
+
reason: `too many lines (${lines.length} > ${countMax}; likely auto-generated)`,
|
|
76
|
+
content,
|
|
77
|
+
size: stat.size,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return { skip: false, content, size: stat.size };
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=file-skip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-skip.js","sourceRoot":"","sources":["../../src/utils/file-skip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAazB,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,SAAS,EAAE,EAAE,CAAC,CAAC;AACnF,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;AACnF,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;AAEjF;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,IAAI,IAAc,CAAC;IACnB,IAAI,CAAC;QACH,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM,OAAO,GAAG,cAAc,EAAE,CAA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