@productbrain/mcp 0.0.1-beta.8372 → 0.0.1-beta.8396
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.
|
@@ -709,6 +709,14 @@ async function dispatchDiscriminated(toolName, union2, flatData, actionSpecs, ha
|
|
|
709
709
|
// src/tools/knowledge.ts
|
|
710
710
|
import { z as z6 } from "zod/v3";
|
|
711
711
|
|
|
712
|
+
// src/lib/captureWhyFold.ts
|
|
713
|
+
async function foldWhyIntoData(slug, why, userData) {
|
|
714
|
+
if (typeof why !== "string" || why.trim().length === 0) return userData;
|
|
715
|
+
const contract = await kernelQuery("chain.getCollectionFields", { slug }).catch(() => null);
|
|
716
|
+
const whyKey = contract && typeof contract.whyField === "string" && contract.whyField ? contract.whyField : "why";
|
|
717
|
+
return { ...userData && typeof userData === "object" ? userData : {}, [whyKey]: why };
|
|
718
|
+
}
|
|
719
|
+
|
|
712
720
|
// src/tools/smart-capture.ts
|
|
713
721
|
import { z as z4 } from "zod/v3";
|
|
714
722
|
|
|
@@ -1892,7 +1900,6 @@ All other collections get an ENT-{random} ID and sensible defaults.
|
|
|
1892
1900
|
}
|
|
1893
1901
|
async function handleCapture(server, { collection, name, description, context, entryId, canonicalKey, data: userData, why, links, sourceRef, sourceExcerpt, preview, suggestOnly, format, ownerRoleEntryId }) {
|
|
1894
1902
|
requireWriteAccess();
|
|
1895
|
-
if (typeof why === "string" && why.trim().length > 0) userData = { ...userData && typeof userData === "object" ? userData : {}, why };
|
|
1896
1903
|
const timingStart = Date.now();
|
|
1897
1904
|
const wsCtx = await getWorkspaceContext();
|
|
1898
1905
|
const explicitCollectionProvided = typeof collection === "string" && collection.trim().length > 0;
|
|
@@ -1963,6 +1970,7 @@ async function handleCapture(server, { collection, name, description, context, e
|
|
|
1963
1970
|
};
|
|
1964
1971
|
}
|
|
1965
1972
|
const profile = await getProfile(resolvedCollection, col.fields);
|
|
1973
|
+
userData = await foldWhyIntoData(resolvedCollection, why, userData);
|
|
1966
1974
|
const groundingStart = Date.now();
|
|
1967
1975
|
const groundingPromise = name || description ? kernelQuery("chain.capture", { name, description: description ?? "", collectionSlug: resolvedCollection }).catch(() => null) : Promise.resolve(null);
|
|
1968
1976
|
const groundingRaw = await Promise.race([groundingPromise, new Promise((r) => setTimeout(() => r(null), 500))]);
|
|
@@ -14630,4 +14638,4 @@ export {
|
|
|
14630
14638
|
createProductBrainServer,
|
|
14631
14639
|
initFeatureFlags
|
|
14632
14640
|
};
|
|
14633
|
-
//# sourceMappingURL=chunk-
|
|
14641
|
+
//# sourceMappingURL=chunk-RLXYUP6A.js.map
|