@agimon-ai/po-log 0.0.0-alpha.195 → 0.0.0-alpha.196
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,4 +1,4 @@
|
|
|
1
|
-
import { defineNativePlugin, defineToolRenderer } from "@agimon-ai/po-core/native";
|
|
1
|
+
import { defineNativePlugin, defineToolRenderer, t, useT } from "@agimon-ai/po-core/native";
|
|
2
2
|
import { View } from "react-native-unistyles/components/native/View";
|
|
3
3
|
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
4
|
import { Badge, CodeBlock, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, SectionLabel, StatusBadge, collapseLines, fontOf, toolTone } from "@agimon-ai/po-native-components";
|
|
@@ -87,27 +87,27 @@ function compactNumber(value) {
|
|
|
87
87
|
}
|
|
88
88
|
const words = (value) => value.replaceAll(/[-_]/g, " ");
|
|
89
89
|
/** The header summary: the primary piece stays whole, the context may truncate. */
|
|
90
|
-
function diagnosticSummary(report) {
|
|
90
|
+
function diagnosticSummary(t, report) {
|
|
91
91
|
const context = [report.scope, report.period].flatMap((part) => part ? [words(part)] : []).join(" · ");
|
|
92
92
|
const issues = report.capturedIssues;
|
|
93
|
-
const primary = report.evidence === "unavailable" ? "Telemetry unavailable" : report.evidence === "empty" ? "Nothing captured" : issues === void 0 ? "Captured agent evidence" : issues === 0 ? "No issues" :
|
|
93
|
+
const primary = report.evidence === "unavailable" ? t("log.ui.telemetryUnavailable", "Telemetry unavailable") : report.evidence === "empty" ? t("log.ui.nothingCaptured", "Nothing captured") : issues === void 0 ? t("log.ui.capturedAgentEvidence", "Captured agent evidence") : issues === 0 ? t("log.ui.noIssues", "No issues") : issues === 1 ? t("log.ui.issueCountOne", "{count} issue", { count: issues }) : t("log.ui.issueCount", "{count} issues", { count: issues });
|
|
94
94
|
return context === "" ? { primary } : {
|
|
95
95
|
primary,
|
|
96
96
|
context
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
/** The key figures row; a figure the report did not send is left out rather than shown as zero. */
|
|
100
|
-
function diagnosticFigures(report) {
|
|
100
|
+
function diagnosticFigures(t, report) {
|
|
101
101
|
const figures = [];
|
|
102
102
|
if (report.capturedRecords !== void 0) figures.push({
|
|
103
|
-
label: "Records",
|
|
103
|
+
label: t("log.ui.records", "Records"),
|
|
104
104
|
value: report.capturedRecords.toLocaleString("en-US"),
|
|
105
105
|
failure: false
|
|
106
106
|
});
|
|
107
107
|
if (report.capturedIssues !== void 0) {
|
|
108
108
|
const failing = report.capturedIssues > 0 && report.categories.some((category) => category.failure);
|
|
109
109
|
figures.push({
|
|
110
|
-
label: "Issues",
|
|
110
|
+
label: t("log.ui.issues", "Issues"),
|
|
111
111
|
value: report.capturedIssues.toLocaleString("en-US"),
|
|
112
112
|
failure: failing
|
|
113
113
|
});
|
|
@@ -115,30 +115,30 @@ function diagnosticFigures(report) {
|
|
|
115
115
|
if (report.inputTokens !== void 0 || report.outputTokens !== void 0) {
|
|
116
116
|
const side = (value) => value === void 0 ? "?" : compactNumber(value);
|
|
117
117
|
figures.push({
|
|
118
|
-
label: "Tokens in / out",
|
|
118
|
+
label: t("log.ui.tokensInOut", "Tokens in / out"),
|
|
119
119
|
value: `${side(report.inputTokens)} / ${side(report.outputTokens)}`,
|
|
120
120
|
failure: false
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
if (report.tokenCoveragePercent !== void 0) figures.push({
|
|
124
|
-
label: "Token coverage",
|
|
124
|
+
label: t("log.ui.tokenCoverage", "Token coverage"),
|
|
125
125
|
value: `${String(report.tokenCoveragePercent)}%`,
|
|
126
126
|
failure: false
|
|
127
127
|
});
|
|
128
128
|
return figures;
|
|
129
129
|
}
|
|
130
130
|
/** The quiet note at the bottom: capture completeness, then the report's limitations. */
|
|
131
|
-
function diagnosticNote(report) {
|
|
132
|
-
const parts = [report.captureCompleteness ?
|
|
131
|
+
function diagnosticNote(t, report) {
|
|
132
|
+
const parts = [report.captureCompleteness ? t("log.ui.captureCompleteness", "Capture completeness: {value}.", { value: words(report.captureCompleteness) }) : void 0, report.limitations].filter((part) => part !== void 0);
|
|
133
133
|
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
134
134
|
}
|
|
135
135
|
/** The limitation sentence an empty report leads with, so an empty window never reads as a healthy run. */
|
|
136
|
-
function emptyLimitation(report) {
|
|
137
|
-
return report.limitations?.match(EMPTY_SENTENCE)?.[0].trim() ?? "Empty data is not proof of a healthy run.";
|
|
136
|
+
function emptyLimitation(t, report) {
|
|
137
|
+
return report.limitations?.match(EMPTY_SENTENCE)?.[0].trim() ?? t("log.ui.emptyDataIsNotProofOfAHealthyRun", "Empty data is not proof of a healthy run.");
|
|
138
138
|
}
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/AgentDiagnosticCard.native.tsx
|
|
141
|
-
const DEFAULT_SUMMARY = "Captured agent evidence";
|
|
141
|
+
const DEFAULT_SUMMARY = () => t("log.ui.capturedAgentEvidence", "Captured agent evidence");
|
|
142
142
|
/**
|
|
143
143
|
* The diagnose_agent tool's timeline item on native, as the web's: the report
|
|
144
144
|
* as a header summary and its key figures, with categories, tools and the
|
|
@@ -146,6 +146,7 @@ const DEFAULT_SUMMARY = "Captured agent evidence";
|
|
|
146
146
|
* failed read shows only its reason in red; the header carries the failure.
|
|
147
147
|
*/
|
|
148
148
|
function AgentDiagnosticCard({ toolName, output, running, isError }) {
|
|
149
|
+
const t = useT();
|
|
149
150
|
const tone = toolTone({
|
|
150
151
|
running,
|
|
151
152
|
isError
|
|
@@ -161,7 +162,7 @@ function AgentDiagnosticCard({ toolName, output, running, isError }) {
|
|
|
161
162
|
tone,
|
|
162
163
|
children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
163
164
|
title: toolName,
|
|
164
|
-
children: DEFAULT_SUMMARY
|
|
165
|
+
children: DEFAULT_SUMMARY()
|
|
165
166
|
}), lines.length > 0 ? /* @__PURE__ */ jsx(MessageItemBody, { children: /* @__PURE__ */ jsx(Text, {
|
|
166
167
|
selectable: true,
|
|
167
168
|
style: [styles$1.sans, styles$1.error],
|
|
@@ -175,32 +176,33 @@ function AgentDiagnosticCard({ toolName, output, running, isError }) {
|
|
|
175
176
|
const view = collapseLines(lines, 12, expanded);
|
|
176
177
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
177
178
|
title: toolName,
|
|
178
|
-
children: DEFAULT_SUMMARY
|
|
179
|
+
children: DEFAULT_SUMMARY()
|
|
179
180
|
}), view.shown.length > 0 || running ? /* @__PURE__ */ jsxs(MessageItemBody, { children: [
|
|
180
181
|
view.shown.map((line, index) => /* @__PURE__ */ jsx(Text, {
|
|
181
182
|
selectable: true,
|
|
182
183
|
style: [styles$1.sans, styles$1.text],
|
|
183
184
|
children: line
|
|
184
185
|
}, `${String(index)}-${line}`)),
|
|
185
|
-
view.hidden > 0 ? /* @__PURE__ */
|
|
186
|
+
view.hidden > 0 ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
186
187
|
expands: true,
|
|
187
|
-
children:
|
|
188
|
+
children: t("log.ui.moreLines", "{count} more lines", { count: view.hidden })
|
|
188
189
|
}) : null,
|
|
189
190
|
running ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
190
191
|
tone: "running",
|
|
191
|
-
children: "Reading session telemetry"
|
|
192
|
+
children: t("log.ui.readingSessionTelemetry", "Reading session telemetry")
|
|
192
193
|
}) : null
|
|
193
194
|
] }) : null] });
|
|
194
195
|
}
|
|
195
196
|
});
|
|
196
197
|
}
|
|
197
198
|
function ReportCard({ toolName, tone, report }) {
|
|
198
|
-
const
|
|
199
|
-
const
|
|
200
|
-
const
|
|
199
|
+
const t = useT();
|
|
200
|
+
const summary = diagnosticSummary(t, report);
|
|
201
|
+
const figures = diagnosticFigures(t, report);
|
|
202
|
+
const note = diagnosticNote(t, report);
|
|
201
203
|
const empty = report.evidence === "empty";
|
|
202
204
|
const unavailable = report.evidence === "unavailable";
|
|
203
|
-
const sentence = emptyLimitation(report);
|
|
205
|
+
const sentence = emptyLimitation(t, report);
|
|
204
206
|
const extraNote = empty && note === sentence ? void 0 : note;
|
|
205
207
|
const quiet = empty || unavailable;
|
|
206
208
|
const details = quiet ? extraNote !== void 0 : report.categories.length > 0 || report.tools.length > 0 || note !== void 0;
|
|
@@ -224,7 +226,7 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
224
226
|
style: styles$1.wrapRow,
|
|
225
227
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
226
228
|
style: [styles$1.sans, styles$1.dim],
|
|
227
|
-
children: "The session's telemetry could not be read."
|
|
229
|
+
children: t("log.ui.theSessionSTelemetryCouldNotBeRead", "The session's telemetry could not be read.")
|
|
228
230
|
}), report.code ? /* @__PURE__ */ jsx(StatusBadge, {
|
|
229
231
|
size: "xs",
|
|
230
232
|
children: /* @__PURE__ */ jsx(Text, {
|
|
@@ -236,7 +238,7 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
236
238
|
style: styles$1.block,
|
|
237
239
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
238
240
|
style: [styles$1.sans, styles$1.text],
|
|
239
|
-
children: "No records were captured in this window."
|
|
241
|
+
children: t("log.ui.noRecordsWereCapturedInThisWindow", "No records were captured in this window.")
|
|
240
242
|
}), /* @__PURE__ */ jsx(Text, {
|
|
241
243
|
style: [styles$1.small, styles$1.dim],
|
|
242
244
|
children: sentence
|
|
@@ -258,7 +260,7 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
258
260
|
}) : null,
|
|
259
261
|
expanded && !quiet && report.categories.length > 0 ? /* @__PURE__ */ jsxs(View, {
|
|
260
262
|
style: styles$1.section,
|
|
261
|
-
children: [/* @__PURE__ */ jsx(SectionLabel, { children: "Issues by category" }), /* @__PURE__ */ jsx(View, {
|
|
263
|
+
children: [/* @__PURE__ */ jsx(SectionLabel, { children: t("log.ui.issuesByCategory", "Issues by category") }), /* @__PURE__ */ jsx(View, {
|
|
262
264
|
style: styles$1.wrapRow,
|
|
263
265
|
children: report.categories.map((category) => /* @__PURE__ */ jsxs(Badge, {
|
|
264
266
|
tone: category.failure ? "red" : "neutral",
|
|
@@ -276,7 +278,7 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
276
278
|
expanded && !quiet && report.tools.length > 0 ? /* @__PURE__ */ jsxs(View, {
|
|
277
279
|
style: styles$1.section,
|
|
278
280
|
children: [
|
|
279
|
-
/* @__PURE__ */ jsx(SectionLabel, { children: "Tools" }),
|
|
281
|
+
/* @__PURE__ */ jsx(SectionLabel, { children: t("log.ui.tools", "Tools") }),
|
|
280
282
|
/* @__PURE__ */ jsxs(View, {
|
|
281
283
|
style: styles$1.toolRow,
|
|
282
284
|
children: [
|
|
@@ -286,7 +288,7 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
286
288
|
styles$1.dim,
|
|
287
289
|
styles$1.toolName
|
|
288
290
|
],
|
|
289
|
-
children: "Name"
|
|
291
|
+
children: t("log.ui.name", "Name")
|
|
290
292
|
}),
|
|
291
293
|
/* @__PURE__ */ jsx(Text, {
|
|
292
294
|
style: [
|
|
@@ -294,7 +296,7 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
294
296
|
styles$1.dim,
|
|
295
297
|
styles$1.toolCalls
|
|
296
298
|
],
|
|
297
|
-
children: "Calls"
|
|
299
|
+
children: t("log.ui.calls", "Calls")
|
|
298
300
|
}),
|
|
299
301
|
/* @__PURE__ */ jsx(Text, {
|
|
300
302
|
style: [
|
|
@@ -302,7 +304,7 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
302
304
|
styles$1.dim,
|
|
303
305
|
styles$1.toolTokens
|
|
304
306
|
],
|
|
305
|
-
children: "p90 turn"
|
|
307
|
+
children: t("log.ui.p90Turn", "p90 turn")
|
|
306
308
|
})
|
|
307
309
|
]
|
|
308
310
|
}),
|
|
@@ -336,13 +338,9 @@ function ReportCard({ toolName, tone, report }) {
|
|
|
336
338
|
})
|
|
337
339
|
]
|
|
338
340
|
}, tool.name)) }),
|
|
339
|
-
report.limitReached ? /* @__PURE__ */
|
|
341
|
+
report.limitReached ? /* @__PURE__ */ jsx(Text, {
|
|
340
342
|
style: [styles$1.small, styles$1.dim],
|
|
341
|
-
children:
|
|
342
|
-
"Showing the first ",
|
|
343
|
-
report.tools.length,
|
|
344
|
-
" tools."
|
|
345
|
-
]
|
|
343
|
+
children: t("log.ui.firstTools", "Showing the first {count} tools.", { count: report.tools.length })
|
|
346
344
|
}) : null
|
|
347
345
|
]
|
|
348
346
|
}) : null,
|
|
@@ -518,7 +516,7 @@ function percent(value) {
|
|
|
518
516
|
function iso(value) {
|
|
519
517
|
return typeof value === "string" && /^\d{4}-\d{2}-\d{2}T/.test(value) && Number.isFinite(Date.parse(value));
|
|
520
518
|
}
|
|
521
|
-
function scopeLabel(value) {
|
|
519
|
+
function scopeLabel(t, value) {
|
|
522
520
|
const scope = record(value);
|
|
523
521
|
if (!scope || scope.kind !== "session" && scope.kind !== "history") return void 0;
|
|
524
522
|
if (scope.sessionId !== void 0 && typeof scope.sessionId !== "string") return void 0;
|
|
@@ -527,7 +525,7 @@ function scopeLabel(value) {
|
|
|
527
525
|
if (scope.kind === "history" && (!iso(scope.startTime) || !iso(scope.endTime))) return void 0;
|
|
528
526
|
if (iso(scope.startTime) && iso(scope.endTime) && Date.parse(scope.startTime) > Date.parse(scope.endTime)) return void 0;
|
|
529
527
|
return [
|
|
530
|
-
scope.kind === "session" ? "This session" : "History",
|
|
528
|
+
scope.kind === "session" ? t("log.ui.thisSession", "This session") : t("log.ui.history", "History"),
|
|
531
529
|
scope.startTime,
|
|
532
530
|
scope.endTime,
|
|
533
531
|
scope.kind === "history" ? scope.sessionId : void 0
|
|
@@ -538,7 +536,7 @@ function matchesLogsinkTool(toolName) {
|
|
|
538
536
|
return logsinkToolNames.some((name) => name === toolName);
|
|
539
537
|
}
|
|
540
538
|
/** No reader, telemetry runtime, or schema construction crosses into the browser. */
|
|
541
|
-
function logsinkCardSummary({ toolName, args, result, output, running, isError }) {
|
|
539
|
+
function logsinkCardSummary(t, { toolName, args, result, output, running, isError }) {
|
|
542
540
|
let value = result?.details;
|
|
543
541
|
if (value === void 0 || value === null) try {
|
|
544
542
|
value = JSON.parse(output);
|
|
@@ -546,13 +544,13 @@ function logsinkCardSummary({ toolName, args, result, output, running, isError }
|
|
|
546
544
|
value = void 0;
|
|
547
545
|
}
|
|
548
546
|
const report = record(value);
|
|
549
|
-
const effectiveScope = scopeLabel(report?.scope);
|
|
547
|
+
const effectiveScope = scopeLabel(t, report?.scope);
|
|
550
548
|
const requestedScope = args.scope === "history" ? [
|
|
551
|
-
"Requested history",
|
|
549
|
+
t("log.ui.requestedHistory", "Requested history"),
|
|
552
550
|
args.startTime,
|
|
553
551
|
args.endTime,
|
|
554
552
|
args.sessionId
|
|
555
|
-
].filter((part) => typeof part === "string").join(" · ") : "This session";
|
|
553
|
+
].filter((part) => typeof part === "string").join(" · ") : t("log.ui.thisSession", "This session");
|
|
556
554
|
const evidence = value === void 0 ? output : JSON.stringify(value, null, 2);
|
|
557
555
|
const base = {
|
|
558
556
|
scope: effectiveScope ?? requestedScope,
|
|
@@ -562,20 +560,20 @@ function logsinkCardSummary({ toolName, args, result, output, running, isError }
|
|
|
562
560
|
...base,
|
|
563
561
|
scope: requestedScope,
|
|
564
562
|
state: "running",
|
|
565
|
-
heading: "Reading captured agent evidence",
|
|
566
|
-
note: "Only retained records are inspected."
|
|
563
|
+
heading: t("log.ui.readingCapturedAgentEvidence", "Reading captured agent evidence"),
|
|
564
|
+
note: t("log.ui.onlyRetainedRecordsAreInspected", "Only retained records are inspected.")
|
|
567
565
|
};
|
|
568
566
|
if (isError) return {
|
|
569
567
|
...base,
|
|
570
568
|
state: "query-error",
|
|
571
|
-
heading: "Log query could not be completed.",
|
|
572
|
-
note: "No collector changes were made."
|
|
569
|
+
heading: t("log.ui.logQueryCouldNotBeCompleted", "Log query could not be completed."),
|
|
570
|
+
note: t("log.ui.noCollectorChangesWereMade", "No collector changes were made.")
|
|
573
571
|
};
|
|
574
572
|
const unavailable = {
|
|
575
573
|
...base,
|
|
576
574
|
state: "unavailable",
|
|
577
|
-
heading: "Log summary is unavailable.",
|
|
578
|
-
note: "Inspect the retained evidence for details."
|
|
575
|
+
heading: t("log.ui.logSummaryIsUnavailable", "Log summary is unavailable."),
|
|
576
|
+
note: t("log.ui.inspectTheRetainedEvidenceForDetails", "Inspect the retained evidence for details.")
|
|
579
577
|
};
|
|
580
578
|
const data = record(report?.data);
|
|
581
579
|
if (!effectiveScope || !data) return unavailable;
|
|
@@ -587,29 +585,32 @@ function logsinkCardSummary({ toolName, args, result, output, running, isError }
|
|
|
587
585
|
const empty = {
|
|
588
586
|
...base,
|
|
589
587
|
state: "empty",
|
|
590
|
-
heading: "No captured records in this window.",
|
|
591
|
-
note: "This does not establish that the run was healthy."
|
|
588
|
+
heading: t("log.ui.noCapturedRecordsInThisWindow", "No captured records in this window."),
|
|
589
|
+
note: t("log.ui.thisDoesNotEstablishThatTheRunWasHealthy", "This does not establish that the run was healthy.")
|
|
592
590
|
};
|
|
593
591
|
switch (toolName) {
|
|
594
592
|
case "logsink_status":
|
|
595
593
|
if (data.available === false && data.reason === "missing-database") return {
|
|
596
594
|
...base,
|
|
597
595
|
state: "missing",
|
|
598
|
-
heading: "No retained log database is available.",
|
|
599
|
-
note: "No collector changes were made."
|
|
596
|
+
heading: t("log.ui.noRetainedLogDatabaseIsAvailable", "No retained log database is available."),
|
|
597
|
+
note: t("log.ui.noCollectorChangesWereMade", "No collector changes were made.")
|
|
600
598
|
};
|
|
601
599
|
return data.available === true ? {
|
|
602
600
|
...populated,
|
|
603
|
-
heading: "Retained log database is available.",
|
|
604
|
-
note: "This does not establish that the collector is capturing now."
|
|
601
|
+
heading: t("log.ui.retainedLogDatabaseIsAvailable", "Retained log database is available."),
|
|
602
|
+
note: t("log.ui.thisDoesNotEstablishThatTheCollectorIsCapturingNow", "This does not establish that the collector is capturing now.")
|
|
605
603
|
} : unavailable;
|
|
606
604
|
case "logsink_search":
|
|
607
605
|
if (!count(data.count) || !count(data.total) || typeof data.truncated !== "boolean" || !Array.isArray(data.results)) return unavailable;
|
|
608
606
|
return {
|
|
609
607
|
...data.total === 0 ? empty : populated,
|
|
610
|
-
heading: data.total === 0 ? empty.heading : "Captured log records",
|
|
611
|
-
summary:
|
|
612
|
-
|
|
608
|
+
heading: data.total === 0 ? empty.heading : t("log.ui.capturedLogRecords", "Captured log records"),
|
|
609
|
+
summary: t("log.ui.returnedRecords", "{returned} returned · {total} records", {
|
|
610
|
+
returned: data.count,
|
|
611
|
+
total: data.total
|
|
612
|
+
}),
|
|
613
|
+
note: data.truncated ? t("log.ui.resultsAreTruncated", "Results are truncated.") : data.total === 0 ? empty.note : void 0
|
|
613
614
|
};
|
|
614
615
|
case "logsink_agent_issues": {
|
|
615
616
|
if (!count(data.matchingLogs) || !count(data.uniqueIncidents) || !count(data.scanned) || !percent(data.coveragePercent) || typeof data.truncated !== "boolean" || !Array.isArray(data.issues)) return unavailable;
|
|
@@ -617,23 +618,30 @@ function logsinkCardSummary({ toolName, args, result, output, running, isError }
|
|
|
617
618
|
if (!byTool || !Object.values(byTool).every(count)) return unavailable;
|
|
618
619
|
return {
|
|
619
620
|
...data.matchingLogs === 0 ? empty : populated,
|
|
620
|
-
heading: data.matchingLogs === 0 ? "No captured agent issues in this window." : "Captured agent issues",
|
|
621
|
-
summary:
|
|
622
|
-
|
|
621
|
+
heading: data.matchingLogs === 0 ? t("log.ui.noCapturedAgentIssuesInThisWindow", "No captured agent issues in this window.") : t("log.ui.capturedAgentIssues", "Captured agent issues"),
|
|
622
|
+
summary: t("log.ui.recordIncidents", "{records} records · {incidents} incidents", {
|
|
623
|
+
records: data.matchingLogs,
|
|
624
|
+
incidents: data.uniqueIncidents
|
|
625
|
+
}),
|
|
626
|
+
coverage: t("log.ui.scanCoverage", "Coverage {percent}% · {count} scanned{notice}", {
|
|
627
|
+
percent: data.coveragePercent,
|
|
628
|
+
count: data.scanned,
|
|
629
|
+
notice: data.truncated ? t("log.ui.scanTruncated", " · Scan truncated") : ""
|
|
630
|
+
}),
|
|
623
631
|
tools: Object.entries(byTool).map(([name, n]) => ({
|
|
624
632
|
name,
|
|
625
633
|
count: n
|
|
626
634
|
})),
|
|
627
|
-
note: data.matchingLogs === 0 ? empty.note : "Repeated events may describe one incident."
|
|
635
|
+
note: data.matchingLogs === 0 ? empty.note : t("log.ui.repeatedEventsMayDescribeOneIncident", "Repeated events may describe one incident.")
|
|
628
636
|
};
|
|
629
637
|
}
|
|
630
638
|
case "logsink_trace":
|
|
631
639
|
if (!count(data.count) || typeof data.truncated !== "boolean" || !Array.isArray(data.timeline)) return unavailable;
|
|
632
640
|
return {
|
|
633
641
|
...data.count === 0 ? empty : populated,
|
|
634
|
-
heading: data.count === 0 ? empty.heading : "Captured trace timeline",
|
|
635
|
-
summary:
|
|
636
|
-
note: data.truncated ? "Timeline is truncated." : data.count === 0 ? empty.note : void 0
|
|
642
|
+
heading: data.count === 0 ? empty.heading : t("log.ui.capturedTraceTimeline", "Captured trace timeline"),
|
|
643
|
+
summary: t("log.ui.entryCount", "{count} entries", { count: data.count }),
|
|
644
|
+
note: data.truncated ? t("log.ui.timelineIsTruncated", "Timeline is truncated.") : data.count === 0 ? empty.note : void 0
|
|
637
645
|
};
|
|
638
646
|
case "logsink_stats":
|
|
639
647
|
if (!count(data.totalEntries) || !Array.isArray(data.statistics) || !data.statistics.every((row) => {
|
|
@@ -642,8 +650,14 @@ function logsinkCardSummary({ toolName, args, result, output, running, isError }
|
|
|
642
650
|
})) return unavailable;
|
|
643
651
|
return {
|
|
644
652
|
...data.totalEntries === 0 ? empty : populated,
|
|
645
|
-
heading: data.totalEntries === 0 ? empty.heading : "Retained entry statistics",
|
|
646
|
-
summary:
|
|
653
|
+
heading: data.totalEntries === 0 ? empty.heading : t("log.ui.retainedEntryStatistics", "Retained entry statistics"),
|
|
654
|
+
summary: data.statistics.length === 1 ? t("log.ui.entryGroupsOne", "{entries} entries · {groups} group", {
|
|
655
|
+
entries: data.totalEntries,
|
|
656
|
+
groups: data.statistics.length
|
|
657
|
+
}) : t("log.ui.entryGroups", "{entries} entries · {groups} groups", {
|
|
658
|
+
entries: data.totalEntries,
|
|
659
|
+
groups: data.statistics.length
|
|
660
|
+
}),
|
|
647
661
|
tools: data.statistics.map((row) => {
|
|
648
662
|
const group = row;
|
|
649
663
|
return {
|
|
@@ -656,19 +670,23 @@ function logsinkCardSummary({ toolName, args, result, output, running, isError }
|
|
|
656
670
|
if (!count(data.count) || typeof data.truncated !== "boolean" || !Array.isArray(data.services) || !data.services.every((service) => typeof service === "string")) return unavailable;
|
|
657
671
|
return {
|
|
658
672
|
...data.count === 0 ? empty : populated,
|
|
659
|
-
heading: data.count === 0 ? empty.heading : "Services with retained records",
|
|
660
|
-
summary:
|
|
661
|
-
note: data.truncated ? "Service list is truncated." : data.count === 0 ? empty.note : void 0
|
|
673
|
+
heading: data.count === 0 ? empty.heading : t("log.ui.servicesWithRetainedRecords", "Services with retained records"),
|
|
674
|
+
summary: data.count === 1 ? t("log.ui.serviceCountOne", "{count} service", { count: data.count }) : t("log.ui.serviceCount", "{count} services", { count: data.count }),
|
|
675
|
+
note: data.truncated ? t("log.ui.serviceListIsTruncated", "Service list is truncated.") : data.count === 0 ? empty.note : void 0
|
|
662
676
|
};
|
|
663
677
|
case "logsink_metrics": {
|
|
664
678
|
const totals = record(data.totals);
|
|
665
679
|
if (!totals || !count(totals.totalRecords) || !count(totals.totalTokens) || !count(totals.issueCount) || !percent(totals.tokenCoveragePercent)) return unavailable;
|
|
666
680
|
return {
|
|
667
681
|
...totals.totalRecords === 0 ? empty : populated,
|
|
668
|
-
heading: totals.totalRecords === 0 ? empty.heading : "Captured usage and issues",
|
|
669
|
-
summary:
|
|
670
|
-
|
|
671
|
-
|
|
682
|
+
heading: totals.totalRecords === 0 ? empty.heading : t("log.ui.capturedUsageAndIssues", "Captured usage and issues"),
|
|
683
|
+
summary: t("log.ui.usageSummary", "{records} records · {tokens} tokens · {issues} issues", {
|
|
684
|
+
records: totals.totalRecords,
|
|
685
|
+
tokens: totals.totalTokens,
|
|
686
|
+
issues: totals.issueCount
|
|
687
|
+
}),
|
|
688
|
+
coverage: t("log.ui.tokenCoveragePercent", "Token coverage {percent}%", { percent: totals.tokenCoveragePercent }),
|
|
689
|
+
note: t("log.ui.toolCostNotice", "{notice}Tool turn costs are not exclusive per-tool token shares.", { notice: totals.totalRecords === 0 ? `${empty.note} ` : "" })
|
|
672
690
|
};
|
|
673
691
|
}
|
|
674
692
|
default: return unavailable;
|
|
@@ -681,8 +699,9 @@ function logsinkCardSummary({ toolName, args, result, output, running, isError }
|
|
|
681
699
|
* same summary (heading, counts, coverage, per-tool counts) and the evidence on expand.
|
|
682
700
|
*/
|
|
683
701
|
function LogsinkToolCard(props) {
|
|
702
|
+
const t = useT();
|
|
684
703
|
const { toolName, running, isError } = props;
|
|
685
|
-
const fixture = logsinkCardSummary(props);
|
|
704
|
+
const fixture = logsinkCardSummary(t, props);
|
|
686
705
|
const missing = fixture.state === "missing";
|
|
687
706
|
const neutral = missing || fixture.state === "unavailable";
|
|
688
707
|
return /* @__PURE__ */ jsx(MessageItem, {
|
|
@@ -694,7 +713,7 @@ function LogsinkToolCard(props) {
|
|
|
694
713
|
defaultExpanded: false,
|
|
695
714
|
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
696
715
|
title: toolName,
|
|
697
|
-
badge: isError ? "Query failed" : missing ? "No data" : void 0,
|
|
716
|
+
badge: isError ? t("log.ui.queryFailed", "Query failed") : missing ? t("log.ui.noData", "No data") : void 0,
|
|
698
717
|
children: /* @__PURE__ */ jsx(Text, {
|
|
699
718
|
numberOfLines: 1,
|
|
700
719
|
style: [
|
|
@@ -731,13 +750,9 @@ function LogsinkToolCard(props) {
|
|
|
731
750
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
732
751
|
style: styles.mono,
|
|
733
752
|
children: tool.name
|
|
734
|
-
}), /* @__PURE__ */
|
|
753
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
735
754
|
style: styles.dim,
|
|
736
|
-
children:
|
|
737
|
-
" ",
|
|
738
|
-
tool.count,
|
|
739
|
-
" occurrences"
|
|
740
|
-
]
|
|
755
|
+
children: t("log.ui.occurrences", "{count} occurrences", { count: tool.count })
|
|
741
756
|
})]
|
|
742
757
|
}, tool.name))
|
|
743
758
|
}) : null,
|
|
@@ -747,14 +762,14 @@ function LogsinkToolCard(props) {
|
|
|
747
762
|
}) : null,
|
|
748
763
|
running ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
749
764
|
tone: "running",
|
|
750
|
-
children: "Reading telemetry"
|
|
765
|
+
children: t("log.ui.readingTelemetry", "Reading telemetry")
|
|
751
766
|
}) : null,
|
|
752
767
|
fixture.evidence ? /* @__PURE__ */ jsxs(View, {
|
|
753
768
|
style: [styles.block, styles.divided],
|
|
754
769
|
children: [/* @__PURE__ */ jsx(MessageItemStatus, {
|
|
755
770
|
expands: true,
|
|
756
771
|
glyph: expanded ? "⌄" : "›",
|
|
757
|
-
children: expanded ? "Hide evidence" : "Show evidence"
|
|
772
|
+
children: expanded ? t("log.ui.hideEvidence", "Hide evidence") : t("log.ui.showEvidence", "Show evidence")
|
|
758
773
|
}), expanded ? /* @__PURE__ */ jsx(CodeBlock, {
|
|
759
774
|
text: fixture.evidence,
|
|
760
775
|
language: "json"
|