@lynn123411/dsh-subagent-judge-dispatch 0.6.3 → 0.6.5
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.md +135 -13
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/preview.svg +63 -0
- package/docs/preview.zh.svg +63 -0
- package/lib/client.js +211 -117
- package/lib/client.js.map +2 -2
- package/lib/index.js +23 -9
- package/lib/index.js.map +2 -2
- package/locale/en.json +2 -1
- package/locale/zh.json +2 -1
- package/package.json +2 -2
- package/DETAILS.md +0 -98
package/lib/client.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "@lynn123411/dsh-subagent-judge-dispatch", factory: (require) => { var module = { exports: {} }; var exports = module.exports;
|
|
2
2
|
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
9
|
var __export = (target, all) => {
|
|
8
10
|
for (var name2 in all)
|
|
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
18
|
}
|
|
17
19
|
return to;
|
|
18
20
|
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
19
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
30
|
|
|
21
31
|
// src/client/index.ts
|
|
@@ -44,6 +54,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
44
54
|
|
|
45
55
|
// src/client/settings/ui.tsx
|
|
46
56
|
var import_react = require("react");
|
|
57
|
+
var React = __toESM(require("react"), 1);
|
|
47
58
|
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
48
59
|
|
|
49
60
|
// src/client/settings/plugin-page.ts
|
|
@@ -146,7 +157,8 @@ function readRow(value) {
|
|
|
146
157
|
description: text("description"),
|
|
147
158
|
provider: text("provider"),
|
|
148
159
|
model: text("model"),
|
|
149
|
-
effort: text("effort")
|
|
160
|
+
effort: text("effort"),
|
|
161
|
+
enabled: record.enabled !== false
|
|
150
162
|
};
|
|
151
163
|
}
|
|
152
164
|
function describeModel(row) {
|
|
@@ -216,7 +228,8 @@ function exportRowsJson(rows) {
|
|
|
216
228
|
description: row.description,
|
|
217
229
|
provider: row.provider,
|
|
218
230
|
model: row.model,
|
|
219
|
-
effort: row.effort
|
|
231
|
+
effort: row.effort,
|
|
232
|
+
enabled: row.enabled
|
|
220
233
|
})),
|
|
221
234
|
null,
|
|
222
235
|
2
|
|
@@ -239,13 +252,14 @@ function parseRowsJson(text) {
|
|
|
239
252
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return { ok: false, error: "shape" };
|
|
240
253
|
const record = value;
|
|
241
254
|
const wrongType = ["description", "provider", "model", "effort"].some((key) => record[key] !== void 0 && typeof record[key] !== "string");
|
|
242
|
-
if (wrongType) return { ok: false, error: "shape" };
|
|
255
|
+
if (wrongType || record.enabled !== void 0 && typeof record.enabled !== "boolean") return { ok: false, error: "shape" };
|
|
243
256
|
const field = (key) => typeof record[key] === "string" ? record[key] : "";
|
|
244
257
|
const row = {
|
|
245
258
|
description: field("description"),
|
|
246
259
|
provider: field("provider"),
|
|
247
260
|
model: field("model"),
|
|
248
|
-
effort: field("effort")
|
|
261
|
+
effort: field("effort"),
|
|
262
|
+
enabled: record.enabled !== false
|
|
249
263
|
};
|
|
250
264
|
if (isBlankRow(row)) continue;
|
|
251
265
|
rows.push(row);
|
|
@@ -483,7 +497,7 @@ var DispatchCardStore = class {
|
|
|
483
497
|
}
|
|
484
498
|
/** Append an empty row and write it: a new row is a decision like any other. */
|
|
485
499
|
addRow() {
|
|
486
|
-
this.stage({ rows: [...this.state.rows, { description: "", provider: "", model: "", effort: "" }] });
|
|
500
|
+
this.stage({ rows: [...this.state.rows, { description: "", provider: "", model: "", effort: "", enabled: true }] });
|
|
487
501
|
void this.commit("rows");
|
|
488
502
|
}
|
|
489
503
|
/**
|
|
@@ -496,7 +510,7 @@ var DispatchCardStore = class {
|
|
|
496
510
|
* @param rows - the rows read from the pasted JSON.
|
|
497
511
|
*/
|
|
498
512
|
replaceRows(rows) {
|
|
499
|
-
this.stage({ rows: rows.map(
|
|
513
|
+
this.stage({ rows: rows.map(readRow) });
|
|
500
514
|
void this.commit("rows");
|
|
501
515
|
}
|
|
502
516
|
/**
|
|
@@ -515,6 +529,18 @@ var DispatchCardStore = class {
|
|
|
515
529
|
});
|
|
516
530
|
void this.commit("judge");
|
|
517
531
|
}
|
|
532
|
+
toggleRow(index, enabled) {
|
|
533
|
+
this.stage({ rows: this.state.rows.map((row, at) => at === index ? { ...row, enabled } : row) });
|
|
534
|
+
void this.commit("rows");
|
|
535
|
+
}
|
|
536
|
+
moveRow(from, to) {
|
|
537
|
+
if (from === to || from < 0 || to < 0 || from >= this.state.rows.length || to >= this.state.rows.length) return;
|
|
538
|
+
const rows = [...this.state.rows];
|
|
539
|
+
const [moved] = rows.splice(from, 1);
|
|
540
|
+
rows.splice(to, 0, moved);
|
|
541
|
+
this.stage({ rows });
|
|
542
|
+
void this.commit("rows");
|
|
543
|
+
}
|
|
518
544
|
/** Delete one row and write the rest; the remaining rows renumber themselves. */
|
|
519
545
|
removeRow(index) {
|
|
520
546
|
this.stage({ rows: this.state.rows.filter((_row, at) => at !== index) });
|
|
@@ -750,7 +776,8 @@ var en = {
|
|
|
750
776
|
"reason.unknown": "unknown reason",
|
|
751
777
|
"rows.title": "Task types",
|
|
752
778
|
"rows.empty": "No task type yet. Add one below.",
|
|
753
|
-
"rows.
|
|
779
|
+
"rows.drag": "Drag to reorder",
|
|
780
|
+
"rows.enabled": "Enable task type",
|
|
754
781
|
"rows.colType": "Task type",
|
|
755
782
|
"rows.colDescription": "Description",
|
|
756
783
|
"rows.colModel": "Model",
|
|
@@ -777,7 +804,7 @@ var en = {
|
|
|
777
804
|
"rows.importCancel": "Cancel",
|
|
778
805
|
"rows.importClose": "Close",
|
|
779
806
|
"rows.importBadJson": "This is not valid JSON.",
|
|
780
|
-
"rows.importBadShape": "
|
|
807
|
+
"rows.importBadShape": "Task type fields must be text, and enabled must be true or false.",
|
|
781
808
|
"rows.importEmpty": "There is no task type in this list.",
|
|
782
809
|
"preview.title": "View the full prompt",
|
|
783
810
|
"preview.desc": "Exactly what would be sent to the judgement service. The delegation label and the task text are filled in at delegation time.",
|
|
@@ -804,6 +831,10 @@ var en = {
|
|
|
804
831
|
"log.promptDesc": "Exactly the request body this judgement sent.",
|
|
805
832
|
"log.promptClose": "Close",
|
|
806
833
|
"log.promptEmpty": "No request was sent for this judgement.",
|
|
834
|
+
"log.copyAnalysis": "Improve task type descriptions",
|
|
835
|
+
"log.analysisPrompt": "Analyze the latest 100 judgement log entries in the DSH home (DSH_HOME, default ~/.dsh) at dsh-subagent-judge-dispatch/judgements.json. Compare each task and selected type with the criteria recorded in that request; type descriptions and numbering may have changed. Identify possible misclassifications with examples, explain uncertainty and missing or truncated task text, and suggest improved task type descriptions. Read the current task types and preserve their model and effort settings. Do not change the configuration unless asked.",
|
|
836
|
+
"log.analysisCopied": "Analysis prompt copied.",
|
|
837
|
+
"log.analysisCopyFailed": "Could not copy to the clipboard.",
|
|
807
838
|
"log.refresh": "Refresh",
|
|
808
839
|
"log.loadFailed": "The log could not be read.",
|
|
809
840
|
"ms": "{value} ms"
|
|
@@ -857,7 +888,8 @@ var zh = {
|
|
|
857
888
|
"reason.unknown": "\u539F\u56E0\u4E0D\u660E",
|
|
858
889
|
"rows.title": "\u4EFB\u52A1\u7C7B\u578B",
|
|
859
890
|
"rows.empty": "\u8FD8\u6CA1\u6709\u4EFB\u52A1\u7C7B\u578B\u3002\u5728\u4E0B\u9762\u52A0\u4E00\u884C\u3002",
|
|
860
|
-
"rows.
|
|
891
|
+
"rows.drag": "\u62D6\u62FD\u8C03\u6574\u987A\u5E8F",
|
|
892
|
+
"rows.enabled": "\u5F00\u542F\u4EFB\u52A1\u7C7B\u578B",
|
|
861
893
|
"rows.colType": "\u4EFB\u52A1\u7C7B\u578B",
|
|
862
894
|
"rows.colDescription": "\u63CF\u8FF0",
|
|
863
895
|
"rows.colModel": "\u6A21\u578B",
|
|
@@ -884,7 +916,7 @@ var zh = {
|
|
|
884
916
|
"rows.importCancel": "\u53D6\u6D88",
|
|
885
917
|
"rows.importClose": "\u5173\u95ED",
|
|
886
918
|
"rows.importBadJson": "\u8FD9\u4E0D\u662F\u5408\u6CD5\u7684 JSON\u3002",
|
|
887
|
-
"rows.importBadShape": "\
|
|
919
|
+
"rows.importBadShape": "\u4EFB\u52A1\u7C7B\u578B\u7684\u6587\u5B57\u5B57\u6BB5\u5FC5\u987B\u662F\u6587\u5B57\uFF0Cenabled \u5FC5\u987B\u662F true \u6216 false\u3002",
|
|
888
920
|
"rows.importEmpty": "\u8FD9\u4EFD\u6E05\u5355\u91CC\u4E00\u6761\u4EFB\u52A1\u7C7B\u578B\u90FD\u6CA1\u6709\u3002",
|
|
889
921
|
"preview.title": "\u67E5\u770B\u5B8C\u6574\u9884\u89C8",
|
|
890
922
|
"preview.desc": "\u771F\u6B63\u4F1A\u53D1\u7ED9\u5224\u65AD\u670D\u52A1\u7684\u90A3\u6BB5\u5185\u5BB9\u3002\u6D3E\u5DE5\u6807\u7B7E\u4E0E\u4EFB\u52A1\u6B63\u6587\u90FD\u5728\u6D3E\u5DE5\u90A3\u4E00\u523B\u624D\u586B\u8FDB\u53BB\u3002",
|
|
@@ -911,6 +943,10 @@ var zh = {
|
|
|
911
943
|
"log.promptDesc": "\u8FD9\u6B21\u5224\u65AD\u771F\u6B63\u53D1\u51FA\u53BB\u7684\u8BF7\u6C42\u4F53\u3002",
|
|
912
944
|
"log.promptClose": "\u5173\u95ED",
|
|
913
945
|
"log.promptEmpty": "\u8FD9\u6B21\u5224\u65AD\u6CA1\u6709\u53D1\u51FA\u8BF7\u6C42\u3002",
|
|
946
|
+
"log.copyAnalysis": "\u4F18\u5316\u4EFB\u52A1\u7C7B\u578B\u63CF\u8FF0",
|
|
947
|
+
"log.analysisPrompt": "\u8BF7\u5206\u6790 DSH \u5BB6\u76EE\u5F55\uFF08DSH_HOME\uFF0C\u9ED8\u8BA4 ~/.dsh\uFF09\u4E0B dsh-subagent-judge-dispatch/judgements.json \u4E2D\u6700\u8FD1 100 \u6761\u5224\u65AD\u65E5\u5FD7\u3002\u9010\u6761\u7ED3\u5408\u4EFB\u52A1\u5185\u5BB9\u3001\u9009\u62E9\u7ED3\u679C\u548C\u5F53\u6B21\u8BF7\u6C42\u4E2D\u8BB0\u5F55\u7684\u4EFB\u52A1\u7C7B\u578B\u63CF\u8FF0\uFF0C\u627E\u51FA\u53EF\u80FD\u7684\u8BEF\u5224\u5E76\u4E3E\u4F8B\u8BF4\u660E\uFF1B\u7C7B\u578B\u63CF\u8FF0\u548C\u7F16\u53F7\u53EF\u80FD\u968F\u65F6\u95F4\u53D8\u5316\u3002\u8BF4\u660E\u8BC1\u636E\u4E0D\u8DB3\u3001\u4EFB\u52A1\u6B63\u6587\u7F3A\u5931\u6216\u88AB\u622A\u65AD\u7684\u60C5\u51B5\uFF0C\u5E76\u7ED9\u51FA\u5F53\u524D\u4EFB\u52A1\u7C7B\u578B\u63CF\u8FF0\u7684\u4F18\u5316\u5EFA\u8BAE\u3002\u8BF7\u8BFB\u53D6\u5F53\u524D\u4EFB\u52A1\u7C7B\u578B\uFF0C\u4FDD\u7559\u6A21\u578B\u548C\u5F3A\u5EA6\u914D\u7F6E\uFF1B\u672A\u7ECF\u8981\u6C42\u4E0D\u8981\u4FEE\u6539\u914D\u7F6E\u3002",
|
|
948
|
+
"log.analysisCopied": "\u5DF2\u590D\u5236\u5206\u6790\u63D0\u793A\u8BCD\u3002",
|
|
949
|
+
"log.analysisCopyFailed": "\u590D\u5236\u5230\u526A\u8D34\u677F\u6CA1\u6210\u529F\u3002",
|
|
914
950
|
"log.refresh": "\u5237\u65B0",
|
|
915
951
|
"log.loadFailed": "\u65E5\u5FD7\u8BFB\u4E0D\u51FA\u6765\u3002",
|
|
916
952
|
"ms": "{value} \u6BEB\u79D2"
|
|
@@ -998,11 +1034,12 @@ var CARD_CSS = `
|
|
|
998
1034
|
.dsh-judge-table td { padding: 6px 8px 6px 0; vertical-align: middle; }
|
|
999
1035
|
.dsh-judge-table tbody tr + tr td { border-top: 0.5px solid var(--dsw-alias-border-l3); }
|
|
1000
1036
|
.dsh-judge-table td:last-child, .dsh-judge-table th:last-child { padding-right: 0; }
|
|
1001
|
-
.dsh-judge-col-
|
|
1037
|
+
.dsh-judge-col-drag { width: 36px; }
|
|
1038
|
+
.dsh-judge-drag { border: 0; padding: 4px; background: transparent; cursor: grab; color: var(--dsw-alias-label-tertiary); font: inherit; }
|
|
1039
|
+
.dsh-judge-drag:active { cursor: grabbing; }
|
|
1002
1040
|
.dsh-judge-col-model { width: 188px; }
|
|
1003
1041
|
.dsh-judge-col-effort { width: 124px; }
|
|
1004
|
-
.dsh-judge-col-actions { width:
|
|
1005
|
-
.dsh-judge-no { color: var(--dsw-alias-label-tertiary); font: var(--dsw-font-xxs-12); font-variant-numeric: tabular-nums; }
|
|
1042
|
+
.dsh-judge-col-actions { width: 130px; }
|
|
1006
1043
|
.dsh-judge-row-off .dsh-judge-field { opacity: 0.6; }
|
|
1007
1044
|
.dsh-judge-cell-actions { display: flex; gap: 6px; }
|
|
1008
1045
|
.dsh-judge-log { display: flex; flex-direction: column; gap: 4px; font: var(--dsw-font-xxs-12); }
|
|
@@ -1038,6 +1075,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1038
1075
|
const { t } = props;
|
|
1039
1076
|
const [state, setState] = (0, import_react.useState)(() => dispatchCardStore.getState());
|
|
1040
1077
|
const [tab, setTab] = (0, import_react.useState)("design");
|
|
1078
|
+
const dragIndex = React.useRef(null);
|
|
1041
1079
|
const [preview, setPreview] = (0, import_react.useState)(null);
|
|
1042
1080
|
const [previewOpen, setPreviewOpen] = (0, import_react.useState)(false);
|
|
1043
1081
|
const [probing, setProbing] = (0, import_react.useState)(false);
|
|
@@ -1048,6 +1086,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1048
1086
|
const [importText, setImportText] = (0, import_react.useState)("");
|
|
1049
1087
|
const [importError, setImportError] = (0, import_react.useState)("");
|
|
1050
1088
|
const [copyNote, setCopyNote] = (0, import_react.useState)(null);
|
|
1089
|
+
const [logCopyResult, setLogCopyResult] = (0, import_react.useState)(null);
|
|
1051
1090
|
(0, import_react.useEffect)(() => {
|
|
1052
1091
|
setState(dispatchCardStore.getState());
|
|
1053
1092
|
const unsubscribe = dispatchCardStore.subscribe(() => setState(dispatchCardStore.getState()));
|
|
@@ -1115,118 +1154,169 @@ function JudgeDispatchPanel(props) {
|
|
|
1115
1154
|
const efforts = dispatchCardStore.effortsFor(draft);
|
|
1116
1155
|
const usable = dispatchCardStore.rowUsable(draft);
|
|
1117
1156
|
const catalogOffersEffort = state.catalogRead && efforts.length > 0;
|
|
1118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
{
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
) }),
|
|
1135
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1136
|
-
import_dsh_client_ui_primitives.Menu,
|
|
1137
|
-
{
|
|
1138
|
-
open: openMenu?.index === index && openMenu.kind === "model",
|
|
1139
|
-
anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1140
|
-
import_dsh_client_ui_primitives.Input,
|
|
1157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1158
|
+
"tr",
|
|
1159
|
+
{
|
|
1160
|
+
className: usable && draft.enabled ? void 0 : "dsh-judge-row-off",
|
|
1161
|
+
onDragOver: (event) => {
|
|
1162
|
+
if (dragIndex.current !== null) event.preventDefault();
|
|
1163
|
+
},
|
|
1164
|
+
onDrop: (event) => {
|
|
1165
|
+
event.preventDefault();
|
|
1166
|
+
if (dragIndex.current !== null) dispatchCardStore.moveRow(dragIndex.current, index);
|
|
1167
|
+
dragIndex.current = null;
|
|
1168
|
+
setOpenMenu(null);
|
|
1169
|
+
},
|
|
1170
|
+
children: [
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "dsh-judge-col-drag", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1172
|
+
"button",
|
|
1141
1173
|
{
|
|
1142
|
-
type: "
|
|
1143
|
-
className: "dsh-judge-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1174
|
+
type: "button",
|
|
1175
|
+
className: "dsh-judge-drag",
|
|
1176
|
+
draggable: state.writable,
|
|
1177
|
+
disabled: !state.writable,
|
|
1178
|
+
"aria-label": `${t("rows.drag")}: ${draft.description}`,
|
|
1179
|
+
onDragStart: (event) => {
|
|
1180
|
+
dragIndex.current = index;
|
|
1181
|
+
event.dataTransfer.effectAllowed = "move";
|
|
1182
|
+
event.dataTransfer.setData("text/plain", String(index));
|
|
1183
|
+
},
|
|
1184
|
+
onDragEnd: () => {
|
|
1185
|
+
dragIndex.current = null;
|
|
1186
|
+
},
|
|
1187
|
+
onKeyDown: (event) => {
|
|
1188
|
+
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
1189
|
+
event.preventDefault();
|
|
1190
|
+
dispatchCardStore.moveRow(index, index + (event.key === "ArrowUp" ? -1 : 1));
|
|
1191
|
+
}
|
|
1192
|
+
},
|
|
1193
|
+
children: "\u283F"
|
|
1152
1194
|
}
|
|
1153
|
-
),
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
},
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1195
|
+
) }),
|
|
1196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
|
|
1197
|
+
rowHints(state.rows, index, t).map((hint) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-off", children: hint }, hint)),
|
|
1198
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1199
|
+
import_dsh_client_ui_primitives.Input,
|
|
1200
|
+
{
|
|
1201
|
+
type: "text",
|
|
1202
|
+
className: "dsh-judge-field",
|
|
1203
|
+
value: draft.description,
|
|
1204
|
+
placeholder: t("rows.descriptionPlaceholder"),
|
|
1205
|
+
"aria-label": `${t("rows.colDescription")} ${index + 1}`,
|
|
1206
|
+
onChange: (event) => dispatchCardStore.cell(index, "description", event.target.value),
|
|
1207
|
+
onBlur: commitRows
|
|
1208
|
+
}
|
|
1209
|
+
)
|
|
1210
|
+
] }),
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1212
|
+
import_dsh_client_ui_primitives.Menu,
|
|
1213
|
+
{
|
|
1214
|
+
open: openMenu?.index === index && openMenu.kind === "model",
|
|
1215
|
+
anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1216
|
+
import_dsh_client_ui_primitives.Input,
|
|
1217
|
+
{
|
|
1218
|
+
type: "text",
|
|
1219
|
+
className: "dsh-judge-field",
|
|
1220
|
+
readOnly: true,
|
|
1221
|
+
value: draft.model === "" ? "" : `${draft.provider}/${draft.model}`,
|
|
1222
|
+
placeholder: t("rows.modelPlaceholder"),
|
|
1223
|
+
"aria-label": `${t("rows.colModel")} ${index + 1}`,
|
|
1224
|
+
"aria-haspopup": "listbox",
|
|
1225
|
+
"aria-expanded": openMenu?.index === index && openMenu.kind === "model",
|
|
1226
|
+
onClick: () => setOpenMenu({ index, kind: "model" }),
|
|
1227
|
+
onFocus: () => setOpenMenu({ index, kind: "model" })
|
|
1228
|
+
}
|
|
1229
|
+
),
|
|
1230
|
+
items: [
|
|
1231
|
+
{ type: "label", id: "model", text: t("rows.colModel") },
|
|
1232
|
+
...state.models.length === 0 ? [] : state.models.map((option) => ({
|
|
1233
|
+
id: routeKey(option.provider, option.model),
|
|
1234
|
+
label: `${option.provider}/${option.label}`
|
|
1235
|
+
}))
|
|
1236
|
+
],
|
|
1237
|
+
selectedId: draft.model === "" ? void 0 : routeKey(draft.provider, draft.model),
|
|
1238
|
+
onSelect: (id) => {
|
|
1239
|
+
const { provider, model } = splitRouteKey(id);
|
|
1240
|
+
dispatchCardStore.cell(index, "provider", provider);
|
|
1241
|
+
dispatchCardStore.cell(index, "model", model);
|
|
1242
|
+
setOpenMenu(null);
|
|
1243
|
+
commitRows();
|
|
1244
|
+
},
|
|
1245
|
+
onClose: () => setOpenMenu(null),
|
|
1246
|
+
className: "dsh-judge-field-wrap",
|
|
1247
|
+
portal: true
|
|
1248
|
+
}
|
|
1249
|
+
) }),
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: catalogOffersEffort ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1251
|
+
import_dsh_client_ui_primitives.Menu,
|
|
1252
|
+
{
|
|
1253
|
+
open: openMenu?.index === index && openMenu.kind === "effort",
|
|
1254
|
+
anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1255
|
+
import_dsh_client_ui_primitives.Input,
|
|
1256
|
+
{
|
|
1257
|
+
type: "text",
|
|
1258
|
+
className: "dsh-judge-field",
|
|
1259
|
+
readOnly: true,
|
|
1260
|
+
value: draft.effort,
|
|
1261
|
+
placeholder: t("rows.effortPlaceholder"),
|
|
1262
|
+
"aria-label": `${t("rows.colEffort")} ${index + 1}`,
|
|
1263
|
+
"aria-haspopup": "listbox",
|
|
1264
|
+
"aria-expanded": openMenu?.index === index && openMenu.kind === "effort",
|
|
1265
|
+
onClick: () => setOpenMenu({ index, kind: "effort" }),
|
|
1266
|
+
onFocus: () => setOpenMenu({ index, kind: "effort" })
|
|
1267
|
+
}
|
|
1268
|
+
),
|
|
1269
|
+
items: [
|
|
1270
|
+
{ type: "label", id: "effort", text: t("rows.colEffort") },
|
|
1271
|
+
...efforts.map((effort) => ({ id: effort, label: effort }))
|
|
1272
|
+
],
|
|
1273
|
+
selectedId: draft.effort === "" ? void 0 : draft.effort,
|
|
1274
|
+
onSelect: (id) => {
|
|
1275
|
+
dispatchCardStore.cell(index, "effort", id);
|
|
1276
|
+
setOpenMenu(null);
|
|
1277
|
+
commitRows();
|
|
1278
|
+
},
|
|
1279
|
+
onClose: () => setOpenMenu(null),
|
|
1280
|
+
className: "dsh-judge-field-wrap",
|
|
1281
|
+
portal: true
|
|
1282
|
+
}
|
|
1283
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1179
1284
|
import_dsh_client_ui_primitives.Input,
|
|
1180
1285
|
{
|
|
1181
1286
|
type: "text",
|
|
1182
1287
|
className: "dsh-judge-field",
|
|
1183
|
-
readOnly: true,
|
|
1184
1288
|
value: draft.effort,
|
|
1185
1289
|
placeholder: t("rows.effortPlaceholder"),
|
|
1186
1290
|
"aria-label": `${t("rows.colEffort")} ${index + 1}`,
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
onClick: () => setOpenMenu({ index, kind: "effort" }),
|
|
1190
|
-
onFocus: () => setOpenMenu({ index, kind: "effort" })
|
|
1291
|
+
onChange: (event) => dispatchCardStore.cell(index, "effort", event.target.value),
|
|
1292
|
+
onBlur: commitRows
|
|
1191
1293
|
}
|
|
1192
|
-
),
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
) }),
|
|
1219
|
-
/* @__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)(
|
|
1220
|
-
import_dsh_client_ui_primitives.Button,
|
|
1221
|
-
{
|
|
1222
|
-
variant: "outline",
|
|
1223
|
-
size: "sm",
|
|
1224
|
-
"aria-label": `${t("rows.remove")} ${index + 1}`,
|
|
1225
|
-
onClick: () => dispatchCardStore.removeRow(index),
|
|
1226
|
-
children: t("rows.remove")
|
|
1227
|
-
}
|
|
1228
|
-
) }) })
|
|
1229
|
-
] }, index);
|
|
1294
|
+
) }),
|
|
1295
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "dsh-judge-col-actions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-cell-actions", children: [
|
|
1296
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1297
|
+
import_dsh_client_ui_primitives.Switch,
|
|
1298
|
+
{
|
|
1299
|
+
checked: draft.enabled,
|
|
1300
|
+
onChange: (next) => dispatchCardStore.toggleRow(index, next),
|
|
1301
|
+
label: `${t("rows.enabled")}: ${draft.description}`,
|
|
1302
|
+
disabled: !state.writable
|
|
1303
|
+
}
|
|
1304
|
+
),
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1306
|
+
import_dsh_client_ui_primitives.Button,
|
|
1307
|
+
{
|
|
1308
|
+
variant: "outline",
|
|
1309
|
+
size: "sm",
|
|
1310
|
+
"aria-label": `${t("rows.remove")} ${index + 1}`,
|
|
1311
|
+
onClick: () => dispatchCardStore.removeRow(index),
|
|
1312
|
+
children: t("rows.remove")
|
|
1313
|
+
}
|
|
1314
|
+
)
|
|
1315
|
+
] }) })
|
|
1316
|
+
]
|
|
1317
|
+
},
|
|
1318
|
+
index
|
|
1319
|
+
);
|
|
1230
1320
|
};
|
|
1231
1321
|
const design = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-panel", children: [
|
|
1232
1322
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-section", children: [
|
|
@@ -1378,7 +1468,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1378
1468
|
state.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-desc", children: t("rows.empty") }),
|
|
1379
1469
|
state.rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "dsh-judge-table", children: [
|
|
1380
1470
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
1381
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { className: "dsh-judge-col-
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { className: "dsh-judge-col-drag" }),
|
|
1382
1472
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: t("rows.colType") }),
|
|
1383
1473
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { className: "dsh-judge-col-model", children: t("rows.colModel") }),
|
|
1384
1474
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { className: "dsh-judge-col-effort", children: t("rows.colEffort") }),
|
|
@@ -1394,8 +1484,12 @@ function JudgeDispatchPanel(props) {
|
|
|
1394
1484
|
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: [
|
|
1395
1485
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-head", children: [
|
|
1396
1486
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dsh-judge-title", children: t("log.title") }),
|
|
1397
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dsh-judge-actions-group", children: [
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => void (0, import_dsh_client_ui_primitives.writeClipboard)(t("log.analysisPrompt")).then(setLogCopyResult), children: t("log.copyAnalysis") }),
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", size: "sm", onClick: () => void dispatchCardStore.refreshLog(), children: t("log.refresh") })
|
|
1490
|
+
] })
|
|
1398
1491
|
] }),
|
|
1492
|
+
logCopyResult !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: logCopyResult ? "dsh-judge-note-ok" : "dsh-judge-note-bad", role: "status", children: t(logCopyResult ? "log.analysisCopied" : "log.analysisCopyFailed") }),
|
|
1399
1493
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-desc", children: t("log.desc") }),
|
|
1400
1494
|
state.logFailed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-note-bad", children: t("log.loadFailed") }),
|
|
1401
1495
|
state.logLoaded && state.log.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dsh-judge-desc", children: t("log.empty") }),
|