@dan-ai-studio/dshopencodego 0.1.64 → 0.1.65

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/lib/client.js CHANGED
@@ -55,16 +55,16 @@ function parseGoQuota(value) {
55
55
  function parseCost(value) {
56
56
  if (value === null || typeof value !== "object") throw new Error("invalid model cost");
57
57
  const row = value;
58
- const rate = (key) => {
58
+ const rate3 = (key) => {
59
59
  const entry = row[key];
60
60
  if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) throw new Error(`invalid model cost "${key}"`);
61
61
  return entry;
62
62
  };
63
63
  return {
64
- input: rate("input"),
65
- output: rate("output"),
66
- ...typeof row["cacheRead"] === "number" ? { cacheRead: rate("cacheRead") } : {},
67
- ...typeof row["cacheWrite"] === "number" ? { cacheWrite: rate("cacheWrite") } : {}
64
+ input: rate3("input"),
65
+ output: rate3("output"),
66
+ ...typeof row["cacheRead"] === "number" ? { cacheRead: rate3("cacheRead") } : {},
67
+ ...typeof row["cacheWrite"] === "number" ? { cacheWrite: rate3("cacheWrite") } : {}
68
68
  };
69
69
  }
70
70
  function parseModalities(value) {
@@ -115,7 +115,7 @@ function parseCatalogReading(value) {
115
115
  throw new Error("invalid catalog reading");
116
116
  }
117
117
  const numbers = counts;
118
- const count2 = (key) => {
118
+ const count3 = (key) => {
119
119
  const entry = numbers[key];
120
120
  if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) throw new Error(`invalid catalog count "${key}"`);
121
121
  return entry;
@@ -134,11 +134,11 @@ function parseCatalogReading(value) {
134
134
  fetchedAtMs: row["fetchedAtMs"],
135
135
  quotaSource: quotaSource ?? "seed",
136
136
  counts: {
137
- total: count2("total"),
138
- enabled: count2("enabled"),
139
- deprecated: count2("deprecated"),
140
- unconfigured: count2("unconfigured"),
141
- inferred: count2("inferred")
137
+ total: count3("total"),
138
+ enabled: count3("enabled"),
139
+ deprecated: count3("deprecated"),
140
+ unconfigured: count3("unconfigured"),
141
+ inferred: count3("inferred")
142
142
  }
143
143
  };
144
144
  }
@@ -246,6 +246,8 @@ function parseEntry(value) {
246
246
  ...row["cacheReadTokens"] === void 0 ? {} : { cacheReadTokens: count("cacheReadTokens", row) },
247
247
  ...row["durationMs"] === void 0 ? {} : { durationMs: count("durationMs", row) },
248
248
  ...row["firstTokenMs"] === void 0 ? {} : { firstTokenMs: count("firstTokenMs", row) },
249
+ ...row["decodeMs"] === void 0 ? {} : { decodeMs: count("decodeMs", row) },
250
+ ...row["tps"] === void 0 ? {} : { tps: rate("tps", row) },
249
251
  ok: row["ok"] === true,
250
252
  ...typeof row["code"] === "string" ? { code: row["code"] } : {},
251
253
  ...typeof row["poolKey"] === "string" ? { poolKey: row["poolKey"] } : {},
@@ -264,6 +266,13 @@ function parseEntry(value) {
264
266
  } : {}
265
267
  };
266
268
  }
269
+ function rate(key, row) {
270
+ const entry = row[key];
271
+ if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) {
272
+ throw new Error(`invalid request-log entry "${key}"`);
273
+ }
274
+ return entry;
275
+ }
267
276
  function parsePoolEvent(value) {
268
277
  if (value === null || typeof value !== "object") throw new Error("invalid request-log pool event");
269
278
  const row = value;
@@ -378,22 +387,22 @@ function parseUsageWindows(value) {
378
387
  function parseTotals(value) {
379
388
  if (value === null || typeof value !== "object") throw new Error("invalid meter totals");
380
389
  const row = value;
381
- const count2 = (key) => {
390
+ const count3 = (key) => {
382
391
  const entry = row[key];
383
392
  if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) throw new Error(`invalid meter field "${key}"`);
384
393
  return entry;
385
394
  };
386
- const optionalCount = (key) => row[key] === void 0 ? void 0 : count2(key);
395
+ const optionalCount = (key) => row[key] === void 0 ? void 0 : count3(key);
387
396
  const reasoningTokens = optionalCount("reasoningTokens");
388
397
  const estimatedUSD = optionalCount("estimatedUSD");
389
398
  const unpricedTokens = optionalCount("unpricedTokens");
390
399
  return {
391
- calls: count2("calls"),
392
- inputTokens: count2("inputTokens"),
393
- outputTokens: count2("outputTokens"),
394
- cacheReadTokens: count2("cacheReadTokens"),
395
- cacheWriteTokens: count2("cacheWriteTokens"),
396
- totalTokens: count2("totalTokens"),
400
+ calls: count3("calls"),
401
+ inputTokens: count3("inputTokens"),
402
+ outputTokens: count3("outputTokens"),
403
+ cacheReadTokens: count3("cacheReadTokens"),
404
+ cacheWriteTokens: count3("cacheWriteTokens"),
405
+ totalTokens: count3("totalTokens"),
397
406
  ...reasoningTokens === void 0 ? {} : { reasoningTokens },
398
407
  ...estimatedUSD === void 0 ? {} : { estimatedUSD },
399
408
  ...unpricedTokens === void 0 ? {} : { unpricedTokens }
@@ -490,6 +499,7 @@ var en = {
490
499
  keepAliveHint: "How long a connection to the gateway is held between requests. Longer pauses in a conversation cost one handshake each; the timer restarts on every answer.",
491
500
  requestLogTitle: "Request log",
492
501
  requestLogHint: "Per-request records for troubleshooting. Off by default; enabling it does not change what requests do.",
502
+ requestLogPageHint: "One row per request. The table scrolls; the filters stay put.",
493
503
  requestLogEnabled: "Record requests",
494
504
  requestLogDebug: "Debug detail",
495
505
  requestLogDebugHint: "Pool events and full session ids. Otherwise sessions are truncated to 8 characters.",
@@ -509,6 +519,7 @@ var en = {
509
519
  requestLogSlowOnly: "Slow only",
510
520
  requestLogSlowSeconds: "slower than (seconds)",
511
521
  requestLogFilterSession: "Session contains",
522
+ requestLogOnlySession: "this session only",
512
523
  requestLogGroupBy: "Group by",
513
524
  requestLogGroupNone: "None",
514
525
  requestLogGroupSession: "Session",
@@ -527,6 +538,7 @@ var en = {
527
538
  requestLogColOut: "Out",
528
539
  requestLogColCache: "Cached",
529
540
  requestLogColLatency: "Latency",
541
+ requestLogColTps: "tok/s",
530
542
  requestLogColFirstToken: "First token",
531
543
  requestLogColStatus: "Status",
532
544
  requestLogDetailRequest: "Request",
@@ -544,6 +556,11 @@ var en = {
544
556
  requestLogDetailMessages: "messages",
545
557
  requestLogDetailTools: "tools",
546
558
  requestLogDetailHasImage: "with images",
559
+ requestLogStatRequests: "Requests",
560
+ requestLogStatFailures: "Failures",
561
+ requestLogStatLatency: "Mean latency",
562
+ requestLogStatFirstToken: "Mean first token",
563
+ requestLogStatTps: "Mean tok/s",
547
564
  writeRejected: "The settings write was rejected (the namespace was reloaded) \u2014 try again",
548
565
  writeFailed: "The settings write failed",
549
566
  filterPlaceholder: "Filter by name or id",
@@ -658,6 +675,7 @@ var zh = {
658
675
  keepAliveHint: "\u4E0E\u7F51\u5173\u7684\u8FDE\u63A5\u5728\u4E24\u6B21\u8BF7\u6C42\u4E4B\u95F4\u4FDD\u7559\u591A\u4E45\u3002\u5BF9\u8BDD\u4E2D\u6BCF\u6B21\u505C\u987F\u8F83\u4E45\u90FD\u8981\u91CD\u65B0\u63E1\u624B\u4E00\u6B21\uFF1B\u6BCF\u6B21\u6536\u5230\u56DE\u7B54\u540E\u8BA1\u65F6\u90FD\u4F1A\u91CD\u65B0\u5F00\u59CB\u3002",
659
676
  requestLogTitle: "\u8BF7\u6C42\u65E5\u5FD7",
660
677
  requestLogHint: "\u6392\u67E5\u7528\u7684\u9010\u8BF7\u6C42\u8BB0\u5F55\u3002\u9ED8\u8BA4\u5173\u95ED\uFF1B\u6253\u5F00\u5B83\u4E0D\u4F1A\u6539\u53D8\u8BF7\u6C42\u672C\u8EAB\u7684\u884C\u4E3A\u3002",
678
+ requestLogPageHint: "\u6BCF\u4E2A\u8BF7\u6C42\u4E00\u884C\u3002\u8868\u683C\u6EDA\u52A8\uFF0C\u7B5B\u9009\u680F\u56FA\u5B9A\u5728\u4E0A\u65B9\u3002",
661
679
  requestLogEnabled: "\u8BB0\u5F55\u8BF7\u6C42",
662
680
  requestLogDebug: "\u6392\u9519\u8BE6\u60C5",
663
681
  requestLogDebugHint: "\u8FDE\u63A5\u6C60\u4E8B\u4EF6\u4E0E\u5B8C\u6574\u4F1A\u8BDD id\u3002\u4E0D\u5F00\u5219\u4F1A\u8BDD\u53EA\u4FDD\u7559\u524D 8 \u4F4D\u3002",
@@ -677,6 +695,7 @@ var zh = {
677
695
  requestLogSlowOnly: "\u53EA\u770B\u6162\u8BF7\u6C42",
678
696
  requestLogSlowSeconds: "\u6162\u4E8E\uFF08\u79D2\uFF09",
679
697
  requestLogFilterSession: "\u4F1A\u8BDD\u5305\u542B",
698
+ requestLogOnlySession: "\u4EC5\u672C\u4F1A\u8BDD",
680
699
  requestLogGroupBy: "\u5206\u7EC4",
681
700
  requestLogGroupNone: "\u4E0D\u5206\u7EC4",
682
701
  requestLogGroupSession: "\u6309\u4F1A\u8BDD",
@@ -695,6 +714,7 @@ var zh = {
695
714
  requestLogColOut: "\u8F93\u51FA",
696
715
  requestLogColCache: "\u7F13\u5B58",
697
716
  requestLogColLatency: "\u8017\u65F6",
717
+ requestLogColTps: "tok/s",
698
718
  requestLogColFirstToken: "\u9996\u5B57",
699
719
  requestLogColStatus: "\u72B6\u6001",
700
720
  requestLogDetailRequest: "\u8BF7\u6C42",
@@ -712,6 +732,11 @@ var zh = {
712
732
  requestLogDetailMessages: "\u6761\u6D88\u606F",
713
733
  requestLogDetailTools: "\u4E2A\u5DE5\u5177",
714
734
  requestLogDetailHasImage: "\u542B\u56FE\u7247",
735
+ requestLogStatRequests: "\u8BF7\u6C42\u6570",
736
+ requestLogStatFailures: "\u5931\u8D25\u6570",
737
+ requestLogStatLatency: "\u5E73\u5747\u8017\u65F6",
738
+ requestLogStatFirstToken: "\u5E73\u5747\u9996\u5B57",
739
+ requestLogStatTps: "\u5E73\u5747 tok/s",
715
740
  writeRejected: "\u8BBE\u7F6E\u5199\u5165\u88AB\u62D2\u7EDD\uFF08\u5DF2\u91CD\u65B0\u8F7D\u5165\uFF09\uFF0C\u8BF7\u91CD\u8BD5",
716
741
  writeFailed: "\u8BBE\u7F6E\u5199\u5165\u5931\u8D25",
717
742
  filterPlaceholder: "\u6309\u540D\u79F0\u6216 ID \u7B5B\u9009",
@@ -786,348 +811,7 @@ var zh = {
786
811
  };
787
812
 
788
813
  // src/client/Section.tsx
789
- var import_react2 = require("react");
790
-
791
- // src/client/RequestLogDialog.tsx
792
814
  var import_react = require("react");
793
- var import_react_dom = require("react-dom");
794
-
795
- // plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/request-log.module.css
796
- var id = "@dan-ai-studio/dshopencodego/request-log.module.css";
797
- if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")) {
798
- const style = document.createElement("style");
799
- style.dataset.plugin = "@dan-ai-studio/dshopencodego";
800
- style.dataset.pluginCss = id;
801
- style.textContent = ".Lx7MOq_overlay{z-index:1000;background:#0000008c;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.Lx7MOq_panel{border-radius:8px;flex-direction:column;width:min(1100px,94vw);max-height:92vh;display:flex;overflow:hidden}.Lx7MOq_title{align-items:baseline;gap:8px;display:flex}.Lx7MOq_titleValue{margin-left:auto}.Lx7MOq_controls{flex-wrap:wrap;align-items:center;gap:8px 16px;display:flex}.Lx7MOq_footer{align-items:center;gap:16px;display:flex}.Lx7MOq_tableWrap{flex:1;min-height:120px;overflow:auto}.Lx7MOq_table{border-collapse:collapse;width:100%;font-size:12px}.Lx7MOq_table th,.Lx7MOq_table td{text-align:left;white-space:nowrap;padding:4px 8px}.Lx7MOq_group td{font-weight:700}.Lx7MOq_row{cursor:pointer}.Lx7MOq_rowFail{border-left:3px solid #c0392b}.Lx7MOq_rowFail td:first-child{color:#c0392b}.Lx7MOq_rowSlow{border-left:3px solid #d68910}.Lx7MOq_rowSlow td:first-child{color:#d68910}.Lx7MOq_rowOk{border-left:3px solid #0000}.Lx7MOq_detail td{white-space:normal;word-break:break-all}.Lx7MOq_mono{font-family:monospace}.Lx7MOq_pager{align-items:center;gap:12px;display:flex}";
802
- document.head.appendChild(style);
803
- }
804
- var request_log_default = { "controls": "Lx7MOq_controls", "detail": "Lx7MOq_detail", "footer": "Lx7MOq_footer", "group": "Lx7MOq_group", "mono": "Lx7MOq_mono", "overlay": "Lx7MOq_overlay", "pager": "Lx7MOq_pager", "panel": "Lx7MOq_panel", "row": "Lx7MOq_row", "rowFail": "Lx7MOq_rowFail", "rowOk": "Lx7MOq_rowOk", "rowSlow": "Lx7MOq_rowSlow", "table": "Lx7MOq_table", "tableWrap": "Lx7MOq_tableWrap", "title": "Lx7MOq_title", "titleValue": "Lx7MOq_titleValue" };
805
-
806
- // src/client/RequestLogDialog.tsx
807
- var import_jsx_runtime = require("react/jsx-runtime");
808
- var PAGE_SIZE = 50;
809
- function formatCount(value) {
810
- if (value === void 0) return "\u2014";
811
- return value.toLocaleString();
812
- }
813
- function formatMs(value) {
814
- if (value === void 0) return "\u2014";
815
- return value < 1e3 ? `${Math.round(value)}ms` : `${(value / 1e3).toFixed(1)}s`;
816
- }
817
- function formatTime(atMs, getLocale) {
818
- return new Date(atMs).toLocaleTimeString(getLocale?.(), { hour12: false });
819
- }
820
- function statusOf(entry) {
821
- if (!entry.ok) return entry.code === "TIMEOUT" || entry.code === "ABORTED" ? "timeout" : "fail";
822
- return "ok";
823
- }
824
- function groupKey(entry, groupBy) {
825
- switch (groupBy) {
826
- case "session":
827
- return entry.session === "" ? "\u2014" : entry.session;
828
- case "model":
829
- return entry.model;
830
- case "result":
831
- return entry.ok ? "ok" : entry.code ?? "fail";
832
- case "none":
833
- return null;
834
- }
835
- }
836
- function RequestLogDialog({ readLog, enabled, t, getLocale, onClose }) {
837
- const [snapshot, setSnapshot] = (0, import_react.useState)(void 0);
838
- const [failure, setFailure] = (0, import_react.useState)(void 0);
839
- const [refreshing, setRefreshing] = (0, import_react.useState)(false);
840
- const [model, setModel] = (0, import_react.useState)("all");
841
- const [result, setResult] = (0, import_react.useState)("all");
842
- const [slowOnly, setSlowOnly] = (0, import_react.useState)(false);
843
- const [slowSeconds, setSlowSeconds] = (0, import_react.useState)(5);
844
- const [sessionQuery, setSessionQuery] = (0, import_react.useState)("");
845
- const [groupBy, setGroupBy] = (0, import_react.useState)("none");
846
- const [page, setPage] = (0, import_react.useState)(0);
847
- const [expanded, setExpanded] = (0, import_react.useState)(null);
848
- const root = (0, import_react.useRef)(null);
849
- (0, import_react.useEffect)(() => {
850
- let alive = true;
851
- const load = async () => {
852
- setRefreshing(true);
853
- try {
854
- const next = await readLog();
855
- if (!alive) return;
856
- setSnapshot(next);
857
- setFailure(void 0);
858
- } catch (error) {
859
- if (!alive) return;
860
- setFailure(error instanceof Error ? error.message : String(error));
861
- } finally {
862
- if (alive) setRefreshing(false);
863
- }
864
- };
865
- void load();
866
- return () => {
867
- alive = false;
868
- };
869
- }, [readLog]);
870
- (0, import_react.useEffect)(() => {
871
- const close = (event) => {
872
- if (!root.current?.contains(event.target)) onClose();
873
- };
874
- const escape = (event) => {
875
- if (event.key === "Escape") onClose();
876
- };
877
- document.addEventListener("mousedown", close);
878
- document.addEventListener("keydown", escape);
879
- return () => {
880
- document.removeEventListener("mousedown", close);
881
- document.removeEventListener("keydown", escape);
882
- };
883
- }, [onClose]);
884
- const models = (0, import_react.useMemo)(() => {
885
- const ids = /* @__PURE__ */ new Set();
886
- for (const entry of snapshot?.entries ?? []) ids.add(entry.model);
887
- return [...ids].toSorted();
888
- }, [snapshot]);
889
- const filtered = (0, import_react.useMemo)(() => {
890
- const query = sessionQuery.trim();
891
- return (snapshot?.entries ?? []).filter((entry) => {
892
- if (model !== "all" && entry.model !== model) return false;
893
- if (result === "ok" && !entry.ok) return false;
894
- if (result === "fail" && entry.ok) return false;
895
- if (slowOnly && (entry.durationMs ?? 0) < Math.max(0, slowSeconds) * 1e3) return false;
896
- if (query !== "" && !entry.session.includes(query)) return false;
897
- return true;
898
- });
899
- }, [snapshot, model, result, slowOnly, slowSeconds, sessionQuery]);
900
- const pages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
901
- const safePage = Math.min(page, pages - 1);
902
- const pageEntries = filtered.slice(safePage * PAGE_SIZE, (safePage + 1) * PAGE_SIZE);
903
- const reuse = snapshot !== void 0 && snapshot.totalRecords > 0 ? Math.max(0, Math.min(1, 1 - snapshot.newConnections / snapshot.totalRecords)) : null;
904
- const rows = () => {
905
- const out = [];
906
- let lastGroup = null;
907
- for (const entry of pageEntries) {
908
- const state = statusOf(entry);
909
- const slow = entry.ok && (entry.durationMs ?? 0) >= 5e3;
910
- const group = groupKey(entry, groupBy);
911
- if (group !== null && group !== lastGroup) {
912
- lastGroup = group;
913
- out.push(
914
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { className: request_log_default.group, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { colSpan: 9, children: group }) }, `group-${group}-${entry.seq}`)
915
- );
916
- }
917
- out.push(
918
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
919
- "tr",
920
- {
921
- className: `${request_log_default.row} ${state === "ok" ? slow ? request_log_default.rowSlow : request_log_default.rowOk : state === "timeout" ? request_log_default.rowSlow : request_log_default.rowFail}`,
922
- onClick: () => {
923
- setExpanded(expanded === entry.seq ? null : entry.seq);
924
- },
925
- children: [
926
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: formatTime(entry.atMs, getLocale) }),
927
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: request_log_default.mono, children: entry.model }),
928
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: request_log_default.mono, children: entry.session === "" ? "\u2014" : entry.session }),
929
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: formatCount(entry.inputTokens) }),
930
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: formatCount(entry.outputTokens) }),
931
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: formatCount(entry.cacheReadTokens) }),
932
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: formatMs(entry.durationMs) }),
933
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: formatMs(entry.firstTokenMs) }),
934
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: entry.ok ? `${entry.status ?? ""}`.trim() || "\u2713" : entry.code ?? "\u2717" })
935
- ]
936
- },
937
- entry.seq
938
- )
939
- );
940
- if (expanded === entry.seq) {
941
- out.push(
942
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { className: request_log_default.detail, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { colSpan: 9, children: [
943
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("requestLogDetailRequest") }) }),
944
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
945
- `${t("requestLogDetailMethod")}: `,
946
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: request_log_default.mono, children: entry.method })
947
- ] }),
948
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
949
- `${t("requestLogDetailUrl")}: `,
950
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: request_log_default.mono, children: entry.url })
951
- ] }),
952
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
953
- `${t("requestLogDetailSession")}: `,
954
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: request_log_default.mono, children: entry.session === "" ? "\u2014" : entry.session })
955
- ] }),
956
- entry.poolKey !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
957
- `${t("requestLogDetailPool")}: `,
958
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: request_log_default.mono, children: entry.poolKey })
959
- ] }),
960
- entry.headers !== void 0 && (entry.headers.session !== void 0 || entry.headers.userAgent !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
961
- `${t("requestLogDetailHeaders")}: `,
962
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: request_log_default.mono, children: [entry.headers.session, entry.headers.userAgent].filter((part) => part !== void 0).join(" \xB7 ") })
963
- ] }),
964
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
965
- `${t("requestLogDetailShape")}: `,
966
- `${entry.shape?.messages ?? 0} ${t("requestLogDetailMessages")}`,
967
- entry.shape !== void 0 && entry.shape.tools > 0 && ` \xB7 ${entry.shape.tools} ${t("requestLogDetailTools")}`,
968
- entry.shape?.hasImage === true && ` \xB7 ${t("requestLogDetailHasImage")}`
969
- ] }),
970
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("requestLogDetailTiming") }) }),
971
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: `${t("requestLogColLatency")}: ${formatMs(entry.durationMs)} \xB7 ${t("requestLogColFirstToken")}: ${formatMs(entry.firstTokenMs)}` }),
972
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("requestLogDetailResult") }) }),
973
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
974
- `${t("requestLogColStatus")}: ${entry.status ?? "\u2014"}`,
975
- ` \xB7 ${t("requestLogDetailTokens")}: ${formatCount(entry.inputTokens)} / ${formatCount(entry.outputTokens)} / ${formatCount(entry.cacheReadTokens)}`,
976
- !entry.ok && entry.code !== void 0 && ` \xB7 ${t("requestLogDetailError")}: ${entry.code}`
977
- ] })
978
- ] }) }, `detail-${entry.seq}`)
979
- );
980
- }
981
- }
982
- return out;
983
- };
984
- return (0, import_react_dom.createPortal)(
985
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: request_log_default.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: request_log_default.panel, ref: root, role: "dialog", "aria-label": t("requestLogTitle"), "aria-busy": refreshing, children: [
986
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: request_log_default.title, children: [
987
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("requestLogTitle") }),
988
- snapshot !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: request_log_default.titleValue, children: `${snapshot.totalRecords.toLocaleString(getLocale?.())} \xB7 ${t("requestLogDropped")} ${snapshot.droppedRecords.toLocaleString(getLocale?.())}` }),
989
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => {
990
- setPage(0);
991
- setExpanded(null);
992
- void refresh();
993
- }, disabled: refreshing, children: t("requestLogRefresh") }),
994
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: onClose, children: t("requestLogClose") })
995
- ] }),
996
- !enabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("requestLogDisabled") }),
997
- enabled && failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", children: failure }),
998
- enabled && snapshot !== void 0 && reuse !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { title: t("requestLogReuseHint"), children: [
999
- `${t("requestLogReuse")} ${(reuse * 100).toFixed(0)}%`,
1000
- snapshot.poolKey !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: request_log_default.mono, children: [
1001
- " \xB7 ",
1002
- snapshot.poolKey
1003
- ] })
1004
- ] }),
1005
- enabled && snapshot !== void 0 && snapshot.poolEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: request_log_default.mono, children: snapshot.poolEvents.map(
1006
- (event) => `${new Date(event.atMs).toLocaleTimeString(getLocale?.(), { hour12: false })} ${event.type} ${event.key}`
1007
- ).join(" \xB7 ") }),
1008
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: request_log_default.controls, children: [
1009
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
1010
- `${t("requestLogFilterModel")} `,
1011
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: model, onChange: (event) => {
1012
- setModel(event.target.value);
1013
- setPage(0);
1014
- }, children: [
1015
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "all", children: t("requestLogFilterModelAll") }),
1016
- models.map((id4) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: id4, children: id4 }, id4))
1017
- ] })
1018
- ] }),
1019
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
1020
- `${t("requestLogFilterResult")} `,
1021
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1022
- "select",
1023
- {
1024
- value: result,
1025
- onChange: (event) => {
1026
- setResult(event.target.value);
1027
- setPage(0);
1028
- },
1029
- children: [
1030
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "all", children: t("requestLogResultAll") }),
1031
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "ok", children: t("requestLogResultOk") }),
1032
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "fail", children: t("requestLogResultFail") })
1033
- ]
1034
- }
1035
- )
1036
- ] }),
1037
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
1038
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1039
- "input",
1040
- {
1041
- type: "checkbox",
1042
- checked: slowOnly,
1043
- onChange: (event) => {
1044
- setSlowOnly(event.target.checked);
1045
- setPage(0);
1046
- }
1047
- }
1048
- ),
1049
- ` ${t("requestLogSlowOnly")} `,
1050
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1051
- "input",
1052
- {
1053
- type: "number",
1054
- min: 1,
1055
- value: slowSeconds,
1056
- disabled: !slowOnly,
1057
- "aria-label": t("requestLogSlowSeconds"),
1058
- onChange: (event) => {
1059
- setSlowSeconds(Number(event.target.value));
1060
- setPage(0);
1061
- }
1062
- }
1063
- ),
1064
- ` ${t("requestLogSlowSeconds")}`
1065
- ] }),
1066
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
1067
- `${t("requestLogFilterSession")} `,
1068
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1069
- "input",
1070
- {
1071
- type: "search",
1072
- value: sessionQuery,
1073
- onChange: (event) => {
1074
- setSessionQuery(event.target.value);
1075
- setPage(0);
1076
- }
1077
- }
1078
- )
1079
- ] }),
1080
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { children: [
1081
- `${t("requestLogGroupBy")} `,
1082
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { value: groupBy, onChange: (event) => {
1083
- setGroupBy(event.target.value);
1084
- setPage(0);
1085
- }, children: [
1086
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "none", children: t("requestLogGroupNone") }),
1087
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "session", children: t("requestLogGroupSession") }),
1088
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "model", children: t("requestLogGroupModel") }),
1089
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "result", children: t("requestLogGroupResult") })
1090
- ] })
1091
- ] })
1092
- ] }),
1093
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: request_log_default.tableWrap, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("requestLogEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: request_log_default.table, children: [
1094
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
1095
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColTime") }),
1096
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColModel") }),
1097
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColSession") }),
1098
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColIn") }),
1099
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColOut") }),
1100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColCache") }),
1101
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColLatency") }),
1102
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColFirstToken") }),
1103
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("requestLogColStatus") })
1104
- ] }) }),
1105
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: rows() })
1106
- ] }) }),
1107
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: request_log_default.footer, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: request_log_default.pager, children: [
1108
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: safePage <= 0, onClick: () => {
1109
- setPage(safePage - 1);
1110
- }, children: t("requestLogPagePrev") }),
1111
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: `${safePage + 1} ${t("requestLogPageOf")} ${pages}` }),
1112
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", disabled: safePage >= pages - 1, onClick: () => {
1113
- setPage(safePage + 1);
1114
- }, children: t("requestLogPageNext") })
1115
- ] }) })
1116
- ] }) }),
1117
- document.body
1118
- );
1119
- async function refresh() {
1120
- setRefreshing(true);
1121
- try {
1122
- setSnapshot(await readLog());
1123
- setFailure(void 0);
1124
- } catch (error) {
1125
- setFailure(error instanceof Error ? error.message : String(error));
1126
- } finally {
1127
- setRefreshing(false);
1128
- }
1129
- }
1130
- }
1131
815
 
1132
816
  // src/update/check.ts
1133
817
  var PACKAGE_NAME = "@dan-ai-studio/dshopencodego";
@@ -1187,18 +871,18 @@ function isIPv6(value) {
1187
871
  const head = groups(halves[0] ?? "");
1188
872
  const tail = halves.length === 2 ? groups(halves[1] ?? "") : [];
1189
873
  const all = [...head, ...tail];
1190
- let count2 = 0;
874
+ let count3 = 0;
1191
875
  for (const [index, group] of all.entries()) {
1192
876
  if (group.includes(".")) {
1193
877
  if (index !== all.length - 1) return false;
1194
878
  if (!isDottedQuad(group)) return false;
1195
- count2 += 2;
879
+ count3 += 2;
1196
880
  continue;
1197
881
  }
1198
882
  if (!/^[0-9a-fA-F]{1,4}$/.test(group)) return false;
1199
- count2 += 1;
883
+ count3 += 1;
1200
884
  }
1201
- return halves.length === 2 ? count2 <= 7 : count2 === 8;
885
+ return halves.length === 2 ? count3 <= 7 : count3 === 8;
1202
886
  }
1203
887
  function isAddress(value) {
1204
888
  const trimmed = value.trim();
@@ -1267,18 +951,18 @@ function inputModalityLabels(model, t) {
1267
951
  }
1268
952
 
1269
953
  // plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/section.module.css
1270
- var id2 = "@dan-ai-studio/dshopencodego/section.module.css";
1271
- if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]")) {
954
+ var id = "@dan-ai-studio/dshopencodego/section.module.css";
955
+ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")) {
1272
956
  const style = document.createElement("style");
1273
957
  style.dataset.plugin = "@dan-ai-studio/dshopencodego";
1274
- style.dataset.pluginCss = id2;
958
+ style.dataset.pluginCss = id;
1275
959
  style.textContent = ".d7lz0W_root{color:var(--dsw-alias-label-primary);flex-direction:column;gap:1.25rem;display:flex}.d7lz0W_title{margin:0;font-size:1.05rem}.d7lz0W_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.8rem}.d7lz0W_warn{color:var(--dsw-alias-state-warn-primary);margin:0;font-size:.8rem}.d7lz0W_ok{color:var(--dsw-alias-state-success-primary);font-size:.8rem}.d7lz0W_block{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:.6rem;flex-direction:column;gap:.5rem;padding:.85rem;display:flex}.d7lz0W_row{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.d7lz0W_row>strong{margin-right:auto}.d7lz0W_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);min-width:10rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;flex:14rem;padding:.35rem .5rem;font-size:.85rem}.d7lz0W_button{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;padding:.35rem .7rem;font-size:.8rem}.d7lz0W_button:disabled{color:var(--dsw-alias-state-idle-primary);cursor:default}.d7lz0W_number{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:5rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_select{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:auto;max-width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_list{flex-direction:column;display:flex}.d7lz0W_item{border-top:1px solid var(--dsw-alias-border-l1);align-items:flex-start;gap:.5rem;padding:.45rem .15rem;display:flex}.d7lz0W_item input[type=checkbox]{accent-color:var(--dsw-alias-brand-primary);margin-top:.15rem}.d7lz0W_itemBody{flex-direction:column;gap:.15rem;min-width:0;display:flex}.d7lz0W_itemMain{flex-wrap:wrap;align-items:baseline;gap:.6rem;display:flex}.d7lz0W_itemMeta{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:.75rem;font-size:.75rem;display:flex}.d7lz0W_itemModalities{color:var(--dsw-alias-label-secondary);font-size:.75rem}.d7lz0W_name{color:var(--dsw-alias-label-primary)}.d7lz0W_mono{color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.d7lz0W_badge{color:var(--dsw-alias-brand-primary)}";
1276
960
  document.head.appendChild(style);
1277
961
  }
1278
962
  var section_default = { "badge": "d7lz0W_badge", "block": "d7lz0W_block", "button": "d7lz0W_button", "hint": "d7lz0W_hint", "input": "d7lz0W_input", "item": "d7lz0W_item", "itemBody": "d7lz0W_itemBody", "itemMain": "d7lz0W_itemMain", "itemMeta": "d7lz0W_itemMeta", "itemModalities": "d7lz0W_itemModalities", "list": "d7lz0W_list", "mono": "d7lz0W_mono", "name": "d7lz0W_name", "number": "d7lz0W_number", "ok": "d7lz0W_ok", "root": "d7lz0W_root", "row": "d7lz0W_row", "select": "d7lz0W_select", "title": "d7lz0W_title", "warn": "d7lz0W_warn" };
1279
963
 
1280
964
  // src/client/Section.tsx
1281
- var import_jsx_runtime2 = require("react/jsx-runtime");
965
+ var import_jsx_runtime = require("react/jsx-runtime");
1282
966
  var API_KEY_REF = "OPENCODE_GO_API_KEY";
1283
967
  var VISIBILITY_WRITE_DELAY_MS = 250;
1284
968
  var INITIAL = {
@@ -1295,8 +979,7 @@ var INITIAL = {
1295
979
  writable: false,
1296
980
  saving: false,
1297
981
  filter: INITIAL_FILTER,
1298
- update: { phase: "idle", status: void 0, message: void 0 },
1299
- requestLogOpen: false
982
+ update: { phase: "idle", status: void 0, message: void 0 }
1300
983
  };
1301
984
  function settingsOf(value) {
1302
985
  if (value === null || typeof value !== "object") return void 0;
@@ -1773,14 +1456,6 @@ var SectionController = class _SectionController {
1773
1456
  () => this.set({ settings: { ...current, requestLogMaxEntries: entries } })
1774
1457
  );
1775
1458
  }
1776
- /** Open the request-log viewer. */
1777
- openRequestLog() {
1778
- this.set({ requestLogOpen: true });
1779
- }
1780
- /** Close the request-log viewer. */
1781
- closeRequestLog() {
1782
- this.set({ requestLogOpen: false });
1783
- }
1784
1459
  async write(operation, onAccepted) {
1785
1460
  this.set({ saving: true });
1786
1461
  try {
@@ -1824,12 +1499,12 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1824
1499
  if (update.phase === "idle") return null;
1825
1500
  const status = update.status;
1826
1501
  const notes = status?.latest === void 0 ? `https://github.com/${REPOSITORY}/releases` : `https://github.com/${REPOSITORY}/releases/tag/v${status.latest}`;
1827
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.block, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
1828
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: t("updateTitle") }),
1829
- update.phase === "checking" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("updateChecking") }),
1830
- update.phase === "current" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1831
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: `${t("updateLatest")} ${status?.current ?? ""}`.trim() }),
1832
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1502
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.block, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1503
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("updateTitle") }),
1504
+ update.phase === "checking" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("updateChecking") }),
1505
+ update.phase === "current" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1506
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: `${t("updateLatest")} ${status?.current ?? ""}`.trim() }),
1507
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1833
1508
  "button",
1834
1509
  {
1835
1510
  type: "button",
@@ -1844,9 +1519,9 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1844
1519
  }
1845
1520
  )
1846
1521
  ] }),
1847
- update.phase === "ready" && status?.latest !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1848
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: `${t("updateAvailable")} ${status.latest} (${t("updateCurrent")} ${status.current})` }),
1849
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1522
+ update.phase === "ready" && status?.latest !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1523
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: `${t("updateAvailable")} ${status.latest} (${t("updateCurrent")} ${status.current})` }),
1524
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1850
1525
  "button",
1851
1526
  {
1852
1527
  type: "button",
@@ -1858,8 +1533,8 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1858
1533
  children: t("updateNow")
1859
1534
  }
1860
1535
  ),
1861
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { className: section_default.hint, href: notes, target: "_blank", rel: "noreferrer", children: t("updateNotes") }),
1862
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1536
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: section_default.hint, href: notes, target: "_blank", rel: "noreferrer", children: t("updateNotes") }),
1537
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1863
1538
  "button",
1864
1539
  {
1865
1540
  type: "button",
@@ -1874,9 +1549,9 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1874
1549
  }
1875
1550
  )
1876
1551
  ] }),
1877
- update.phase === "confirming" && status?.latest !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1878
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: `${t("updateConfirmHint")} ${status.latest}` }),
1879
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1552
+ update.phase === "confirming" && status?.latest !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1553
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: `${t("updateConfirmHint")} ${status.latest}` }),
1554
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1880
1555
  "button",
1881
1556
  {
1882
1557
  type: "button",
@@ -1890,7 +1565,7 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1890
1565
  children: t("updateConfirm")
1891
1566
  }
1892
1567
  ),
1893
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1568
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1894
1569
  "button",
1895
1570
  {
1896
1571
  type: "button",
@@ -1903,15 +1578,15 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1903
1578
  }
1904
1579
  )
1905
1580
  ] }),
1906
- update.phase === "updating" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("updateApplying") }),
1907
- update.phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1908
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.ok, children: `${t("updateDone")} ${status?.latest ?? ""}`.trim() }),
1909
- update.message === "restart-required" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.warn, children: t("updateRestart") })
1581
+ update.phase === "updating" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("updateApplying") }),
1582
+ update.phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1583
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.ok, children: `${t("updateDone")} ${status?.latest ?? ""}`.trim() }),
1584
+ update.message === "restart-required" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.warn, children: t("updateRestart") })
1910
1585
  ] }),
1911
- update.phase === "failed" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1912
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.warn, children: t("updateFailed") }),
1913
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: updateFailureText(update.message, t) }),
1914
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1586
+ update.phase === "failed" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1587
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.warn, children: t("updateFailed") }),
1588
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: updateFailureText(update.message, t) }),
1589
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1915
1590
  "button",
1916
1591
  {
1917
1592
  type: "button",
@@ -1943,12 +1618,12 @@ function updateFailureText(message, t) {
1943
1618
  if (message === "pending-builds") return t("updatePendingBuilds");
1944
1619
  return message;
1945
1620
  }
1946
- function Section({ controller, t, getLocale }) {
1947
- const state = (0, import_react2.useSyncExternalStore)(controller.subscribe, controller.snapshot, controller.snapshot);
1948
- const [keyDraft, setKeyDraft] = (0, import_react2.useState)("");
1949
- const [pinDraft, setPinDraft] = (0, import_react2.useState)("");
1950
- const [busy, setBusy] = (0, import_react2.useState)(false);
1951
- const act = (0, import_react2.useCallback)(async (operation) => {
1621
+ function Section({ controller, t, getLocale, openRequestLog }) {
1622
+ const state = (0, import_react.useSyncExternalStore)(controller.subscribe, controller.snapshot, controller.snapshot);
1623
+ const [keyDraft, setKeyDraft] = (0, import_react.useState)("");
1624
+ const [pinDraft, setPinDraft] = (0, import_react.useState)("");
1625
+ const [busy, setBusy] = (0, import_react.useState)(false);
1626
+ const act = (0, import_react.useCallback)(async (operation) => {
1952
1627
  setBusy(true);
1953
1628
  try {
1954
1629
  await operation();
@@ -1956,10 +1631,10 @@ function Section({ controller, t, getLocale }) {
1956
1631
  setBusy(false);
1957
1632
  }
1958
1633
  }, []);
1959
- (0, import_react2.useEffect)(() => {
1634
+ (0, import_react.useEffect)(() => {
1960
1635
  setKeyDraft("");
1961
1636
  }, [state.saved]);
1962
- (0, import_react2.useEffect)(() => {
1637
+ (0, import_react.useEffect)(() => {
1963
1638
  setPinDraft(state.network?.address ?? "");
1964
1639
  }, [state.network?.address]);
1965
1640
  const reading = state.reading;
@@ -1968,18 +1643,18 @@ function Section({ controller, t, getLocale }) {
1968
1643
  const editable = state.writable && state.settings !== void 0;
1969
1644
  const rows = reading === void 0 ? [] : visibleModels(reading.models, state.filter, visibility, getLocale?.());
1970
1645
  const hidden = reading === void 0 ? 0 : reading.models.length - rows.length;
1971
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: section_default.root, children: [
1972
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: section_default.title, children: t("nav") }),
1973
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.hint, children: t("intro") }),
1974
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(UpdateBanner, { controller, t, busy, act, update: state.update }),
1975
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.block, children: [
1976
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
1977
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: t("keyTitle") }),
1978
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: state.keyConfigured === true ? section_default.ok : state.keyConfigured === false ? section_default.warn : section_default.hint, children: state.keyConfigured === true ? t("keyConfigured") : state.keyConfigured === false ? t("keyMissing") : "\u2014" })
1646
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: section_default.root, children: [
1647
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: section_default.title, children: t("nav") }),
1648
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("intro") }),
1649
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UpdateBanner, { controller, t, busy, act, update: state.update }),
1650
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.block, children: [
1651
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1652
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("keyTitle") }),
1653
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: state.keyConfigured === true ? section_default.ok : state.keyConfigured === false ? section_default.warn : section_default.hint, children: state.keyConfigured === true ? t("keyConfigured") : state.keyConfigured === false ? t("keyMissing") : "\u2014" })
1979
1654
  ] }),
1980
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.hint, children: t("keyHint") }),
1981
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
1982
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1655
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("keyHint") }),
1656
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1657
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1983
1658
  "input",
1984
1659
  {
1985
1660
  className: section_default.input,
@@ -1992,7 +1667,7 @@ function Section({ controller, t, getLocale }) {
1992
1667
  }
1993
1668
  }
1994
1669
  ),
1995
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1670
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1996
1671
  "button",
1997
1672
  {
1998
1673
  type: "button",
@@ -2006,7 +1681,7 @@ function Section({ controller, t, getLocale }) {
2006
1681
  children: state.saved === true ? t("keySaved") : t("keySave")
2007
1682
  }
2008
1683
  ),
2009
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1684
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2010
1685
  "button",
2011
1686
  {
2012
1687
  type: "button",
@@ -2022,16 +1697,16 @@ function Section({ controller, t, getLocale }) {
2022
1697
  )
2023
1698
  ] })
2024
1699
  ] }),
2025
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.block, children: [
2026
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2027
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: t("pinTitle") }),
2028
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.mono, children: network?.host ?? "\u2014" }),
2029
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: network?.failed === true ? section_default.warn : section_default.hint, children: network === void 0 ? "\u2014" : network.failed === true ? t("pinFailed") : network.address === void 0 ? t("pinNone") : network.address })
1700
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.block, children: [
1701
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1702
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("pinTitle") }),
1703
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.mono, children: network?.host ?? "\u2014" }),
1704
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: network?.failed === true ? section_default.warn : section_default.hint, children: network === void 0 ? "\u2014" : network.failed === true ? t("pinFailed") : network.address === void 0 ? t("pinNone") : network.address })
2030
1705
  ] }),
2031
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.hint, children: t("pinHint") }),
2032
- state.networkFailure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.warn, children: `${t("pinUnavailable")}: ${state.networkFailure}` }),
2033
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2034
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1706
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("pinHint") }),
1707
+ state.networkFailure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.warn, children: `${t("pinUnavailable")}: ${state.networkFailure}` }),
1708
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1709
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2035
1710
  "input",
2036
1711
  {
2037
1712
  className: section_default.input,
@@ -2044,7 +1719,7 @@ function Section({ controller, t, getLocale }) {
2044
1719
  }
2045
1720
  }
2046
1721
  ),
2047
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1722
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2048
1723
  "button",
2049
1724
  {
2050
1725
  type: "button",
@@ -2058,7 +1733,7 @@ function Section({ controller, t, getLocale }) {
2058
1733
  children: t("pinSave")
2059
1734
  }
2060
1735
  ),
2061
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1736
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2062
1737
  "button",
2063
1738
  {
2064
1739
  type: "button",
@@ -2073,13 +1748,13 @@ function Section({ controller, t, getLocale }) {
2073
1748
  }
2074
1749
  )
2075
1750
  ] }),
2076
- state.pinInvalid && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.warn, children: t("pinInvalid") })
1751
+ state.pinInvalid && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.warn, children: t("pinInvalid") })
2077
1752
  ] }),
2078
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.block, children: [
2079
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2080
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: t("catalogTitle") }),
2081
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: reading === void 0 ? "\u2014" : `${reading.counts.total} ${t("catalogCountUnit")} \xB7 ${reading.counts.enabled} \u2713` + (reading.counts.inferred === 0 ? "" : ` \xB7 ${reading.counts.inferred} ${t("catalogInferred")}`) + (reading.counts.unconfigured === 0 ? "" : ` \xB7 ${reading.counts.unconfigured} ${t("catalogUnconfigured")}`) }),
2082
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1753
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.block, children: [
1754
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1755
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("catalogTitle") }),
1756
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: reading === void 0 ? "\u2014" : `${reading.counts.total} ${t("catalogCountUnit")} \xB7 ${reading.counts.enabled} \u2713` + (reading.counts.inferred === 0 ? "" : ` \xB7 ${reading.counts.inferred} ${t("catalogInferred")}`) + (reading.counts.unconfigured === 0 ? "" : ` \xB7 ${reading.counts.unconfigured} ${t("catalogUnconfigured")}`) }),
1757
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2083
1758
  "button",
2084
1759
  {
2085
1760
  type: "button",
@@ -2091,7 +1766,7 @@ function Section({ controller, t, getLocale }) {
2091
1766
  children: t("catalogSelectAll")
2092
1767
  }
2093
1768
  ),
2094
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1769
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2095
1770
  "button",
2096
1771
  {
2097
1772
  type: "button",
@@ -2103,7 +1778,7 @@ function Section({ controller, t, getLocale }) {
2103
1778
  children: t("catalogSelectNone")
2104
1779
  }
2105
1780
  ),
2106
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1781
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2107
1782
  "button",
2108
1783
  {
2109
1784
  type: "button",
@@ -2118,31 +1793,31 @@ function Section({ controller, t, getLocale }) {
2118
1793
  }
2119
1794
  )
2120
1795
  ] }),
2121
- state.failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.warn, children: [
1796
+ state.failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.warn, children: [
2122
1797
  t("catalogStale"),
2123
1798
  ": ",
2124
1799
  state.failure
2125
1800
  ] }),
2126
- reading !== void 0 && reading.stale && state.failure === void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.warn, children: t("catalogStale") }),
2127
- reading !== void 0 && reading.degradations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.warn, children: [
1801
+ reading !== void 0 && reading.stale && state.failure === void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.warn, children: t("catalogStale") }),
1802
+ reading !== void 0 && reading.degradations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.warn, children: [
2128
1803
  t("catalogDegraded"),
2129
1804
  ": ",
2130
1805
  reading.degradations.map((degradation) => `${t(degradation.source === "metadata" ? "catalogDegradedMetadata" : "catalogDegradedDocument")} \u2014 ${degradation.reason}`).join("; ")
2131
1806
  ] }),
2132
- reading !== void 0 && reading.quotaSource === "seed" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.hint, children: [
1807
+ reading !== void 0 && reading.quotaSource === "seed" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.hint, children: [
2133
1808
  t("quotaSeed"),
2134
1809
  " ",
2135
1810
  SEED_TRANSCRIBED
2136
1811
  ] }),
2137
- reading !== void 0 && reading.factsCachedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.hint, children: [
1812
+ reading !== void 0 && reading.factsCachedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.hint, children: [
2138
1813
  t("factsCached"),
2139
1814
  " ",
2140
1815
  new Date(reading.factsCachedAt).toISOString().slice(0, 10)
2141
1816
  ] }),
2142
- reading !== void 0 && reading.cached === true && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.hint, children: t("catalogRefreshing") }),
2143
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2144
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-refresh", children: t("refreshLabel") }),
2145
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1817
+ reading !== void 0 && reading.cached === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("catalogRefreshing") }),
1818
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1819
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-refresh", children: t("refreshLabel") }),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2146
1821
  "input",
2147
1822
  {
2148
1823
  id: "dshopencodego-refresh",
@@ -2157,11 +1832,11 @@ function Section({ controller, t, getLocale }) {
2157
1832
  }
2158
1833
  }
2159
1834
  ),
2160
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("refreshHint") })
1835
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("refreshHint") })
2161
1836
  ] }),
2162
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2163
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-keepalive", children: t("keepAliveLabel") }),
2164
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1837
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1838
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-keepalive", children: t("keepAliveLabel") }),
1839
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2165
1840
  "input",
2166
1841
  {
2167
1842
  id: "dshopencodego-keepalive",
@@ -2176,12 +1851,12 @@ function Section({ controller, t, getLocale }) {
2176
1851
  }
2177
1852
  }
2178
1853
  ),
2179
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("keepAliveHint") })
1854
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("keepAliveHint") })
2180
1855
  ] }),
2181
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: t("requestLogTitle") }) }),
2182
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.hint, children: t("requestLogHint") }),
2183
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
2184
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1856
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("requestLogTitle") }) }),
1857
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("requestLogHint") }),
1858
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1859
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2185
1860
  "input",
2186
1861
  {
2187
1862
  type: "checkbox",
@@ -2196,9 +1871,9 @@ function Section({ controller, t, getLocale }) {
2196
1871
  ),
2197
1872
  ` ${t("requestLogEnabled")}`
2198
1873
  ] }) }),
2199
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2200
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
2201
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1874
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1875
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1876
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2202
1877
  "input",
2203
1878
  {
2204
1879
  type: "checkbox",
@@ -2213,11 +1888,11 @@ function Section({ controller, t, getLocale }) {
2213
1888
  ),
2214
1889
  ` ${t("requestLogDebug")}`
2215
1890
  ] }),
2216
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("requestLogDebugHint") })
1891
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("requestLogDebugHint") })
2217
1892
  ] }),
2218
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2219
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-requestlog-max", children: t("requestLogMaxEntries") }),
2220
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1893
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1894
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-requestlog-max", children: t("requestLogMaxEntries") }),
1895
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2221
1896
  "input",
2222
1897
  {
2223
1898
  id: "dshopencodego-requestlog-max",
@@ -2234,14 +1909,14 @@ function Section({ controller, t, getLocale }) {
2234
1909
  }
2235
1910
  }
2236
1911
  ),
2237
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("requestLogMaxEntriesHint") })
1912
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("requestLogMaxEntriesHint") })
2238
1913
  ] }),
2239
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: section_default.button, onClick: () => {
2240
- controller.openRequestLog();
1914
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: section_default.button, onClick: () => {
1915
+ openRequestLog?.();
2241
1916
  }, children: t("requestLogOpen") }) }),
2242
- state.writeFailure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.warn, children: state.writeFailure.kind === "rejected" ? t("writeRejected") : state.writeFailure.message.length === 0 ? t("writeFailed") : `${t("writeFailed")}: ${state.writeFailure.message}` }),
2243
- reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.row, children: [
2244
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1917
+ state.writeFailure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.warn, children: state.writeFailure.kind === "rejected" ? t("writeRejected") : state.writeFailure.message.length === 0 ? t("writeFailed") : `${t("writeFailed")}: ${state.writeFailure.message}` }),
1918
+ reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1919
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2245
1920
  "input",
2246
1921
  {
2247
1922
  className: section_default.input,
@@ -2254,8 +1929,8 @@ function Section({ controller, t, getLocale }) {
2254
1929
  }
2255
1930
  }
2256
1931
  ),
2257
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
2258
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1932
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1933
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2259
1934
  "input",
2260
1935
  {
2261
1936
  type: "checkbox",
@@ -2267,8 +1942,8 @@ function Section({ controller, t, getLocale }) {
2267
1942
  ),
2268
1943
  ` ${t("filterOnlyEnabled")}`
2269
1944
  ] }),
2270
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
2271
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1945
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1946
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2272
1947
  "input",
2273
1948
  {
2274
1949
  type: "checkbox",
@@ -2280,9 +1955,9 @@ function Section({ controller, t, getLocale }) {
2280
1955
  ),
2281
1956
  ` ${t("filterShowDeprecated")}`
2282
1957
  ] }),
2283
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
1958
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
2284
1959
  `${t("sortLabel")} `,
2285
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1960
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2286
1961
  "select",
2287
1962
  {
2288
1963
  className: section_default.select,
@@ -2292,29 +1967,29 @@ function Section({ controller, t, getLocale }) {
2292
1967
  controller.setFilter({ sort: event.target.value });
2293
1968
  },
2294
1969
  children: [
2295
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "default", children: t("sortDefault") }),
2296
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "released", children: t("sortReleased") }),
2297
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "name", children: t("sortName") }),
2298
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "context", children: t("sortContext") }),
2299
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "quota", children: t("sortQuota") }),
2300
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "price", children: t("sortPrice") }),
2301
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "enabled", children: t("sortEnabled") })
1970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "default", children: t("sortDefault") }),
1971
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "released", children: t("sortReleased") }),
1972
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "name", children: t("sortName") }),
1973
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "context", children: t("sortContext") }),
1974
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "quota", children: t("sortQuota") }),
1975
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "price", children: t("sortPrice") }),
1976
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "enabled", children: t("sortEnabled") })
2302
1977
  ]
2303
1978
  }
2304
1979
  )
2305
1980
  ] }),
2306
- hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: section_default.hint, children: [
1981
+ hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: section_default.hint, children: [
2307
1982
  hidden,
2308
1983
  " ",
2309
1984
  t("filterHidden")
2310
1985
  ] })
2311
1986
  ] }),
2312
- reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.list, children: rows.map((model) => {
1987
+ reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.list, children: rows.map((model) => {
2313
1988
  const badge = badgeFor(model, t);
2314
1989
  const modalities = inputModalityLabels(model, t).join(" \xB7 ");
2315
1990
  const offered = isOffered(model, visibility);
2316
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.item, children: [
2317
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1991
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.item, children: [
1992
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2318
1993
  "input",
2319
1994
  {
2320
1995
  type: "checkbox",
@@ -2326,39 +2001,411 @@ function Section({ controller, t, getLocale }) {
2326
2001
  }
2327
2002
  }
2328
2003
  ),
2329
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.itemBody, children: [
2330
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.itemMain, children: [
2331
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.name, children: model.name }),
2332
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.mono, children: model.id }),
2333
- model.releaseDate !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: model.releaseDate }),
2334
- badge.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.badge, children: badge })
2004
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.itemBody, children: [
2005
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.itemMain, children: [
2006
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.name, children: model.name }),
2007
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.mono, children: model.id }),
2008
+ model.releaseDate !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: model.releaseDate }),
2009
+ badge.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.badge, children: badge })
2335
2010
  ] }),
2336
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.itemMeta, children: [
2337
- model.contextWindow !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: `${t("iosContext")} ${model.contextWindow.toLocaleString(getLocale?.())}` }),
2338
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: ioLabel(model, t) }),
2339
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: priceLabel(model) }),
2340
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: quotaLabel(model, t) })
2011
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.itemMeta, children: [
2012
+ model.contextWindow !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: `${t("iosContext")} ${model.contextWindow.toLocaleString(getLocale?.())}` }),
2013
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: ioLabel(model, t) }),
2014
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: priceLabel(model) }),
2015
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: quotaLabel(model, t) })
2341
2016
  ] }),
2342
- modalities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.itemModalities, children: `${t("inputLabel")} ${modalities}` })
2017
+ modalities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.itemModalities, children: `${t("inputLabel")} ${modalities}` })
2343
2018
  ] })
2344
2019
  ] }, model.id);
2345
2020
  }) })
2346
- ] }),
2347
- state.requestLogOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2348
- RequestLogDialog,
2349
- {
2350
- readLog: () => controller.readRequestLog(),
2351
- enabled: state.settings?.requestLogEnabled ?? false,
2352
- t,
2353
- getLocale,
2354
- onClose: () => {
2355
- controller.closeRequestLog();
2356
- }
2021
+ ] })
2022
+ ] });
2023
+ }
2024
+
2025
+ // src/client/RequestLogPage.tsx
2026
+ var import_react2 = require("react");
2027
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
2028
+
2029
+ // plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/request-log.module.css
2030
+ var id2 = "@dan-ai-studio/dshopencodego/request-log.module.css";
2031
+ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]")) {
2032
+ const style = document.createElement("style");
2033
+ style.dataset.plugin = "@dan-ai-studio/dshopencodego";
2034
+ style.dataset.pluginCss = id2;
2035
+ style.textContent = ".Lx7MOq_page{box-sizing:border-box;background:var(--dsw-alias-bg-base);height:100%;min-height:0;color:var(--dsw-alias-label-primary);flex-direction:column;display:flex;overflow:hidden}.Lx7MOq_head{flex-wrap:wrap;flex:none;align-items:center;gap:12px;padding:20px clamp(16px,3vw,32px) 12px;display:flex}.Lx7MOq_headText{min-width:0}.Lx7MOq_title{margin:0;font-size:20px;font-weight:500;line-height:28px}.Lx7MOq_subtitle{color:var(--dsw-alias-label-secondary);margin:4px 0 0;font-size:13px;line-height:20px}.Lx7MOq_headActions{flex:none;align-items:center;gap:8px;margin-left:auto;display:flex}.Lx7MOq_button{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;align-items:center;gap:6px;padding:0 12px;font-size:13px;display:inline-flex}.Lx7MOq_button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.Lx7MOq_button:disabled{cursor:default;opacity:.5}.Lx7MOq_summary{flex-wrap:wrap;flex:none;gap:8px;padding:0 clamp(16px,3vw,32px) 12px;display:flex}.Lx7MOq_card{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);flex-direction:column;gap:2px;min-width:104px;padding:8px 12px;display:flex}.Lx7MOq_cardLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:16px}.Lx7MOq_cardValue{font-variant-numeric:tabular-nums;font-size:16px;font-weight:500;line-height:22px}.Lx7MOq_cardError .Lx7MOq_cardValue{color:var(--dsw-alias-state-error-primary)}.Lx7MOq_cardWarn .Lx7MOq_cardValue{color:var(--dsw-alias-state-warn-primary)}.Lx7MOq_toolbar{flex-wrap:wrap;flex:none;align-items:center;gap:8px 12px;padding:0 clamp(16px,3vw,32px) 12px;display:flex}.Lx7MOq_field{color:var(--dsw-alias-label-secondary);align-items:center;gap:6px;font-size:13px;line-height:20px;display:inline-flex}.Lx7MOq_select,.Lx7MOq_input{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-1);height:28px;color:var(--dsw-alias-label-primary);font:inherit;padding:0 8px;font-size:13px}.Lx7MOq_input{width:160px}.Lx7MOq_inputNumber{width:72px}.Lx7MOq_checkbox{accent-color:var(--dsw-alias-brand-primary)}.Lx7MOq_tableWrap{border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-1);flex:1;min-height:0;margin:0 clamp(16px,3vw,32px);overflow:auto}.Lx7MOq_table{border-collapse:separate;border-spacing:0;width:100%;min-width:940px;font-size:13px;line-height:20px}.Lx7MOq_table th{z-index:1;border-bottom:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-tertiary);text-align:left;white-space:nowrap;padding:8px 10px;font-size:12px;font-weight:500;position:sticky;top:0}.Lx7MOq_table td{border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap;font-variant-numeric:tabular-nums;padding:6px 10px}.Lx7MOq_table tbody tr:last-child td{border-bottom:none}.Lx7MOq_row{cursor:pointer}.Lx7MOq_row:hover td{background:var(--dsw-alias-interactive-bg-hover)}.Lx7MOq_rowOk td:first-child{box-shadow:inset 3px 0 0 var(--dsw-alias-border-l3)}.Lx7MOq_rowSlow td:first-child{box-shadow:inset 3px 0 0 var(--dsw-alias-state-warn-primary)}.Lx7MOq_rowFail td:first-child{box-shadow:inset 3px 0 0 var(--dsw-alias-state-error-primary)}.Lx7MOq_rowFail td:last-child,.Lx7MOq_rowSlow td:last-child{color:var(--dsw-alias-state-error-primary)}.Lx7MOq_group td{border-bottom:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);padding-top:12px;font-weight:500}.Lx7MOq_detail td{border-bottom:1px solid var(--dsw-alias-border-l1);white-space:normal;background:var(--dsw-alias-bg-layer-2);padding:12px 10px 16px}.Lx7MOq_detailGrid{grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:6px 24px;display:grid}.Lx7MOq_detailItem{gap:8px;min-width:0;font-size:13px;line-height:20px;display:flex}.Lx7MOq_detailLabel{color:var(--dsw-alias-label-tertiary);flex:none}.Lx7MOq_detailValue{overflow-wrap:anywhere;min-width:0;color:var(--dsw-alias-label-primary)}.Lx7MOq_mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}.Lx7MOq_empty{text-align:center;color:var(--dsw-alias-label-tertiary);padding:48px 16px}.Lx7MOq_foot{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;flex:none;align-items:center;gap:12px;padding:12px clamp(16px,3vw,32px) 20px;font-size:12px;display:flex}.Lx7MOq_pager{align-items:center;gap:8px;margin-left:auto;display:flex}.Lx7MOq_notice{color:var(--dsw-alias-label-secondary);padding:0 clamp(16px,3vw,32px) 12px;font-size:13px;line-height:20px}.Lx7MOq_noticeError{color:var(--dsw-alias-state-error-primary)}";
2036
+ document.head.appendChild(style);
2037
+ }
2038
+ var request_log_default = { "button": "Lx7MOq_button", "card": "Lx7MOq_card", "cardError": "Lx7MOq_cardError", "cardLabel": "Lx7MOq_cardLabel", "cardValue": "Lx7MOq_cardValue", "cardWarn": "Lx7MOq_cardWarn", "checkbox": "Lx7MOq_checkbox", "detail": "Lx7MOq_detail", "detailGrid": "Lx7MOq_detailGrid", "detailItem": "Lx7MOq_detailItem", "detailLabel": "Lx7MOq_detailLabel", "detailValue": "Lx7MOq_detailValue", "empty": "Lx7MOq_empty", "field": "Lx7MOq_field", "foot": "Lx7MOq_foot", "group": "Lx7MOq_group", "head": "Lx7MOq_head", "headActions": "Lx7MOq_headActions", "headText": "Lx7MOq_headText", "input": "Lx7MOq_input", "inputNumber": "Lx7MOq_inputNumber", "mono": "Lx7MOq_mono", "notice": "Lx7MOq_notice", "noticeError": "Lx7MOq_noticeError", "page": "Lx7MOq_page", "pager": "Lx7MOq_pager", "row": "Lx7MOq_row", "rowFail": "Lx7MOq_rowFail", "rowOk": "Lx7MOq_rowOk", "rowSlow": "Lx7MOq_rowSlow", "select": "Lx7MOq_select", "subtitle": "Lx7MOq_subtitle", "summary": "Lx7MOq_summary", "table": "Lx7MOq_table", "tableWrap": "Lx7MOq_tableWrap", "title": "Lx7MOq_title", "toolbar": "Lx7MOq_toolbar" };
2039
+
2040
+ // src/client/RequestLogPage.tsx
2041
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2042
+ var PAGE_SIZE = 50;
2043
+ function count2(value) {
2044
+ return value === void 0 ? "\u2014" : value.toLocaleString();
2045
+ }
2046
+ function duration(value) {
2047
+ if (value === void 0) return "\u2014";
2048
+ return value < 1e3 ? `${Math.round(value)}ms` : `${(value / 1e3).toFixed(2)}s`;
2049
+ }
2050
+ function rate2(value) {
2051
+ return value === void 0 ? "\u2014" : value.toFixed(1);
2052
+ }
2053
+ function average(values) {
2054
+ if (values.length === 0) return void 0;
2055
+ let sum = 0;
2056
+ for (const value of values) sum += value;
2057
+ return sum / values.length;
2058
+ }
2059
+ function groupKey(entry, groupBy) {
2060
+ switch (groupBy) {
2061
+ case "session":
2062
+ return entry.session === "" ? "\u2014" : entry.session;
2063
+ case "model":
2064
+ return entry.model;
2065
+ case "result":
2066
+ return entry.ok ? "ok" : entry.code ?? "fail";
2067
+ case "none":
2068
+ return void 0;
2069
+ }
2070
+ }
2071
+ function RequestLogPage({ readLog, enabled, t, getLocale, sessionId }) {
2072
+ const [snapshot, setSnapshot] = (0, import_react2.useState)(void 0);
2073
+ const [failure, setFailure] = (0, import_react2.useState)(void 0);
2074
+ const [refreshing, setRefreshing] = (0, import_react2.useState)(false);
2075
+ const [model, setModel] = (0, import_react2.useState)("all");
2076
+ const [result, setResult] = (0, import_react2.useState)("all");
2077
+ const [slowOnly, setSlowOnly] = (0, import_react2.useState)(false);
2078
+ const [slowSeconds, setSlowSeconds] = (0, import_react2.useState)(5);
2079
+ const [sessionQuery, setSessionQuery] = (0, import_react2.useState)("");
2080
+ const [groupBy, setGroupBy] = (0, import_react2.useState)("none");
2081
+ const [page, setPage] = (0, import_react2.useState)(0);
2082
+ const [expanded, setExpanded] = (0, import_react2.useState)(null);
2083
+ const sessionPrefix = sessionId === void 0 ? "" : sessionId.slice(0, 8);
2084
+ const [onlySession, setOnlySession] = (0, import_react2.useState)(sessionPrefix !== "");
2085
+ const load = (0, import_react2.useCallback)(async () => {
2086
+ setRefreshing(true);
2087
+ try {
2088
+ const next = await readLog();
2089
+ setSnapshot(next);
2090
+ setFailure(void 0);
2091
+ } catch (error) {
2092
+ setFailure(error instanceof Error ? error.message : String(error));
2093
+ } finally {
2094
+ setRefreshing(false);
2095
+ }
2096
+ }, [readLog]);
2097
+ (0, import_react2.useEffect)(() => {
2098
+ void load();
2099
+ }, [load]);
2100
+ const models = (0, import_react2.useMemo)(() => {
2101
+ const ids = /* @__PURE__ */ new Set();
2102
+ for (const entry of snapshot?.entries ?? []) ids.add(entry.model);
2103
+ return [...ids].toSorted();
2104
+ }, [snapshot]);
2105
+ const filtered = (0, import_react2.useMemo)(() => {
2106
+ const query = sessionQuery.trim();
2107
+ return (snapshot?.entries ?? []).filter((entry) => {
2108
+ if (model !== "all" && entry.model !== model) return false;
2109
+ if (result === "ok" && !entry.ok) return false;
2110
+ if (result === "fail" && entry.ok) return false;
2111
+ if (slowOnly && (entry.durationMs ?? 0) < Math.max(0, slowSeconds) * 1e3) return false;
2112
+ if (onlySession && sessionPrefix !== "" && !entry.session.startsWith(sessionPrefix)) return false;
2113
+ if (query !== "" && !entry.session.includes(query)) return false;
2114
+ return true;
2115
+ });
2116
+ }, [snapshot, model, result, slowOnly, slowSeconds, sessionQuery, onlySession, sessionPrefix]);
2117
+ const pages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
2118
+ const safePage = Math.min(page, pages - 1);
2119
+ const pageEntries = filtered.slice(safePage * PAGE_SIZE, (safePage + 1) * PAGE_SIZE);
2120
+ const failures = filtered.filter((entry) => !entry.ok).length;
2121
+ const meanLatency = average(filtered.flatMap((entry) => entry.durationMs === void 0 ? [] : [entry.durationMs]));
2122
+ const meanFirstToken = average(filtered.flatMap((entry) => entry.firstTokenMs === void 0 ? [] : [entry.firstTokenMs]));
2123
+ const meanTps = average(filtered.flatMap((entry) => entry.tps === void 0 ? [] : [entry.tps]));
2124
+ const reuse = snapshot !== void 0 && snapshot.totalRecords > 0 ? Math.max(0, Math.min(1, 1 - snapshot.newConnections / snapshot.totalRecords)) : void 0;
2125
+ const rows = () => {
2126
+ const out = [];
2127
+ let lastGroup;
2128
+ for (const entry of pageEntries) {
2129
+ const group = groupKey(entry, groupBy);
2130
+ if (group !== void 0 && group !== lastGroup) {
2131
+ lastGroup = group;
2132
+ out.push(
2133
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { className: request_log_default.group, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { colSpan: 10, children: group }) }, `group-${group}-${entry.seq}`)
2134
+ );
2357
2135
  }
2358
- )
2136
+ const state = !entry.ok ? "rowFail" : entry.tps !== void 0 && entry.tps < 5 ? "rowSlow" : "rowOk";
2137
+ out.push(
2138
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2139
+ "tr",
2140
+ {
2141
+ className: `${request_log_default.row} ${request_log_default[state]}`,
2142
+ onClick: () => {
2143
+ setExpanded(expanded === entry.seq ? null : entry.seq);
2144
+ },
2145
+ children: [
2146
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: new Date(entry.atMs).toLocaleTimeString(getLocale(), { hour12: false }) }),
2147
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: request_log_default.mono, children: entry.model }),
2148
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: request_log_default.mono, children: entry.session === "" ? "\u2014" : entry.session }),
2149
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: count2(entry.inputTokens) }),
2150
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: count2(entry.outputTokens) }),
2151
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: count2(entry.cacheReadTokens) }),
2152
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: rate2(entry.tps) }),
2153
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: duration(entry.firstTokenMs) }),
2154
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: duration(entry.durationMs) }),
2155
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: entry.ok ? entry.status === void 0 ? "\u2713" : String(entry.status) : entry.code ?? "\u2717" })
2156
+ ]
2157
+ },
2158
+ entry.seq
2159
+ )
2160
+ );
2161
+ if (expanded === entry.seq) {
2162
+ out.push(
2163
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { className: request_log_default.detail, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { colSpan: 10, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailGrid, children: [
2164
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2165
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailMethod") }),
2166
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.method })
2167
+ ] }),
2168
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2169
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailUrl") }),
2170
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.url })
2171
+ ] }),
2172
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2173
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailSession") }),
2174
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.session === "" ? "\u2014" : entry.session })
2175
+ ] }),
2176
+ entry.poolKey !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2177
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailPool") }),
2178
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.poolKey })
2179
+ ] }),
2180
+ entry.headers !== void 0 && (entry.headers.session !== void 0 || entry.headers.userAgent !== void 0) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2181
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailUserAgent") }),
2182
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: [entry.headers.session, entry.headers.userAgent].filter((part) => part !== void 0).join(" \xB7 ") })
2183
+ ] }),
2184
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2185
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailShape") }),
2186
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: request_log_default.detailValue, children: [
2187
+ `${entry.shape?.messages ?? 0} ${t("requestLogDetailMessages")}`,
2188
+ entry.shape !== void 0 && entry.shape.tools > 0 && ` \xB7 ${entry.shape.tools} ${t("requestLogDetailTools")}`,
2189
+ entry.shape?.hasImage === true && ` \xB7 ${t("requestLogDetailHasImage")}`
2190
+ ] })
2191
+ ] }),
2192
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2193
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailTokens") }),
2194
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailValue, children: `${count2(entry.inputTokens)} / ${count2(entry.outputTokens)} / ${count2(entry.cacheReadTokens)}` })
2195
+ ] }),
2196
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2197
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogColTps") }),
2198
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailValue, children: rate2(entry.tps) })
2199
+ ] }),
2200
+ !entry.ok && entry.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2201
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailError") }),
2202
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailValue, children: entry.code })
2203
+ ] })
2204
+ ] }) }) }, `detail-${entry.seq}`)
2205
+ );
2206
+ }
2207
+ }
2208
+ return out;
2209
+ };
2210
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.page, children: [
2211
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.head, children: [
2212
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.headText, children: [
2213
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { className: request_log_default.title, children: t("requestLogTitle") }),
2214
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: request_log_default.subtitle, children: t("requestLogPageHint") })
2215
+ ] }),
2216
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: request_log_default.headActions, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { type: "button", className: request_log_default.button, onClick: () => {
2217
+ void load();
2218
+ }, disabled: refreshing, children: [
2219
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 13 }),
2220
+ t("requestLogRefresh")
2221
+ ] }) })
2222
+ ] }),
2223
+ !enabled() && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: request_log_default.notice, children: t("requestLogDisabled") }),
2224
+ failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: `${request_log_default.notice} ${request_log_default.noticeError}`, children: failure }),
2225
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.summary, children: [
2226
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2227
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatRequests") }),
2228
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: filtered.length.toLocaleString(getLocale()) })
2229
+ ] }),
2230
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `${request_log_default.card} ${failures > 0 ? request_log_default.cardError : ""}`, children: [
2231
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatFailures") }),
2232
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: failures.toLocaleString(getLocale()) })
2233
+ ] }),
2234
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2235
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatLatency") }),
2236
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: duration(meanLatency) })
2237
+ ] }),
2238
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2239
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatFirstToken") }),
2240
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: duration(meanFirstToken) })
2241
+ ] }),
2242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatTps") }),
2244
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: rate2(meanTps) })
2245
+ ] }),
2246
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2247
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogReuse") }),
2248
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: reuse === void 0 ? "\u2014" : `${(reuse * 100).toFixed(0)}%` })
2249
+ ] })
2250
+ ] }),
2251
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.toolbar, children: [
2252
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2253
+ t("requestLogFilterModel"),
2254
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2255
+ "select",
2256
+ {
2257
+ className: request_log_default.select,
2258
+ value: model,
2259
+ onChange: (event) => {
2260
+ setModel(event.target.value);
2261
+ setPage(0);
2262
+ },
2263
+ children: [
2264
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "all", children: t("requestLogFilterModelAll") }),
2265
+ models.map((id4) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: id4, children: id4 }, id4))
2266
+ ]
2267
+ }
2268
+ )
2269
+ ] }),
2270
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2271
+ t("requestLogFilterResult"),
2272
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2273
+ "select",
2274
+ {
2275
+ className: request_log_default.select,
2276
+ value: result,
2277
+ onChange: (event) => {
2278
+ setResult(event.target.value);
2279
+ setPage(0);
2280
+ },
2281
+ children: [
2282
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "all", children: t("requestLogResultAll") }),
2283
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "ok", children: t("requestLogResultOk") }),
2284
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "fail", children: t("requestLogResultFail") })
2285
+ ]
2286
+ }
2287
+ )
2288
+ ] }),
2289
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2290
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2291
+ "input",
2292
+ {
2293
+ className: request_log_default.checkbox,
2294
+ type: "checkbox",
2295
+ checked: slowOnly,
2296
+ onChange: (event) => {
2297
+ setSlowOnly(event.target.checked);
2298
+ setPage(0);
2299
+ }
2300
+ }
2301
+ ),
2302
+ t("requestLogSlowOnly"),
2303
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2304
+ "input",
2305
+ {
2306
+ className: `${request_log_default.input} ${request_log_default.inputNumber}`,
2307
+ type: "number",
2308
+ min: 1,
2309
+ value: slowSeconds,
2310
+ disabled: !slowOnly,
2311
+ "aria-label": t("requestLogSlowSeconds"),
2312
+ onChange: (event) => {
2313
+ setSlowSeconds(Number(event.target.value));
2314
+ setPage(0);
2315
+ }
2316
+ }
2317
+ ),
2318
+ t("requestLogSlowSeconds")
2319
+ ] }),
2320
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2321
+ t("requestLogFilterSession"),
2322
+ sessionPrefix !== "" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2323
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2324
+ "input",
2325
+ {
2326
+ className: request_log_default.checkbox,
2327
+ type: "checkbox",
2328
+ checked: onlySession,
2329
+ onChange: (event) => {
2330
+ setOnlySession(event.target.checked);
2331
+ setPage(0);
2332
+ }
2333
+ }
2334
+ ),
2335
+ t("requestLogOnlySession")
2336
+ ] }),
2337
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2338
+ "input",
2339
+ {
2340
+ className: request_log_default.input,
2341
+ type: "search",
2342
+ value: sessionQuery,
2343
+ disabled: onlySession,
2344
+ onChange: (event) => {
2345
+ setSessionQuery(event.target.value);
2346
+ setPage(0);
2347
+ }
2348
+ }
2349
+ )
2350
+ ] }),
2351
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2352
+ t("requestLogGroupBy"),
2353
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2354
+ "select",
2355
+ {
2356
+ className: request_log_default.select,
2357
+ value: groupBy,
2358
+ onChange: (event) => {
2359
+ setGroupBy(event.target.value);
2360
+ setPage(0);
2361
+ },
2362
+ children: [
2363
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "none", children: t("requestLogGroupNone") }),
2364
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "session", children: t("requestLogGroupSession") }),
2365
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "model", children: t("requestLogGroupModel") }),
2366
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "result", children: t("requestLogGroupResult") })
2367
+ ]
2368
+ }
2369
+ )
2370
+ ] })
2371
+ ] }),
2372
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: request_log_default.tableWrap, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: request_log_default.empty, children: t("requestLogEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: request_log_default.table, children: [
2373
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [
2374
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColTime") }),
2375
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColModel") }),
2376
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColSession") }),
2377
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColIn") }),
2378
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColOut") }),
2379
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColCache") }),
2380
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColTps") }),
2381
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColFirstToken") }),
2382
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColLatency") }),
2383
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: t("requestLogColStatus") })
2384
+ ] }) }),
2385
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: rows() })
2386
+ ] }) }),
2387
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.foot, children: [
2388
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: `${filtered.length.toLocaleString(getLocale())} / ${(snapshot?.totalRecords ?? 0).toLocaleString(getLocale())} ${t("requestLogStatRequests")}` }),
2389
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.pager, children: [
2390
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: request_log_default.button, disabled: safePage <= 0, onClick: () => {
2391
+ setPage(safePage - 1);
2392
+ }, children: t("requestLogPagePrev") }),
2393
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: `${safePage + 1} ${t("requestLogPageOf")} ${pages}` }),
2394
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: request_log_default.button, disabled: safePage >= pages - 1, onClick: () => {
2395
+ setPage(safePage + 1);
2396
+ }, children: t("requestLogPageNext") })
2397
+ ] })
2398
+ ] })
2359
2399
  ] });
2360
2400
  }
2361
2401
 
2402
+ // src/client/RequestLogPanelIcon.tsx
2403
+ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
2404
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2405
+ function RequestLogPanelIcon({ size }) {
2406
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.IconDataOutlineRegular, { size });
2407
+ }
2408
+
2362
2409
  // src/client/UsagePill.tsx
2363
2410
  var import_react3 = require("react");
2364
2411
 
@@ -2374,7 +2421,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id3) + "]"
2374
2421
  var pill_default = { "hint": "mMNkkW_hint", "limited": "mMNkkW_limited", "local": "mMNkkW_local", "panel": "mMNkkW_panel", "progress": "mMNkkW_progress", "retry": "mMNkkW_retry", "root": "mMNkkW_root", "row": "mMNkkW_row", "trigger": "mMNkkW_trigger", "warning": "mMNkkW_warning", "window": "mMNkkW_window" };
2375
2422
 
2376
2423
  // src/client/UsagePill.tsx
2377
- var import_jsx_runtime3 = require("react/jsx-runtime");
2424
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2378
2425
  function failureOf(error) {
2379
2426
  if (error !== null && typeof error === "object" && "code" in error && error.code === "dshopencodego/usage-unavailable") {
2380
2427
  const details = error.details;
@@ -2396,7 +2443,7 @@ function formatUSD(value) {
2396
2443
  }
2397
2444
  function UsagePill({ directory, ...rest }) {
2398
2445
  const state = (0, import_react3.useSyncExternalStore)(directory.subscribe, directory.getSnapshot, directory.getSnapshot);
2399
- return state.current?.provider === "opencode-go" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ActiveUsage, { ...rest }) : null;
2446
+ return state.current?.provider === "opencode-go" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActiveUsage, { ...rest }) : null;
2400
2447
  }
2401
2448
  function ActiveUsage({
2402
2449
  readWindows,
@@ -2463,8 +2510,8 @@ function ActiveUsage({
2463
2510
  const label = windows === void 0 ? `Go \xB7 ${failure === void 0 ? "\u2026" : t("usageUnavailable")}` : `Go \xB7 ${t("usageRolling")} ${windows.rolling.percent}% \xB7 ${t("usageWeekly")} ${windows.weekly.percent}%` + (failure === void 0 ? "" : ` \xB7 ${t("usageStale")}`);
2464
2511
  const unpriced = (meter?.models ?? []).filter((entry) => entry.estimatedUSD === void 0);
2465
2512
  const unpricedModels = unpriced.slice(0, MAX_UNPRICED_IDS).map((entry) => entry.model).join(", ") + (unpriced.length > MAX_UNPRICED_IDS ? ` +${unpriced.length - MAX_UNPRICED_IDS}` : "");
2466
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: pill_default.root, ref: root, children: [
2467
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
2513
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: pill_default.root, ref: root, children: [
2514
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2468
2515
  "button",
2469
2516
  {
2470
2517
  type: "button",
@@ -2478,71 +2525,71 @@ function ActiveUsage({
2478
2525
  children: label
2479
2526
  }
2480
2527
  ),
2481
- open && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.panel, role: "dialog", "aria-label": t("usageTitle"), "aria-busy": refreshing, children: [
2482
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: t("usageTitle") }),
2483
- failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.warning, role: "alert", children: [
2484
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: t("usageUnavailable") }) }),
2485
- failure.message.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: failure.message }),
2486
- windows !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: t("usageStale") })
2528
+ open && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.panel, role: "dialog", "aria-label": t("usageTitle"), "aria-busy": refreshing, children: [
2529
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: t("usageTitle") }),
2530
+ failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.warning, role: "alert", children: [
2531
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: t("usageUnavailable") }) }),
2532
+ failure.message.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: failure.message }),
2533
+ windows !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: t("usageStale") })
2487
2534
  ] }),
2488
- windows === void 0 && failure === void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: pill_default.hint, children: t("usageLoading") }),
2489
- windows !== void 0 && [["rolling", "usageRolling"], ["weekly", "usageWeekly"], ["monthly", "usageMonthly"]].map(([key, label2]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.window, children: [
2490
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.row, children: [
2491
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t(label2) }),
2492
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("strong", { children: [
2535
+ windows === void 0 && failure === void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: pill_default.hint, children: t("usageLoading") }),
2536
+ windows !== void 0 && [["rolling", "usageRolling"], ["weekly", "usageWeekly"], ["monthly", "usageMonthly"]].map(([key, label2]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.window, children: [
2537
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2538
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t(label2) }),
2539
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("strong", { children: [
2493
2540
  windows[key].percent,
2494
2541
  "%"
2495
2542
  ] })
2496
2543
  ] }),
2497
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("progress", { className: pill_default.progress, max: 100, value: Math.min(100, windows[key].percent), "aria-label": t(label2) }),
2498
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.hint, children: [
2544
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("progress", { className: pill_default.progress, max: 100, value: Math.min(100, windows[key].percent), "aria-label": t(label2) }),
2545
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.hint, children: [
2499
2546
  t("usageResets"),
2500
2547
  " ",
2501
2548
  new Date(windows[key].resetsAt).toLocaleString(getLocale?.())
2502
2549
  ] }),
2503
- windows[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: pill_default.limited, children: t("usageLimited") })
2550
+ windows[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: pill_default.limited, children: t("usageLimited") })
2504
2551
  ] }, key)),
2505
- meter !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.local, children: [
2506
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: t("usageSinceBoot") }),
2507
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.row, children: [
2508
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("usageCallsUnit") }),
2509
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: meter.totals.calls })
2552
+ meter !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.local, children: [
2553
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: t("usageSinceBoot") }),
2554
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2555
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageCallsUnit") }),
2556
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.calls })
2510
2557
  ] }),
2511
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.row, children: [
2512
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("usageTokensUnit") }),
2513
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: meter.totals.totalTokens.toLocaleString(getLocale?.()) })
2558
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2559
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageTokensUnit") }),
2560
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.totalTokens.toLocaleString(getLocale?.()) })
2514
2561
  ] }),
2515
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.row, children: [
2516
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("usageCached") }),
2517
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: meter.totals.cacheReadTokens.toLocaleString(getLocale?.()) })
2562
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2563
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageCached") }),
2564
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.cacheReadTokens.toLocaleString(getLocale?.()) })
2518
2565
  ] }),
2519
- meter.totals.reasoningTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.row, children: [
2520
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("usageReasoning") }),
2521
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: meter.totals.reasoningTokens.toLocaleString(getLocale?.()) })
2566
+ meter.totals.reasoningTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2567
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageReasoning") }),
2568
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.reasoningTokens.toLocaleString(getLocale?.()) })
2522
2569
  ] }),
2523
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.row, children: [
2524
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("usageSpend") }),
2525
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: meter.totals.estimatedUSD === void 0 ? t("usageUnpriced") : formatUSD(meter.totals.estimatedUSD) })
2570
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2571
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageSpend") }),
2572
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.estimatedUSD === void 0 ? t("usageUnpriced") : formatUSD(meter.totals.estimatedUSD) })
2526
2573
  ] }),
2527
- meter.totals.unpricedTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.hint, children: [
2574
+ meter.totals.unpricedTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.hint, children: [
2528
2575
  t("usageSpendPartial"),
2529
2576
  " ",
2530
2577
  meter.totals.unpricedTokens.toLocaleString(getLocale?.())
2531
2578
  ] }),
2532
- unpriced.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.hint, children: [
2579
+ unpriced.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.hint, children: [
2533
2580
  t("usageUnpricedModels"),
2534
2581
  " ",
2535
2582
  unpricedModels
2536
2583
  ] }),
2537
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: pill_default.hint, children: t("usageSpendHint") }),
2538
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: pill_default.hint, children: t("usageLocalHint") })
2584
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: pill_default.hint, children: t("usageSpendHint") }),
2585
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: pill_default.hint, children: t("usageLocalHint") })
2539
2586
  ] }),
2540
- updatedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: pill_default.hint, children: [
2587
+ updatedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: pill_default.hint, children: [
2541
2588
  t("usageLastUpdated"),
2542
2589
  " ",
2543
2590
  new Date(updatedAt).toLocaleString(getLocale?.())
2544
2591
  ] }),
2545
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: pill_default.retry, disabled: refreshing, onClick: () => {
2592
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: pill_default.retry, disabled: refreshing, onClick: () => {
2546
2593
  void refresh();
2547
2594
  }, children: t(refreshing ? "usageRefreshing" : "usageRetry") })
2548
2595
  ] })
@@ -2551,6 +2598,7 @@ function ActiveUsage({
2551
2598
 
2552
2599
  // src/client/index.ts
2553
2600
  var NS = "settings.dshopencodego";
2601
+ var REQUEST_LOG_PANEL = "dshopencodego-request-log";
2554
2602
  var inject = ["slots", "locale", "remote"];
2555
2603
  function apply(ctx) {
2556
2604
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dshopencodego: copy dictionaries");
@@ -2577,10 +2625,11 @@ function apply(ctx) {
2577
2625
  ctx.inject(["configForms", "remote.opencodeGoCatalog", "remote.opencodeGoUpdate", "remote.opencodeGoNetwork", "remote.opencodeGoRequestLog", "remote.credentials"], (scope) => {
2578
2626
  const forms = scope.get("configForms");
2579
2627
  const pluginManager = {};
2628
+ const profile = forms?.get("dshopencodego");
2580
2629
  const controller = new SectionController({
2581
2630
  remote: scope.remote,
2582
2631
  pluginManager,
2583
- scope: forms?.get("dshopencodego")
2632
+ scope: profile
2584
2633
  });
2585
2634
  scope.inject(["remote.pluginManager"], (managerScope) => {
2586
2635
  pluginManager.current = managerScope.remote.pluginManager;
@@ -2592,6 +2641,47 @@ function apply(ctx) {
2592
2641
  scope.effect(() => () => {
2593
2642
  controller.dispose();
2594
2643
  });
2644
+ const requestLog = {
2645
+ readLog: async () => {
2646
+ const result = await scope.remote.opencodeGoRequestLog.readLog();
2647
+ if (!result.ok) throw result.error;
2648
+ return result.value;
2649
+ },
2650
+ // Read live: the switch on the settings page can change while the log
2651
+ // page sits open, and the page says so rather than pretending.
2652
+ enabled: () => {
2653
+ const value = profile?.getSnapshot().value;
2654
+ if (value === null || typeof value !== "object") return false;
2655
+ return value.requestLogEnabled === true;
2656
+ },
2657
+ t: (key) => translate(key),
2658
+ getLocale: () => scope.locale.getLocale().active
2659
+ };
2660
+ scope.slots.inject("main", function* () {
2661
+ yield scope.slots.register({
2662
+ name: "main",
2663
+ key: REQUEST_LOG_PANEL,
2664
+ locale: NS,
2665
+ inject: () => requestLog
2666
+ }, RequestLogPage);
2667
+ });
2668
+ scope.slots.inject("sidebar.panellist", () => scope.slots.register({
2669
+ name: "sidebar.panellist",
2670
+ id: REQUEST_LOG_PANEL,
2671
+ // After the Host's own panels, which run from 0.
2672
+ order: 100,
2673
+ label: () => translate("requestLogTitle"),
2674
+ locale: NS
2675
+ }, RequestLogPanelIcon));
2676
+ scope.slots.inject("conversation.view", () => scope.slots.register({
2677
+ name: "conversation.view",
2678
+ id: "dshopencodego-request-log",
2679
+ // After the Host's own View (the chat itself), which runs at 0.
2680
+ order: 100,
2681
+ label: () => translate("requestLogTitle"),
2682
+ locale: NS,
2683
+ inject: (sessionId) => ({ ...requestLog, sessionId: String(sessionId) })
2684
+ }, RequestLogPage));
2595
2685
  scope.slots.inject("settings.section", () => scope.slots.register({
2596
2686
  name: "settings.section",
2597
2687
  id: "dshopencodego",
@@ -2604,7 +2694,16 @@ function apply(ctx) {
2604
2694
  inject: () => ({
2605
2695
  controller,
2606
2696
  t: (key) => translate(key),
2607
- getLocale: () => scope.locale.getLocale().active
2697
+ getLocale: () => scope.locale.getLocale().active,
2698
+ // The settings page opens the log in the main column, beside this
2699
+ // page rather than over it. A composition without the layout service
2700
+ // has no main column to select, so the button does nothing there.
2701
+ openRequestLog: () => {
2702
+ try {
2703
+ ctx.layout.selectPanel(REQUEST_LOG_PANEL);
2704
+ } catch {
2705
+ }
2706
+ }
2608
2707
  })
2609
2708
  }, Section));
2610
2709
  });