@agimon-ai/po-log 0.0.0-alpha.21 → 0.0.0-alpha.210
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/LICENSE +21 -149
- package/README.md +4 -10
- package/dist/apiContracts.cjs +81 -57
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -2
- package/dist/apiContracts.mjs +82 -58
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/extensions/native.mjs +403 -0
- package/dist/extensions/native.mjs.map +1 -0
- package/dist/extensions/server.cjs +835 -296
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +837 -298
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +735 -300
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/findings-Bo4IHNpr.cjs +165 -0
- package/dist/findings-Bo4IHNpr.cjs.map +1 -0
- package/dist/findings-DAKeRG4O.mjs +160 -0
- package/dist/findings-DAKeRG4O.mjs.map +1 -0
- package/dist/http-D7IHAk6Y.mjs +29 -0
- package/dist/http-D7IHAk6Y.mjs.map +1 -0
- package/dist/http-Dhn2bpMh.cjs +40 -0
- package/dist/http-Dhn2bpMh.cjs.map +1 -0
- package/dist/index.cjs +3 -2
- package/dist/index.d.mts +8 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/{metrics-jCZe13Xg.cjs → metrics-Bml7TSZq.cjs} +9 -160
- package/dist/metrics-Bml7TSZq.cjs.map +1 -0
- package/dist/{metrics-DywCpDJ_.mjs → metrics-DwfV84Fy.mjs} +2 -159
- package/dist/metrics-DwfV84Fy.mjs.map +1 -0
- package/dist/metrics.cjs +3 -2
- package/dist/metrics.mjs +3 -1
- package/dist/{metricsSource-Cy8f47Q0.cjs → metricsSource-CF3cp-sf.cjs} +16 -43
- package/dist/metricsSource-CF3cp-sf.cjs.map +1 -0
- package/dist/{metricsSource-BaoBR_Ia.mjs → metricsSource-I5p5_t2L.mjs} +9 -42
- package/dist/metricsSource-I5p5_t2L.mjs.map +1 -0
- package/dist/{metricsSource-DNT8BrTF.d.mts → metricsSource-sO8OpIes.d.mts} +14 -3
- package/dist/metricsSource-sO8OpIes.d.mts.map +1 -0
- package/dist/metricsSource.cjs +1 -1
- package/dist/metricsSource.d.mts +1 -13
- package/dist/metricsSource.d.mts.map +1 -1
- package/dist/metricsSource.mjs +1 -1
- package/dist/metricsStore-BcjSOJGN.mjs +44 -0
- package/dist/metricsStore-BcjSOJGN.mjs.map +1 -0
- package/dist/metricsStore-nGI-c5NH.cjs +79 -0
- package/dist/metricsStore-nGI-c5NH.cjs.map +1 -0
- package/dist/metricsStore.cjs +476 -0
- package/dist/metricsStore.cjs.map +1 -0
- package/dist/metricsStore.d.mts +63 -0
- package/dist/metricsStore.d.mts.map +1 -0
- package/dist/metricsStore.mjs +471 -0
- package/dist/metricsStore.mjs.map +1 -0
- package/dist/po-runtime-identity.json +1 -0
- package/llms.txt +5 -1
- package/locales/vi.json +202 -0
- package/locales/zh-CN.json +202 -0
- package/package.json +81 -18
- package/src/prompts/codemode-how-to-logsink/SKILL.md +80 -0
- package/src/prompts/help-how-to-log/SKILL.md +28 -0
- package/dist/metrics-DywCpDJ_.mjs.map +0 -1
- package/dist/metrics-jCZe13Xg.cjs.map +0 -1
- package/dist/metricsSource-BaoBR_Ia.mjs.map +0 -1
- package/dist/metricsSource-Cy8f47Q0.cjs.map +0 -1
- package/dist/metricsSource-DNT8BrTF.d.mts.map +0 -1
- package/src/prompts/po-debug-agent/SKILL.md +0 -28
package/dist/extensions/web.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { apiResponse, createApiClient, defineApiRoutes, defineSettingsPanel, defineToolRenderer, defineWebPlugin, sessionApiAddress } from "@agimon-ai/po-core/web";
|
|
2
|
-
import { Button, EmptyState, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, MessageLines, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Spinner,
|
|
1
|
+
import { apiResponse, createApiClient, currentLocale, defineApiRoutes, defineFill, defineSettingsPanel, defineToolRenderer, defineWebPlugin, sessionApiAddress, t, useLocale, useT } from "@agimon-ai/po-core/web";
|
|
2
|
+
import { ActivityIcon, Button, CalendarIcon, CheckIcon, EmptyState, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, MessageLines, PuzzleIcon, SearchIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, ServerIcon, Spinner, WrenchIcon, toolTone } from "@agimon-ai/po-web-components";
|
|
3
3
|
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { browserTransport } from "@agimon-ai/po-web-security/browser";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/types/webMetrics.ts
|
|
7
7
|
/**
|
|
@@ -49,7 +49,7 @@ function isIssuesUnavailable(response) {
|
|
|
49
49
|
* This is the one file the routes, the Hono app and the browser all read, so a
|
|
50
50
|
* path cannot move on one side alone.
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
const routes = defineApiRoutes({
|
|
53
53
|
metrics: {
|
|
54
54
|
method: "GET",
|
|
55
55
|
path: "/metrics",
|
|
@@ -70,44 +70,35 @@ var apiRoutes_default = defineApiRoutes({
|
|
|
70
70
|
path: "/issues",
|
|
71
71
|
query: [METRICS_QUERY_PARAMS.focus],
|
|
72
72
|
response: apiResponse()
|
|
73
|
+
},
|
|
74
|
+
/** The resources the host meters for its own account. Empty on a host that meters none. */
|
|
75
|
+
usage: {
|
|
76
|
+
method: "GET",
|
|
77
|
+
path: "/usage",
|
|
78
|
+
response: apiResponse()
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* OTLP/JSON logs from clients that run no collector of their own, such as the
|
|
82
|
+
* native app. Forwarded unchanged to the sink, which validates and redacts.
|
|
83
|
+
*/
|
|
84
|
+
ingestLogs: {
|
|
85
|
+
method: "POST",
|
|
86
|
+
path: "/v1/logs",
|
|
87
|
+
response: apiResponse()
|
|
73
88
|
}
|
|
74
89
|
});
|
|
75
|
-
const api = createApiClient(
|
|
90
|
+
const api = createApiClient(routes, {
|
|
76
91
|
scopes: [
|
|
77
|
-
"
|
|
92
|
+
"host",
|
|
78
93
|
"workspace",
|
|
79
94
|
"session"
|
|
80
95
|
],
|
|
81
96
|
basePath: "log",
|
|
82
|
-
transport: (input, init) =>
|
|
97
|
+
transport: (input, init) => browserTransport.fetch(input, init),
|
|
83
98
|
sessionAddress: sessionApiAddress
|
|
84
99
|
});
|
|
85
100
|
//#endregion
|
|
86
101
|
//#region src/extensions/(frontend)/setting/_lib/metricsApi.ts
|
|
87
|
-
/**
|
|
88
|
-
* The page's half of this package's metrics API. The only place the cockpit
|
|
89
|
-
* talks to the hub for metrics, so if the transport ever changes, it changes
|
|
90
|
-
* here alone.
|
|
91
|
-
*
|
|
92
|
-
* These are adapters now, not a transport. The generated client owns the URL
|
|
93
|
-
* and the sealed transport with it, so nothing here spells a route or reaches
|
|
94
|
-
* for `fetch`; a plugin calling `fetch` directly would send plaintext to the
|
|
95
|
-
* tunnel's relay. What stays is this package's own vocabulary: which of the
|
|
96
|
-
* empty states a reader is shown, and which answers are states rather than
|
|
97
|
-
* failures.
|
|
98
|
-
*/
|
|
99
|
-
const UNREACHABLE = "The cockpit hub is unreachable.";
|
|
100
|
-
/**
|
|
101
|
-
* A hub with no package APIs mounted serves the SPA shell for this route, so
|
|
102
|
-
* the answer is a 200 of HTML rather than an error status. The client parses no
|
|
103
|
-
* JSON out of it and reports no body at all, which is read here as an
|
|
104
|
-
* uninstalled feature, because that is what it is.
|
|
105
|
-
*/
|
|
106
|
-
const NO_API_DETAIL = "This cockpit is running a bundle without the log package API, so there are no metrics to read.";
|
|
107
|
-
const NO_API = {
|
|
108
|
-
unavailable: "no-api",
|
|
109
|
-
detail: NO_API_DETAIL
|
|
110
|
-
};
|
|
111
102
|
function isRecord(value) {
|
|
112
103
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
113
104
|
}
|
|
@@ -121,10 +112,10 @@ function isRecord(value) {
|
|
|
121
112
|
* would overwrite whatever the replacement renders.
|
|
122
113
|
*/
|
|
123
114
|
function outcomeOf(result, signal) {
|
|
124
|
-
if (result.status === 0) return { error: signal?.aborted === true ? "" :
|
|
125
|
-
const status =
|
|
115
|
+
if (result.status === 0) return { error: signal?.aborted === true ? "" : t("log.error.unreachable", "The cockpit hub is unreachable.") };
|
|
116
|
+
const status = t("log.error.status", "The hub answered {status}.", { status: String(result.status) });
|
|
126
117
|
if (result.data === void 0) return result.ok ? { noApi: true } : { error: status };
|
|
127
|
-
if (!isRecord(result.data)) return { error: "The hub returned a response the cockpit could not read." };
|
|
118
|
+
if (!isRecord(result.data)) return { error: t("log.error.response", "The hub returned a response the cockpit could not read.") };
|
|
128
119
|
if (!result.ok) return { error: result.error === "" ? status : result.error };
|
|
129
120
|
return { body: result.data };
|
|
130
121
|
}
|
|
@@ -136,7 +127,7 @@ function outcomeOf(result, signal) {
|
|
|
136
127
|
* rather than showing one generic failure.
|
|
137
128
|
*/
|
|
138
129
|
async function fetchMetrics(dimension, period, focus, signal) {
|
|
139
|
-
const outcome = outcomeOf(await api.
|
|
130
|
+
const outcome = outcomeOf(await api.host.metrics({
|
|
140
131
|
query: {
|
|
141
132
|
[METRICS_QUERY_PARAMS.dimension]: dimension,
|
|
142
133
|
[METRICS_QUERY_PARAMS.period]: period,
|
|
@@ -145,9 +136,12 @@ async function fetchMetrics(dimension, period, focus, signal) {
|
|
|
145
136
|
...signal === void 0 ? {} : { signal }
|
|
146
137
|
}), signal);
|
|
147
138
|
if ("error" in outcome) return { error: outcome.error };
|
|
148
|
-
if ("noApi" in outcome) return { report:
|
|
139
|
+
if ("noApi" in outcome) return { report: {
|
|
140
|
+
unavailable: "no-api",
|
|
141
|
+
detail: t("log.error.noApi", "This cockpit is running a bundle without the log package API, so there are no metrics to read.")
|
|
142
|
+
} };
|
|
149
143
|
const report = outcome.body;
|
|
150
|
-
if (!isMetricsUnavailable(report) && !Array.isArray(report.groups)) return { error: "The hub returned a report the cockpit could not read." };
|
|
144
|
+
if (!isMetricsUnavailable(report) && !Array.isArray(report.groups)) return { error: t("log.error.report", "The hub returned a report the cockpit could not read.") };
|
|
151
145
|
return { report };
|
|
152
146
|
}
|
|
153
147
|
/**
|
|
@@ -157,7 +151,7 @@ async function fetchMetrics(dimension, period, focus, signal) {
|
|
|
157
151
|
* the report would make every refresh wait on the slowest transport.
|
|
158
152
|
*/
|
|
159
153
|
async function fetchIssues(focus, signal, window = {}) {
|
|
160
|
-
const outcome = outcomeOf(await api.
|
|
154
|
+
const outcome = outcomeOf(await api.host.issues({
|
|
161
155
|
query: {
|
|
162
156
|
[METRICS_QUERY_PARAMS.focus]: focus === "" ? void 0 : focus,
|
|
163
157
|
...window
|
|
@@ -167,10 +161,17 @@ async function fetchIssues(focus, signal, window = {}) {
|
|
|
167
161
|
if ("error" in outcome) return { error: outcome.error };
|
|
168
162
|
if ("noApi" in outcome) return { issues: {
|
|
169
163
|
unavailable: "no-api",
|
|
170
|
-
detail:
|
|
164
|
+
detail: t("log.error.noApi", "This cockpit is running a bundle without the log package API, so there are no metrics to read.")
|
|
171
165
|
} };
|
|
172
166
|
return { issues: outcome.body };
|
|
173
167
|
}
|
|
168
|
+
/** What the host meters for this account. A host that meters nothing, or an answer that cannot be read, is no rows. */
|
|
169
|
+
async function fetchHostUsage(signal) {
|
|
170
|
+
const outcome = outcomeOf(await api.host.usage(signal === void 0 ? {} : { signal }), signal);
|
|
171
|
+
if (!("body" in outcome)) return [];
|
|
172
|
+
const rows = outcome.body["rows"];
|
|
173
|
+
return Array.isArray(rows) ? rows : [];
|
|
174
|
+
}
|
|
174
175
|
//#endregion
|
|
175
176
|
//#region src/extensions/(frontend)/setting/_lib/chartScale.ts
|
|
176
177
|
/**
|
|
@@ -197,16 +198,66 @@ function seriesMax(values) {
|
|
|
197
198
|
* raw nine-digit total makes every row the same illegible width.
|
|
198
199
|
*/
|
|
199
200
|
function formatTokens(value) {
|
|
200
|
-
if (!Number.isFinite(value)) return "Not reported";
|
|
201
|
+
if (!Number.isFinite(value)) return t("log.ui.notReported", "Not reported");
|
|
202
|
+
if (currentLocale() !== "en") return new Intl.NumberFormat(currentLocale(), {
|
|
203
|
+
notation: "compact",
|
|
204
|
+
maximumFractionDigits: 1
|
|
205
|
+
}).format(Math.round(value));
|
|
201
206
|
if (value >= 1e6) return `${(value / 1e6).toFixed(1)}M`;
|
|
202
207
|
if (value >= 1e3) return `${(value / 1e3).toFixed(1)}k`;
|
|
203
208
|
return String(Math.round(value));
|
|
204
209
|
}
|
|
210
|
+
/** A metered amount in the largest unit that keeps it short: `1h 10m`, `9m`, `45s`, `17.5 MB`. */
|
|
211
|
+
function formatUsage(value, unit) {
|
|
212
|
+
if (!Number.isFinite(value) || value < 0) return t("log.ui.notReported", "Not reported");
|
|
213
|
+
if (unit === "seconds") {
|
|
214
|
+
const hours = Math.floor(value / 3600);
|
|
215
|
+
const minutes = Math.floor(value % 3600 / 60);
|
|
216
|
+
if (hours > 0) return minutes > 0 ? t("log.format.hoursMinutes", "{hours}h {minutes}m", {
|
|
217
|
+
hours,
|
|
218
|
+
minutes
|
|
219
|
+
}) : t("log.format.hours", "{hours}h", { hours });
|
|
220
|
+
return minutes > 0 ? t("log.format.minutes", "{minutes}m", { minutes }) : t("log.format.seconds", "{seconds}s", { seconds: Math.round(value) });
|
|
221
|
+
}
|
|
222
|
+
if (value >= 1024 ** 3) return `${(value / 1024 ** 3).toFixed(1)} GB`;
|
|
223
|
+
if (value >= 1024 ** 2) return `${(value / 1024 ** 2).toFixed(1)} MB`;
|
|
224
|
+
if (value >= 1024) return `${(value / 1024).toFixed(1)} KB`;
|
|
225
|
+
return `${Math.round(value)} B`;
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/extensions/(frontend)/setting/_components/HostUsage.tsx
|
|
229
|
+
/** What the host meters for this account. A host that meters nothing shows nothing. */
|
|
230
|
+
function HostUsage({ rows }) {
|
|
231
|
+
const t = useT();
|
|
232
|
+
if (rows.length === 0) return null;
|
|
233
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
234
|
+
className: "grid grid-cols-2 gap-3 @3xl:grid-cols-4",
|
|
235
|
+
"data-testid": "host-usage",
|
|
236
|
+
children: rows.map((row) => /* @__PURE__ */ jsxs("div", {
|
|
237
|
+
className: "min-w-0 rounded-lg border border-po-border bg-po-panel p-4",
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ jsx("dt", {
|
|
240
|
+
className: "text-sm text-po-dim",
|
|
241
|
+
children: row.label
|
|
242
|
+
}),
|
|
243
|
+
/* @__PURE__ */ jsxs("dd", {
|
|
244
|
+
className: "mt-2 text-lg font-semibold tabular-nums text-po-text",
|
|
245
|
+
children: [formatUsage(row.used, row.unit), row.limit === void 0 ? "" : t("log.ui.usageLimit", " of {limit}", { limit: formatUsage(row.limit, row.unit) })]
|
|
246
|
+
}),
|
|
247
|
+
/* @__PURE__ */ jsx("dd", {
|
|
248
|
+
className: "mt-1 text-sm text-po-dim",
|
|
249
|
+
children: row.detail
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
}, row.key))
|
|
253
|
+
});
|
|
254
|
+
}
|
|
205
255
|
//#endregion
|
|
206
256
|
//#region src/extensions/(frontend)/setting/_components/charts/GroupBars.tsx
|
|
207
257
|
const PREVIEW_GROUPS = 5;
|
|
208
258
|
/** Rank recorded consumers; an unknown attribution is not a selectable model. */
|
|
209
259
|
function GroupBars({ groups, totalTokens, focus, onFocus }) {
|
|
260
|
+
const t = useT();
|
|
210
261
|
const [expanded, setExpanded] = useState(false);
|
|
211
262
|
const sorted = [...groups].sort((a, b) => b.totalTokens - a.totalTokens || a.key.localeCompare(b.key));
|
|
212
263
|
const rows = expanded ? sorted : sorted.slice(0, PREVIEW_GROUPS);
|
|
@@ -214,9 +265,11 @@ function GroupBars({ groups, totalTokens, focus, onFocus }) {
|
|
|
214
265
|
return /* @__PURE__ */ jsxs("div", {
|
|
215
266
|
className: "flex flex-col gap-3",
|
|
216
267
|
children: [
|
|
217
|
-
groups.length === 0 ? /* @__PURE__ */ jsx(
|
|
218
|
-
|
|
219
|
-
|
|
268
|
+
groups.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
269
|
+
size: "compact",
|
|
270
|
+
icon: /* @__PURE__ */ jsx(ActivityIcon, {}),
|
|
271
|
+
title: t("log.ui.noGroupedUsage", "No grouped usage"),
|
|
272
|
+
description: t("log.ui.nothingWasRecordedForThisSelection", "Nothing was recorded for this selection.")
|
|
220
273
|
}) : null,
|
|
221
274
|
/* @__PURE__ */ jsx("ul", {
|
|
222
275
|
className: "flex flex-col gap-1",
|
|
@@ -232,7 +285,7 @@ function GroupBars({ groups, totalTokens, focus, onFocus }) {
|
|
|
232
285
|
children: [/* @__PURE__ */ jsx("span", {
|
|
233
286
|
className: "min-w-0 break-all text-left font-medium text-po-hi",
|
|
234
287
|
title: group.key,
|
|
235
|
-
children: unknown ? "Unattributed" : group.key
|
|
288
|
+
children: unknown ? t("log.ui.unattributed", "Unattributed") : group.key
|
|
236
289
|
}), /* @__PURE__ */ jsx("span", {
|
|
237
290
|
className: "shrink-0 text-right font-semibold tabular-nums text-po-hi",
|
|
238
291
|
title: String(group.totalTokens),
|
|
@@ -249,14 +302,9 @@ function GroupBars({ groups, totalTokens, focus, onFocus }) {
|
|
|
249
302
|
}),
|
|
250
303
|
/* @__PURE__ */ jsxs("span", {
|
|
251
304
|
className: "mt-2 flex flex-wrap items-center justify-between gap-2 text-sm text-po-dim",
|
|
252
|
-
children: [/* @__PURE__ */ jsx("span", { children: totalTokens !== void 0 && max > 0 ?
|
|
305
|
+
children: [/* @__PURE__ */ jsx("span", { children: totalTokens !== void 0 && max > 0 ? t("log.ui.percentOfTotal", "{percentage}% of total", { percentage: percentage.toFixed(1) }) : t("log.ui.relativeTokenVolume", "Relative token volume") }), /* @__PURE__ */ jsxs("span", {
|
|
253
306
|
className: group.issueCount > 0 || group.failed ? "text-po-yellow" : "text-po-dim",
|
|
254
|
-
children: [
|
|
255
|
-
group.failed ? "Failed · " : "",
|
|
256
|
-
formatTokens(group.issueCount),
|
|
257
|
-
" ",
|
|
258
|
-
group.issueCount === 1 ? "issue" : "issues"
|
|
259
|
-
]
|
|
307
|
+
children: [group.failed ? t("log.ui.failed", "Failed · ") : "", group.issueCount === 1 ? t("log.ui.issueCountOne", "{count} issue", { count: formatTokens(group.issueCount) }) : t("log.ui.issueCount", "{count} issues", { count: formatTokens(group.issueCount) })]
|
|
260
308
|
})]
|
|
261
309
|
})
|
|
262
310
|
] });
|
|
@@ -264,7 +312,7 @@ function GroupBars({ groups, totalTokens, focus, onFocus }) {
|
|
|
264
312
|
type: "button",
|
|
265
313
|
onClick: () => onFocus?.(selected ? "" : group.key),
|
|
266
314
|
"aria-pressed": selected,
|
|
267
|
-
"aria-label":
|
|
315
|
+
"aria-label": t("log.ui.filterTo", "Filter to {name}", { name: group.key }),
|
|
268
316
|
"data-testid": `metrics-group-${group.key}`,
|
|
269
317
|
className: `block w-full rounded-md p-3 text-base hover:bg-po-tint-blue focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue ${selected ? "bg-po-tint-blue" : ""}`,
|
|
270
318
|
children: row
|
|
@@ -279,7 +327,7 @@ function GroupBars({ groups, totalTokens, focus, onFocus }) {
|
|
|
279
327
|
size: "sm",
|
|
280
328
|
onClick: () => setExpanded(!expanded),
|
|
281
329
|
"aria-expanded": expanded,
|
|
282
|
-
children: expanded ? "Show top 5" :
|
|
330
|
+
children: expanded ? t("log.ui.showTop5", "Show top 5") : t("log.ui.showAllGroups", "Show all {count} returned groups", { count: groups.length })
|
|
283
331
|
}) : null
|
|
284
332
|
]
|
|
285
333
|
});
|
|
@@ -289,15 +337,21 @@ function GroupBars({ groups, totalTokens, focus, onFocus }) {
|
|
|
289
337
|
const SERIES = [
|
|
290
338
|
{
|
|
291
339
|
key: "totalTokens",
|
|
292
|
-
label
|
|
340
|
+
get label() {
|
|
341
|
+
return t("log.ui.total", "Total");
|
|
342
|
+
}
|
|
293
343
|
},
|
|
294
344
|
{
|
|
295
345
|
key: "inputTokens",
|
|
296
|
-
label
|
|
346
|
+
get label() {
|
|
347
|
+
return t("log.ui.input", "Input");
|
|
348
|
+
}
|
|
297
349
|
},
|
|
298
350
|
{
|
|
299
351
|
key: "outputTokens",
|
|
300
|
-
label
|
|
352
|
+
get label() {
|
|
353
|
+
return t("log.ui.output", "Output");
|
|
354
|
+
}
|
|
301
355
|
}
|
|
302
356
|
];
|
|
303
357
|
const PLOT_WIDTH = 600;
|
|
@@ -305,17 +359,21 @@ const PLOT_HEIGHT = 160;
|
|
|
305
359
|
const MAX_COLUMN_WIDTH = 48;
|
|
306
360
|
/** Plot the sink's buckets without filling missing history or stacking counters. */
|
|
307
361
|
function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
362
|
+
const t = useT();
|
|
363
|
+
const locale = useLocale();
|
|
308
364
|
const [series, setSeries] = useState("totalTokens");
|
|
309
365
|
const [activeLabel, setActiveLabel] = useState("");
|
|
310
366
|
const active = buckets.find((bucket) => bucket.label === activeLabel) ?? buckets.at(-1);
|
|
311
367
|
const max = seriesMax(buckets.map((bucket) => bucket[series]));
|
|
312
|
-
const unit = bucketUnit ? `${bucketUnit} ` : "";
|
|
368
|
+
const unit = bucketUnit ? `${bucketUnit === "day" ? t("log.ui.unitDay", "day") : bucketUnit === "hour" ? t("log.ui.unitHour", "hour") : bucketUnit} ` : "";
|
|
313
369
|
const slot = PLOT_WIDTH / Math.max(1, buckets.length);
|
|
314
370
|
const width = Math.min(MAX_COLUMN_WIDTH, slot * .65);
|
|
315
|
-
if (buckets.length === 0) return /* @__PURE__ */ jsx(
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
371
|
+
if (buckets.length === 0) return /* @__PURE__ */ jsx(EmptyState, {
|
|
372
|
+
size: "compact",
|
|
373
|
+
icon: /* @__PURE__ */ jsx(CalendarIcon, {}),
|
|
374
|
+
title: t("log.ui.noTimelineBuckets", "No timeline buckets"),
|
|
375
|
+
description: t("log.ui.noneWereRecordedForThisSelection", "None were recorded for this selection."),
|
|
376
|
+
"data-testid": "metrics-timeline-chart"
|
|
319
377
|
});
|
|
320
378
|
if (buckets.length === 1 && active !== void 0) return /* @__PURE__ */ jsx("div", {
|
|
321
379
|
className: "flex flex-col gap-4",
|
|
@@ -327,29 +385,25 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
327
385
|
className: "text-sm text-po-dim",
|
|
328
386
|
children: active.label
|
|
329
387
|
}),
|
|
330
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ jsx("p", {
|
|
331
389
|
className: "mt-2 text-lg font-semibold tabular-nums text-po-blue",
|
|
332
390
|
title: String(active.totalTokens),
|
|
333
|
-
children:
|
|
391
|
+
children: t("log.ui.tokens", "{count} tokens", { count: formatTokens(active.totalTokens) })
|
|
334
392
|
}),
|
|
335
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ jsx("p", {
|
|
336
394
|
className: "mt-3 text-sm leading-relaxed text-po-dim",
|
|
337
|
-
children:
|
|
338
|
-
"Only one ",
|
|
339
|
-
unit,
|
|
340
|
-
"bucket was recorded. There is not enough history to show a trend."
|
|
341
|
-
]
|
|
395
|
+
children: t("log.ui.singleBucket", "Only one {unit}bucket was recorded. There is not enough history to show a trend.", { unit })
|
|
342
396
|
}),
|
|
343
397
|
/* @__PURE__ */ jsx("p", {
|
|
344
398
|
className: "mt-2 text-sm text-po-dim",
|
|
345
|
-
children: "For more detail, pick a shorter period when one is available."
|
|
399
|
+
children: t("log.ui.forMoreDetailPickAShorterPeriodWhenOneIsAvailable", "For more detail, pick a shorter period when one is available.")
|
|
346
400
|
}),
|
|
347
401
|
onShorterPeriod === void 0 ? null : /* @__PURE__ */ jsx(Button, {
|
|
348
402
|
variant: "ghost",
|
|
349
403
|
size: "sm",
|
|
350
404
|
className: "mt-3",
|
|
351
405
|
onClick: onShorterPeriod,
|
|
352
|
-
children: "View hourly detail"
|
|
406
|
+
children: t("log.ui.viewHourlyDetail", "View hourly detail")
|
|
353
407
|
})
|
|
354
408
|
]
|
|
355
409
|
})
|
|
@@ -363,7 +417,7 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
363
417
|
children: [/* @__PURE__ */ jsx("div", {
|
|
364
418
|
className: "flex gap-1",
|
|
365
419
|
role: "group",
|
|
366
|
-
"aria-label": "Timeline token counter",
|
|
420
|
+
"aria-label": t("log.ui.timelineTokenCounter", "Timeline token counter"),
|
|
367
421
|
children: SERIES.map((item) => /* @__PURE__ */ jsx(Button, {
|
|
368
422
|
size: "sm",
|
|
369
423
|
variant: series === item.key ? "primary" : "ghost",
|
|
@@ -371,14 +425,12 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
371
425
|
onClick: () => setSeries(item.key),
|
|
372
426
|
children: item.label
|
|
373
427
|
}, item.key))
|
|
374
|
-
}), /* @__PURE__ */
|
|
428
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
375
429
|
className: "text-sm text-po-dim",
|
|
376
|
-
children:
|
|
377
|
-
buckets.length,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
"buckets"
|
|
381
|
-
]
|
|
430
|
+
children: t("log.ui.recordedBuckets", "{count} recorded {unit}buckets", {
|
|
431
|
+
count: buckets.length,
|
|
432
|
+
unit
|
|
433
|
+
})
|
|
382
434
|
})]
|
|
383
435
|
}),
|
|
384
436
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -396,7 +448,7 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
396
448
|
preserveAspectRatio: "none",
|
|
397
449
|
className: "h-40 min-w-0 flex-1 overflow-visible",
|
|
398
450
|
role: "group",
|
|
399
|
-
"aria-label":
|
|
451
|
+
"aria-label": t("log.ui.bucketPeak", "tokens per bucket, peak {count}", { count: formatTokens(max) }),
|
|
400
452
|
children: [[
|
|
401
453
|
0,
|
|
402
454
|
PLOT_HEIGHT / 2,
|
|
@@ -411,7 +463,11 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
411
463
|
vectorEffect: "non-scaling-stroke"
|
|
412
464
|
}, y)), buckets.map((bucket, index) => {
|
|
413
465
|
const height = barFraction(bucket[series], max) * PLOT_HEIGHT;
|
|
414
|
-
const label =
|
|
466
|
+
const label = t("log.ui.bucketLabel", "{bucket}: {count} {series} tokens", {
|
|
467
|
+
bucket: bucket.label,
|
|
468
|
+
count: formatTokens(bucket[series]),
|
|
469
|
+
series: SERIES.find((item) => item.key === series)?.label.toLowerCase() ?? ""
|
|
470
|
+
});
|
|
415
471
|
return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("rect", {
|
|
416
472
|
x: index * slot + (slot - width) / 2,
|
|
417
473
|
y: PLOT_HEIGHT - height,
|
|
@@ -459,29 +515,23 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
459
515
|
children: [/* @__PURE__ */ jsx("span", {
|
|
460
516
|
className: "text-po-dim",
|
|
461
517
|
children: active?.label
|
|
462
|
-
}), /* @__PURE__ */
|
|
518
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
463
519
|
className: "text-po-hi",
|
|
464
|
-
children:
|
|
465
|
-
formatTokens(active?.[series] ?? NaN),
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
" tokens"
|
|
469
|
-
]
|
|
520
|
+
children: t("log.ui.seriesTokens", "{count} {series} tokens", {
|
|
521
|
+
count: formatTokens(active?.[series] ?? NaN),
|
|
522
|
+
series: SERIES.find((item) => item.key === series)?.label.toLowerCase() ?? ""
|
|
523
|
+
})
|
|
470
524
|
})]
|
|
471
525
|
}),
|
|
472
|
-
max === 0 ? /* @__PURE__ */
|
|
526
|
+
max === 0 ? /* @__PURE__ */ jsx("p", {
|
|
473
527
|
className: "text-sm text-po-dim",
|
|
474
|
-
children:
|
|
475
|
-
"Recorded buckets contain zero ",
|
|
476
|
-
SERIES.find((item) => item.key === series)?.label.toLowerCase(),
|
|
477
|
-
" tokens."
|
|
478
|
-
]
|
|
528
|
+
children: t("log.ui.zeroTokens", "Recorded buckets contain zero {series} tokens.", { series: SERIES.find((item) => item.key === series)?.label.toLowerCase() ?? "" })
|
|
479
529
|
}) : null,
|
|
480
530
|
/* @__PURE__ */ jsxs("details", {
|
|
481
531
|
className: "text-sm text-po-dim",
|
|
482
532
|
children: [/* @__PURE__ */ jsx("summary", {
|
|
483
533
|
className: "cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue",
|
|
484
|
-
children: "View exact bucket values"
|
|
534
|
+
children: t("log.ui.viewExactBucketValues", "View exact bucket values")
|
|
485
535
|
}), /* @__PURE__ */ jsx("div", {
|
|
486
536
|
className: "mt-3 overflow-x-auto",
|
|
487
537
|
children: /* @__PURE__ */ jsxs("table", {
|
|
@@ -489,28 +539,28 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
489
539
|
children: [
|
|
490
540
|
/* @__PURE__ */ jsx("caption", {
|
|
491
541
|
className: "sr-only",
|
|
492
|
-
children: "Independent token counters by recorded bucket"
|
|
542
|
+
children: t("log.ui.independentTokenCountersByRecordedBucket", "Independent token counters by recorded bucket")
|
|
493
543
|
}),
|
|
494
544
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
495
545
|
/* @__PURE__ */ jsx("th", {
|
|
496
546
|
scope: "col",
|
|
497
547
|
className: "py-2 text-left",
|
|
498
|
-
children: "Bucket"
|
|
548
|
+
children: t("log.ui.bucket", "Bucket")
|
|
499
549
|
}),
|
|
500
550
|
/* @__PURE__ */ jsx("th", {
|
|
501
551
|
scope: "col",
|
|
502
552
|
className: "pl-3",
|
|
503
|
-
children: "Total"
|
|
553
|
+
children: t("log.ui.total", "Total")
|
|
504
554
|
}),
|
|
505
555
|
/* @__PURE__ */ jsx("th", {
|
|
506
556
|
scope: "col",
|
|
507
557
|
className: "pl-3",
|
|
508
|
-
children: "Input"
|
|
558
|
+
children: t("log.ui.input", "Input")
|
|
509
559
|
}),
|
|
510
560
|
/* @__PURE__ */ jsx("th", {
|
|
511
561
|
scope: "col",
|
|
512
562
|
className: "pl-3",
|
|
513
|
-
children: "Output"
|
|
563
|
+
children: t("log.ui.output", "Output")
|
|
514
564
|
})
|
|
515
565
|
] }) }),
|
|
516
566
|
/* @__PURE__ */ jsx("tbody", { children: buckets.map((bucket) => /* @__PURE__ */ jsxs("tr", {
|
|
@@ -521,7 +571,7 @@ function TimelineChart({ buckets, bucketUnit, onShorterPeriod }) {
|
|
|
521
571
|
children: bucket.label
|
|
522
572
|
}), SERIES.map((item) => /* @__PURE__ */ jsx("td", {
|
|
523
573
|
className: "pl-3",
|
|
524
|
-
children: Number.isFinite(bucket[item.key]) ? bucket[item.key].toLocaleString(
|
|
574
|
+
children: Number.isFinite(bucket[item.key]) ? bucket[item.key].toLocaleString(locale) : t("log.ui.notReported", "Not reported")
|
|
525
575
|
}, item.key))]
|
|
526
576
|
}, bucket.label)) })
|
|
527
577
|
]
|
|
@@ -596,10 +646,11 @@ function countRows(counts) {
|
|
|
596
646
|
/** A short, human label for a problem; the detail can be a whole command line. */
|
|
597
647
|
function titleOf(group) {
|
|
598
648
|
if (group.errorType !== null) return group.errorType;
|
|
599
|
-
if (group.tool !== null) return
|
|
649
|
+
if (group.tool !== null) return t("log.ui.toolFailed", "{tool} failed", { tool: group.tool });
|
|
600
650
|
return group.category;
|
|
601
651
|
}
|
|
602
652
|
function IssueRow({ group, max, tools }) {
|
|
653
|
+
const t = useT();
|
|
603
654
|
const [open, setOpen] = useState(false);
|
|
604
655
|
const width = `${(barFraction(group.occurrences, max) * 100).toFixed(2)}%`;
|
|
605
656
|
const calls = tools.find((tool) => tool.name === group.tool)?.calls;
|
|
@@ -630,9 +681,9 @@ function IssueRow({ group, max, tools }) {
|
|
|
630
681
|
className: "min-w-40 flex-1 break-words text-po-dim",
|
|
631
682
|
children: group.detail
|
|
632
683
|
}),
|
|
633
|
-
calls === void 0 ? null : /* @__PURE__ */
|
|
684
|
+
calls === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
634
685
|
className: "shrink-0 text-po-dim",
|
|
635
|
-
children:
|
|
686
|
+
children: t("log.ui.tokenSamples", "{count} token samples", { count: calls })
|
|
636
687
|
})
|
|
637
688
|
]
|
|
638
689
|
})]
|
|
@@ -643,13 +694,41 @@ function IssueRow({ group, max, tools }) {
|
|
|
643
694
|
/* @__PURE__ */ jsxs("div", {
|
|
644
695
|
className: "flex flex-wrap gap-x-3 gap-y-1 text-sm text-po-dim",
|
|
645
696
|
children: [
|
|
646
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
group.
|
|
652
|
-
|
|
697
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
698
|
+
t("log.ui.category", "category"),
|
|
699
|
+
" ",
|
|
700
|
+
group.category
|
|
701
|
+
] }),
|
|
702
|
+
group.tool === null ? null : /* @__PURE__ */ jsxs("span", { children: [
|
|
703
|
+
t("log.ui.tool", "tool"),
|
|
704
|
+
" ",
|
|
705
|
+
group.tool
|
|
706
|
+
] }),
|
|
707
|
+
group.errorType === null ? null : /* @__PURE__ */ jsxs("span", { children: [
|
|
708
|
+
t("log.ui.error", "error"),
|
|
709
|
+
" ",
|
|
710
|
+
group.errorType
|
|
711
|
+
] }),
|
|
712
|
+
group.statusCode === null ? null : /* @__PURE__ */ jsxs("span", { children: [
|
|
713
|
+
t("log.ui.status", "status"),
|
|
714
|
+
" ",
|
|
715
|
+
group.statusCode
|
|
716
|
+
] }),
|
|
717
|
+
group.agentName === null ? null : /* @__PURE__ */ jsxs("span", { children: [
|
|
718
|
+
t("log.ui.agent", "agent"),
|
|
719
|
+
" ",
|
|
720
|
+
group.agentName
|
|
721
|
+
] }),
|
|
722
|
+
group.model === null ? null : /* @__PURE__ */ jsxs("span", { children: [
|
|
723
|
+
t("log.ui.model", "model"),
|
|
724
|
+
" ",
|
|
725
|
+
group.model
|
|
726
|
+
] }),
|
|
727
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
728
|
+
t("log.ui.lastSeen", "last seen"),
|
|
729
|
+
" ",
|
|
730
|
+
group.lastSeen
|
|
731
|
+
] })
|
|
653
732
|
]
|
|
654
733
|
}),
|
|
655
734
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -676,26 +755,24 @@ function IssueRow({ group, max, tools }) {
|
|
|
676
755
|
});
|
|
677
756
|
}
|
|
678
757
|
function IssuesDetail({ view, tools, summaryCount }) {
|
|
758
|
+
const t = useT();
|
|
679
759
|
const groups = groupIssues(view.samples);
|
|
680
760
|
const max = groups[0]?.occurrences ?? 0;
|
|
681
761
|
const callsByTool = new Map(tools.map((tool) => [tool.name, tool.calls]));
|
|
682
762
|
return /* @__PURE__ */ jsxs("div", {
|
|
683
763
|
className: "flex flex-col gap-3",
|
|
684
764
|
children: [
|
|
685
|
-
summaryCount !== void 0 && summaryCount !== view.totalIssues ? /* @__PURE__ */
|
|
765
|
+
summaryCount !== void 0 && summaryCount !== view.totalIssues ? /* @__PURE__ */ jsx("p", {
|
|
686
766
|
className: "rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm leading-relaxed text-po-yellow",
|
|
687
767
|
role: "status",
|
|
688
768
|
"data-testid": "metrics-issue-count-mismatch",
|
|
689
|
-
children:
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
view.totalIssues,
|
|
697
|
-
". The counts differ, so these details should not be treated as a complete explanation of the summary."
|
|
698
|
-
]
|
|
769
|
+
children: summaryCount === 1 ? t("log.ui.countMismatchOne", "The summary reports {summary} issue; incident analysis returned {incidents}. The counts differ, so these details should not be treated as a complete explanation of the summary.", {
|
|
770
|
+
summary: summaryCount,
|
|
771
|
+
incidents: view.totalIssues
|
|
772
|
+
}) : t("log.ui.countMismatch", "The summary reports {summary} issues; incident analysis returned {incidents}. The counts differ, so these details should not be treated as a complete explanation of the summary.", {
|
|
773
|
+
summary: summaryCount,
|
|
774
|
+
incidents: view.totalIssues
|
|
775
|
+
})
|
|
699
776
|
}) : null,
|
|
700
777
|
/* @__PURE__ */ jsxs("span", {
|
|
701
778
|
className: "text-sm text-po-dim",
|
|
@@ -704,18 +781,19 @@ function IssuesDetail({ view, tools, summaryCount }) {
|
|
|
704
781
|
className: "text-po-hi",
|
|
705
782
|
children: view.totalIssues
|
|
706
783
|
}),
|
|
707
|
-
" occurrences of",
|
|
708
|
-
" ",
|
|
784
|
+
t("log.ui.occurrencesOf", " occurrences of "),
|
|
709
785
|
/* @__PURE__ */ jsx("span", {
|
|
710
786
|
className: "text-po-hi",
|
|
711
787
|
children: groups.length
|
|
712
788
|
}),
|
|
713
|
-
" distinct problems in the returned samples, most frequent first"
|
|
789
|
+
t("log.ui.distinctProblems", " distinct problems in the returned samples, most frequent first")
|
|
714
790
|
]
|
|
715
791
|
}),
|
|
716
|
-
groups.length === 0 ? /* @__PURE__ */ jsx(
|
|
717
|
-
|
|
718
|
-
|
|
792
|
+
groups.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
793
|
+
size: "compact",
|
|
794
|
+
icon: view.totalIssues === 0 ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
795
|
+
title: view.totalIssues === 0 ? t("log.ui.noIssuesDetected", "No issues detected") : t("log.ui.noIncidentSamples", "No incident samples"),
|
|
796
|
+
description: view.totalIssues === 0 ? t("log.ui.noIssuesWereDetectedInTheReturnedAnalysisThisDoesNotEstablish", "No issues were detected in the returned analysis. This does not establish coverage of unrecorded activity.") : t("log.ui.theAnalysisCountedIssuesButReturnedNoIncidentSamples", "The analysis counted issues but returned no incident samples.")
|
|
719
797
|
}) : /* @__PURE__ */ jsx("ul", {
|
|
720
798
|
className: "flex flex-col gap-2",
|
|
721
799
|
"data-testid": "metrics-issue-groups",
|
|
@@ -729,7 +807,7 @@ function IssuesDetail({ view, tools, summaryCount }) {
|
|
|
729
807
|
className: "flex flex-col gap-2 overflow-x-auto",
|
|
730
808
|
children: [/* @__PURE__ */ jsx("h4", {
|
|
731
809
|
className: "text-base font-semibold text-po-hi",
|
|
732
|
-
children: "Failures by tool"
|
|
810
|
+
children: t("log.ui.failuresByTool", "Failures by tool")
|
|
733
811
|
}), /* @__PURE__ */ jsxs("table", {
|
|
734
812
|
className: "w-full text-sm",
|
|
735
813
|
"data-testid": "metrics-issues-tools",
|
|
@@ -739,17 +817,17 @@ function IssuesDetail({ view, tools, summaryCount }) {
|
|
|
739
817
|
/* @__PURE__ */ jsx("th", {
|
|
740
818
|
scope: "col",
|
|
741
819
|
className: "py-2 text-left font-normal",
|
|
742
|
-
children: "Tool"
|
|
820
|
+
children: t("log.ui.toolTitle", "Tool")
|
|
743
821
|
}),
|
|
744
822
|
/* @__PURE__ */ jsx("th", {
|
|
745
823
|
scope: "col",
|
|
746
824
|
className: "text-right font-normal",
|
|
747
|
-
children: "Failures"
|
|
825
|
+
children: t("log.ui.failures", "Failures")
|
|
748
826
|
}),
|
|
749
827
|
/* @__PURE__ */ jsx("th", {
|
|
750
828
|
scope: "col",
|
|
751
829
|
className: "text-right font-normal",
|
|
752
|
-
children: "Attribution context"
|
|
830
|
+
children: t("log.ui.attributionContext", "Attribution context")
|
|
753
831
|
})
|
|
754
832
|
]
|
|
755
833
|
}) }), /* @__PURE__ */ jsx("tbody", { children: countRows(view.byTool).map(([name, failures]) => {
|
|
@@ -767,7 +845,7 @@ function IssuesDetail({ view, tools, summaryCount }) {
|
|
|
767
845
|
}),
|
|
768
846
|
/* @__PURE__ */ jsx("td", {
|
|
769
847
|
className: "w-28 py-2 text-right text-po-dim",
|
|
770
|
-
children: calls === void 0 ? "no token samples" :
|
|
848
|
+
children: calls === void 0 ? t("log.ui.noTokenSamples", "no token samples") : t("log.ui.tokenSamples", "{count} token samples", { count: calls })
|
|
771
849
|
})
|
|
772
850
|
]
|
|
773
851
|
}, name);
|
|
@@ -778,7 +856,7 @@ function IssuesDetail({ view, tools, summaryCount }) {
|
|
|
778
856
|
className: "flex flex-wrap gap-x-4 gap-y-1 text-sm text-po-dim",
|
|
779
857
|
children: [/* @__PURE__ */ jsx("span", {
|
|
780
858
|
className: "text-sm font-semibold text-po-dim",
|
|
781
|
-
children: "by category"
|
|
859
|
+
children: t("log.ui.byCategory", "by category")
|
|
782
860
|
}), countRows(view.byCategory).map(([name, count]) => /* @__PURE__ */ jsxs("span", { children: [
|
|
783
861
|
name,
|
|
784
862
|
" ",
|
|
@@ -795,6 +873,7 @@ function IssuesDetail({ view, tools, summaryCount }) {
|
|
|
795
873
|
//#region src/extensions/(frontend)/setting/_components/IssuesSection.tsx
|
|
796
874
|
/** Issue analysis is an explicit read, not another request on every metrics refresh. */
|
|
797
875
|
function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope = false }) {
|
|
876
|
+
const t = useT();
|
|
798
877
|
const [view, setView] = useState();
|
|
799
878
|
const [message, setMessage] = useState("");
|
|
800
879
|
const [loading, setLoading] = useState(false);
|
|
@@ -827,13 +906,13 @@ function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope =
|
|
|
827
906
|
}).then((result) => {
|
|
828
907
|
if (controller.signal.aborted) return;
|
|
829
908
|
setLoading(false);
|
|
830
|
-
if ("error" in result) setMessage(result.error || "Issue details could not be loaded.");
|
|
909
|
+
if ("error" in result) setMessage(result.error || t("log.ui.issueDetailsCouldNotBeLoaded", "Issue details could not be loaded."));
|
|
831
910
|
else if (isIssuesUnavailable(result.issues)) setMessage(result.issues.detail);
|
|
832
911
|
else setView(result.issues);
|
|
833
912
|
}).catch((error) => {
|
|
834
913
|
if (controller.signal.aborted) return;
|
|
835
914
|
setLoading(false);
|
|
836
|
-
setMessage(error instanceof Error ? error.message : "Issue details could not be loaded.");
|
|
915
|
+
setMessage(error instanceof Error ? error.message : t("log.ui.issueDetailsCouldNotBeLoaded", "Issue details could not be loaded."));
|
|
837
916
|
});
|
|
838
917
|
};
|
|
839
918
|
return /* @__PURE__ */ jsxs("section", {
|
|
@@ -844,14 +923,14 @@ function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope =
|
|
|
844
923
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
845
924
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("h3", {
|
|
846
925
|
className: "text-lg font-semibold text-po-hi",
|
|
847
|
-
children: ["Issues to investigate", count === void 0 ? "" :
|
|
926
|
+
children: [t("log.ui.issuesToInvestigate", "Issues to investigate"), count === void 0 ? "" : count === 1 ? t("log.ui.issuesSuffixOne", " · {count} issue", { count }) : t("log.ui.issuesSuffix", " · {count} issues", { count })]
|
|
848
927
|
}), /* @__PURE__ */ jsx("p", {
|
|
849
928
|
className: "mt-1 text-sm text-po-dim",
|
|
850
|
-
children: "Inspect recurring failures and the evidence behind them."
|
|
929
|
+
children: t("log.ui.inspectRecurringFailuresAndTheEvidenceBehindThem", "Inspect recurring failures and the evidence behind them.")
|
|
851
930
|
})] }), /* @__PURE__ */ jsxs("div", {
|
|
852
931
|
className: "flex items-center gap-2",
|
|
853
932
|
children: [
|
|
854
|
-
loading ? /* @__PURE__ */ jsx(Spinner, { label: "Reading issue details" }) : null,
|
|
933
|
+
loading ? /* @__PURE__ */ jsx(Spinner, { label: t("log.ui.readingIssueDetails", "Reading issue details") }) : null,
|
|
855
934
|
/* @__PURE__ */ jsx(Button, {
|
|
856
935
|
variant: "outline",
|
|
857
936
|
size: "md",
|
|
@@ -860,7 +939,7 @@ function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope =
|
|
|
860
939
|
"aria-expanded": open,
|
|
861
940
|
"aria-controls": detailsId,
|
|
862
941
|
"data-testid": open ? "metrics-issues-reload" : "metrics-issues-open",
|
|
863
|
-
children: open ? "Reload details" : "Inspect issues"
|
|
942
|
+
children: open ? t("log.ui.reloadDetails", "Reload details") : t("log.ui.inspectIssues", "Inspect issues")
|
|
864
943
|
}),
|
|
865
944
|
open ? /* @__PURE__ */ jsx(Button, {
|
|
866
945
|
variant: "ghost",
|
|
@@ -871,7 +950,7 @@ function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope =
|
|
|
871
950
|
setOpen(false);
|
|
872
951
|
},
|
|
873
952
|
"aria-controls": detailsId,
|
|
874
|
-
children: "Hide"
|
|
953
|
+
children: t("log.ui.hide", "Hide")
|
|
875
954
|
}) : null
|
|
876
955
|
]
|
|
877
956
|
})]
|
|
@@ -879,11 +958,12 @@ function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope =
|
|
|
879
958
|
/* @__PURE__ */ jsxs("p", {
|
|
880
959
|
className: "text-sm leading-relaxed text-po-dim",
|
|
881
960
|
children: [
|
|
882
|
-
"Details are loaded on demand.",
|
|
883
961
|
" ",
|
|
884
|
-
|
|
962
|
+
t("log.ui.detailsAreLoadedOnDemand", "Details are loaded on demand."),
|
|
963
|
+
" ",
|
|
964
|
+
startTime === void 0 ? endTime === void 0 ? t("log.ui.thisHubDidNotReportATimeWindowDetailsCoverAllAvailable", "This hub did not report a time window; details cover all available history.") : t("log.ui.detailsCoverAvailableHistoryUpToReportTimeNoStartBoundWas", "Details cover available history up to report time; no start bound was supplied.") : t("log.ui.detailsUseTheReportSRecordedTimeWindow", "Details use the report’s recorded time window."),
|
|
885
965
|
" ",
|
|
886
|
-
broaderScope ? "LogSink cannot filter issue details by model, provider or agent, so this analysis covers all groups in that window." : focus === void 0 ? "Analysis covers all groups." : "Filtered to this session."
|
|
966
|
+
broaderScope ? t("log.ui.logsinkCannotFilterIssueDetailsByModelProviderOrAgentSoThis", "LogSink cannot filter issue details by model, provider or agent, so this analysis covers all groups in that window.") : focus === void 0 ? t("log.ui.analysisCoversAllGroups", "Analysis covers all groups.") : t("log.ui.filteredToThisSession", "Filtered to this session.")
|
|
887
967
|
]
|
|
888
968
|
}),
|
|
889
969
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -900,7 +980,7 @@ function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope =
|
|
|
900
980
|
loading ? /* @__PURE__ */ jsx("p", {
|
|
901
981
|
role: "status",
|
|
902
982
|
className: "py-3 text-sm text-po-dim",
|
|
903
|
-
children: "Reading recorded incidents..."
|
|
983
|
+
children: t("log.ui.readingRecordedIncidents", "Reading recorded incidents...")
|
|
904
984
|
}) : null,
|
|
905
985
|
view === void 0 ? null : /* @__PURE__ */ jsx(IssuesDetail, {
|
|
906
986
|
view,
|
|
@@ -916,29 +996,31 @@ function IssuesSection({ tools, focus, count, startTime, endTime, broaderScope =
|
|
|
916
996
|
//#region src/extensions/(frontend)/setting/_components/MetricsSummary.tsx
|
|
917
997
|
/** Independent counters, never a stacked breakdown of the provider total. */
|
|
918
998
|
function MetricsSummary({ totals }) {
|
|
999
|
+
const t = useT();
|
|
1000
|
+
const locale = useLocale();
|
|
919
1001
|
const cards = [
|
|
920
1002
|
{
|
|
921
|
-
label: "Total tokens",
|
|
1003
|
+
label: t("log.ui.totalTokens", "Total tokens"),
|
|
922
1004
|
value: totals.totalTokens,
|
|
923
|
-
detail: "Provider-reported total",
|
|
1005
|
+
detail: t("log.ui.providerReportedTotal", "Provider-reported total"),
|
|
924
1006
|
color: "text-po-blue"
|
|
925
1007
|
},
|
|
926
1008
|
{
|
|
927
|
-
label: "Input tokens",
|
|
1009
|
+
label: t("log.ui.inputTokens", "Input tokens"),
|
|
928
1010
|
value: totals.inputTokens,
|
|
929
|
-
detail: "Reported input counter",
|
|
1011
|
+
detail: t("log.ui.reportedInputCounter", "Reported input counter"),
|
|
930
1012
|
color: "text-po-hi"
|
|
931
1013
|
},
|
|
932
1014
|
{
|
|
933
|
-
label: "Output tokens",
|
|
1015
|
+
label: t("log.ui.outputTokens", "Output tokens"),
|
|
934
1016
|
value: totals.outputTokens,
|
|
935
|
-
detail: "Reported output counter",
|
|
1017
|
+
detail: t("log.ui.reportedOutputCounter", "Reported output counter"),
|
|
936
1018
|
color: "text-po-hi"
|
|
937
1019
|
},
|
|
938
1020
|
{
|
|
939
|
-
label: "Recorded issues",
|
|
1021
|
+
label: t("log.ui.recordedIssues", "Recorded issues"),
|
|
940
1022
|
value: totals.issueCount,
|
|
941
|
-
detail: "Detected in this selection",
|
|
1023
|
+
detail: t("log.ui.detectedInThisSelection", "Detected in this selection"),
|
|
942
1024
|
color: totals.issueCount > 0 ? "text-po-yellow" : "text-po-hi"
|
|
943
1025
|
}
|
|
944
1026
|
];
|
|
@@ -954,7 +1036,7 @@ function MetricsSummary({ totals }) {
|
|
|
954
1036
|
}),
|
|
955
1037
|
/* @__PURE__ */ jsx("dd", {
|
|
956
1038
|
className: `mt-2 text-lg font-semibold tabular-nums ${card.color}`,
|
|
957
|
-
title: Number.isFinite(card.value) ? card.value.toLocaleString(
|
|
1039
|
+
title: Number.isFinite(card.value) ? card.value.toLocaleString(locale) : t("log.ui.notReported", "Not reported"),
|
|
958
1040
|
children: formatTokens(card.value)
|
|
959
1041
|
}),
|
|
960
1042
|
/* @__PURE__ */ jsx("dd", {
|
|
@@ -969,45 +1051,42 @@ function MetricsSummary({ totals }) {
|
|
|
969
1051
|
//#region src/extensions/(frontend)/setting/_components/ToolMetrics.tsx
|
|
970
1052
|
/** The sink attributes a whole turn to its tools. These are samples, not bills. */
|
|
971
1053
|
function ToolMetrics({ tools }) {
|
|
1054
|
+
const t = useT();
|
|
972
1055
|
const [sort, setSort] = useState("p90TotalTokens");
|
|
973
1056
|
const rows = [...tools].sort((a, b) => b[sort] - a[sort] || a.name.localeCompare(b.name));
|
|
974
1057
|
return /* @__PURE__ */ jsxs("section", {
|
|
975
1058
|
className: "flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4",
|
|
976
|
-
"aria-label": "Tool token samples",
|
|
1059
|
+
"aria-label": t("log.ui.toolTokenSamples", "Tool token samples"),
|
|
977
1060
|
children: [
|
|
978
1061
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
979
1062
|
className: "text-lg font-semibold text-po-hi",
|
|
980
|
-
children: "Tool token samples"
|
|
1063
|
+
children: t("log.ui.toolTokenSamples", "Tool token samples")
|
|
981
1064
|
}), /* @__PURE__ */ jsx("p", {
|
|
982
1065
|
className: "mt-1 text-sm text-po-dim",
|
|
983
|
-
children: "Which tools participate in token-heavy turns?"
|
|
1066
|
+
children: t("log.ui.whichToolsParticipateInTokenHeavyTurns", "Which tools participate in token-heavy turns?")
|
|
984
1067
|
})] }),
|
|
985
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
992
|
-
className: "text-sm leading-relaxed text-po-dim",
|
|
993
|
-
children: "Tool execution logs may exist, but this selection has no samples that connect tools to model usage. This does not mean no tools ran."
|
|
994
|
-
})]
|
|
1068
|
+
rows.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
1069
|
+
size: "compact",
|
|
1070
|
+
icon: /* @__PURE__ */ jsx(WrenchIcon, {}),
|
|
1071
|
+
title: t("log.ui.noTokenAttributedToolCalls", "No token-attributed tool calls"),
|
|
1072
|
+
description: t("log.ui.toolExecutionLogsMayExistButThisSelectionHasNoSamplesThat", "Tool execution logs may exist, but this selection has no samples that connect tools to model usage. This does not mean no tools ran."),
|
|
1073
|
+
"data-testid": "metrics-tools-empty"
|
|
995
1074
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
996
1075
|
className: "flex flex-wrap gap-1",
|
|
997
1076
|
role: "group",
|
|
998
|
-
"aria-label": "Rank tool samples by",
|
|
1077
|
+
"aria-label": t("log.ui.rankToolSamplesBy", "Rank tool samples by"),
|
|
999
1078
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
1000
1079
|
size: "sm",
|
|
1001
1080
|
variant: sort === "p90TotalTokens" ? "primary" : "ghost",
|
|
1002
1081
|
"aria-pressed": sort === "p90TotalTokens",
|
|
1003
1082
|
onClick: () => setSort("p90TotalTokens"),
|
|
1004
|
-
children: "P90 turn tokens"
|
|
1083
|
+
children: t("log.ui.p90TurnTokens", "P90 turn tokens")
|
|
1005
1084
|
}), /* @__PURE__ */ jsx(Button, {
|
|
1006
1085
|
size: "sm",
|
|
1007
1086
|
variant: sort === "calls" ? "primary" : "ghost",
|
|
1008
1087
|
"aria-pressed": sort === "calls",
|
|
1009
1088
|
onClick: () => setSort("calls"),
|
|
1010
|
-
children: "Sampled calls"
|
|
1089
|
+
children: t("log.ui.sampledCalls", "Sampled calls")
|
|
1011
1090
|
})]
|
|
1012
1091
|
}), /* @__PURE__ */ jsx("div", {
|
|
1013
1092
|
className: "overflow-x-auto",
|
|
@@ -1015,9 +1094,9 @@ function ToolMetrics({ tools }) {
|
|
|
1015
1094
|
className: "w-full text-base tabular-nums",
|
|
1016
1095
|
"data-testid": "metrics-tools",
|
|
1017
1096
|
children: [
|
|
1018
|
-
/* @__PURE__ */
|
|
1097
|
+
/* @__PURE__ */ jsx("caption", {
|
|
1019
1098
|
className: "sr-only",
|
|
1020
|
-
children:
|
|
1099
|
+
children: t("log.ui.toolsRanked", "Tools ranked by {sort}", { sort: sort === "calls" ? t("log.ui.sampledCallsLower", "sampled calls") : t("log.ui.90thPercentileWholeTurnTokens", "90th percentile whole-turn tokens") })
|
|
1021
1100
|
}),
|
|
1022
1101
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", {
|
|
1023
1102
|
className: "border-b border-po-border text-sm text-po-dim",
|
|
@@ -1025,17 +1104,17 @@ function ToolMetrics({ tools }) {
|
|
|
1025
1104
|
/* @__PURE__ */ jsx("th", {
|
|
1026
1105
|
scope: "col",
|
|
1027
1106
|
className: "pb-2 text-left font-normal",
|
|
1028
|
-
children: "Tool"
|
|
1107
|
+
children: t("log.ui.toolTitle", "Tool")
|
|
1029
1108
|
}),
|
|
1030
1109
|
/* @__PURE__ */ jsx("th", {
|
|
1031
1110
|
scope: "col",
|
|
1032
1111
|
className: "pb-2 pl-3 text-right font-normal",
|
|
1033
|
-
children: "Sampled calls"
|
|
1112
|
+
children: t("log.ui.sampledCalls", "Sampled calls")
|
|
1034
1113
|
}),
|
|
1035
1114
|
/* @__PURE__ */ jsx("th", {
|
|
1036
1115
|
scope: "col",
|
|
1037
1116
|
className: "pb-2 pl-3 text-right font-normal",
|
|
1038
|
-
children: "P90 turn tokens"
|
|
1117
|
+
children: t("log.ui.p90TurnTokens", "P90 turn tokens")
|
|
1039
1118
|
})
|
|
1040
1119
|
]
|
|
1041
1120
|
}) }),
|
|
@@ -1065,10 +1144,10 @@ function ToolMetrics({ tools }) {
|
|
|
1065
1144
|
className: "text-sm leading-relaxed text-po-dim",
|
|
1066
1145
|
children: [/* @__PURE__ */ jsx("summary", {
|
|
1067
1146
|
className: "cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue",
|
|
1068
|
-
children: "How these samples are counted"
|
|
1147
|
+
children: t("log.ui.howTheseSamplesAreCounted", "How these samples are counted")
|
|
1069
1148
|
}), /* @__PURE__ */ jsx("p", {
|
|
1070
1149
|
className: "mt-2",
|
|
1071
|
-
children: "This view includes only calls with recorded token attribution; external MCP calls remain in the logs. P90 is the 90th percentile of the whole turn, not each tool's own consumption. Several tools may share a turn, so do not add these values together."
|
|
1150
|
+
children: t("log.ui.thisViewIncludesOnlyCallsWithRecordedTokenAttributionExternalMcpCalls", "This view includes only calls with recorded token attribution; external MCP calls remain in the logs. P90 is the 90th percentile of the whole turn, not each tool's own consumption. Several tools may share a turn, so do not add these values together.")
|
|
1072
1151
|
})]
|
|
1073
1152
|
})
|
|
1074
1153
|
]
|
|
@@ -1077,31 +1156,43 @@ function ToolMetrics({ tools }) {
|
|
|
1077
1156
|
//#endregion
|
|
1078
1157
|
//#region src/extensions/(frontend)/setting/_components/MetricsReportView.tsx
|
|
1079
1158
|
const DIMENSION_LABELS = {
|
|
1080
|
-
session
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1159
|
+
get session() {
|
|
1160
|
+
return t("log.ui.session", "session");
|
|
1161
|
+
},
|
|
1162
|
+
get agent() {
|
|
1163
|
+
return t("log.ui.agent", "agent");
|
|
1164
|
+
},
|
|
1165
|
+
get model() {
|
|
1166
|
+
return t("log.ui.model", "model");
|
|
1167
|
+
},
|
|
1168
|
+
get provider() {
|
|
1169
|
+
return t("log.ui.provider", "provider");
|
|
1170
|
+
}
|
|
1084
1171
|
};
|
|
1085
|
-
const DIMENSION_NOTES = {
|
|
1172
|
+
const DIMENSION_NOTES = { get session() {
|
|
1173
|
+
return t("log.ui.sessionIdsAreHashedBeforeExportSelectARowToFilterUsage", "Session ids are hashed before export. Select a row to filter usage, not to open a session.");
|
|
1174
|
+
} };
|
|
1086
1175
|
/** The same data-only dashboard is rendered by the stories and the settings panel. */
|
|
1087
1176
|
function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
1177
|
+
const t = useT();
|
|
1178
|
+
const locale = useLocale();
|
|
1088
1179
|
const label = DIMENSION_LABELS[report.dimension];
|
|
1089
1180
|
const unattributed = report.groups.filter((group) => group.key === "unknown" || group.key === "").reduce((sum, group) => sum + group.totalTokens, 0);
|
|
1090
1181
|
const counters = [
|
|
1091
1182
|
{
|
|
1092
|
-
name: "Cache reads",
|
|
1183
|
+
name: t("log.ui.cacheReads", "Cache reads"),
|
|
1093
1184
|
value: report.totals.cachedTokens
|
|
1094
1185
|
},
|
|
1095
1186
|
{
|
|
1096
|
-
name: "Reasoning tokens",
|
|
1187
|
+
name: t("log.ui.reasoningTokens", "Reasoning tokens"),
|
|
1097
1188
|
value: report.totals.reasoningTokens
|
|
1098
1189
|
},
|
|
1099
1190
|
{
|
|
1100
|
-
name: "Usage events",
|
|
1191
|
+
name: t("log.ui.usageEvents", "Usage events"),
|
|
1101
1192
|
value: report.totals.usageEventCount
|
|
1102
1193
|
},
|
|
1103
1194
|
{
|
|
1104
|
-
name: "Log and span records",
|
|
1195
|
+
name: t("log.ui.logAndSpanRecords", "Log and span records"),
|
|
1105
1196
|
value: report.totals.totalRecords
|
|
1106
1197
|
}
|
|
1107
1198
|
];
|
|
@@ -1115,13 +1206,13 @@ function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
|
1115
1206
|
className: "grid min-w-0 grid-cols-1 gap-4 @3xl:grid-cols-3",
|
|
1116
1207
|
children: [/* @__PURE__ */ jsxs("section", {
|
|
1117
1208
|
className: "flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4 @3xl:col-span-2",
|
|
1118
|
-
"aria-label": "Usage over time",
|
|
1209
|
+
"aria-label": t("log.ui.usageOverTime", "Usage over time"),
|
|
1119
1210
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
1120
1211
|
className: "text-lg font-semibold text-po-hi",
|
|
1121
|
-
children: "Usage over time"
|
|
1212
|
+
children: t("log.ui.usageOverTime", "Usage over time")
|
|
1122
1213
|
}), /* @__PURE__ */ jsx("p", {
|
|
1123
1214
|
className: "mt-1 text-sm text-po-dim",
|
|
1124
|
-
children: "Recorded tokens, not estimated spend."
|
|
1215
|
+
children: t("log.ui.recordedTokensNotEstimatedSpend", "Recorded tokens, not estimated spend.")
|
|
1125
1216
|
})] }), /* @__PURE__ */ jsx(TimelineChart, {
|
|
1126
1217
|
buckets: report.timeline,
|
|
1127
1218
|
bucketUnit: report.bucketUnit,
|
|
@@ -1129,11 +1220,11 @@ function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
|
1129
1220
|
})]
|
|
1130
1221
|
}), /* @__PURE__ */ jsxs("section", {
|
|
1131
1222
|
className: "flex min-w-0 flex-col gap-4 rounded-lg border border-po-border bg-po-panel p-4",
|
|
1132
|
-
"aria-label": "Reported counters",
|
|
1223
|
+
"aria-label": t("log.ui.reportedCounters", "Reported counters"),
|
|
1133
1224
|
children: [
|
|
1134
1225
|
/* @__PURE__ */ jsx("h3", {
|
|
1135
1226
|
className: "text-lg font-semibold text-po-hi",
|
|
1136
|
-
children: "Reported counters"
|
|
1227
|
+
children: t("log.ui.reportedCounters", "Reported counters")
|
|
1137
1228
|
}),
|
|
1138
1229
|
/* @__PURE__ */ jsx("dl", {
|
|
1139
1230
|
className: "flex flex-col gap-3",
|
|
@@ -1144,23 +1235,23 @@ function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
|
1144
1235
|
children: counter.name
|
|
1145
1236
|
}), /* @__PURE__ */ jsx("dd", {
|
|
1146
1237
|
className: "text-base font-semibold tabular-nums text-po-hi",
|
|
1147
|
-
title: counter.value === void 0 ? "Not reported" : String(counter.value),
|
|
1238
|
+
title: counter.value === void 0 ? t("log.ui.notReported", "Not reported") : String(counter.value),
|
|
1148
1239
|
children: formatTokens(counter.value ?? NaN)
|
|
1149
1240
|
})]
|
|
1150
1241
|
}, counter.name))
|
|
1151
1242
|
}),
|
|
1152
1243
|
/* @__PURE__ */ jsx("p", {
|
|
1153
1244
|
className: "text-sm leading-relaxed text-po-dim",
|
|
1154
|
-
children: "Monetary cost is not included in this metrics report."
|
|
1245
|
+
children: t("log.ui.monetaryCostIsNotIncludedInThisMetricsReport", "Monetary cost is not included in this metrics report.")
|
|
1155
1246
|
}),
|
|
1156
1247
|
/* @__PURE__ */ jsxs("details", {
|
|
1157
1248
|
className: "text-sm leading-relaxed text-po-dim",
|
|
1158
1249
|
children: [/* @__PURE__ */ jsx("summary", {
|
|
1159
1250
|
className: "cursor-pointer rounded-sm focus-visible:outline focus-visible:outline-1 focus-visible:outline-po-blue",
|
|
1160
|
-
children: "Why the counters may not add up"
|
|
1251
|
+
children: t("log.ui.whyTheCountersMayNotAddUp", "Why the counters may not add up")
|
|
1161
1252
|
}), /* @__PURE__ */ jsx("p", {
|
|
1162
1253
|
className: "mt-2",
|
|
1163
|
-
children: "The total is reported by providers. Input, output, cache reads and reasoning are independent counters and may overlap or be incomplete. They are not a breakdown and may not sum to the total. A gap is not evidence of cache traffic. Missing fields say Not reported; a recorded zero stays zero."
|
|
1254
|
+
children: t("log.ui.theTotalIsReportedByProvidersInputOutputCacheReadsAndReasoning", "The total is reported by providers. Input, output, cache reads and reasoning are independent counters and may overlap or be incomplete. They are not a breakdown and may not sum to the total. A gap is not evidence of cache traffic. Missing fields say Not reported; a recorded zero stays zero.")
|
|
1164
1255
|
})]
|
|
1165
1256
|
})
|
|
1166
1257
|
]
|
|
@@ -1170,31 +1261,27 @@ function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
|
1170
1261
|
className: "grid min-w-0 grid-cols-1 items-start gap-4 @3xl:grid-cols-2",
|
|
1171
1262
|
children: [/* @__PURE__ */ jsxs("section", {
|
|
1172
1263
|
className: "flex min-w-0 flex-col gap-3 rounded-lg border border-po-border bg-po-panel p-4",
|
|
1173
|
-
"aria-label":
|
|
1264
|
+
"aria-label": t("log.ui.tokensBy", "Tokens by {dimension}", { dimension: label }),
|
|
1174
1265
|
children: [
|
|
1175
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */
|
|
1266
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
1176
1267
|
className: "text-lg font-semibold text-po-hi",
|
|
1177
|
-
children:
|
|
1268
|
+
children: t("log.ui.tokensBy", "Tokens by {dimension}", { dimension: label })
|
|
1178
1269
|
}), /* @__PURE__ */ jsx("p", {
|
|
1179
1270
|
className: "mt-1 text-sm text-po-dim",
|
|
1180
|
-
children: "Largest recorded consumers. Select a named row to filter."
|
|
1271
|
+
children: t("log.ui.largestRecordedConsumersSelectANamedRowToFilter", "Largest recorded consumers. Select a named row to filter.")
|
|
1181
1272
|
})] }),
|
|
1182
1273
|
unattributed > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1183
1274
|
className: "rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3",
|
|
1184
1275
|
"data-testid": "metrics-attribution-notice",
|
|
1185
|
-
children: [/* @__PURE__ */
|
|
1276
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1186
1277
|
className: "text-sm font-semibold text-po-yellow",
|
|
1187
|
-
children:
|
|
1188
|
-
}), /* @__PURE__ */
|
|
1278
|
+
children: t("log.ui.attributionMissing", "{dimension} attribution missing", { dimension: label.charAt(0).toUpperCase() + label.slice(1) })
|
|
1279
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1189
1280
|
className: "mt-1 text-sm leading-relaxed text-po-dim",
|
|
1190
|
-
children:
|
|
1191
|
-
formatTokens(unattributed),
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
" recorded. They are included in the total, but cannot be assigned to a named ",
|
|
1195
|
-
label,
|
|
1196
|
-
"."
|
|
1197
|
-
]
|
|
1281
|
+
children: t("log.ui.unattributedTokens", "{count} tokens have no {dimension} recorded. They are included in the total, but cannot be assigned to a named {dimension}.", {
|
|
1282
|
+
count: formatTokens(unattributed),
|
|
1283
|
+
dimension: label
|
|
1284
|
+
})
|
|
1198
1285
|
})]
|
|
1199
1286
|
}) : null,
|
|
1200
1287
|
DIMENSION_NOTES[report.dimension] === void 0 ? null : /* @__PURE__ */ jsx("p", {
|
|
@@ -1207,28 +1294,21 @@ function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
|
1207
1294
|
focus: report.focus,
|
|
1208
1295
|
onFocus
|
|
1209
1296
|
}, `${report.dimension}:${report.focus ?? ""}`),
|
|
1210
|
-
/* @__PURE__ */
|
|
1297
|
+
/* @__PURE__ */ jsx("p", {
|
|
1211
1298
|
className: "text-sm text-po-dim",
|
|
1212
|
-
children:
|
|
1213
|
-
|
|
1214
|
-
report.
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
" ",
|
|
1218
|
-
label,
|
|
1219
|
-
" groups. Bars show share of the reported total."
|
|
1220
|
-
]
|
|
1299
|
+
children: t("log.ui.showingGroups", "Showing {shown} of {total} {dimension} groups. Bars show share of the reported total.", {
|
|
1300
|
+
shown: report.groups.length,
|
|
1301
|
+
total: formatTokens(report.totals.groupCount),
|
|
1302
|
+
dimension: label
|
|
1303
|
+
})
|
|
1221
1304
|
}),
|
|
1222
|
-
report.totals.failedGroups > 0 ? /* @__PURE__ */
|
|
1305
|
+
report.totals.failedGroups > 0 ? /* @__PURE__ */ jsx("p", {
|
|
1223
1306
|
className: "text-sm text-po-yellow",
|
|
1224
|
-
children:
|
|
1225
|
-
report.totals.failedGroups,
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
label,
|
|
1230
|
-
"s failed"
|
|
1231
|
-
]
|
|
1307
|
+
children: t("log.ui.failedGroups", "{failed} of {total} {dimension}s failed", {
|
|
1308
|
+
failed: report.totals.failedGroups,
|
|
1309
|
+
total: report.totals.groupCount,
|
|
1310
|
+
dimension: label
|
|
1311
|
+
})
|
|
1232
1312
|
}) : null
|
|
1233
1313
|
]
|
|
1234
1314
|
}), /* @__PURE__ */ jsx(ToolMetrics, { tools: report.tools })]
|
|
@@ -1244,13 +1324,9 @@ function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
|
1244
1324
|
/* @__PURE__ */ jsxs("footer", {
|
|
1245
1325
|
className: "flex flex-wrap justify-between gap-2 border-t border-po-border pt-3 text-sm text-po-dim",
|
|
1246
1326
|
"data-testid": "metrics-provenance",
|
|
1247
|
-
children: [/* @__PURE__ */ jsxs("span", { children: [
|
|
1248
|
-
"Source: LogSink ·",
|
|
1249
|
-
" ",
|
|
1250
|
-
report.transport === "http" ? "HTTP" : report.transport === "worker" ? "database worker" : "transport not reported"
|
|
1251
|
-
] }), /* @__PURE__ */ jsxs("span", {
|
|
1327
|
+
children: [/* @__PURE__ */ jsxs("span", { children: [t("log.ui.sourceLogsink", "Source: LogSink · "), report.transport === "http" ? "HTTP" : report.transport === "worker" ? t("log.ui.databaseWorker", "database worker") : t("log.ui.transportNotReported", "transport not reported")] }), /* @__PURE__ */ jsx("span", {
|
|
1252
1328
|
title: report.generatedAt,
|
|
1253
|
-
children:
|
|
1329
|
+
children: t("log.ui.generatedAt", "Report generated {time}", { time: Number.isNaN(generated.getTime()) ? report.generatedAt : generated.toLocaleString(locale) })
|
|
1254
1330
|
})]
|
|
1255
1331
|
})
|
|
1256
1332
|
]
|
|
@@ -1267,41 +1343,62 @@ function MetricsReportView({ report, onFocus, onPeriodChange }) {
|
|
|
1267
1343
|
* this decides how each one reads.
|
|
1268
1344
|
*/
|
|
1269
1345
|
const EMPTY_TITLES = {
|
|
1270
|
-
"no-sink"
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
"
|
|
1346
|
+
get "no-sink"() {
|
|
1347
|
+
return t("log.ui.noLogSink", "No log sink");
|
|
1348
|
+
},
|
|
1349
|
+
get "no-data"() {
|
|
1350
|
+
return t("log.ui.nothingRecordedYet", "Nothing recorded yet");
|
|
1351
|
+
},
|
|
1352
|
+
get "no-api"() {
|
|
1353
|
+
return t("log.ui.metricsNotInstalled", "Metrics not installed");
|
|
1354
|
+
},
|
|
1355
|
+
get "query-error"() {
|
|
1356
|
+
return t("log.ui.metricsCouldNotBeLoaded", "Metrics could not be loaded");
|
|
1357
|
+
}
|
|
1274
1358
|
};
|
|
1275
|
-
|
|
1359
|
+
/** A failed query draws the error tone's alert glyph, so it has no entry. */
|
|
1360
|
+
const EMPTY_ICONS = {
|
|
1361
|
+
"no-sink": /* @__PURE__ */ jsx(ServerIcon, {}),
|
|
1362
|
+
"no-data": /* @__PURE__ */ jsx(ActivityIcon, {}),
|
|
1363
|
+
"no-api": /* @__PURE__ */ jsx(PuzzleIcon, {})
|
|
1364
|
+
};
|
|
1365
|
+
function EmptyForReason({ response, onRetry }) {
|
|
1366
|
+
const t = useT();
|
|
1367
|
+
const failed = response.unavailable === "query-error";
|
|
1276
1368
|
return /* @__PURE__ */ jsx(EmptyState, {
|
|
1369
|
+
icon: EMPTY_ICONS[response.unavailable],
|
|
1370
|
+
tone: failed ? "error" : "neutral",
|
|
1277
1371
|
title: EMPTY_TITLES[response.unavailable],
|
|
1278
|
-
description: response.detail,
|
|
1372
|
+
description: response.unavailable === "no-data" && response.detail === "No recorded usage was found for this period." ? t("log.ui.noRecordedUsage", "No recorded usage was found for this period.") : response.unavailable === "no-api" && response.detail === "This cockpit is running a bundle without the log package API, so there are no metrics to read." ? t("log.error.noApi", "This cockpit is running a bundle without the log package API, so there are no metrics to read.") : response.detail === "The metrics query failed." ? t("log.error.metricsQuery", "The metrics query failed.") : response.detail === "The issues query failed." ? t("log.error.issuesQuery", "The issues query failed.") : response.detail,
|
|
1373
|
+
...failed && onRetry ? { action: {
|
|
1374
|
+
label: t("log.ui.retry", "Retry"),
|
|
1375
|
+
onAction: onRetry,
|
|
1376
|
+
testId: "metrics-retry"
|
|
1377
|
+
} } : {},
|
|
1279
1378
|
"data-testid": "metrics-empty"
|
|
1280
1379
|
});
|
|
1281
1380
|
}
|
|
1282
1381
|
function FocusNotice({ requested, applied, dimension, onClear }) {
|
|
1382
|
+
const t = useT();
|
|
1283
1383
|
if (requested === "") return null;
|
|
1284
1384
|
if (applied === void 0) return /* @__PURE__ */ jsxs("span", {
|
|
1285
1385
|
className: "rounded-md border border-po-edge-yellow bg-po-tint-yellow p-3 text-sm text-po-yellow",
|
|
1286
1386
|
"data-testid": "metrics-focus-refused",
|
|
1287
|
-
children: [
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
className: "ml-2",
|
|
1295
|
-
onClick: onClear,
|
|
1296
|
-
children: "clear"
|
|
1297
|
-
})
|
|
1298
|
-
]
|
|
1387
|
+
children: [t("log.ui.focusUnsupported", "this log sink does not support narrowing by {dimension}, so the numbers below are still everything", { dimension: DIMENSION_LABELS[dimension] }), /* @__PURE__ */ jsx(Button, {
|
|
1388
|
+
variant: "ghost",
|
|
1389
|
+
size: "md",
|
|
1390
|
+
className: "ml-2",
|
|
1391
|
+
onClick: onClear,
|
|
1392
|
+
children: t("log.ui.clear", "clear")
|
|
1393
|
+
})]
|
|
1299
1394
|
});
|
|
1300
1395
|
return /* @__PURE__ */ jsxs("span", {
|
|
1301
1396
|
className: "flex flex-wrap items-center gap-2 rounded-md border border-po-border bg-po-panel p-3 text-sm text-po-dim",
|
|
1302
1397
|
"data-testid": "metrics-focus",
|
|
1303
1398
|
children: [
|
|
1304
|
-
"
|
|
1399
|
+
" ",
|
|
1400
|
+
t("log.ui.narrowedTo", "narrowed to"),
|
|
1401
|
+
" ",
|
|
1305
1402
|
/* @__PURE__ */ jsx("span", {
|
|
1306
1403
|
className: "min-w-0 break-all text-po-hi",
|
|
1307
1404
|
children: applied
|
|
@@ -1311,13 +1408,14 @@ function FocusNotice({ requested, applied, dimension, onClear }) {
|
|
|
1311
1408
|
size: "md",
|
|
1312
1409
|
className: "ml-2",
|
|
1313
1410
|
onClick: onClear,
|
|
1314
|
-
children: "clear"
|
|
1411
|
+
children: t("log.ui.clear", "clear")
|
|
1315
1412
|
})
|
|
1316
1413
|
]
|
|
1317
1414
|
});
|
|
1318
1415
|
}
|
|
1319
1416
|
/** First load and filter changes have no report to display yet. */
|
|
1320
1417
|
function MetricsLoading() {
|
|
1418
|
+
const t = useT();
|
|
1321
1419
|
return /* @__PURE__ */ jsxs("div", {
|
|
1322
1420
|
className: "flex flex-col gap-4",
|
|
1323
1421
|
role: "status",
|
|
@@ -1326,7 +1424,7 @@ function MetricsLoading() {
|
|
|
1326
1424
|
children: [
|
|
1327
1425
|
/* @__PURE__ */ jsx("span", {
|
|
1328
1426
|
className: "text-sm text-po-dim",
|
|
1329
|
-
children: "Loading recorded metrics..."
|
|
1427
|
+
children: t("log.ui.loadingRecordedMetrics", "Loading recorded metrics...")
|
|
1330
1428
|
}),
|
|
1331
1429
|
/* @__PURE__ */ jsx("div", {
|
|
1332
1430
|
"aria-hidden": "true",
|
|
@@ -1348,13 +1446,22 @@ function MetricsLoading() {
|
|
|
1348
1446
|
//#endregion
|
|
1349
1447
|
//#region src/extensions/(frontend)/setting/_components/MetricsPanel.tsx
|
|
1350
1448
|
const PERIOD_LABELS = {
|
|
1351
|
-
day
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1449
|
+
get day() {
|
|
1450
|
+
return t("log.ui.pastDay", "Past day");
|
|
1451
|
+
},
|
|
1452
|
+
get week() {
|
|
1453
|
+
return t("log.ui.pastWeek", "Past week");
|
|
1454
|
+
},
|
|
1455
|
+
get month() {
|
|
1456
|
+
return t("log.ui.pastMonth", "Past month");
|
|
1457
|
+
},
|
|
1458
|
+
get all() {
|
|
1459
|
+
return t("log.ui.allHistory", "All history");
|
|
1460
|
+
}
|
|
1355
1461
|
};
|
|
1356
1462
|
/** Only render a response under the controls that requested it. */
|
|
1357
1463
|
function MetricsPanel(_props) {
|
|
1464
|
+
const t = useT();
|
|
1358
1465
|
const [dimension, setDimension] = useState("model");
|
|
1359
1466
|
const [period, setPeriod] = useState("week");
|
|
1360
1467
|
const [focus, setFocus] = useState("");
|
|
@@ -1366,6 +1473,14 @@ function MetricsPanel(_props) {
|
|
|
1366
1473
|
focus,
|
|
1367
1474
|
refreshKey
|
|
1368
1475
|
]);
|
|
1476
|
+
const [usage, setUsage] = useState([]);
|
|
1477
|
+
useEffect(() => {
|
|
1478
|
+
const controller = new AbortController();
|
|
1479
|
+
fetchHostUsage(controller.signal).then((rows) => {
|
|
1480
|
+
if (!controller.signal.aborted) setUsage(rows);
|
|
1481
|
+
}).catch(() => void 0);
|
|
1482
|
+
return () => controller.abort();
|
|
1483
|
+
}, [refreshKey]);
|
|
1369
1484
|
useEffect(() => {
|
|
1370
1485
|
const controller = new AbortController();
|
|
1371
1486
|
fetchMetrics(dimension, period, focus, controller.signal).then((result) => {
|
|
@@ -1376,7 +1491,7 @@ function MetricsPanel(_props) {
|
|
|
1376
1491
|
}).catch((error) => {
|
|
1377
1492
|
if (!controller.signal.aborted) setCompleted({
|
|
1378
1493
|
key: requestKey,
|
|
1379
|
-
result: { error: error instanceof Error ? error.message : "Metrics could not be loaded." }
|
|
1494
|
+
result: { error: error instanceof Error ? error.message : t("log.ui.metricsCouldNotBeLoadedTitle", "Metrics could not be loaded.") }
|
|
1380
1495
|
});
|
|
1381
1496
|
});
|
|
1382
1497
|
return () => controller.abort();
|
|
@@ -1396,6 +1511,7 @@ function MetricsPanel(_props) {
|
|
|
1396
1511
|
"data-testid": "metrics-panel",
|
|
1397
1512
|
"aria-busy": loading,
|
|
1398
1513
|
children: [
|
|
1514
|
+
/* @__PURE__ */ jsx(HostUsage, { rows: usage }),
|
|
1399
1515
|
/* @__PURE__ */ jsxs("div", {
|
|
1400
1516
|
className: "flex min-w-0 flex-wrap items-end gap-3 rounded-lg border border-po-border bg-po-panel p-3",
|
|
1401
1517
|
children: [
|
|
@@ -1403,7 +1519,7 @@ function MetricsPanel(_props) {
|
|
|
1403
1519
|
className: "flex flex-col gap-2",
|
|
1404
1520
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1405
1521
|
className: "text-base font-medium text-po-text",
|
|
1406
|
-
children: "Group by"
|
|
1522
|
+
children: t("log.ui.groupBy", "Group by")
|
|
1407
1523
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
1408
1524
|
value: dimension,
|
|
1409
1525
|
onValueChange: (next) => {
|
|
@@ -1411,7 +1527,7 @@ function MetricsPanel(_props) {
|
|
|
1411
1527
|
setDimension(next);
|
|
1412
1528
|
},
|
|
1413
1529
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1414
|
-
"aria-label": "Group metrics by",
|
|
1530
|
+
"aria-label": t("log.ui.groupMetricsBy", "Group metrics by"),
|
|
1415
1531
|
"data-testid": "metrics-dimension",
|
|
1416
1532
|
className: "w-40 ",
|
|
1417
1533
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
@@ -1425,12 +1541,12 @@ function MetricsPanel(_props) {
|
|
|
1425
1541
|
className: "flex flex-col gap-2",
|
|
1426
1542
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1427
1543
|
className: "text-base font-medium text-po-text",
|
|
1428
|
-
children: "Period"
|
|
1544
|
+
children: t("log.ui.period", "Period")
|
|
1429
1545
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
1430
1546
|
value: period,
|
|
1431
1547
|
onValueChange: (next) => setPeriod(next),
|
|
1432
1548
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
1433
|
-
"aria-label": "Metrics period",
|
|
1549
|
+
"aria-label": t("log.ui.metricsPeriod", "Metrics period"),
|
|
1434
1550
|
"data-testid": "metrics-period",
|
|
1435
1551
|
className: "w-40 ",
|
|
1436
1552
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
@@ -1447,7 +1563,7 @@ function MetricsPanel(_props) {
|
|
|
1447
1563
|
onClick: () => setRefreshKey((current) => current + 1),
|
|
1448
1564
|
disabled: loading,
|
|
1449
1565
|
"data-testid": "metrics-refresh",
|
|
1450
|
-
children: loading ? "Loading..." : "Refresh"
|
|
1566
|
+
children: loading ? t("log.ui.loading", "Loading...") : t("log.ui.refresh", "Refresh")
|
|
1451
1567
|
})
|
|
1452
1568
|
]
|
|
1453
1569
|
}),
|
|
@@ -1456,9 +1572,17 @@ function MetricsPanel(_props) {
|
|
|
1456
1572
|
role: "alert",
|
|
1457
1573
|
className: "rounded-lg border border-po-edge-red bg-po-tint-red p-4 text-sm text-po-red",
|
|
1458
1574
|
"data-testid": "metrics-error",
|
|
1459
|
-
children: [
|
|
1575
|
+
children: [
|
|
1576
|
+
error,
|
|
1577
|
+
" ",
|
|
1578
|
+
t("log.ui.useRefreshToTryAgain", "Use Refresh to try again."),
|
|
1579
|
+
" "
|
|
1580
|
+
]
|
|
1460
1581
|
}),
|
|
1461
|
-
response !== void 0 && isMetricsUnavailable(response) ? /* @__PURE__ */ jsx(EmptyForReason, {
|
|
1582
|
+
response !== void 0 && isMetricsUnavailable(response) ? /* @__PURE__ */ jsx(EmptyForReason, {
|
|
1583
|
+
response,
|
|
1584
|
+
onRetry: () => setRefreshKey((current) => current + 1)
|
|
1585
|
+
}) : null,
|
|
1462
1586
|
report === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FocusNotice, {
|
|
1463
1587
|
requested: focus,
|
|
1464
1588
|
applied: report.focus,
|
|
@@ -1477,64 +1601,375 @@ function MetricsPanel(_props) {
|
|
|
1477
1601
|
var metrics_panel_web_default = defineSettingsPanel({
|
|
1478
1602
|
label: "metrics",
|
|
1479
1603
|
detail: "recorded usage, token attribution and issues",
|
|
1604
|
+
icon: ActivityIcon,
|
|
1480
1605
|
component: MetricsPanel
|
|
1481
1606
|
});
|
|
1482
1607
|
//#endregion
|
|
1483
|
-
//#region src/extensions/workspaces/sessions/(frontend)/
|
|
1484
|
-
|
|
1485
|
-
|
|
1608
|
+
//#region src/extensions/workspaces/sessions/(frontend)/fill/Logs.help.guides.web.ts
|
|
1609
|
+
var Logs_help_guides_web_default = defineFill({
|
|
1610
|
+
slot: "help.guides",
|
|
1611
|
+
id: "Logs",
|
|
1612
|
+
order: 130,
|
|
1613
|
+
data: {
|
|
1614
|
+
version: 1,
|
|
1615
|
+
category: "access",
|
|
1616
|
+
labelKey: "log.guides.logs",
|
|
1617
|
+
label: "Logs",
|
|
1618
|
+
guides: [{
|
|
1619
|
+
id: "about",
|
|
1620
|
+
questionKey: "log.guides.whatCanLogsTellMe",
|
|
1621
|
+
question: "What can logs tell me?",
|
|
1622
|
+
order: 0,
|
|
1623
|
+
answerKey: "log.guides.logsTracksTokenUsageToolCallsFailuresAndRecentErrorsForThisSessionOlderHistoryNeedsTheLogCollectorToBeRunning",
|
|
1624
|
+
answer: "Logs tracks token usage, tool calls, failures and recent errors for this session. Older history needs the log collector to be running.",
|
|
1625
|
+
keywords: ["metrics", "telemetry"]
|
|
1626
|
+
}, {
|
|
1627
|
+
id: "use",
|
|
1628
|
+
questionKey: "log.guides.howDoIInvestigateASessionProblem",
|
|
1629
|
+
question: "How do I investigate a session problem?",
|
|
1630
|
+
order: 1,
|
|
1631
|
+
answerKey: "log.guides.turnOnHelpModeAndAskPoToDiagnoseThisSessionForFailedToolsOrTokenUsageAMissingRecordDoesNotProveTheSessionWasHealthy",
|
|
1632
|
+
answer: "Turn on Help mode and ask Po to diagnose this session for failed tools or token usage. A missing record does not prove the session was healthy.",
|
|
1633
|
+
keywords: ["diagnostics", "errors"]
|
|
1634
|
+
}]
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
//#endregion
|
|
1638
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/logsinkToolRender.ts
|
|
1639
|
+
const logsinkToolNames = [
|
|
1640
|
+
"logsink_status",
|
|
1641
|
+
"logsink_search",
|
|
1642
|
+
"logsink_agent_issues",
|
|
1643
|
+
"logsink_trace",
|
|
1644
|
+
"logsink_stats",
|
|
1645
|
+
"logsink_services",
|
|
1646
|
+
"logsink_metrics"
|
|
1647
|
+
];
|
|
1648
|
+
function record(value) {
|
|
1649
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
1650
|
+
}
|
|
1651
|
+
function count(value) {
|
|
1652
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
1653
|
+
}
|
|
1654
|
+
function percent(value) {
|
|
1655
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 100;
|
|
1656
|
+
}
|
|
1657
|
+
function iso(value) {
|
|
1658
|
+
return typeof value === "string" && /^\d{4}-\d{2}-\d{2}T/.test(value) && Number.isFinite(Date.parse(value));
|
|
1659
|
+
}
|
|
1660
|
+
function scopeLabel(t, value) {
|
|
1661
|
+
const scope = record(value);
|
|
1662
|
+
if (!scope || scope.kind !== "session" && scope.kind !== "history") return void 0;
|
|
1663
|
+
if (scope.sessionId !== void 0 && typeof scope.sessionId !== "string") return void 0;
|
|
1664
|
+
if (scope.startTime !== void 0 && !iso(scope.startTime)) return void 0;
|
|
1665
|
+
if (scope.endTime !== void 0 && !iso(scope.endTime)) return void 0;
|
|
1666
|
+
if (scope.kind === "history" && (!iso(scope.startTime) || !iso(scope.endTime))) return void 0;
|
|
1667
|
+
if (iso(scope.startTime) && iso(scope.endTime) && Date.parse(scope.startTime) > Date.parse(scope.endTime)) return void 0;
|
|
1668
|
+
return [
|
|
1669
|
+
scope.kind === "session" ? t("log.ui.thisSession", "This session") : t("log.ui.history", "History"),
|
|
1670
|
+
scope.startTime,
|
|
1671
|
+
scope.endTime,
|
|
1672
|
+
scope.kind === "history" ? scope.sessionId : void 0
|
|
1673
|
+
].filter(Boolean).join(" · ");
|
|
1674
|
+
}
|
|
1675
|
+
/** Bound the runtime matcher to this package's seven registered tools. */
|
|
1676
|
+
function matchesLogsinkTool(toolName) {
|
|
1677
|
+
return logsinkToolNames.some((name) => name === toolName);
|
|
1678
|
+
}
|
|
1679
|
+
/** No reader, telemetry runtime, or schema construction crosses into the browser. */
|
|
1680
|
+
function logsinkCardSummary(t, { toolName, args, result, output, running, isError }) {
|
|
1681
|
+
let value = result?.details;
|
|
1682
|
+
if (value === void 0 || value === null) try {
|
|
1683
|
+
value = JSON.parse(output);
|
|
1684
|
+
} catch {
|
|
1685
|
+
value = void 0;
|
|
1686
|
+
}
|
|
1687
|
+
const report = record(value);
|
|
1688
|
+
const effectiveScope = scopeLabel(t, report?.scope);
|
|
1689
|
+
const requestedScope = args.scope === "history" ? [
|
|
1690
|
+
t("log.ui.requestedHistory", "Requested history"),
|
|
1691
|
+
args.startTime,
|
|
1692
|
+
args.endTime,
|
|
1693
|
+
args.sessionId
|
|
1694
|
+
].filter((part) => typeof part === "string").join(" · ") : t("log.ui.thisSession", "This session");
|
|
1695
|
+
const evidence = value === void 0 ? output : JSON.stringify(value, null, 2);
|
|
1696
|
+
const base = {
|
|
1697
|
+
scope: effectiveScope ?? requestedScope,
|
|
1698
|
+
evidence
|
|
1699
|
+
};
|
|
1700
|
+
if (running) return {
|
|
1701
|
+
...base,
|
|
1702
|
+
scope: requestedScope,
|
|
1703
|
+
state: "running",
|
|
1704
|
+
heading: t("log.ui.readingCapturedAgentEvidence", "Reading captured agent evidence"),
|
|
1705
|
+
note: t("log.ui.onlyRetainedRecordsAreInspected", "Only retained records are inspected.")
|
|
1706
|
+
};
|
|
1707
|
+
if (isError) return {
|
|
1708
|
+
...base,
|
|
1709
|
+
state: "query-error",
|
|
1710
|
+
heading: t("log.ui.logQueryCouldNotBeCompleted", "Log query could not be completed."),
|
|
1711
|
+
note: t("log.ui.noCollectorChangesWereMade", "No collector changes were made.")
|
|
1712
|
+
};
|
|
1713
|
+
const unavailable = {
|
|
1714
|
+
...base,
|
|
1715
|
+
state: "unavailable",
|
|
1716
|
+
heading: t("log.ui.logSummaryIsUnavailable", "Log summary is unavailable."),
|
|
1717
|
+
note: t("log.ui.inspectTheRetainedEvidenceForDetails", "Inspect the retained evidence for details.")
|
|
1718
|
+
};
|
|
1719
|
+
const data = record(report?.data);
|
|
1720
|
+
if (!effectiveScope || !data) return unavailable;
|
|
1721
|
+
const populated = {
|
|
1722
|
+
...base,
|
|
1723
|
+
state: "populated",
|
|
1724
|
+
heading: ""
|
|
1725
|
+
};
|
|
1726
|
+
const empty = {
|
|
1727
|
+
...base,
|
|
1728
|
+
state: "empty",
|
|
1729
|
+
heading: t("log.ui.noCapturedRecordsInThisWindow", "No captured records in this window."),
|
|
1730
|
+
note: t("log.ui.thisDoesNotEstablishThatTheRunWasHealthy", "This does not establish that the run was healthy.")
|
|
1731
|
+
};
|
|
1732
|
+
switch (toolName) {
|
|
1733
|
+
case "logsink_status":
|
|
1734
|
+
if (data.available === false && data.reason === "missing-database") return {
|
|
1735
|
+
...base,
|
|
1736
|
+
state: "missing",
|
|
1737
|
+
heading: t("log.ui.noRetainedLogDatabaseIsAvailable", "No retained log database is available."),
|
|
1738
|
+
note: t("log.ui.noCollectorChangesWereMade", "No collector changes were made.")
|
|
1739
|
+
};
|
|
1740
|
+
return data.available === true ? {
|
|
1741
|
+
...populated,
|
|
1742
|
+
heading: t("log.ui.retainedLogDatabaseIsAvailable", "Retained log database is available."),
|
|
1743
|
+
note: t("log.ui.thisDoesNotEstablishThatTheCollectorIsCapturingNow", "This does not establish that the collector is capturing now.")
|
|
1744
|
+
} : unavailable;
|
|
1745
|
+
case "logsink_search":
|
|
1746
|
+
if (!count(data.count) || !count(data.total) || typeof data.truncated !== "boolean" || !Array.isArray(data.results)) return unavailable;
|
|
1747
|
+
return {
|
|
1748
|
+
...data.total === 0 ? empty : populated,
|
|
1749
|
+
heading: data.total === 0 ? empty.heading : t("log.ui.capturedLogRecords", "Captured log records"),
|
|
1750
|
+
summary: t("log.ui.returnedRecords", "{returned} returned · {total} records", {
|
|
1751
|
+
returned: data.count,
|
|
1752
|
+
total: data.total
|
|
1753
|
+
}),
|
|
1754
|
+
note: data.truncated ? t("log.ui.resultsAreTruncated", "Results are truncated.") : data.total === 0 ? empty.note : void 0
|
|
1755
|
+
};
|
|
1756
|
+
case "logsink_agent_issues": {
|
|
1757
|
+
if (!count(data.matchingLogs) || !count(data.uniqueIncidents) || !count(data.scanned) || !percent(data.coveragePercent) || typeof data.truncated !== "boolean" || !Array.isArray(data.issues)) return unavailable;
|
|
1758
|
+
const byTool = record(data.byTool);
|
|
1759
|
+
if (!byTool || !Object.values(byTool).every(count)) return unavailable;
|
|
1760
|
+
return {
|
|
1761
|
+
...data.matchingLogs === 0 ? empty : populated,
|
|
1762
|
+
heading: data.matchingLogs === 0 ? t("log.ui.noCapturedAgentIssuesInThisWindow", "No captured agent issues in this window.") : t("log.ui.capturedAgentIssues", "Captured agent issues"),
|
|
1763
|
+
summary: t("log.ui.recordIncidents", "{records} records · {incidents} incidents", {
|
|
1764
|
+
records: data.matchingLogs,
|
|
1765
|
+
incidents: data.uniqueIncidents
|
|
1766
|
+
}),
|
|
1767
|
+
coverage: t("log.ui.scanCoverage", "Coverage {percent}% · {count} scanned{notice}", {
|
|
1768
|
+
percent: data.coveragePercent,
|
|
1769
|
+
count: data.scanned,
|
|
1770
|
+
notice: data.truncated ? t("log.ui.scanTruncated", " · Scan truncated") : ""
|
|
1771
|
+
}),
|
|
1772
|
+
tools: Object.entries(byTool).map(([name, n]) => ({
|
|
1773
|
+
name,
|
|
1774
|
+
count: n
|
|
1775
|
+
})),
|
|
1776
|
+
note: data.matchingLogs === 0 ? empty.note : t("log.ui.repeatedEventsMayDescribeOneIncident", "Repeated events may describe one incident.")
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
case "logsink_trace":
|
|
1780
|
+
if (!count(data.count) || typeof data.truncated !== "boolean" || !Array.isArray(data.timeline)) return unavailable;
|
|
1781
|
+
return {
|
|
1782
|
+
...data.count === 0 ? empty : populated,
|
|
1783
|
+
heading: data.count === 0 ? empty.heading : t("log.ui.capturedTraceTimeline", "Captured trace timeline"),
|
|
1784
|
+
summary: t("log.ui.entryCount", "{count} entries", { count: data.count }),
|
|
1785
|
+
note: data.truncated ? t("log.ui.timelineIsTruncated", "Timeline is truncated.") : data.count === 0 ? empty.note : void 0
|
|
1786
|
+
};
|
|
1787
|
+
case "logsink_stats":
|
|
1788
|
+
if (!count(data.totalEntries) || !Array.isArray(data.statistics) || !data.statistics.every((row) => {
|
|
1789
|
+
const group = record(row);
|
|
1790
|
+
return count(group?.count) && typeof group?.service === "string" && typeof group?.level === "string";
|
|
1791
|
+
})) return unavailable;
|
|
1792
|
+
return {
|
|
1793
|
+
...data.totalEntries === 0 ? empty : populated,
|
|
1794
|
+
heading: data.totalEntries === 0 ? empty.heading : t("log.ui.retainedEntryStatistics", "Retained entry statistics"),
|
|
1795
|
+
summary: data.statistics.length === 1 ? t("log.ui.entryGroupsOne", "{entries} entries · {groups} group", {
|
|
1796
|
+
entries: data.totalEntries,
|
|
1797
|
+
groups: data.statistics.length
|
|
1798
|
+
}) : t("log.ui.entryGroups", "{entries} entries · {groups} groups", {
|
|
1799
|
+
entries: data.totalEntries,
|
|
1800
|
+
groups: data.statistics.length
|
|
1801
|
+
}),
|
|
1802
|
+
tools: data.statistics.map((row) => {
|
|
1803
|
+
const group = row;
|
|
1804
|
+
return {
|
|
1805
|
+
name: [group.service, group.level].filter(Boolean).join(" · "),
|
|
1806
|
+
count: group.count
|
|
1807
|
+
};
|
|
1808
|
+
})
|
|
1809
|
+
};
|
|
1810
|
+
case "logsink_services":
|
|
1811
|
+
if (!count(data.count) || typeof data.truncated !== "boolean" || !Array.isArray(data.services) || !data.services.every((service) => typeof service === "string")) return unavailable;
|
|
1812
|
+
return {
|
|
1813
|
+
...data.count === 0 ? empty : populated,
|
|
1814
|
+
heading: data.count === 0 ? empty.heading : t("log.ui.servicesWithRetainedRecords", "Services with retained records"),
|
|
1815
|
+
summary: data.count === 1 ? t("log.ui.serviceCountOne", "{count} service", { count: data.count }) : t("log.ui.serviceCount", "{count} services", { count: data.count }),
|
|
1816
|
+
note: data.truncated ? t("log.ui.serviceListIsTruncated", "Service list is truncated.") : data.count === 0 ? empty.note : void 0
|
|
1817
|
+
};
|
|
1818
|
+
case "logsink_metrics": {
|
|
1819
|
+
const totals = record(data.totals);
|
|
1820
|
+
if (!totals || !count(totals.totalRecords) || !count(totals.totalTokens) || !count(totals.issueCount) || !percent(totals.tokenCoveragePercent)) return unavailable;
|
|
1821
|
+
return {
|
|
1822
|
+
...totals.totalRecords === 0 ? empty : populated,
|
|
1823
|
+
heading: totals.totalRecords === 0 ? empty.heading : t("log.ui.capturedUsageAndIssues", "Captured usage and issues"),
|
|
1824
|
+
summary: t("log.ui.usageSummary", "{records} records · {tokens} tokens · {issues} issues", {
|
|
1825
|
+
records: totals.totalRecords,
|
|
1826
|
+
tokens: totals.totalTokens,
|
|
1827
|
+
issues: totals.issueCount
|
|
1828
|
+
}),
|
|
1829
|
+
coverage: t("log.ui.tokenCoveragePercent", "Token coverage {percent}%", { percent: totals.tokenCoveragePercent }),
|
|
1830
|
+
note: t("log.ui.toolCostNotice", "{notice}Tool turn costs are not exclusive per-tool token shares.", { notice: totals.totalRecords === 0 ? `${empty.note} ` : "" })
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
default: return unavailable;
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
//#endregion
|
|
1837
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/LogsinkToolCardView.tsx
|
|
1838
|
+
function LogsinkToolCardView({ toolName, running, isError, fixture, defaultExpanded = false }) {
|
|
1839
|
+
const t = useT();
|
|
1840
|
+
const missing = fixture.state === "missing";
|
|
1841
|
+
const unavailable = fixture.state === "unavailable";
|
|
1842
|
+
const lines = fixture.evidence.split("\n").map((text) => ({
|
|
1486
1843
|
text,
|
|
1487
1844
|
tone: "text"
|
|
1488
1845
|
}));
|
|
1489
1846
|
return /* @__PURE__ */ jsx(MessageItem, {
|
|
1490
|
-
tone: toolTone({
|
|
1847
|
+
tone: missing || unavailable ? "neutral" : toolTone({
|
|
1491
1848
|
running,
|
|
1492
1849
|
isError
|
|
1493
1850
|
}),
|
|
1494
|
-
expandable:
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1851
|
+
expandable: fixture.evidence.length > 0,
|
|
1852
|
+
defaultExpanded,
|
|
1853
|
+
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
1854
|
+
title: toolName,
|
|
1855
|
+
badge: isError ? t("log.ui.queryFailed", "Query failed") : missing ? t("log.ui.noData", "No data") : void 0,
|
|
1856
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1857
|
+
className: "truncate text-po-dim max-sm:hidden",
|
|
1858
|
+
children: fixture.scope
|
|
1859
|
+
})
|
|
1860
|
+
}), /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
1861
|
+
className: "flex flex-col gap-3",
|
|
1862
|
+
children: [
|
|
1863
|
+
/* @__PURE__ */ jsx("p", {
|
|
1864
|
+
className: "break-words text-sm text-po-dim sm:hidden",
|
|
1865
|
+
children: fixture.scope
|
|
1866
|
+
}),
|
|
1867
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1868
|
+
className: "flex flex-col gap-1",
|
|
1869
|
+
children: [
|
|
1870
|
+
/* @__PURE__ */ jsx("p", {
|
|
1871
|
+
className: "text-base font-semibold text-po-hi",
|
|
1872
|
+
children: fixture.heading
|
|
1873
|
+
}),
|
|
1874
|
+
fixture.summary ? /* @__PURE__ */ jsx("p", {
|
|
1875
|
+
className: "text-base text-po-text",
|
|
1876
|
+
children: fixture.summary
|
|
1877
|
+
}) : null,
|
|
1878
|
+
fixture.coverage ? /* @__PURE__ */ jsx("p", {
|
|
1879
|
+
className: "text-sm text-po-dim",
|
|
1880
|
+
children: fixture.coverage
|
|
1881
|
+
}) : null
|
|
1882
|
+
]
|
|
1883
|
+
}),
|
|
1884
|
+
fixture.tools ? /* @__PURE__ */ jsx("div", {
|
|
1885
|
+
className: "flex flex-col gap-2 border-t border-po-border-soft pt-3",
|
|
1886
|
+
children: fixture.tools.map((tool) => /* @__PURE__ */ jsxs("p", {
|
|
1887
|
+
className: "flex flex-wrap items-center gap-4 text-base",
|
|
1888
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1889
|
+
className: "font-mono text-po-text",
|
|
1890
|
+
children: tool.name
|
|
1891
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1892
|
+
className: "text-po-dim",
|
|
1893
|
+
children: t("log.ui.occurrences", "{count} occurrences", { count: tool.count })
|
|
1894
|
+
})]
|
|
1895
|
+
}, tool.name))
|
|
1896
|
+
}) : null,
|
|
1897
|
+
fixture.note ? /* @__PURE__ */ jsx("p", {
|
|
1898
|
+
className: "text-sm text-po-dim",
|
|
1899
|
+
children: fixture.note
|
|
1505
1900
|
}) : null,
|
|
1506
1901
|
running ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
1507
1902
|
tone: "running",
|
|
1508
|
-
children: "Reading
|
|
1903
|
+
children: t("log.ui.readingTelemetry", "Reading telemetry")
|
|
1509
1904
|
}) : null,
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
children:
|
|
1905
|
+
fixture.evidence ? /* @__PURE__ */ jsxs("div", {
|
|
1906
|
+
className: "flex flex-col gap-3 border-t border-po-border-soft pt-3",
|
|
1907
|
+
children: [/* @__PURE__ */ jsx(MessageItemStatus, {
|
|
1908
|
+
expands: true,
|
|
1909
|
+
glyph: expanded ? "⌄" : "›",
|
|
1910
|
+
className: "text-sm text-po-dim",
|
|
1911
|
+
children: expanded ? t("log.ui.hideEvidence", "Hide evidence") : t("log.ui.showEvidence", "Show evidence")
|
|
1912
|
+
}), expanded ? /* @__PURE__ */ jsx(MessageLines, { lines }) : null]
|
|
1513
1913
|
}) : null
|
|
1514
|
-
]
|
|
1515
|
-
}
|
|
1914
|
+
]
|
|
1915
|
+
})] })
|
|
1516
1916
|
});
|
|
1517
1917
|
}
|
|
1518
1918
|
//#endregion
|
|
1519
|
-
//#region src/extensions/workspaces/sessions/(frontend)/tool/
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1919
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/LogsinkToolCard.tsx
|
|
1920
|
+
function LogsinkToolCard(props) {
|
|
1921
|
+
const t = useT();
|
|
1922
|
+
return /* @__PURE__ */ jsx(LogsinkToolCardView, {
|
|
1923
|
+
...props,
|
|
1924
|
+
fixture: logsinkCardSummary(t, props)
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
//#endregion
|
|
1928
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/logsink.web.tsx
|
|
1929
|
+
var logsink_web_default = defineToolRenderer({
|
|
1930
|
+
tools: [
|
|
1931
|
+
"logsink_status",
|
|
1932
|
+
"logsink_search",
|
|
1933
|
+
"logsink_agent_issues",
|
|
1934
|
+
"logsink_trace",
|
|
1935
|
+
"logsink_stats",
|
|
1936
|
+
"logsink_services",
|
|
1937
|
+
"logsink_metrics"
|
|
1938
|
+
],
|
|
1939
|
+
matches: matchesLogsinkTool,
|
|
1940
|
+
message: LogsinkToolCard
|
|
1523
1941
|
});
|
|
1524
1942
|
//#endregion
|
|
1525
1943
|
//#region generated/web.ts
|
|
1526
|
-
const via = (identity, value) =>
|
|
1527
|
-
|
|
1528
|
-
|
|
1944
|
+
const via = (identity, value) => {
|
|
1945
|
+
if (value === void 0) return void 0;
|
|
1946
|
+
const declaration = value;
|
|
1947
|
+
return {
|
|
1948
|
+
...identity,
|
|
1949
|
+
...declaration,
|
|
1950
|
+
...declaration.relations === void 0 ? {} : { relations: declaration.relations.map((relation) => ({
|
|
1951
|
+
evidence: "declared",
|
|
1952
|
+
...relation
|
|
1953
|
+
})) }
|
|
1954
|
+
};
|
|
1529
1955
|
};
|
|
1530
1956
|
const webPlugin = defineWebPlugin({
|
|
1531
1957
|
id: "log",
|
|
1532
|
-
|
|
1958
|
+
packageName: "@agimon-ai/po-log",
|
|
1959
|
+
host: { get settingsPanels() {
|
|
1533
1960
|
return [via({ id: "metrics" }, metrics_panel_web_default)];
|
|
1534
1961
|
} },
|
|
1535
|
-
session: {
|
|
1536
|
-
|
|
1537
|
-
|
|
1962
|
+
session: {
|
|
1963
|
+
get fills() {
|
|
1964
|
+
return [via({
|
|
1965
|
+
slot: "help.guides",
|
|
1966
|
+
id: "logs"
|
|
1967
|
+
}, Logs_help_guides_web_default)];
|
|
1968
|
+
},
|
|
1969
|
+
get toolRenderers() {
|
|
1970
|
+
return [via({ tools: ["logsink"] }, logsink_web_default)];
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1538
1973
|
});
|
|
1539
1974
|
//#endregion
|
|
1540
1975
|
export { webPlugin };
|