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