@windsland52/maa-log-tools 1.2.0 → 1.2.1
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/README.md +5 -6
- package/dist/cli.js +1 -1
- package/dist/runtimeInspection.d.ts +1 -2
- package/dist/runtimeInspection.js +14 -12
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -92,9 +92,8 @@ ambiguous tasks remain in `unscopedTasks` and produce a warning.
|
|
|
92
92
|
Use `--runtime-inspection` to emit this result directly from a file, zip, or directory. It is a
|
|
93
93
|
separate output mode from `--preflight`; the two flags are mutually exclusive.
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
file. Callers without segments leave these fields as `null`.
|
|
95
|
+
Each evidence position carries `source`, `path`, and `localLine` describing which original log
|
|
96
|
+
file the evidence came from and its 1-based line within that file. Segments are built by the Node
|
|
97
|
+
extraction helpers (`loadNodeLogDirectory`, `extractZipContentFromNodeFile`) when merging multiple
|
|
98
|
+
log files and are required by `buildRuntimeInspection`; `localLine` is the offset within the
|
|
99
|
+
individual source file, not the merged parser input line.
|
package/dist/cli.js
CHANGED
|
@@ -108,7 +108,7 @@ export const main = async () => {
|
|
|
108
108
|
? extractFrameworkSessions(await loadFrameworkLogSources(resolvedPath))
|
|
109
109
|
: EMPTY_FRAMEWORK_EXTRACTION;
|
|
110
110
|
let result = null;
|
|
111
|
-
let sourceSegments;
|
|
111
|
+
let sourceSegments = [];
|
|
112
112
|
if (targetStat.isDirectory()) {
|
|
113
113
|
const extracted = await loadNodeLogDirectory(resolvedPath);
|
|
114
114
|
if (extracted) {
|
|
@@ -3,7 +3,6 @@ import type { FrameworkSession, FrameworkSessionExtraction } from './frameworkVe
|
|
|
3
3
|
export declare const MLA_RUNTIME_INSPECTION_SCHEMA_VERSION = "mla-runtime-inspection/v1";
|
|
4
4
|
export interface RuntimeEvidencePosition {
|
|
5
5
|
timestamp: string | null;
|
|
6
|
-
parserInputLine: number | null;
|
|
7
6
|
source: string | null;
|
|
8
7
|
path: string | null;
|
|
9
8
|
localLine: number | null;
|
|
@@ -221,5 +220,5 @@ export interface RuntimeInspection {
|
|
|
221
220
|
signals: RuntimeSignal[];
|
|
222
221
|
warnings: string[];
|
|
223
222
|
}
|
|
224
|
-
export declare const buildRuntimeInspection: (output: KernelOutput, framework: FrameworkSessionExtraction, sourceSegments
|
|
223
|
+
export declare const buildRuntimeInspection: (output: KernelOutput, framework: FrameworkSessionExtraction, sourceSegments: readonly SourceSegment[]) => RuntimeInspection;
|
|
225
224
|
export {};
|
|
@@ -30,11 +30,11 @@ const evidence = (index, timestamp) => {
|
|
|
30
30
|
if (timestamp) {
|
|
31
31
|
const exactLine = index.exactLines.get(timestamp);
|
|
32
32
|
if (exactLine != null)
|
|
33
|
-
return { timestamp,
|
|
33
|
+
return { timestamp, mergedLine: exactLine };
|
|
34
34
|
}
|
|
35
35
|
const target = timestampMs(timestamp);
|
|
36
36
|
if (target == null || index.ordered.length === 0) {
|
|
37
|
-
return { timestamp: timestamp ?? null,
|
|
37
|
+
return { timestamp: timestamp ?? null, mergedLine: null };
|
|
38
38
|
}
|
|
39
39
|
let low = 0;
|
|
40
40
|
let high = index.ordered.length;
|
|
@@ -50,7 +50,7 @@ const evidence = (index, timestamp) => {
|
|
|
50
50
|
const nearest = before == null
|
|
51
51
|
? after
|
|
52
52
|
: after == null || target - before.timestamp <= after.timestamp - target ? before : after;
|
|
53
|
-
return { timestamp: timestamp ?? null,
|
|
53
|
+
return { timestamp: timestamp ?? null, mergedLine: nearest?.line ?? null };
|
|
54
54
|
};
|
|
55
55
|
const recognitionItems = (items) => ((items ?? []).flatMap(item => [
|
|
56
56
|
...(item.type === 'recognition' || item.type === 'recognition_node' ? [item] : []),
|
|
@@ -161,25 +161,27 @@ const canonicalCycle = (pattern) => {
|
|
|
161
161
|
rotations.sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right)));
|
|
162
162
|
return rotations[0] ?? [...pattern];
|
|
163
163
|
};
|
|
164
|
-
const findSourceSegment = (segments,
|
|
164
|
+
const findSourceSegment = (segments, mergedLine) => {
|
|
165
165
|
for (const segment of segments) {
|
|
166
|
-
if (
|
|
166
|
+
if (mergedLine >= segment.startLine && mergedLine < segment.startLine + segment.lineCount) {
|
|
167
167
|
return segment;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
return null;
|
|
171
171
|
};
|
|
172
172
|
const enrichWithSource = (position, segments) => {
|
|
173
|
-
if (
|
|
174
|
-
return position;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
if (position.mergedLine == null) {
|
|
174
|
+
return { timestamp: position.timestamp, source: null, path: null, localLine: null };
|
|
175
|
+
}
|
|
176
|
+
const segment = findSourceSegment(segments, position.mergedLine);
|
|
177
|
+
if (!segment) {
|
|
178
|
+
return { timestamp: position.timestamp, source: null, path: null, localLine: null };
|
|
179
|
+
}
|
|
178
180
|
return {
|
|
179
|
-
|
|
181
|
+
timestamp: position.timestamp,
|
|
180
182
|
source: segment.source,
|
|
181
183
|
path: segment.path,
|
|
182
|
-
localLine: position.
|
|
184
|
+
localLine: position.mergedLine - segment.startLine + 1,
|
|
183
185
|
};
|
|
184
186
|
};
|
|
185
187
|
const createEvidenceFn = (segments) => (index, timestamp) => enrichWithSource(evidence(index, timestamp), segments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windsland52/maa-log-tools",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"bin": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"fflate": "^0.8.2",
|
|
45
45
|
"@windsland52/maa-log-adapter": "1.0.1",
|
|
46
|
+
"@windsland52/maa-log-kernel": "1.0.1",
|
|
46
47
|
"@windsland52/maa-log-parser": "1.0.1",
|
|
47
|
-
"@windsland52/maa-log-runtime": "1.0.1"
|
|
48
|
-
"@windsland52/maa-log-kernel": "1.0.1"
|
|
48
|
+
"@windsland52/maa-log-runtime": "1.0.1"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=24.0.0"
|