@productbrain/mcp 0.0.1-beta.1810 → 0.0.1-beta.1818

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.
@@ -724,6 +724,7 @@ var GENERIC_PROFILE = {
724
724
  COMMON_CHECKS.hasType
725
725
  ]
726
726
  };
727
+ var NON_DATA_CRITERION_FIELDS = /* @__PURE__ */ new Set(["grounding", "governanceWhy", "governanceSteering"]);
727
728
  function buildFieldQualityChecks(col) {
728
729
  const checks = [];
729
730
  const fields = col.fields ?? [];
@@ -764,6 +765,7 @@ function buildFieldQualityChecks(col) {
764
765
  }
765
766
  for (const criterion of col.qualityCriteria ?? []) {
766
767
  if (criterion.active === false) continue;
768
+ if (NON_DATA_CRITERION_FIELDS.has(criterion.field)) continue;
767
769
  const id = criterion.rule === "required" ? `field-${criterion.field}-required` : criterion.rule === "min_length" ? `field-${criterion.field}-min-length` : `quality-${criterion.field}-${criterion.rule}`;
768
770
  addCheck({
769
771
  id,
@@ -1749,6 +1751,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
1749
1751
  const linksCreated = [];
1750
1752
  const linksSuggested = [];
1751
1753
  const userLinkResults = [];
1754
+ const advisedLinks = [];
1752
1755
  let conflictCandidates = [];
1753
1756
  const pendingRelations = [];
1754
1757
  const skipAutoDiscovery = links && links.length > 0;
@@ -1869,6 +1872,12 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
1869
1872
  relationType: pending.type,
1870
1873
  linkReason: pending.meta.linkReason
1871
1874
  });
1875
+ } else if (result.status === "advised") {
1876
+ advisedLinks.push({
1877
+ targetName: pending.meta.targetName,
1878
+ targetCollection: pending.meta.targetCollection,
1879
+ relationType: pending.type
1880
+ });
1872
1881
  }
1873
1882
  } else {
1874
1883
  if (result.ok) {
@@ -1885,6 +1894,9 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
1885
1894
  }
1886
1895
  }
1887
1896
  }
1897
+ if (advisedLinks.length > 0) {
1898
+ entryWarnings.push(`${advisedLinks.length} auto-link(s) advised, not written (untypeable) \u2014 accept with \`relations action=create\` to promote.`);
1899
+ }
1888
1900
  const captureCtx = {
1889
1901
  collection: resolvedCollection,
1890
1902
  name,
@@ -2383,6 +2395,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2383
2395
  entryId: "",
2384
2396
  ok: false,
2385
2397
  autoLinks: 0,
2398
+ advisedLinks: 0,
2386
2399
  status: "draft",
2387
2400
  classifiedBy,
2388
2401
  confidence,
@@ -2398,6 +2411,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2398
2411
  entryId: "",
2399
2412
  ok: false,
2400
2413
  autoLinks: 0,
2414
+ advisedLinks: 0,
2401
2415
  status: "draft",
2402
2416
  classifiedBy,
2403
2417
  confidence,
@@ -2506,6 +2520,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2506
2520
  });
2507
2521
  }
2508
2522
  let autoLinkCount = 0;
2523
+ let advisedLinkCount = 0;
2509
2524
  let entryOverlapCount = 0;
2510
2525
  const searchQuery = extractSearchTerms(entry.name, entry.description);
2511
2526
  if (searchQuery) {
@@ -2530,6 +2545,10 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2530
2545
  sessionId: agentId ?? void 0
2531
2546
  });
2532
2547
  autoLinkCount = batchRes.created;
2548
+ advisedLinkCount = batchRes.advised ?? 0;
2549
+ if (advisedLinkCount > 0) {
2550
+ batchEntryWarnings.push(`${advisedLinkCount} auto-link(s) advised, not written (untypeable) \u2014 accept with \`relations action=create\` to promote.`);
2551
+ }
2533
2552
  }
2534
2553
  } catch {
2535
2554
  }
@@ -2579,6 +2598,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2579
2598
  entryId: finalEntryId,
2580
2599
  ok: true,
2581
2600
  autoLinks: autoLinkCount,
2601
+ advisedLinks: advisedLinkCount,
2582
2602
  status: finalStatus,
2583
2603
  classifiedBy,
2584
2604
  confidence,
@@ -2603,6 +2623,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2603
2623
  entryId: "",
2604
2624
  ok: false,
2605
2625
  autoLinks: 0,
2626
+ advisedLinks: 0,
2606
2627
  status: "draft",
2607
2628
  classifiedBy,
2608
2629
  confidence,
@@ -2624,6 +2645,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2624
2645
  logger: "product-brain"
2625
2646
  });
2626
2647
  const totalAutoLinks = created.reduce((sum, r) => sum + r.autoLinks, 0);
2648
+ const totalAdvisedLinks = created.reduce((sum, r) => sum + r.advisedLinks, 0);
2627
2649
  const byCollection = /* @__PURE__ */ new Map();
2628
2650
  for (const r of created) {
2629
2651
  byCollection.set(r.collection, (byCollection.get(r.collection) ?? 0) + 1);
@@ -2631,7 +2653,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
2631
2653
  const lines = [
2632
2654
  `# Batch Capture Complete`,
2633
2655
  `**${created.length}** created, **${failed.length}** failed, **${skippedLowConfidence.length}** skipped out of ${entries.length} total.`,
2634
- `**Auto-links created:** ${totalAutoLinks}`,
2656
+ `**Auto-links created:** ${totalAutoLinks}${totalAdvisedLinks > 0 ? `, ${totalAdvisedLinks} advised` : ""}`,
2635
2657
  ""
2636
2658
  ];
2637
2659
  if (classifiedCount > 0) {
@@ -7131,6 +7153,7 @@ async function runWrapupCommitAll(data, cachedSuggestions) {
7131
7153
  const results = [];
7132
7154
  let linksCreated = 0;
7133
7155
  let linksFailed = 0;
7156
+ let linksAdvised = 0;
7134
7157
  const linkFailureDetails = [];
7135
7158
  let proposalsCreated = 0;
7136
7159
  const allDrafts = [...data.drafts, ...data.overflowDrafts ?? []];
@@ -7195,9 +7218,10 @@ async function runWrapupCommitAll(data, cachedSuggestions) {
7195
7218
  sessionId
7196
7219
  });
7197
7220
  linksCreated += batchResult?.created ?? 0;
7221
+ linksAdvised += batchResult?.advised ?? 0;
7198
7222
  if (batchResult && batchResult.failed > 0) {
7199
7223
  linksFailed += batchResult.failed;
7200
- const failedResults = batchResult.results.map((r, i) => ({ ...r, index: i })).filter((r) => !r.ok);
7224
+ const failedResults = batchResult.results.map((r, i) => ({ ...r, index: i })).filter((r) => !r.ok && r.status !== "advised");
7201
7225
  for (const fr of failedResults) {
7202
7226
  const rel = batchRels[fr.index];
7203
7227
  if (rel) {
@@ -7224,7 +7248,10 @@ async function runWrapupCommitAll(data, cachedSuggestions) {
7224
7248
  ...s.confidence !== void 0 ? { confidence: s.confidence } : {},
7225
7249
  sessionId
7226
7250
  });
7227
- if (result?.status !== "proposal_created") {
7251
+ if (result?.status === "proposal_created") {
7252
+ } else if (result?.advised) {
7253
+ linksAdvised++;
7254
+ } else {
7228
7255
  linksCreated++;
7229
7256
  }
7230
7257
  } catch (err) {
@@ -7252,6 +7279,9 @@ async function runWrapupCommitAll(data, cachedSuggestions) {
7252
7279
  if (linksFailed > 0) {
7253
7280
  lines.push(`**${linksFailed}** link${linksFailed === 1 ? "" : "s"} failed to create.`);
7254
7281
  }
7282
+ if (linksAdvised > 0) {
7283
+ lines.push(`**${linksAdvised}** auto-link(s) advised, not written (untypeable) \u2014 accept with \`relations action=create\` to promote.`);
7284
+ }
7255
7285
  if (failed.length > 0) {
7256
7286
  lines.push("");
7257
7287
  lines.push("### Failed to accept");
@@ -14709,4 +14739,4 @@ export {
14709
14739
  createProductBrainServer,
14710
14740
  initFeatureFlags
14711
14741
  };
14712
- //# sourceMappingURL=chunk-MIJAUKD3.js.map
14742
+ //# sourceMappingURL=chunk-I6LKRXFS.js.map