@lynn123411/dsh-subagent-judge-dispatch 0.6.10 → 0.6.12
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 +5 -5
- package/lib/client.js +52 -32
- package/lib/client.js.map +2 -2
- package/lib/index.js +19 -12
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- **试判样例**:输入任务并主动发送,将正文和已保存的类型清单发给配置的判断服务,显示所选路线和宿主校验结果;不派工、不记日志。
|
|
16
16
|
- **地址自动补路径**:端点地址填到主机就行,发请求时自动补上 `/v1/systemone`;地址里已经带了 `/v1/systemone` 或 `/systemone` 就原样用,只填到 `/v1` 就只补 `/systemone`。
|
|
17
17
|
- **密钥直接填**:判断服务要用的密钥就填在配置卡片里,存进 DSH 的凭据文件,只写不读;页面不会把它显示回来。
|
|
18
|
-
-
|
|
18
|
+
- **结果日志**:记录结果、路线、时间和耗时。点开一行可看判断模型、当时选中的类型描述和任务正文。配置页显示最近 10 条,磁盘最多保留 200 条。
|
|
19
19
|
|
|
20
20
|
## 安装与开关
|
|
21
21
|
|
|
@@ -91,11 +91,11 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
91
91
|
|
|
92
92
|
预览、真正发出的请求与答复匹配读的是同一份编号:关掉或没填全的行在这三处都不出现,所以预览里是编号 2 的那一行,就是答复「2」会选中的那一行。
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
提供方、模型和推理等级一次写入。新建子代理时,宿主会在派工描述事件后记录初始路线,插件根据派工调用参数判断这条路线是否由调用方显式指定,并优先保留显式指定的路线。有后续模型选择或模型请求记录时,插件保留现有路线。恢复子代理时,已有的模型选择同样优先。写入前,插件查宿主当前的子代理允许列表,并用 `llm.resolveCallConfig()` 校验这组提供方、模型和推理等级。模型校验返回后再核对允许列表,避免应用在校验期间撤销的路线。
|
|
95
95
|
|
|
96
96
|
判断失败或预检失败时,子代理沿用宿主已解析好的路线。
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
端点地址补全:页面按填写的内容保存地址,发请求时补齐 URL 的路径。路径已经以 `/v1/systemone` 或 `/systemone` 结尾就直接使用,只填到 `/v1` 就补 `/systemone`,更短的补 `/v1/systemone`。查询参数保持原值。地址与模型两格都不预填值,占位提示给出例子。
|
|
99
99
|
|
|
100
100
|
试通不依赖类型清单:连通性检查问的是「这个地址与模型能不能答」,所以它自己带一个选项发给判断服务,与读者写没写类型无关——清单是判断时才需要的输入,拿它当能不能测的前提,会让空清单的读者以为服务坏了。返回的原因是连通性本身:`unconfigured`(地址或模型没填)、`unreachable`、`timeout`、`unmatched`。
|
|
101
101
|
|
|
@@ -103,7 +103,7 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
103
103
|
|
|
104
104
|
判断日志写在 `~/.dsh/dsh-subagent-judge-dispatch/judgements.json`(跟随 `DSH_HOME`)。多个进程在同一个文件锁内读取并合并最新记录,再原子替换文件。
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
「选择」列显示模型和推理等级,悬停可以查看提供方。「未判成」结果的悬停提示说明失败原因。类型编号是判断时的编号;悬停显示随机行标识,旧记录或尚未保存标识的行提示无法追溯。开启日志时,新记录会在本地保存判断模型、当时选中的类型描述和完整任务正文。点开一行可查看这些内容,之后修改类型清单也不会改变旧记录里的描述。旧记录缺少的字段会显示「此记录未保存」。读取失败时保留已有列表并可刷新重试。日志页的「分析判断结果」可复制一段统计最近 100 条日志的请求。
|
|
107
107
|
|
|
108
108
|
### 导入导出
|
|
109
109
|
|
|
@@ -144,7 +144,7 @@ cd plugins/dsh-subagent-judge-dispatch && pnpm check
|
|
|
144
144
|
`check` = `typecheck` + `build` + 五个自检 + `assert:lib-untracked`:
|
|
145
145
|
|
|
146
146
|
- **`scripts/test-decision.mjs`** 直接验证判断请求、答复匹配、超时、类型编号与日志保留。用四个进程同时追加日志,核对磁盘保留完整的最新 200 条。
|
|
147
|
-
- **`scripts/smoke-host.mjs`** 用 Cordis `Context` 验证 `agent/created`
|
|
147
|
+
- **`scripts/smoke-host.mjs`** 用 Cordis `Context` 验证 `agent/created` 的派工关联、原路线保留、实时允许名单、推理等级校验、共享时限与日志详情;模拟判断服务检查样例正文、路线校验和不记日志。使用真实 Connection 验证 `/api` 必须认证、匿名凭据被拒、非 owner 无法触发样例判断。
|
|
148
148
|
- **`scripts/smoke-client.mjs`** 按 Web shell 的方式装载 `lib/client.js`(`window.__ModuleLoader__.load` 桩件),喂假 cordis 服务:断言卡片注册进 `plugins.bundle.config`、key 是包名、走 `slots.inject`、读本插件自己的命名空间与宿主那份「子代理可选用哪些模型」设置、以宿主在服务本条目为挂载条件、样式表在 `apply()` 追加一次且没写死色值,以及 zh/en 键集一致。它的守卫带反例断言(「守卫拒绝未声明的服务读取」必须抛)。
|
|
149
149
|
- **`scripts/test-card.mjs`** 打的是 `src/`,守配置卡片状态机、失败的日志读取与重试、行标识在排序后保持不变,以及清单与判断服务设置的导入导出。
|
|
150
150
|
- **`scripts/test-render.mjs`** 用真 react 把卡片画进 jsdom,验证配置、导入导出和日志表,旧记录的编号说明挂在 `Tooltip` 上。`ui-primitives` 走替身,外观与浮层定位要在真浏览器里看。
|
package/lib/client.js
CHANGED
|
@@ -384,8 +384,10 @@ var DispatchCardStore = class {
|
|
|
384
384
|
listeners = /* @__PURE__ */ new Set();
|
|
385
385
|
/** One commit at a time: a queued write reads the drafts as they stand when it runs. */
|
|
386
386
|
queue = Promise.resolve();
|
|
387
|
+
pendingOps = [];
|
|
387
388
|
form = null;
|
|
388
389
|
allowedForm = null;
|
|
390
|
+
modelLoadRevision = 0;
|
|
389
391
|
session = null;
|
|
390
392
|
remote = null;
|
|
391
393
|
credentials = null;
|
|
@@ -412,8 +414,8 @@ var DispatchCardStore = class {
|
|
|
412
414
|
}
|
|
413
415
|
if (this.allowedForm !== null) {
|
|
414
416
|
this.offAllowed = this.allowedForm.subscribe(() => void this.loadModels());
|
|
415
|
-
void this.loadModels();
|
|
416
417
|
}
|
|
418
|
+
void this.loadModels();
|
|
417
419
|
void this.refreshKeyStatus();
|
|
418
420
|
}
|
|
419
421
|
getState() {
|
|
@@ -427,11 +429,12 @@ var DispatchCardStore = class {
|
|
|
427
429
|
}
|
|
428
430
|
/** Read the Host's allowlist and the adapter catalogue into the model options. */
|
|
429
431
|
async loadModels() {
|
|
432
|
+
const revision = ++this.modelLoadRevision;
|
|
430
433
|
const allowedValue = this.allowedForm?.getSnapshot().value;
|
|
431
434
|
const allowed = Array.isArray(allowedValue?.allowedModels) ? allowedValue.allowedModels : [];
|
|
432
435
|
let groups = [];
|
|
433
436
|
let catalogRead = false;
|
|
434
|
-
if (this.session !== null) {
|
|
437
|
+
if (this.allowedForm !== null && this.session !== null) {
|
|
435
438
|
try {
|
|
436
439
|
const response = await this.session.modelCatalog();
|
|
437
440
|
if (response.ok) {
|
|
@@ -441,6 +444,7 @@ var DispatchCardStore = class {
|
|
|
441
444
|
} catch {
|
|
442
445
|
}
|
|
443
446
|
}
|
|
447
|
+
if (revision !== this.modelLoadRevision) return;
|
|
444
448
|
this.state = { ...this.state, models: buildModelOptions(allowed, groups), catalogRead };
|
|
445
449
|
this.notify();
|
|
446
450
|
}
|
|
@@ -468,7 +472,7 @@ var DispatchCardStore = class {
|
|
|
468
472
|
* while holding nothing would discard input mid-typing every time the Host
|
|
469
473
|
* publishes.
|
|
470
474
|
*/
|
|
471
|
-
deriveCommitted() {
|
|
475
|
+
deriveCommitted(notify = true) {
|
|
472
476
|
const snapshot = this.form?.getSnapshot();
|
|
473
477
|
const value = snapshot?.value;
|
|
474
478
|
if (value === void 0) return;
|
|
@@ -480,20 +484,24 @@ var DispatchCardStore = class {
|
|
|
480
484
|
judgeModel: typeof value.judgeModel === "string" ? value.judgeModel : "",
|
|
481
485
|
rows
|
|
482
486
|
};
|
|
483
|
-
const staged = (
|
|
484
|
-
|
|
487
|
+
const staged = (key) => {
|
|
488
|
+
const equal = key === "rows" ? (left, right) => JSON.stringify(left) === JSON.stringify(right) : Object.is;
|
|
489
|
+
const current = this.state[key];
|
|
490
|
+
const pending = this.pendingOps.find((op) => op.path[0] === key);
|
|
491
|
+
return !equal(current, this.state.committed[key]) || pending?.op === "set" && !equal(current, pending.value);
|
|
492
|
+
};
|
|
485
493
|
this.state = {
|
|
486
494
|
...this.state,
|
|
487
495
|
available: snapshot?.status === "ready",
|
|
488
496
|
writable: snapshot?.writable ?? false,
|
|
489
497
|
committed,
|
|
490
|
-
enabled: staged(
|
|
491
|
-
logEnabled: staged(
|
|
492
|
-
endpointUrl: staged(
|
|
493
|
-
judgeModel: staged(
|
|
494
|
-
rows:
|
|
498
|
+
enabled: staged("enabled") ? this.state.enabled : committed.enabled,
|
|
499
|
+
logEnabled: staged("logEnabled") ? this.state.logEnabled : committed.logEnabled,
|
|
500
|
+
endpointUrl: staged("endpointUrl") ? this.state.endpointUrl : committed.endpointUrl,
|
|
501
|
+
judgeModel: staged("judgeModel") ? this.state.judgeModel : committed.judgeModel,
|
|
502
|
+
rows: staged("rows") ? this.state.rows : committed.rows
|
|
495
503
|
};
|
|
496
|
-
this.notify();
|
|
504
|
+
if (notify) this.notify();
|
|
497
505
|
}
|
|
498
506
|
/**
|
|
499
507
|
* Stage one edit.
|
|
@@ -649,6 +657,7 @@ var DispatchCardStore = class {
|
|
|
649
657
|
}
|
|
650
658
|
return;
|
|
651
659
|
}
|
|
660
|
+
this.pendingOps = ops;
|
|
652
661
|
this.state = { ...this.state, writing: section, writeFailed: "", writeError: "" };
|
|
653
662
|
this.notify();
|
|
654
663
|
let failure = "";
|
|
@@ -668,14 +677,15 @@ var DispatchCardStore = class {
|
|
|
668
677
|
failure = error instanceof Error && error.message !== "" ? error.message : this.translate("write.invalid");
|
|
669
678
|
}
|
|
670
679
|
}
|
|
680
|
+
if (failure === "") this.deriveCommitted(false);
|
|
681
|
+
this.pendingOps = [];
|
|
671
682
|
this.state = {
|
|
672
683
|
...this.state,
|
|
673
684
|
writing: "",
|
|
674
685
|
writeFailed: failure === "" || keyFailed ? "" : section,
|
|
675
686
|
writeError: keyFailed ? "" : failure
|
|
676
687
|
};
|
|
677
|
-
|
|
678
|
-
else this.notify();
|
|
688
|
+
this.notify();
|
|
679
689
|
}
|
|
680
690
|
/**
|
|
681
691
|
* Write one judgement key through the credentials service.
|
|
@@ -875,10 +885,14 @@ var en = {
|
|
|
875
885
|
"log.resultJudged": "Type {id}",
|
|
876
886
|
"log.resultHistorical": "Type {id} at the time",
|
|
877
887
|
"log.resultInherited": "No match",
|
|
878
|
-
"log.
|
|
879
|
-
"log.
|
|
880
|
-
"log.
|
|
881
|
-
"log.
|
|
888
|
+
"log.detailTitle": "Judgement details",
|
|
889
|
+
"log.detailClose": "Close",
|
|
890
|
+
"log.detailModel": "Judge model",
|
|
891
|
+
"log.detailType": "Selected task type",
|
|
892
|
+
"log.detailTask": "Task content",
|
|
893
|
+
"log.detailMissing": "Unavailable in this record",
|
|
894
|
+
"log.detailUnmatched": "No task type selected",
|
|
895
|
+
"log.detailBlankType": "The selected type had no description",
|
|
882
896
|
"log.copyAnalysis": "Analyze judgement results",
|
|
883
897
|
"log.analysisPrompt": "Analyze the latest 100 records in dsh-subagent-judge-dispatch/judgements.json under DSH_HOME (default ~/.dsh). Summarize results by type, fallback reasons, and latency. Type numbering can change when the list is edited. Do not infer whether individual tasks were classified correctly from metrics alone.",
|
|
884
898
|
"log.analysisCopied": "Analysis prompt copied.",
|
|
@@ -996,10 +1010,14 @@ var zh = {
|
|
|
996
1010
|
"log.resultJudged": "\u7C7B\u578B {id}",
|
|
997
1011
|
"log.resultHistorical": "\u5F53\u65F6\u7684\u7C7B\u578B {id}",
|
|
998
1012
|
"log.resultInherited": "\u672A\u5224\u6210",
|
|
999
|
-
"log.
|
|
1000
|
-
"log.
|
|
1001
|
-
"log.
|
|
1002
|
-
"log.
|
|
1013
|
+
"log.detailTitle": "\u5224\u65AD\u8BE6\u60C5",
|
|
1014
|
+
"log.detailClose": "\u5173\u95ED",
|
|
1015
|
+
"log.detailModel": "\u5224\u65AD\u6A21\u578B",
|
|
1016
|
+
"log.detailType": "\u5224\u65AD\u51FA\u7684\u4EFB\u52A1\u7C7B\u578B",
|
|
1017
|
+
"log.detailTask": "\u4EFB\u52A1\u5185\u5BB9",
|
|
1018
|
+
"log.detailMissing": "\u6B64\u8BB0\u5F55\u672A\u4FDD\u5B58",
|
|
1019
|
+
"log.detailUnmatched": "\u672A\u9009\u4E2D\u4EFB\u52A1\u7C7B\u578B",
|
|
1020
|
+
"log.detailBlankType": "\u9009\u4E2D\u7684\u7C7B\u578B\u672A\u586B\u5199\u63CF\u8FF0",
|
|
1003
1021
|
"log.copyAnalysis": "\u5206\u6790\u5224\u65AD\u7ED3\u679C",
|
|
1004
1022
|
"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\u8BB0\u5F55\u3002\u7EDF\u8BA1\u5404\u7C7B\u578B\u7684\u5224\u65AD\u6B21\u6570\u3001\u5931\u8D25\u539F\u56E0\u548C\u8017\u65F6\u3002\u6E05\u5355\u6539\u52A8\u540E\u7C7B\u578B\u7F16\u53F7\u53EF\u80FD\u53D8\u5316\uFF0C\u4EC5\u51ED\u8FD9\u4E9B\u6307\u6807\u65E0\u6CD5\u5224\u65AD\u5355\u4E2A\u4EFB\u52A1\u662F\u5426\u88AB\u6B63\u786E\u5F52\u7C7B\u3002",
|
|
1005
1023
|
"log.analysisCopied": "\u5DF2\u590D\u5236\u5206\u6790\u63D0\u793A\u8BCD\u3002",
|
|
@@ -1148,6 +1166,9 @@ var CARD_CSS = `
|
|
|
1148
1166
|
.dsh-judge-modal { width: min(760px, 100%); max-height: min(85vh, 100%); --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2); --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2); }
|
|
1149
1167
|
.dsh-judge-prompt { max-height: 58vh; overflow: auto; }
|
|
1150
1168
|
.dsh-judge-prompt pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
|
|
1169
|
+
.dsh-judge-log-details { display: grid; gap: 8px; margin: 0; }
|
|
1170
|
+
.dsh-judge-log-details dt { font-weight: 600; }
|
|
1171
|
+
.dsh-judge-log-details dd { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1151
1172
|
/* \u7C98\u8D34\u6846\uFF1A\u7B49\u5BBD\u663E\u793A\uFF0C\u597D\u8BA9\u8BFB\u8005\u770B\u51FA JSON \u7684\u5C42\u7EA7\uFF1B\u81EA\u5DF1\u6491\u9AD8\u5230\u4E00\u5C4F\u7684\u4E00\u534A\u518D\u6EDA\u52A8\u3002 */
|
|
1152
1173
|
.dsh-judge-paste { box-sizing: border-box; width: 100%; min-height: 220px; max-height: 45vh; resize: vertical; padding: 10px 12px; border: 0.5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: var(--dsw-font-markdown-code-block); }
|
|
1153
1174
|
.dsh-judge-paste:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dsw-alias-state-business-primary); }
|
|
@@ -1697,18 +1718,17 @@ function JudgeDispatchPanel(props) {
|
|
|
1697
1718
|
{
|
|
1698
1719
|
open: detail !== null,
|
|
1699
1720
|
onClose: () => setDetail(null),
|
|
1700
|
-
title: t("log.
|
|
1701
|
-
closeLabel: t("log.
|
|
1702
|
-
description: t("log.promptDesc"),
|
|
1721
|
+
title: t("log.detailTitle"),
|
|
1722
|
+
closeLabel: t("log.detailClose"),
|
|
1703
1723
|
className: "dsh-judge-modal",
|
|
1704
|
-
children: detail !== null &&
|
|
1705
|
-
|
|
1706
|
-
{
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1724
|
+
children: detail !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dl", { className: "dsh-judge-prompt dsh-judge-log-details", children: [
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("log.detailModel") }),
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: detail.metrics?.judgeModel || t("log.detailMissing") }),
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("log.detailType") }),
|
|
1728
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: detail.typeDescription === void 0 ? t(detail.typeId === null ? "log.detailUnmatched" : "log.detailMissing") : detail.typeDescription.trim() || t("log.detailBlankType") }),
|
|
1729
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: t("log.detailTask") }),
|
|
1730
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: detail.taskText ?? t("log.detailMissing") })
|
|
1731
|
+
] })
|
|
1712
1732
|
}
|
|
1713
1733
|
)
|
|
1714
1734
|
] });
|