@productbrain/mcp 0.0.1-beta.161 → 0.0.1-beta.163

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.
@@ -2350,23 +2350,22 @@ Or use \`collections action=list\` to see available collections.`
2350
2350
  };
2351
2351
  }
2352
2352
  const skipAutoDiscoveryEarly = links && links.length > 0;
2353
+ const groundingStart = Date.now();
2353
2354
  const groundingPromise = !skipAutoDiscoveryEarly && (name || description) ? mcpQuery("chain.suggestLinksForCapture", {
2354
2355
  entries: [{ name, description: description ?? "", collectionHint: resolvedCollection }],
2355
2356
  limit: 5,
2356
2357
  threshold: 2
2357
2358
  }).catch(() => null) : Promise.resolve(null);
2358
2359
  const groundingRaw = await groundingPromise;
2360
+ const groundingElapsedMs = Date.now() - groundingStart;
2359
2361
  const groundingEntry = groundingRaw?.[0] ?? null;
2360
2362
  const groundingRelated = groundingEntry?.related ?? [];
2361
2363
  const groundingDuplicates = groundingEntry?.duplicates ?? [];
2362
- const groundingGovernanceCandidates = [...groundingRelated, ...groundingDuplicates];
2363
- const groundingGovernance = [];
2364
- for (const c of groundingGovernanceCandidates) {
2365
- if (groundingGovernance.some((g) => g.entryId === c.entryId)) continue;
2366
- if (await isGoverned(c.collectionSlug)) {
2367
- groundingGovernance.push({ entryId: c.entryId, name: c.name, collectionSlug: c.collectionSlug });
2368
- }
2369
- }
2364
+ const groundingGovernance = (groundingEntry?.governance ?? []).map((g) => ({
2365
+ entryId: g.entryId,
2366
+ name: g.name,
2367
+ collectionSlug: g.collectionSlug
2368
+ }));
2370
2369
  const groundingReport = {
2371
2370
  related: groundingRelated.map((r) => ({
2372
2371
  entryId: r.entryId,
@@ -2568,6 +2567,17 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2568
2567
  throw error;
2569
2568
  }
2570
2569
  const tAfterCreate = Date.now();
2570
+ void mcpMutation("chain.recordGroundingOutcome", {
2571
+ surface: "mcp",
2572
+ promptShown: groundingReport.governance.length > 0,
2573
+ highestRatio: Math.max(
2574
+ ...groundingReport.duplicates.map((d) => d.overlapRatio),
2575
+ ...groundingReport.related.map((r) => r.overlapRatio),
2576
+ 0
2577
+ ),
2578
+ hadGovernance: groundingReport.governance.length > 0,
2579
+ grounding_ms: groundingElapsedMs
2580
+ }).catch(() => void 0);
2571
2581
  const linksCreated = [];
2572
2582
  const linksSuggested = [];
2573
2583
  const userLinkResults = [];
@@ -15756,4 +15766,4 @@ export {
15756
15766
  SERVER_VERSION,
15757
15767
  createProductBrainServer
15758
15768
  };
15759
- //# sourceMappingURL=chunk-6E6HZFTX.js.map
15769
+ //# sourceMappingURL=chunk-EPAHRXLQ.js.map