@productbrain/mcp 0.0.1-beta.74 → 0.0.1-beta.76
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.
- package/dist/{chunk-UV2NXX4Q.js → chunk-BWK4N5YU.js} +8 -6
- package/dist/chunk-BWK4N5YU.js.map +1 -0
- package/dist/{chunk-Z4RIIF2E.js → chunk-KWQSXRIH.js} +52 -29
- package/dist/chunk-KWQSXRIH.js.map +1 -0
- package/dist/http.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{smart-capture-5C3DGFWF.js → smart-capture-HSQTA5JW.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-UV2NXX4Q.js.map +0 -1
- package/dist/chunk-Z4RIIF2E.js.map +0 -1
- /package/dist/{smart-capture-5C3DGFWF.js.map → smart-capture-HSQTA5JW.js.map} +0 -0
|
@@ -1227,6 +1227,19 @@ function withEnvelope(handler) {
|
|
|
1227
1227
|
};
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
+
// src/lib/fieldTypes.ts
|
|
1231
|
+
var FIELD_TYPE_DEFAULTS = {
|
|
1232
|
+
"string": "",
|
|
1233
|
+
"text": "",
|
|
1234
|
+
"rich-text": "",
|
|
1235
|
+
"number": null,
|
|
1236
|
+
"boolean": false,
|
|
1237
|
+
"select": null,
|
|
1238
|
+
"multi-select": [],
|
|
1239
|
+
"array": [],
|
|
1240
|
+
"json": null
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1230
1243
|
// src/tools/smart-capture-routing.ts
|
|
1231
1244
|
var STARTER_COLLECTIONS = CLASSIFIABLE_COLLECTIONS;
|
|
1232
1245
|
|
|
@@ -2169,6 +2182,17 @@ var batchCaptureOutputSchema = z2.object({
|
|
|
2169
2182
|
function shouldAutoCommitCapture(autoCommit, governanceMode) {
|
|
2170
2183
|
return autoCommit === true || autoCommit === void 0 && governanceMode === "open";
|
|
2171
2184
|
}
|
|
2185
|
+
function buildDataFromFields(fields, descriptionField, descriptionValue) {
|
|
2186
|
+
const data = {};
|
|
2187
|
+
for (const field of fields) {
|
|
2188
|
+
if (field.key === descriptionField) {
|
|
2189
|
+
data[field.key] = descriptionValue;
|
|
2190
|
+
} else {
|
|
2191
|
+
data[field.key] = FIELD_TYPE_DEFAULTS[field.type] ?? null;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
return data;
|
|
2195
|
+
}
|
|
2172
2196
|
function registerSmartCaptureTools(server) {
|
|
2173
2197
|
const captureTool = server.registerTool(
|
|
2174
2198
|
"capture",
|
|
@@ -2230,19 +2254,8 @@ Or use \`collections action=list\` to see available collections.`
|
|
|
2230
2254
|
)
|
|
2231
2255
|
};
|
|
2232
2256
|
}
|
|
2233
|
-
const data =
|
|
2257
|
+
const data = buildDataFromFields(col.fields ?? [], profile.descriptionField, description);
|
|
2234
2258
|
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
2235
|
-
for (const field of col.fields ?? []) {
|
|
2236
|
-
const key = field.key;
|
|
2237
|
-
if (key === profile.descriptionField) {
|
|
2238
|
-
data[key] = description;
|
|
2239
|
-
} else if (field.type === "array" || field.type === "multi-select") {
|
|
2240
|
-
data[key] = [];
|
|
2241
|
-
} else if (field.type === "select") {
|
|
2242
|
-
} else {
|
|
2243
|
-
data[key] = "";
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
2259
|
for (const def of profile.defaults) {
|
|
2247
2260
|
if (def.value === "today") {
|
|
2248
2261
|
data[def.key] = today;
|
|
@@ -2277,7 +2290,7 @@ Or use \`collections action=list\` to see available collections.`
|
|
|
2277
2290
|
const isBetCapture = canonicalKey === "bet";
|
|
2278
2291
|
if (isBetCapture) {
|
|
2279
2292
|
data.chainTypeId = "bet";
|
|
2280
|
-
const betContentFields = ["problem", "appetite", "elements", "architecture", "rabbitHoles", "noGos", "doneWhen", "buildContract", "solution"];
|
|
2293
|
+
const betContentFields = ["problem", "appetite", "elements", "architecture", "rabbitHoles", "noGos", "doneWhen", "buildSequence", "buildContract", "solution"];
|
|
2281
2294
|
const betLinks = {};
|
|
2282
2295
|
for (const field of betContentFields) {
|
|
2283
2296
|
if (data[field] !== void 0) {
|
|
@@ -2291,6 +2304,7 @@ Or use \`collections action=list\` to see available collections.`
|
|
|
2291
2304
|
const agentId = getAgentSessionId();
|
|
2292
2305
|
let finalEntryId;
|
|
2293
2306
|
let internalId;
|
|
2307
|
+
let entryWarnings = [];
|
|
2294
2308
|
try {
|
|
2295
2309
|
const result = await mcpMutation("chain.createEntry", {
|
|
2296
2310
|
collectionSlug: resolvedCollection,
|
|
@@ -2304,6 +2318,7 @@ Or use \`collections action=list\` to see available collections.`
|
|
|
2304
2318
|
});
|
|
2305
2319
|
internalId = result.docId;
|
|
2306
2320
|
finalEntryId = result.entryId;
|
|
2321
|
+
entryWarnings = result.warnings ?? [];
|
|
2307
2322
|
resolveGapsForEntry(name, result.entryId);
|
|
2308
2323
|
} catch (error) {
|
|
2309
2324
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -2596,6 +2611,13 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
|
|
|
2596
2611
|
}
|
|
2597
2612
|
lines.push("Run `context action=gather` on these entries before committing.");
|
|
2598
2613
|
}
|
|
2614
|
+
if (entryWarnings.length > 0) {
|
|
2615
|
+
lines.push("");
|
|
2616
|
+
lines.push("## Validation Warnings");
|
|
2617
|
+
for (const w of entryWarnings) {
|
|
2618
|
+
lines.push(`- ${w}`);
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2599
2621
|
if (coachingSection) {
|
|
2600
2622
|
lines.push("");
|
|
2601
2623
|
lines.push(coachingSection);
|
|
@@ -2658,7 +2680,8 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
|
|
|
2658
2680
|
qualityScore: quality.score,
|
|
2659
2681
|
qualityVerdict: verdictResult?.verdict ? { ...verdictResult.verdict, source: verdictResult.source ?? "heuristic" } : void 0,
|
|
2660
2682
|
...classifierMeta && { classifier: classifierMeta },
|
|
2661
|
-
...studioUrl && { studioUrl }
|
|
2683
|
+
...studioUrl && { studioUrl },
|
|
2684
|
+
...entryWarnings.length > 0 && { warnings: entryWarnings }
|
|
2662
2685
|
},
|
|
2663
2686
|
next
|
|
2664
2687
|
)
|
|
@@ -2759,19 +2782,8 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
|
|
|
2759
2782
|
});
|
|
2760
2783
|
continue;
|
|
2761
2784
|
}
|
|
2762
|
-
const data =
|
|
2785
|
+
const data = buildDataFromFields(col.fields ?? [], profile.descriptionField, entry.description);
|
|
2763
2786
|
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
2764
|
-
for (const field of col.fields ?? []) {
|
|
2765
|
-
const key = field.key;
|
|
2766
|
-
if (key === profile.descriptionField) {
|
|
2767
|
-
data[key] = entry.description;
|
|
2768
|
-
} else if (field.type === "array" || field.type === "multi-select") {
|
|
2769
|
-
data[key] = [];
|
|
2770
|
-
} else if (field.type === "select") {
|
|
2771
|
-
} else {
|
|
2772
|
-
data[key] = "";
|
|
2773
|
-
}
|
|
2774
|
-
}
|
|
2775
2787
|
for (const def of profile.defaults) {
|
|
2776
2788
|
if (def.value === "today") data[def.key] = today;
|
|
2777
2789
|
else if (def.value !== "infer") data[def.key] = def.value;
|
|
@@ -2806,6 +2818,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
|
|
|
2806
2818
|
});
|
|
2807
2819
|
const internalId = result.docId;
|
|
2808
2820
|
const finalEntryId = result.entryId;
|
|
2821
|
+
const batchEntryWarnings = result.warnings ?? [];
|
|
2809
2822
|
resolveGapsForEntry(entry.name, result.entryId);
|
|
2810
2823
|
let finalStatus = "draft";
|
|
2811
2824
|
let commitError;
|
|
@@ -2866,7 +2879,8 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
|
|
|
2866
2879
|
classifiedBy,
|
|
2867
2880
|
confidence,
|
|
2868
2881
|
confidenceTier,
|
|
2869
|
-
...commitError ? { commitError } : {}
|
|
2882
|
+
...commitError ? { commitError } : {},
|
|
2883
|
+
...batchEntryWarnings.length > 0 ? { warnings: batchEntryWarnings } : {}
|
|
2870
2884
|
});
|
|
2871
2885
|
} catch (error) {
|
|
2872
2886
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -2964,6 +2978,14 @@ _Use \`entries action=move\` to correct any misclassified entries._`);
|
|
|
2964
2978
|
lines.push(`- **${r.entryId}**: ${r.name} [${r.collection}] \u2014 ${r.commitError}`);
|
|
2965
2979
|
}
|
|
2966
2980
|
}
|
|
2981
|
+
const entriesWithWarnings = created.filter((r) => r.warnings && r.warnings.length > 0);
|
|
2982
|
+
if (entriesWithWarnings.length > 0) {
|
|
2983
|
+
lines.push("");
|
|
2984
|
+
lines.push("## Validation Warnings");
|
|
2985
|
+
for (const r of entriesWithWarnings) {
|
|
2986
|
+
lines.push(`- **${r.entryId}** (${r.name}): ${r.warnings.join("; ")}`);
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2967
2989
|
if (failed.length > 0) {
|
|
2968
2990
|
lines.push("");
|
|
2969
2991
|
lines.push("## Failed");
|
|
@@ -3016,7 +3038,8 @@ _Use \`entries action=move\` to correct any misclassified entries._`);
|
|
|
3016
3038
|
status: r.status,
|
|
3017
3039
|
...r.classifiedBy ? { classifiedBy: r.classifiedBy } : {},
|
|
3018
3040
|
...r.confidence != null ? { confidence: r.confidence } : {},
|
|
3019
|
-
...r.confidenceTier ? { confidenceTier: r.confidenceTier } : {}
|
|
3041
|
+
...r.confidenceTier ? { confidenceTier: r.confidenceTier } : {},
|
|
3042
|
+
...r.warnings?.length ? { warnings: r.warnings } : {}
|
|
3020
3043
|
})),
|
|
3021
3044
|
total: created.length,
|
|
3022
3045
|
failed: failed.length,
|
|
@@ -3308,4 +3331,4 @@ export {
|
|
|
3308
3331
|
formatRubricCoaching,
|
|
3309
3332
|
formatRubricVerdictSection
|
|
3310
3333
|
};
|
|
3311
|
-
//# sourceMappingURL=chunk-
|
|
3334
|
+
//# sourceMappingURL=chunk-KWQSXRIH.js.map
|