@oneuptime/common 11.5.12 → 11.5.13
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/Models/DatabaseModels/AIInsight.ts +30 -0
- package/Models/DatabaseModels/Project.ts +30 -0
- package/Models/DatabaseModels/TelemetryException.ts +128 -0
- package/Server/API/AIAgentDataAPI.ts +129 -5
- package/Server/API/AIInvestigationAPI.ts +87 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1784640000000-AddExceptionTriageAndPrivacyColumns.ts +56 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Services/AIRunService.ts +8 -0
- package/Server/Services/TelemetryExceptionService.ts +320 -24
- package/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.ts +15 -4
- package/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.ts +15 -4
- package/Server/Utils/AI/SRE/Insights/InsightScanner.ts +222 -24
- package/Server/Utils/AI/SRE/Insights/InsightTriageRunner.ts +225 -9
- package/Server/Utils/AI/SRE/SubjectCodeFixRun.ts +39 -0
- package/Server/Utils/AI/SRE/TelemetryImprovementTaskTrigger.ts +114 -0
- package/Server/Utils/Telemetry/ExceptionSanitizer.ts +222 -0
- package/Tests/Server/Services/TelemetryExceptionCodeFixRun.test.ts +205 -1
- package/Tests/Server/Utils/AI/Insights/InsightScanner.test.ts +150 -141
- package/Tests/Server/Utils/AI/Insights/InsightTriageRunner.test.ts +277 -1
- package/Tests/Server/Utils/ExceptionSanitizer.test.ts +70 -0
- package/Tests/Server/Utils/InsightTriageClassification.test.ts +57 -0
- package/Tests/Server/Utils/TelemetryImprovementTaskTrigger.test.ts +141 -0
- package/Tests/UI/Components/ModelTableSelectFromColumns.test.ts +259 -0
- package/Types/AI/CodeFixTaskContext.ts +6 -0
- package/Types/AI/CodeFixTaskType.ts +38 -1
- package/Types/AI/ExceptionAIClassification.ts +27 -0
- package/Types/Log/LogScrubPatternType.ts +7 -0
- package/Types/Trace/TraceScrubPatternType.ts +7 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +15 -46
- package/UI/Components/ModelTable/SelectFromColumns.ts +129 -0
- package/build/dist/Models/DatabaseModels/AIInsight.js +31 -0
- package/build/dist/Models/DatabaseModels/AIInsight.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Project.js +31 -0
- package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js +134 -0
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
- package/build/dist/Server/API/AIAgentDataAPI.js +97 -8
- package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -1
- package/build/dist/Server/API/AIInvestigationAPI.js +55 -0
- package/build/dist/Server/API/AIInvestigationAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784640000000-AddExceptionTriageAndPrivacyColumns.js +33 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784640000000-AddExceptionTriageAndPrivacyColumns.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/AIRunService.js +9 -2
- package/build/dist/Server/Services/AIRunService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +263 -22
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.js +12 -4
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.js +12 -4
- package/build/dist/Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightScanner.js +193 -22
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightScanner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightTriageRunner.js +178 -9
- package/build/dist/Server/Utils/AI/SRE/Insights/InsightTriageRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/SubjectCodeFixRun.js +37 -0
- package/build/dist/Server/Utils/AI/SRE/SubjectCodeFixRun.js.map +1 -1
- package/build/dist/Server/Utils/AI/SRE/TelemetryImprovementTaskTrigger.js +98 -0
- package/build/dist/Server/Utils/AI/SRE/TelemetryImprovementTaskTrigger.js.map +1 -0
- package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js +149 -0
- package/build/dist/Server/Utils/Telemetry/ExceptionSanitizer.js.map +1 -0
- package/build/dist/Types/AI/CodeFixTaskType.js +38 -1
- package/build/dist/Types/AI/CodeFixTaskType.js.map +1 -1
- package/build/dist/Types/AI/ExceptionAIClassification.js +28 -0
- package/build/dist/Types/AI/ExceptionAIClassification.js.map +1 -0
- package/build/dist/Types/Log/LogScrubPatternType.js +7 -0
- package/build/dist/Types/Log/LogScrubPatternType.js.map +1 -1
- package/build/dist/Types/Trace/TraceScrubPatternType.js +7 -0
- package/build/dist/Types/Trace/TraceScrubPatternType.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +12 -37
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/ModelTable/SelectFromColumns.js +82 -0
- package/build/dist/UI/Components/ModelTable/SelectFromColumns.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExceptionSpikeDetector.js","sourceRoot":"","sources":["../../../../../../../../Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,SAAS,MAAM,gDAAgD,CAAC;AACvE,OAAO,SAAS,MAAM,gDAAgD,CAAC;AAGvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,iBAAiB,MAAM,8CAA8C,CAAC;AAG7E,OAAO,yBAAyB,MAAM,mDAAmD,CAAC;AAC1F,OAAO,wBAAwB,MAAM,kDAAkD,CAAC;AACxF,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,WAAW,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"ExceptionSpikeDetector.js","sourceRoot":"","sources":["../../../../../../../../Server/Utils/AI/SRE/Insights/Detectors/ExceptionSpikeDetector.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,SAAS,MAAM,gDAAgD,CAAC;AACvE,OAAO,SAAS,MAAM,gDAAgD,CAAC;AAGvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,iBAAiB,MAAM,8CAA8C,CAAC;AAG7E,OAAO,yBAAyB,MAAM,mDAAmD,CAAC;AAC1F,OAAO,wBAAwB,MAAM,kDAAkD,CAAC;AACxF,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,WAAW,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAOpF;;;;;;;;GAQG;AAEH,iEAAiE;AACjE,MAAM,CAAC,MAAM,mCAAmC,GAAW,CAAC,CAAC;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAW,EAAE,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAW,EAAE,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAW,CAAC,CAAC;AAExD,yEAAyE;AACzE,MAAM,CAAC,MAAM,wCAAwC,GAAW,EAAE,CAAC;AAEnE;;;;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AC/B,CAAC;CACF"}
|
|
@@ -5,6 +5,7 @@ import AIInsightSeverity from "../../../../../../Types/AI/AIInsightSeverity";
|
|
|
5
5
|
import TelemetryExceptionService from "../../../../../Services/TelemetryExceptionService";
|
|
6
6
|
import ServiceService from "../../../../../Services/ServiceService";
|
|
7
7
|
import QueryHelper from "../../../../../Types/Database/QueryHelper";
|
|
8
|
+
import { sanitizeExceptionMessage } from "../../../../Telemetry/ExceptionSanitizer";
|
|
8
9
|
/*
|
|
9
10
|
* NewException — a brand-new failure mode in the code: a telemetry
|
|
10
11
|
* exception group whose FIRST occurrence is inside the lookback window and
|
|
@@ -119,7 +120,14 @@ export default class NewExceptionDetector {
|
|
|
119
120
|
continue;
|
|
120
121
|
}
|
|
121
122
|
const serviceName = await this.resolveServiceName(exception.primaryEntityId);
|
|
122
|
-
|
|
123
|
+
/*
|
|
124
|
+
* The message flows into the insight title/detail/evidence, and from
|
|
125
|
+
* there into the triage LLM prompt — sanitize it once here so no
|
|
126
|
+
* interpolated user data (IDs, emails, domains) rides along. The raw
|
|
127
|
+
* message stays on the exception row for the dashboard.
|
|
128
|
+
*/
|
|
129
|
+
const safeMessage = sanitizeExceptionMessage(exception.message || "");
|
|
130
|
+
const label = NewExceptionDetector.buildExceptionLabel(exception.exceptionType, safeMessage);
|
|
123
131
|
const firstSeenAtIso = exception.firstSeenAt
|
|
124
132
|
? exception.firstSeenAt.toISOString()
|
|
125
133
|
: undefined;
|
|
@@ -128,8 +136,8 @@ export default class NewExceptionDetector {
|
|
|
128
136
|
"",
|
|
129
137
|
`- Exception: \`${label}\``,
|
|
130
138
|
];
|
|
131
|
-
if (
|
|
132
|
-
detailLines.push(`- Message: ${
|
|
139
|
+
if (safeMessage) {
|
|
140
|
+
detailLines.push(`- Message: ${safeMessage}`);
|
|
133
141
|
}
|
|
134
142
|
if (serviceName) {
|
|
135
143
|
detailLines.push(`- Service: ${serviceName}`);
|
|
@@ -146,7 +154,7 @@ export default class NewExceptionDetector {
|
|
|
146
154
|
telemetryExceptionId: exception.id,
|
|
147
155
|
evidence: {
|
|
148
156
|
exception: {
|
|
149
|
-
exceptionMessage:
|
|
157
|
+
exceptionMessage: safeMessage,
|
|
150
158
|
exceptionType: exception.exceptionType,
|
|
151
159
|
totalOccurrenceCount: occurrenceCount,
|
|
152
160
|
firstSeenAt: firstSeenAtIso,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NewExceptionDetector.js","sourceRoot":"","sources":["../../../../../../../../Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,SAAS,MAAM,gDAAgD,CAAC;AAEvE,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,iBAAiB,MAAM,8CAA8C,CAAC;AAG7E,OAAO,yBAAyB,MAAM,mDAAmD,CAAC;AAC1F,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,WAAW,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"NewExceptionDetector.js","sourceRoot":"","sources":["../../../../../../../../Server/Utils/AI/SRE/Insights/Detectors/NewExceptionDetector.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,SAAS,MAAM,gDAAgD,CAAC;AAEvE,OAAO,aAAa,MAAM,0CAA0C,CAAC;AACrE,OAAO,iBAAiB,MAAM,8CAA8C,CAAC;AAG7E,OAAO,yBAAyB,MAAM,mDAAmD,CAAC;AAC1F,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,WAAW,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAOpF;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAW,EAAE,CAAC;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAW,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C,SAAS;gBACvE,oBAAoB,EAAE,SAAS,CAAC,EAAE;gBAClC,QAAQ,EAAE;oBACR,SAAS,EAAE;wBACT,gBAAgB,EAAE,WAAW;wBAC7B,aAAa,EAAE,SAAS,CAAC,aAAa;wBACtC,oBAAoB,EAAE,eAAe;wBACrC,WAAW,EAAE,cAAc;qBAC5B;iBACF;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,kBAAkB,CAC9B,eAAqC;QAErC,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,OAAO,GAAmB,MAAM,cAAc,CAAC,WAAW,CAAC;YAC/D,EAAE,EAAE,eAAe;YACnB,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;YACtB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACxB,CAAC,CAAC;QACH,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,KAAI,IAAI,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -17,6 +17,12 @@ import InsightDetectors from "./Detectors/Index";
|
|
|
17
17
|
import InsightStore from "./InsightStore";
|
|
18
18
|
import InsightFixRouting from "./FixRouting";
|
|
19
19
|
import InsightTriage from "./Triage";
|
|
20
|
+
import AIInsightType from "../../../../../Types/AI/AIInsightType";
|
|
21
|
+
import AIRunType from "../../../../../Types/AI/AIRunType";
|
|
22
|
+
import AIRunStatus from "../../../../../Types/AI/AIRunStatus";
|
|
23
|
+
import ExceptionAIClassification from "../../../../../Types/AI/ExceptionAIClassification";
|
|
24
|
+
import AIRunService from "../../../../Services/AIRunService";
|
|
25
|
+
import QueryHelper from "../../../../Types/Database/QueryHelper";
|
|
20
26
|
import logger from "../../../Logger";
|
|
21
27
|
import CaptureSpan from "../../../Telemetry/CaptureSpan";
|
|
22
28
|
/*
|
|
@@ -24,8 +30,9 @@ import CaptureSpan from "../../../Telemetry/CaptureSpan";
|
|
|
24
30
|
*
|
|
25
31
|
* THE RULE: no LLM here. Detectors are deterministic statistical sensors;
|
|
26
32
|
* the LLM only engages per-finding AFTERWARDS through InsightTriage
|
|
27
|
-
* (budgeted, read-only)
|
|
28
|
-
*
|
|
33
|
+
* (budgeted, read-only). The automatic fix decision happens after triage
|
|
34
|
+
* completes (InsightTriageRunner → InsightFixRouting) and only for
|
|
35
|
+
* insights the triage classified as code faults.
|
|
29
36
|
*
|
|
30
37
|
* Everything is opt-in and quiet: only projects with the default-false
|
|
31
38
|
* enableAiInsights flag are scanned, insights never page and never
|
|
@@ -73,8 +80,8 @@ export default class InsightScanner {
|
|
|
73
80
|
* One project's scan: self-heal any insight an earlier tick left unrouted,
|
|
74
81
|
* run every registered detector (isolated — one failing sensor must not
|
|
75
82
|
* blind the others), dedupe/upsert the candidates through InsightStore,
|
|
76
|
-
* then route each NEWLY created insight to
|
|
77
|
-
*
|
|
83
|
+
* then route each NEWLY created insight to ActionRequired and enqueue its
|
|
84
|
+
* triage (which, on a code-fault verdict, routes the fix).
|
|
78
85
|
*/
|
|
79
86
|
static async scanProjectForInsights(project) {
|
|
80
87
|
var _a;
|
|
@@ -189,32 +196,196 @@ export default class InsightScanner {
|
|
|
189
196
|
logger.error(`AI Insights: re-routing failed for stranded insight ${(_a = insight.id) === null || _a === void 0 ? void 0 : _a.toString()} (project ${projectId.toString()}) — continuing with the remaining stranded insights: ${error}`);
|
|
190
197
|
}
|
|
191
198
|
}
|
|
199
|
+
await this.resweepUntriagedInsights({ projectId });
|
|
200
|
+
await this.resweepUnroutedCodeFaults({ projectId, project });
|
|
201
|
+
}
|
|
202
|
+
/*
|
|
203
|
+
* Stranded shape 2: ActionRequired insights that never got a triage
|
|
204
|
+
* verdict. With triage gating the automatic fix, a triage that was
|
|
205
|
+
* quiet-skipped (token budget exhausted), expired in the queue, or
|
|
206
|
+
* failed would otherwise strand the insight verdict-less FOREVER — and
|
|
207
|
+
* with it any automatic fix. Re-enqueueing is safe and cheap: the
|
|
208
|
+
* triage enqueue dedupes to one non-terminal run per insight and
|
|
209
|
+
* quiet-skips when the budget still has no headroom. Bounded two ways:
|
|
210
|
+
* only insights from the last 7 days (older rows predate the verdict
|
|
211
|
+
* gate or were consciously left alone), and only while fewer than 3
|
|
212
|
+
* triage attempts have ended in failure (a permanently failing triage
|
|
213
|
+
* must not retry every 15 minutes for a week).
|
|
214
|
+
*/
|
|
215
|
+
static async resweepUntriagedInsights(data) {
|
|
216
|
+
var _a;
|
|
217
|
+
const { projectId } = data;
|
|
218
|
+
try {
|
|
219
|
+
const untriaged = await AIInsightService.findBy({
|
|
220
|
+
query: {
|
|
221
|
+
projectId: projectId,
|
|
222
|
+
status: AIInsightStatus.ActionRequired,
|
|
223
|
+
triageCompletedAt: QueryHelper.isNull(),
|
|
224
|
+
createdAt: QueryHelper.greaterThanEqualTo(OneUptimeDate.addRemoveDays(OneUptimeDate.getCurrentDate(), -7)),
|
|
225
|
+
},
|
|
226
|
+
select: {
|
|
227
|
+
_id: true,
|
|
228
|
+
projectId: true,
|
|
229
|
+
insightType: true,
|
|
230
|
+
serviceName: true,
|
|
231
|
+
traceId: true,
|
|
232
|
+
telemetryExceptionId: true,
|
|
233
|
+
evidence: true,
|
|
234
|
+
},
|
|
235
|
+
limit: LIMIT_MAX,
|
|
236
|
+
skip: 0,
|
|
237
|
+
props: { isRoot: true },
|
|
238
|
+
});
|
|
239
|
+
for (const insight of untriaged) {
|
|
240
|
+
try {
|
|
241
|
+
const failedTriageAttempts = (await AIRunService.countBy({
|
|
242
|
+
query: {
|
|
243
|
+
runType: AIRunType.Investigation,
|
|
244
|
+
triggeredByAiInsightId: insight.id,
|
|
245
|
+
status: QueryHelper.any([
|
|
246
|
+
AIRunStatus.Error,
|
|
247
|
+
AIRunStatus.Cancelled,
|
|
248
|
+
AIRunStatus.Stale,
|
|
249
|
+
]),
|
|
250
|
+
},
|
|
251
|
+
props: { isRoot: true },
|
|
252
|
+
})).toNumber();
|
|
253
|
+
if (failedTriageAttempts >= 3) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const triageResult = await InsightTriage.enqueueInsightTriage({ insight: insight });
|
|
257
|
+
if (triageResult.triageAiRunId) {
|
|
258
|
+
await AIInsightService.updateOneById({
|
|
259
|
+
id: insight.id,
|
|
260
|
+
data: {
|
|
261
|
+
triageAiRunId: triageResult.triageAiRunId,
|
|
262
|
+
},
|
|
263
|
+
props: { isRoot: true },
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
logger.error(`AI Insights: triage re-enqueue failed for insight ${(_a = insight.id) === null || _a === void 0 ? void 0 : _a.toString()} — continuing: ${error}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
logger.error(`AI Insights: failed to sweep untriaged insights for project ${projectId.toString()} — continuing with the scan: ${error}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/*
|
|
277
|
+
* Stranded shape 3: a code-fault verdict was recorded but the fix was
|
|
278
|
+
* never routed — the pod died between the verdict write and the fix
|
|
279
|
+
* routing, or routing quiet-skipped on a transient gate (daily fix
|
|
280
|
+
* budget, readiness). Re-routing is idempotent: the creation path's
|
|
281
|
+
* per-(exception, recipe) dedupe and the cross-group guard refuse
|
|
282
|
+
* duplicates, and the conditional status flip only moves
|
|
283
|
+
* ActionRequired → FixOpened. Bounded to verdicts from the last 24
|
|
284
|
+
* hours so a permanently refused group (declined by a human, capped
|
|
285
|
+
* repo) does not retry forever. Latency insights are excluded — they
|
|
286
|
+
* are fix-routed deterministically at scan time.
|
|
287
|
+
*/
|
|
288
|
+
static async resweepUnroutedCodeFaults(data) {
|
|
289
|
+
var _a;
|
|
290
|
+
const { projectId, project } = data;
|
|
291
|
+
try {
|
|
292
|
+
const unrouted = await AIInsightService.findBy({
|
|
293
|
+
query: {
|
|
294
|
+
projectId: projectId,
|
|
295
|
+
status: AIInsightStatus.ActionRequired,
|
|
296
|
+
classification: ExceptionAIClassification.CodeFault,
|
|
297
|
+
fixAiRunId: QueryHelper.isNull(),
|
|
298
|
+
triageCompletedAt: QueryHelper.greaterThanEqualTo(OneUptimeDate.addRemoveDays(OneUptimeDate.getCurrentDate(), -1)),
|
|
299
|
+
},
|
|
300
|
+
select: {
|
|
301
|
+
_id: true,
|
|
302
|
+
projectId: true,
|
|
303
|
+
insightType: true,
|
|
304
|
+
serviceName: true,
|
|
305
|
+
traceId: true,
|
|
306
|
+
telemetryExceptionId: true,
|
|
307
|
+
evidence: true,
|
|
308
|
+
},
|
|
309
|
+
limit: LIMIT_MAX,
|
|
310
|
+
skip: 0,
|
|
311
|
+
props: { isRoot: true },
|
|
312
|
+
});
|
|
313
|
+
for (const insight of unrouted) {
|
|
314
|
+
if (insight.insightType === AIInsightType.TraceLatencyRegression) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
const fixResult = await InsightFixRouting.routeInsightFix({
|
|
319
|
+
insight: insight,
|
|
320
|
+
project: project,
|
|
321
|
+
});
|
|
322
|
+
if (fixResult.fixAiRunId) {
|
|
323
|
+
await AIInsightService.updateOneBy({
|
|
324
|
+
query: {
|
|
325
|
+
_id: insight.id.toString(),
|
|
326
|
+
status: AIInsightStatus.ActionRequired,
|
|
327
|
+
},
|
|
328
|
+
data: {
|
|
329
|
+
status: AIInsightStatus.FixOpened,
|
|
330
|
+
fixAiRunId: fixResult.fixAiRunId,
|
|
331
|
+
},
|
|
332
|
+
props: { isRoot: true },
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
logger.error(`AI Insights: fix re-routing failed for insight ${(_a = insight.id) === null || _a === void 0 ? void 0 : _a.toString()} — continuing: ${error}`);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
logger.error(`AI Insights: failed to sweep unrouted code-fault insights for project ${projectId.toString()} — continuing with the scan: ${error}`);
|
|
343
|
+
}
|
|
192
344
|
}
|
|
193
345
|
/*
|
|
194
346
|
* Route one insight — newly created this tick, or swept up as stranded
|
|
195
|
-
* from an earlier one — out of the defensive Detected state
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
347
|
+
* from an earlier one — out of the defensive Detected state.
|
|
348
|
+
*
|
|
349
|
+
* TRIAGE GATES THE FIX. The automatic fix decision no longer happens
|
|
350
|
+
* here: every new insight goes to ActionRequired and gets its triage
|
|
351
|
+
* enqueued; when the triage run completes with a code-fault
|
|
352
|
+
* classification, InsightTriageRunner routes the fix (via
|
|
353
|
+
* InsightFixRouting) and flips the insight to FixOpened. This exists
|
|
354
|
+
* because roughly half of real exception insights turn out to be
|
|
355
|
+
* expected user errors or intentional denials (auth, paywalls, scanner
|
|
356
|
+
* probes) — opening an unreviewed fix PR for those is worse than
|
|
357
|
+
* opening none: the agent's only "fix" is to weaken the check that
|
|
358
|
+
* correctly fired. Fail-closed by design: no triage verdict, no
|
|
359
|
+
* automatic PR. The manual "Fix with AI" button on the exception page
|
|
360
|
+
* is unaffected.
|
|
361
|
+
*
|
|
362
|
+
* The collaborator is never-throws by contract, but it is wrapped
|
|
363
|
+
* anyway: a contract breach must degrade (no triage), not leave the
|
|
364
|
+
* insight stuck in Detected or fail the scan.
|
|
204
365
|
*/
|
|
205
366
|
static async routeNewInsight(data) {
|
|
206
367
|
var _a, _b;
|
|
207
368
|
const { insight, project } = data;
|
|
369
|
+
/*
|
|
370
|
+
* TraceLatencyRegression keeps DETERMINISTIC scan-time fix routing:
|
|
371
|
+
* its evidence is the SpanTreeAnalyzer's own findings (N+1, dominant
|
|
372
|
+
* span, sequential fan-out) — no LLM verdict adds signal there, and
|
|
373
|
+
* the exception-centric classification taxonomy would mislabel most
|
|
374
|
+
* latency regressions as "infrastructure". Exception insights go
|
|
375
|
+
* through the verdict gate instead.
|
|
376
|
+
*/
|
|
208
377
|
let fixAiRunId = undefined;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
378
|
+
if (insight.insightType === AIInsightType.TraceLatencyRegression) {
|
|
379
|
+
try {
|
|
380
|
+
const fixResult = await InsightFixRouting.routeInsightFix({
|
|
381
|
+
insight: insight,
|
|
382
|
+
project: project,
|
|
383
|
+
});
|
|
384
|
+
fixAiRunId = fixResult.fixAiRunId;
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
logger.error(`AI Insights: fix routing threw for latency insight ${(_a = insight.id) === null || _a === void 0 ? void 0 : _a.toString()} (treating as no fix opened): ${error}`);
|
|
388
|
+
}
|
|
218
389
|
}
|
|
219
390
|
if (fixAiRunId) {
|
|
220
391
|
await AIInsightService.updateOneById({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightScanner.js","sourceRoot":"","sources":["../../../../../../../Server/Utils/AI/SRE/Insights/InsightScanner.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,SAAS,MAAM,wCAAwC,CAAC;AAC/D,OAAO,OAAO,MAAM,8CAA8C,CAAC;AAEnE,OAAO,eAAe,MAAM,yCAAyC,CAAC;AACtE,OAAO,cAAc,MAAM,qCAAqC,CAAC;AACjE,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AACrE,OAAO,gBAAgB,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAwC,MAAM,gBAAgB,CAAC;AACtE,OAAO,iBAA8C,MAAM,cAAc,CAAC;AAC1E,OAAO,aAAsC,MAAM,UAAU,CAAC;AAE9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACr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E,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACjE,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CACV,iDAAiD,MAAA,OAAO,CAAC,EAAE,0CAAE,QAAQ,EAAE,iCAAiC,KAAK,EAAE,CAChH,CAAC;QACJ,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,gBAAgB,CAAC,aAAa,CAAC;gBACnC,EAAE,EAAE,OAAO,CAAC,EAAG;gBACf,IAAI,EAAE;oBACJ,aAAa,EAAE,aAAa;iBAC7B;gBACD,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;aACxB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA1bqB;IADnB,WAAW,EAAE;;;;2CAgCb;AAUmB;IADnB,WAAW,EAAE;;qCACsC,OAAO;;kDAkE1D"}
|
|
@@ -8,10 +8,17 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import OneUptimeDate from "../../../../../Types/Date";
|
|
11
|
+
import AIInsightStatus, { AIInsightStatusHelper, } from "../../../../../Types/AI/AIInsightStatus";
|
|
12
|
+
import AIInsightType from "../../../../../Types/AI/AIInsightType";
|
|
13
|
+
import ExceptionAIClassification from "../../../../../Types/AI/ExceptionAIClassification";
|
|
11
14
|
import AIInsightService from "../../../../Services/AIInsightService";
|
|
15
|
+
import ProjectService from "../../../../Services/ProjectService";
|
|
16
|
+
import TelemetryExceptionService from "../../../../Services/TelemetryExceptionService";
|
|
12
17
|
import { AI_INSIGHT_TRIAGE_FEATURE } from "../../../../Services/AIService";
|
|
13
18
|
import AIInvestigationEngine from "../AIInvestigationEngine";
|
|
14
19
|
import AIInvestigationQueue from "../InvestigationQueue";
|
|
20
|
+
import InsightFixRouting from "./FixRouting";
|
|
21
|
+
import ToolResultSerializer from "../../Toolbox/Serializer";
|
|
15
22
|
import logger from "../../../Logger";
|
|
16
23
|
import CaptureSpan from "../../../Telemetry/CaptureSpan";
|
|
17
24
|
/*
|
|
@@ -45,7 +52,17 @@ const PREVENTIVE_TRIAGE_FRAMING = `IMPORTANT — this is PREVENTIVE TRIAGE, not
|
|
|
45
52
|
- Establish the most likely root cause of the finding.
|
|
46
53
|
- Estimate the blast radius: which services/users/operations are affected, and how badly.
|
|
47
54
|
- Recommend exactly ONE next action (the single most useful thing an engineer should do first).
|
|
48
|
-
Cite the evidence for every factual claim. If the telemetry cannot support a conclusion, say so plainly. Do not refer to "the incident" — there is none
|
|
55
|
+
Cite the evidence for every factual claim. If the telemetry cannot support a conclusion, say so plainly. Do not refer to "the incident" — there is none.
|
|
56
|
+
|
|
57
|
+
CLASSIFICATION — you MUST end your analysis with one line in EXACTLY this format, on its own line, with nothing after it:
|
|
58
|
+
Classification: <verdict>
|
|
59
|
+
where <verdict> is exactly one of: code-fault, user-error, expected-denial, infrastructure, unknown.
|
|
60
|
+
- code-fault: a defect in the monitored code that a code change should fix.
|
|
61
|
+
- user-error: an expected consequence of invalid end-user input (bad parameters, malformed values, garbage in a URL). The code rejected it correctly; the input was wrong.
|
|
62
|
+
- expected-denial: an intentional check doing its job — authentication/authorization failures, plan or paywall rejections, rate limits, or security scanners/fuzzers tripping validation on purpose-built probes.
|
|
63
|
+
- infrastructure: an environmental condition (network timeout, connection reset, resource exhaustion, dependency outage) rather than a logic defect.
|
|
64
|
+
- unknown: the evidence does not support a confident verdict.
|
|
65
|
+
This verdict gates automation: ONLY code-fault findings may get an automatic fix pull request, so classify conservatively — when torn between code-fault and anything else, pick the other one.`;
|
|
49
66
|
export default class InsightTriageRunner {
|
|
50
67
|
/*
|
|
51
68
|
* Execute a claimed triage run: load the insight, build its description
|
|
@@ -56,11 +73,13 @@ export default class InsightTriageRunner {
|
|
|
56
73
|
static async executeTriage(data) {
|
|
57
74
|
const { aiRunId, projectId, sentinelInsightId, attemptCount } = data;
|
|
58
75
|
let contextSummary;
|
|
76
|
+
let insight = null;
|
|
59
77
|
try {
|
|
60
|
-
|
|
78
|
+
insight = await AIInsightService.findOneById({
|
|
61
79
|
id: sentinelInsightId,
|
|
62
80
|
select: {
|
|
63
81
|
_id: true,
|
|
82
|
+
projectId: true,
|
|
64
83
|
insightType: true,
|
|
65
84
|
severity: true,
|
|
66
85
|
title: true,
|
|
@@ -68,6 +87,7 @@ export default class InsightTriageRunner {
|
|
|
68
87
|
evidence: true,
|
|
69
88
|
serviceName: true,
|
|
70
89
|
traceId: true,
|
|
90
|
+
telemetryExceptionId: true,
|
|
71
91
|
metricName: true,
|
|
72
92
|
firstSeenAt: true,
|
|
73
93
|
lastSeenAt: true,
|
|
@@ -101,25 +121,168 @@ export default class InsightTriageRunner {
|
|
|
101
121
|
feature: AI_INSIGHT_TRIAGE_FEATURE,
|
|
102
122
|
contextSummary,
|
|
103
123
|
postAnalysis: async (postData) => {
|
|
124
|
+
const classification = this.parseClassification(postData.analysisMarkdown);
|
|
104
125
|
/*
|
|
105
|
-
* The quiet inbox —
|
|
106
|
-
* no workspace notification, no owner/on-call
|
|
107
|
-
* and no instrumentation-task trigger. Insights
|
|
108
|
-
* never enter the notification pipeline
|
|
109
|
-
* the summary waits on the Insights page
|
|
126
|
+
* The quiet inbox — the summary and verdict land on the insight
|
|
127
|
+
* row: no feed items, no workspace notification, no owner/on-call
|
|
128
|
+
* ping, no metrics, and no instrumentation-task trigger. Insights
|
|
129
|
+
* never page and never enter the notification pipeline
|
|
130
|
+
* (Preventive-lane rule); the summary waits on the Insights page
|
|
131
|
+
* until a human looks.
|
|
110
132
|
*/
|
|
111
133
|
await AIInsightService.updateOneById({
|
|
112
134
|
id: sentinelInsightId,
|
|
113
135
|
data: {
|
|
114
136
|
triageSummaryMarkdown: postData.analysisMarkdown,
|
|
115
137
|
triageCompletedAt: OneUptimeDate.getCurrentDate(),
|
|
138
|
+
classification: classification,
|
|
116
139
|
},
|
|
117
140
|
props: { isRoot: true },
|
|
118
141
|
});
|
|
119
|
-
logger.debug(`AI insights: triage summary posted for insight ${sentinelInsightId.toString()} (run ${aiRunId.toString()}, confident=${postData.confidence.confident} via ${postData.confidence.source}).`);
|
|
142
|
+
logger.debug(`AI insights: triage summary posted for insight ${sentinelInsightId.toString()} (run ${aiRunId.toString()}, classification=${classification}, confident=${postData.confidence.confident} via ${postData.confidence.source}).`);
|
|
143
|
+
/*
|
|
144
|
+
* Verdict-driven follow-through. Best-effort by design: the
|
|
145
|
+
* triage summary is already posted, and a failure here must not
|
|
146
|
+
* fail the triage run itself.
|
|
147
|
+
*/
|
|
148
|
+
try {
|
|
149
|
+
await this.actOnClassification({
|
|
150
|
+
insight: insight,
|
|
151
|
+
classification: classification,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
logger.error(`AI insights: post-triage action failed for insight ${sentinelInsightId.toString()} (verdict ${classification}): ${error}`);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/*
|
|
162
|
+
* Parse the mandatory trailing "Classification: <verdict>" line out of
|
|
163
|
+
* the triage analysis. The LAST match wins (the model may discuss the
|
|
164
|
+
* taxonomy earlier in its reasoning). Anything unparseable is Unknown —
|
|
165
|
+
* and Unknown never routes a fix, so a malformed answer fails closed.
|
|
166
|
+
*/
|
|
167
|
+
static parseClassification(analysisMarkdown) {
|
|
168
|
+
const matches = Array.from((analysisMarkdown || "").matchAll(/^\s*\**\s*classification\s*\**\s*[:=]\s*\**\s*(code-fault|user-error|expected-denial|infrastructure|unknown)\b/gim));
|
|
169
|
+
const last = matches[matches.length - 1];
|
|
170
|
+
if (!last || !last[1]) {
|
|
171
|
+
return ExceptionAIClassification.Unknown;
|
|
172
|
+
}
|
|
173
|
+
return last[1].toLowerCase();
|
|
174
|
+
}
|
|
175
|
+
/*
|
|
176
|
+
* Act on the triage verdict:
|
|
177
|
+
*
|
|
178
|
+
* 1. Stamp the verdict onto the exception group row (aiClassification)
|
|
179
|
+
* so the exceptions list can filter on it and the fix lane can skip
|
|
180
|
+
* known-non-defects without re-triaging.
|
|
181
|
+
* 2. code-fault → route the automatic fix (InsightFixRouting owns every
|
|
182
|
+
* gate: enableAi, enableInsightFixTasks, budget, readiness, dedupe)
|
|
183
|
+
* and flip the insight to FixOpened when a run was queued.
|
|
184
|
+
* 3. expected-denial → optionally auto-archive the exception group when
|
|
185
|
+
* the project opted in (autoArchiveNonActionableExceptions). Only
|
|
186
|
+
* expected denials are archived — user errors and infrastructure
|
|
187
|
+
* conditions stay visible for a human to judge.
|
|
188
|
+
*/
|
|
189
|
+
static async actOnClassification(data) {
|
|
190
|
+
const { insight, classification } = data;
|
|
191
|
+
if (!insight.id || !insight.projectId) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
/*
|
|
195
|
+
* The verdict stamp on the exception group is metadata and always
|
|
196
|
+
* lands; the AUTOMATION below (fix PR, auto-archive) additionally
|
|
197
|
+
* requires that no human closed the insight while the triage run sat
|
|
198
|
+
* in the queue or executed. The `insight` object is a snapshot from
|
|
199
|
+
* claim time — minutes to half an hour old — so the status MUST be
|
|
200
|
+
* re-read here: an insight a human Dismissed or Resolved in the
|
|
201
|
+
* meantime gets no PR and keeps its terminal status.
|
|
202
|
+
*/
|
|
203
|
+
if (insight.telemetryExceptionId) {
|
|
204
|
+
await TelemetryExceptionService.updateOneById({
|
|
205
|
+
id: insight.telemetryExceptionId,
|
|
206
|
+
data: {
|
|
207
|
+
aiClassification: classification,
|
|
120
208
|
},
|
|
209
|
+
props: { isRoot: true },
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
const currentInsight = await AIInsightService.findOneById({
|
|
213
|
+
id: insight.id,
|
|
214
|
+
select: {
|
|
215
|
+
_id: true,
|
|
216
|
+
status: true,
|
|
217
|
+
},
|
|
218
|
+
props: { isRoot: true },
|
|
219
|
+
});
|
|
220
|
+
if (!currentInsight ||
|
|
221
|
+
(currentInsight.status &&
|
|
222
|
+
AIInsightStatusHelper.isTerminalStatus(currentInsight.status))) {
|
|
223
|
+
logger.debug(`AI insights: skipping post-triage automation for insight ${insight.id.toString()} — insight is ${(currentInsight === null || currentInsight === void 0 ? void 0 : currentInsight.status) || "deleted"}.`);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const project = await ProjectService.findOneById({
|
|
227
|
+
id: insight.projectId,
|
|
228
|
+
select: {
|
|
229
|
+
_id: true,
|
|
230
|
+
enableAi: true,
|
|
231
|
+
enableInsightFixTasks: true,
|
|
232
|
+
autoArchiveNonActionableExceptions: true,
|
|
121
233
|
},
|
|
234
|
+
props: { isRoot: true },
|
|
122
235
|
});
|
|
236
|
+
if (!project) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
/*
|
|
240
|
+
* TraceLatencyRegression insights are fix-routed DETERMINISTICALLY at
|
|
241
|
+
* scan time (their span-tree evidence needs no LLM verdict — see
|
|
242
|
+
* InsightScanner.routeNewInsight); routing them again here would
|
|
243
|
+
* duplicate the run/PR. The verdict gate applies to exception
|
|
244
|
+
* insights only.
|
|
245
|
+
*/
|
|
246
|
+
const isVerdictGatedInsight = insight.insightType !== AIInsightType.TraceLatencyRegression;
|
|
247
|
+
if (classification === ExceptionAIClassification.CodeFault &&
|
|
248
|
+
isVerdictGatedInsight) {
|
|
249
|
+
const fixResult = await InsightFixRouting.routeInsightFix({
|
|
250
|
+
insight: insight,
|
|
251
|
+
project: project,
|
|
252
|
+
});
|
|
253
|
+
if (fixResult.fixAiRunId) {
|
|
254
|
+
/*
|
|
255
|
+
* Conditional flip: only a still-ActionRequired insight moves to
|
|
256
|
+
* FixOpened, so a dismissal landing between the status re-read
|
|
257
|
+
* above and this write can never be clobbered.
|
|
258
|
+
*/
|
|
259
|
+
await AIInsightService.updateOneBy({
|
|
260
|
+
query: {
|
|
261
|
+
_id: insight.id.toString(),
|
|
262
|
+
status: AIInsightStatus.ActionRequired,
|
|
263
|
+
},
|
|
264
|
+
data: {
|
|
265
|
+
status: AIInsightStatus.FixOpened,
|
|
266
|
+
fixAiRunId: fixResult.fixAiRunId,
|
|
267
|
+
},
|
|
268
|
+
props: { isRoot: true },
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (classification === ExceptionAIClassification.ExpectedDenial &&
|
|
274
|
+
project.autoArchiveNonActionableExceptions === true &&
|
|
275
|
+
insight.telemetryExceptionId) {
|
|
276
|
+
await TelemetryExceptionService.updateOneById({
|
|
277
|
+
id: insight.telemetryExceptionId,
|
|
278
|
+
data: {
|
|
279
|
+
isArchived: true,
|
|
280
|
+
markedAsArchivedAt: OneUptimeDate.getCurrentDate(),
|
|
281
|
+
},
|
|
282
|
+
props: { isRoot: true },
|
|
283
|
+
});
|
|
284
|
+
logger.debug(`AI insights: auto-archived exception ${insight.telemetryExceptionId.toString()} (expected-denial verdict, project opted in).`);
|
|
285
|
+
}
|
|
123
286
|
}
|
|
124
287
|
// Build the compact insight record that seeds the triage.
|
|
125
288
|
static buildInsightSummary(insight) {
|
|
@@ -159,7 +322,13 @@ export default class InsightTriageRunner {
|
|
|
159
322
|
lines.push("## Raw evidence values");
|
|
160
323
|
lines.push(renderedEvidence);
|
|
161
324
|
}
|
|
162
|
-
|
|
325
|
+
/*
|
|
326
|
+
* Detector detailMarkdown and evidence quote raw exception messages —
|
|
327
|
+
* sweep secrets/PII before the text reaches the LLM provider. (The
|
|
328
|
+
* chat/investigation toolbox path already redacts its tool results;
|
|
329
|
+
* this closes the same gap for the detector-supplied context.)
|
|
330
|
+
*/
|
|
331
|
+
return ToolResultSerializer.redact(lines.join("\n")).text;
|
|
163
332
|
}
|
|
164
333
|
/*
|
|
165
334
|
* Render the stored evidence JSON compactly: one line per populated
|