@lynn123411/dsh-subagent-judge-dispatch 0.6.16 → 0.6.17
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 +3 -3
- package/lib/client.js.map +2 -2
- package/lib/index.js +4 -7
- package/lib/index.js.map +2 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -193,9 +193,7 @@ var JudgeBudget = class {
|
|
|
193
193
|
|
|
194
194
|
// src/server/judge-prompt.ts
|
|
195
195
|
var QUESTION_KEY = "task_type";
|
|
196
|
-
var
|
|
197
|
-
var NONE_CRITERION = "None of the configured task types applies. Keep the original model selection.";
|
|
198
|
-
var QUESTION_INSTRUCTIONS = 'Which single task type below does the delegated job best match? Weigh what the job actually requires, not how it is phrased. Choose the number of a matching configured type, including an applicable catch-all type. Choose "none" only if no configured type applies.';
|
|
196
|
+
var QUESTION_INSTRUCTIONS = "Which single task type below does the delegated job best match? Weigh what the job actually requires, not how it is phrased. Answer with the number of exactly one listed type.";
|
|
199
197
|
var PROBE_OPTION_ID = "1";
|
|
200
198
|
var PROBE_TASK_TEXT = "\u8FDE\u63A5\u6D4B\u8BD5\uFF1A\u8FD9\u662F\u4E00\u6B21\u5224\u65AD\u670D\u52A1\u7684\u8FDE\u901A\u6027\u68C0\u67E5\u3002";
|
|
201
199
|
var PROBE_INSTRUCTIONS = "Answer with the number of the one option listed below.";
|
|
@@ -243,7 +241,6 @@ ${tail}`;
|
|
|
243
241
|
function buildJudgeRequest(rows, model, subject) {
|
|
244
242
|
const criteria = {};
|
|
245
243
|
for (const row of selectableRows(rows)) criteria[String(row.id)] = row.description;
|
|
246
|
-
criteria[NONE_OPTION_ID] = NONE_CRITERION;
|
|
247
244
|
return {
|
|
248
245
|
model,
|
|
249
246
|
state: { message: subject },
|
|
@@ -291,7 +288,6 @@ function readChoice(payload) {
|
|
|
291
288
|
function readJudgeAnswer(payload, rows) {
|
|
292
289
|
const choice = readChoice(payload);
|
|
293
290
|
if (choice === void 0) return { kind: "empty" };
|
|
294
|
-
if (choice === NONE_OPTION_ID) return { kind: "none" };
|
|
295
291
|
const row = rows.find((candidate) => String(candidate.id) === choice && isOfferedRow(candidate));
|
|
296
292
|
return row === void 0 ? { kind: "unmatched" } : { kind: "row", row };
|
|
297
293
|
}
|
|
@@ -367,7 +363,7 @@ async function judgeTaskType(endpoint, rows, subject, fetchImpl = fetch, sharedB
|
|
|
367
363
|
const decision = readJudgeAnswer(payload, offered);
|
|
368
364
|
const latencyMs = budget.elapsed();
|
|
369
365
|
if (decision.kind === "row") return { kind: "matched", row: decision.row, latencyMs, metrics };
|
|
370
|
-
return { kind: "fallback", reason:
|
|
366
|
+
return { kind: "fallback", reason: "unmatched", latencyMs, metrics };
|
|
371
367
|
} catch {
|
|
372
368
|
const reason = budget.expired() ? "timeout" : "unreachable";
|
|
373
369
|
return { kind: "fallback", reason, latencyMs: budget.elapsed(), metrics };
|
|
@@ -642,7 +638,7 @@ function createJudgePolicy(options) {
|
|
|
642
638
|
timings.preflight = Math.round(performance.now() - preflightStarted);
|
|
643
639
|
}
|
|
644
640
|
}
|
|
645
|
-
return { settings, prepare, evaluate, planIsCurrent, checkFinalRoute, previewRows };
|
|
641
|
+
return { settings, prepare, evaluate, planIsCurrent, checkFinalRoute, previewRows, hasRules: () => currentRules().length > 0 };
|
|
646
642
|
}
|
|
647
643
|
|
|
648
644
|
// src/server/log-store.ts
|
|
@@ -1228,6 +1224,7 @@ function apply(ctx, config) {
|
|
|
1228
1224
|
const cancellation = cancelWith(signal);
|
|
1229
1225
|
if (agent === void 0 || !isSubagent(agent) || judged.has(agent.id) || cancellation.aborted) return;
|
|
1230
1226
|
if (source !== "startup" && source !== "resume") return;
|
|
1227
|
+
if (!policy.hasRules()) return;
|
|
1231
1228
|
const resumed = source === "resume";
|
|
1232
1229
|
const budget = new JudgeBudget(cancellation);
|
|
1233
1230
|
const timings = {};
|