@dan-ai-studio/dshopencodego 0.1.64 → 0.1.66

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,12 +499,14 @@ 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. Click a column head to sort; the table scrolls and the filters stay put.",
493
503
  requestLogEnabled: "Record requests",
494
504
  requestLogDebug: "Debug detail",
495
- requestLogDebugHint: "Pool events and full session ids. Otherwise sessions are truncated to 8 characters.",
505
+ requestLogDebugHint: "Pool events and the request user agent.",
496
506
  requestLogMaxEntries: "Keep at most (entries)",
497
507
  requestLogMaxEntriesHint: "50 to 500; oldest entries are dropped first. Default 200.",
498
508
  requestLogOpen: "Open request log",
509
+ requestLogOpenFailed: "The request-log page could not be opened. Use the sidebar entry.",
499
510
  requestLogClose: "Close",
500
511
  requestLogRefresh: "Refresh",
501
512
  requestLogEmpty: "No requests recorded. Turn the log on, then make a request.",
@@ -509,6 +520,7 @@ var en = {
509
520
  requestLogSlowOnly: "Slow only",
510
521
  requestLogSlowSeconds: "slower than (seconds)",
511
522
  requestLogFilterSession: "Session contains",
523
+ requestLogOnlySession: "this session only",
512
524
  requestLogGroupBy: "Group by",
513
525
  requestLogGroupNone: "None",
514
526
  requestLogGroupSession: "Session",
@@ -526,7 +538,9 @@ var en = {
526
538
  requestLogColIn: "In",
527
539
  requestLogColOut: "Out",
528
540
  requestLogColCache: "Cached",
541
+ requestLogColCacheRate: "Cache hit",
529
542
  requestLogColLatency: "Latency",
543
+ requestLogColTps: "tok/s",
530
544
  requestLogColFirstToken: "First token",
531
545
  requestLogColStatus: "Status",
532
546
  requestLogDetailRequest: "Request",
@@ -544,6 +558,12 @@ var en = {
544
558
  requestLogDetailMessages: "messages",
545
559
  requestLogDetailTools: "tools",
546
560
  requestLogDetailHasImage: "with images",
561
+ requestLogStatRequests: "Requests",
562
+ requestLogStatFailures: "Failures",
563
+ requestLogStatLatency: "Mean latency",
564
+ requestLogStatFirstToken: "Mean first token",
565
+ requestLogStatTps: "Mean tok/s",
566
+ requestLogStatCacheRate: "Mean cache hit",
547
567
  writeRejected: "The settings write was rejected (the namespace was reloaded) \u2014 try again",
548
568
  writeFailed: "The settings write failed",
549
569
  filterPlaceholder: "Filter by name or id",
@@ -658,12 +678,14 @@ var zh = {
658
678
  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
679
  requestLogTitle: "\u8BF7\u6C42\u65E5\u5FD7",
660
680
  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",
681
+ requestLogPageHint: "\u6BCF\u4E2A\u8BF7\u6C42\u4E00\u884C\u3002\u70B9\u5217\u5934\u53EF\u6392\u5E8F\uFF1B\u8868\u683C\u6EDA\u52A8\uFF0C\u7B5B\u9009\u680F\u56FA\u5B9A\u5728\u4E0A\u65B9\u3002",
661
682
  requestLogEnabled: "\u8BB0\u5F55\u8BF7\u6C42",
662
683
  requestLogDebug: "\u6392\u9519\u8BE6\u60C5",
663
- 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",
684
+ requestLogDebugHint: "\u8FDE\u63A5\u6C60\u4E8B\u4EF6\u4E0E\u8BF7\u6C42 UA\u3002",
664
685
  requestLogMaxEntries: "\u6700\u591A\u4FDD\u7559\uFF08\u6761\uFF09",
665
686
  requestLogMaxEntriesHint: "50\uFF5E500 \u6761\uFF0C\u8D85\u9650\u4E22\u5F03\u6700\u65E7\u7684\u3002\u9ED8\u8BA4 200 \u6761\u3002",
666
687
  requestLogOpen: "\u6253\u5F00\u8BF7\u6C42\u65E5\u5FD7",
688
+ requestLogOpenFailed: "\u6253\u4E0D\u5F00\u8BF7\u6C42\u65E5\u5FD7\u9875\u9762\uFF0C\u8BF7\u4ECE\u4FA7\u8FB9\u680F\u7684\u5165\u53E3\u6253\u5F00\u3002",
667
689
  requestLogClose: "\u5173\u95ED",
668
690
  requestLogRefresh: "\u5237\u65B0",
669
691
  requestLogEmpty: "\u6682\u65E0\u8BB0\u5F55\u3002\u5148\u6253\u5F00\u65E5\u5FD7\u5F00\u5173\uFF0C\u518D\u53D1\u8D77\u4E00\u6B21\u8BF7\u6C42\u3002",
@@ -677,6 +699,7 @@ var zh = {
677
699
  requestLogSlowOnly: "\u53EA\u770B\u6162\u8BF7\u6C42",
678
700
  requestLogSlowSeconds: "\u6162\u4E8E\uFF08\u79D2\uFF09",
679
701
  requestLogFilterSession: "\u4F1A\u8BDD\u5305\u542B",
702
+ requestLogOnlySession: "\u4EC5\u672C\u4F1A\u8BDD",
680
703
  requestLogGroupBy: "\u5206\u7EC4",
681
704
  requestLogGroupNone: "\u4E0D\u5206\u7EC4",
682
705
  requestLogGroupSession: "\u6309\u4F1A\u8BDD",
@@ -694,7 +717,9 @@ var zh = {
694
717
  requestLogColIn: "\u8F93\u5165",
695
718
  requestLogColOut: "\u8F93\u51FA",
696
719
  requestLogColCache: "\u7F13\u5B58",
720
+ requestLogColCacheRate: "\u7F13\u5B58\u547D\u4E2D",
697
721
  requestLogColLatency: "\u8017\u65F6",
722
+ requestLogColTps: "tok/s",
698
723
  requestLogColFirstToken: "\u9996\u5B57",
699
724
  requestLogColStatus: "\u72B6\u6001",
700
725
  requestLogDetailRequest: "\u8BF7\u6C42",
@@ -712,6 +737,12 @@ var zh = {
712
737
  requestLogDetailMessages: "\u6761\u6D88\u606F",
713
738
  requestLogDetailTools: "\u4E2A\u5DE5\u5177",
714
739
  requestLogDetailHasImage: "\u542B\u56FE\u7247",
740
+ requestLogStatRequests: "\u8BF7\u6C42\u6570",
741
+ requestLogStatFailures: "\u5931\u8D25\u6570",
742
+ requestLogStatLatency: "\u5E73\u5747\u8017\u65F6",
743
+ requestLogStatFirstToken: "\u5E73\u5747\u9996\u5B57",
744
+ requestLogStatTps: "\u5E73\u5747 tok/s",
745
+ requestLogStatCacheRate: "\u5E73\u5747\u7F13\u5B58\u547D\u4E2D",
715
746
  writeRejected: "\u8BBE\u7F6E\u5199\u5165\u88AB\u62D2\u7EDD\uFF08\u5DF2\u91CD\u65B0\u8F7D\u5165\uFF09\uFF0C\u8BF7\u91CD\u8BD5",
716
747
  writeFailed: "\u8BBE\u7F6E\u5199\u5165\u5931\u8D25",
717
748
  filterPlaceholder: "\u6309\u540D\u79F0\u6216 ID \u7B5B\u9009",
@@ -786,348 +817,7 @@ var zh = {
786
817
  };
787
818
 
788
819
  // src/client/Section.tsx
789
- var import_react2 = require("react");
790
-
791
- // src/client/RequestLogDialog.tsx
792
820
  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
821
 
1132
822
  // src/update/check.ts
1133
823
  var PACKAGE_NAME = "@dan-ai-studio/dshopencodego";
@@ -1187,18 +877,18 @@ function isIPv6(value) {
1187
877
  const head = groups(halves[0] ?? "");
1188
878
  const tail = halves.length === 2 ? groups(halves[1] ?? "") : [];
1189
879
  const all = [...head, ...tail];
1190
- let count2 = 0;
880
+ let count3 = 0;
1191
881
  for (const [index, group] of all.entries()) {
1192
882
  if (group.includes(".")) {
1193
883
  if (index !== all.length - 1) return false;
1194
884
  if (!isDottedQuad(group)) return false;
1195
- count2 += 2;
885
+ count3 += 2;
1196
886
  continue;
1197
887
  }
1198
888
  if (!/^[0-9a-fA-F]{1,4}$/.test(group)) return false;
1199
- count2 += 1;
889
+ count3 += 1;
1200
890
  }
1201
- return halves.length === 2 ? count2 <= 7 : count2 === 8;
891
+ return halves.length === 2 ? count3 <= 7 : count3 === 8;
1202
892
  }
1203
893
  function isAddress(value) {
1204
894
  const trimmed = value.trim();
@@ -1267,18 +957,18 @@ function inputModalityLabels(model, t) {
1267
957
  }
1268
958
 
1269
959
  // 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) + "]")) {
960
+ var id = "@dan-ai-studio/dshopencodego/section.module.css";
961
+ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")) {
1272
962
  const style = document.createElement("style");
1273
963
  style.dataset.plugin = "@dan-ai-studio/dshopencodego";
1274
- style.dataset.pluginCss = id2;
964
+ style.dataset.pluginCss = id;
1275
965
  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
966
  document.head.appendChild(style);
1277
967
  }
1278
968
  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
969
 
1280
970
  // src/client/Section.tsx
1281
- var import_jsx_runtime2 = require("react/jsx-runtime");
971
+ var import_jsx_runtime = require("react/jsx-runtime");
1282
972
  var API_KEY_REF = "OPENCODE_GO_API_KEY";
1283
973
  var VISIBILITY_WRITE_DELAY_MS = 250;
1284
974
  var INITIAL = {
@@ -1295,8 +985,7 @@ var INITIAL = {
1295
985
  writable: false,
1296
986
  saving: false,
1297
987
  filter: INITIAL_FILTER,
1298
- update: { phase: "idle", status: void 0, message: void 0 },
1299
- requestLogOpen: false
988
+ update: { phase: "idle", status: void 0, message: void 0 }
1300
989
  };
1301
990
  function settingsOf(value) {
1302
991
  if (value === null || typeof value !== "object") return void 0;
@@ -1773,14 +1462,6 @@ var SectionController = class _SectionController {
1773
1462
  () => this.set({ settings: { ...current, requestLogMaxEntries: entries } })
1774
1463
  );
1775
1464
  }
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
1465
  async write(operation, onAccepted) {
1785
1466
  this.set({ saving: true });
1786
1467
  try {
@@ -1824,12 +1505,12 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1824
1505
  if (update.phase === "idle") return null;
1825
1506
  const status = update.status;
1826
1507
  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)(
1508
+ 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: [
1509
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("updateTitle") }),
1510
+ update.phase === "checking" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("updateChecking") }),
1511
+ update.phase === "current" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1512
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: `${t("updateLatest")} ${status?.current ?? ""}`.trim() }),
1513
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1833
1514
  "button",
1834
1515
  {
1835
1516
  type: "button",
@@ -1844,9 +1525,9 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1844
1525
  }
1845
1526
  )
1846
1527
  ] }),
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)(
1528
+ update.phase === "ready" && status?.latest !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1529
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: `${t("updateAvailable")} ${status.latest} (${t("updateCurrent")} ${status.current})` }),
1530
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1850
1531
  "button",
1851
1532
  {
1852
1533
  type: "button",
@@ -1858,8 +1539,8 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1858
1539
  children: t("updateNow")
1859
1540
  }
1860
1541
  ),
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)(
1542
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: section_default.hint, href: notes, target: "_blank", rel: "noreferrer", children: t("updateNotes") }),
1543
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1863
1544
  "button",
1864
1545
  {
1865
1546
  type: "button",
@@ -1874,9 +1555,9 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1874
1555
  }
1875
1556
  )
1876
1557
  ] }),
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)(
1558
+ update.phase === "confirming" && status?.latest !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1559
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: `${t("updateConfirmHint")} ${status.latest}` }),
1560
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1880
1561
  "button",
1881
1562
  {
1882
1563
  type: "button",
@@ -1890,7 +1571,7 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1890
1571
  children: t("updateConfirm")
1891
1572
  }
1892
1573
  ),
1893
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1574
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1894
1575
  "button",
1895
1576
  {
1896
1577
  type: "button",
@@ -1903,15 +1584,15 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1903
1584
  }
1904
1585
  )
1905
1586
  ] }),
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") })
1587
+ update.phase === "updating" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("updateApplying") }),
1588
+ update.phase === "done" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1589
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.ok, children: `${t("updateDone")} ${status?.latest ?? ""}`.trim() }),
1590
+ update.message === "restart-required" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.warn, children: t("updateRestart") })
1910
1591
  ] }),
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)(
1592
+ update.phase === "failed" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1593
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.warn, children: t("updateFailed") }),
1594
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: updateFailureText(update.message, t) }),
1595
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1915
1596
  "button",
1916
1597
  {
1917
1598
  type: "button",
@@ -1943,12 +1624,13 @@ function updateFailureText(message, t) {
1943
1624
  if (message === "pending-builds") return t("updatePendingBuilds");
1944
1625
  return message;
1945
1626
  }
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) => {
1627
+ function Section({ controller, t, getLocale, openRequestLog }) {
1628
+ const state = (0, import_react.useSyncExternalStore)(controller.subscribe, controller.snapshot, controller.snapshot);
1629
+ const [keyDraft, setKeyDraft] = (0, import_react.useState)("");
1630
+ const [pinDraft, setPinDraft] = (0, import_react.useState)("");
1631
+ const [busy, setBusy] = (0, import_react.useState)(false);
1632
+ const [logOpenFailed, setLogOpenFailed] = (0, import_react.useState)(false);
1633
+ const act = (0, import_react.useCallback)(async (operation) => {
1952
1634
  setBusy(true);
1953
1635
  try {
1954
1636
  await operation();
@@ -1956,10 +1638,10 @@ function Section({ controller, t, getLocale }) {
1956
1638
  setBusy(false);
1957
1639
  }
1958
1640
  }, []);
1959
- (0, import_react2.useEffect)(() => {
1641
+ (0, import_react.useEffect)(() => {
1960
1642
  setKeyDraft("");
1961
1643
  }, [state.saved]);
1962
- (0, import_react2.useEffect)(() => {
1644
+ (0, import_react.useEffect)(() => {
1963
1645
  setPinDraft(state.network?.address ?? "");
1964
1646
  }, [state.network?.address]);
1965
1647
  const reading = state.reading;
@@ -1968,18 +1650,18 @@ function Section({ controller, t, getLocale }) {
1968
1650
  const editable = state.writable && state.settings !== void 0;
1969
1651
  const rows = reading === void 0 ? [] : visibleModels(reading.models, state.filter, visibility, getLocale?.());
1970
1652
  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" })
1653
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: section_default.root, children: [
1654
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: section_default.title, children: t("nav") }),
1655
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("intro") }),
1656
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UpdateBanner, { controller, t, busy, act, update: state.update }),
1657
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.block, children: [
1658
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1659
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("keyTitle") }),
1660
+ /* @__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
1661
  ] }),
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)(
1662
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("keyHint") }),
1663
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1664
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1983
1665
  "input",
1984
1666
  {
1985
1667
  className: section_default.input,
@@ -1992,7 +1674,7 @@ function Section({ controller, t, getLocale }) {
1992
1674
  }
1993
1675
  }
1994
1676
  ),
1995
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1677
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1996
1678
  "button",
1997
1679
  {
1998
1680
  type: "button",
@@ -2006,7 +1688,7 @@ function Section({ controller, t, getLocale }) {
2006
1688
  children: state.saved === true ? t("keySaved") : t("keySave")
2007
1689
  }
2008
1690
  ),
2009
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1691
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2010
1692
  "button",
2011
1693
  {
2012
1694
  type: "button",
@@ -2022,16 +1704,16 @@ function Section({ controller, t, getLocale }) {
2022
1704
  )
2023
1705
  ] })
2024
1706
  ] }),
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 })
1707
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.block, children: [
1708
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1709
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("pinTitle") }),
1710
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.mono, children: network?.host ?? "\u2014" }),
1711
+ /* @__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
1712
  ] }),
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)(
1713
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("pinHint") }),
1714
+ state.networkFailure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.warn, children: `${t("pinUnavailable")}: ${state.networkFailure}` }),
1715
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1716
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2035
1717
  "input",
2036
1718
  {
2037
1719
  className: section_default.input,
@@ -2044,7 +1726,7 @@ function Section({ controller, t, getLocale }) {
2044
1726
  }
2045
1727
  }
2046
1728
  ),
2047
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1729
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2048
1730
  "button",
2049
1731
  {
2050
1732
  type: "button",
@@ -2058,7 +1740,7 @@ function Section({ controller, t, getLocale }) {
2058
1740
  children: t("pinSave")
2059
1741
  }
2060
1742
  ),
2061
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1743
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2062
1744
  "button",
2063
1745
  {
2064
1746
  type: "button",
@@ -2073,13 +1755,13 @@ function Section({ controller, t, getLocale }) {
2073
1755
  }
2074
1756
  )
2075
1757
  ] }),
2076
- state.pinInvalid && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.warn, children: t("pinInvalid") })
1758
+ state.pinInvalid && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.warn, children: t("pinInvalid") })
2077
1759
  ] }),
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)(
1760
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.block, children: [
1761
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1762
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("catalogTitle") }),
1763
+ /* @__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")}`) }),
1764
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2083
1765
  "button",
2084
1766
  {
2085
1767
  type: "button",
@@ -2091,7 +1773,7 @@ function Section({ controller, t, getLocale }) {
2091
1773
  children: t("catalogSelectAll")
2092
1774
  }
2093
1775
  ),
2094
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1776
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2095
1777
  "button",
2096
1778
  {
2097
1779
  type: "button",
@@ -2103,7 +1785,7 @@ function Section({ controller, t, getLocale }) {
2103
1785
  children: t("catalogSelectNone")
2104
1786
  }
2105
1787
  ),
2106
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1788
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2107
1789
  "button",
2108
1790
  {
2109
1791
  type: "button",
@@ -2118,31 +1800,31 @@ function Section({ controller, t, getLocale }) {
2118
1800
  }
2119
1801
  )
2120
1802
  ] }),
2121
- state.failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.warn, children: [
1803
+ state.failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.warn, children: [
2122
1804
  t("catalogStale"),
2123
1805
  ": ",
2124
1806
  state.failure
2125
1807
  ] }),
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: [
1808
+ reading !== void 0 && reading.stale && state.failure === void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.warn, children: t("catalogStale") }),
1809
+ reading !== void 0 && reading.degradations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.warn, children: [
2128
1810
  t("catalogDegraded"),
2129
1811
  ": ",
2130
1812
  reading.degradations.map((degradation) => `${t(degradation.source === "metadata" ? "catalogDegradedMetadata" : "catalogDegradedDocument")} \u2014 ${degradation.reason}`).join("; ")
2131
1813
  ] }),
2132
- reading !== void 0 && reading.quotaSource === "seed" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.hint, children: [
1814
+ reading !== void 0 && reading.quotaSource === "seed" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.hint, children: [
2133
1815
  t("quotaSeed"),
2134
1816
  " ",
2135
1817
  SEED_TRANSCRIBED
2136
1818
  ] }),
2137
- reading !== void 0 && reading.factsCachedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.hint, children: [
1819
+ reading !== void 0 && reading.factsCachedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: section_default.hint, children: [
2138
1820
  t("factsCached"),
2139
1821
  " ",
2140
1822
  new Date(reading.factsCachedAt).toISOString().slice(0, 10)
2141
1823
  ] }),
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)(
1824
+ reading !== void 0 && reading.cached === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("catalogRefreshing") }),
1825
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1826
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-refresh", children: t("refreshLabel") }),
1827
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2146
1828
  "input",
2147
1829
  {
2148
1830
  id: "dshopencodego-refresh",
@@ -2157,11 +1839,11 @@ function Section({ controller, t, getLocale }) {
2157
1839
  }
2158
1840
  }
2159
1841
  ),
2160
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("refreshHint") })
1842
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("refreshHint") })
2161
1843
  ] }),
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)(
1844
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1845
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-keepalive", children: t("keepAliveLabel") }),
1846
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2165
1847
  "input",
2166
1848
  {
2167
1849
  id: "dshopencodego-keepalive",
@@ -2176,12 +1858,12 @@ function Section({ controller, t, getLocale }) {
2176
1858
  }
2177
1859
  }
2178
1860
  ),
2179
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("keepAliveHint") })
1861
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("keepAliveHint") })
2180
1862
  ] }),
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)(
1863
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("requestLogTitle") }) }),
1864
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("requestLogHint") }),
1865
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1866
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2185
1867
  "input",
2186
1868
  {
2187
1869
  type: "checkbox",
@@ -2196,9 +1878,9 @@ function Section({ controller, t, getLocale }) {
2196
1878
  ),
2197
1879
  ` ${t("requestLogEnabled")}`
2198
1880
  ] }) }),
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)(
1881
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1882
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1883
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2202
1884
  "input",
2203
1885
  {
2204
1886
  type: "checkbox",
@@ -2213,11 +1895,11 @@ function Section({ controller, t, getLocale }) {
2213
1895
  ),
2214
1896
  ` ${t("requestLogDebug")}`
2215
1897
  ] }),
2216
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("requestLogDebugHint") })
1898
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("requestLogDebugHint") })
2217
1899
  ] }),
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)(
1900
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1901
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: section_default.hint, htmlFor: "dshopencodego-requestlog-max", children: t("requestLogMaxEntries") }),
1902
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2221
1903
  "input",
2222
1904
  {
2223
1905
  id: "dshopencodego-requestlog-max",
@@ -2234,14 +1916,17 @@ function Section({ controller, t, getLocale }) {
2234
1916
  }
2235
1917
  }
2236
1918
  ),
2237
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("requestLogMaxEntriesHint") })
1919
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("requestLogMaxEntriesHint") })
2238
1920
  ] }),
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();
2241
- }, 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)(
1921
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1922
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: section_default.button, onClick: () => {
1923
+ setLogOpenFailed(!(openRequestLog?.() ?? false));
1924
+ }, children: t("requestLogOpen") }),
1925
+ logOpenFailed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.warn, children: t("requestLogOpenFailed") })
1926
+ ] }),
1927
+ 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}` }),
1928
+ reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
1929
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2245
1930
  "input",
2246
1931
  {
2247
1932
  className: section_default.input,
@@ -2254,8 +1939,8 @@ function Section({ controller, t, getLocale }) {
2254
1939
  }
2255
1940
  }
2256
1941
  ),
2257
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
2258
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1942
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1943
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2259
1944
  "input",
2260
1945
  {
2261
1946
  type: "checkbox",
@@ -2267,8 +1952,8 @@ function Section({ controller, t, getLocale }) {
2267
1952
  ),
2268
1953
  ` ${t("filterOnlyEnabled")}`
2269
1954
  ] }),
2270
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
2271
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1955
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
1956
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2272
1957
  "input",
2273
1958
  {
2274
1959
  type: "checkbox",
@@ -2280,9 +1965,9 @@ function Section({ controller, t, getLocale }) {
2280
1965
  ),
2281
1966
  ` ${t("filterShowDeprecated")}`
2282
1967
  ] }),
2283
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
1968
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
2284
1969
  `${t("sortLabel")} `,
2285
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
2286
1971
  "select",
2287
1972
  {
2288
1973
  className: section_default.select,
@@ -2292,29 +1977,29 @@ function Section({ controller, t, getLocale }) {
2292
1977
  controller.setFilter({ sort: event.target.value });
2293
1978
  },
2294
1979
  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") })
1980
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "default", children: t("sortDefault") }),
1981
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "released", children: t("sortReleased") }),
1982
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "name", children: t("sortName") }),
1983
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "context", children: t("sortContext") }),
1984
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "quota", children: t("sortQuota") }),
1985
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "price", children: t("sortPrice") }),
1986
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "enabled", children: t("sortEnabled") })
2302
1987
  ]
2303
1988
  }
2304
1989
  )
2305
1990
  ] }),
2306
- hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: section_default.hint, children: [
1991
+ hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: section_default.hint, children: [
2307
1992
  hidden,
2308
1993
  " ",
2309
1994
  t("filterHidden")
2310
1995
  ] })
2311
1996
  ] }),
2312
- reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.list, children: rows.map((model) => {
1997
+ reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.list, children: rows.map((model) => {
2313
1998
  const badge = badgeFor(model, t);
2314
1999
  const modalities = inputModalityLabels(model, t).join(" \xB7 ");
2315
2000
  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)(
2001
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.item, children: [
2002
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2318
2003
  "input",
2319
2004
  {
2320
2005
  type: "checkbox",
@@ -2326,39 +2011,500 @@ function Section({ controller, t, getLocale }) {
2326
2011
  }
2327
2012
  }
2328
2013
  ),
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 })
2014
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.itemBody, children: [
2015
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.itemMain, children: [
2016
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.name, children: model.name }),
2017
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.mono, children: model.id }),
2018
+ model.releaseDate !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: model.releaseDate }),
2019
+ badge.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.badge, children: badge })
2335
2020
  ] }),
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) })
2021
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.itemMeta, children: [
2022
+ model.contextWindow !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: `${t("iosContext")} ${model.contextWindow.toLocaleString(getLocale?.())}` }),
2023
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: ioLabel(model, t) }),
2024
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: priceLabel(model) }),
2025
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: quotaLabel(model, t) })
2341
2026
  ] }),
2342
- modalities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.itemModalities, children: `${t("inputLabel")} ${modalities}` })
2027
+ modalities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.itemModalities, children: `${t("inputLabel")} ${modalities}` })
2343
2028
  ] })
2344
2029
  ] }, model.id);
2345
2030
  }) })
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
- }
2031
+ ] })
2032
+ ] });
2033
+ }
2034
+
2035
+ // src/client/RequestLogPage.tsx
2036
+ var import_react2 = require("react");
2037
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
2038
+
2039
+ // plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/request-log.module.css
2040
+ var id2 = "@dan-ai-studio/dshopencodego/request-log.module.css";
2041
+ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]")) {
2042
+ const style = document.createElement("style");
2043
+ style.dataset.plugin = "@dan-ai-studio/dshopencodego";
2044
+ style.dataset.pluginCss = id2;
2045
+ 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}.Lx7MOq_pageLoose{height:auto}.Lx7MOq_pageLoose .Lx7MOq_tableWrap{overflow:visible}.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_thSortable{cursor:pointer;user-select:none}.Lx7MOq_thSortable:hover{color:var(--dsw-alias-label-primary)}.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)}";
2046
+ document.head.appendChild(style);
2047
+ }
2048
+ 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", "pageLoose": "Lx7MOq_pageLoose", "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", "thSortable": "Lx7MOq_thSortable", "title": "Lx7MOq_title", "toolbar": "Lx7MOq_toolbar" };
2049
+
2050
+ // src/client/RequestLogPage.tsx
2051
+ var import_jsx_runtime2 = require("react/jsx-runtime");
2052
+ var SORT_DEFAULT_DIR = {
2053
+ atMs: "desc",
2054
+ model: "asc",
2055
+ session: "asc",
2056
+ inputTokens: "desc",
2057
+ outputTokens: "desc",
2058
+ cacheReadTokens: "desc",
2059
+ cacheRate: "desc",
2060
+ tps: "desc",
2061
+ firstTokenMs: "desc",
2062
+ durationMs: "desc",
2063
+ status: "asc"
2064
+ };
2065
+ function sortValue(entry, key) {
2066
+ switch (key) {
2067
+ case "atMs":
2068
+ return entry.atMs;
2069
+ case "model":
2070
+ return entry.model;
2071
+ case "session":
2072
+ return entry.session;
2073
+ case "inputTokens":
2074
+ return entry.inputTokens ?? -1;
2075
+ case "outputTokens":
2076
+ return entry.outputTokens ?? -1;
2077
+ case "cacheReadTokens":
2078
+ return entry.cacheReadTokens ?? -1;
2079
+ case "cacheRate":
2080
+ return cacheRate(entry) ?? -1;
2081
+ case "tps":
2082
+ return entry.tps ?? -1;
2083
+ case "firstTokenMs":
2084
+ return entry.firstTokenMs ?? -1;
2085
+ case "durationMs":
2086
+ return entry.durationMs ?? -1;
2087
+ case "status":
2088
+ return entry.ok ? `ok-${entry.status ?? ""}` : `fail-${entry.code ?? ""}`;
2089
+ }
2090
+ }
2091
+ var PAGE_SIZE = 50;
2092
+ function count2(value) {
2093
+ return value === void 0 ? "\u2014" : value.toLocaleString();
2094
+ }
2095
+ function duration(value) {
2096
+ if (value === void 0) return "\u2014";
2097
+ return value < 1e3 ? `${Math.round(value)}ms` : `${(value / 1e3).toFixed(2)}s`;
2098
+ }
2099
+ function rate2(value) {
2100
+ return value === void 0 ? "\u2014" : value.toFixed(1);
2101
+ }
2102
+ function cacheRate(entry) {
2103
+ if (entry.inputTokens === void 0) return void 0;
2104
+ const cached = entry.cacheReadTokens ?? 0;
2105
+ const total = entry.inputTokens + cached;
2106
+ return total > 0 ? cached / total : void 0;
2107
+ }
2108
+ function percent(value) {
2109
+ return value === void 0 ? "\u2014" : `${(value * 100).toFixed(0)}%`;
2110
+ }
2111
+ function average(values) {
2112
+ if (values.length === 0) return void 0;
2113
+ let sum = 0;
2114
+ for (const value of values) sum += value;
2115
+ return sum / values.length;
2116
+ }
2117
+ function groupKey(entry, groupBy) {
2118
+ switch (groupBy) {
2119
+ case "session":
2120
+ return entry.session === "" ? "\u2014" : entry.session;
2121
+ case "model":
2122
+ return entry.model;
2123
+ case "result":
2124
+ return entry.ok ? "ok" : entry.code ?? "fail";
2125
+ case "none":
2126
+ return void 0;
2127
+ }
2128
+ }
2129
+ function RequestLogPage({ readLog, enabled, t, getLocale, sessionId }) {
2130
+ const [snapshot, setSnapshot] = (0, import_react2.useState)(void 0);
2131
+ const [failure, setFailure] = (0, import_react2.useState)(void 0);
2132
+ const [refreshing, setRefreshing] = (0, import_react2.useState)(false);
2133
+ const [model, setModel] = (0, import_react2.useState)("all");
2134
+ const [result, setResult] = (0, import_react2.useState)("all");
2135
+ const [slowOnly, setSlowOnly] = (0, import_react2.useState)(false);
2136
+ const [slowSeconds, setSlowSeconds] = (0, import_react2.useState)(5);
2137
+ const [sessionQuery, setSessionQuery] = (0, import_react2.useState)("");
2138
+ const [groupBy, setGroupBy] = (0, import_react2.useState)("none");
2139
+ const [page, setPage] = (0, import_react2.useState)(0);
2140
+ const [expanded, setExpanded] = (0, import_react2.useState)(null);
2141
+ const [sortKey, setSortKey] = (0, import_react2.useState)("atMs");
2142
+ const [sortDir, setSortDir] = (0, import_react2.useState)("desc");
2143
+ const [onlySession, setOnlySession] = (0, import_react2.useState)(sessionId !== void 0);
2144
+ const toggleSort = (key) => {
2145
+ if (key === sortKey) {
2146
+ setSortDir(sortDir === "asc" ? "desc" : "asc");
2147
+ } else {
2148
+ setSortKey(key);
2149
+ setSortDir(SORT_DEFAULT_DIR[key]);
2150
+ }
2151
+ setPage(0);
2152
+ setExpanded(null);
2153
+ };
2154
+ const load = (0, import_react2.useCallback)(async () => {
2155
+ setRefreshing(true);
2156
+ try {
2157
+ const next = await readLog();
2158
+ setSnapshot(next);
2159
+ setFailure(void 0);
2160
+ } catch (error) {
2161
+ setFailure(error instanceof Error ? error.message : String(error));
2162
+ } finally {
2163
+ setRefreshing(false);
2164
+ }
2165
+ }, [readLog]);
2166
+ (0, import_react2.useEffect)(() => {
2167
+ void load();
2168
+ }, [load]);
2169
+ const models = (0, import_react2.useMemo)(() => {
2170
+ const ids = /* @__PURE__ */ new Set();
2171
+ for (const entry of snapshot?.entries ?? []) ids.add(entry.model);
2172
+ return [...ids].toSorted();
2173
+ }, [snapshot]);
2174
+ const filtered = (0, import_react2.useMemo)(() => {
2175
+ const query = sessionQuery.trim();
2176
+ return (snapshot?.entries ?? []).filter((entry) => {
2177
+ if (model !== "all" && entry.model !== model) return false;
2178
+ if (result === "ok" && !entry.ok) return false;
2179
+ if (result === "fail" && entry.ok) return false;
2180
+ if (slowOnly && (entry.durationMs ?? 0) < Math.max(0, slowSeconds) * 1e3) return false;
2181
+ if (onlySession && sessionId !== void 0 && entry.session !== sessionId) return false;
2182
+ if (query !== "" && !entry.session.includes(query)) return false;
2183
+ return true;
2184
+ });
2185
+ }, [snapshot, model, result, slowOnly, slowSeconds, sessionQuery, onlySession, sessionId]);
2186
+ const pages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
2187
+ const safePage = Math.min(page, pages - 1);
2188
+ const sorted = (0, import_react2.useMemo)(() => {
2189
+ const next = [...filtered];
2190
+ next.sort((a, b) => {
2191
+ const first = sortValue(a, sortKey);
2192
+ const second = sortValue(b, sortKey);
2193
+ const compared = typeof first === "number" && typeof second === "number" ? first - second : String(first) < String(second) ? -1 : String(first) > String(second) ? 1 : 0;
2194
+ return sortDir === "asc" ? compared : -compared;
2195
+ });
2196
+ return next;
2197
+ }, [filtered, sortKey, sortDir]);
2198
+ const pageEntries = sorted.slice(safePage * PAGE_SIZE, (safePage + 1) * PAGE_SIZE);
2199
+ const failures = filtered.filter((entry) => !entry.ok).length;
2200
+ const meanLatency = average(filtered.flatMap((entry) => entry.durationMs === void 0 ? [] : [entry.durationMs]));
2201
+ const meanFirstToken = average(filtered.flatMap((entry) => entry.firstTokenMs === void 0 ? [] : [entry.firstTokenMs]));
2202
+ const meanTps = average(filtered.flatMap((entry) => entry.tps === void 0 ? [] : [entry.tps]));
2203
+ const meanCacheRate = average(filtered.flatMap((entry) => {
2204
+ const value = cacheRate(entry);
2205
+ return value === void 0 ? [] : [value];
2206
+ }));
2207
+ const reuse = snapshot !== void 0 && snapshot.totalRecords > 0 ? Math.max(0, Math.min(1, 1 - snapshot.newConnections / snapshot.totalRecords)) : void 0;
2208
+ const head = (key, label) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("th", { className: request_log_default.thSortable, onClick: () => {
2209
+ toggleSort(key);
2210
+ }, children: [
2211
+ label,
2212
+ sortKey === key ? sortDir === "asc" ? " \u25B2" : " \u25BC" : ""
2213
+ ] });
2214
+ const rows = () => {
2215
+ const out = [];
2216
+ let lastGroup;
2217
+ for (const entry of pageEntries) {
2218
+ const group = groupKey(entry, groupBy);
2219
+ if (group !== void 0 && group !== lastGroup) {
2220
+ lastGroup = group;
2221
+ out.push(
2222
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { className: request_log_default.group, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { colSpan: 11, children: group }) }, `group-${group}-${entry.seq}`)
2223
+ );
2224
+ }
2225
+ const state = !entry.ok ? "rowFail" : entry.tps !== void 0 && entry.tps < 5 ? "rowSlow" : "rowOk";
2226
+ out.push(
2227
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2228
+ "tr",
2229
+ {
2230
+ className: `${request_log_default.row} ${request_log_default[state]}`,
2231
+ onClick: () => {
2232
+ setExpanded(expanded === entry.seq ? null : entry.seq);
2233
+ },
2234
+ children: [
2235
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: new Date(entry.atMs).toLocaleTimeString(getLocale(), { hour12: false }) }),
2236
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: request_log_default.mono, children: entry.model }),
2237
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: request_log_default.mono, children: entry.session === "" ? "\u2014" : entry.session }),
2238
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: count2(entry.inputTokens) }),
2239
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: count2(entry.outputTokens) }),
2240
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: count2(entry.cacheReadTokens) }),
2241
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: percent(cacheRate(entry)) }),
2242
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: rate2(entry.tps) }),
2243
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: duration(entry.firstTokenMs) }),
2244
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: duration(entry.durationMs) }),
2245
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: entry.ok ? entry.status === void 0 ? "\u2713" : String(entry.status) : entry.code ?? "\u2717" })
2246
+ ]
2247
+ },
2248
+ entry.seq
2249
+ )
2250
+ );
2251
+ if (expanded === entry.seq) {
2252
+ out.push(
2253
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { className: request_log_default.detail, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { colSpan: 11, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailGrid, children: [
2254
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2255
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailMethod") }),
2256
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.method })
2257
+ ] }),
2258
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2259
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailUrl") }),
2260
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.url })
2261
+ ] }),
2262
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2263
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailSession") }),
2264
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.session === "" ? "\u2014" : entry.session })
2265
+ ] }),
2266
+ entry.poolKey !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2267
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailPool") }),
2268
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: `${request_log_default.detailValue} ${request_log_default.mono}`, children: entry.poolKey })
2269
+ ] }),
2270
+ 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: [
2271
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailUserAgent") }),
2272
+ /* @__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 ") })
2273
+ ] }),
2274
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2275
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailShape") }),
2276
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: request_log_default.detailValue, children: [
2277
+ `${entry.shape?.messages ?? 0} ${t("requestLogDetailMessages")}`,
2278
+ entry.shape !== void 0 && entry.shape.tools > 0 && ` \xB7 ${entry.shape.tools} ${t("requestLogDetailTools")}`,
2279
+ entry.shape?.hasImage === true && ` \xB7 ${t("requestLogDetailHasImage")}`
2280
+ ] })
2281
+ ] }),
2282
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2283
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailTokens") }),
2284
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailValue, children: `${count2(entry.inputTokens)} / ${count2(entry.outputTokens)} / ${count2(entry.cacheReadTokens)}` })
2285
+ ] }),
2286
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2287
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogColCacheRate") }),
2288
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailValue, children: percent(cacheRate(entry)) })
2289
+ ] }),
2290
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2291
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogColTps") }),
2292
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailValue, children: rate2(entry.tps) })
2293
+ ] }),
2294
+ !entry.ok && entry.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.detailItem, children: [
2295
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailLabel, children: t("requestLogDetailError") }),
2296
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.detailValue, children: entry.code })
2297
+ ] })
2298
+ ] }) }) }, `detail-${entry.seq}`)
2299
+ );
2357
2300
  }
2358
- )
2301
+ }
2302
+ return out;
2303
+ };
2304
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: sessionId === void 0 ? request_log_default.page : `${request_log_default.page} ${request_log_default.pageLoose}`, children: [
2305
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.head, children: [
2306
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.headText, children: [
2307
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { className: request_log_default.title, children: t("requestLogTitle") }),
2308
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: request_log_default.subtitle, children: t("requestLogPageHint") })
2309
+ ] }),
2310
+ /* @__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: () => {
2311
+ void load();
2312
+ }, disabled: refreshing, children: [
2313
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 13 }),
2314
+ t("requestLogRefresh")
2315
+ ] }) })
2316
+ ] }),
2317
+ !enabled() && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: request_log_default.notice, children: t("requestLogDisabled") }),
2318
+ failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: `${request_log_default.notice} ${request_log_default.noticeError}`, children: failure }),
2319
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.summary, children: [
2320
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2321
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatRequests") }),
2322
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: filtered.length.toLocaleString(getLocale()) })
2323
+ ] }),
2324
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `${request_log_default.card} ${failures > 0 ? request_log_default.cardError : ""}`, children: [
2325
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatFailures") }),
2326
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: failures.toLocaleString(getLocale()) })
2327
+ ] }),
2328
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2329
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatLatency") }),
2330
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: duration(meanLatency) })
2331
+ ] }),
2332
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2333
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatFirstToken") }),
2334
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: duration(meanFirstToken) })
2335
+ ] }),
2336
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2337
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatTps") }),
2338
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: rate2(meanTps) })
2339
+ ] }),
2340
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2341
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogStatCacheRate") }),
2342
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: percent(meanCacheRate) })
2343
+ ] }),
2344
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.card, children: [
2345
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardLabel, children: t("requestLogReuse") }),
2346
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: request_log_default.cardValue, children: reuse === void 0 ? "\u2014" : `${(reuse * 100).toFixed(0)}%` })
2347
+ ] })
2348
+ ] }),
2349
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.toolbar, children: [
2350
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2351
+ t("requestLogFilterModel"),
2352
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2353
+ "select",
2354
+ {
2355
+ className: request_log_default.select,
2356
+ value: model,
2357
+ onChange: (event) => {
2358
+ setModel(event.target.value);
2359
+ setPage(0);
2360
+ },
2361
+ children: [
2362
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "all", children: t("requestLogFilterModelAll") }),
2363
+ models.map((id4) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: id4, children: id4 }, id4))
2364
+ ]
2365
+ }
2366
+ )
2367
+ ] }),
2368
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2369
+ t("requestLogFilterResult"),
2370
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2371
+ "select",
2372
+ {
2373
+ className: request_log_default.select,
2374
+ value: result,
2375
+ onChange: (event) => {
2376
+ setResult(event.target.value);
2377
+ setPage(0);
2378
+ },
2379
+ children: [
2380
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "all", children: t("requestLogResultAll") }),
2381
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "ok", children: t("requestLogResultOk") }),
2382
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "fail", children: t("requestLogResultFail") })
2383
+ ]
2384
+ }
2385
+ )
2386
+ ] }),
2387
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2388
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2389
+ "input",
2390
+ {
2391
+ className: request_log_default.checkbox,
2392
+ type: "checkbox",
2393
+ checked: slowOnly,
2394
+ onChange: (event) => {
2395
+ setSlowOnly(event.target.checked);
2396
+ setPage(0);
2397
+ }
2398
+ }
2399
+ ),
2400
+ t("requestLogSlowOnly"),
2401
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2402
+ "input",
2403
+ {
2404
+ className: `${request_log_default.input} ${request_log_default.inputNumber}`,
2405
+ type: "number",
2406
+ min: 1,
2407
+ value: slowSeconds,
2408
+ disabled: !slowOnly,
2409
+ "aria-label": t("requestLogSlowSeconds"),
2410
+ onChange: (event) => {
2411
+ setSlowSeconds(Number(event.target.value));
2412
+ setPage(0);
2413
+ }
2414
+ }
2415
+ ),
2416
+ t("requestLogSlowSeconds")
2417
+ ] }),
2418
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2419
+ t("requestLogFilterSession"),
2420
+ sessionId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2421
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2422
+ "input",
2423
+ {
2424
+ className: request_log_default.checkbox,
2425
+ type: "checkbox",
2426
+ checked: onlySession,
2427
+ onChange: (event) => {
2428
+ setOnlySession(event.target.checked);
2429
+ setPage(0);
2430
+ }
2431
+ }
2432
+ ),
2433
+ t("requestLogOnlySession")
2434
+ ] }),
2435
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2436
+ "input",
2437
+ {
2438
+ className: request_log_default.input,
2439
+ type: "search",
2440
+ value: sessionQuery,
2441
+ disabled: onlySession,
2442
+ onChange: (event) => {
2443
+ setSessionQuery(event.target.value);
2444
+ setPage(0);
2445
+ }
2446
+ }
2447
+ )
2448
+ ] }),
2449
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: request_log_default.field, children: [
2450
+ t("requestLogGroupBy"),
2451
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2452
+ "select",
2453
+ {
2454
+ className: request_log_default.select,
2455
+ value: groupBy,
2456
+ onChange: (event) => {
2457
+ setGroupBy(event.target.value);
2458
+ setPage(0);
2459
+ },
2460
+ children: [
2461
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "none", children: t("requestLogGroupNone") }),
2462
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "session", children: t("requestLogGroupSession") }),
2463
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "model", children: t("requestLogGroupModel") }),
2464
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "result", children: t("requestLogGroupResult") })
2465
+ ]
2466
+ }
2467
+ )
2468
+ ] })
2469
+ ] }),
2470
+ /* @__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: [
2471
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [
2472
+ head("atMs", t("requestLogColTime")),
2473
+ head("model", t("requestLogColModel")),
2474
+ head("session", t("requestLogColSession")),
2475
+ head("inputTokens", t("requestLogColIn")),
2476
+ head("outputTokens", t("requestLogColOut")),
2477
+ head("cacheReadTokens", t("requestLogColCache")),
2478
+ head("cacheRate", t("requestLogColCacheRate")),
2479
+ head("tps", t("requestLogColTps")),
2480
+ head("firstTokenMs", t("requestLogColFirstToken")),
2481
+ head("durationMs", t("requestLogColLatency")),
2482
+ head("status", t("requestLogColStatus"))
2483
+ ] }) }),
2484
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: rows() })
2485
+ ] }) }),
2486
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.foot, children: [
2487
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: `${filtered.length.toLocaleString(getLocale())} / ${(snapshot?.totalRecords ?? 0).toLocaleString(getLocale())} ${t("requestLogStatRequests")}` }),
2488
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: request_log_default.pager, children: [
2489
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: request_log_default.button, disabled: safePage <= 0, onClick: () => {
2490
+ setPage(safePage - 1);
2491
+ }, children: t("requestLogPagePrev") }),
2492
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: `${safePage + 1} ${t("requestLogPageOf")} ${pages}` }),
2493
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: request_log_default.button, disabled: safePage >= pages - 1, onClick: () => {
2494
+ setPage(safePage + 1);
2495
+ }, children: t("requestLogPageNext") })
2496
+ ] })
2497
+ ] })
2359
2498
  ] });
2360
2499
  }
2361
2500
 
2501
+ // src/client/RequestLogPanelIcon.tsx
2502
+ var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
2503
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2504
+ function RequestLogPanelIcon({ size }) {
2505
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_dsh_client_ui_primitives2.IconDataOutlineRegular, { size });
2506
+ }
2507
+
2362
2508
  // src/client/UsagePill.tsx
2363
2509
  var import_react3 = require("react");
2364
2510
 
@@ -2374,7 +2520,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id3) + "]"
2374
2520
  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
2521
 
2376
2522
  // src/client/UsagePill.tsx
2377
- var import_jsx_runtime3 = require("react/jsx-runtime");
2523
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2378
2524
  function failureOf(error) {
2379
2525
  if (error !== null && typeof error === "object" && "code" in error && error.code === "dshopencodego/usage-unavailable") {
2380
2526
  const details = error.details;
@@ -2396,7 +2542,7 @@ function formatUSD(value) {
2396
2542
  }
2397
2543
  function UsagePill({ directory, ...rest }) {
2398
2544
  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;
2545
+ return state.current?.provider === "opencode-go" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ActiveUsage, { ...rest }) : null;
2400
2546
  }
2401
2547
  function ActiveUsage({
2402
2548
  readWindows,
@@ -2463,8 +2609,8 @@ function ActiveUsage({
2463
2609
  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
2610
  const unpriced = (meter?.models ?? []).filter((entry) => entry.estimatedUSD === void 0);
2465
2611
  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)(
2612
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: pill_default.root, ref: root, children: [
2613
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2468
2614
  "button",
2469
2615
  {
2470
2616
  type: "button",
@@ -2478,71 +2624,71 @@ function ActiveUsage({
2478
2624
  children: label
2479
2625
  }
2480
2626
  ),
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") })
2627
+ open && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.panel, role: "dialog", "aria-label": t("usageTitle"), "aria-busy": refreshing, children: [
2628
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: t("usageTitle") }),
2629
+ failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.warning, role: "alert", children: [
2630
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: t("usageUnavailable") }) }),
2631
+ failure.message.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: failure.message }),
2632
+ windows !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: t("usageStale") })
2487
2633
  ] }),
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: [
2634
+ windows === void 0 && failure === void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: pill_default.hint, children: t("usageLoading") }),
2635
+ windows !== void 0 && [["rolling", "usageRolling"], ["weekly", "usageWeekly"], ["monthly", "usageMonthly"]].map(([key, label2]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.window, children: [
2636
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2637
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t(label2) }),
2638
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("strong", { children: [
2493
2639
  windows[key].percent,
2494
2640
  "%"
2495
2641
  ] })
2496
2642
  ] }),
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: [
2643
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("progress", { className: pill_default.progress, max: 100, value: Math.min(100, windows[key].percent), "aria-label": t(label2) }),
2644
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.hint, children: [
2499
2645
  t("usageResets"),
2500
2646
  " ",
2501
2647
  new Date(windows[key].resetsAt).toLocaleString(getLocale?.())
2502
2648
  ] }),
2503
- windows[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: pill_default.limited, children: t("usageLimited") })
2649
+ windows[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: pill_default.limited, children: t("usageLimited") })
2504
2650
  ] }, 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 })
2651
+ meter !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.local, children: [
2652
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: t("usageSinceBoot") }),
2653
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2654
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageCallsUnit") }),
2655
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.calls })
2510
2656
  ] }),
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?.()) })
2657
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2658
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageTokensUnit") }),
2659
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.totalTokens.toLocaleString(getLocale?.()) })
2514
2660
  ] }),
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?.()) })
2661
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2662
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageCached") }),
2663
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.cacheReadTokens.toLocaleString(getLocale?.()) })
2518
2664
  ] }),
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?.()) })
2665
+ meter.totals.reasoningTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2666
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageReasoning") }),
2667
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.reasoningTokens.toLocaleString(getLocale?.()) })
2522
2668
  ] }),
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) })
2669
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.row, children: [
2670
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("usageSpend") }),
2671
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: meter.totals.estimatedUSD === void 0 ? t("usageUnpriced") : formatUSD(meter.totals.estimatedUSD) })
2526
2672
  ] }),
2527
- meter.totals.unpricedTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.hint, children: [
2673
+ meter.totals.unpricedTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.hint, children: [
2528
2674
  t("usageSpendPartial"),
2529
2675
  " ",
2530
2676
  meter.totals.unpricedTokens.toLocaleString(getLocale?.())
2531
2677
  ] }),
2532
- unpriced.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.hint, children: [
2678
+ unpriced.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: pill_default.hint, children: [
2533
2679
  t("usageUnpricedModels"),
2534
2680
  " ",
2535
2681
  unpricedModels
2536
2682
  ] }),
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") })
2683
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: pill_default.hint, children: t("usageSpendHint") }),
2684
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: pill_default.hint, children: t("usageLocalHint") })
2539
2685
  ] }),
2540
- updatedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: pill_default.hint, children: [
2686
+ updatedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { className: pill_default.hint, children: [
2541
2687
  t("usageLastUpdated"),
2542
2688
  " ",
2543
2689
  new Date(updatedAt).toLocaleString(getLocale?.())
2544
2690
  ] }),
2545
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: pill_default.retry, disabled: refreshing, onClick: () => {
2691
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: pill_default.retry, disabled: refreshing, onClick: () => {
2546
2692
  void refresh();
2547
2693
  }, children: t(refreshing ? "usageRefreshing" : "usageRetry") })
2548
2694
  ] })
@@ -2551,9 +2697,17 @@ function ActiveUsage({
2551
2697
 
2552
2698
  // src/client/index.ts
2553
2699
  var NS = "settings.dshopencodego";
2700
+ var REQUEST_LOG_PANEL = "dshopencodego-request-log";
2554
2701
  var inject = ["slots", "locale", "remote"];
2555
2702
  function apply(ctx) {
2556
2703
  ctx.effect(() => ctx.locale.register(NS, { zh, en }), "dshopencodego: copy dictionaries");
2704
+ const layout = { current: void 0 };
2705
+ ctx.inject(["layout"], (layoutScope) => {
2706
+ layout.current = layoutScope.layout;
2707
+ return () => {
2708
+ layout.current = void 0;
2709
+ };
2710
+ });
2557
2711
  const mounted = ctx.remote.$mount({
2558
2712
  package: usageRemote.package,
2559
2713
  descriptors: [
@@ -2577,10 +2731,11 @@ function apply(ctx) {
2577
2731
  ctx.inject(["configForms", "remote.opencodeGoCatalog", "remote.opencodeGoUpdate", "remote.opencodeGoNetwork", "remote.opencodeGoRequestLog", "remote.credentials"], (scope) => {
2578
2732
  const forms = scope.get("configForms");
2579
2733
  const pluginManager = {};
2734
+ const profile = forms?.get("dshopencodego");
2580
2735
  const controller = new SectionController({
2581
2736
  remote: scope.remote,
2582
2737
  pluginManager,
2583
- scope: forms?.get("dshopencodego")
2738
+ scope: profile
2584
2739
  });
2585
2740
  scope.inject(["remote.pluginManager"], (managerScope) => {
2586
2741
  pluginManager.current = managerScope.remote.pluginManager;
@@ -2592,6 +2747,47 @@ function apply(ctx) {
2592
2747
  scope.effect(() => () => {
2593
2748
  controller.dispose();
2594
2749
  });
2750
+ const requestLog = {
2751
+ readLog: async () => {
2752
+ const result = await scope.remote.opencodeGoRequestLog.readLog();
2753
+ if (!result.ok) throw result.error;
2754
+ return result.value;
2755
+ },
2756
+ // Read live: the switch on the settings page can change while the log
2757
+ // page sits open, and the page says so rather than pretending.
2758
+ enabled: () => {
2759
+ const value = profile?.getSnapshot().value;
2760
+ if (value === null || typeof value !== "object") return false;
2761
+ return value.requestLogEnabled === true;
2762
+ },
2763
+ t: (key) => translate(key),
2764
+ getLocale: () => scope.locale.getLocale().active
2765
+ };
2766
+ scope.slots.inject("main", function* () {
2767
+ yield scope.slots.register({
2768
+ name: "main",
2769
+ key: REQUEST_LOG_PANEL,
2770
+ locale: NS,
2771
+ inject: () => requestLog
2772
+ }, RequestLogPage);
2773
+ });
2774
+ scope.slots.inject("sidebar.panellist", () => scope.slots.register({
2775
+ name: "sidebar.panellist",
2776
+ id: REQUEST_LOG_PANEL,
2777
+ // After the Host's own panels, which run from 0.
2778
+ order: 100,
2779
+ label: () => translate("requestLogTitle"),
2780
+ locale: NS
2781
+ }, RequestLogPanelIcon));
2782
+ scope.slots.inject("conversation.view", () => scope.slots.register({
2783
+ name: "conversation.view",
2784
+ id: "dshopencodego-request-log",
2785
+ // After the Host's own View (the chat itself), which runs at 0.
2786
+ order: 100,
2787
+ label: () => translate("requestLogTitle"),
2788
+ locale: NS,
2789
+ inject: (sessionId) => ({ ...requestLog, sessionId: String(sessionId) })
2790
+ }, RequestLogPage));
2595
2791
  scope.slots.inject("settings.section", () => scope.slots.register({
2596
2792
  name: "settings.section",
2597
2793
  id: "dshopencodego",
@@ -2604,11 +2800,20 @@ function apply(ctx) {
2604
2800
  inject: () => ({
2605
2801
  controller,
2606
2802
  t: (key) => translate(key),
2607
- getLocale: () => scope.locale.getLocale().active
2803
+ getLocale: () => scope.locale.getLocale().active,
2804
+ // The settings page opens the log in the main column, beside this
2805
+ // page rather than over it. It reports whether it worked: a button
2806
+ // that silently does nothing is worse than one that says why.
2807
+ openRequestLog: () => {
2808
+ const service = layout.current;
2809
+ if (service === void 0) return false;
2810
+ service.selectPanel(REQUEST_LOG_PANEL);
2811
+ return true;
2812
+ }
2608
2813
  })
2609
2814
  }, Section));
2610
2815
  });
2611
- ctx.inject(["modelDirectories", "remote.opencodeGoUsage"], (scope) => {
2816
+ ctx.inject(["modelDirectories", "remote.opencodeGoUsage", "remote.session"], (scope) => {
2612
2817
  const translate = scope.locale.bind(NS);
2613
2818
  scope.slots.inject("conversation.input.right", () => scope.slots.register({
2614
2819
  name: "conversation.input.right",