@productbrain/mcp 0.0.1-beta.8248 → 0.0.1-beta.8252

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.
@@ -988,6 +988,10 @@ async function resolveTargetProseKey(collectionSlug) {
988
988
  const col = await getCollectionBySlug(collectionSlug).catch(() => void 0);
989
989
  return col?.descriptionFieldKey || "description";
990
990
  }
991
+ function captureChangeReason(description, data) {
992
+ const text = description.trim() || Object.keys(data ?? {}).map((k) => `${k} set`).join(", ");
993
+ return text ? { changeReason: `Captured: ${text.slice(0, 300)}` } : {};
994
+ }
991
995
  async function runVersionCapture(params) {
992
996
  const { groundingEntry, name, description, data, sourceRef, sourceExcerpt, links, groundingElapsedMs } = params;
993
997
  const versionAgentId = getAgentSessionId();
@@ -999,6 +1003,7 @@ async function runVersionCapture(params) {
999
1003
  ...patch,
1000
1004
  autoPublish: true,
1001
1005
  changeNote: "Captured as a new version via MCP",
1006
+ ...captureChangeReason(description ?? "", data ?? void 0),
1002
1007
  changedBy: versionAgentId ? `agent:${versionAgentId}` : "capture",
1003
1008
  ...sourceRef ? { sourceRef } : {},
1004
1009
  ...sourceExcerpt ? { sourceExcerpt } : {}
@@ -2881,6 +2886,7 @@ var updateEntrySchema = z6.object({
2881
2886
  canonicalKey: z6.string().optional().describe("Semantic type (e.g. 'decision', 'tension'). Only changeable on draft/uncommitted entries."),
2882
2887
  autoPublish: z6.boolean().optional().default(false).describe("Accepted for backward compatibility but IGNORED \u2014 draft vs. published is decided by the entry's own accepted/active status, never by this flag. Removal tracked as a follow-up."),
2883
2888
  // DEC-1716
2889
+ changeReason: z6.string().optional().describe("Change reason: required when this update changes a promise field (or the name of a collection that declares one) of an accepted entry \u2014 why what the entry promises is changing. Recorded on the history event and the version. Not the same as changeNote."),
2884
2890
  changeNote: z6.string().optional().describe("Strongly recommended: short human-readable rationale for WHY this change was made (e.g. 'Aligned description with F1-themed copy'). Surfaces in activity feed and pb get. If omitted, falls back to session purpose or auto-generated field summary."),
2885
2891
  sourceRef: z6.string().optional().describe("URI or path of the source document backing this entry. Write-once: can only be set if currently empty."),
2886
2892
  sourceExcerpt: z6.string().optional().describe("Verbatim excerpt from the source that backs this entry's claims. Write-once: can only be set if currently empty."),
@@ -2904,7 +2910,7 @@ var commitEntrySchema = z6.object({
2904
2910
  reason: z6.string().optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
2905
2911
  }).optional().describe("Explicit response to a coherency challenge (standard/strict workspace modes).")
2906
2912
  });
2907
- async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowStatus: rawWorkflowStatus, data, order, canonicalKey, autoPublish, changeNote, sourceRef, sourceExcerpt, steeringOverrideReason, coherencyAcknowledgement }, toolName = "entries") {
2913
+ async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowStatus: rawWorkflowStatus, data, order, canonicalKey, autoPublish, changeNote, changeReason, sourceRef, sourceExcerpt, steeringOverrideReason, coherencyAcknowledgement }, toolName = "entries") {
2908
2914
  requireWriteAccess();
2909
2915
  const fieldsProvided = [];
2910
2916
  if (name !== void 0) fieldsProvided.push("name");
@@ -2925,6 +2931,7 @@ async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowSta
2925
2931
  canonicalKey,
2926
2932
  autoPublish,
2927
2933
  changeNote,
2934
+ ...changeReason ? { changeReason } : {},
2928
2935
  changedBy: getAgentSessionId() ? `agent:${getAgentSessionId()}` : void 0,
2929
2936
  ...sourceRef !== void 0 ? { sourceRef } : {},
2930
2937
  ...sourceExcerpt !== void 0 ? { sourceExcerpt } : {},
@@ -3758,6 +3765,9 @@ var entriesSchema = z10.object({
3758
3765
  autoPublish: z10.boolean().optional().default(false).describe(
3759
3766
  "For 'update': accepted for backward compatibility but IGNORED \u2014 draft vs. published is decided by the entry's own accepted/active status, never by this flag."
3760
3767
  ),
3768
+ changeReason: z10.string().max(2e3).optional().describe(
3769
+ "For 'update': Change reason \u2014 required when the update changes a promise field of an accepted entry. Recorded on the history event and the version."
3770
+ ),
3761
3771
  changeNote: z10.string().max(2e3).optional().describe(
3762
3772
  "For 'update': short human-readable rationale for WHY this change was made. Surfaces in activity feed."
3763
3773
  ),
@@ -3831,7 +3841,7 @@ var ENTRIES_ACTION_SPECS = {
3831
3841
  get: { params: ["entryId"], description: "Fetch one entry by ID." },
3832
3842
  batch: { params: ["entryIds"], description: "Fetch up to 20 entries by ID." },
3833
3843
  search: { params: ["query", "collection", "status"], description: "Full-text search; query is required (min 2 chars)." },
3834
- update: { params: ["entryId", "name", "status", "workflowStatus", "data", "order", "canonicalKey", "autoPublish", "changeNote", "sourceRef", "sourceExcerpt", "steeringOverrideReason", "coherencyAcknowledgement"], description: "entryId is required; every other field is optional." },
3844
+ update: { params: ["entryId", "name", "status", "workflowStatus", "data", "order", "canonicalKey", "autoPublish", "changeNote", "changeReason", "sourceRef", "sourceExcerpt", "steeringOverrideReason", "coherencyAcknowledgement"], description: "entryId is required; every other field is optional." },
3835
3845
  commit: { params: ["entryId", "preview", "steeringOverrideReason", "coherencyAcknowledgement"], description: "entryId is required." },
3836
3846
  history: { params: ["entryId"], description: "entryId is required." },
3837
3847
  move: { params: ["entryId", "toCollection", "canonicalKey"], description: "entryId and toCollection are required; canonicalKey is optional (atomic move+retype)." },
@@ -14616,4 +14626,4 @@ export {
14616
14626
  createProductBrainServer,
14617
14627
  initFeatureFlags
14618
14628
  };
14619
- //# sourceMappingURL=chunk-J5R4OAP5.js.map
14629
+ //# sourceMappingURL=chunk-LV23VXXV.js.map