@productbrain/mcp 0.0.1-beta.12454 → 0.0.1-beta.12457

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.
@@ -753,6 +753,15 @@ import { z as z7 } from "zod/v3";
753
753
  import { z as z5 } from "zod/v3";
754
754
 
755
755
  // src/lib/captureTimeoutOutcome.ts
756
+ var SPINE_FLOOR_EXEMPT_SENTENCE = "kept as a draft, though this workspace is not yet enforcing the spine above it \u2014 it can be accepted as-is.";
757
+ function draftReplyLines(name, id, spineFloor, missingFieldLines = []) {
758
+ const lines = missingFieldLines.length > 0 ? ["", ...missingFieldLines] : [];
759
+ if (!spineFloor) return lines;
760
+ const { relationType: relationType2, parentKind, exempt, linkWritten, line, nextTo } = spineFloor, to = nextTo ?? `<${parentKind.toUpperCase().replace(/_/g, "-")}-ID>`;
761
+ lines.push("", "## Saved as draft", `**${name}** ${exempt ? SPINE_FLOOR_EXEMPT_SENTENCE : `kept as a draft. ${line ?? rungLine(parentKind)}`}`);
762
+ lines.push(exempt || linkWritten ? `Next: \`entries action=accept entryId="${id}"\`.` : `Next: \`relations action=create from="${id}" type="${relationType2}" to="${to}"\`.`);
763
+ return lines;
764
+ }
756
765
  function isGatewayTimeout(error) {
757
766
  return error?.name === "GatewayTimeoutError";
758
767
  }
@@ -779,15 +788,18 @@ function resumeReplayedCapture(replay, name) {
779
788
  const status2 = isTrustAccepted(replay.status) ? "committed" : "draft";
780
789
  const summary = `Already captured as ${replay.entryId}; this re-send returned that entry and wrote no second one.`;
781
790
  const linkLines = links.map((l) => `- ${l.line}`);
791
+ const draftLines = status2 === "draft" ? draftReplyLines(name, replay.entryId, replay.spineFloor, replay.missingFieldLines) : [];
792
+ const linkBlock = linkLines.length ? `
793
+
794
+ **Links:**
795
+ ${linkLines.join("\n")}` : "";
782
796
  return {
783
797
  content: [{
784
798
  type: "text",
785
799
  text: `# Already Captured: ${replay.entryId}
786
800
 
787
- ${summary}${linkLines.length ? `
788
-
789
- **Links:**
790
- ${linkLines.join("\n")}` : ""}
801
+ ${summary}${linkBlock}${draftLines.map((l) => `
802
+ ${l}`).join("")}
791
803
 
792
804
  Read it with \`context action=get\`.`
793
805
  }],
@@ -964,7 +976,6 @@ var captureSinglePreviewOutputSchema = z4.object({
964
976
 
965
977
  // src/tools/smart-capture.ts
966
978
  var CAPTURE_LINK_OUTCOMES = ["written", "refused"];
967
- var SPINE_FLOOR_EXEMPT_SENTENCE = "kept as a draft, though this workspace is not yet enforcing the spine above it \u2014 it can be accepted as-is.";
968
979
  var LINK_TYPE_DESCRIPTION = `Relation type. The spine links: ${SPINE_RUNG_LINES.join(" ")}`;
969
980
  var captureSchema = z5.object({
970
981
  collection: z5.string().optional().describe("Collection slug, e.g. 'tensions', 'rules', 'glossary', 'decisions'. Optional \u2014 the kernel classifies when omitted."),
@@ -1158,6 +1169,7 @@ ${context.trim()}` : description;
1158
1169
  let formativeHints = [];
1159
1170
  let coachingFromCreate;
1160
1171
  let wasAutoCommittedServerSide = false;
1172
+ let missingFieldLines = [];
1161
1173
  let spineFloor;
1162
1174
  let linkOutcomes = [];
1163
1175
  try {
@@ -1257,6 +1269,7 @@ No DB writes \u2014 call without \`preview:true\` to capture for real.${result2.
1257
1269
  formativeHints = created.qualityHints ?? [];
1258
1270
  coachingFromCreate = created.coaching;
1259
1271
  linkOutcomes = created.links ?? [];
1272
+ missingFieldLines = created.missingFieldLines ?? [];
1260
1273
  const createdStatus = created.status;
1261
1274
  if (createdStatus !== void 0 && isTrustAccepted(createdStatus)) wasAutoCommittedServerSide = true;
1262
1275
  spineFloor = created.spineFloor;
@@ -1320,11 +1333,7 @@ Use \`context action=get\` to inspect the existing entry, or \`entries action=up
1320
1333
  lines.push("");
1321
1334
  lines.push(`## Accepted: ${finalEntryId}`);
1322
1335
  lines.push(`**${name}** added to your knowledge base.`);
1323
- } else if (spineFloor) {
1324
- const { relationType: relationType2, parentKind, exempt, linkWritten, line, nextTo } = spineFloor, id = finalEntryId, to = nextTo ?? `<${parentKind.toUpperCase().replace(/_/g, "-")}-ID>`;
1325
- lines.push("", "## Saved as draft", `**${name}** ${exempt ? SPINE_FLOOR_EXEMPT_SENTENCE : `kept as a draft. ${line ?? rungLine(parentKind)}`}`);
1326
- lines.push(exempt || linkWritten ? `Next: \`entries action=accept entryId="${id}"\`.` : `Next: \`relations action=create from="${id}" type="${relationType2}" to="${to}"\`.`);
1327
- }
1336
+ } else lines.push(...draftReplyLines(name, finalEntryId, spineFloor, missingFieldLines));
1328
1337
  if (groundingCaveat) lines.push("", groundingCaveat);
1329
1338
  const named = groundingReport.duplicates.slice(0, 3).map((d) => `${d.entryId} "${d.name}"`).join(", ");
1330
1339
  if (named) lines.push("", `**Possible match:** ${named}. Nothing was written to it; to change it, use \`entries action=update\`.`);
@@ -1764,6 +1773,8 @@ ${mcp}`, "QUALITY_HELD", mcp.split("\n")[0] ?? mcp, mcp.split("\n")[1] ?? mcp, v
1764
1773
  }
1765
1774
  const orgCheck = applied.orgCheck ?? [];
1766
1775
  if (orgCheck.length > 0) responseLines.push("", ...orgCheck);
1776
+ const missingFieldLines = applied.missingFieldLines ?? [];
1777
+ if (missingFieldLines.length > 0) responseLines.push("", ...missingFieldLines);
1767
1778
  const summary = [applied.receipt ?? `Updated ${entryId} \u2014 ${versionMode}. Fields: ${appliedFields.join(", ") || "none"}.`, applied.qualityOverride].filter(Boolean).join(" ");
1768
1779
  const next = [
1769
1780
  { tool: "context", description: "View updated entry", parameters: { action: "get", entryId } },
@@ -11960,4 +11971,4 @@ export {
11960
11971
  SERVER_VERSION,
11961
11972
  createProductBrainServer
11962
11973
  };
11963
- //# sourceMappingURL=chunk-6GBHT6VR.js.map
11974
+ //# sourceMappingURL=chunk-ZAJRU5V6.js.map