@lynn123411/dsh-subagent-judge-dispatch 0.6.13 → 0.6.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/client/index.ts
32
32
  var index_exports = {};
33
33
  __export(index_exports, {
34
- ALLOWED_MODELS_NAMESPACE: () => ALLOWED_MODELS_NAMESPACE,
35
34
  JudgeDispatchPanel: () => JudgeDispatchPanel,
36
35
  NS: () => NS,
37
36
  SETTINGS_NAMESPACE: () => SETTINGS_NAMESPACE,
@@ -144,10 +143,7 @@ var en = {
144
143
  "ready.loading": "Waiting for the settings from DSH.",
145
144
  "ready.address": "Enter a valid service address.",
146
145
  "ready.model": "Enter the judgement model.",
147
- "ready.authorization.unknown": "Could not confirm which models DSH allows for subagents.",
148
- "ready.authorization.disabled": "Enable model selection under Plugins \u2192 Subagent.",
149
- "ready.authorization.invalid": "Add valid allowed models under Plugins \u2192 Subagent.",
150
- "ready.rules": "Complete a task rule and choose an allowed model.",
146
+ "ready.rules": "Complete a task rule with an available model.",
151
147
  "ready.count": "{used} of {total} task rules ready",
152
148
  "ready.readOnly": "This page can only view settings.",
153
149
  "transfer.judge": "Connection import/export",
@@ -213,14 +209,19 @@ var en = {
213
209
  "judge.probing": "Testing\u2026",
214
210
  "judge.probeOk": "Connected in {latency} ms",
215
211
  "judge.probeFail": "Not usable: {reason}",
212
+ "judge.probeHttpStatus": " (HTTP {status})",
216
213
  "reason.unconfigured": "the endpoint address or model is not filled in",
217
214
  "reason.unreachable": "the endpoint could not be reached",
215
+ "reason.authentication": "the service rejected the credentials or access",
216
+ "reason.rate-limited": "the service is receiving too many requests",
217
+ "reason.server-error": "the service reported a server error",
218
+ "reason.http-error": "the service rejected the request",
218
219
  "reason.timeout": "it did not answer within 5 seconds",
219
220
  "reason.unmatched": "the answer named no listed type",
220
221
  "reason.incomplete": "the selected type is not filled in",
221
222
  "reason.unavailable-route": "the selected model or effort is unavailable",
222
223
  "reason.no-match": "no configured type applies",
223
- "reason.no-authorized-route": "none of the configured types has a model DSH currently allows",
224
+ "reason.no-authorized-route": "none of the configured types has a model in the current DSH catalog",
224
225
  "reason.unidentified-task": "the original task could not be identified",
225
226
  "reason.explicit-route": "the delegation already specified a model",
226
227
  "reason.recorded-route": "the subagent already selected or used a model",
@@ -248,17 +249,22 @@ var en = {
248
249
  "rows.hintDuplicateDescription": "Description repeats another row",
249
250
  "rows.hintNoModel": "Choose a model",
250
251
  "rows.hintNoEffort": "Choose a reasoning effort",
251
- "rows.hintModelNotAllowed": "Model is outside the host\u2019s allowed list",
252
+ "rows.hintModelUnavailable": "Model is missing from the DSH catalog",
252
253
  "rows.hintEffortUnavailable": "This model does not support the selected effort",
253
254
  "rows.modelPlaceholder": "Not chosen",
255
+ "rows.modelSearch": "Search models or providers",
256
+ "rows.modelSearchClear": "Clear search",
257
+ "rows.modelSearchEmpty": "No matching models",
258
+ "rows.catalogLoading": "Loading the DSH model catalog\u2026",
259
+ "rows.catalogUnavailable": "Could not load the DSH model catalog.",
260
+ "rows.catalogRetry": "Retry loading models",
261
+ "rows.catalogEmpty": "No models are listed in DSH. Add one in Models settings.",
254
262
  "rows.effortPlaceholder": "Not chosen",
255
263
  "rows.effortChoices": "Effort choices",
256
264
  "rows.effortDefault": "Model default",
257
265
  "rows.useDefaultEffort": "Use model default",
258
266
  "rows.incomplete": "Not used",
259
267
  "rows.descriptionPlaceholder": "What kind of job is this? Write as much as you like.",
260
- "rows.dependsOn": "Under Plugins \u2192 Official \u2192 Subagent, enable model selection and add allowed models. If it is off, the child keeps its original model.",
261
- "rows.allowedEmpty": "The official setting offers no model yet; fill it in and the options appear here.",
262
268
  "rows.importOpen": "Import",
263
269
  "rows.export": "Export",
264
270
  "rows.exported": "Copied the task-type list as JSON.",
@@ -299,6 +305,7 @@ var en = {
299
305
  "log.column.duration": "Duration",
300
306
  "log.column.details": "Details",
301
307
  "log.loading": "Loading the log\u2026",
308
+ "log.recovered": "The damaged log was saved as a backup. New entries are recorded in a new log.",
302
309
  "log.empty": "No entries yet.",
303
310
  "log.filterLabel": "Filter by result",
304
311
  "log.filterAll": "All",
@@ -366,10 +373,7 @@ var zh = {
366
373
  "ready.loading": "\u6B63\u5728\u8BFB\u53D6 DSH \u8BBE\u7F6E\u3002",
367
374
  "ready.address": "\u8BF7\u586B\u5199\u6709\u6548\u7684\u670D\u52A1\u5730\u5740\u3002",
368
375
  "ready.model": "\u8BF7\u586B\u5199\u5224\u65AD\u6A21\u578B\u3002",
369
- "ready.authorization.unknown": "\u8FD8\u65E0\u6CD5\u786E\u8BA4 DSH \u5141\u8BB8\u5B50\u4EE3\u7406\u4F7F\u7528\u54EA\u4E9B\u6A21\u578B\u3002",
370
- "ready.authorization.disabled": "\u8BF7\u5728\u300C\u63D2\u4EF6 \u2192 \u5B50\u667A\u80FD\u4F53\u300D\u4E2D\u5F00\u542F\u6A21\u578B\u9009\u62E9\u3002",
371
- "ready.authorization.invalid": "\u8BF7\u5728\u300C\u63D2\u4EF6 \u2192 \u5B50\u667A\u80FD\u4F53\u300D\u4E2D\u6DFB\u52A0\u6709\u6548\u7684\u5141\u8BB8\u6A21\u578B\u3002",
372
- "ready.rules": "\u8BF7\u586B\u597D\u81F3\u5C11\u4E00\u6761\u4EFB\u52A1\u89C4\u5219\uFF0C\u5E76\u4E3A\u5B83\u9009\u4E00\u4E2A\u5141\u8BB8\u4F7F\u7528\u7684\u6A21\u578B\u3002",
376
+ "ready.rules": "\u8BF7\u586B\u597D\u81F3\u5C11\u4E00\u6761\u4EFB\u52A1\u89C4\u5219\uFF0C\u5E76\u9009\u62E9\u4E00\u4E2A\u53EF\u7528\u7684\u6A21\u578B\u3002",
373
377
  "ready.count": "{total} \u6761\u89C4\u5219\u4E2D\u6709 {used} \u6761\u53EF\u7528",
374
378
  "ready.readOnly": "\u6B64\u9875\u9762\u53EA\u80FD\u67E5\u770B\u914D\u7F6E\u3002",
375
379
  "transfer.judge": "\u5BFC\u5165\uFF0F\u5BFC\u51FA\u8FDE\u63A5\u8BBE\u7F6E",
@@ -435,14 +439,19 @@ var zh = {
435
439
  "judge.probing": "\u6B63\u5728\u8BD5\u2026",
436
440
  "judge.probeOk": "\u8FDE\u4E0A\u4E86\uFF0C\u7528\u4E86 {latency} \u6BEB\u79D2",
437
441
  "judge.probeFail": "\u7528\u4E0D\u4E86\uFF1A{reason}",
442
+ "judge.probeHttpStatus": "\uFF08HTTP {status}\uFF09",
438
443
  "reason.unconfigured": "\u7AEF\u70B9\u5730\u5740\u6216\u5224\u65AD\u6A21\u578B\u8FD8\u6CA1\u586B",
439
444
  "reason.unreachable": "\u8FDE\u4E0D\u4E0A\u8FD9\u4E2A\u5730\u5740",
445
+ "reason.authentication": "\u51ED\u636E\u6216\u6743\u9650\u6709\u95EE\u9898",
446
+ "reason.rate-limited": "\u8BF7\u6C42\u8FC7\u4E8E\u9891\u7E41",
447
+ "reason.server-error": "\u5224\u65AD\u670D\u52A1\u51FA\u9519",
448
+ "reason.http-error": "\u5224\u65AD\u670D\u52A1\u62D2\u7EDD\u4E86\u8BF7\u6C42",
440
449
  "reason.timeout": "\u5224\u65AD\u6216\u8DEF\u7EBF\u6821\u9A8C\u8D85\u8FC7 5 \u79D2",
441
450
  "reason.unmatched": "\u7B54\u590D\u5BF9\u4E0D\u4E0A\u6E05\u5355",
442
451
  "reason.incomplete": "\u9009\u4E2D\u7684\u7C7B\u578B\u6CA1\u586B\u5168",
443
452
  "reason.unavailable-route": "\u9009\u4E2D\u7684\u6A21\u578B\u6216\u63A8\u7406\u7B49\u7EA7\u5F53\u524D\u4E0D\u53EF\u7528",
444
453
  "reason.no-match": "\u6CA1\u6709\u9002\u7528\u7684\u4EFB\u52A1\u7C7B\u578B",
445
- "reason.no-authorized-route": "\u89C4\u5219\u91CC\u6CA1\u6709 DSH \u5F53\u524D\u5141\u8BB8\u4F7F\u7528\u7684\u6A21\u578B",
454
+ "reason.no-authorized-route": "\u89C4\u5219\u4E2D\u6CA1\u6709\u6A21\u578B\u51FA\u73B0\u5728\u5F53\u524D DSH \u76EE\u5F55\u91CC",
446
455
  "reason.unidentified-task": "\u627E\u4E0D\u5230\u8FD9\u6B21\u6D3E\u51FA\u7684\u539F\u4EFB\u52A1",
447
456
  "reason.explicit-route": "\u6D3E\u4EFB\u52A1\u65F6\u5DF2\u6307\u5B9A\u6A21\u578B",
448
457
  "reason.recorded-route": "\u5B50\u4EE3\u7406\u5DF2\u9009\u62E9\u6216\u4F7F\u7528\u8FC7\u6A21\u578B",
@@ -470,17 +479,22 @@ var zh = {
470
479
  "rows.hintDuplicateDescription": "\u63CF\u8FF0\u548C\u522B\u7684\u884C\u91CD\u590D",
471
480
  "rows.hintNoModel": "\u672A\u9009\u6A21\u578B",
472
481
  "rows.hintNoEffort": "\u672A\u9009\u63A8\u7406\u5F3A\u5EA6",
473
- "rows.hintModelNotAllowed": "\u6A21\u578B\u4E0D\u5728\u5BBF\u4E3B\u5141\u8BB8\u6E05\u5355\u4E2D",
482
+ "rows.hintModelUnavailable": "DSH \u6A21\u578B\u76EE\u5F55\u4E2D\u6CA1\u6709\u8FD9\u4E2A\u6A21\u578B",
474
483
  "rows.hintEffortUnavailable": "\u8BE5\u6A21\u578B\u4E0D\u652F\u6301\u9009\u4E2D\u7684\u63A8\u7406\u5F3A\u5EA6",
475
484
  "rows.modelPlaceholder": "\u8FD8\u6CA1\u9009",
485
+ "rows.modelSearch": "\u641C\u7D22\u6A21\u578B\u6216\u4F9B\u5E94\u5546",
486
+ "rows.modelSearchClear": "\u6E05\u9664\u641C\u7D22",
487
+ "rows.modelSearchEmpty": "\u6CA1\u6709\u5339\u914D\u7684\u6A21\u578B",
488
+ "rows.catalogLoading": "\u6B63\u5728\u8BFB\u53D6 DSH \u6A21\u578B\u76EE\u5F55\u2026",
489
+ "rows.catalogUnavailable": "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6 DSH \u6A21\u578B\u76EE\u5F55\u3002",
490
+ "rows.catalogRetry": "\u91CD\u65B0\u8BFB\u53D6\u6A21\u578B",
491
+ "rows.catalogEmpty": "DSH \u6A21\u578B\u76EE\u5F55\u4E3A\u7A7A\u3002\u8BF7\u5728\u300C\u6A21\u578B\u300D\u8BBE\u7F6E\u4E2D\u6DFB\u52A0\u6A21\u578B\u3002",
476
492
  "rows.effortPlaceholder": "\u8FD8\u6CA1\u9009",
477
493
  "rows.effortChoices": "\u9009\u62E9\u63A8\u7406\u5F3A\u5EA6",
478
494
  "rows.effortDefault": "\u6A21\u578B\u9ED8\u8BA4",
479
495
  "rows.useDefaultEffort": "\u4F7F\u7528\u6A21\u578B\u9ED8\u8BA4\u5F3A\u5EA6",
480
496
  "rows.incomplete": "\u4E0D\u751F\u6548",
481
497
  "rows.descriptionPlaceholder": "\u8FD9\u662F\u54EA\u79CD\u6D3B\uFF1F\u5199\u591A\u5C11\u90FD\u884C\u3002",
482
- "rows.dependsOn": "\u8BF7\u5728\u300C\u63D2\u4EF6 \u2192 \u5B98\u65B9 \u2192 \u5B50\u667A\u80FD\u4F53\u300D\u4E2D\u5F00\u542F\u6A21\u578B\u9009\u62E9\u5E76\u6DFB\u52A0\u5141\u8BB8\u7684\u6A21\u578B\u3002\u5173\u95ED\u65F6\uFF0C\u5B50\u4EE3\u7406\u6CBF\u7528\u539F\u8DEF\u7EBF\u3002",
483
- "rows.allowedEmpty": "\u5B98\u65B9\u914D\u7F6E\u91CC\u8FD8\u6CA1\u6709\u53EF\u9009\u6A21\u578B\uFF0C\u586B\u4E0A\u4E4B\u540E\u8FD9\u91CC\u624D\u6709\u53EF\u9009\u9879\u3002",
484
498
  "rows.importOpen": "\u5BFC\u5165",
485
499
  "rows.export": "\u5BFC\u51FA",
486
500
  "rows.exported": "\u5DF2\u7ECF\u628A\u4EFB\u52A1\u7C7B\u578B\u6E05\u5355\u6309 JSON \u590D\u5236\u8D70\u4E86\u3002",
@@ -521,6 +535,7 @@ var zh = {
521
535
  "log.column.duration": "\u8017\u65F6",
522
536
  "log.column.details": "\u8BE6\u60C5",
523
537
  "log.loading": "\u6B63\u5728\u8BFB\u53D6\u65E5\u5FD7\u2026",
538
+ "log.recovered": "\u539F\u65E5\u5FD7\u5DF2\u635F\u574F\uFF0C\u5DF2\u4FDD\u7559\u5907\u4EFD\u3002\u65B0\u8BB0\u5F55\u4F1A\u5199\u5165\u65B0\u7684\u65E5\u5FD7\u3002",
524
539
  "log.empty": "\u8FD8\u6CA1\u6709\u65E5\u5FD7\u3002",
525
540
  "log.filterLabel": "\u6309\u7ED3\u679C\u7B5B\u9009",
526
541
  "log.filterAll": "\u5168\u90E8",
@@ -671,7 +686,7 @@ function LogDetails({ entry, t }) {
671
686
  ] })
672
687
  ] }) });
673
688
  }
674
- function LogPanel({ entries, loaded, failed, loading, onRefresh, t }) {
689
+ function LogPanel({ entries, loaded, failed, loading, recovered, onRefresh, t }) {
675
690
  const [filter, setFilter] = React.useState("all");
676
691
  const [detail, setDetail] = React.useState(null);
677
692
  const [copyResult, setCopyResult] = React.useState(null);
@@ -713,6 +728,7 @@ function LogPanel({ entries, loaded, failed, loading, onRefresh, t }) {
713
728
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("log.desc") }),
714
729
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { role: "status", className: "dsh-judge-log-copy-status", "data-result": copyResult ?? void 0, children: copyResult === "copied" ? t("log.analysisCopied") : copyResult === "failed" ? t("log.analysisCopyFailed") : "" })
715
730
  ] }),
731
+ recovered && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsh-judge-log-warning", role: "status", children: t("log.recovered") }),
716
732
  failed && !loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsh-judge-log-error", role: "alert", children: t(entries.length === 0 ? "log.loadFailed" : "log.refreshFailed") }),
717
733
  entries.length === 0 && !loaded && !failed && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsh-judge-log-message", role: "status", children: t("log.loading") }),
718
734
  entries.length === 0 && loaded && !failed && !loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "dsh-judge-log-message", role: "status", children: t("log.empty") }),
@@ -778,12 +794,13 @@ var LOG_PANEL_CSS = `
778
794
  .dsh-judge-log-toolbar { justify-content: space-between; gap: 8px 12px; }
779
795
  .dsh-judge-log-actions { gap: 6px; }
780
796
  .dsh-judge-log-filter[aria-pressed="true"] { color: var(--dsw-alias-label-primary); }
781
- .dsh-judge-log-caption, .dsh-judge-log-message, .dsh-judge-log-error {
797
+ .dsh-judge-log-caption, .dsh-judge-log-message, .dsh-judge-log-error, .dsh-judge-log-warning {
782
798
  margin: 10px 0 0;
783
799
  color: var(--dsw-alias-label-secondary);
784
800
  font: var(--dsw-font-xs-13);
785
801
  }
786
802
  .dsh-judge-log-error { color: var(--dsw-alias-state-error-primary); }
803
+ .dsh-judge-log-warning { color: var(--dsw-alias-state-warn-primary); }
787
804
  .dsh-judge-log-caption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
788
805
  .dsh-judge-log-copy-status[data-result='copied'] { color: var(--dsw-alias-state-success-primary); }
789
806
  .dsh-judge-log-copy-status[data-result='failed'] { color: var(--dsw-alias-state-error-primary); }
@@ -881,7 +898,6 @@ var SAMPLE_ROUTE_PATH = `${BASE_PATH}/sample`;
881
898
  var KEY_STATUS_ROUTE_PATH = `${BASE_PATH}/key-status`;
882
899
 
883
900
  // src/client/settings/store.ts
884
- var ALLOWED_MODELS_NAMESPACE = "subagent-model-selection-settings";
885
901
  async function readJson(response) {
886
902
  try {
887
903
  return await response.json();
@@ -896,7 +912,7 @@ function createDispatchRemote() {
896
912
  if (!response.ok) throw new Error("Log request failed");
897
913
  const body = await readJson(response);
898
914
  if (body?.ok !== true || !Array.isArray(body.entries)) throw new Error("Invalid log response");
899
- return body.entries;
915
+ return { entries: body.entries, recovered: body.recovered === true };
900
916
  },
901
917
  async preview(task = "", label = "") {
902
918
  try {
@@ -921,7 +937,8 @@ function createDispatchRemote() {
921
937
  return {
922
938
  ok: body.ok === true,
923
939
  latencyMs: typeof body.latencyMs === "number" ? body.latencyMs : 0,
924
- ...typeof body.reason === "string" ? { reason: body.reason } : {}
940
+ ...typeof body.reason === "string" ? { reason: body.reason } : {},
941
+ ...Number.isInteger(body.httpStatus) && body.httpStatus >= 100 && body.httpStatus <= 599 ? { httpStatus: body.httpStatus } : {}
925
942
  };
926
943
  } catch {
927
944
  return { ok: false, latencyMs: 0, reason: "unreachable" };
@@ -1001,35 +1018,20 @@ function splitRouteKey(key) {
1001
1018
  if (at < 0) return { provider: "", model: "" };
1002
1019
  return { provider: key.slice(0, at), model: key.slice(at + 1) };
1003
1020
  }
1004
- function buildModelOptions(allowed, groups) {
1021
+ function buildModelOptions(groups) {
1005
1022
  const byRoute = /* @__PURE__ */ new Map();
1006
1023
  for (const group of groups) {
1007
1024
  for (const model of group.models) {
1008
1025
  byRoute.set(routeKey(group.id, model.id), {
1009
- label: model.name,
1026
+ provider: group.id,
1027
+ providerName: group.name || group.id,
1028
+ model: model.id,
1029
+ label: model.name || model.id,
1010
1030
  efforts: (model.reasoning?.efforts ?? []).map((effort) => effort.id)
1011
1031
  });
1012
1032
  }
1013
1033
  }
1014
- const options = [];
1015
- const seen = /* @__PURE__ */ new Set();
1016
- for (const entry of allowed) {
1017
- const provider = typeof entry?.provider === "string" ? entry.provider : "";
1018
- const model = typeof entry?.model === "string" ? entry.model : "";
1019
- if (provider === "" || model === "") continue;
1020
- const key = routeKey(provider, model);
1021
- if (seen.has(key)) continue;
1022
- seen.add(key);
1023
- const found = byRoute.get(key);
1024
- options.push({
1025
- provider,
1026
- model,
1027
- label: found?.label ?? model,
1028
- efforts: found?.efforts ?? [],
1029
- catalogued: found !== void 0
1030
- });
1031
- }
1032
- return options;
1034
+ return [...byRoute.values()];
1033
1035
  }
1034
1036
  function rowHints(rows, index, t) {
1035
1037
  const row = rows[index];
@@ -1046,8 +1048,6 @@ function rowHints(rows, index, t) {
1046
1048
  }
1047
1049
  function exportRowsJson(rows) {
1048
1050
  return JSON.stringify(
1049
- // 空白行(读者按了「加一行」还没填)不写进 JSON:它没有内容可带走,写出去
1050
- // 还会让这份文本自己读不回来。
1051
1051
  rows.filter((row) => !isBlankRow(row)).map((row) => ({
1052
1052
  description: row.description,
1053
1053
  provider: row.provider,
@@ -1142,8 +1142,7 @@ var DispatchCardStore = class {
1142
1142
  connectionRevision: 0,
1143
1143
  rows: [],
1144
1144
  models: [],
1145
- modelAuthorization: "unknown",
1146
- catalogRead: false,
1145
+ catalogStatus: "loading",
1147
1146
  committed: {
1148
1147
  enabled: DEFAULT_ENABLED,
1149
1148
  logEnabled: true,
@@ -1156,16 +1155,15 @@ var DispatchCardStore = class {
1156
1155
  writeErrors: {},
1157
1156
  key: emptyKey(),
1158
1157
  log: [],
1158
+ logRecovered: false,
1159
1159
  logLoaded: false,
1160
1160
  logFailed: false,
1161
1161
  logLoading: false
1162
1162
  };
1163
1163
  listeners = /* @__PURE__ */ new Set();
1164
- /** One commit at a time: a queued write reads the drafts as they stand when it runs. */
1165
1164
  queue = Promise.resolve();
1166
1165
  pendingOps = [];
1167
1166
  form = null;
1168
- allowedForm = null;
1169
1167
  modelLoadRevision = 0;
1170
1168
  logLoadRevision = 0;
1171
1169
  session = null;
@@ -1174,21 +1172,20 @@ var DispatchCardStore = class {
1174
1172
  keyEndpoint = "";
1175
1173
  keyStatusRevision = 0;
1176
1174
  offForm = null;
1177
- offAllowed = null;
1178
1175
  translate = (key) => key;
1179
- /** Bind the Host services; re-binding detaches the previous subscriptions. */
1180
1176
  attach(options) {
1181
1177
  this.offForm?.();
1182
- this.offAllowed?.();
1183
1178
  this.form = options.form;
1184
- this.allowedForm = options.allowedForm;
1185
1179
  this.session = options.session;
1180
+ this.modelLoadRevision++;
1186
1181
  this.remote = options.remote;
1187
1182
  this.logLoadRevision++;
1188
1183
  this.credentials = options.credentials;
1189
1184
  this.translate = options.t;
1190
1185
  this.state = {
1191
1186
  ...this.state,
1187
+ models: [],
1188
+ catalogStatus: "loading",
1192
1189
  logLoading: false,
1193
1190
  key: { ...this.state.key, unavailable: options.credentials === null }
1194
1191
  };
@@ -1196,10 +1193,6 @@ var DispatchCardStore = class {
1196
1193
  this.offForm = this.form.subscribe(() => this.deriveCommitted());
1197
1194
  this.deriveCommitted();
1198
1195
  }
1199
- if (this.allowedForm !== null) {
1200
- this.offAllowed = this.allowedForm.subscribe(() => void this.loadModels());
1201
- }
1202
- void this.loadModels();
1203
1196
  void this.refreshKeyStatus();
1204
1197
  }
1205
1198
  getState() {
@@ -1211,33 +1204,18 @@ var DispatchCardStore = class {
1211
1204
  this.listeners.delete(listener);
1212
1205
  };
1213
1206
  }
1214
- /** Read the Host's allowlist and the adapter catalogue into the model options. */
1215
1207
  async loadModels() {
1216
1208
  const revision = ++this.modelLoadRevision;
1217
- const snapshot = this.allowedForm?.getSnapshot();
1218
- const allowedValue = snapshot?.value;
1219
- const allowed = Array.isArray(allowedValue?.allowedModels) ? allowedValue.allowedModels : [];
1220
- const options = buildModelOptions(allowed, []);
1221
- const modelAuthorization = snapshot?.status !== "ready" || allowedValue === void 0 ? "unknown" : allowedValue.enabled !== true ? "disabled" : options.length === 0 || options.length !== allowed.length ? "invalid" : "enabled";
1222
- this.state = { ...this.state, models: options, catalogRead: false, modelAuthorization };
1223
- this.notify();
1224
- let groups = [];
1225
- let catalogRead = false;
1226
- if (this.allowedForm !== null && this.session !== null) {
1227
- try {
1228
- const response = await this.session.modelCatalog();
1229
- if (response.ok) {
1230
- groups = response.value.groups;
1231
- catalogRead = true;
1232
- }
1233
- } catch {
1234
- }
1209
+ this.stage({ catalogStatus: "loading", models: [] });
1210
+ let groups;
1211
+ try {
1212
+ const response = await this.session?.modelCatalog();
1213
+ if (response?.ok) groups = response.value.groups;
1214
+ } catch {
1235
1215
  }
1236
1216
  if (revision !== this.modelLoadRevision) return;
1237
- this.state = { ...this.state, models: buildModelOptions(allowed, groups), catalogRead };
1238
- this.notify();
1217
+ this.stage(groups === void 0 ? { catalogStatus: "unavailable" } : { catalogStatus: "ready", models: buildModelOptions(groups) });
1239
1218
  }
1240
- /** Read the status for the committed address; discard replies for an older address. */
1241
1219
  async refreshKeyStatus() {
1242
1220
  const revision = ++this.keyStatusRevision;
1243
1221
  const endpoint = this.state.committed.endpointUrl;
@@ -1259,15 +1237,6 @@ var DispatchCardStore = class {
1259
1237
  this.state = { ...this.state, key: { ...this.state.key, configured } };
1260
1238
  this.notify();
1261
1239
  }
1262
- /**
1263
- * Map the Host's resolved section into committed state and re-seed the drafts.
1264
- *
1265
- * Drafts are held FIELD BY FIELD, against the value this page last saw
1266
- * committed. Holding a whole section instead would make a save write back a
1267
- * field the reader never touched — reverting a change another page made to it —
1268
- * while holding nothing would discard input mid-typing every time the Host
1269
- * publishes.
1270
- */
1271
1240
  deriveCommitted(notify = true) {
1272
1241
  const snapshot = this.form?.getSnapshot();
1273
1242
  const value = snapshot?.value;
@@ -1306,85 +1275,48 @@ var DispatchCardStore = class {
1306
1275
  if (notify) this.notify();
1307
1276
  if (keyOriginChanged) void this.refreshKeyStatus();
1308
1277
  }
1309
- /**
1310
- * Stage one edit.
1311
- *
1312
- * A failure stays on screen until a write lands: the value it complains about
1313
- * has not reached the document yet, so clearing it on the first keystroke would
1314
- * say "fixed" while the drafts are still only on this page.
1315
- *
1316
- * @param patch - the state fields this edit changes.
1317
- */
1318
1278
  stage(patch) {
1319
1279
  this.state = { ...this.state, ...patch };
1320
1280
  this.notify();
1321
1281
  }
1322
- /** Stage one top-level field; its control commits when focus leaves it. */
1323
1282
  field(key, value) {
1324
1283
  this.stage(key === "endpointUrl" ? { endpointUrl: value } : { judgeModel: value });
1325
1284
  }
1326
- /** Flip one switch and write it: a switch is one complete decision. */
1327
1285
  toggle(key, value) {
1328
1286
  this.stage({ [key]: value });
1329
1287
  void this.commit(key === "enabled" ? "judge" : key);
1330
1288
  }
1331
- /** Stage the judgement key; its control commits when focus leaves it or on Enter. */
1332
1289
  key(text) {
1333
1290
  this.keyEndpoint = this.state.endpointUrl;
1334
1291
  this.stage({ key: { ...this.state.key, text, failed: false, error: "" } });
1335
1292
  }
1336
- /** Stage one cell of one row; a text cell commits on blur, a menu choice at once. */
1337
- cell(index, key, value) {
1338
- if (key === "effort") {
1339
- this.chooseEffort(index, value);
1340
- return;
1341
- }
1342
- const rows = this.state.rows.map((row, at) => at === index ? { ...row, [key]: value } : row);
1343
- this.stage({ rows: key === "model" ? this.reconcileEffort(rows, index) : rows });
1293
+ describeRow(index, description) {
1294
+ const rows = this.state.rows.map((row, at) => at === index ? { ...row, description } : row);
1295
+ this.stage({ rows });
1296
+ }
1297
+ chooseModel(index, provider, model) {
1298
+ const option = this.state.models.find((candidate) => candidate.provider === provider && candidate.model === model);
1299
+ if (option === void 0) return;
1300
+ const rows = this.state.rows.map((row, at) => at === index ? {
1301
+ ...row,
1302
+ provider,
1303
+ model,
1304
+ effort: option.efforts.includes(row.effort) ? row.effort : ""
1305
+ } : row);
1306
+ this.stage({ rows });
1344
1307
  }
1345
- /** Stage an explicit effort id, an empty draft, or the model default (undefined). */
1346
1308
  chooseEffort(index, effort) {
1347
1309
  const rows = this.state.rows.map((row, at) => at === index ? readRow({ ...row, effort: effort ?? "", useDefaultEffort: effort === void 0 }) : row);
1348
1310
  this.stage({ rows });
1349
1311
  }
1350
- /** Drop an effort the freshly selected model does not declare. */
1351
- reconcileEffort(rows, index) {
1352
- const row = rows[index];
1353
- if (row === void 0) return rows;
1354
- const efforts = this.effortsFor(row);
1355
- if (efforts !== void 0 && row.effort !== "" && !efforts.includes(row.effort)) {
1356
- return rows.map((candidate, at) => at === index ? { ...candidate, effort: "" } : candidate);
1357
- }
1358
- return rows;
1359
- }
1360
- /** Append an empty row and write it: a new row is a decision like any other. */
1361
1312
  addRow() {
1362
1313
  this.stage({ rows: [...this.state.rows, { description: "", provider: "", model: "", effort: "", enabled: true }] });
1363
1314
  void this.commit("rows");
1364
1315
  }
1365
- /**
1366
- * Replace the list with an imported one and write it.
1367
- *
1368
- * The import dialog's own button is the confirmation, so the list it produces
1369
- * is written at once rather than left as a draft the reader has to commit a
1370
- * second time.
1371
- *
1372
- * @param rows - the rows read from the pasted JSON.
1373
- * @param preserveUnlisted - keep existing rules omitted from the import.
1374
- */
1375
1316
  replaceRows(rows, preserveUnlisted = false) {
1376
1317
  this.stage({ rows: planRowsImport(this.state.rows, rows, preserveUnlisted).rows });
1377
1318
  void this.commit("rows");
1378
1319
  }
1379
- /**
1380
- * Replace the judgement service's connection settings with an imported set and
1381
- * write them.
1382
- *
1383
- * The import dialog's own button is the confirmation, so the settings it
1384
- * produces are written at once rather than left as a draft.
1385
- *
1386
- * @param draft - the settings read from the pasted JSON.
1387
- */
1388
1320
  replaceJudgeConfig(draft) {
1389
1321
  this.stage({
1390
1322
  endpointUrl: draft.endpointUrl,
@@ -1404,27 +1336,10 @@ var DispatchCardStore = class {
1404
1336
  this.stage({ rows });
1405
1337
  void this.commit("rows");
1406
1338
  }
1407
- /** Delete one row and write the rest; the remaining rows renumber themselves. */
1408
1339
  removeRow(index) {
1409
1340
  this.stage({ rows: this.state.rows.filter((_row, at) => at !== index) });
1410
1341
  void this.commit("rows");
1411
1342
  }
1412
- /**
1413
- * Write one section's staged edits as one batch.
1414
- *
1415
- * The card queues commits so each one reads the latest drafts and committed
1416
- * values after the previous commit settles. The shared form orders these
1417
- * writes with the session menu's writes and supplies their revision fences.
1418
- *
1419
- * The judgement section also writes a typed key, so leaving the key field and
1420
- * leaving the endpoint field are one kind of gesture. The type rows are written
1421
- * whole rather than diffed: the array is one value, and a positional number is
1422
- * derived from it, so a partial write could momentarily renumber the list under
1423
- * a reader mid-write.
1424
- *
1425
- * @param section - which section's drafts to write.
1426
- * @returns settlement after the write, whether it landed or not.
1427
- */
1428
1343
  commit(section) {
1429
1344
  this.queue = this.queue.then(() => this.write(section)).catch(() => {
1430
1345
  this.pendingOps = [];
@@ -1436,15 +1351,10 @@ var DispatchCardStore = class {
1436
1351
  });
1437
1352
  return this.queue;
1438
1353
  }
1439
- /** Queue text drafts before leaving. Logging switches already queue their own writes. */
1440
1354
  flush() {
1441
1355
  void this.commit("judge");
1442
1356
  return this.commit("rows");
1443
1357
  }
1444
- /**
1445
- * The write itself, run from the queue.
1446
- * @param section - which section's drafts to write.
1447
- */
1448
1358
  async write(section) {
1449
1359
  const form = this.form;
1450
1360
  if (form === null || !this.state.writable) return;
@@ -1508,17 +1418,6 @@ var DispatchCardStore = class {
1508
1418
  this.state = { ...this.state, writing: "", writeErrors };
1509
1419
  this.notify();
1510
1420
  }
1511
- /**
1512
- * Write one judgement key through the credentials service.
1513
- *
1514
- * The service resolves with `{ ok: false }` rather than rejecting when it
1515
- * refuses a write, so that result decides the outcome. The key value is handed
1516
- * straight to the service and is never copied into the page state.
1517
- *
1518
- * @param endpoint - the address in the form when the key was typed.
1519
- * @param rawKey - the staged, still non-empty key text.
1520
- * @returns whether the write landed, and the message when it did not.
1521
- */
1522
1421
  async writeKey(endpoint, rawKey) {
1523
1422
  const credentials = this.credentials;
1524
1423
  this.state = { ...this.state, key: { ...this.state.key, writing: true } };
@@ -1552,7 +1451,6 @@ var DispatchCardStore = class {
1552
1451
  return { ok: false, error: message };
1553
1452
  }
1554
1453
  }
1555
- /** Read the runtime log from the Host. */
1556
1454
  async refreshLog() {
1557
1455
  if (this.state.logLoading) return;
1558
1456
  const remote = this.remote;
@@ -1565,16 +1463,15 @@ var DispatchCardStore = class {
1565
1463
  this.state = { ...this.state, logLoading: true };
1566
1464
  this.notify();
1567
1465
  try {
1568
- const entries = await remote.log();
1466
+ const { entries, recovered } = await remote.log();
1569
1467
  if (revision !== this.logLoadRevision) return;
1570
- this.state = { ...this.state, log: entries, logLoaded: true, logFailed: false, logLoading: false };
1468
+ this.state = { ...this.state, log: entries, logRecovered: recovered, logLoaded: true, logFailed: false, logLoading: false };
1571
1469
  } catch {
1572
1470
  if (revision !== this.logLoadRevision) return;
1573
1471
  this.state = { ...this.state, logLoaded: true, logFailed: true, logLoading: false };
1574
1472
  }
1575
1473
  this.notify();
1576
1474
  }
1577
- /** Read the exact prompt a judgement would send. */
1578
1475
  async preview(task = "", label = "") {
1579
1476
  try {
1580
1477
  return await this.remote?.preview?.(task, label) ?? null;
@@ -1582,7 +1479,6 @@ var DispatchCardStore = class {
1582
1479
  return null;
1583
1480
  }
1584
1481
  }
1585
- /** Test the judge endpoint against the committed settings. */
1586
1482
  async probe() {
1587
1483
  if (this.remote === null) return { ok: false, latencyMs: 0, reason: "unreachable" };
1588
1484
  try {
@@ -1598,14 +1494,6 @@ var DispatchCardStore = class {
1598
1494
  return { ok: false, reason: "unreachable" };
1599
1495
  }
1600
1496
  }
1601
- /** The declared effort ids, or undefined when this model's metadata is unavailable. */
1602
- effortsFor(row) {
1603
- const option = this.state.models.find(
1604
- (candidate) => candidate.provider === row.provider && candidate.model === row.model
1605
- );
1606
- return option?.catalogued === true ? option.efforts : void 0;
1607
- }
1608
- /** Whether one row will be offered to the judge (the server's own rule). */
1609
1497
  rowUsable(row) {
1610
1498
  return isOfferedRow(row);
1611
1499
  }
@@ -1686,6 +1574,33 @@ var RULES_LIST_CSS = `
1686
1574
  .dsh-judge-rule-effort-input > span { flex: 1; min-width: 0; }
1687
1575
  @media (pointer: coarse) { .dsh-judge-rule-editor { font: var(--dsw-font-m-16); } }
1688
1576
  `;
1577
+ var CLEAR_MODEL_SEARCH = "clear-model-search";
1578
+ function providerLabel(option, models) {
1579
+ const duplicate = models.some((item) => item.provider !== option.provider && item.providerName === option.providerName);
1580
+ return duplicate ? `${option.providerName} (${option.provider})` : option.providerName;
1581
+ }
1582
+ function modelLabel(option, models) {
1583
+ const duplicate = models.some((item) => item.provider === option.provider && item.model !== option.model && item.label === option.label);
1584
+ return duplicate ? `${option.label} (${option.model})` : option.label;
1585
+ }
1586
+ function modelMenuItems(models, query) {
1587
+ const words = query.trim().toLowerCase().split(/\s+/);
1588
+ const groups = /* @__PURE__ */ new Map();
1589
+ for (const option of models) {
1590
+ const searchable = [option.label, option.model, option.providerName, option.provider].join(" ").toLowerCase();
1591
+ if (!words.every((word) => searchable.includes(word))) continue;
1592
+ const group = groups.get(option.provider) ?? [];
1593
+ group.push(option);
1594
+ groups.set(option.provider, group);
1595
+ }
1596
+ return Array.from(groups, ([provider, options]) => [
1597
+ { type: "label", id: `provider:${provider}`, text: providerLabel(options[0], models) },
1598
+ ...options.map((option) => ({
1599
+ id: routeKey(provider, option.model),
1600
+ label: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { title: `${option.provider}/${option.model}`, children: modelLabel(option, models) })
1601
+ }))
1602
+ ]).flat();
1603
+ }
1689
1604
  function readRuleModel(state, row) {
1690
1605
  const provider = row.provider.trim();
1691
1606
  const model = row.model.trim();
@@ -1693,10 +1608,10 @@ function readRuleModel(state, row) {
1693
1608
  const modelChosen = provider !== "" && model !== "";
1694
1609
  const effortChosen = row.useDefaultEffort === true || effort !== "";
1695
1610
  const option = state.models.find((item) => item.provider === provider && item.model === model);
1696
- const efforts = option?.catalogued === true ? option.efforts : void 0;
1611
+ const efforts = option?.efforts;
1697
1612
  let problem;
1698
- if (modelChosen && state.modelAuthorization === "enabled" && option === void 0) {
1699
- problem = "model-not-allowed";
1613
+ if (modelChosen && state.catalogStatus === "ready" && option === void 0) {
1614
+ problem = "model-unavailable";
1700
1615
  } else if (row.useDefaultEffort !== true && effort !== "" && efforts !== void 0 && !efforts.includes(effort)) {
1701
1616
  problem = "effort-not-supported";
1702
1617
  }
@@ -1711,16 +1626,17 @@ function commitRows() {
1711
1626
  function RuleRow({ draft, index, number, state, t, onMove }) {
1712
1627
  const [editingDescription, setEditingDescription] = (0, import_react2.useState)(false);
1713
1628
  const [openMenu, setOpenMenu] = (0, import_react2.useState)(null);
1629
+ const [modelQuery, setModelQuery] = (0, import_react2.useState)("");
1714
1630
  const editorId = (0, import_react2.useId)();
1715
1631
  const editor = (0, import_react2.useRef)(null);
1716
1632
  const description = draft.description.trim();
1717
1633
  const { provider, model, effort, modelChosen, effortChosen, option, efforts, problem } = readRuleModel(state, draft);
1718
- const modelText = model === "" ? t("rows.modelPlaceholder") : [option?.label || model, provider].filter(Boolean).join(" \xB7 ");
1634
+ const modelText = model === "" ? t("rows.modelPlaceholder") : option === void 0 ? [model, provider].filter(Boolean).join(" \xB7 ") : [modelLabel(option, state.models), providerLabel(option, state.models)].join(" \xB7 ");
1719
1635
  const effortText = draft.useDefaultEffort === true ? t("rows.effortDefault") : draft.effort;
1720
1636
  const hints = rowHints(state.rows, index, (key) => key === "rows.hintDuplicateDescription" ? t(key) : "").filter(Boolean);
1721
1637
  if (!modelChosen) hints.push(t("rows.hintNoModel"));
1722
1638
  if (!effortChosen) hints.push(t("rows.hintNoEffort"));
1723
- if (problem === "model-not-allowed") hints.push(t("rows.hintModelNotAllowed"));
1639
+ if (problem === "model-unavailable") hints.push(t("rows.hintModelUnavailable"));
1724
1640
  if (problem === "effort-not-supported") hints.push(t("rows.hintEffortUnavailable"));
1725
1641
  (0, import_react2.useLayoutEffect)(() => {
1726
1642
  if (editingDescription) editor.current?.focus();
@@ -1812,7 +1728,7 @@ function RuleRow({ draft, index, number, state, t, onMove }) {
1812
1728
  value: draft.description,
1813
1729
  placeholder: t("rows.descriptionPlaceholder"),
1814
1730
  "aria-label": `${t("rows.colDescription")} ${position}`,
1815
- onChange: (event) => dispatchCardStore.cell(index, "description", event.target.value),
1731
+ onChange: (event) => dispatchCardStore.describeRow(index, event.target.value),
1816
1732
  onBlur: commitRows
1817
1733
  }
1818
1734
  ),
@@ -1836,24 +1752,39 @@ function RuleRow({ draft, index, number, state, t, onMove }) {
1836
1752
  "aria-label": `${t("rows.colModel")} ${position} \xB7 ${modelText}`,
1837
1753
  "aria-haspopup": "menu",
1838
1754
  "aria-expanded": modelMenuOpen,
1839
- onClick: () => setOpenMenu(modelMenuOpen ? null : "model"),
1755
+ onClick: () => {
1756
+ setModelQuery("");
1757
+ setOpenMenu(modelMenuOpen ? null : "model");
1758
+ },
1840
1759
  children: [
1841
1760
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-judge-rule-choice-value", children: modelText }),
1842
1761
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": "true", children: "\u25BE" })
1843
1762
  ]
1844
1763
  }
1845
1764
  ),
1846
- items: state.models.map(({ provider: provider2, model: model2 }) => ({ id: routeKey(provider2, model2), label: `${provider2}/${model2}` })),
1765
+ items: modelMenuOpen ? modelMenuItems(state.models, modelQuery) : [],
1766
+ footer: modelQuery === "" ? void 0 : [{ id: CLEAR_MODEL_SEARCH, label: t("rows.modelSearchClear") }],
1847
1767
  selectedId: modelChosen ? routeKey(provider, model) : void 0,
1848
1768
  onSelect: (id) => {
1769
+ if (id === CLEAR_MODEL_SEARCH) {
1770
+ setModelQuery("");
1771
+ return;
1772
+ }
1849
1773
  const picked = splitRouteKey(id);
1850
- dispatchCardStore.cell(index, "provider", picked.provider);
1851
- dispatchCardStore.cell(index, "model", picked.model);
1774
+ dispatchCardStore.chooseModel(index, picked.provider, picked.model);
1852
1775
  closeMenu();
1853
1776
  commitRows();
1854
1777
  },
1855
1778
  onClose: closeMenu,
1856
- autoFocus: true,
1779
+ search: {
1780
+ label: t("rows.modelSearch"),
1781
+ emptyMessage: t("rows.modelSearchEmpty"),
1782
+ value: modelQuery,
1783
+ onChange: setModelQuery,
1784
+ skipAutoFocusOnTouch: true
1785
+ },
1786
+ maxVisibleRows: 8,
1787
+ minWidthFromAnchor: true,
1857
1788
  portal: true
1858
1789
  }
1859
1790
  )
@@ -2120,6 +2051,9 @@ function JudgeDispatchPanel(props) {
2120
2051
  (0, import_react3.useEffect)(() => () => {
2121
2052
  void dispatchCardStore.flush();
2122
2053
  }, []);
2054
+ (0, import_react3.useEffect)(() => {
2055
+ void dispatchCardStore.loadModels();
2056
+ }, []);
2123
2057
  (0, import_react3.useEffect)(() => {
2124
2058
  if (tab === "log") void dispatchCardStore.refreshLog();
2125
2059
  }, [tab]);
@@ -2128,16 +2062,15 @@ function JudgeDispatchPanel(props) {
2128
2062
  const savedOrigin = judgeOrigin(state.committed.endpointUrl);
2129
2063
  const keyConfigured = origin === savedOrigin && state.key.configured;
2130
2064
  const destination = (site) => site === void 0 ? t("sample.destinationMissing") : t("sample.destination").replace("{origin}", site);
2131
- const usableCount = state.modelAuthorization === "enabled" ? state.committed.rows.filter((row) => dispatchCardStore.rowUsable(row) && ruleModelProblem(state, row) === void 0).length : 0;
2065
+ const usableCount = state.catalogStatus === "ready" ? state.committed.rows.filter((row) => dispatchCardStore.rowUsable(row) && ruleModelProblem(state, row) === void 0).length : 0;
2132
2066
  const issues = [];
2133
2067
  if (!state.available) issues.push(t("ready.loading"));
2134
2068
  else {
2135
2069
  if (!savedOrigin) issues.push(t("ready.address"));
2136
2070
  if (!state.committed.judgeModel.trim()) issues.push(t("ready.model"));
2137
- if (state.modelAuthorization !== "enabled") issues.push(t(`ready.authorization.${state.modelAuthorization}`));
2138
- else if (usableCount === 0) issues.push(t("ready.rules"));
2071
+ if (state.catalogStatus === "ready" && usableCount === 0) issues.push(t("ready.rules"));
2139
2072
  }
2140
- const setupReady = issues.length === 0;
2073
+ const setupReady = issues.length === 0 && state.catalogStatus === "ready";
2141
2074
  const count = t("ready.count").replace("{used}", String(usableCount)).replace("{total}", String(state.committed.rows.length));
2142
2075
  const probeStale = probe !== null && (connectionDirty(state) || probe.revision !== state.connectionRevision);
2143
2076
  const result = sampleResult?.input === sample && sampleResult.revision === state.connectionRevision && sameRows(sampleResult.rows, state.committed.rows) ? sampleResult.result : void 0;
@@ -2242,7 +2175,7 @@ function JudgeDispatchPanel(props) {
2242
2175
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "dsh-judge-section", "aria-label": t("ready.label"), children: [
2243
2176
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dsh-judge-status", "data-ready": setupReady && state.committed.enabled, children: [
2244
2177
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: t(!setupReady ? "ready.needsSetup" : state.committed.enabled ? "ready.ready" : "ready.off") }),
2245
- state.modelAuthorization !== "unknown" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dsh-judge-desc", children: count })
2178
+ state.available && state.catalogStatus === "ready" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dsh-judge-desc", children: count })
2246
2179
  ] }),
2247
2180
  issues.map((issue) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dsh-judge-desc", children: issue }, issue)),
2248
2181
  state.available && !state.writable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dsh-judge-desc", children: t("ready.readOnly") })
@@ -2335,6 +2268,7 @@ function JudgeDispatchPanel(props) {
2335
2268
  ),
2336
2269
  !probing && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { role: "status", className: probe === null || probeStale ? "dsh-judge-desc" : probe.result.ok ? "dsh-judge-note-ok" : "dsh-judge-note-bad", children: [
2337
2270
  probe === null ? t("judge.notTested") : probeStale ? t("judge.testStale") : probe.result.ok ? t("judge.probeOk").replace("{latency}", String(probe.result.latencyMs)) : t("judge.probeFail").replace("{reason}", reasonText(probe.result.reason)),
2271
+ probe && !probeStale && !probe.result.ok && probe.result.httpStatus !== void 0 && t("judge.probeHttpStatus").replace("{status}", String(probe.result.httpStatus)),
2338
2272
  probe && !probeStale && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2339
2273
  " \xB7 ",
2340
2274
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("time", { dateTime: new Date(probe.at).toISOString(), children: new Date(probe.at).toLocaleTimeString() })
@@ -2352,6 +2286,18 @@ function JudgeDispatchPanel(props) {
2352
2286
  transfer("rows")
2353
2287
  ] })
2354
2288
  ] }),
2289
+ state.catalogStatus !== "ready" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dsh-judge-feedback", children: [
2290
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dsh-judge-desc", role: "status", children: t(state.catalogStatus === "loading" ? "rows.catalogLoading" : "rows.catalogUnavailable") }),
2291
+ state.catalogStatus === "unavailable" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2292
+ import_dsh_client_ui_primitives4.Button,
2293
+ {
2294
+ size: "sm",
2295
+ variant: "outline",
2296
+ onClick: () => void dispatchCardStore.loadModels(),
2297
+ children: t("rows.catalogRetry")
2298
+ }
2299
+ )
2300
+ ] }) : state.models.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dsh-judge-desc", children: t("rows.catalogEmpty") }),
2355
2301
  state.rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "dsh-judge-desc", children: t("rows.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RulesList, { state, t }),
2356
2302
  copied("rows"),
2357
2303
  saveFeedback(state, "rows", t)
@@ -2437,6 +2383,7 @@ function JudgeDispatchPanel(props) {
2437
2383
  LogPanel,
2438
2384
  {
2439
2385
  entries: state.log,
2386
+ recovered: state.logRecovered,
2440
2387
  loading: state.logLoading,
2441
2388
  loaded: state.logLoaded,
2442
2389
  failed: state.logFailed,
@@ -2550,7 +2497,6 @@ function setupSettingsUi(ctx) {
2550
2497
  try {
2551
2498
  dispatchCardStore.attach({
2552
2499
  form: ctx.configForms.get(SETTINGS_NAMESPACE),
2553
- allowedForm: ctx.configForms.get(ALLOWED_MODELS_NAMESPACE),
2554
2500
  session: ctx.remote?.session ?? null,
2555
2501
  remote: createDispatchRemote(),
2556
2502
  credentials: ctx.remote?.credentials ?? null,