@lynn123411/dsh-subagent-judge-dispatch 0.4.2 → 0.5.1
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/DETAILS.md +14 -12
- package/README.md +4 -4
- package/lib/client.js +203 -274
- package/lib/client.js.map +2 -2
- package/lib/index.js +66 -28
- package/lib/index.js.map +3 -3
- package/package.json +15 -15
package/lib/client.js
CHANGED
|
@@ -38,7 +38,6 @@ __export(index_exports, {
|
|
|
38
38
|
name: () => name,
|
|
39
39
|
readRow: () => readRow,
|
|
40
40
|
setupSettingsUi: () => setupSettingsUi,
|
|
41
|
-
validateRows: () => validateRows,
|
|
42
41
|
zh: () => zh
|
|
43
42
|
});
|
|
44
43
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -175,15 +174,18 @@ function buildModelOptions(allowed, groups) {
|
|
|
175
174
|
}
|
|
176
175
|
return options;
|
|
177
176
|
}
|
|
178
|
-
function
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
function rowHints(rows, index, t) {
|
|
178
|
+
const row = rows[index];
|
|
179
|
+
if (row === void 0) return [];
|
|
180
|
+
const hints = [];
|
|
181
|
+
if (!isSelectableRow(row)) hints.push(t("rows.incomplete"));
|
|
182
|
+
const description = row.description.trim();
|
|
183
|
+
if (description === "") {
|
|
184
|
+
hints.push(t("rows.hintNoDescription"));
|
|
185
|
+
} else if (rows.some((other, at) => at !== index && other.description.trim() === description)) {
|
|
186
|
+
hints.push(t("rows.hintDuplicateDescription"));
|
|
185
187
|
}
|
|
186
|
-
return
|
|
188
|
+
return hints;
|
|
187
189
|
}
|
|
188
190
|
function exportRowsJson(rows) {
|
|
189
191
|
return JSON.stringify(
|
|
@@ -236,10 +238,9 @@ function emptyKey() {
|
|
|
236
238
|
configured: false,
|
|
237
239
|
writable: false,
|
|
238
240
|
unavailable: false,
|
|
239
|
-
|
|
241
|
+
writing: false,
|
|
240
242
|
failed: false,
|
|
241
|
-
error: ""
|
|
242
|
-
landed: ""
|
|
243
|
+
error: ""
|
|
243
244
|
};
|
|
244
245
|
}
|
|
245
246
|
var DispatchCardStore = class {
|
|
@@ -260,19 +261,17 @@ var DispatchCardStore = class {
|
|
|
260
261
|
judgeModel: DEFAULT_JUDGE_MODEL,
|
|
261
262
|
rows: []
|
|
262
263
|
},
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
rowsInvalid: "",
|
|
267
|
-
saving: "",
|
|
268
|
-
saveFailed: "",
|
|
269
|
-
saveError: "",
|
|
264
|
+
writing: "",
|
|
265
|
+
writeFailed: "",
|
|
266
|
+
writeError: "",
|
|
270
267
|
key: emptyKey(),
|
|
271
268
|
log: [],
|
|
272
269
|
logLoaded: false,
|
|
273
270
|
logFailed: false
|
|
274
271
|
};
|
|
275
272
|
listeners = /* @__PURE__ */ new Set();
|
|
273
|
+
/** One commit at a time: a queued write reads the drafts as they stand when it runs. */
|
|
274
|
+
queue = Promise.resolve();
|
|
276
275
|
form = null;
|
|
277
276
|
allowedForm = null;
|
|
278
277
|
session = null;
|
|
@@ -386,46 +385,38 @@ var DispatchCardStore = class {
|
|
|
386
385
|
judgeModel: staged(this.state.judgeModel, before.judgeModel) ? this.state.judgeModel : committed.judgeModel,
|
|
387
386
|
rows: JSON.stringify(this.state.rows) !== JSON.stringify(before.rows) ? this.state.rows : committed.rows
|
|
388
387
|
};
|
|
389
|
-
this.
|
|
388
|
+
this.notify();
|
|
390
389
|
}
|
|
391
|
-
/**
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
};
|
|
390
|
+
/**
|
|
391
|
+
* Stage one edit.
|
|
392
|
+
*
|
|
393
|
+
* A failure stays on screen until a write lands: the value it complains about
|
|
394
|
+
* has not reached the document yet, so clearing it on the first keystroke would
|
|
395
|
+
* say "fixed" while the drafts are still only on this page.
|
|
396
|
+
*
|
|
397
|
+
* @param patch - the state fields this edit changes.
|
|
398
|
+
*/
|
|
399
|
+
stage(patch) {
|
|
400
|
+
this.state = { ...this.state, ...patch };
|
|
403
401
|
this.notify();
|
|
404
402
|
}
|
|
405
|
-
/** Stage one top-level field. */
|
|
403
|
+
/** Stage one top-level field; its control commits when focus leaves it. */
|
|
406
404
|
field(key, value) {
|
|
407
|
-
this.
|
|
408
|
-
this.recompute();
|
|
405
|
+
this.stage(key === "endpointUrl" ? { endpointUrl: value } : { judgeModel: value });
|
|
409
406
|
}
|
|
410
|
-
/**
|
|
407
|
+
/** Flip one switch and write it: a switch is one complete decision. */
|
|
411
408
|
toggle(key, value) {
|
|
412
|
-
this.
|
|
413
|
-
this.
|
|
409
|
+
this.stage(key === "enabled" ? { enabled: value } : { logEnabled: value });
|
|
410
|
+
void this.commit("judge");
|
|
414
411
|
}
|
|
415
|
-
/** Stage the judgement key
|
|
412
|
+
/** Stage the judgement key; its control commits when focus leaves it or on Enter. */
|
|
416
413
|
key(text) {
|
|
417
|
-
this.
|
|
418
|
-
this.recompute();
|
|
414
|
+
this.stage({ key: { ...this.state.key, text, failed: false, error: "" } });
|
|
419
415
|
}
|
|
420
|
-
/** Stage one cell of one row. */
|
|
416
|
+
/** Stage one cell of one row; a text cell commits on blur, a menu choice at once. */
|
|
421
417
|
cell(index, key, value) {
|
|
422
418
|
const rows = this.state.rows.map((row, at) => at === index ? { ...row, [key]: value } : row);
|
|
423
|
-
this.
|
|
424
|
-
...this.state,
|
|
425
|
-
rows: key === "model" ? this.reconcileEffort(rows, index) : rows,
|
|
426
|
-
saveFailed: ""
|
|
427
|
-
};
|
|
428
|
-
this.recompute();
|
|
419
|
+
this.stage({ rows: key === "model" ? this.reconcileEffort(rows, index) : rows });
|
|
429
420
|
}
|
|
430
421
|
/** Drop an effort the freshly selected model does not declare. */
|
|
431
422
|
reconcileEffort(rows, index) {
|
|
@@ -440,62 +431,63 @@ var DispatchCardStore = class {
|
|
|
440
431
|
}
|
|
441
432
|
return rows;
|
|
442
433
|
}
|
|
443
|
-
/** Append an empty row. */
|
|
434
|
+
/** Append an empty row and write it: a new row is a decision like any other. */
|
|
444
435
|
addRow() {
|
|
445
|
-
this.
|
|
446
|
-
this.
|
|
436
|
+
this.stage({ rows: [...this.state.rows, { description: "", provider: "", model: "", effort: "" }] });
|
|
437
|
+
void this.commit("rows");
|
|
447
438
|
}
|
|
448
439
|
/**
|
|
449
|
-
*
|
|
440
|
+
* Replace the list with an imported one and write it.
|
|
450
441
|
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
442
|
+
* The import dialog's own button is the confirmation, so the list it produces
|
|
443
|
+
* is written at once rather than left as a draft the reader has to commit a
|
|
444
|
+
* second time.
|
|
454
445
|
*
|
|
455
446
|
* @param rows - the rows read from the pasted JSON.
|
|
456
447
|
*/
|
|
457
448
|
replaceRows(rows) {
|
|
458
|
-
this.
|
|
459
|
-
this.
|
|
449
|
+
this.stage({ rows: rows.map((row) => ({ ...row })) });
|
|
450
|
+
void this.commit("rows");
|
|
460
451
|
}
|
|
461
|
-
/** Delete one row; the remaining rows renumber themselves. */
|
|
452
|
+
/** Delete one row and write the rest; the remaining rows renumber themselves. */
|
|
462
453
|
removeRow(index) {
|
|
463
|
-
this.
|
|
464
|
-
this.
|
|
465
|
-
}
|
|
466
|
-
/** Discard one section's drafts back to the committed values. */
|
|
467
|
-
revert(section) {
|
|
468
|
-
const committed = this.state.committed;
|
|
469
|
-
this.state = section === "judge" ? {
|
|
470
|
-
...this.state,
|
|
471
|
-
enabled: committed.enabled,
|
|
472
|
-
logEnabled: committed.logEnabled,
|
|
473
|
-
endpointUrl: committed.endpointUrl,
|
|
474
|
-
judgeModel: committed.judgeModel,
|
|
475
|
-
// 只清掉「还没交出去的那段文本」。密钥已经存在凭据文件里,放弃这一节的
|
|
476
|
-
// 设置草稿不该让页面改口说「还没有密钥」——那是另一处的状态。
|
|
477
|
-
key: { ...this.state.key, text: "", failed: false, error: "", landed: "" },
|
|
478
|
-
saveFailed: ""
|
|
479
|
-
} : { ...this.state, rows: committed.rows, saveFailed: "" };
|
|
480
|
-
this.recompute();
|
|
454
|
+
this.stage({ rows: this.state.rows.filter((_row, at) => at !== index) });
|
|
455
|
+
void this.commit("rows");
|
|
481
456
|
}
|
|
482
457
|
/**
|
|
483
458
|
* Write one section's staged edits as one revision-fenced batch.
|
|
484
459
|
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
460
|
+
* Commits are queued rather than overlapped: the Host fences each write on a
|
|
461
|
+
* revision, and two controls left in quick succession would otherwise have the
|
|
462
|
+
* second write fenced against a revision the first one just replaced. The queue
|
|
463
|
+
* also makes a write read the drafts as they stand when it runs, so a burst of
|
|
464
|
+
* edits coalesces into the fewest writes that still land the latest value.
|
|
465
|
+
*
|
|
466
|
+
* The judgement section also writes a typed key, so leaving the key field and
|
|
467
|
+
* leaving the endpoint field are one kind of gesture. The type rows are written
|
|
468
|
+
* whole rather than diffed: the array is one value, and a positional number is
|
|
469
|
+
* derived from it, so a partial write could momentarily renumber the list under
|
|
470
|
+
* a reader mid-write.
|
|
490
471
|
*
|
|
491
472
|
* @param section - which section's drafts to write.
|
|
473
|
+
* @returns settlement after the write, whether it landed or not.
|
|
492
474
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
475
|
+
commit(section) {
|
|
476
|
+
this.queue = this.queue.then(() => this.write(section)).catch(() => {
|
|
477
|
+
});
|
|
478
|
+
return this.queue;
|
|
479
|
+
}
|
|
480
|
+
/** Write whatever both sections still hold; used when the page is left. */
|
|
481
|
+
flush() {
|
|
482
|
+
return this.commit("judge").then(() => this.commit("rows"));
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* The write itself, run from the queue.
|
|
486
|
+
* @param section - which section's drafts to write.
|
|
487
|
+
*/
|
|
488
|
+
async write(section) {
|
|
495
489
|
const form = this.form;
|
|
496
490
|
if (form === null || !this.state.writable) return;
|
|
497
|
-
if (section === "rows" && (this.state.rowsInvalid !== "" || !this.state.rowsDirty)) return;
|
|
498
|
-
if (section === "judge" && !this.state.judgeDirty) return;
|
|
499
491
|
const ops = [];
|
|
500
492
|
if (section === "judge") {
|
|
501
493
|
if (this.state.endpointUrl !== this.state.committed.endpointUrl) {
|
|
@@ -513,30 +505,38 @@ var DispatchCardStore = class {
|
|
|
513
505
|
} else if (JSON.stringify(this.state.rows) !== JSON.stringify(this.state.committed.rows)) {
|
|
514
506
|
ops.push({ op: "set", path: ["rows"], value: this.state.rows.map((row) => ({ ...row })) });
|
|
515
507
|
}
|
|
516
|
-
this.state = { ...this.state, saving: section, saveFailed: "", saveError: "" };
|
|
517
|
-
this.notify();
|
|
518
508
|
const typedKey = section === "judge" ? this.state.key.text.trim() : "";
|
|
509
|
+
if (ops.length === 0 && typedKey === "") {
|
|
510
|
+
if (this.state.writeFailed === section) {
|
|
511
|
+
this.state = { ...this.state, writeFailed: "", writeError: "" };
|
|
512
|
+
this.notify();
|
|
513
|
+
}
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
this.state = { ...this.state, writing: section, writeFailed: "", writeError: "" };
|
|
517
|
+
this.notify();
|
|
519
518
|
let failure = "";
|
|
520
|
-
let
|
|
519
|
+
let keyFailed = false;
|
|
521
520
|
if (typedKey !== "") {
|
|
522
521
|
const result = await this.writeKey(typedKey);
|
|
523
|
-
if (result.ok)
|
|
524
|
-
|
|
522
|
+
if (!result.ok) {
|
|
523
|
+
failure = result.error;
|
|
524
|
+
keyFailed = true;
|
|
525
|
+
}
|
|
525
526
|
}
|
|
526
527
|
if (failure === "" && ops.length > 0) {
|
|
527
528
|
try {
|
|
528
529
|
const landed = await form.mutate(ops, form.getSnapshot().revision);
|
|
529
|
-
if (!landed) failure = this.translate("
|
|
530
|
+
if (!landed) failure = this.translate("write.refused");
|
|
530
531
|
} catch (error) {
|
|
531
|
-
failure = error instanceof Error && error.message !== "" ? error.message : this.translate("
|
|
532
|
+
failure = error instanceof Error && error.message !== "" ? error.message : this.translate("write.invalid");
|
|
532
533
|
}
|
|
533
534
|
}
|
|
534
535
|
this.state = {
|
|
535
536
|
...this.state,
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
key: keyLanded === "" ? this.state.key : { ...this.state.key, text: "", landed: keyLanded }
|
|
537
|
+
writing: "",
|
|
538
|
+
writeFailed: failure === "" || keyFailed ? "" : section,
|
|
539
|
+
writeError: keyFailed ? "" : failure
|
|
540
540
|
};
|
|
541
541
|
if (failure === "") this.deriveCommitted();
|
|
542
542
|
else this.notify();
|
|
@@ -554,21 +554,24 @@ var DispatchCardStore = class {
|
|
|
554
554
|
async writeKey(value) {
|
|
555
555
|
const credentials = this.credentials;
|
|
556
556
|
if (credentials === null) return { ok: false, error: this.translate("key.unavailable") };
|
|
557
|
-
this.state = { ...this.state, key: { ...this.state.key,
|
|
557
|
+
this.state = { ...this.state, key: { ...this.state.key, writing: true, failed: false, error: "" } };
|
|
558
558
|
this.notify();
|
|
559
559
|
try {
|
|
560
560
|
const response = await credentials.set(JUDGE_API_KEY_REF, value);
|
|
561
561
|
if (!response.ok) {
|
|
562
|
-
const error = response.error.message || this.translate("key.
|
|
563
|
-
this.state = { ...this.state, key: { ...this.state.key,
|
|
562
|
+
const error = response.error.message || this.translate("key.writeFailed");
|
|
563
|
+
this.state = { ...this.state, key: { ...this.state.key, writing: false, failed: true, error } };
|
|
564
564
|
return { ok: false, error };
|
|
565
565
|
}
|
|
566
|
-
this.state = {
|
|
566
|
+
this.state = {
|
|
567
|
+
...this.state,
|
|
568
|
+
key: { ...this.state.key, writing: false, failed: false, error: "", text: "", configured: true }
|
|
569
|
+
};
|
|
567
570
|
await this.refreshKeyStatus();
|
|
568
571
|
return { ok: true, error: "" };
|
|
569
572
|
} catch (error) {
|
|
570
|
-
const message = error instanceof Error && error.message !== "" ? error.message : this.translate("key.
|
|
571
|
-
this.state = { ...this.state, key: { ...this.state.key,
|
|
573
|
+
const message = error instanceof Error && error.message !== "" ? error.message : this.translate("key.writeFailed");
|
|
574
|
+
this.state = { ...this.state, key: { ...this.state.key, writing: false, failed: true, error: message } };
|
|
572
575
|
return { ok: false, error: message };
|
|
573
576
|
}
|
|
574
577
|
}
|
|
@@ -584,7 +587,7 @@ var DispatchCardStore = class {
|
|
|
584
587
|
async clearKey() {
|
|
585
588
|
const credentials = this.credentials;
|
|
586
589
|
if (credentials === null) return;
|
|
587
|
-
this.state = { ...this.state, key: { ...this.state.key,
|
|
590
|
+
this.state = { ...this.state, key: { ...this.state.key, writing: true, failed: false, error: "" } };
|
|
588
591
|
this.notify();
|
|
589
592
|
try {
|
|
590
593
|
const response = await credentials.unset(JUDGE_API_KEY_REF);
|
|
@@ -593,7 +596,7 @@ var DispatchCardStore = class {
|
|
|
593
596
|
...this.state,
|
|
594
597
|
key: {
|
|
595
598
|
...this.state.key,
|
|
596
|
-
|
|
599
|
+
writing: false,
|
|
597
600
|
failed: true,
|
|
598
601
|
error: response.error.message || this.translate("key.clearFailed")
|
|
599
602
|
}
|
|
@@ -601,7 +604,7 @@ var DispatchCardStore = class {
|
|
|
601
604
|
} else {
|
|
602
605
|
this.state = {
|
|
603
606
|
...this.state,
|
|
604
|
-
key: { ...this.state.key,
|
|
607
|
+
key: { ...this.state.key, writing: false, text: "", failed: false, error: "", configured: false }
|
|
605
608
|
};
|
|
606
609
|
await this.refreshKeyStatus();
|
|
607
610
|
}
|
|
@@ -610,7 +613,7 @@ var DispatchCardStore = class {
|
|
|
610
613
|
...this.state,
|
|
611
614
|
key: {
|
|
612
615
|
...this.state.key,
|
|
613
|
-
|
|
616
|
+
writing: false,
|
|
614
617
|
failed: true,
|
|
615
618
|
error: error instanceof Error && error.message !== "" ? error.message : this.translate("key.clearFailed")
|
|
616
619
|
}
|
|
@@ -690,12 +693,10 @@ var en = {
|
|
|
690
693
|
"judge.keySet": "Key stored",
|
|
691
694
|
"judge.keyUnset": "No key",
|
|
692
695
|
"judge.keyClear": "Remove the key",
|
|
693
|
-
"judge.keySaved": "The key is stored.",
|
|
694
|
-
"judge.keyCleared": "The key was removed.",
|
|
695
696
|
"judge.keyFailed": "The key was not stored: {error}",
|
|
696
697
|
"key.unavailable": "The credentials service is unavailable on this page.",
|
|
697
698
|
"judge.keyUnavailable": "This page has no credentials channel, so a key cannot be stored from here.",
|
|
698
|
-
"key.
|
|
699
|
+
"key.writeFailed": "The key was not accepted.",
|
|
699
700
|
"key.clearFailed": "The key was not removed.",
|
|
700
701
|
"judge.probe": "Test the connection",
|
|
701
702
|
"judge.probing": "Testing\u2026",
|
|
@@ -718,9 +719,8 @@ var en = {
|
|
|
718
719
|
"rows.colEffort": "Effort",
|
|
719
720
|
"rows.add": "Add a row",
|
|
720
721
|
"rows.remove": "Remove",
|
|
721
|
-
"rows.
|
|
722
|
-
"rows.
|
|
723
|
-
"rows.browseClose": "Close",
|
|
722
|
+
"rows.hintNoDescription": "No description",
|
|
723
|
+
"rows.hintDuplicateDescription": "Description repeats another row",
|
|
724
724
|
"rows.modelPlaceholder": "Not chosen",
|
|
725
725
|
"rows.effortPlaceholder": "Not chosen",
|
|
726
726
|
"rows.incomplete": "Not used",
|
|
@@ -731,10 +731,11 @@ var en = {
|
|
|
731
731
|
"rows.exported": "Copied the task-type list as JSON.",
|
|
732
732
|
"rows.exportFailed": "Could not copy to the clipboard.",
|
|
733
733
|
"rows.importTitle": "Import the task-type list",
|
|
734
|
-
"rows.importDesc": "Paste the JSON list here. It
|
|
734
|
+
"rows.importDesc": "Paste the JSON list here. It replaces the table below and is written at once.",
|
|
735
735
|
"rows.importPlaceholder": '[\n { "description": "...", "provider": "...", "model": "...", "effort": "..." }\n]',
|
|
736
|
-
"rows.importApply": "
|
|
736
|
+
"rows.importApply": "Replace and write",
|
|
737
737
|
"rows.importCancel": "Cancel",
|
|
738
|
+
"rows.importClose": "Close",
|
|
738
739
|
"rows.importBadJson": "This is not valid JSON.",
|
|
739
740
|
"rows.importBadShape": "This is not a list of task types: every entry needs description, provider, model and effort as text.",
|
|
740
741
|
"rows.importEmpty": "There is no task type in this list.",
|
|
@@ -744,18 +745,10 @@ var en = {
|
|
|
744
745
|
"preview.copy": "Copy",
|
|
745
746
|
"preview.copied": "Copied",
|
|
746
747
|
"preview.close": "Close",
|
|
747
|
-
"preview.blocked": "Save your changes first.",
|
|
748
748
|
"preview.failed": "The preview could not be read.",
|
|
749
|
-
"
|
|
750
|
-
"
|
|
751
|
-
"
|
|
752
|
-
"save.discard": "Discard",
|
|
753
|
-
"save.refusedTitle": "This cannot be saved yet",
|
|
754
|
-
"save.failed": "The save did not land: {error}",
|
|
755
|
-
"save.duplicateDescription": "Two rows have the same description. Give them different descriptions before saving.",
|
|
756
|
-
"save.emptyDescription": "Every row needs a description before it can be saved.",
|
|
757
|
-
"save.invalid": "This cannot be saved yet.",
|
|
758
|
-
"save.refused": "The host did not accept this write.",
|
|
749
|
+
"write.failed": "The write did not land: {error}",
|
|
750
|
+
"write.invalid": "This could not be written.",
|
|
751
|
+
"write.refused": "The host did not accept this write.",
|
|
759
752
|
"log.title": "Judgement log",
|
|
760
753
|
"log.desc": "The most recent 10 judgements, newest first; the file keeps more. Click one to see the exact prompt that was sent.",
|
|
761
754
|
"log.empty": "No judgement has run yet.",
|
|
@@ -795,12 +788,10 @@ var zh = {
|
|
|
795
788
|
"judge.keySet": "\u5DF2\u5B58\u5BC6\u94A5",
|
|
796
789
|
"judge.keyUnset": "\u8FD8\u6CA1\u6709\u5BC6\u94A5",
|
|
797
790
|
"judge.keyClear": "\u5220\u6389\u5BC6\u94A5",
|
|
798
|
-
"judge.keySaved": "\u5BC6\u94A5\u5DF2\u5B58\u3002",
|
|
799
|
-
"judge.keyCleared": "\u5BC6\u94A5\u5DF2\u5220\u6389\u3002",
|
|
800
791
|
"judge.keyFailed": "\u5BC6\u94A5\u6CA1\u5B58\u4E0A\uFF1A{error}",
|
|
801
792
|
"key.unavailable": "\u8FD9\u4E2A\u9875\u9762\u4E0A\u7528\u4E0D\u4E86\u51ED\u636E\u670D\u52A1\u3002",
|
|
802
793
|
"judge.keyUnavailable": "\u8FD9\u4E2A\u9875\u9762\u4E0A\u6CA1\u6709\u51ED\u636E\u901A\u9053\uFF0C\u5728\u8FD9\u91CC\u5B58\u4E0D\u4E86\u5BC6\u94A5\u3002",
|
|
803
|
-
"key.
|
|
794
|
+
"key.writeFailed": "\u5BC6\u94A5\u6CA1\u88AB\u63A5\u53D7\u3002",
|
|
804
795
|
"key.clearFailed": "\u5BC6\u94A5\u6CA1\u5220\u6389\u3002",
|
|
805
796
|
"judge.probe": "\u8BD5\u4E00\u4E0B\u901A\u4E0D\u901A",
|
|
806
797
|
"judge.probing": "\u6B63\u5728\u8BD5\u2026",
|
|
@@ -823,9 +814,8 @@ var zh = {
|
|
|
823
814
|
"rows.colEffort": "\u5F3A\u5EA6",
|
|
824
815
|
"rows.add": "\u52A0\u4E00\u884C",
|
|
825
816
|
"rows.remove": "\u5220\u6389",
|
|
826
|
-
"rows.
|
|
827
|
-
"rows.
|
|
828
|
-
"rows.browseClose": "\u5173\u95ED",
|
|
817
|
+
"rows.hintNoDescription": "\u6CA1\u6709\u63CF\u8FF0",
|
|
818
|
+
"rows.hintDuplicateDescription": "\u63CF\u8FF0\u548C\u522B\u7684\u884C\u91CD\u590D",
|
|
829
819
|
"rows.modelPlaceholder": "\u8FD8\u6CA1\u9009",
|
|
830
820
|
"rows.effortPlaceholder": "\u8FD8\u6CA1\u9009",
|
|
831
821
|
"rows.incomplete": "\u4E0D\u751F\u6548",
|
|
@@ -836,10 +826,11 @@ var zh = {
|
|
|
836
826
|
"rows.exported": "\u5DF2\u7ECF\u628A\u4EFB\u52A1\u7C7B\u578B\u6E05\u5355\u6309 JSON \u590D\u5236\u8D70\u4E86\u3002",
|
|
837
827
|
"rows.exportFailed": "\u590D\u5236\u5230\u526A\u8D34\u677F\u6CA1\u6210\u529F\u3002",
|
|
838
828
|
"rows.importTitle": "\u5BFC\u5165\u4EFB\u52A1\u7C7B\u578B",
|
|
839
|
-
"rows.importDesc": "\u628A JSON \u6E05\u5355\u7C98\u8D34\u5230\u8FD9\u91CC\u3002\u5B83\
|
|
829
|
+
"rows.importDesc": "\u628A JSON \u6E05\u5355\u7C98\u8D34\u5230\u8FD9\u91CC\u3002\u5B83\u4F1A\u66FF\u6362\u4E0B\u9762\u90A3\u5F20\u8868\uFF0C\u5E76\u7ACB\u5373\u5199\u5165\u3002",
|
|
840
830
|
"rows.importPlaceholder": '[\n { "description": "\u2026\u2026", "provider": "\u2026\u2026", "model": "\u2026\u2026", "effort": "\u2026\u2026" }\n]',
|
|
841
|
-
"rows.importApply": "\
|
|
831
|
+
"rows.importApply": "\u66FF\u6362\u5E76\u5199\u5165",
|
|
842
832
|
"rows.importCancel": "\u53D6\u6D88",
|
|
833
|
+
"rows.importClose": "\u5173\u95ED",
|
|
843
834
|
"rows.importBadJson": "\u8FD9\u4E0D\u662F\u5408\u6CD5\u7684 JSON\u3002",
|
|
844
835
|
"rows.importBadShape": "\u8FD9\u4E0D\u662F\u4E00\u4EFD\u4EFB\u52A1\u7C7B\u578B\u6E05\u5355\uFF1A\u6BCF\u4E00\u6761\u90FD\u8981\u6709 description\u3001provider\u3001model\u3001effort \u56DB\u4E2A\u6587\u5B57\u5B57\u6BB5\u3002",
|
|
845
836
|
"rows.importEmpty": "\u8FD9\u4EFD\u6E05\u5355\u91CC\u4E00\u6761\u4EFB\u52A1\u7C7B\u578B\u90FD\u6CA1\u6709\u3002",
|
|
@@ -849,18 +840,10 @@ var zh = {
|
|
|
849
840
|
"preview.copy": "\u590D\u5236",
|
|
850
841
|
"preview.copied": "\u5DF2\u590D\u5236",
|
|
851
842
|
"preview.close": "\u5173\u95ED",
|
|
852
|
-
"preview.blocked": "\u5148\u628A\u6539\u52A8\u4FDD\u5B58\u4E0B\u6765\u3002",
|
|
853
843
|
"preview.failed": "\u9884\u89C8\u8BFB\u4E0D\u51FA\u6765\u3002",
|
|
854
|
-
"
|
|
855
|
-
"
|
|
856
|
-
"
|
|
857
|
-
"save.discard": "\u653E\u5F03\u6539\u52A8",
|
|
858
|
-
"save.refusedTitle": "\u73B0\u5728\u8FD8\u5B58\u4E0D\u4E86",
|
|
859
|
-
"save.failed": "\u6CA1\u4FDD\u5B58\u4E0A\uFF1A{error}",
|
|
860
|
-
"save.duplicateDescription": "\u6709\u4E24\u6761\u7684\u63CF\u8FF0\u4E00\u6A21\u4E00\u6837\u3002\u6539\u6210\u4E0D\u4E00\u6837\u7684\u518D\u4FDD\u5B58\u3002",
|
|
861
|
-
"save.emptyDescription": "\u6BCF\u4E00\u884C\u90FD\u8981\u6709\u63CF\u8FF0\u624D\u80FD\u4FDD\u5B58\u3002",
|
|
862
|
-
"save.invalid": "\u73B0\u5728\u8FD8\u5B58\u4E0D\u4E86\u3002",
|
|
863
|
-
"save.refused": "\u5BBF\u4E3B\u6CA1\u6709\u63A5\u53D7\u8FD9\u6B21\u5199\u5165\u3002",
|
|
844
|
+
"write.failed": "\u6CA1\u5199\u8FDB\u53BB\uFF1A{error}",
|
|
845
|
+
"write.invalid": "\u8FD9\u6B21\u5199\u5165\u6CA1\u88AB\u63A5\u53D7\u3002",
|
|
846
|
+
"write.refused": "\u5BBF\u4E3B\u6CA1\u6709\u63A5\u53D7\u8FD9\u6B21\u5199\u5165\u3002",
|
|
864
847
|
"log.title": "\u5224\u65AD\u65E5\u5FD7",
|
|
865
848
|
"log.desc": "\u6700\u8FD1 10 \u6761\u5224\u65AD\uFF0C\u65B0\u7684\u5728\u6700\u524D\u9762\uFF1B\u6587\u4EF6\u91CC\u7559\u5F97\u66F4\u591A\u3002\u70B9\u4E00\u884C\u770B\u8FD9\u6B21\u53D1\u7ED9\u5224\u65AD\u6A21\u578B\u7684\u90A3\u6BB5\u5185\u5BB9\u3002",
|
|
866
849
|
"log.empty": "\u8FD8\u6CA1\u6709\u5224\u65AD\u8FC7\u3002",
|
|
@@ -930,12 +913,10 @@ var CARD_CSS = `
|
|
|
930
913
|
.dsh-judge-field { display: flex; box-sizing: border-box; width: 100%; min-width: 0; }
|
|
931
914
|
.dsh-judge-field input { box-sizing: border-box; width: 100%; min-width: 0; }
|
|
932
915
|
.dsh-judge-key-line { display: flex; align-items: center; gap: 8px; box-sizing: border-box; width: 100%; }
|
|
933
|
-
.dsh-judge-off { display: block; color: var(--dsw-alias-state-warn-label); font: var(--dsw-font-xxxs-11);
|
|
934
|
-
/* \
|
|
935
|
-
.dsh-judge-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 0.5px solid var(--dsw-alias-border-l3); }
|
|
916
|
+
.dsh-judge-off { display: block; color: var(--dsw-alias-state-warn-label); font: var(--dsw-font-xxxs-11); }
|
|
917
|
+
/* \u6807\u9898\u884C\u53F3\u7AEF\u7684\u4E00\u7EC4\u52A8\u4F5C\uFF1A\u8BD5\u901A\u3001\u5BFC\u5165\u3001\u5BFC\u51FA\u3001\u52A0\u4E00\u884C\u90FD\u6392\u5728\u8FD9\u91CC\u3002 */
|
|
936
918
|
.dsh-judge-actions-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
937
|
-
/* \u5361\u7247\u6700\u4E0B\u9762\u7684\u51FA\u53E3\uFF1A\u53EA\u6709\u9884\u89C8\u8FD9\u4E00\u4EF6\u8DE8\u8282\u7684\u52A8\u4F5C\uFF0C\u9760\u53F3\u4E0E\u4E24\u8282\u7684\u53F3\u8FB9\u7F18\u5BF9\u9F50\
|
|
938
|
-
\u5B58\u4E0B\u53BB\u65F6\uFF0C\u90A3\u53E5\u63D0\u9192\u5728\u5B83\u5DE6\u8FB9\u3002 */
|
|
919
|
+
/* \u5361\u7247\u6700\u4E0B\u9762\u7684\u51FA\u53E3\uFF1A\u53EA\u6709\u9884\u89C8\u8FD9\u4E00\u4EF6\u8DE8\u8282\u7684\u52A8\u4F5C\uFF0C\u9760\u53F3\u4E0E\u4E24\u8282\u7684\u53F3\u8FB9\u7F18\u5BF9\u9F50\u3002 */
|
|
939
920
|
.dsh-judge-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
|
|
940
921
|
.dsh-judge-hint { color: var(--dsw-alias-label-tertiary); font: var(--dsw-font-xxs-12); }
|
|
941
922
|
.dsh-judge-note-ok { color: var(--dsw-alias-state-success-primary); font: var(--dsw-font-xxs-12); }
|
|
@@ -952,10 +933,10 @@ var CARD_CSS = `
|
|
|
952
933
|
.dsh-judge-table td { padding: 6px 8px 6px 0; vertical-align: middle; }
|
|
953
934
|
.dsh-judge-table tbody tr + tr td { border-top: 0.5px solid var(--dsw-alias-border-l3); }
|
|
954
935
|
.dsh-judge-table td:last-child, .dsh-judge-table th:last-child { padding-right: 0; }
|
|
955
|
-
.dsh-judge-col-no { width:
|
|
936
|
+
.dsh-judge-col-no { width: 84px; }
|
|
956
937
|
.dsh-judge-col-model { width: 188px; }
|
|
957
938
|
.dsh-judge-col-effort { width: 124px; }
|
|
958
|
-
.dsh-judge-col-actions { width:
|
|
939
|
+
.dsh-judge-col-actions { width: 96px; }
|
|
959
940
|
.dsh-judge-no { color: var(--dsw-alias-label-tertiary); font: var(--dsw-font-xxs-12); font-variant-numeric: tabular-nums; }
|
|
960
941
|
.dsh-judge-row-off .dsh-judge-field { opacity: 0.6; }
|
|
961
942
|
.dsh-judge-cell-actions { display: flex; gap: 6px; }
|
|
@@ -992,20 +973,22 @@ function JudgeDispatchPanel(props) {
|
|
|
992
973
|
const { t } = props;
|
|
993
974
|
const [state, setState] = (0, import_react.useState)(() => dispatchCardStore.getState());
|
|
994
975
|
const [tab, setTab] = (0, import_react.useState)("design");
|
|
995
|
-
const [browsing, setBrowsing] = (0, import_react.useState)(null);
|
|
996
976
|
const [preview, setPreview] = (0, import_react.useState)(null);
|
|
997
977
|
const [previewOpen, setPreviewOpen] = (0, import_react.useState)(false);
|
|
998
978
|
const [probing, setProbing] = (0, import_react.useState)(false);
|
|
999
979
|
const [probeResult, setProbeResult] = (0, import_react.useState)(null);
|
|
1000
980
|
const [detail, setDetail] = (0, import_react.useState)(null);
|
|
1001
981
|
const [openMenu, setOpenMenu] = (0, import_react.useState)(null);
|
|
1002
|
-
const [refusal, setRefusal] = (0, import_react.useState)(null);
|
|
1003
982
|
const [importText, setImportText] = (0, import_react.useState)(null);
|
|
1004
983
|
const [importError, setImportError] = (0, import_react.useState)("");
|
|
1005
984
|
const [copyNote, setCopyNote] = (0, import_react.useState)(null);
|
|
1006
985
|
(0, import_react.useEffect)(() => {
|
|
1007
986
|
setState(dispatchCardStore.getState());
|
|
1008
|
-
|
|
987
|
+
const unsubscribe = dispatchCardStore.subscribe(() => setState(dispatchCardStore.getState()));
|
|
988
|
+
return () => {
|
|
989
|
+
unsubscribe();
|
|
990
|
+
void dispatchCardStore.flush();
|
|
991
|
+
};
|
|
1009
992
|
}, []);
|
|
1010
993
|
(0, import_react.useEffect)(() => {
|
|
1011
994
|
if (tab === "log") void dispatchCardStore.refreshLog();
|
|
@@ -1016,14 +999,8 @@ function JudgeDispatchPanel(props) {
|
|
|
1016
999
|
setProbeResult(await dispatchCardStore.probe());
|
|
1017
1000
|
setProbing(false);
|
|
1018
1001
|
};
|
|
1019
|
-
const saveRows = () => {
|
|
1020
|
-
if (state.rowsInvalid !== "") {
|
|
1021
|
-
setRefusal(state.rowsInvalid);
|
|
1022
|
-
return;
|
|
1023
|
-
}
|
|
1024
|
-
void dispatchCardStore.save("rows");
|
|
1025
|
-
};
|
|
1026
1002
|
const openPreview = async () => {
|
|
1003
|
+
await dispatchCardStore.flush();
|
|
1027
1004
|
const text = await dispatchCardStore.preview();
|
|
1028
1005
|
setPreview(text ?? t("preview.failed"));
|
|
1029
1006
|
setPreviewOpen(true);
|
|
@@ -1047,33 +1024,9 @@ function JudgeDispatchPanel(props) {
|
|
|
1047
1024
|
setImportText(null);
|
|
1048
1025
|
setImportError("");
|
|
1049
1026
|
};
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
import_dsh_client_ui_primitives.Button,
|
|
1054
|
-
{
|
|
1055
|
-
variant: "primary",
|
|
1056
|
-
size: "sm",
|
|
1057
|
-
disabled: state.saving !== "" || !dirty || !state.writable,
|
|
1058
|
-
onClick: onSave,
|
|
1059
|
-
children: state.saving === section ? t("save.saving") : t("save.button")
|
|
1060
|
-
}
|
|
1061
|
-
),
|
|
1062
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1063
|
-
import_dsh_client_ui_primitives.Button,
|
|
1064
|
-
{
|
|
1065
|
-
variant: "outline",
|
|
1066
|
-
size: "sm",
|
|
1067
|
-
disabled: state.saving !== "" || !dirty,
|
|
1068
|
-
onClick: () => dispatchCardStore.revert(section),
|
|
1069
|
-
children: t("save.discard")
|
|
1070
|
-
}
|
|
1071
|
-
),
|
|
1072
|
-
dirty && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-hint", children: t("save.unsaved") }),
|
|
1073
|
-
state.saveFailed === section && state.saveError !== "" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-note-bad", role: "alert", children: t("save.failed").replace("{error}", state.saveError) })
|
|
1074
|
-
] }),
|
|
1075
|
-
checks !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-actions-group", children: checks })
|
|
1076
|
-
] });
|
|
1027
|
+
const commitJudge = () => void dispatchCardStore.commit("judge");
|
|
1028
|
+
const commitRows = () => void dispatchCardStore.commit("rows");
|
|
1029
|
+
const failure = (section) => state.writeFailed === section && state.writeError !== "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-note-bad", role: "alert", children: t("write.failed").replace("{error}", state.writeError) }) : null;
|
|
1077
1030
|
const row = (draft, index) => {
|
|
1078
1031
|
const efforts = dispatchCardStore.effortsFor(draft);
|
|
1079
1032
|
const usable = dispatchCardStore.rowUsable(draft);
|
|
@@ -1081,7 +1034,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1081
1034
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { className: usable ? void 0 : "dsh-judge-row-off", children: [
|
|
1082
1035
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { className: "dsh-judge-col-no", children: [
|
|
1083
1036
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-no", children: index + 1 }),
|
|
1084
|
-
|
|
1037
|
+
rowHints(state.rows, index, t).map((hint) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-off", children: hint }, hint))
|
|
1085
1038
|
] }),
|
|
1086
1039
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1087
1040
|
import_dsh_client_ui_primitives.Input,
|
|
@@ -1091,7 +1044,8 @@ function JudgeDispatchPanel(props) {
|
|
|
1091
1044
|
value: draft.description,
|
|
1092
1045
|
placeholder: t("rows.descriptionPlaceholder"),
|
|
1093
1046
|
"aria-label": `${t("rows.colDescription")} ${index + 1}`,
|
|
1094
|
-
onChange: (event) => dispatchCardStore.cell(index, "description", event.target.value)
|
|
1047
|
+
onChange: (event) => dispatchCardStore.cell(index, "description", event.target.value),
|
|
1048
|
+
onBlur: commitRows
|
|
1095
1049
|
}
|
|
1096
1050
|
) }),
|
|
1097
1051
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1126,6 +1080,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1126
1080
|
dispatchCardStore.cell(index, "provider", provider);
|
|
1127
1081
|
dispatchCardStore.cell(index, "model", model);
|
|
1128
1082
|
setOpenMenu(null);
|
|
1083
|
+
commitRows();
|
|
1129
1084
|
},
|
|
1130
1085
|
onClose: () => setOpenMenu(null),
|
|
1131
1086
|
className: "dsh-judge-field-wrap",
|
|
@@ -1159,6 +1114,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1159
1114
|
onSelect: (id) => {
|
|
1160
1115
|
dispatchCardStore.cell(index, "effort", id);
|
|
1161
1116
|
setOpenMenu(null);
|
|
1117
|
+
commitRows();
|
|
1162
1118
|
},
|
|
1163
1119
|
onClose: () => setOpenMenu(null),
|
|
1164
1120
|
className: "dsh-judge-field-wrap",
|
|
@@ -1172,36 +1128,37 @@ function JudgeDispatchPanel(props) {
|
|
|
1172
1128
|
value: draft.effort,
|
|
1173
1129
|
placeholder: t("rows.effortPlaceholder"),
|
|
1174
1130
|
"aria-label": `${t("rows.colEffort")} ${index + 1}`,
|
|
1175
|
-
onChange: (event) => dispatchCardStore.cell(index, "effort", event.target.value)
|
|
1131
|
+
onChange: (event) => dispatchCardStore.cell(index, "effort", event.target.value),
|
|
1132
|
+
onBlur: commitRows
|
|
1176
1133
|
}
|
|
1177
1134
|
) }),
|
|
1178
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "dsh-judge-col-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "dsh-judge-col-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-cell-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1136
|
+
import_dsh_client_ui_primitives.Button,
|
|
1137
|
+
{
|
|
1138
|
+
variant: "outline",
|
|
1139
|
+
size: "sm",
|
|
1140
|
+
"aria-label": `${t("rows.remove")} ${index + 1}`,
|
|
1141
|
+
onClick: () => dispatchCardStore.removeRow(index),
|
|
1142
|
+
children: t("rows.remove")
|
|
1143
|
+
}
|
|
1144
|
+
) }) })
|
|
1145
|
+
] }, index);
|
|
1146
|
+
};
|
|
1147
|
+
const design = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-panel", children: [
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-section", children: [
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-head", children: [
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-title", children: t("judge.title") }),
|
|
1189
1151
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1190
1152
|
import_dsh_client_ui_primitives.Button,
|
|
1191
1153
|
{
|
|
1192
1154
|
variant: "outline",
|
|
1193
1155
|
size: "sm",
|
|
1194
|
-
|
|
1195
|
-
onClick: () =>
|
|
1196
|
-
children: t("
|
|
1156
|
+
disabled: probing || state.writing !== "",
|
|
1157
|
+
onClick: () => void runProbe(),
|
|
1158
|
+
children: probing ? t("judge.probing") : t("judge.probe")
|
|
1197
1159
|
}
|
|
1198
1160
|
)
|
|
1199
|
-
] })
|
|
1200
|
-
] }, index);
|
|
1201
|
-
};
|
|
1202
|
-
const design = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-panel", children: [
|
|
1203
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-section", children: [
|
|
1204
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-head", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-title", children: t("judge.title") }) }),
|
|
1161
|
+
] }),
|
|
1205
1162
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-desc", children: t("judge.desc") }),
|
|
1206
1163
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-row", children: [
|
|
1207
1164
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-row-info", children: [
|
|
@@ -1214,7 +1171,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1214
1171
|
checked: state.enabled,
|
|
1215
1172
|
onChange: (next) => dispatchCardStore.toggle("enabled", next),
|
|
1216
1173
|
label: t("switch.rewrite.title"),
|
|
1217
|
-
disabled: !state.writable
|
|
1174
|
+
disabled: !state.writable
|
|
1218
1175
|
}
|
|
1219
1176
|
)
|
|
1220
1177
|
] }),
|
|
@@ -1229,7 +1186,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1229
1186
|
checked: state.logEnabled,
|
|
1230
1187
|
onChange: (next) => dispatchCardStore.toggle("logEnabled", next),
|
|
1231
1188
|
label: t("switch.log.title"),
|
|
1232
|
-
disabled: !state.writable
|
|
1189
|
+
disabled: !state.writable
|
|
1233
1190
|
}
|
|
1234
1191
|
)
|
|
1235
1192
|
] }),
|
|
@@ -1246,7 +1203,9 @@ function JudgeDispatchPanel(props) {
|
|
|
1246
1203
|
value: state.endpointUrl,
|
|
1247
1204
|
placeholder: "http://127.0.0.1:3425/v1/systemone",
|
|
1248
1205
|
"aria-label": t("judge.endpoint"),
|
|
1249
|
-
|
|
1206
|
+
disabled: !state.writable,
|
|
1207
|
+
onChange: (event) => dispatchCardStore.field("endpointUrl", event.target.value),
|
|
1208
|
+
onBlur: commitJudge
|
|
1250
1209
|
}
|
|
1251
1210
|
) })
|
|
1252
1211
|
] }),
|
|
@@ -1263,7 +1222,9 @@ function JudgeDispatchPanel(props) {
|
|
|
1263
1222
|
value: state.judgeModel,
|
|
1264
1223
|
placeholder: "future-jev/jev-latest",
|
|
1265
1224
|
"aria-label": t("judge.model"),
|
|
1266
|
-
|
|
1225
|
+
disabled: !state.writable,
|
|
1226
|
+
onChange: (event) => dispatchCardStore.field("judgeModel", event.target.value),
|
|
1227
|
+
onBlur: commitJudge
|
|
1267
1228
|
}
|
|
1268
1229
|
) })
|
|
1269
1230
|
] }),
|
|
@@ -1282,8 +1243,14 @@ function JudgeDispatchPanel(props) {
|
|
|
1282
1243
|
value: state.key.text,
|
|
1283
1244
|
placeholder: state.key.configured ? t("judge.keyPlaceholderSet") : t("judge.keyPlaceholder"),
|
|
1284
1245
|
"aria-label": t("judge.key"),
|
|
1285
|
-
disabled: state.key.unavailable,
|
|
1286
|
-
onChange: (event) => dispatchCardStore.key(event.target.value)
|
|
1246
|
+
disabled: state.key.unavailable || !state.writable,
|
|
1247
|
+
onChange: (event) => dispatchCardStore.key(event.target.value),
|
|
1248
|
+
onBlur: commitJudge,
|
|
1249
|
+
onKeyDown: (event) => {
|
|
1250
|
+
if (event.key !== "Enter") return;
|
|
1251
|
+
event.preventDefault();
|
|
1252
|
+
commitJudge();
|
|
1253
|
+
}
|
|
1287
1254
|
}
|
|
1288
1255
|
),
|
|
1289
1256
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-key-line", children: [
|
|
@@ -1293,32 +1260,28 @@ function JudgeDispatchPanel(props) {
|
|
|
1293
1260
|
{
|
|
1294
1261
|
variant: "outline",
|
|
1295
1262
|
size: "sm",
|
|
1296
|
-
disabled: state.key.
|
|
1263
|
+
disabled: state.key.writing || !state.key.writable,
|
|
1297
1264
|
onClick: () => void dispatchCardStore.clearKey(),
|
|
1298
1265
|
children: t("judge.keyClear")
|
|
1299
1266
|
}
|
|
1300
1267
|
),
|
|
1301
1268
|
state.key.unavailable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-hint", children: t("judge.keyUnavailable") }),
|
|
1302
|
-
state.key.
|
|
1303
|
-
state.key.landed === "cleared" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-note-ok", children: t("judge.keyCleared") }),
|
|
1304
|
-
state.key.failed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-note-bad", role: "alert", children: t("judge.keyFailed").replace("{error}", state.key.error || t("save.invalid")) })
|
|
1269
|
+
state.key.failed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-note-bad", role: "alert", children: t("judge.keyFailed").replace("{error}", state.key.error || t("write.invalid")) })
|
|
1305
1270
|
] })
|
|
1306
1271
|
] })
|
|
1307
1272
|
] }),
|
|
1308
1273
|
probeResult !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: probeResult.ok ? "dsh-judge-note-ok" : "dsh-judge-note-bad", children: probeResult.ok ? t("judge.probeOk").replace("{latency}", String(probeResult.latencyMs)) : t("judge.probeFail").replace("{reason}", reasonText(probeResult.reason)) }),
|
|
1309
|
-
|
|
1310
|
-
import_dsh_client_ui_primitives.Button,
|
|
1311
|
-
{
|
|
1312
|
-
variant: "outline",
|
|
1313
|
-
size: "sm",
|
|
1314
|
-
disabled: probing || state.dirty,
|
|
1315
|
-
onClick: () => void runProbe(),
|
|
1316
|
-
children: probing ? t("judge.probing") : t("judge.probe")
|
|
1317
|
-
}
|
|
1318
|
-
))
|
|
1274
|
+
failure("judge")
|
|
1319
1275
|
] }),
|
|
1320
1276
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-section", children: [
|
|
1321
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-head", children: [
|
|
1278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-title", children: t("rows.title") }),
|
|
1279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-actions-group", children: [
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: openImport, children: t("rows.importOpen") }),
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => void exportRows(), children: t("rows.export") }),
|
|
1282
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => dispatchCardStore.addRow(), children: t("rows.add") })
|
|
1283
|
+
] })
|
|
1284
|
+
] }),
|
|
1322
1285
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-desc", children: t("rows.desc") }),
|
|
1323
1286
|
state.models.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-off", children: t("rows.allowedEmpty") }),
|
|
1324
1287
|
state.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-desc", children: t("rows.empty") }),
|
|
@@ -1332,27 +1295,10 @@ function JudgeDispatchPanel(props) {
|
|
|
1332
1295
|
] }) }),
|
|
1333
1296
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: state.rows.map((draft, index) => row(draft, index)) })
|
|
1334
1297
|
] }),
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: openImport, children: t("rows.importOpen") }),
|
|
1338
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => void exportRows(), children: t("rows.export") }),
|
|
1339
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => dispatchCardStore.addRow(), children: t("rows.add") }),
|
|
1340
|
-
copyNote !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: copyNote.ok ? "dsh-judge-note-ok" : "dsh-judge-note-bad", role: "status", children: copyNote.text })
|
|
1341
|
-
] }))
|
|
1298
|
+
copyNote !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: copyNote.ok ? "dsh-judge-note-ok" : "dsh-judge-note-bad", role: "status", children: copyNote.text }),
|
|
1299
|
+
failure("rows")
|
|
1342
1300
|
] }),
|
|
1343
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1344
|
-
state.dirty && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-hint", children: t("preview.blocked") }),
|
|
1345
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1346
|
-
import_dsh_client_ui_primitives.Button,
|
|
1347
|
-
{
|
|
1348
|
-
variant: "outline",
|
|
1349
|
-
size: "sm",
|
|
1350
|
-
disabled: state.dirty,
|
|
1351
|
-
onClick: () => void openPreview(),
|
|
1352
|
-
children: t("preview.open")
|
|
1353
|
-
}
|
|
1354
|
-
)
|
|
1355
|
-
] })
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-footer", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => void openPreview(), children: t("preview.open") }) })
|
|
1356
1302
|
] });
|
|
1357
1303
|
const log = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-panel", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-section", children: [
|
|
1358
1304
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-head", children: [
|
|
@@ -1405,21 +1351,14 @@ function JudgeDispatchPanel(props) {
|
|
|
1405
1351
|
{ value: "log", label: t("tab.log"), id: "judge-tab-log", panelId: "judge-panel-log" }
|
|
1406
1352
|
],
|
|
1407
1353
|
value: tab,
|
|
1408
|
-
onChange:
|
|
1354
|
+
onChange: (next) => {
|
|
1355
|
+
void dispatchCardStore.flush();
|
|
1356
|
+
setTab(next);
|
|
1357
|
+
},
|
|
1409
1358
|
label: t("tab.design")
|
|
1410
1359
|
}
|
|
1411
1360
|
),
|
|
1412
1361
|
tab === "design" ? design : log,
|
|
1413
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1414
|
-
import_dsh_client_ui_primitives.Modal,
|
|
1415
|
-
{
|
|
1416
|
-
open: refusal !== null,
|
|
1417
|
-
onClose: () => setRefusal(null),
|
|
1418
|
-
title: t("save.refusedTitle"),
|
|
1419
|
-
closeLabel: t("rows.browseClose"),
|
|
1420
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-note-bad", role: "alert", children: refusal ?? "" })
|
|
1421
|
-
}
|
|
1422
|
-
),
|
|
1423
1362
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1424
1363
|
import_dsh_client_ui_primitives.Modal,
|
|
1425
1364
|
{
|
|
@@ -1440,7 +1379,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1440
1379
|
open: importText !== null,
|
|
1441
1380
|
onClose: () => setImportText(null),
|
|
1442
1381
|
title: t("rows.importTitle"),
|
|
1443
|
-
closeLabel: t("rows.
|
|
1382
|
+
closeLabel: t("rows.importClose"),
|
|
1444
1383
|
description: t("rows.importDesc"),
|
|
1445
1384
|
className: "dsh-judge-modal",
|
|
1446
1385
|
footer: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -1467,16 +1406,6 @@ function JudgeDispatchPanel(props) {
|
|
|
1467
1406
|
]
|
|
1468
1407
|
}
|
|
1469
1408
|
),
|
|
1470
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1471
|
-
import_dsh_client_ui_primitives.Modal,
|
|
1472
|
-
{
|
|
1473
|
-
open: browsing !== null,
|
|
1474
|
-
onClose: () => setBrowsing(null),
|
|
1475
|
-
title: t("rows.browseTitle").replace("{id}", String((browsing ?? 0) + 1)),
|
|
1476
|
-
closeLabel: t("rows.browseClose"),
|
|
1477
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-desc", style: { whiteSpace: "pre-wrap" }, children: browsing === null ? "" : state.rows[browsing]?.description ?? "" })
|
|
1478
|
-
}
|
|
1479
|
-
),
|
|
1480
1409
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1481
1410
|
import_dsh_client_ui_primitives.Modal,
|
|
1482
1411
|
{
|