@productbrain/mcp 0.0.1-beta.8770 → 0.0.1-beta.8779
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/dist/{chunk-7GE3P7XW.js → chunk-EQSIIMRC.js} +1 -18
- package/dist/chunk-EQSIIMRC.js.map +1 -0
- package/dist/{chunk-KKDDIKQU.js → chunk-USZ2527R.js} +34 -58
- package/dist/chunk-USZ2527R.js.map +1 -0
- package/dist/cli/index.js +1 -1
- package/dist/http.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{setup-PF2ZDPZC.js → setup-2NV6EI3B.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-7GE3P7XW.js.map +0 -1
- package/dist/chunk-KKDDIKQU.js.map +0 -1
- /package/dist/{setup-PF2ZDPZC.js.map → setup-2NV6EI3B.js.map} +0 -0
|
@@ -36,14 +36,13 @@ import {
|
|
|
36
36
|
trackClassifierDivergence,
|
|
37
37
|
trackCollectionClassified,
|
|
38
38
|
trackCommitErrorByCode,
|
|
39
|
-
trackFieldGuidanceApplied,
|
|
40
39
|
trackKnowledgeGap,
|
|
41
40
|
trackQualityCheck,
|
|
42
41
|
trackQualityVerdict,
|
|
43
42
|
trackSessionCaptureRate,
|
|
44
43
|
trackZeroCaptureAuditFired,
|
|
45
44
|
validateCallerSession
|
|
46
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-EQSIIMRC.js";
|
|
47
46
|
|
|
48
47
|
// src/server.ts
|
|
49
48
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -905,13 +904,6 @@ async function captureVersionOrPreview(preview, params) {
|
|
|
905
904
|
return preview ? buildVersionPreviewResult(params.groundingEntry, params.name) : runVersionCapture(params);
|
|
906
905
|
}
|
|
907
906
|
|
|
908
|
-
// src/lib/bodyTemplate.ts
|
|
909
|
-
function readBodyTemplateGuidance(bodyTemplate) {
|
|
910
|
-
if (!bodyTemplate || bodyTemplate.length === 0) return void 0;
|
|
911
|
-
return bodyTemplate.map((entry) => `## ${entry.heading}
|
|
912
|
-
${entry.guidance}`).join("\n\n");
|
|
913
|
-
}
|
|
914
|
-
|
|
915
907
|
// src/lib/inferSourceDate.ts
|
|
916
908
|
function inferSourceDate(...values) {
|
|
917
909
|
const combined = values.filter((value) => typeof value === "string" && value.trim().length > 0).join("\n");
|
|
@@ -1171,29 +1163,23 @@ function verdictQualityPhrase(result2) {
|
|
|
1171
1163
|
if (!v || criteria.length === 0) {
|
|
1172
1164
|
return "Quality: not evaluated (no rubric for this type).";
|
|
1173
1165
|
}
|
|
1174
|
-
const
|
|
1175
|
-
const
|
|
1176
|
-
|
|
1177
|
-
return v.passed ? `Quality: all ${total} gating criteria pass.` : `Quality: ${passed}/${total} gating criteria pass \u2014 see the coaching above.`;
|
|
1178
|
-
}
|
|
1179
|
-
function hintLines(criteria) {
|
|
1180
|
-
const hints = (criteria ?? []).filter((c) => c.gating === false && !c.passed);
|
|
1181
|
-
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.`;
|
|
1182
1169
|
}
|
|
1183
1170
|
function formatRubricCoaching(result2) {
|
|
1184
1171
|
const { verdict, rogerMartin } = result2;
|
|
1185
1172
|
if (!verdict || verdict.criteria.length === 0) return "";
|
|
1186
1173
|
const lines = ["## Semantic Quality"];
|
|
1187
|
-
const
|
|
1188
|
-
const
|
|
1189
|
-
const total = gating.length;
|
|
1174
|
+
const failed = (verdict.criteria ?? []).filter((c) => !c.passed);
|
|
1175
|
+
const total = verdict.criteria?.length ?? 0;
|
|
1190
1176
|
const passedCount = total - failed.length;
|
|
1191
1177
|
if (verdict.passed) {
|
|
1192
|
-
lines.push(`All ${total}
|
|
1178
|
+
lines.push(`All ${total} rubric criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier).`);
|
|
1193
1179
|
} else {
|
|
1194
|
-
lines.push(`${passedCount}/${total}
|
|
1180
|
+
lines.push(`${passedCount}/${total} criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier)`);
|
|
1195
1181
|
lines.push("");
|
|
1196
|
-
for (const c of
|
|
1182
|
+
for (const c of verdict.criteria) {
|
|
1197
1183
|
const icon = c.passed ? "[x]" : "[ ]";
|
|
1198
1184
|
const extra = c.passed ? "" : ` \u2014 ${c.hint}`;
|
|
1199
1185
|
lines.push(`${icon} ${c.id}${extra}`);
|
|
@@ -1204,7 +1190,6 @@ function formatRubricCoaching(result2) {
|
|
|
1204
1190
|
lines.push(`_Question to consider:_ ${verdict.weakest.questionTemplate}`);
|
|
1205
1191
|
}
|
|
1206
1192
|
}
|
|
1207
|
-
lines.push(...hintLines(verdict.criteria));
|
|
1208
1193
|
if (rogerMartin) {
|
|
1209
1194
|
lines.push("");
|
|
1210
1195
|
lines.push("### Roger Martin Test");
|
|
@@ -1222,18 +1207,17 @@ function formatRubricCoaching(result2) {
|
|
|
1222
1207
|
function formatRubricVerdictSection(verdict) {
|
|
1223
1208
|
if (!verdict || !verdict.criteria || verdict.criteria.length === 0) return "";
|
|
1224
1209
|
const lines = ["## Semantic Quality"];
|
|
1225
|
-
const
|
|
1226
|
-
const
|
|
1227
|
-
const total = gating.length;
|
|
1210
|
+
const failed = verdict.criteria.filter((c) => !c.passed);
|
|
1211
|
+
const total = verdict.criteria.length;
|
|
1228
1212
|
const passedCount = total - failed.length;
|
|
1229
1213
|
const durationSuffix = verdict.llmDurationMs ? ` in ${(verdict.llmDurationMs / 1e3).toFixed(1)}s` : "";
|
|
1230
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}` : "";
|
|
1231
1215
|
if (failed.length === 0) {
|
|
1232
|
-
lines.push(`All ${total}
|
|
1216
|
+
lines.push(`All ${total} rubric criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier, ${verdict.source} evaluation).${statusNote}`);
|
|
1233
1217
|
} else {
|
|
1234
|
-
lines.push(`${passedCount}/${total}
|
|
1218
|
+
lines.push(`${passedCount}/${total} criteria pass for \`${verdict.canonicalKey}\` (${verdict.tier} tier, ${verdict.source} evaluation)${statusNote}`);
|
|
1235
1219
|
lines.push("");
|
|
1236
|
-
for (const c of
|
|
1220
|
+
for (const c of verdict.criteria) {
|
|
1237
1221
|
const icon = c.passed ? "[x]" : "[ ]";
|
|
1238
1222
|
const extra = c.passed ? "" : ` \u2014 ${c.hint}`;
|
|
1239
1223
|
lines.push(`${icon} ${c.id}${extra}`);
|
|
@@ -1243,7 +1227,6 @@ function formatRubricVerdictSection(verdict) {
|
|
|
1243
1227
|
lines.push(`**Top improvement:** ${verdict.weakest.hint}`);
|
|
1244
1228
|
}
|
|
1245
1229
|
}
|
|
1246
|
-
lines.push(...hintLines(verdict.criteria));
|
|
1247
1230
|
if (verdict.rogerMartin) {
|
|
1248
1231
|
const rm = verdict.rogerMartin;
|
|
1249
1232
|
lines.push("");
|
|
@@ -2311,7 +2294,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
|
|
|
2311
2294
|
try {
|
|
2312
2295
|
const wsForTracking = await getWorkspaceContext();
|
|
2313
2296
|
const v = verdictResult.verdict;
|
|
2314
|
-
const failedCount = (v.criteria ?? []).filter((c) => !c.passed
|
|
2297
|
+
const failedCount = (v.criteria ?? []).filter((c) => !c.passed).length;
|
|
2315
2298
|
trackQualityVerdict(wsForTracking.workspaceId, {
|
|
2316
2299
|
entry_id: finalEntryId,
|
|
2317
2300
|
entry_type: v.canonicalKey ?? resolvedCollection,
|
|
@@ -2319,7 +2302,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
|
|
|
2319
2302
|
context: "capture",
|
|
2320
2303
|
passed: v.passed,
|
|
2321
2304
|
source: verdictResult.source ?? "heuristic",
|
|
2322
|
-
criteria_total:
|
|
2305
|
+
criteria_total: v.criteria?.length ?? 0,
|
|
2323
2306
|
criteria_failed: failedCount,
|
|
2324
2307
|
llm_scheduled: v.tier !== "passive",
|
|
2325
2308
|
methodology_version: v.methodologyVersion
|
|
@@ -2422,15 +2405,6 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
|
|
|
2422
2405
|
lines.push(`_Grounding: ${parts.join(", ")}. Review and link if relevant._`);
|
|
2423
2406
|
}
|
|
2424
2407
|
}
|
|
2425
|
-
const bodyGuidance = readBodyTemplateGuidance(col.bodyTemplate);
|
|
2426
|
-
if (bodyGuidance) {
|
|
2427
|
-
lines.push("");
|
|
2428
|
-
lines.push(bodyGuidance);
|
|
2429
|
-
trackFieldGuidanceApplied(wsCtx.workspaceId, {
|
|
2430
|
-
collection: resolvedCollection,
|
|
2431
|
-
guided_heading_count: col.bodyTemplate?.length ?? 0
|
|
2432
|
-
});
|
|
2433
|
-
}
|
|
2434
2408
|
if (formativeHints.length > 0) {
|
|
2435
2409
|
lines.push("");
|
|
2436
2410
|
lines.push("## Quality Hints (advisory)");
|
|
@@ -2534,8 +2508,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`entries action=up
|
|
|
2534
2508
|
key: f.key,
|
|
2535
2509
|
required: f.required === true,
|
|
2536
2510
|
type: f.type
|
|
2537
|
-
}))
|
|
2538
|
-
...bodyGuidance ? { guidance: bodyGuidance } : {}
|
|
2511
|
+
}))
|
|
2539
2512
|
};
|
|
2540
2513
|
const totalMs = Date.now() - timingStart;
|
|
2541
2514
|
const timing = {
|
|
@@ -3008,7 +2981,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
|
|
|
3008
2981
|
if (coachingResult?.verdict) {
|
|
3009
2982
|
try {
|
|
3010
2983
|
const v = coachingResult.verdict;
|
|
3011
|
-
const failedCount = (v.criteria ?? []).filter((c) => !c.passed
|
|
2984
|
+
const failedCount = (v.criteria ?? []).filter((c) => !c.passed).length;
|
|
3012
2985
|
trackQualityVerdict(wsCtx.workspaceId, {
|
|
3013
2986
|
entry_id: entryId,
|
|
3014
2987
|
entry_type: v.canonicalKey ?? entry.canonicalKey ?? "",
|
|
@@ -3016,7 +2989,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
|
|
|
3016
2989
|
context: "commit",
|
|
3017
2990
|
passed: v.passed,
|
|
3018
2991
|
source: coachingResult.source ?? "heuristic",
|
|
3019
|
-
criteria_total:
|
|
2992
|
+
criteria_total: v.criteria?.length ?? 0,
|
|
3020
2993
|
criteria_failed: failedCount,
|
|
3021
2994
|
llm_scheduled: v.tier !== "passive",
|
|
3022
2995
|
methodology_version: v.methodologyVersion
|
|
@@ -5947,6 +5920,13 @@ function formatTimeAgo(ms) {
|
|
|
5947
5920
|
// src/tools/collections.ts
|
|
5948
5921
|
import { z as z17 } from "zod/v3";
|
|
5949
5922
|
|
|
5923
|
+
// src/lib/bodyTemplate.ts
|
|
5924
|
+
function readBodyTemplateGuidance(bodyTemplate) {
|
|
5925
|
+
if (!bodyTemplate || bodyTemplate.length === 0) return void 0;
|
|
5926
|
+
return bodyTemplate.map((entry) => `## ${entry.heading}
|
|
5927
|
+
${entry.guidance}`).join("\n\n");
|
|
5928
|
+
}
|
|
5929
|
+
|
|
5950
5930
|
// src/tools/labels.ts
|
|
5951
5931
|
import { z as z16 } from "zod/v3";
|
|
5952
5932
|
var labelsSchema = z16.object({
|
|
@@ -10540,9 +10520,7 @@ var qualityCheckOutputSchema = z21.object({
|
|
|
10540
10520
|
criteria: z21.array(z21.object({
|
|
10541
10521
|
id: z21.string(),
|
|
10542
10522
|
passed: z21.boolean(),
|
|
10543
|
-
hint: z21.string().optional()
|
|
10544
|
-
/** TASK-588 / DEC-1908: false = a coaching hint; an unmet one never fails the verdict. */
|
|
10545
|
-
gating: z21.literal(false).optional()
|
|
10523
|
+
hint: z21.string().optional()
|
|
10546
10524
|
}))
|
|
10547
10525
|
});
|
|
10548
10526
|
var qualityReevaluateOutputSchema = z21.object({
|
|
@@ -10672,11 +10650,10 @@ Entry \`${entryId}\` not found. Use \`search\` to find the right ID.`,
|
|
|
10672
10650
|
});
|
|
10673
10651
|
} catch {
|
|
10674
10652
|
}
|
|
10675
|
-
const
|
|
10676
|
-
const passedCount = gatingCriteria.filter((c) => c.passed).length;
|
|
10653
|
+
const passedCount = criteria.filter((c) => c.passed).length;
|
|
10677
10654
|
return successResult(
|
|
10678
10655
|
lines.join("\n"),
|
|
10679
|
-
`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.` : ""),
|
|
10680
10657
|
{
|
|
10681
10658
|
entryId,
|
|
10682
10659
|
entryFound: true,
|
|
@@ -10684,7 +10661,7 @@ Entry \`${entryId}\` not found. Use \`search\` to find the right ID.`,
|
|
|
10684
10661
|
stale: res.stale ?? false,
|
|
10685
10662
|
tier: verdict.tier,
|
|
10686
10663
|
passed: verdict.passed,
|
|
10687
|
-
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 }))
|
|
10688
10665
|
},
|
|
10689
10666
|
[
|
|
10690
10667
|
{ tool: "relations", description: "Suggest connections", parameters: { action: "suggest", entryId } }
|
|
@@ -10723,15 +10700,14 @@ async function handleReEvaluate(entryId, context) {
|
|
|
10723
10700
|
context,
|
|
10724
10701
|
passed: result2.verdict.passed ?? false,
|
|
10725
10702
|
source: "heuristic",
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
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,
|
|
10729
10705
|
llm_scheduled: llmScheduled,
|
|
10730
10706
|
methodology_version: result2.verdict.methodologyVersion
|
|
10731
10707
|
});
|
|
10732
10708
|
} catch {
|
|
10733
10709
|
}
|
|
10734
|
-
const criteria =
|
|
10710
|
+
const criteria = result2.verdict.criteria ?? [];
|
|
10735
10711
|
const reEvalScore = criteria.filter((c) => c.passed).length;
|
|
10736
10712
|
const reEvalMaxScore = criteria.length;
|
|
10737
10713
|
return {
|
|
@@ -14157,4 +14133,4 @@ export {
|
|
|
14157
14133
|
createProductBrainServer,
|
|
14158
14134
|
initFeatureFlags
|
|
14159
14135
|
};
|
|
14160
|
-
//# sourceMappingURL=chunk-
|
|
14136
|
+
//# sourceMappingURL=chunk-USZ2527R.js.map
|