@productbrain/mcp 0.0.1-beta.6562 → 0.0.1-beta.6570

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.
@@ -41,7 +41,7 @@ import {
41
41
  trackSessionCaptureRate,
42
42
  trackWriteBackHintServed,
43
43
  trackZeroCaptureAuditFired
44
- } from "./chunk-KL74MUS5.js";
44
+ } from "./chunk-EUKYUOF7.js";
45
45
 
46
46
  // src/server.ts
47
47
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -2752,6 +2752,46 @@ async function runConflictPreflight(name, description, collectionHint) {
2752
2752
  }
2753
2753
  }
2754
2754
 
2755
+ // src/tools/knowledge/updateEntryAppliedFields.ts
2756
+ function computeUpdateEntryAppliedFields(args, normalization) {
2757
+ const rejectedDataFields = normalization?.rejected ?? [];
2758
+ const acceptedDataFields = normalization?.accepted ?? [];
2759
+ const appliedFields = [];
2760
+ if (args.name !== void 0) appliedFields.push("name");
2761
+ if (args.status !== void 0) appliedFields.push("status");
2762
+ if (args.workflowStatus !== void 0) appliedFields.push("workflowStatus");
2763
+ if (args.order !== void 0) appliedFields.push("order");
2764
+ if (args.canonicalKey !== void 0) appliedFields.push("canonicalKey");
2765
+ appliedFields.push(...acceptedDataFields);
2766
+ return { appliedFields, rejectedDataFields };
2767
+ }
2768
+ function buildFieldsRejectedFailure(entryId, fieldsProvided, appliedFields, rejectedDataFields) {
2769
+ if (!(fieldsProvided.length > 0 && appliedFields.length === 0)) return null;
2770
+ const rejectedNote = rejectedDataFields.length > 0 ? ` Rejected: ${rejectedDataFields.join(", ")}.` : "";
2771
+ return failureResult(
2772
+ `No fields were applied to ${entryId}.${rejectedNote}`,
2773
+ "FIELDS_REJECTED",
2774
+ `No fields were applied to ${entryId}.${rejectedNote}`,
2775
+ "Run `collections action=describe` for this entry's collection to see valid fields."
2776
+ );
2777
+ }
2778
+ function filterRedundantRejectionWarnings(warnings, rejectedDataFields) {
2779
+ if (rejectedDataFields.length === 0) return warnings;
2780
+ return warnings.filter((warning) => !rejectedDataFields.some((field) => warning.includes(field)));
2781
+ }
2782
+ function pushAppliedFieldsLines(responseLines, fieldsProvided, appliedFields, rejectedDataFields) {
2783
+ if (fieldsProvided.length > 0) {
2784
+ responseLines.push(`**Fields applied:** ${appliedFields.join(", ")}`);
2785
+ if (rejectedDataFields.length > 0) {
2786
+ responseLines.push("");
2787
+ responseLines.push(`\u26A0\uFE0F **Fields rejected:** ${rejectedDataFields.join(", ")}`);
2788
+ }
2789
+ } else {
2790
+ responseLines.push("");
2791
+ responseLines.push("\u26A0\uFE0F No fields to update were provided \u2014 only `entryId` was set.");
2792
+ }
2793
+ }
2794
+
2755
2795
  // src/tools/knowledge/getHistory.ts
2756
2796
  import { z as z5 } from "zod/v3";
2757
2797
  var getHistorySchema = z5.object({
@@ -2852,6 +2892,10 @@ async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowSta
2852
2892
  return coherencyRefusedResult(`${toolName} action=update`, entryId, maybeRefused.refusal);
2853
2893
  }
2854
2894
  const id = updateResult.id;
2895
+ const fieldArgs = { name, status: rawStatus, workflowStatus: rawWorkflowStatus, order, canonicalKey };
2896
+ const { appliedFields, rejectedDataFields } = computeUpdateEntryAppliedFields(fieldArgs, updateResult.normalization);
2897
+ const totalFailure = buildFieldsRejectedFailure(entryId, fieldsProvided, appliedFields, rejectedDataFields);
2898
+ if (totalFailure) return totalFailure;
2855
2899
  await recordSessionActivity({ entryModified: id });
2856
2900
  const wsCtx = await getWorkspaceContext();
2857
2901
  const updated = await kernelQuery("chain.getEntry", { entryId });
@@ -2865,18 +2909,12 @@ async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowSta
2865
2909
  `Internal ID: ${id}`,
2866
2910
  `**Workspace:** ${wsCtx.workspaceSlug} (${wsCtx.workspaceId})`
2867
2911
  ];
2868
- if (fieldsProvided.length > 0) {
2869
- responseLines.push(`**Fields provided:** ${fieldsProvided.join(", ")}`);
2870
- } else {
2871
- responseLines.push("");
2872
- responseLines.push("\u26A0\uFE0F No fields to update were provided \u2014 only `entryId` was set.");
2873
- }
2874
- if ((updateResult.normalizationWarnings ?? []).length > 0) {
2912
+ pushAppliedFieldsLines(responseLines, fieldsProvided, appliedFields, rejectedDataFields);
2913
+ const shownWarnings = filterRedundantRejectionWarnings(updateResult.normalizationWarnings ?? [], rejectedDataFields);
2914
+ if (shownWarnings.length > 0) {
2875
2915
  responseLines.push("");
2876
2916
  responseLines.push("\u26A0\uFE0F **Normalization warnings:**");
2877
- for (const warning of updateResult.normalizationWarnings ?? []) {
2878
- responseLines.push(` - ${warning}`);
2879
- }
2917
+ for (const warning of shownWarnings) responseLines.push(` - ${warning}`);
2880
2918
  }
2881
2919
  if ((updateResult.validationWarnings ?? []).length > 0) {
2882
2920
  responseLines.push("");
@@ -2885,7 +2923,7 @@ async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowSta
2885
2923
  responseLines.push(` - ${warning}`);
2886
2924
  }
2887
2925
  }
2888
- const summary = `Updated ${entryId} \u2014 ${versionMode}. Fields: ${fieldsProvided.join(", ") || "none"}.`;
2926
+ const summary = `Updated ${entryId} \u2014 ${versionMode}. Fields: ${appliedFields.join(", ") || "none"}.`;
2889
2927
  const next = [
2890
2928
  { tool: toolName, description: "View updated entry", parameters: { action: "get", entryId } },
2891
2929
  { tool: toolName, description: "Accept onto Chain", parameters: { action: "commit", entryId } }
@@ -2895,7 +2933,8 @@ async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowSta
2895
2933
  structuredContent: success(summary, {
2896
2934
  entryId: id,
2897
2935
  versionMode,
2898
- fieldsProvided,
2936
+ fieldsApplied: appliedFields,
2937
+ // PR B: renamed from fieldsProvided (caller intent) — this is the server's verdict, matching the text above
2899
2938
  // BET-192: normalization breakdown in structuredContent — symmetric with capture tool
2900
2939
  ...updateResult.normalization && (Object.keys(updateResult.normalization.remapped).length > 0 || updateResult.normalization.rejected.length > 0) && {
2901
2940
  normalization: {
@@ -14916,4 +14955,4 @@ export {
14916
14955
  createProductBrainServer,
14917
14956
  initFeatureFlags
14918
14957
  };
14919
- //# sourceMappingURL=chunk-UWVIKCHQ.js.map
14958
+ //# sourceMappingURL=chunk-3HALD6EU.js.map