@dan-ai-studio/dshopencodego 0.1.63 → 0.1.64
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/README.en.md +10 -2
- package/README.md +10 -2
- package/lib/client.js +901 -199
- package/lib/index.js +465 -124
- package/lib/types/adapter.d.ts +7 -0
- package/lib/types/config.d.ts +19 -0
- package/lib/types/network/pinning.d.ts +15 -0
- package/lib/types/request-log/contract.d.ts +23 -0
- package/lib/types/request-log/index.d.ts +10 -0
- package/lib/types/request-log/limits.d.ts +15 -0
- package/lib/types/request-log/service.d.ts +26 -0
- package/lib/types/request-log/store.d.ts +194 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -115,7 +115,7 @@ function parseCatalogReading(value) {
|
|
|
115
115
|
throw new Error("invalid catalog reading");
|
|
116
116
|
}
|
|
117
117
|
const numbers = counts;
|
|
118
|
-
const
|
|
118
|
+
const count2 = (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:
|
|
138
|
-
enabled:
|
|
139
|
-
deprecated:
|
|
140
|
-
unconfigured:
|
|
141
|
-
inferred:
|
|
137
|
+
total: count2("total"),
|
|
138
|
+
enabled: count2("enabled"),
|
|
139
|
+
deprecated: count2("deprecated"),
|
|
140
|
+
unconfigured: count2("unconfigured"),
|
|
141
|
+
inferred: count2("inferred")
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
144
|
}
|
|
@@ -207,6 +207,106 @@ var networkRemote = {
|
|
|
207
207
|
]
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
+
// src/request-log/contract.ts
|
|
211
|
+
function count(key, row, optional) {
|
|
212
|
+
const entry = row[key];
|
|
213
|
+
if (entry === void 0) {
|
|
214
|
+
if (optional === true) return void 0;
|
|
215
|
+
throw new Error(`invalid request-log entry "${key}"`);
|
|
216
|
+
}
|
|
217
|
+
if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) {
|
|
218
|
+
throw new Error(`invalid request-log entry "${key}"`);
|
|
219
|
+
}
|
|
220
|
+
return entry;
|
|
221
|
+
}
|
|
222
|
+
function text(key, row, optional) {
|
|
223
|
+
const entry = row[key];
|
|
224
|
+
if (entry === void 0) {
|
|
225
|
+
if (optional === true) return void 0;
|
|
226
|
+
throw new Error(`invalid request-log entry "${key}"`);
|
|
227
|
+
}
|
|
228
|
+
if (typeof entry !== "string") throw new Error(`invalid request-log entry "${key}"`);
|
|
229
|
+
return entry;
|
|
230
|
+
}
|
|
231
|
+
function parseEntry(value) {
|
|
232
|
+
if (value === null || typeof value !== "object") throw new Error("invalid request-log entry");
|
|
233
|
+
const row = value;
|
|
234
|
+
const shape = row["shape"];
|
|
235
|
+
const headers = row["headers"];
|
|
236
|
+
return {
|
|
237
|
+
seq: count("seq", row),
|
|
238
|
+
atMs: count("atMs", row),
|
|
239
|
+
model: text("model", row),
|
|
240
|
+
session: text("session", row),
|
|
241
|
+
method: text("method", row),
|
|
242
|
+
url: text("url", row),
|
|
243
|
+
...row["status"] === void 0 ? {} : { status: count("status", row) },
|
|
244
|
+
...row["inputTokens"] === void 0 ? {} : { inputTokens: count("inputTokens", row) },
|
|
245
|
+
...row["outputTokens"] === void 0 ? {} : { outputTokens: count("outputTokens", row) },
|
|
246
|
+
...row["cacheReadTokens"] === void 0 ? {} : { cacheReadTokens: count("cacheReadTokens", row) },
|
|
247
|
+
...row["durationMs"] === void 0 ? {} : { durationMs: count("durationMs", row) },
|
|
248
|
+
...row["firstTokenMs"] === void 0 ? {} : { firstTokenMs: count("firstTokenMs", row) },
|
|
249
|
+
ok: row["ok"] === true,
|
|
250
|
+
...typeof row["code"] === "string" ? { code: row["code"] } : {},
|
|
251
|
+
...typeof row["poolKey"] === "string" ? { poolKey: row["poolKey"] } : {},
|
|
252
|
+
...shape !== null && typeof shape === "object" ? {
|
|
253
|
+
shape: {
|
|
254
|
+
messages: count("messages", shape),
|
|
255
|
+
hasImage: shape["hasImage"] === true,
|
|
256
|
+
tools: count("tools", shape)
|
|
257
|
+
}
|
|
258
|
+
} : {},
|
|
259
|
+
...headers !== null && typeof headers === "object" ? {
|
|
260
|
+
headers: {
|
|
261
|
+
...typeof headers["session"] === "string" ? { session: headers["session"] } : {},
|
|
262
|
+
...typeof headers["userAgent"] === "string" ? { userAgent: headers["userAgent"] } : {}
|
|
263
|
+
}
|
|
264
|
+
} : {}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function parsePoolEvent(value) {
|
|
268
|
+
if (value === null || typeof value !== "object") throw new Error("invalid request-log pool event");
|
|
269
|
+
const row = value;
|
|
270
|
+
const type = row["type"];
|
|
271
|
+
if (type !== "create" && type !== "close") throw new Error("invalid request-log pool event");
|
|
272
|
+
return { atMs: count("atMs", row), type, key: text("key", row) };
|
|
273
|
+
}
|
|
274
|
+
function parseRequestLogSnapshot(value) {
|
|
275
|
+
if (value === null || typeof value !== "object") throw new Error("invalid request-log snapshot");
|
|
276
|
+
const row = value;
|
|
277
|
+
if (!Array.isArray(row["entries"]) || !Array.isArray(row["poolEvents"])) {
|
|
278
|
+
throw new Error("invalid request-log snapshot");
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
entries: row["entries"].map(parseEntry),
|
|
282
|
+
poolEvents: row["poolEvents"].map(parsePoolEvent),
|
|
283
|
+
totalRecords: count("totalRecords", row),
|
|
284
|
+
droppedRecords: count("droppedRecords", row),
|
|
285
|
+
newConnections: count("newConnections", row),
|
|
286
|
+
...typeof row["poolKey"] === "string" ? { poolKey: row["poolKey"] } : {}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
var codec3 = {
|
|
290
|
+
mode: "strict",
|
|
291
|
+
typeSymbol: "@dan-ai-studio/dshopencodego#RequestLogSnapshot",
|
|
292
|
+
schema: { parse: parseRequestLogSnapshot },
|
|
293
|
+
create: () => ({ parse: parseRequestLogSnapshot })
|
|
294
|
+
};
|
|
295
|
+
var requestLogRemote = {
|
|
296
|
+
package: "@dan-ai-studio/dshopencodego",
|
|
297
|
+
descriptors: [
|
|
298
|
+
{
|
|
299
|
+
id: "@dan-ai-studio/dshopencodego#opencodeGoRequestLog/readLog",
|
|
300
|
+
service: "opencodeGoRequestLog",
|
|
301
|
+
namespace: "opencodeGoRequestLog",
|
|
302
|
+
method: "readLog",
|
|
303
|
+
invocation: { kind: "direct" },
|
|
304
|
+
parameters: [],
|
|
305
|
+
result: codec3
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
};
|
|
309
|
+
|
|
210
310
|
// src/update/contract.ts
|
|
211
311
|
function parseUpdateStatus(value) {
|
|
212
312
|
if (value === null || typeof value !== "object") throw new Error("invalid update reading");
|
|
@@ -226,7 +326,7 @@ function parseUpdateStatus(value) {
|
|
|
226
326
|
checked: row["checked"]
|
|
227
327
|
};
|
|
228
328
|
}
|
|
229
|
-
var
|
|
329
|
+
var codec4 = (typeSymbol, parse) => ({
|
|
230
330
|
mode: "strict",
|
|
231
331
|
typeSymbol,
|
|
232
332
|
schema: { parse },
|
|
@@ -242,7 +342,7 @@ var updateRemote = {
|
|
|
242
342
|
method: "readUpdate",
|
|
243
343
|
invocation: { kind: "direct" },
|
|
244
344
|
parameters: [],
|
|
245
|
-
result:
|
|
345
|
+
result: codec4("@dan-ai-studio/dshopencodego#UpdateStatus", parseUpdateStatus)
|
|
246
346
|
},
|
|
247
347
|
{
|
|
248
348
|
id: "@dan-ai-studio/dshopencodego#opencodeGoUpdate/refreshUpdate",
|
|
@@ -251,7 +351,7 @@ var updateRemote = {
|
|
|
251
351
|
method: "refreshUpdate",
|
|
252
352
|
invocation: { kind: "direct" },
|
|
253
353
|
parameters: [],
|
|
254
|
-
result:
|
|
354
|
+
result: codec4("@dan-ai-studio/dshopencodego#UpdateStatus", parseUpdateStatus)
|
|
255
355
|
}
|
|
256
356
|
]
|
|
257
357
|
};
|
|
@@ -278,22 +378,22 @@ function parseUsageWindows(value) {
|
|
|
278
378
|
function parseTotals(value) {
|
|
279
379
|
if (value === null || typeof value !== "object") throw new Error("invalid meter totals");
|
|
280
380
|
const row = value;
|
|
281
|
-
const
|
|
381
|
+
const count2 = (key) => {
|
|
282
382
|
const entry = row[key];
|
|
283
383
|
if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) throw new Error(`invalid meter field "${key}"`);
|
|
284
384
|
return entry;
|
|
285
385
|
};
|
|
286
|
-
const optionalCount = (key) => row[key] === void 0 ? void 0 :
|
|
386
|
+
const optionalCount = (key) => row[key] === void 0 ? void 0 : count2(key);
|
|
287
387
|
const reasoningTokens = optionalCount("reasoningTokens");
|
|
288
388
|
const estimatedUSD = optionalCount("estimatedUSD");
|
|
289
389
|
const unpricedTokens = optionalCount("unpricedTokens");
|
|
290
390
|
return {
|
|
291
|
-
calls:
|
|
292
|
-
inputTokens:
|
|
293
|
-
outputTokens:
|
|
294
|
-
cacheReadTokens:
|
|
295
|
-
cacheWriteTokens:
|
|
296
|
-
totalTokens:
|
|
391
|
+
calls: count2("calls"),
|
|
392
|
+
inputTokens: count2("inputTokens"),
|
|
393
|
+
outputTokens: count2("outputTokens"),
|
|
394
|
+
cacheReadTokens: count2("cacheReadTokens"),
|
|
395
|
+
cacheWriteTokens: count2("cacheWriteTokens"),
|
|
396
|
+
totalTokens: count2("totalTokens"),
|
|
297
397
|
...reasoningTokens === void 0 ? {} : { reasoningTokens },
|
|
298
398
|
...estimatedUSD === void 0 ? {} : { estimatedUSD },
|
|
299
399
|
...unpricedTokens === void 0 ? {} : { unpricedTokens }
|
|
@@ -317,7 +417,7 @@ function parseGoMeter(value) {
|
|
|
317
417
|
})
|
|
318
418
|
};
|
|
319
419
|
}
|
|
320
|
-
var
|
|
420
|
+
var codec5 = (typeSymbol, parse) => ({
|
|
321
421
|
mode: "strict",
|
|
322
422
|
typeSymbol,
|
|
323
423
|
schema: { parse },
|
|
@@ -333,7 +433,7 @@ var usageRemote = {
|
|
|
333
433
|
method: "readWindows",
|
|
334
434
|
invocation: { kind: "direct" },
|
|
335
435
|
parameters: [],
|
|
336
|
-
result:
|
|
436
|
+
result: codec5("@dan-ai-studio/dshopencodego#GoUsageWindows", parseUsageWindows)
|
|
337
437
|
},
|
|
338
438
|
{
|
|
339
439
|
id: "@dan-ai-studio/dshopencodego#opencodeGoUsage/readMeter",
|
|
@@ -342,7 +442,7 @@ var usageRemote = {
|
|
|
342
442
|
method: "readMeter",
|
|
343
443
|
invocation: { kind: "direct" },
|
|
344
444
|
parameters: [],
|
|
345
|
-
result:
|
|
445
|
+
result: codec5("@dan-ai-studio/dshopencodego#GoMeter", parseGoMeter)
|
|
346
446
|
}
|
|
347
447
|
]
|
|
348
448
|
};
|
|
@@ -388,6 +488,62 @@ var en = {
|
|
|
388
488
|
refreshHint: "How long requests and the model picker reuse one listing.",
|
|
389
489
|
keepAliveLabel: "Connection kept idle (seconds)",
|
|
390
490
|
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
|
+
requestLogTitle: "Request log",
|
|
492
|
+
requestLogHint: "Per-request records for troubleshooting. Off by default; enabling it does not change what requests do.",
|
|
493
|
+
requestLogEnabled: "Record requests",
|
|
494
|
+
requestLogDebug: "Debug detail",
|
|
495
|
+
requestLogDebugHint: "Pool events and full session ids. Otherwise sessions are truncated to 8 characters.",
|
|
496
|
+
requestLogMaxEntries: "Keep at most (entries)",
|
|
497
|
+
requestLogMaxEntriesHint: "50 to 500; oldest entries are dropped first. Default 200.",
|
|
498
|
+
requestLogOpen: "Open request log",
|
|
499
|
+
requestLogClose: "Close",
|
|
500
|
+
requestLogRefresh: "Refresh",
|
|
501
|
+
requestLogEmpty: "No requests recorded. Turn the log on, then make a request.",
|
|
502
|
+
requestLogDisabled: "The request log is off.",
|
|
503
|
+
requestLogFilterModel: "Model",
|
|
504
|
+
requestLogFilterModelAll: "All models",
|
|
505
|
+
requestLogFilterResult: "Result",
|
|
506
|
+
requestLogResultAll: "All",
|
|
507
|
+
requestLogResultOk: "Succeeded",
|
|
508
|
+
requestLogResultFail: "Failed",
|
|
509
|
+
requestLogSlowOnly: "Slow only",
|
|
510
|
+
requestLogSlowSeconds: "slower than (seconds)",
|
|
511
|
+
requestLogFilterSession: "Session contains",
|
|
512
|
+
requestLogGroupBy: "Group by",
|
|
513
|
+
requestLogGroupNone: "None",
|
|
514
|
+
requestLogGroupSession: "Session",
|
|
515
|
+
requestLogGroupModel: "Model",
|
|
516
|
+
requestLogGroupResult: "Result",
|
|
517
|
+
requestLogPagePrev: "Previous",
|
|
518
|
+
requestLogPageNext: "Next",
|
|
519
|
+
requestLogPageOf: "of",
|
|
520
|
+
requestLogReuse: "Connection reuse",
|
|
521
|
+
requestLogReuseHint: "Share of recorded requests that reused a kept-alive connection, estimated from new sockets vs recorded requests.",
|
|
522
|
+
requestLogDropped: "dropped",
|
|
523
|
+
requestLogColTime: "Time",
|
|
524
|
+
requestLogColModel: "Model",
|
|
525
|
+
requestLogColSession: "Session",
|
|
526
|
+
requestLogColIn: "In",
|
|
527
|
+
requestLogColOut: "Out",
|
|
528
|
+
requestLogColCache: "Cached",
|
|
529
|
+
requestLogColLatency: "Latency",
|
|
530
|
+
requestLogColFirstToken: "First token",
|
|
531
|
+
requestLogColStatus: "Status",
|
|
532
|
+
requestLogDetailRequest: "Request",
|
|
533
|
+
requestLogDetailTiming: "Timing",
|
|
534
|
+
requestLogDetailResult: "Result",
|
|
535
|
+
requestLogDetailMethod: "Method",
|
|
536
|
+
requestLogDetailUrl: "URL",
|
|
537
|
+
requestLogDetailSession: "Session",
|
|
538
|
+
requestLogDetailPool: "Pool",
|
|
539
|
+
requestLogDetailError: "Error",
|
|
540
|
+
requestLogDetailTokens: "Tokens",
|
|
541
|
+
requestLogDetailHeaders: "Headers",
|
|
542
|
+
requestLogDetailUserAgent: "User-Agent",
|
|
543
|
+
requestLogDetailShape: "Shape",
|
|
544
|
+
requestLogDetailMessages: "messages",
|
|
545
|
+
requestLogDetailTools: "tools",
|
|
546
|
+
requestLogDetailHasImage: "with images",
|
|
391
547
|
writeRejected: "The settings write was rejected (the namespace was reloaded) \u2014 try again",
|
|
392
548
|
writeFailed: "The settings write failed",
|
|
393
549
|
filterPlaceholder: "Filter by name or id",
|
|
@@ -500,6 +656,62 @@ var zh = {
|
|
|
500
656
|
refreshHint: "\u8BF7\u6C42\u4E0E\u6A21\u578B\u9009\u62E9\u5668\u590D\u7528\u540C\u4E00\u4EFD\u5217\u8868\u7684\u65F6\u957F\u3002",
|
|
501
657
|
keepAliveLabel: "\u8FDE\u63A5\u7A7A\u95F2\u4FDD\u7559\uFF08\u79D2\uFF09",
|
|
502
658
|
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
|
+
requestLogTitle: "\u8BF7\u6C42\u65E5\u5FD7",
|
|
660
|
+
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",
|
|
661
|
+
requestLogEnabled: "\u8BB0\u5F55\u8BF7\u6C42",
|
|
662
|
+
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",
|
|
664
|
+
requestLogMaxEntries: "\u6700\u591A\u4FDD\u7559\uFF08\u6761\uFF09",
|
|
665
|
+
requestLogMaxEntriesHint: "50\uFF5E500 \u6761\uFF0C\u8D85\u9650\u4E22\u5F03\u6700\u65E7\u7684\u3002\u9ED8\u8BA4 200 \u6761\u3002",
|
|
666
|
+
requestLogOpen: "\u6253\u5F00\u8BF7\u6C42\u65E5\u5FD7",
|
|
667
|
+
requestLogClose: "\u5173\u95ED",
|
|
668
|
+
requestLogRefresh: "\u5237\u65B0",
|
|
669
|
+
requestLogEmpty: "\u6682\u65E0\u8BB0\u5F55\u3002\u5148\u6253\u5F00\u65E5\u5FD7\u5F00\u5173\uFF0C\u518D\u53D1\u8D77\u4E00\u6B21\u8BF7\u6C42\u3002",
|
|
670
|
+
requestLogDisabled: "\u8BF7\u6C42\u65E5\u5FD7\u672A\u5F00\u542F\u3002",
|
|
671
|
+
requestLogFilterModel: "\u6A21\u578B",
|
|
672
|
+
requestLogFilterModelAll: "\u5168\u90E8\u6A21\u578B",
|
|
673
|
+
requestLogFilterResult: "\u7ED3\u679C",
|
|
674
|
+
requestLogResultAll: "\u5168\u90E8",
|
|
675
|
+
requestLogResultOk: "\u6210\u529F",
|
|
676
|
+
requestLogResultFail: "\u5931\u8D25",
|
|
677
|
+
requestLogSlowOnly: "\u53EA\u770B\u6162\u8BF7\u6C42",
|
|
678
|
+
requestLogSlowSeconds: "\u6162\u4E8E\uFF08\u79D2\uFF09",
|
|
679
|
+
requestLogFilterSession: "\u4F1A\u8BDD\u5305\u542B",
|
|
680
|
+
requestLogGroupBy: "\u5206\u7EC4",
|
|
681
|
+
requestLogGroupNone: "\u4E0D\u5206\u7EC4",
|
|
682
|
+
requestLogGroupSession: "\u6309\u4F1A\u8BDD",
|
|
683
|
+
requestLogGroupModel: "\u6309\u6A21\u578B",
|
|
684
|
+
requestLogGroupResult: "\u6309\u7ED3\u679C",
|
|
685
|
+
requestLogPagePrev: "\u4E0A\u4E00\u9875",
|
|
686
|
+
requestLogPageNext: "\u4E0B\u4E00\u9875",
|
|
687
|
+
requestLogPageOf: "\uFF0F\u5171",
|
|
688
|
+
requestLogReuse: "\u8FDE\u63A5\u590D\u7528\u7387",
|
|
689
|
+
requestLogReuseHint: "\u590D\u7528\u4FDD\u6D3B\u8FDE\u63A5\u7684\u8BF7\u6C42\u5360\u6BD4\uFF0C\u7528\u65B0\u5EFA\u8FDE\u63A5\u6570\u4E0E\u5DF2\u8BB0\u5F55\u8BF7\u6C42\u6570\u4F30\u7B97\u3002",
|
|
690
|
+
requestLogDropped: "\u5DF2\u4E22\u5F03",
|
|
691
|
+
requestLogColTime: "\u65F6\u95F4",
|
|
692
|
+
requestLogColModel: "\u6A21\u578B",
|
|
693
|
+
requestLogColSession: "\u4F1A\u8BDD",
|
|
694
|
+
requestLogColIn: "\u8F93\u5165",
|
|
695
|
+
requestLogColOut: "\u8F93\u51FA",
|
|
696
|
+
requestLogColCache: "\u7F13\u5B58",
|
|
697
|
+
requestLogColLatency: "\u8017\u65F6",
|
|
698
|
+
requestLogColFirstToken: "\u9996\u5B57",
|
|
699
|
+
requestLogColStatus: "\u72B6\u6001",
|
|
700
|
+
requestLogDetailRequest: "\u8BF7\u6C42",
|
|
701
|
+
requestLogDetailTiming: "\u8017\u65F6",
|
|
702
|
+
requestLogDetailResult: "\u7ED3\u679C",
|
|
703
|
+
requestLogDetailMethod: "\u65B9\u6CD5",
|
|
704
|
+
requestLogDetailUrl: "\u5730\u5740",
|
|
705
|
+
requestLogDetailSession: "\u4F1A\u8BDD",
|
|
706
|
+
requestLogDetailPool: "\u8FDE\u63A5\u6C60",
|
|
707
|
+
requestLogDetailError: "\u9519\u8BEF",
|
|
708
|
+
requestLogDetailTokens: "Token",
|
|
709
|
+
requestLogDetailHeaders: "\u8BF7\u6C42\u5934",
|
|
710
|
+
requestLogDetailUserAgent: "User-Agent",
|
|
711
|
+
requestLogDetailShape: "\u8BF7\u6C42\u6784\u6210",
|
|
712
|
+
requestLogDetailMessages: "\u6761\u6D88\u606F",
|
|
713
|
+
requestLogDetailTools: "\u4E2A\u5DE5\u5177",
|
|
714
|
+
requestLogDetailHasImage: "\u542B\u56FE\u7247",
|
|
503
715
|
writeRejected: "\u8BBE\u7F6E\u5199\u5165\u88AB\u62D2\u7EDD\uFF08\u5DF2\u91CD\u65B0\u8F7D\u5165\uFF09\uFF0C\u8BF7\u91CD\u8BD5",
|
|
504
716
|
writeFailed: "\u8BBE\u7F6E\u5199\u5165\u5931\u8D25",
|
|
505
717
|
filterPlaceholder: "\u6309\u540D\u79F0\u6216 ID \u7B5B\u9009",
|
|
@@ -574,7 +786,348 @@ var zh = {
|
|
|
574
786
|
};
|
|
575
787
|
|
|
576
788
|
// src/client/Section.tsx
|
|
789
|
+
var import_react2 = require("react");
|
|
790
|
+
|
|
791
|
+
// src/client/RequestLogDialog.tsx
|
|
577
792
|
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
|
+
}
|
|
578
1131
|
|
|
579
1132
|
// src/update/check.ts
|
|
580
1133
|
var PACKAGE_NAME = "@dan-ai-studio/dshopencodego";
|
|
@@ -588,6 +1141,11 @@ var MAX_KEEP_ALIVE_TIMEOUT_SECONDS = 1800;
|
|
|
588
1141
|
var DEFAULT_KEEP_ALIVE_TIMEOUT_MS = DEFAULT_KEEP_ALIVE_TIMEOUT_SECONDS * 1e3;
|
|
589
1142
|
var MAX_KEEP_ALIVE_TIMEOUT_MS = MAX_KEEP_ALIVE_TIMEOUT_SECONDS * 1e3;
|
|
590
1143
|
|
|
1144
|
+
// src/request-log/limits.ts
|
|
1145
|
+
var DEFAULT_REQUEST_LOG_MAX_ENTRIES = 200;
|
|
1146
|
+
var MIN_REQUEST_LOG_MAX_ENTRIES = 50;
|
|
1147
|
+
var MAX_REQUEST_LOG_MAX_ENTRIES = 500;
|
|
1148
|
+
|
|
591
1149
|
// src/go-limits.ts
|
|
592
1150
|
var SEED_TRANSCRIBED = "2026-09-25";
|
|
593
1151
|
function monthlyRequestsRank(quota) {
|
|
@@ -629,18 +1187,18 @@ function isIPv6(value) {
|
|
|
629
1187
|
const head = groups(halves[0] ?? "");
|
|
630
1188
|
const tail = halves.length === 2 ? groups(halves[1] ?? "") : [];
|
|
631
1189
|
const all = [...head, ...tail];
|
|
632
|
-
let
|
|
1190
|
+
let count2 = 0;
|
|
633
1191
|
for (const [index, group] of all.entries()) {
|
|
634
1192
|
if (group.includes(".")) {
|
|
635
1193
|
if (index !== all.length - 1) return false;
|
|
636
1194
|
if (!isDottedQuad(group)) return false;
|
|
637
|
-
|
|
1195
|
+
count2 += 2;
|
|
638
1196
|
continue;
|
|
639
1197
|
}
|
|
640
1198
|
if (!/^[0-9a-fA-F]{1,4}$/.test(group)) return false;
|
|
641
|
-
|
|
1199
|
+
count2 += 1;
|
|
642
1200
|
}
|
|
643
|
-
return halves.length === 2 ?
|
|
1201
|
+
return halves.length === 2 ? count2 <= 7 : count2 === 8;
|
|
644
1202
|
}
|
|
645
1203
|
function isAddress(value) {
|
|
646
1204
|
const trimmed = value.trim();
|
|
@@ -709,18 +1267,18 @@ function inputModalityLabels(model, t) {
|
|
|
709
1267
|
}
|
|
710
1268
|
|
|
711
1269
|
// plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/section.module.css
|
|
712
|
-
var
|
|
713
|
-
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(
|
|
1270
|
+
var id2 = "@dan-ai-studio/dshopencodego/section.module.css";
|
|
1271
|
+
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]")) {
|
|
714
1272
|
const style = document.createElement("style");
|
|
715
1273
|
style.dataset.plugin = "@dan-ai-studio/dshopencodego";
|
|
716
|
-
style.dataset.pluginCss =
|
|
1274
|
+
style.dataset.pluginCss = id2;
|
|
717
1275
|
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)}";
|
|
718
1276
|
document.head.appendChild(style);
|
|
719
1277
|
}
|
|
720
1278
|
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" };
|
|
721
1279
|
|
|
722
1280
|
// src/client/Section.tsx
|
|
723
|
-
var
|
|
1281
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
724
1282
|
var API_KEY_REF = "OPENCODE_GO_API_KEY";
|
|
725
1283
|
var VISIBILITY_WRITE_DELAY_MS = 250;
|
|
726
1284
|
var INITIAL = {
|
|
@@ -737,7 +1295,8 @@ var INITIAL = {
|
|
|
737
1295
|
writable: false,
|
|
738
1296
|
saving: false,
|
|
739
1297
|
filter: INITIAL_FILTER,
|
|
740
|
-
update: { phase: "idle", status: void 0, message: void 0 }
|
|
1298
|
+
update: { phase: "idle", status: void 0, message: void 0 },
|
|
1299
|
+
requestLogOpen: false
|
|
741
1300
|
};
|
|
742
1301
|
function settingsOf(value) {
|
|
743
1302
|
if (value === null || typeof value !== "object") return void 0;
|
|
@@ -749,11 +1308,17 @@ function settingsOf(value) {
|
|
|
749
1308
|
const pins = record["pinnedAddresses"];
|
|
750
1309
|
const pinEntries = pins !== null && typeof pins === "object" ? Object.entries(pins).filter(([, address]) => typeof address === "string") : [];
|
|
751
1310
|
const keepAlive = record["keepAliveTimeoutMs"];
|
|
1311
|
+
const requestLogEnabled = record["requestLogEnabled"];
|
|
1312
|
+
const requestLogDebug = record["requestLogDebug"];
|
|
1313
|
+
const requestLogMaxEntries = record["requestLogMaxEntries"];
|
|
752
1314
|
return {
|
|
753
1315
|
modelVisibility: Object.fromEntries(entries),
|
|
754
1316
|
refreshMinutes: minutes,
|
|
755
1317
|
pinnedAddresses: Object.fromEntries(pinEntries),
|
|
756
|
-
keepAliveTimeoutMs: typeof keepAlive === "number" ? keepAlive : DEFAULT_KEEP_ALIVE_TIMEOUT_MS
|
|
1318
|
+
keepAliveTimeoutMs: typeof keepAlive === "number" ? keepAlive : DEFAULT_KEEP_ALIVE_TIMEOUT_MS,
|
|
1319
|
+
requestLogEnabled: typeof requestLogEnabled === "boolean" ? requestLogEnabled : false,
|
|
1320
|
+
requestLogDebug: typeof requestLogDebug === "boolean" ? requestLogDebug : false,
|
|
1321
|
+
requestLogMaxEntries: typeof requestLogMaxEntries === "number" ? requestLogMaxEntries : DEFAULT_REQUEST_LOG_MAX_ENTRIES
|
|
757
1322
|
};
|
|
758
1323
|
}
|
|
759
1324
|
var SectionController = class _SectionController {
|
|
@@ -843,6 +1408,18 @@ var SectionController = class _SectionController {
|
|
|
843
1408
|
});
|
|
844
1409
|
}
|
|
845
1410
|
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Read one request-log snapshot for the viewer. The viewer opens it on
|
|
1413
|
+
* demand and refreshes it when asked; nothing polls, so a closed viewer
|
|
1414
|
+
* costs no wire traffic at all.
|
|
1415
|
+
*/
|
|
1416
|
+
async readRequestLog() {
|
|
1417
|
+
const remote = this.services.remote.opencodeGoRequestLog;
|
|
1418
|
+
if (remote === void 0) throw new Error("the request-log Remote is not mounted");
|
|
1419
|
+
const result = await remote.readLog();
|
|
1420
|
+
if (!result.ok) throw result.error;
|
|
1421
|
+
return result.value;
|
|
1422
|
+
}
|
|
846
1423
|
/**
|
|
847
1424
|
* Pin the gateway to one address.
|
|
848
1425
|
*
|
|
@@ -1053,8 +1630,8 @@ var SectionController = class _SectionController {
|
|
|
1053
1630
|
* the UI never waits on the Host round trip and a burst of clicks becomes a
|
|
1054
1631
|
* single write of the final dict.
|
|
1055
1632
|
*/
|
|
1056
|
-
setVisibility(
|
|
1057
|
-
this.mergeVisibility({ [
|
|
1633
|
+
setVisibility(id4, enabled) {
|
|
1634
|
+
this.mergeVisibility({ [id4]: enabled });
|
|
1058
1635
|
}
|
|
1059
1636
|
/**
|
|
1060
1637
|
* Set every configurable model at once (select-all / select-none).
|
|
@@ -1153,6 +1730,57 @@ var SectionController = class _SectionController {
|
|
|
1153
1730
|
() => this.set({ settings: { ...current, keepAliveTimeoutMs: milliseconds } })
|
|
1154
1731
|
);
|
|
1155
1732
|
}
|
|
1733
|
+
/**
|
|
1734
|
+
* Flip the request-log master switch. Off (the default) means no record is
|
|
1735
|
+
* kept and the request path reads exactly as without the log.
|
|
1736
|
+
*/
|
|
1737
|
+
async setRequestLogEnabled(enabled) {
|
|
1738
|
+
const scope = this.services.scope;
|
|
1739
|
+
const current = this.state.settings;
|
|
1740
|
+
if (scope === void 0 || current === void 0 || !this.state.writable) return;
|
|
1741
|
+
if (typeof enabled !== "boolean") return;
|
|
1742
|
+
await this.write(
|
|
1743
|
+
() => scope.set("requestLogEnabled", enabled),
|
|
1744
|
+
() => this.set({ settings: { ...current, requestLogEnabled: enabled } })
|
|
1745
|
+
);
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Flip request-log debug detail. Only recorded while the master switch is
|
|
1749
|
+
* on; the page does not enforce the pairing, the recorder does.
|
|
1750
|
+
*/
|
|
1751
|
+
async setRequestLogDebug(debug) {
|
|
1752
|
+
const scope = this.services.scope;
|
|
1753
|
+
const current = this.state.settings;
|
|
1754
|
+
if (scope === void 0 || current === void 0 || !this.state.writable) return;
|
|
1755
|
+
if (typeof debug !== "boolean") return;
|
|
1756
|
+
await this.write(
|
|
1757
|
+
() => scope.set("requestLogDebug", debug),
|
|
1758
|
+
() => this.set({ settings: { ...current, requestLogDebug: debug } })
|
|
1759
|
+
);
|
|
1760
|
+
}
|
|
1761
|
+
/**
|
|
1762
|
+
* Set how many request-log entries the Host keeps, clamped to the schema's
|
|
1763
|
+
* own bounds. A lowered bound trims on the next read; raising it backfills
|
|
1764
|
+
* nothing.
|
|
1765
|
+
*/
|
|
1766
|
+
async setRequestLogMaxEntries(entries) {
|
|
1767
|
+
const scope = this.services.scope;
|
|
1768
|
+
const current = this.state.settings;
|
|
1769
|
+
if (scope === void 0 || current === void 0 || !this.state.writable) return;
|
|
1770
|
+
if (!Number.isSafeInteger(entries) || entries < MIN_REQUEST_LOG_MAX_ENTRIES || entries > MAX_REQUEST_LOG_MAX_ENTRIES) return;
|
|
1771
|
+
await this.write(
|
|
1772
|
+
() => scope.set("requestLogMaxEntries", entries),
|
|
1773
|
+
() => this.set({ settings: { ...current, requestLogMaxEntries: entries } })
|
|
1774
|
+
);
|
|
1775
|
+
}
|
|
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
|
+
}
|
|
1156
1784
|
async write(operation, onAccepted) {
|
|
1157
1785
|
this.set({ saving: true });
|
|
1158
1786
|
try {
|
|
@@ -1196,12 +1824,12 @@ function UpdateBanner({ controller, t, busy, act, update }) {
|
|
|
1196
1824
|
if (update.phase === "idle") return null;
|
|
1197
1825
|
const status = update.status;
|
|
1198
1826
|
const notes = status?.latest === void 0 ? `https://github.com/${REPOSITORY}/releases` : `https://github.com/${REPOSITORY}/releases/tag/v${status.latest}`;
|
|
1199
|
-
return /* @__PURE__ */ (0,
|
|
1200
|
-
/* @__PURE__ */ (0,
|
|
1201
|
-
update.phase === "checking" && /* @__PURE__ */ (0,
|
|
1202
|
-
update.phase === "current" && /* @__PURE__ */ (0,
|
|
1203
|
-
/* @__PURE__ */ (0,
|
|
1204
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1205
1833
|
"button",
|
|
1206
1834
|
{
|
|
1207
1835
|
type: "button",
|
|
@@ -1216,9 +1844,9 @@ function UpdateBanner({ controller, t, busy, act, update }) {
|
|
|
1216
1844
|
}
|
|
1217
1845
|
)
|
|
1218
1846
|
] }),
|
|
1219
|
-
update.phase === "ready" && status?.latest !== void 0 && /* @__PURE__ */ (0,
|
|
1220
|
-
/* @__PURE__ */ (0,
|
|
1221
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1222
1850
|
"button",
|
|
1223
1851
|
{
|
|
1224
1852
|
type: "button",
|
|
@@ -1230,8 +1858,8 @@ function UpdateBanner({ controller, t, busy, act, update }) {
|
|
|
1230
1858
|
children: t("updateNow")
|
|
1231
1859
|
}
|
|
1232
1860
|
),
|
|
1233
|
-
/* @__PURE__ */ (0,
|
|
1234
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1235
1863
|
"button",
|
|
1236
1864
|
{
|
|
1237
1865
|
type: "button",
|
|
@@ -1246,9 +1874,9 @@ function UpdateBanner({ controller, t, busy, act, update }) {
|
|
|
1246
1874
|
}
|
|
1247
1875
|
)
|
|
1248
1876
|
] }),
|
|
1249
|
-
update.phase === "confirming" && status?.latest !== void 0 && /* @__PURE__ */ (0,
|
|
1250
|
-
/* @__PURE__ */ (0,
|
|
1251
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1252
1880
|
"button",
|
|
1253
1881
|
{
|
|
1254
1882
|
type: "button",
|
|
@@ -1262,7 +1890,7 @@ function UpdateBanner({ controller, t, busy, act, update }) {
|
|
|
1262
1890
|
children: t("updateConfirm")
|
|
1263
1891
|
}
|
|
1264
1892
|
),
|
|
1265
|
-
/* @__PURE__ */ (0,
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1266
1894
|
"button",
|
|
1267
1895
|
{
|
|
1268
1896
|
type: "button",
|
|
@@ -1275,15 +1903,15 @@ function UpdateBanner({ controller, t, busy, act, update }) {
|
|
|
1275
1903
|
}
|
|
1276
1904
|
)
|
|
1277
1905
|
] }),
|
|
1278
|
-
update.phase === "updating" && /* @__PURE__ */ (0,
|
|
1279
|
-
update.phase === "done" && /* @__PURE__ */ (0,
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
update.message === "restart-required" && /* @__PURE__ */ (0,
|
|
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") })
|
|
1282
1910
|
] }),
|
|
1283
|
-
update.phase === "failed" && /* @__PURE__ */ (0,
|
|
1284
|
-
/* @__PURE__ */ (0,
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1287
1915
|
"button",
|
|
1288
1916
|
{
|
|
1289
1917
|
type: "button",
|
|
@@ -1316,11 +1944,11 @@ function updateFailureText(message, t) {
|
|
|
1316
1944
|
return message;
|
|
1317
1945
|
}
|
|
1318
1946
|
function Section({ controller, t, getLocale }) {
|
|
1319
|
-
const state = (0,
|
|
1320
|
-
const [keyDraft, setKeyDraft] = (0,
|
|
1321
|
-
const [pinDraft, setPinDraft] = (0,
|
|
1322
|
-
const [busy, setBusy] = (0,
|
|
1323
|
-
const act = (0,
|
|
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) => {
|
|
1324
1952
|
setBusy(true);
|
|
1325
1953
|
try {
|
|
1326
1954
|
await operation();
|
|
@@ -1328,10 +1956,10 @@ function Section({ controller, t, getLocale }) {
|
|
|
1328
1956
|
setBusy(false);
|
|
1329
1957
|
}
|
|
1330
1958
|
}, []);
|
|
1331
|
-
(0,
|
|
1959
|
+
(0, import_react2.useEffect)(() => {
|
|
1332
1960
|
setKeyDraft("");
|
|
1333
1961
|
}, [state.saved]);
|
|
1334
|
-
(0,
|
|
1962
|
+
(0, import_react2.useEffect)(() => {
|
|
1335
1963
|
setPinDraft(state.network?.address ?? "");
|
|
1336
1964
|
}, [state.network?.address]);
|
|
1337
1965
|
const reading = state.reading;
|
|
@@ -1340,18 +1968,18 @@ function Section({ controller, t, getLocale }) {
|
|
|
1340
1968
|
const editable = state.writable && state.settings !== void 0;
|
|
1341
1969
|
const rows = reading === void 0 ? [] : visibleModels(reading.models, state.filter, visibility, getLocale?.());
|
|
1342
1970
|
const hidden = reading === void 0 ? 0 : reading.models.length - rows.length;
|
|
1343
|
-
return /* @__PURE__ */ (0,
|
|
1344
|
-
/* @__PURE__ */ (0,
|
|
1345
|
-
/* @__PURE__ */ (0,
|
|
1346
|
-
/* @__PURE__ */ (0,
|
|
1347
|
-
/* @__PURE__ */ (0,
|
|
1348
|
-
/* @__PURE__ */ (0,
|
|
1349
|
-
/* @__PURE__ */ (0,
|
|
1350
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
1351
1979
|
] }),
|
|
1352
|
-
/* @__PURE__ */ (0,
|
|
1353
|
-
/* @__PURE__ */ (0,
|
|
1354
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1355
1983
|
"input",
|
|
1356
1984
|
{
|
|
1357
1985
|
className: section_default.input,
|
|
@@ -1364,7 +1992,7 @@ function Section({ controller, t, getLocale }) {
|
|
|
1364
1992
|
}
|
|
1365
1993
|
}
|
|
1366
1994
|
),
|
|
1367
|
-
/* @__PURE__ */ (0,
|
|
1995
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1368
1996
|
"button",
|
|
1369
1997
|
{
|
|
1370
1998
|
type: "button",
|
|
@@ -1378,7 +2006,7 @@ function Section({ controller, t, getLocale }) {
|
|
|
1378
2006
|
children: state.saved === true ? t("keySaved") : t("keySave")
|
|
1379
2007
|
}
|
|
1380
2008
|
),
|
|
1381
|
-
/* @__PURE__ */ (0,
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1382
2010
|
"button",
|
|
1383
2011
|
{
|
|
1384
2012
|
type: "button",
|
|
@@ -1394,16 +2022,16 @@ function Section({ controller, t, getLocale }) {
|
|
|
1394
2022
|
)
|
|
1395
2023
|
] })
|
|
1396
2024
|
] }),
|
|
1397
|
-
/* @__PURE__ */ (0,
|
|
1398
|
-
/* @__PURE__ */ (0,
|
|
1399
|
-
/* @__PURE__ */ (0,
|
|
1400
|
-
/* @__PURE__ */ (0,
|
|
1401
|
-
/* @__PURE__ */ (0,
|
|
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 })
|
|
1402
2030
|
] }),
|
|
1403
|
-
/* @__PURE__ */ (0,
|
|
1404
|
-
state.networkFailure !== void 0 && /* @__PURE__ */ (0,
|
|
1405
|
-
/* @__PURE__ */ (0,
|
|
1406
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1407
2035
|
"input",
|
|
1408
2036
|
{
|
|
1409
2037
|
className: section_default.input,
|
|
@@ -1416,7 +2044,7 @@ function Section({ controller, t, getLocale }) {
|
|
|
1416
2044
|
}
|
|
1417
2045
|
}
|
|
1418
2046
|
),
|
|
1419
|
-
/* @__PURE__ */ (0,
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1420
2048
|
"button",
|
|
1421
2049
|
{
|
|
1422
2050
|
type: "button",
|
|
@@ -1430,7 +2058,7 @@ function Section({ controller, t, getLocale }) {
|
|
|
1430
2058
|
children: t("pinSave")
|
|
1431
2059
|
}
|
|
1432
2060
|
),
|
|
1433
|
-
/* @__PURE__ */ (0,
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1434
2062
|
"button",
|
|
1435
2063
|
{
|
|
1436
2064
|
type: "button",
|
|
@@ -1445,13 +2073,13 @@ function Section({ controller, t, getLocale }) {
|
|
|
1445
2073
|
}
|
|
1446
2074
|
)
|
|
1447
2075
|
] }),
|
|
1448
|
-
state.pinInvalid && /* @__PURE__ */ (0,
|
|
2076
|
+
state.pinInvalid && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: section_default.warn, children: t("pinInvalid") })
|
|
1449
2077
|
] }),
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1451
|
-
/* @__PURE__ */ (0,
|
|
1452
|
-
/* @__PURE__ */ (0,
|
|
1453
|
-
/* @__PURE__ */ (0,
|
|
1454
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1455
2083
|
"button",
|
|
1456
2084
|
{
|
|
1457
2085
|
type: "button",
|
|
@@ -1463,7 +2091,7 @@ function Section({ controller, t, getLocale }) {
|
|
|
1463
2091
|
children: t("catalogSelectAll")
|
|
1464
2092
|
}
|
|
1465
2093
|
),
|
|
1466
|
-
/* @__PURE__ */ (0,
|
|
2094
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1467
2095
|
"button",
|
|
1468
2096
|
{
|
|
1469
2097
|
type: "button",
|
|
@@ -1475,7 +2103,7 @@ function Section({ controller, t, getLocale }) {
|
|
|
1475
2103
|
children: t("catalogSelectNone")
|
|
1476
2104
|
}
|
|
1477
2105
|
),
|
|
1478
|
-
/* @__PURE__ */ (0,
|
|
2106
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1479
2107
|
"button",
|
|
1480
2108
|
{
|
|
1481
2109
|
type: "button",
|
|
@@ -1490,31 +2118,31 @@ function Section({ controller, t, getLocale }) {
|
|
|
1490
2118
|
}
|
|
1491
2119
|
)
|
|
1492
2120
|
] }),
|
|
1493
|
-
state.failure !== void 0 && /* @__PURE__ */ (0,
|
|
2121
|
+
state.failure !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.warn, children: [
|
|
1494
2122
|
t("catalogStale"),
|
|
1495
2123
|
": ",
|
|
1496
2124
|
state.failure
|
|
1497
2125
|
] }),
|
|
1498
|
-
reading !== void 0 && reading.stale && state.failure === void 0 && /* @__PURE__ */ (0,
|
|
1499
|
-
reading !== void 0 && reading.degradations.length > 0 && /* @__PURE__ */ (0,
|
|
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: [
|
|
1500
2128
|
t("catalogDegraded"),
|
|
1501
2129
|
": ",
|
|
1502
2130
|
reading.degradations.map((degradation) => `${t(degradation.source === "metadata" ? "catalogDegradedMetadata" : "catalogDegradedDocument")} \u2014 ${degradation.reason}`).join("; ")
|
|
1503
2131
|
] }),
|
|
1504
|
-
reading !== void 0 && reading.quotaSource === "seed" && /* @__PURE__ */ (0,
|
|
2132
|
+
reading !== void 0 && reading.quotaSource === "seed" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.hint, children: [
|
|
1505
2133
|
t("quotaSeed"),
|
|
1506
2134
|
" ",
|
|
1507
2135
|
SEED_TRANSCRIBED
|
|
1508
2136
|
] }),
|
|
1509
|
-
reading !== void 0 && reading.factsCachedAt !== void 0 && /* @__PURE__ */ (0,
|
|
2137
|
+
reading !== void 0 && reading.factsCachedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: section_default.hint, children: [
|
|
1510
2138
|
t("factsCached"),
|
|
1511
2139
|
" ",
|
|
1512
2140
|
new Date(reading.factsCachedAt).toISOString().slice(0, 10)
|
|
1513
2141
|
] }),
|
|
1514
|
-
reading !== void 0 && reading.cached === true && /* @__PURE__ */ (0,
|
|
1515
|
-
/* @__PURE__ */ (0,
|
|
1516
|
-
/* @__PURE__ */ (0,
|
|
1517
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1518
2146
|
"input",
|
|
1519
2147
|
{
|
|
1520
2148
|
id: "dshopencodego-refresh",
|
|
@@ -1529,11 +2157,11 @@ function Section({ controller, t, getLocale }) {
|
|
|
1529
2157
|
}
|
|
1530
2158
|
}
|
|
1531
2159
|
),
|
|
1532
|
-
/* @__PURE__ */ (0,
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("refreshHint") })
|
|
1533
2161
|
] }),
|
|
1534
|
-
/* @__PURE__ */ (0,
|
|
1535
|
-
/* @__PURE__ */ (0,
|
|
1536
|
-
/* @__PURE__ */ (0,
|
|
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)(
|
|
1537
2165
|
"input",
|
|
1538
2166
|
{
|
|
1539
2167
|
id: "dshopencodego-keepalive",
|
|
@@ -1548,11 +2176,72 @@ function Section({ controller, t, getLocale }) {
|
|
|
1548
2176
|
}
|
|
1549
2177
|
}
|
|
1550
2178
|
),
|
|
1551
|
-
/* @__PURE__ */ (0,
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("keepAliveHint") })
|
|
2180
|
+
] }),
|
|
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)(
|
|
2185
|
+
"input",
|
|
2186
|
+
{
|
|
2187
|
+
type: "checkbox",
|
|
2188
|
+
checked: state.settings?.requestLogEnabled ?? false,
|
|
2189
|
+
disabled: !editable || state.saving,
|
|
2190
|
+
onChange: (event) => {
|
|
2191
|
+
void act(async () => {
|
|
2192
|
+
await controller.setRequestLogEnabled(event.target.checked);
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
),
|
|
2197
|
+
` ${t("requestLogEnabled")}`
|
|
2198
|
+
] }) }),
|
|
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)(
|
|
2202
|
+
"input",
|
|
2203
|
+
{
|
|
2204
|
+
type: "checkbox",
|
|
2205
|
+
checked: state.settings?.requestLogDebug ?? false,
|
|
2206
|
+
disabled: !editable || state.saving,
|
|
2207
|
+
onChange: (event) => {
|
|
2208
|
+
void act(async () => {
|
|
2209
|
+
await controller.setRequestLogDebug(event.target.checked);
|
|
2210
|
+
});
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
),
|
|
2214
|
+
` ${t("requestLogDebug")}`
|
|
2215
|
+
] }),
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("requestLogDebugHint") })
|
|
2217
|
+
] }),
|
|
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)(
|
|
2221
|
+
"input",
|
|
2222
|
+
{
|
|
2223
|
+
id: "dshopencodego-requestlog-max",
|
|
2224
|
+
className: section_default.number,
|
|
2225
|
+
type: "number",
|
|
2226
|
+
min: MIN_REQUEST_LOG_MAX_ENTRIES,
|
|
2227
|
+
max: MAX_REQUEST_LOG_MAX_ENTRIES,
|
|
2228
|
+
disabled: !editable || state.saving,
|
|
2229
|
+
value: state.settings?.requestLogMaxEntries ?? "",
|
|
2230
|
+
onChange: (event) => {
|
|
2231
|
+
void act(async () => {
|
|
2232
|
+
await controller.setRequestLogMaxEntries(Number(event.target.value));
|
|
2233
|
+
});
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: section_default.hint, children: t("requestLogMaxEntriesHint") })
|
|
1552
2238
|
] }),
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
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)(
|
|
1556
2245
|
"input",
|
|
1557
2246
|
{
|
|
1558
2247
|
className: section_default.input,
|
|
@@ -1565,8 +2254,8 @@ function Section({ controller, t, getLocale }) {
|
|
|
1565
2254
|
}
|
|
1566
2255
|
}
|
|
1567
2256
|
),
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1570
2259
|
"input",
|
|
1571
2260
|
{
|
|
1572
2261
|
type: "checkbox",
|
|
@@ -1578,8 +2267,8 @@ function Section({ controller, t, getLocale }) {
|
|
|
1578
2267
|
),
|
|
1579
2268
|
` ${t("filterOnlyEnabled")}`
|
|
1580
2269
|
] }),
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1582
|
-
/* @__PURE__ */ (0,
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1583
2272
|
"input",
|
|
1584
2273
|
{
|
|
1585
2274
|
type: "checkbox",
|
|
@@ -1591,9 +2280,9 @@ function Section({ controller, t, getLocale }) {
|
|
|
1591
2280
|
),
|
|
1592
2281
|
` ${t("filterShowDeprecated")}`
|
|
1593
2282
|
] }),
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
2283
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: section_default.hint, children: [
|
|
1595
2284
|
`${t("sortLabel")} `,
|
|
1596
|
-
/* @__PURE__ */ (0,
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1597
2286
|
"select",
|
|
1598
2287
|
{
|
|
1599
2288
|
className: section_default.select,
|
|
@@ -1603,29 +2292,29 @@ function Section({ controller, t, getLocale }) {
|
|
|
1603
2292
|
controller.setFilter({ sort: event.target.value });
|
|
1604
2293
|
},
|
|
1605
2294
|
children: [
|
|
1606
|
-
/* @__PURE__ */ (0,
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1609
|
-
/* @__PURE__ */ (0,
|
|
1610
|
-
/* @__PURE__ */ (0,
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
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") })
|
|
1613
2302
|
]
|
|
1614
2303
|
}
|
|
1615
2304
|
)
|
|
1616
2305
|
] }),
|
|
1617
|
-
hidden > 0 && /* @__PURE__ */ (0,
|
|
2306
|
+
hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: section_default.hint, children: [
|
|
1618
2307
|
hidden,
|
|
1619
2308
|
" ",
|
|
1620
2309
|
t("filterHidden")
|
|
1621
2310
|
] })
|
|
1622
2311
|
] }),
|
|
1623
|
-
reading !== void 0 && /* @__PURE__ */ (0,
|
|
2312
|
+
reading !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.list, children: rows.map((model) => {
|
|
1624
2313
|
const badge = badgeFor(model, t);
|
|
1625
2314
|
const modalities = inputModalityLabels(model, t).join(" \xB7 ");
|
|
1626
2315
|
const offered = isOffered(model, visibility);
|
|
1627
|
-
return /* @__PURE__ */ (0,
|
|
1628
|
-
/* @__PURE__ */ (0,
|
|
2316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: section_default.item, children: [
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1629
2318
|
"input",
|
|
1630
2319
|
{
|
|
1631
2320
|
type: "checkbox",
|
|
@@ -1637,43 +2326,55 @@ function Section({ controller, t, getLocale }) {
|
|
|
1637
2326
|
}
|
|
1638
2327
|
}
|
|
1639
2328
|
),
|
|
1640
|
-
/* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1643
|
-
/* @__PURE__ */ (0,
|
|
1644
|
-
model.releaseDate !== void 0 && /* @__PURE__ */ (0,
|
|
1645
|
-
badge.length > 0 && /* @__PURE__ */ (0,
|
|
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 })
|
|
1646
2335
|
] }),
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
model.contextWindow !== void 0 && /* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1650
|
-
/* @__PURE__ */ (0,
|
|
1651
|
-
/* @__PURE__ */ (0,
|
|
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) })
|
|
1652
2341
|
] }),
|
|
1653
|
-
modalities.length > 0 && /* @__PURE__ */ (0,
|
|
2342
|
+
modalities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: section_default.itemModalities, children: `${t("inputLabel")} ${modalities}` })
|
|
1654
2343
|
] })
|
|
1655
2344
|
] }, model.id);
|
|
1656
2345
|
}) })
|
|
1657
|
-
] })
|
|
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
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
)
|
|
1658
2359
|
] });
|
|
1659
2360
|
}
|
|
1660
2361
|
|
|
1661
2362
|
// src/client/UsagePill.tsx
|
|
1662
|
-
var
|
|
2363
|
+
var import_react3 = require("react");
|
|
1663
2364
|
|
|
1664
2365
|
// plugin-css:/home/runner/work/dshopencodego/dshopencodego/src/client/pill.module.css
|
|
1665
|
-
var
|
|
1666
|
-
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(
|
|
2366
|
+
var id3 = "@dan-ai-studio/dshopencodego/pill.module.css";
|
|
2367
|
+
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id3) + "]")) {
|
|
1667
2368
|
const style = document.createElement("style");
|
|
1668
2369
|
style.dataset.plugin = "@dan-ai-studio/dshopencodego";
|
|
1669
|
-
style.dataset.pluginCss =
|
|
2370
|
+
style.dataset.pluginCss = id3;
|
|
1670
2371
|
style.textContent = ".mMNkkW_root{align-items:center;display:inline-flex;position:relative}.mMNkkW_trigger{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;white-space:nowrap;border-radius:999px;padding:.35rem .6rem;font-size:.8rem;line-height:1}.mMNkkW_trigger:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.mMNkkW_panel{z-index:20;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-overlay);width:18rem;color:var(--dsw-alias-label-primary);border-radius:.6rem;flex-direction:column;gap:.6rem;padding:.75rem .85rem;display:flex;position:absolute;bottom:calc(100% + .5rem);right:0;box-shadow:0 8px 24px #0000002e}.mMNkkW_window{flex-direction:column;gap:.25rem;display:flex}.mMNkkW_row{justify-content:space-between;gap:.5rem;font-size:.85rem;display:flex}.mMNkkW_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.75rem}.mMNkkW_progress{width:100%;height:.35rem;accent-color:var(--dsw-alias-brand-primary)}.mMNkkW_limited{color:var(--dsw-alias-state-warn-primary);font-size:.75rem}.mMNkkW_warning{border:1px solid var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary);border-radius:.4rem;padding:.4rem .5rem;font-size:.75rem}.mMNkkW_retry{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;align-self:flex-start;padding:.25rem .5rem;font-size:.75rem}.mMNkkW_local{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:.2rem;padding-top:.5rem;display:flex}";
|
|
1671
2372
|
document.head.appendChild(style);
|
|
1672
2373
|
}
|
|
1673
2374
|
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" };
|
|
1674
2375
|
|
|
1675
2376
|
// src/client/UsagePill.tsx
|
|
1676
|
-
var
|
|
2377
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1677
2378
|
function failureOf(error) {
|
|
1678
2379
|
if (error !== null && typeof error === "object" && "code" in error && error.code === "dshopencodego/usage-unavailable") {
|
|
1679
2380
|
const details = error.details;
|
|
@@ -1694,8 +2395,8 @@ function formatUSD(value) {
|
|
|
1694
2395
|
return value < 1 ? `$${value.toFixed(4)}` : `$${value.toFixed(2)}`;
|
|
1695
2396
|
}
|
|
1696
2397
|
function UsagePill({ directory, ...rest }) {
|
|
1697
|
-
const state = (0,
|
|
1698
|
-
return state.current?.provider === "opencode-go" ? /* @__PURE__ */ (0,
|
|
2398
|
+
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;
|
|
1699
2400
|
}
|
|
1700
2401
|
function ActiveUsage({
|
|
1701
2402
|
readWindows,
|
|
@@ -1703,14 +2404,14 @@ function ActiveUsage({
|
|
|
1703
2404
|
t,
|
|
1704
2405
|
getLocale
|
|
1705
2406
|
}) {
|
|
1706
|
-
const [windows, setWindows] = (0,
|
|
1707
|
-
const [meter, setMeter] = (0,
|
|
1708
|
-
const [failure, setFailure] = (0,
|
|
1709
|
-
const [updatedAt, setUpdatedAt] = (0,
|
|
1710
|
-
const [refreshing, setRefreshing] = (0,
|
|
1711
|
-
const [open, setOpen] = (0,
|
|
1712
|
-
const root = (0,
|
|
1713
|
-
const refresh = (0,
|
|
2407
|
+
const [windows, setWindows] = (0, import_react3.useState)(void 0);
|
|
2408
|
+
const [meter, setMeter] = (0, import_react3.useState)(void 0);
|
|
2409
|
+
const [failure, setFailure] = (0, import_react3.useState)(void 0);
|
|
2410
|
+
const [updatedAt, setUpdatedAt] = (0, import_react3.useState)(void 0);
|
|
2411
|
+
const [refreshing, setRefreshing] = (0, import_react3.useState)(false);
|
|
2412
|
+
const [open, setOpen] = (0, import_react3.useState)(false);
|
|
2413
|
+
const root = (0, import_react3.useRef)(null);
|
|
2414
|
+
const refresh = (0, import_react3.useCallback)(async () => {
|
|
1714
2415
|
setRefreshing(true);
|
|
1715
2416
|
try {
|
|
1716
2417
|
const [nextWindows, nextMeter] = await Promise.all([readWindows(), readMeter()]);
|
|
@@ -1729,7 +2430,7 @@ function ActiveUsage({
|
|
|
1729
2430
|
setRefreshing(false);
|
|
1730
2431
|
}
|
|
1731
2432
|
}, [readWindows, readMeter]);
|
|
1732
|
-
(0,
|
|
2433
|
+
(0, import_react3.useEffect)(() => {
|
|
1733
2434
|
let alive = true;
|
|
1734
2435
|
const run = () => {
|
|
1735
2436
|
if (!alive || document.visibilityState === "hidden") return;
|
|
@@ -1744,7 +2445,7 @@ function ActiveUsage({
|
|
|
1744
2445
|
document.removeEventListener("visibilitychange", run);
|
|
1745
2446
|
};
|
|
1746
2447
|
}, [refresh]);
|
|
1747
|
-
(0,
|
|
2448
|
+
(0, import_react3.useEffect)(() => {
|
|
1748
2449
|
if (!open) return;
|
|
1749
2450
|
const close = (event) => {
|
|
1750
2451
|
if (!root.current?.contains(event.target)) setOpen(false);
|
|
@@ -1762,8 +2463,8 @@ function ActiveUsage({
|
|
|
1762
2463
|
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")}`);
|
|
1763
2464
|
const unpriced = (meter?.models ?? []).filter((entry) => entry.estimatedUSD === void 0);
|
|
1764
2465
|
const unpricedModels = unpriced.slice(0, MAX_UNPRICED_IDS).map((entry) => entry.model).join(", ") + (unpriced.length > MAX_UNPRICED_IDS ? ` +${unpriced.length - MAX_UNPRICED_IDS}` : "");
|
|
1765
|
-
return /* @__PURE__ */ (0,
|
|
1766
|
-
/* @__PURE__ */ (0,
|
|
2466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: pill_default.root, ref: root, children: [
|
|
2467
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1767
2468
|
"button",
|
|
1768
2469
|
{
|
|
1769
2470
|
type: "button",
|
|
@@ -1777,71 +2478,71 @@ function ActiveUsage({
|
|
|
1777
2478
|
children: label
|
|
1778
2479
|
}
|
|
1779
2480
|
),
|
|
1780
|
-
open && /* @__PURE__ */ (0,
|
|
1781
|
-
/* @__PURE__ */ (0,
|
|
1782
|
-
failure !== void 0 && /* @__PURE__ */ (0,
|
|
1783
|
-
/* @__PURE__ */ (0,
|
|
1784
|
-
failure.message.length > 0 && /* @__PURE__ */ (0,
|
|
1785
|
-
windows !== void 0 && /* @__PURE__ */ (0,
|
|
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") })
|
|
1786
2487
|
] }),
|
|
1787
|
-
windows === void 0 && failure === void 0 && /* @__PURE__ */ (0,
|
|
1788
|
-
windows !== void 0 && [["rolling", "usageRolling"], ["weekly", "usageWeekly"], ["monthly", "usageMonthly"]].map(([key, label2]) => /* @__PURE__ */ (0,
|
|
1789
|
-
/* @__PURE__ */ (0,
|
|
1790
|
-
/* @__PURE__ */ (0,
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
1792
2493
|
windows[key].percent,
|
|
1793
2494
|
"%"
|
|
1794
2495
|
] })
|
|
1795
2496
|
] }),
|
|
1796
|
-
/* @__PURE__ */ (0,
|
|
1797
|
-
/* @__PURE__ */ (0,
|
|
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: [
|
|
1798
2499
|
t("usageResets"),
|
|
1799
2500
|
" ",
|
|
1800
2501
|
new Date(windows[key].resetsAt).toLocaleString(getLocale?.())
|
|
1801
2502
|
] }),
|
|
1802
|
-
windows[key].status === "rate-limited" && /* @__PURE__ */ (0,
|
|
2503
|
+
windows[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: pill_default.limited, children: t("usageLimited") })
|
|
1803
2504
|
] }, key)),
|
|
1804
|
-
meter !== void 0 && /* @__PURE__ */ (0,
|
|
1805
|
-
/* @__PURE__ */ (0,
|
|
1806
|
-
/* @__PURE__ */ (0,
|
|
1807
|
-
/* @__PURE__ */ (0,
|
|
1808
|
-
/* @__PURE__ */ (0,
|
|
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 })
|
|
1809
2510
|
] }),
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1811
|
-
/* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
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?.()) })
|
|
1813
2514
|
] }),
|
|
1814
|
-
/* @__PURE__ */ (0,
|
|
1815
|
-
/* @__PURE__ */ (0,
|
|
1816
|
-
/* @__PURE__ */ (0,
|
|
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?.()) })
|
|
1817
2518
|
] }),
|
|
1818
|
-
meter.totals.reasoningTokens !== void 0 && /* @__PURE__ */ (0,
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
1820
|
-
/* @__PURE__ */ (0,
|
|
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?.()) })
|
|
1821
2522
|
] }),
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1824
|
-
/* @__PURE__ */ (0,
|
|
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) })
|
|
1825
2526
|
] }),
|
|
1826
|
-
meter.totals.unpricedTokens !== void 0 && /* @__PURE__ */ (0,
|
|
2527
|
+
meter.totals.unpricedTokens !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.hint, children: [
|
|
1827
2528
|
t("usageSpendPartial"),
|
|
1828
2529
|
" ",
|
|
1829
2530
|
meter.totals.unpricedTokens.toLocaleString(getLocale?.())
|
|
1830
2531
|
] }),
|
|
1831
|
-
unpriced.length > 0 && /* @__PURE__ */ (0,
|
|
2532
|
+
unpriced.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: pill_default.hint, children: [
|
|
1832
2533
|
t("usageUnpricedModels"),
|
|
1833
2534
|
" ",
|
|
1834
2535
|
unpricedModels
|
|
1835
2536
|
] }),
|
|
1836
|
-
/* @__PURE__ */ (0,
|
|
1837
|
-
/* @__PURE__ */ (0,
|
|
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") })
|
|
1838
2539
|
] }),
|
|
1839
|
-
updatedAt !== void 0 && /* @__PURE__ */ (0,
|
|
2540
|
+
updatedAt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: pill_default.hint, children: [
|
|
1840
2541
|
t("usageLastUpdated"),
|
|
1841
2542
|
" ",
|
|
1842
2543
|
new Date(updatedAt).toLocaleString(getLocale?.())
|
|
1843
2544
|
] }),
|
|
1844
|
-
/* @__PURE__ */ (0,
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: pill_default.retry, disabled: refreshing, onClick: () => {
|
|
1845
2546
|
void refresh();
|
|
1846
2547
|
}, children: t(refreshing ? "usageRefreshing" : "usageRetry") })
|
|
1847
2548
|
] })
|
|
@@ -1859,7 +2560,8 @@ function apply(ctx) {
|
|
|
1859
2560
|
...usageRemote.descriptors,
|
|
1860
2561
|
...catalogRemote.descriptors,
|
|
1861
2562
|
...updateRemote.descriptors,
|
|
1862
|
-
...networkRemote.descriptors
|
|
2563
|
+
...networkRemote.descriptors,
|
|
2564
|
+
...requestLogRemote.descriptors
|
|
1863
2565
|
]
|
|
1864
2566
|
});
|
|
1865
2567
|
ctx.effect(() => {
|
|
@@ -1872,7 +2574,7 @@ function apply(ctx) {
|
|
|
1872
2574
|
void dispose?.();
|
|
1873
2575
|
};
|
|
1874
2576
|
}, "dshopencodego: usage Remote");
|
|
1875
|
-
ctx.inject(["configForms", "remote.opencodeGoCatalog", "remote.opencodeGoUpdate", "remote.opencodeGoNetwork", "remote.credentials"], (scope) => {
|
|
2577
|
+
ctx.inject(["configForms", "remote.opencodeGoCatalog", "remote.opencodeGoUpdate", "remote.opencodeGoNetwork", "remote.opencodeGoRequestLog", "remote.credentials"], (scope) => {
|
|
1876
2578
|
const forms = scope.get("configForms");
|
|
1877
2579
|
const pluginManager = {};
|
|
1878
2580
|
const controller = new SectionController({
|