@productbrain/mcp 0.0.1-beta.11538 → 0.0.1-beta.11549

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.
@@ -4,6 +4,7 @@ import {
4
4
  PASTE_NOW,
5
5
  SPINE_RUNG_SEQUENCE,
6
6
  WORKSPACE_CLOSED,
7
+ acceptCall,
7
8
  appUrl,
8
9
  authorityRecovery,
9
10
  cacheScope,
@@ -35,7 +36,7 @@ import {
35
36
  runWithToolContext,
36
37
  setSessionOriented,
37
38
  startAgentSession
38
- } from "./chunk-BZ4N37TH.js";
39
+ } from "./chunk-5EIHZGHY.js";
39
40
 
40
41
  // src/server.ts
41
42
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -1631,7 +1632,9 @@ var commitEntrySchema = z7.object({
1631
1632
  response: z7.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
1632
1633
  entryId: z7.string().optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
1633
1634
  reason: z7.string().optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
1634
- }).optional().describe("Explicit response to a coherency challenge (standard/strict workspace modes).")
1635
+ }).optional().describe("Explicit response to a coherency challenge (standard/strict workspace modes)."),
1636
+ replaces: z7.string().max(200).optional()
1637
+ // TASK-1030: described once, on the served entries schema
1635
1638
  });
1636
1639
  async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowStatus: rawWorkflowStatus, data, order, canonicalKey, autoPublish, changeNote, changeReason, sourceRef, sourceExcerpt, steeringOverrideReason, qualityOverrideReason, coherencyAcknowledgement }, toolName = "entries") {
1637
1640
  requireWriteAccess();
@@ -1744,7 +1747,7 @@ ${mcp}`, "QUALITY_HELD", mcp.split("\n")[0] ?? mcp, mcp.split("\n")[1] ?? mcp, v
1744
1747
  }, next)
1745
1748
  };
1746
1749
  }
1747
- async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qualityOverrideReason, coherencyAcknowledgement }, toolName = "entries") {
1750
+ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qualityOverrideReason, coherencyAcknowledgement, replaces }, toolName = "entries") {
1748
1751
  requireWriteAccess();
1749
1752
  const entry = await kernelQuery("chain.getEntry", { entryId });
1750
1753
  if (!entry) {
@@ -1787,7 +1790,9 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1787
1790
  ...qualityOverrideReason ? { qualityOverrideReason } : {},
1788
1791
  // TASK-954
1789
1792
  ...coherencyAcknowledgement ? { coherencyAcknowledgement } : {},
1790
- ...conflictEvidence.length > 0 ? { conflicts: conflictEvidence } : {}
1793
+ ...conflictEvidence.length > 0 ? { conflicts: conflictEvidence } : {},
1794
+ ...replaces ? { replaces } : {}
1795
+ // TASK-1030: the kernel archives it after the accept, the same path as pb's --replaces
1791
1796
  });
1792
1797
  if (result2?.status === "coherency_refused" && result2?.refusal) {
1793
1798
  return coherencyRefusedResult(`${toolName} action=accept`, entryId, result2.refusal);
@@ -1807,7 +1812,8 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1807
1812
  ...wouldBlock && result2.blockingReason ? { blockingReason: result2.blockingReason } : {},
1808
1813
  ...previewContradictionAdvisory ? { contradictionAdvisory: previewContradictionAdvisory } : {}
1809
1814
  },
1810
- [{ tool: toolName, description: "Accept for real", parameters: { action: "accept", entryId } }]
1815
+ [{ tool: toolName, description: "Accept for real", parameters: { action: "accept", entryId, ...replaces ? { replaces } : {} } }]
1816
+ // TASK-1030
1811
1817
  );
1812
1818
  if (result2.contract) {
1813
1819
  previewEnvelope.contract = result2.contract;
@@ -1888,6 +1894,8 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1888
1894
  lines.push(`- ${advisory}`);
1889
1895
  }
1890
1896
  }
1897
+ const replaced = result2?.replaced;
1898
+ if (replaced) lines.push("", replaced.line, ...replaced.nextAccept ? [`Next: ${acceptCall(replaced.nextAccept)}.`] : []);
1891
1899
  const epistemic = deriveEpistemicStatus(toEpistemicInput(entry));
1892
1900
  if (epistemic && (epistemic.level === "hypothesis" || epistemic.level === "untested")) {
1893
1901
  lines.push("");
@@ -1932,9 +1940,11 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1932
1940
  ...publishAdvisories && publishAdvisories.length > 0 ? { publishAdvisories } : {},
1933
1941
  // WP-B (attestation spec §4.3): mirror the auto-verify receipt into the
1934
1942
  // structured payload so --json/agent consumers see it too.
1935
- ...result2?.autoVerified ? { autoVerified: result2.autoVerified } : {}
1943
+ ...result2?.autoVerified ? { autoVerified: result2.autoVerified } : {},
1944
+ ...replaced ? { replaced } : {}
1945
+ // TASK-1030
1936
1946
  },
1937
- next
1947
+ replaced?.nextAccept ? [{ tool: toolName, description: "Accept what hangs on it", parameters: { action: "accept", entryId: replaced.nextAccept } }, ...next] : next
1938
1948
  );
1939
1949
  if (captureContract) {
1940
1950
  commitSuccessEnvelope.contract = captureContract;
@@ -2503,6 +2513,8 @@ var entriesSchema = z11.object({
2503
2513
  preview: z11.boolean().optional().describe(
2504
2514
  "For 'accept': if true, validates the accept without writing \u2014 returns what would happen."
2505
2515
  ),
2516
+ replaces: z11.string().max(200).optional().describe("For 'accept': the accepted entry of the same kind this one replaces; it is archived."),
2517
+ // TASK-1030
2506
2518
  toCollection: z11.string().max(200).optional().describe("For 'move': target collection slug, e.g. 'decisions', 'architecture'.")
2507
2519
  });
2508
2520
  var entriesUpdateVariant = updateEntrySchema.extend({ action: z11.literal("update") });
@@ -2525,7 +2537,7 @@ var entriesActionUnion = z11.discriminatedUnion("action", [
2525
2537
  ]);
2526
2538
  var ENTRIES_ACTION_SPECS = {
2527
2539
  update: { params: ["entryId", "name", "status", "workflowStatus", "data", "order", "canonicalKey", "autoPublish", "changeNote", "changeReason", "sourceRef", "sourceExcerpt", "steeringOverrideReason", "qualityOverrideReason", "coherencyAcknowledgement"], description: "entryId is required; every other field is optional." },
2528
- accept: { params: ["entryId", "preview", "steeringOverrideReason", "qualityOverrideReason", "coherencyAcknowledgement"], description: "entryId is required." },
2540
+ accept: { params: ["entryId", "preview", "steeringOverrideReason", "qualityOverrideReason", "coherencyAcknowledgement", "replaces"], description: "entryId is required." },
2529
2541
  move: { params: ["entryId", "toCollection", "canonicalKey"], description: "entryId and toCollection are required; canonicalKey is optional (atomic move+retype)." },
2530
2542
  verify: { params: ["entryId"], description: "entryId is required." },
2531
2543
  "still-true": { params: ["entryId"], description: "entryId is required. Allowed for the holder of the owning role; if that role is empty, the nearest seated Team Lead up the team tree." }
@@ -3291,6 +3303,8 @@ No DB writes \u2014 call without \`preview:true\` to create for real.${advisoryT
3291
3303
  lines.push("");
3292
3304
  lines.push(`\u26A0 Written anyway (org stage: ${a.stage}): ${a.ruleText}`);
3293
3305
  }
3306
+ const spineLink = result2?.spineLink;
3307
+ if (spineLink) lines.push("", spineLink.line, ...spineLink.nextAccept ? [`Next: ${acceptCall(spineLink.nextAccept)}.`] : []);
3294
3308
  return {
3295
3309
  content: [{ type: "text", text: lines.join("\n") }],
3296
3310
  structuredContent: success(
@@ -3300,9 +3314,10 @@ No DB writes \u2014 call without \`preview:true\` to create for real.${advisoryT
3300
3314
  from,
3301
3315
  to,
3302
3316
  type,
3303
- ...result2?.advisories && result2.advisories.length > 0 && { advisories: result2.advisories }
3317
+ ...result2?.advisories && result2.advisories.length > 0 && { advisories: result2.advisories },
3318
+ ...spineLink ? { spineLink } : {}
3304
3319
  },
3305
- [{ tool: "context", description: "See connections", parameters: { action: "find", entryId: from } }]
3320
+ spineLink?.nextAccept ? [{ tool: "entries", description: "Accept it", parameters: { action: "accept", entryId: spineLink.nextAccept } }] : [{ tool: "context", description: "See connections", parameters: { action: "find", entryId: from } }]
3306
3321
  )
3307
3322
  };
3308
3323
  }
@@ -11833,4 +11848,4 @@ export {
11833
11848
  SERVER_VERSION,
11834
11849
  createProductBrainServer
11835
11850
  };
11836
- //# sourceMappingURL=chunk-WRKN2TPW.js.map
11851
+ //# sourceMappingURL=chunk-W3UWFCT6.js.map