@lynn123411/dsh-subagent-judge-dispatch 0.6.7 → 0.6.9
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 +22 -21
- package/lib/client.js +100 -101
- package/lib/client.js.map +3 -3
- package/lib/index.js +534 -304
- package/lib/index.js.map +4 -4
- package/package.json +20 -19
package/README.md
CHANGED
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
- **清单由你写**:任务类型是一张表格,每一行写一段判定依据、选一个模型、选一个思考强度。模型从宿主那份「子代理可选用哪些模型」设置里读,强度从该模型自己声明的档位里读:档位读得到时强度栏是下拉,读不到时退回自由填写格。没填完的行、没有描述的行、描述和别的行重复的行,编号下面各有一句提示;它们照常写进配置,只是暂时不生效或判不准。每一行还有一个开关:关掉的行留在清单里,但不参与判断,也不占编号。
|
|
10
10
|
- **只改两样**:只改写子代理使用的模型与思考强度,不改名字、不改标题、不动主对话,其余一概沿用 DSH 原本的派工流程。
|
|
11
|
-
-
|
|
11
|
+
- **判断永不打断派工**:判断和路线校验共用 5 秒。判断服务不可用、答复不符合清单、校验失败或时间用完时,子代理沿用宿主已经解析好的路线。
|
|
12
12
|
- **导入导出**:任务类型清单与判断服务设置都能按纯 JSON 复制走,也能粘贴回来;粘进来的那一份直接替换并立即写入。判断服务那一份只含地址与判断模型,不含密钥。
|
|
13
13
|
- **完整预览**:看一眼真正会发给判断服务的整段内容,派工标签与任务正文那两处标注「派工时才填」。
|
|
14
14
|
- **当场试通**:判断服务的地址填完就能试一下通不通,不用等第一次派工失败。
|
|
15
|
+
- **试判样例**:输入任务并主动发送,将正文和已保存的类型清单发给配置的判断服务,显示所选路线和宿主校验结果;不派工、不记日志。
|
|
15
16
|
- **地址自动补路径**:端点地址填到主机就行,发请求时自动补上 `/v1/systemone`;地址里已经带了 `/v1/systemone` 或 `/systemone` 就原样用,只填到 `/v1` 就只补 `/systemone`。
|
|
16
17
|
- **密钥直接填**:判断服务要用的密钥就填在配置卡片里,存进 DSH 的凭据文件,只写不读;页面不会把它显示回来。
|
|
17
|
-
-
|
|
18
|
+
- **结果日志**:记录结果、路线、时间和耗时。点开一行可看判断模型、可选类型数和输入长度。配置页显示最近 10 条,磁盘最多保留 200 条。
|
|
18
19
|
|
|
19
20
|
## 安装与开关
|
|
20
21
|
|
|
@@ -34,7 +35,7 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
34
35
|
|
|
35
36
|
模型与推理等级菜单中可以按会话开关判断;关闭后该会话及其嵌套子代理的派工不判断,也不记日志。插件页的配置卡片可以设置会话默认是否开启,安装后默认开启;会话自己的选择优先于默认值。「记录日志」关掉后照常判断,只是不写日志文件。整条 loader entry 关掉时插件完全不加载。任务类型清单里每一行还有自己的开关,关掉的行不参与判断,也不占编号。
|
|
36
37
|
|
|
37
|
-
宿主半边声明的服务(`inject`):`credentials`、`sessions
|
|
38
|
+
宿主半边声明的服务(`inject`):`credentials`、`sessions`;`connection` 经 `ctx.inject` 取,取不到时插件照常加载、只是没有那三条读取通道;`settings` 同样经 `ctx.inject` 取,用来声明本条目不走宿主自动生成的设置页。
|
|
38
39
|
|
|
39
40
|
客户端半边有两层声明,两层都要写(见 `docs/rules/client-wiring.md`):
|
|
40
41
|
|
|
@@ -54,7 +55,7 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
54
55
|
| `logEnabled` | true | 判断结果写不写进日志文件。 |
|
|
55
56
|
| `endpointUrl` | 空 | 判断服务地址,按读者填的原样存,发请求时才补路径。 |
|
|
56
57
|
| `judgeModel` | 空 | 判断模型 id。 |
|
|
57
|
-
| `rows` | `[]` |
|
|
58
|
+
| `rows` | `[]` | 任务类型清单,按页面顺序;每行包含 `description`、`provider`、`model`、`effort`、开关 `enabled` 和随机标识 `stableId`。编号只数打开且填全的行,按数组位置从 1 连续;保存清单时为缺少标识的旧行补上标识。 |
|
|
58
59
|
|
|
59
60
|
字段都标了 `.volatile()`:改它们不重挂这条 loader entry,接线每次派工现读当前值。
|
|
60
61
|
|
|
@@ -64,7 +65,7 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
64
65
|
- **草稿按字段保留**:宿主每次发布配置,只有读者改过、且改动与「本页上次看到的已提交值」不同的那一项才留在页面上,其余跟着宿主走。按整节保留会让一次写入把读者没碰过的字段写回去,等于撤掉别的页面刚做的改动。
|
|
65
66
|
- **失败就地报**:写入没落地时,那句错误出现在发起写入的那一节最后一行,两节各报各的;它留到下一次写入真的落地才消失,读者再改一下并离开输入框就会重试,不弹窗打断。密钥写失败只在密钥那一行说一次。
|
|
66
67
|
- **密钥只写不读**:引用名是插件自己的常量 `SUBAGENT_JUDGE_API_KEY`,不是页面填的字段——读者只要把密钥贴进来,不必知道什么是凭据引用。密钥值交给凭据服务之后立刻从页面状态里清掉;页面只显示「已存 / 还没有」。页面没有凭据通道(非回环地址)时,输入框禁用,并有一行字说明原因。
|
|
67
|
-
-
|
|
68
|
+
- **依赖官方配置**:在「插件 → 官方 → 子智能体」开启「允许 Agent 为子智能体选择模型」,并添加允许的提供方和模型。关闭开关、列表不可用、模型不在允许列表中,或模型不支持选定的推理等级时,子代理沿用原路线。
|
|
68
69
|
|
|
69
70
|
## 实现
|
|
70
71
|
|
|
@@ -76,11 +77,13 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
76
77
|
|
|
77
78
|
先是派出这次活的标签(`subagent/descriptor` 的 `label`,宿主用它当子会话标题),再是任务正文原文,两段之间空一行。标签只有三五个词,是派工方写的摘要;正文才是「这个活到底要做什么」。只发标签,判断只能看出个大概方向;只发正文,遇到开头是套话的任务就丢了派工方的意图。
|
|
78
79
|
|
|
79
|
-
|
|
80
|
+
新建时,宿主在 `agent/created` 监听器返回后才投递初始任务。插件只在直接父会话当前步骤查找尚未结束的 `subagent` 或 `subagent_fork` 调用,要求派工描述与子代理 `subagent/descriptor` 的标签唯一匹配。直接调用和 `run_code` 内部调用分别对应 `tool/call` 与 `tool/ptc-dispatch-start`。找不到唯一匹配时,子代理沿用原路线。
|
|
81
|
+
|
|
82
|
+
恢复时,插件通过父会话的 `subagent/catalog` 定位本子代理的原始派工,并核对初始任务。初始任务的来源是直接父会话发出的 `agent-message`,可以出现在收件箱的 `agent/inbox/spliced` 中,也可以已经写成 `user/message`。取正文时去掉开头的发件人提示和末尾的回报说明。找不到原始派工的恢复会话沿用原路线。
|
|
80
83
|
|
|
81
84
|
只读子代理自己的事件:`ownEvents()`(或 `snapshotEvents(inheritedEventCount)`)是子代理自己产生的那一段。不能从日志开头读——叉出来的子代理,日志前缀是父代理已完成的回合,从开头读会把祖先的标签和父对话的第一条消息送给判断模型。
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
发给判断服务的长任务保留开头 1400 字和结尾 400 字,中间标明省略字数。
|
|
84
87
|
|
|
85
88
|
### 判断协议
|
|
86
89
|
|
|
@@ -88,9 +91,9 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
88
91
|
|
|
89
92
|
预览、真正发出的请求与答复匹配读的是同一份编号:关掉或没填全的行在这三处都不出现,所以预览里是编号 2 的那一行,就是答复「2」会选中的那一行。
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
提供方、模型和推理等级一次写入。派工调用显式指定路线,或子会话已经记录了模型选择或使用记录时,插件保留原路线。写入前,插件查宿主当前的子代理允许列表,并用 `llm.resolveCallConfig()` 校验这组提供方、模型和推理等级。模型校验返回后再核对允许列表,避免应用在校验期间撤销的路线。
|
|
92
95
|
|
|
93
|
-
|
|
96
|
+
判断失败或预检失败时,子代理沿用宿主已解析好的路线。
|
|
94
97
|
|
|
95
98
|
端点地址补全:页面只存读者填的那一段地址,真正请求的地址在发请求时算出来——已经以 `/v1/systemone` 或 `/systemone` 结尾就原样用,只填到 `/v1` 就补 `/systemone`,更短的补 `/v1/systemone`。地址与模型两格都不预填值,占位提示给出例子。
|
|
96
99
|
|
|
@@ -98,11 +101,9 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
98
101
|
|
|
99
102
|
### 日志
|
|
100
103
|
|
|
101
|
-
判断日志写在 `~/.dsh/dsh-subagent-judge-dispatch/judgements.json`(跟随 `DSH_HOME
|
|
102
|
-
|
|
103
|
-
表格「子代理」一栏只放派工标签(没有标签时退回正文开头,截到 60 字),不把判断模型读过的那一整段塞回去——那一整段在同一行的弹窗里能看到。日志是一张六列表:结果(`类型 3` / `未判成`)、选择(`模型 · 强度`,悬停补上供应商)、主代理、子代理、时间、耗时。结果在最左,读者扫一眼先看「判成了没有」;选择一栏只写各条之间真正不同的两样,供应商几乎每行都一样,悬停才把整段路 `供应商 · 模型 · 强度` 写出来。没判成的原因同样不在格子里展开,悬停才说——那一列宽度是给编号留的。放不下的格子截断,气泡用宿主的 `Tooltip`(原生 `title` 键盘够不到)。
|
|
104
|
+
判断日志写在 `~/.dsh/dsh-subagent-judge-dispatch/judgements.json`(跟随 `DSH_HOME`)。多个进程在同一个文件锁内读取并合并最新记录,再原子替换文件。
|
|
104
105
|
|
|
105
|
-
|
|
106
|
+
「选择」列显示模型和推理等级,悬停可以查看提供方。「未判成」结果的悬停提示说明失败原因。类型编号是判断时的编号;悬停显示随机行标识,旧记录或尚未保存标识的行提示无法追溯。行标识不记录判断条件,行内容后来改动时不能还原原描述。点开日志行可看当次请求的数值和模型信息。读取失败时保留已有列表并可刷新重试。日志不保存任务正文、派工标签、会话标题或判断条件。日志页的「分析判断结果」可复制一段统计最近 100 条日志的请求。
|
|
106
107
|
|
|
107
108
|
### 导入导出
|
|
108
109
|
|
|
@@ -126,13 +127,13 @@ dsh plugin --profile web add @lynn123411/dsh-subagent-judge-dispatch
|
|
|
126
127
|
|
|
127
128
|
## 限制
|
|
128
129
|
|
|
129
|
-
-
|
|
130
|
-
-
|
|
130
|
+
- 判断服务和宿主路线校验共用 5 秒,时间用完时沿用原路线。
|
|
131
|
+
- 编号按位置算,清单改变后会重排;旧日志没有行标识时不能确定当时的类型,删除或导入替换的行也无法与新行关联。
|
|
131
132
|
- 每个子代理只判一次,插件卸载或重载后这份记录清空。
|
|
132
|
-
-
|
|
133
|
+
- 宿主未开启子代理模型选择时,派工沿用宿主原路线。
|
|
133
134
|
- 日志文件留最近 200 条,配置页只列最近 10 条。
|
|
134
135
|
- 判断协议里的截断标记与失败原因用英文,不随界面语言变。
|
|
135
|
-
-
|
|
136
|
+
- 任务类型的模型选项来自官方子代理设置中的允许列表。
|
|
136
137
|
|
|
137
138
|
## 验证
|
|
138
139
|
|
|
@@ -142,11 +143,11 @@ cd plugins/dsh-subagent-judge-dispatch && pnpm check
|
|
|
142
143
|
|
|
143
144
|
`check` = `typecheck` + `build` + 五个自检 + `assert:lib-untracked`:
|
|
144
145
|
|
|
145
|
-
- **`scripts/test-decision.mjs`**
|
|
146
|
-
- **`scripts/smoke-host.mjs`**
|
|
146
|
+
- **`scripts/test-decision.mjs`** 直接验证判断请求、答复匹配、超时、类型编号与日志保留。用四个进程同时追加日志,核对磁盘保留完整的最新 200 条。
|
|
147
|
+
- **`scripts/smoke-host.mjs`** 用 Cordis `Context` 验证 `agent/created` 的派工关联、原路线保留、实时允许名单、推理等级校验、共享时限与无任务正文的日志;模拟判断服务检查样例正文、路线校验和不记日志。使用真实 Connection 验证 `/api` 必须认证、匿名凭据被拒、非 owner 无法触发样例判断。
|
|
147
148
|
- **`scripts/smoke-client.mjs`** 按 Web shell 的方式装载 `lib/client.js`(`window.__ModuleLoader__.load` 桩件),喂假 cordis 服务:断言卡片注册进 `plugins.bundle.config`、key 是包名、走 `slots.inject`、读本插件自己的命名空间与宿主那份「子代理可选用哪些模型」设置、以宿主在服务本条目为挂载条件、样式表在 `apply()` 追加一次且没写死色值,以及 zh/en 键集一致。它的守卫带反例断言(「守卫拒绝未声明的服务读取」必须抛)。
|
|
148
|
-
- **`scripts/test-card.mjs`** 打的是 `src
|
|
149
|
-
- **`scripts/test-render.mjs`** 用真 react 把卡片画进 jsdom
|
|
149
|
+
- **`scripts/test-card.mjs`** 打的是 `src/`,守配置卡片状态机、失败的日志读取与重试、行标识在排序后保持不变,以及清单与判断服务设置的导入导出。
|
|
150
|
+
- **`scripts/test-render.mjs`** 用真 react 把卡片画进 jsdom,验证配置、导入导出和日志表,旧记录的编号说明挂在 `Tooltip` 上。`ui-primitives` 走替身,外观与浮层定位要在真浏览器里看。
|
|
150
151
|
- **`assert-lib-untracked.mjs`**:`lib/` 是构建镜像,不入 git。
|
|
151
152
|
|
|
152
153
|
要肉眼确认页面上的形态,用仓库的 `node tools/verify-client.mjs dsh-subagent-judge-dispatch --needle '<你新写的文案>'`。
|
package/lib/client.js
CHANGED
|
@@ -129,29 +129,6 @@ function setupPluginPage(slots, register) {
|
|
|
129
129
|
return slots.inject(BUNDLE_CONFIG_SLOT, register);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// src/client/settings/official-settings.ts
|
|
133
|
-
var SUBAGENT_ITEM_ID = "subagent";
|
|
134
|
-
var OPEN_BUDGET_MS = 1500;
|
|
135
|
-
var OPEN_POLL_MS = 50;
|
|
136
|
-
function createOfficialSettingsOpener(navigation) {
|
|
137
|
-
if (navigation === void 0 || typeof navigation.openList !== "function") return null;
|
|
138
|
-
return () => {
|
|
139
|
-
navigation.openList();
|
|
140
|
-
const deadline = Date.now() + OPEN_BUDGET_MS;
|
|
141
|
-
const press = () => {
|
|
142
|
-
const card = document.querySelector(
|
|
143
|
-
`[data-plugin-item="${SUBAGENT_ITEM_ID}"] button`
|
|
144
|
-
);
|
|
145
|
-
if (card !== null) {
|
|
146
|
-
card.click();
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
if (Date.now() < deadline) setTimeout(press, OPEN_POLL_MS);
|
|
150
|
-
};
|
|
151
|
-
setTimeout(press, 0);
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
|
|
155
132
|
// src/server/judge-prompt.ts
|
|
156
133
|
function isSelectableRow(row) {
|
|
157
134
|
return row.provider.trim() !== "" && row.model.trim() !== "" && row.effort.trim() !== "";
|
|
@@ -165,6 +142,7 @@ var ALLOWED_MODELS_NAMESPACE = "subagent-model-selection-settings";
|
|
|
165
142
|
var LOG_ROUTE_PATH = "/api/dsh-subagent-judge-dispatch/log";
|
|
166
143
|
var PREVIEW_ROUTE_PATH = "/api/dsh-subagent-judge-dispatch/preview";
|
|
167
144
|
var PROBE_ROUTE_PATH = "/api/dsh-subagent-judge-dispatch/probe";
|
|
145
|
+
var SAMPLE_ROUTE_PATH = "/api/dsh-subagent-judge-dispatch/sample";
|
|
168
146
|
async function readJson(response) {
|
|
169
147
|
try {
|
|
170
148
|
return await response.json();
|
|
@@ -175,14 +153,11 @@ async function readJson(response) {
|
|
|
175
153
|
function createDispatchRemote() {
|
|
176
154
|
return {
|
|
177
155
|
async log() {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
} catch {
|
|
184
|
-
return [];
|
|
185
|
-
}
|
|
156
|
+
const response = await fetch(LOG_ROUTE_PATH);
|
|
157
|
+
if (!response.ok) throw new Error("Log request failed");
|
|
158
|
+
const body = await readJson(response);
|
|
159
|
+
if (body?.ok !== true || !Array.isArray(body.entries)) throw new Error("Invalid log response");
|
|
160
|
+
return body.entries;
|
|
186
161
|
},
|
|
187
162
|
async preview() {
|
|
188
163
|
try {
|
|
@@ -208,6 +183,15 @@ function createDispatchRemote() {
|
|
|
208
183
|
} catch {
|
|
209
184
|
return { ok: false, latencyMs: 0, reason: "unreachable" };
|
|
210
185
|
}
|
|
186
|
+
},
|
|
187
|
+
async sample(task) {
|
|
188
|
+
const response = await fetch(SAMPLE_ROUTE_PATH, {
|
|
189
|
+
method: "POST",
|
|
190
|
+
headers: { "content-type": "application/json" },
|
|
191
|
+
body: JSON.stringify({ task })
|
|
192
|
+
});
|
|
193
|
+
if (!response.ok) throw new Error("Sample request failed");
|
|
194
|
+
return await readJson(response) ?? { ok: false, reason: "unreachable" };
|
|
211
195
|
}
|
|
212
196
|
};
|
|
213
197
|
}
|
|
@@ -215,6 +199,7 @@ function readRow(value) {
|
|
|
215
199
|
const record = typeof value === "object" && value !== null ? value : {};
|
|
216
200
|
const text = (key) => typeof record[key] === "string" ? record[key] : "";
|
|
217
201
|
return {
|
|
202
|
+
...typeof record.stableId === "string" && record.stableId !== "" ? { stableId: record.stableId } : {},
|
|
218
203
|
description: text("description"),
|
|
219
204
|
provider: text("provider"),
|
|
220
205
|
model: text("model"),
|
|
@@ -406,7 +391,6 @@ var DispatchCardStore = class {
|
|
|
406
391
|
credentials = null;
|
|
407
392
|
offForm = null;
|
|
408
393
|
offAllowed = null;
|
|
409
|
-
officialSettingsOpener = null;
|
|
410
394
|
translate = (key) => key;
|
|
411
395
|
/** Bind the Host services; re-binding detaches the previous subscriptions. */
|
|
412
396
|
attach(options) {
|
|
@@ -417,7 +401,6 @@ var DispatchCardStore = class {
|
|
|
417
401
|
this.session = options.session;
|
|
418
402
|
this.remote = options.remote;
|
|
419
403
|
this.credentials = options.credentials;
|
|
420
|
-
this.officialSettingsOpener = options.officialSettingsOpener;
|
|
421
404
|
this.translate = options.t;
|
|
422
405
|
this.state = {
|
|
423
406
|
...this.state,
|
|
@@ -654,7 +637,9 @@ var DispatchCardStore = class {
|
|
|
654
637
|
ops.push({ op: "set", path: ["logEnabled"], value: this.state.logEnabled });
|
|
655
638
|
}
|
|
656
639
|
} else if (JSON.stringify(this.state.rows) !== JSON.stringify(this.state.committed.rows)) {
|
|
657
|
-
|
|
640
|
+
const rows = this.state.rows.map((row) => readRow({ ...row, stableId: row.stableId || crypto.randomUUID() }));
|
|
641
|
+
this.state = { ...this.state, rows };
|
|
642
|
+
ops.push({ op: "set", path: ["rows"], value: rows });
|
|
658
643
|
}
|
|
659
644
|
const typedKey = section === "judge" ? this.state.key.text.trim() : "";
|
|
660
645
|
if (ops.length === 0 && typedKey === "") {
|
|
@@ -726,17 +711,13 @@ var DispatchCardStore = class {
|
|
|
726
711
|
return { ok: false, error: message };
|
|
727
712
|
}
|
|
728
713
|
}
|
|
729
|
-
/** Whether this page can open the official setting the type list depends on. */
|
|
730
|
-
canOpenOfficialSettings() {
|
|
731
|
-
return this.officialSettingsOpener !== null;
|
|
732
|
-
}
|
|
733
|
-
/** Open the official setting the type list depends on. */
|
|
734
|
-
openOfficialSettings() {
|
|
735
|
-
this.officialSettingsOpener?.();
|
|
736
|
-
}
|
|
737
714
|
/** Read the runtime log from the Host. */
|
|
738
715
|
async refreshLog() {
|
|
739
|
-
if (this.remote === null)
|
|
716
|
+
if (this.remote === null) {
|
|
717
|
+
this.state = { ...this.state, logLoaded: true, logFailed: true };
|
|
718
|
+
this.notify();
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
740
721
|
try {
|
|
741
722
|
const entries = await this.remote.log();
|
|
742
723
|
this.state = { ...this.state, log: entries, logLoaded: true, logFailed: false };
|
|
@@ -763,6 +744,13 @@ var DispatchCardStore = class {
|
|
|
763
744
|
return { ok: false, latencyMs: 0, reason: "unreachable" };
|
|
764
745
|
}
|
|
765
746
|
}
|
|
747
|
+
async sample(task) {
|
|
748
|
+
try {
|
|
749
|
+
return await this.remote?.sample?.(task) ?? { ok: false, reason: "unreachable" };
|
|
750
|
+
} catch {
|
|
751
|
+
return { ok: false, reason: "unreachable" };
|
|
752
|
+
}
|
|
753
|
+
}
|
|
766
754
|
/** The effort ids available for one row's currently selected model. */
|
|
767
755
|
effortsFor(row) {
|
|
768
756
|
return this.state.models.find(
|
|
@@ -833,6 +821,7 @@ var en = {
|
|
|
833
821
|
"reason.timeout": "it did not answer within 5 seconds",
|
|
834
822
|
"reason.unmatched": "the answer named no listed type",
|
|
835
823
|
"reason.incomplete": "the selected type is not filled in",
|
|
824
|
+
"reason.unavailable-route": "the selected model or effort is unavailable",
|
|
836
825
|
"reason.other": "other",
|
|
837
826
|
"reason.unknown": "unknown reason",
|
|
838
827
|
"rows.title": "Task types",
|
|
@@ -851,8 +840,7 @@ var en = {
|
|
|
851
840
|
"rows.effortPlaceholder": "Not chosen",
|
|
852
841
|
"rows.incomplete": "Not used",
|
|
853
842
|
"rows.descriptionPlaceholder": "What kind of job is this? Write as much as you like.",
|
|
854
|
-
"rows.dependsOn":
|
|
855
|
-
"rows.dependsOnOpen": "Open",
|
|
843
|
+
"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.",
|
|
856
844
|
"rows.allowedEmpty": "The official setting offers no model yet; fill it in and the options appear here.",
|
|
857
845
|
"rows.importOpen": "Import",
|
|
858
846
|
"rows.export": "Export",
|
|
@@ -878,26 +866,33 @@ var en = {
|
|
|
878
866
|
"write.invalid": "This could not be written.",
|
|
879
867
|
"write.refused": "The host did not accept this write.",
|
|
880
868
|
"log.title": "Judgement log",
|
|
881
|
-
"log.desc": "The most recent
|
|
869
|
+
"log.desc": "The 10 most recent judgements. Open an entry to see its request metrics.",
|
|
882
870
|
"log.empty": "No judgement has run yet.",
|
|
883
871
|
"log.colResult": "Result",
|
|
884
872
|
"log.colChoice": "Choice",
|
|
885
|
-
"log.colParent": "Main agent",
|
|
886
|
-
"log.colChild": "Subagent",
|
|
887
873
|
"log.colTime": "Time",
|
|
888
874
|
"log.colLatency": "Took",
|
|
889
875
|
"log.resultJudged": "Type {id}",
|
|
876
|
+
"log.resultHistorical": "Type {id} at the time",
|
|
890
877
|
"log.resultInherited": "No match",
|
|
891
|
-
"log.promptTitle": "
|
|
892
|
-
"log.promptDesc": "
|
|
878
|
+
"log.promptTitle": "Judgement request metrics",
|
|
879
|
+
"log.promptDesc": "Judge model, number of offered choices, and input length.",
|
|
893
880
|
"log.promptClose": "Close",
|
|
894
|
-
"log.promptEmpty": "No request was
|
|
895
|
-
"log.copyAnalysis": "
|
|
896
|
-
"log.analysisPrompt": "Analyze the latest 100
|
|
881
|
+
"log.promptEmpty": "No judge request was attempted.",
|
|
882
|
+
"log.copyAnalysis": "Analyze judgement results",
|
|
883
|
+
"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.",
|
|
897
884
|
"log.analysisCopied": "Analysis prompt copied.",
|
|
898
885
|
"log.analysisCopyFailed": "Could not copy to the clipboard.",
|
|
899
886
|
"log.refresh": "Refresh",
|
|
900
887
|
"log.loadFailed": "The log could not be read.",
|
|
888
|
+
"log.typeKey": "Type identifier: {key}; number at the time of judgement.",
|
|
889
|
+
"log.legacyType": "Historical number; the original type cannot be identified after edits.",
|
|
890
|
+
"sample.title": "Try a sample task",
|
|
891
|
+
"sample.desc": "Sending will transmit this text and the configured type list to the configured judgement service. Uses saved settings; does not dispatch a subagent or write a log.",
|
|
892
|
+
"sample.send": "Send sample for judgement",
|
|
893
|
+
"sample.running": "Judging\u2026",
|
|
894
|
+
"sample.valid": "Route validation passed.",
|
|
895
|
+
"sample.failed": "Judgement or route validation failed:",
|
|
901
896
|
"ms": "{value} ms"
|
|
902
897
|
};
|
|
903
898
|
var zh = {
|
|
@@ -944,9 +939,10 @@ var zh = {
|
|
|
944
939
|
"judge.probeFail": "\u7528\u4E0D\u4E86\uFF1A{reason}",
|
|
945
940
|
"reason.unconfigured": "\u7AEF\u70B9\u5730\u5740\u6216\u5224\u65AD\u6A21\u578B\u8FD8\u6CA1\u586B",
|
|
946
941
|
"reason.unreachable": "\u8FDE\u4E0D\u4E0A\u8FD9\u4E2A\u5730\u5740",
|
|
947
|
-
"reason.timeout": "\
|
|
942
|
+
"reason.timeout": "\u5224\u65AD\u6216\u8DEF\u7EBF\u6821\u9A8C\u8D85\u8FC7 5 \u79D2",
|
|
948
943
|
"reason.unmatched": "\u7B54\u590D\u5BF9\u4E0D\u4E0A\u6E05\u5355",
|
|
949
944
|
"reason.incomplete": "\u9009\u4E2D\u7684\u7C7B\u578B\u6CA1\u586B\u5168",
|
|
945
|
+
"reason.unavailable-route": "\u9009\u4E2D\u7684\u6A21\u578B\u6216\u63A8\u7406\u7B49\u7EA7\u5F53\u524D\u4E0D\u53EF\u7528",
|
|
950
946
|
"reason.other": "\u5176\u4ED6",
|
|
951
947
|
"reason.unknown": "\u539F\u56E0\u4E0D\u660E",
|
|
952
948
|
"rows.title": "\u4EFB\u52A1\u7C7B\u578B",
|
|
@@ -965,8 +961,7 @@ var zh = {
|
|
|
965
961
|
"rows.effortPlaceholder": "\u8FD8\u6CA1\u9009",
|
|
966
962
|
"rows.incomplete": "\u4E0D\u751F\u6548",
|
|
967
963
|
"rows.descriptionPlaceholder": "\u8FD9\u662F\u54EA\u79CD\u6D3B\uFF1F\u5199\u591A\u5C11\u90FD\u884C\u3002",
|
|
968
|
-
"rows.dependsOn": "\
|
|
969
|
-
"rows.dependsOnOpen": "\u53BB\u8BBE\u7F6E",
|
|
964
|
+
"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",
|
|
970
965
|
"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",
|
|
971
966
|
"rows.importOpen": "\u5BFC\u5165",
|
|
972
967
|
"rows.export": "\u5BFC\u51FA",
|
|
@@ -992,26 +987,33 @@ var zh = {
|
|
|
992
987
|
"write.invalid": "\u8FD9\u6B21\u5199\u5165\u6CA1\u88AB\u63A5\u53D7\u3002",
|
|
993
988
|
"write.refused": "\u5BBF\u4E3B\u6CA1\u6709\u63A5\u53D7\u8FD9\u6B21\u5199\u5165\u3002",
|
|
994
989
|
"log.title": "\u5224\u65AD\u65E5\u5FD7",
|
|
995
|
-
"log.desc": "\u6700\u8FD1 10 \
|
|
990
|
+
"log.desc": "\u663E\u793A\u6700\u8FD1 10 \u6B21\u5224\u65AD\u3002\u70B9\u5F00\u4E00\u884C\u67E5\u770B\u5F53\u6B21\u8BF7\u6C42\u7684\u7EDF\u8BA1\u3002",
|
|
996
991
|
"log.empty": "\u8FD8\u6CA1\u6709\u5224\u65AD\u8FC7\u3002",
|
|
997
992
|
"log.colResult": "\u7ED3\u679C",
|
|
998
993
|
"log.colChoice": "\u9009\u62E9",
|
|
999
|
-
"log.colParent": "\u4E3B\u4EE3\u7406",
|
|
1000
|
-
"log.colChild": "\u5B50\u4EE3\u7406",
|
|
1001
994
|
"log.colTime": "\u65F6\u95F4",
|
|
1002
995
|
"log.colLatency": "\u8017\u65F6",
|
|
1003
996
|
"log.resultJudged": "\u7C7B\u578B {id}",
|
|
997
|
+
"log.resultHistorical": "\u5F53\u65F6\u7684\u7C7B\u578B {id}",
|
|
1004
998
|
"log.resultInherited": "\u672A\u5224\u6210",
|
|
1005
|
-
"log.promptTitle": "\
|
|
1006
|
-
"log.promptDesc": "\
|
|
999
|
+
"log.promptTitle": "\u5224\u65AD\u8BF7\u6C42\u7EDF\u8BA1",
|
|
1000
|
+
"log.promptDesc": "\u5224\u65AD\u6A21\u578B\u3001\u53EF\u9009\u7C7B\u578B\u6570\u548C\u8F93\u5165\u957F\u5EA6\u3002",
|
|
1007
1001
|
"log.promptClose": "\u5173\u95ED",
|
|
1008
|
-
"log.promptEmpty": "\u8FD9\u6B21\
|
|
1009
|
-
"log.copyAnalysis": "\
|
|
1010
|
-
"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\
|
|
1002
|
+
"log.promptEmpty": "\u8FD9\u6B21\u6CA1\u6709\u5C1D\u8BD5\u53D1\u9001\u5224\u65AD\u8BF7\u6C42\u3002",
|
|
1003
|
+
"log.copyAnalysis": "\u5206\u6790\u5224\u65AD\u7ED3\u679C",
|
|
1004
|
+
"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",
|
|
1011
1005
|
"log.analysisCopied": "\u5DF2\u590D\u5236\u5206\u6790\u63D0\u793A\u8BCD\u3002",
|
|
1012
1006
|
"log.analysisCopyFailed": "\u590D\u5236\u5230\u526A\u8D34\u677F\u6CA1\u6210\u529F\u3002",
|
|
1013
1007
|
"log.refresh": "\u5237\u65B0",
|
|
1014
1008
|
"log.loadFailed": "\u65E5\u5FD7\u8BFB\u4E0D\u51FA\u6765\u3002",
|
|
1009
|
+
"log.typeKey": "\u7C7B\u578B\u6807\u8BC6\uFF1A{key}\uFF1B\u7F16\u53F7\u662F\u5224\u65AD\u65F6\u7684\u7F16\u53F7\u3002",
|
|
1010
|
+
"log.legacyType": "\u8FD9\u662F\u5F53\u65F6\u7684\u7F16\u53F7\uFF1B\u6E05\u5355\u4FEE\u6539\u540E\u65E0\u6CD5\u786E\u5B9A\u539F\u6765\u7684\u7C7B\u578B\u3002",
|
|
1011
|
+
"sample.title": "\u8BD5\u5224\u6837\u4F8B\u4EFB\u52A1",
|
|
1012
|
+
"sample.desc": "\u53D1\u9001\u540E\uFF0C\u8FD9\u6BB5\u6587\u5B57\u548C\u5DF2\u4FDD\u5B58\u7684\u7C7B\u578B\u6E05\u5355\u4F1A\u53D1\u7ED9\u914D\u7F6E\u7684\u5224\u65AD\u670D\u52A1\u3002\u4F7F\u7528\u5DF2\u4FDD\u5B58\u7684\u8BBE\u7F6E\uFF0C\u4E0D\u4F1A\u6D3E\u51FA\u5B50\u4EE3\u7406\u6216\u5199\u5165\u65E5\u5FD7\u3002",
|
|
1013
|
+
"sample.send": "\u53D1\u9001\u6837\u4F8B\u5E76\u8BD5\u5224",
|
|
1014
|
+
"sample.running": "\u6B63\u5728\u5224\u65AD\u2026",
|
|
1015
|
+
"sample.valid": "\u8DEF\u7EBF\u6821\u9A8C\u901A\u8FC7\u3002",
|
|
1016
|
+
"sample.failed": "\u5224\u65AD\u6216\u8DEF\u7EBF\u6821\u9A8C\u5931\u8D25\uFF1A",
|
|
1015
1017
|
"ms": "{value} \u6BEB\u79D2"
|
|
1016
1018
|
};
|
|
1017
1019
|
function apply(ctx) {
|
|
@@ -1108,11 +1110,7 @@ var CARD_CSS = `
|
|
|
1108
1110
|
/* \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 */
|
|
1109
1111
|
.dsh-judge-actions-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
1110
1112
|
/* \u4EFB\u52A1\u7C7B\u578B\u90A3\u4E00\u8282\u9876\u90E8\u7684\u4E00\u884C\uFF1A\u4F9D\u8D56\u54EA\u4EFD\u5B98\u65B9\u914D\u7F6E\uFF0C\u4EE5\u53CA\u53BB\u90A3\u91CC\u7684\u5165\u53E3\u3002 */
|
|
1111
|
-
.dsh-judge-dependency { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px; }
|
|
1112
|
-
.dsh-judge-dependency .dsh-judge-desc { max-width: none; }
|
|
1113
1113
|
/* \u5165\u53E3\u6309\u94FE\u63A5\u7684\u6837\u5B50\u8D70\uFF1A\u6CA1\u6709\u6309\u94AE\u7684\u76D2\u5B50\u548C\u5E95\u8272\uFF0C\u53EA\u5728\u60AC\u505C\u65F6\u52A0\u4E0B\u5212\u7EBF\u3002 */
|
|
1114
|
-
.dsh-judge-link { height: auto; padding: 0 2px; color: var(--dsw-alias-link); font: var(--dsw-font-xxs-12); }
|
|
1115
|
-
.dsh-judge-link:hover { color: var(--dsw-alias-link); background: none; text-decoration: underline; }
|
|
1116
1114
|
/* \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 */
|
|
1117
1115
|
.dsh-judge-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
|
|
1118
1116
|
.dsh-judge-hint { color: var(--dsw-alias-label-tertiary); font: var(--dsw-font-xxs-12); }
|
|
@@ -1139,9 +1137,8 @@ var CARD_CSS = `
|
|
|
1139
1137
|
.dsh-judge-row-off .dsh-judge-field { opacity: 0.6; }
|
|
1140
1138
|
.dsh-judge-cell-actions { display: flex; gap: 6px; }
|
|
1141
1139
|
.dsh-judge-log { display: flex; flex-direction: column; gap: 4px; font: var(--dsw-font-xxs-12); }
|
|
1142
|
-
/*
|
|
1143
|
-
|
|
1144
|
-
.dsh-judge-log-row { display: grid; grid-template-columns: 72px minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 62px 74px; gap: 8px; align-items: center; text-align: left; border: 0; background: none; padding: 6px 4px; border-radius: var(--dsw-radius-sm); cursor: pointer; color: inherit; font: inherit; }
|
|
1140
|
+
/* Allow the model column to shrink so long names can be clipped. */
|
|
1141
|
+
.dsh-judge-log-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) 62px 74px; gap: 8px; align-items: center; text-align: left; border: 0; background: none; padding: 6px 4px; border-radius: var(--dsw-radius-sm); cursor: pointer; color: inherit; font: inherit; }
|
|
1145
1142
|
.dsh-judge-cell-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1146
1143
|
.dsh-judge-log-row:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
1147
1144
|
.dsh-judge-log-head { font-weight: 600; color: var(--dsw-alias-label-tertiary); cursor: default; }
|
|
@@ -1156,14 +1153,15 @@ var CARD_CSS = `
|
|
|
1156
1153
|
.dsh-judge-paste:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--dsw-alias-state-business-primary); }
|
|
1157
1154
|
`;
|
|
1158
1155
|
function injectCardStyles() {
|
|
1159
|
-
if (typeof document === "undefined") return
|
|
1160
|
-
|
|
1156
|
+
if (typeof document === "undefined" || document.getElementById(STYLE_ID) !== null) return () => {
|
|
1157
|
+
};
|
|
1161
1158
|
const element = document.createElement("style");
|
|
1162
1159
|
element.id = STYLE_ID;
|
|
1163
1160
|
element.dataset.plugin = PLUGIN_NAME;
|
|
1164
1161
|
element.dataset.pluginCss = `${PLUGIN_NAME}/settings/ui`;
|
|
1165
1162
|
element.textContent = CARD_CSS;
|
|
1166
1163
|
document.head.appendChild(element);
|
|
1164
|
+
return () => element.remove();
|
|
1167
1165
|
}
|
|
1168
1166
|
var STYLE_ID = "dsh-subagent-judge-dispatch-styles";
|
|
1169
1167
|
var PLUGIN_NAME = "@lynn123411/dsh-subagent-judge-dispatch";
|
|
@@ -1176,6 +1174,9 @@ function JudgeDispatchPanel(props) {
|
|
|
1176
1174
|
const [previewOpen, setPreviewOpen] = (0, import_react2.useState)(false);
|
|
1177
1175
|
const [probing, setProbing] = (0, import_react2.useState)(false);
|
|
1178
1176
|
const [probeResult, setProbeResult] = (0, import_react2.useState)(null);
|
|
1177
|
+
const [sampleTask, setSampleTask] = (0, import_react2.useState)("");
|
|
1178
|
+
const [sampling, setSampling] = (0, import_react2.useState)(false);
|
|
1179
|
+
const [sampleResult, setSampleResult] = (0, import_react2.useState)(null);
|
|
1179
1180
|
const [detail, setDetail] = (0, import_react2.useState)(null);
|
|
1180
1181
|
const [openMenu, setOpenMenu] = (0, import_react2.useState)(null);
|
|
1181
1182
|
const [importSection, setImportSection] = (0, import_react2.useState)(null);
|
|
@@ -1290,6 +1291,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1290
1291
|
}
|
|
1291
1292
|
) }),
|
|
1292
1293
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("td", { children: [
|
|
1294
|
+
draft.stableId && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dsh-judge-hint", children: t("log.typeKey").replace("{key}", draft.stableId) }),
|
|
1293
1295
|
rowHints(state.rows, index, t).map((hint) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dsh-judge-off", children: hint }, hint)),
|
|
1294
1296
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1295
1297
|
"textarea",
|
|
@@ -1548,19 +1550,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1548
1550
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", onClick: () => dispatchCardStore.addRow(), children: t("rows.add") })
|
|
1549
1551
|
] })
|
|
1550
1552
|
] }),
|
|
1551
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
1552
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "dsh-judge-desc", children: t("rows.dependsOn") }),
|
|
1553
|
-
dispatchCardStore.canOpenOfficialSettings() && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1554
|
-
import_dsh_client_ui_primitives2.Button,
|
|
1555
|
-
{
|
|
1556
|
-
variant: "ghost",
|
|
1557
|
-
size: "sm",
|
|
1558
|
-
className: "dsh-judge-link",
|
|
1559
|
-
onClick: () => dispatchCardStore.openOfficialSettings(),
|
|
1560
|
-
children: t("rows.dependsOnOpen")
|
|
1561
|
-
}
|
|
1562
|
-
)
|
|
1563
|
-
] }),
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-desc", children: t("rows.dependsOn") }),
|
|
1564
1554
|
state.models.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-off", children: t("rows.allowedEmpty") }),
|
|
1565
1555
|
state.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-desc", children: t("rows.empty") }),
|
|
1566
1556
|
state.rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "dsh-judge-table", children: [
|
|
@@ -1576,7 +1566,25 @@ function JudgeDispatchPanel(props) {
|
|
|
1576
1566
|
copyNote !== null && copyNote.section === "rows" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: copyNote.ok ? "dsh-judge-note-ok" : "dsh-judge-note-bad", role: "status", children: copyNote.text }),
|
|
1577
1567
|
failure("rows")
|
|
1578
1568
|
] }),
|
|
1579
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-footer", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", onClick: () => void openPreview(), children: t("preview.open") }) })
|
|
1569
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-footer", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", onClick: () => void openPreview(), children: t("preview.open") }) }),
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-judge-section", children: [
|
|
1571
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-title", children: t("sample.title") }),
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-desc", children: t("sample.desc") }),
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("textarea", { "aria-label": t("sample.title"), value: sampleTask, maxLength: 1e4, onChange: (event) => setSampleTask(event.target.value) }),
|
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Button, { variant: "outline", size: "sm", disabled: sampling || !sampleTask.trim() || state.writing !== "", onClick: () => void (async () => {
|
|
1575
|
+
setSampling(true);
|
|
1576
|
+
await dispatchCardStore.flush();
|
|
1577
|
+
const current = dispatchCardStore.getState();
|
|
1578
|
+
if (current.writeFailed || current.key.failed || current.endpointUrl !== current.committed.endpointUrl || current.judgeModel !== current.committed.judgeModel || JSON.stringify(current.rows) !== JSON.stringify(current.committed.rows)) setSampleResult({ ok: false, reason: "write" });
|
|
1579
|
+
else setSampleResult(await dispatchCardStore.sample(sampleTask));
|
|
1580
|
+
setSampling(false);
|
|
1581
|
+
})(), children: sampling ? t("sample.running") : t("sample.send") }),
|
|
1582
|
+
sampleResult && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { role: "status", children: [
|
|
1583
|
+
sampleResult.typeId != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: t("log.resultJudged").replace("{id}", String(sampleResult.typeId)) }),
|
|
1584
|
+
sampleResult.route && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: [sampleResult.route.provider, sampleResult.route.model, sampleResult.route.reasoningEffort].join(" \xB7 ") }),
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: sampleResult.ok ? t("sample.valid") : `${t("sample.failed")} ${sampleResult.reason === "write" ? t("write.invalid") : reasonText(sampleResult.reason)}` })
|
|
1586
|
+
] })
|
|
1587
|
+
] })
|
|
1580
1588
|
] });
|
|
1581
1589
|
const log = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-panel", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-judge-section", children: [
|
|
1582
1590
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-judge-head", children: [
|
|
@@ -1589,13 +1597,11 @@ function JudgeDispatchPanel(props) {
|
|
|
1589
1597
|
logCopyResult !== null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: logCopyResult ? "dsh-judge-note-ok" : "dsh-judge-note-bad", role: "status", children: t(logCopyResult ? "log.analysisCopied" : "log.analysisCopyFailed") }),
|
|
1590
1598
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-desc", children: t("log.desc") }),
|
|
1591
1599
|
state.logFailed && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-note-bad", children: t("log.loadFailed") }),
|
|
1592
|
-
state.logLoaded && state.log.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-desc", children: t("log.empty") }),
|
|
1600
|
+
state.logLoaded && !state.logFailed && state.log.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-desc", children: t("log.empty") }),
|
|
1593
1601
|
state.log.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-judge-log", children: [
|
|
1594
1602
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "dsh-judge-log-row dsh-judge-log-head", children: [
|
|
1595
1603
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("log.colResult") }),
|
|
1596
1604
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("log.colChoice") }),
|
|
1597
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("log.colParent") }),
|
|
1598
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("log.colChild") }),
|
|
1599
1605
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("log.colTime") }),
|
|
1600
1606
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("log.colLatency") })
|
|
1601
1607
|
] }),
|
|
@@ -1603,7 +1609,7 @@ function JudgeDispatchPanel(props) {
|
|
|
1603
1609
|
const result = entry.typeId === null ? {
|
|
1604
1610
|
text: t("log.resultInherited"),
|
|
1605
1611
|
hint: entry.reason === void 0 ? "" : reasonText(entry.reason)
|
|
1606
|
-
} : { text: t("log.
|
|
1612
|
+
} : { text: t("log.resultHistorical").replace("{id}", String(entry.typeId)), hint: entry.typeKey ? t("log.typeKey").replace("{key}", entry.typeKey) : t("log.legacyType") };
|
|
1607
1613
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1608
1614
|
"button",
|
|
1609
1615
|
{
|
|
@@ -1613,8 +1619,6 @@ function JudgeDispatchPanel(props) {
|
|
|
1613
1619
|
children: [
|
|
1614
1620
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LogCell, { text: result.text, hint: result.hint }),
|
|
1615
1621
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LogCell, { text: describeModel(entry) || "\u2014", hint: describeChoice(entry) }),
|
|
1616
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LogCell, { text: entry.parentTitle || "\u2014" }),
|
|
1617
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LogCell, { text: entry.childLabel || "\u2014" }),
|
|
1618
1622
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: new Date(entry.at).toLocaleTimeString() }),
|
|
1619
1623
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: t("ms").replace("{value}", String(entry.latencyMs)) })
|
|
1620
1624
|
]
|
|
@@ -1697,10 +1701,10 @@ function JudgeDispatchPanel(props) {
|
|
|
1697
1701
|
closeLabel: t("log.promptClose"),
|
|
1698
1702
|
description: t("log.promptDesc"),
|
|
1699
1703
|
className: "dsh-judge-modal",
|
|
1700
|
-
children: detail !== null && (detail.
|
|
1704
|
+
children: detail !== null && (detail.metrics === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-desc", children: t("log.promptEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "dsh-judge-prompt", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1701
1705
|
import_dsh_client_ui_primitives2.CodeBlock,
|
|
1702
1706
|
{
|
|
1703
|
-
code: detail.
|
|
1707
|
+
code: JSON.stringify(detail.metrics, null, 2),
|
|
1704
1708
|
copyLabel: t("preview.copy"),
|
|
1705
1709
|
copiedLabel: t("preview.copied")
|
|
1706
1710
|
}
|
|
@@ -1722,11 +1726,6 @@ function setupSettingsUi(ctx) {
|
|
|
1722
1726
|
remote: createDispatchRemote(),
|
|
1723
1727
|
// The judgement key is written here; its value never rides a response.
|
|
1724
1728
|
credentials: ctx.remote?.credentials ?? null,
|
|
1725
|
-
// The type list's options come from the host's own official setting; this
|
|
1726
|
-
// is the one jump to it the page can make.
|
|
1727
|
-
officialSettingsOpener: createOfficialSettingsOpener(
|
|
1728
|
-
ctx.get?.("pluginNavigation")
|
|
1729
|
-
),
|
|
1730
1729
|
t
|
|
1731
1730
|
});
|
|
1732
1731
|
} catch (error) {
|
|
@@ -1749,7 +1748,7 @@ function setupSettingsUi(ctx) {
|
|
|
1749
1748
|
var name = "@lynn123411/dsh-subagent-judge-dispatch";
|
|
1750
1749
|
var inject = ["slots", "configForms", "remote", "remote.session", "remote.credentials", "locale"];
|
|
1751
1750
|
function apply2(ctx) {
|
|
1752
|
-
injectCardStyles
|
|
1751
|
+
ctx.effect(injectCardStyles, "dsh-subagent-judge-dispatch: card styles");
|
|
1753
1752
|
apply(ctx);
|
|
1754
1753
|
ctx.slots.inject(MODEL_OPTIONS_SLOT, () => ctx.slots.register({
|
|
1755
1754
|
name: MODEL_OPTIONS_SLOT,
|