@productbrain/mcp 0.0.1-beta.8774 → 0.0.1-beta.8784
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.
|
@@ -1163,29 +1163,23 @@ function verdictQualityPhrase(result2) {
|
|
|
1163
1163
|
if (!v || criteria.length === 0) {
|
|
1164
1164
|
return "Quality: not evaluated (no rubric for this type).";
|
|
1165
1165
|
}
|
|
1166
|
-
const
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
return v.passed ? `Quality: all ${total} gating criteria pass.` : `Quality: ${passed}/${total} gating criteria pass \u2014 see the coaching above.`;
|
|
1170
|
-
}
|
|
1171
|
-
function hintLines(criteria) {
|
|
1172
|
-
const hints = (criteria ?? []).filter((c) => c.gating === false && !c.passed);
|
|
1173
|
-
return hints.length === 0 ? [] : ["", ...hints.map((c) => `hint (does not block): ${c.id} \u2014 ${c.hint}`)];
|
|
1166
|
+
const total = criteria.length;
|
|
1167
|
+
const passed = criteria.filter((c) => c.passed).length;
|
|
1168
|
+
return v.passed ? `Quality: all ${total} rubric criteria pass.` : `Quality: ${passed}/${total} rubric criteria pass \u2014 see the coaching above.`;
|
|
1174
1169
|
}
|
|
1175
1170
|
function formatRubricCoaching(result2) {
|
|
1176
1171
|
const { verdict, rogerMartin } = result2;
|
|
1177
1172
|
if (!verdict || verdict.criteria.length === 0) return "";
|
|
1178
1173
|
const lines = ["## Semantic Quality"];
|
|
1179
|
-
const
|
|
1180
|
-
const
|
|
1181
|
-
const total = gating.length;
|
|
1174
|
+
const failed = (verdict.criteria ?? []).filter((c) => !c.passed);
|
|
1175
|
+
const total = verdict.criteria?.length ?? 0;
|
|
1182
1176
|
const passedCount = total - failed.length;
|
|
1183
1177
|
if (verdict.passed) {
|
|
1184
|
-
lines.push(`All ${total}
|
|
1178
|
+
lines.push(`All ${total} rubric criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier).`);
|
|
1185
1179
|
} else {
|
|
1186
|
-
lines.push(`${passedCount}/${total}
|
|
1180
|
+
lines.push(`${passedCount}/${total} criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier)`);
|
|
1187
1181
|
lines.push("");
|
|
1188
|
-
for (const c of
|
|
1182
|
+
for (const c of verdict.criteria) {
|
|
1189
1183
|
const icon = c.passed ? "[x]" : "[ ]";
|
|
1190
1184
|
const extra = c.passed ? "" : ` \u2014 ${c.hint}`;
|
|
1191
1185
|
lines.push(`${icon} ${c.id}${extra}`);
|
|
@@ -1196,7 +1190,6 @@ function formatRubricCoaching(result2) {
|
|
|
1196
1190
|
lines.push(`_Question to consider:_ ${verdict.weakest.questionTemplate}`);
|
|
1197
1191
|
}
|
|
1198
1192
|
}
|
|
1199
|
-
lines.push(...hintLines(verdict.criteria));
|
|
1200
1193
|
if (rogerMartin) {
|
|
1201
1194
|
lines.push("");
|
|
1202
1195
|
lines.push("### Roger Martin Test");
|
|
@@ -1214,18 +1207,17 @@ function formatRubricCoaching(result2) {
|
|
|
1214
1207
|
function formatRubricVerdictSection(verdict) {
|
|
1215
1208
|
if (!verdict || !verdict.criteria || verdict.criteria.length === 0) return "";
|
|
1216
1209
|
const lines = ["## Semantic Quality"];
|
|
1217
|
-
const
|
|
1218
|
-
const
|
|
1219
|
-
const total = gating.length;
|
|
1210
|
+
const failed = verdict.criteria.filter((c) => !c.passed);
|
|
1211
|
+
const total = verdict.criteria.length;
|
|
1220
1212
|
const passedCount = total - failed.length;
|
|
1221
1213
|
const durationSuffix = verdict.llmDurationMs ? ` in ${(verdict.llmDurationMs / 1e3).toFixed(1)}s` : "";
|
|
1222
1214
|
const statusNote = verdict.llmStatus === "pending" ? " \u2014 LLM evaluation in progress..." : verdict.llmStatus === "failed" ? ` \u2014 LLM evaluation failed${verdict.llmError ? `: ${verdict.llmError}` : ""}, showing heuristic results` : verdict.source === "llm" && durationSuffix ? ` \u2014 evaluated${durationSuffix}` : "";
|
|
1223
1215
|
if (failed.length === 0) {
|
|
1224
|
-
lines.push(`All ${total}
|
|
1216
|
+
lines.push(`All ${total} rubric criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier, ${verdict.source} evaluation).${statusNote}`);
|
|
1225
1217
|
} else {
|
|
1226
|
-
lines.push(`${passedCount}/${total}
|
|
1218
|
+
lines.push(`${passedCount}/${total} criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier, ${verdict.source} evaluation)${statusNote}`);
|
|
1227
1219
|
lines.push("");
|
|
1228
|
-
for (const c of
|
|
1220
|
+
for (const c of verdict.criteria) {
|
|
1229
1221
|
const icon = c.passed ? "[x]" : "[ ]";
|
|
1230
1222
|
const extra = c.passed ? "" : ` \u2014 ${c.hint}`;
|
|
1231
1223
|
lines.push(`${icon} ${c.id}${extra}`);
|
|
@@ -1235,7 +1227,6 @@ function formatRubricVerdictSection(verdict) {
|
|
|
1235
1227
|
lines.push(`**Top improvement:** ${verdict.weakest.hint}`);
|
|
1236
1228
|
}
|
|
1237
1229
|
}
|
|
1238
|
-
lines.push(...hintLines(verdict.criteria));
|
|
1239
1230
|
if (verdict.rogerMartin) {
|
|
1240
1231
|
const rm = verdict.rogerMartin;
|
|
1241
1232
|
lines.push("");
|
|
@@ -2303,7 +2294,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
|
|
|
2303
2294
|
try {
|
|
2304
2295
|
const wsForTracking = await getWorkspaceContext();
|
|
2305
2296
|
const v = verdictResult.verdict;
|
|
2306
|
-
const failedCount = (v.criteria ?? []).filter((c) => !c.passed
|
|
2297
|
+
const failedCount = (v.criteria ?? []).filter((c) => !c.passed).length;
|
|
2307
2298
|
trackQualityVerdict(wsForTracking.workspaceId, {
|
|
2308
2299
|
entry_id: finalEntryId,
|
|
2309
2300
|
entry_type: v.canonicalKey ?? resolvedCollection,
|
|
@@ -2311,7 +2302,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
|
|
|
2311
2302
|
context: "capture",
|
|
2312
2303
|
passed: v.passed,
|
|
2313
2304
|
source: verdictResult.source ?? "heuristic",
|
|
2314
|
-
criteria_total:
|
|
2305
|
+
criteria_total: v.criteria?.length ?? 0,
|
|
2315
2306
|
criteria_failed: failedCount,
|
|
2316
2307
|
llm_scheduled: v.tier !== "passive",
|
|
2317
2308
|
methodology_version: v.methodologyVersion
|
|
@@ -2990,7 +2981,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
|
|
|
2990
2981
|
if (coachingResult?.verdict) {
|
|
2991
2982
|
try {
|
|
2992
2983
|
const v = coachingResult.verdict;
|
|
2993
|
-
const failedCount = (v.criteria ?? []).filter((c) => !c.passed
|
|
2984
|
+
const failedCount = (v.criteria ?? []).filter((c) => !c.passed).length;
|
|
2994
2985
|
trackQualityVerdict(wsCtx.workspaceId, {
|
|
2995
2986
|
entry_id: entryId,
|
|
2996
2987
|
entry_type: v.canonicalKey ?? entry.canonicalKey ?? "",
|
|
@@ -2998,7 +2989,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
|
|
|
2998
2989
|
context: "commit",
|
|
2999
2990
|
passed: v.passed,
|
|
3000
2991
|
source: coachingResult.source ?? "heuristic",
|
|
3001
|
-
criteria_total:
|
|
2992
|
+
criteria_total: v.criteria?.length ?? 0,
|
|
3002
2993
|
criteria_failed: failedCount,
|
|
3003
2994
|
llm_scheduled: v.tier !== "passive",
|
|
3004
2995
|
methodology_version: v.methodologyVersion
|
|
@@ -10529,9 +10520,7 @@ var qualityCheckOutputSchema = z21.object({
|
|
|
10529
10520
|
criteria: z21.array(z21.object({
|
|
10530
10521
|
id: z21.string(),
|
|
10531
10522
|
passed: z21.boolean(),
|
|
10532
|
-
hint: z21.string().optional()
|
|
10533
|
-
/** TASK-588 / DEC-1908: false = a coaching hint; an unmet one never fails the verdict. */
|
|
10534
|
-
gating: z21.literal(false).optional()
|
|
10523
|
+
hint: z21.string().optional()
|
|
10535
10524
|
}))
|
|
10536
10525
|
});
|
|
10537
10526
|
var qualityReevaluateOutputSchema = z21.object({
|
|
@@ -10661,11 +10650,10 @@ Entry \`${entryId}\` not found. Use \`search\` to find the right ID.`,
|
|
|
10661
10650
|
});
|
|
10662
10651
|
} catch {
|
|
10663
10652
|
}
|
|
10664
|
-
const
|
|
10665
|
-
const passedCount = gatingCriteria.filter((c) => c.passed).length;
|
|
10653
|
+
const passedCount = criteria.filter((c) => c.passed).length;
|
|
10666
10654
|
return successResult(
|
|
10667
10655
|
lines.join("\n"),
|
|
10668
|
-
`Quality check for ${entryId}: ${verdict.tier ?? "unknown"} tier, ${passedCount}/${
|
|
10656
|
+
`Quality check for ${entryId}: ${verdict.tier ?? "unknown"} tier, ${passedCount}/${criteria.length} criteria pass.` + (res.stale ? ` STALE \u2014 ${staleWhy}; re-evaluate for a current one.` : ""),
|
|
10669
10657
|
{
|
|
10670
10658
|
entryId,
|
|
10671
10659
|
entryFound: true,
|
|
@@ -10673,7 +10661,7 @@ Entry \`${entryId}\` not found. Use \`search\` to find the right ID.`,
|
|
|
10673
10661
|
stale: res.stale ?? false,
|
|
10674
10662
|
tier: verdict.tier,
|
|
10675
10663
|
passed: verdict.passed,
|
|
10676
|
-
criteria: criteria.map((c) => ({ id: c.id, passed: c.passed, hint: c.hint
|
|
10664
|
+
criteria: criteria.map((c) => ({ id: c.id, passed: c.passed, hint: c.hint }))
|
|
10677
10665
|
},
|
|
10678
10666
|
[
|
|
10679
10667
|
{ tool: "relations", description: "Suggest connections", parameters: { action: "suggest", entryId } }
|
|
@@ -10712,15 +10700,14 @@ async function handleReEvaluate(entryId, context) {
|
|
|
10712
10700
|
context,
|
|
10713
10701
|
passed: result2.verdict.passed ?? false,
|
|
10714
10702
|
source: "heuristic",
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
criteria_failed: result2.verdict.criteria?.filter((c) => !c.passed && c.gating !== false).length ?? 0,
|
|
10703
|
+
criteria_total: result2.verdict.criteria?.length ?? 0,
|
|
10704
|
+
criteria_failed: result2.verdict.criteria?.filter((c) => !c.passed).length ?? 0,
|
|
10718
10705
|
llm_scheduled: llmScheduled,
|
|
10719
10706
|
methodology_version: result2.verdict.methodologyVersion
|
|
10720
10707
|
});
|
|
10721
10708
|
} catch {
|
|
10722
10709
|
}
|
|
10723
|
-
const criteria =
|
|
10710
|
+
const criteria = result2.verdict.criteria ?? [];
|
|
10724
10711
|
const reEvalScore = criteria.filter((c) => c.passed).length;
|
|
10725
10712
|
const reEvalMaxScore = criteria.length;
|
|
10726
10713
|
return {
|
|
@@ -14146,4 +14133,4 @@ export {
|
|
|
14146
14133
|
createProductBrainServer,
|
|
14147
14134
|
initFeatureFlags
|
|
14148
14135
|
};
|
|
14149
|
-
//# sourceMappingURL=chunk-
|
|
14136
|
+
//# sourceMappingURL=chunk-USZ2527R.js.map
|