@productbrain/mcp 0.0.1-beta.63 → 0.0.1-beta.65
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-DM5DZC7B.js → chunk-UWILSX73.js} +59 -1
- package/dist/chunk-UWILSX73.js.map +1 -0
- package/dist/{chunk-GKMXGRJW.js → chunk-VBKAAFR6.js} +125 -166
- package/dist/chunk-VBKAAFR6.js.map +1 -0
- package/dist/http.js +22 -5
- package/dist/http.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/{smart-capture-NYOKGAFS.js → smart-capture-EGTUM4XP.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-DM5DZC7B.js.map +0 -1
- package/dist/chunk-GKMXGRJW.js.map +0 -1
- /package/dist/{smart-capture-NYOKGAFS.js.map → smart-capture-EGTUM4XP.js.map} +0 -0
|
@@ -615,6 +615,58 @@ async function isFeatureEnabled(flag, workspaceId, workspaceSlug) {
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
+
// src/gap-store.ts
|
|
619
|
+
var SESSION_GAPS = [];
|
|
620
|
+
var DEDUP_WINDOW_MS = 6e4;
|
|
621
|
+
function isDuplicate(gap) {
|
|
622
|
+
const cutoff = gap.timestamp - DEDUP_WINDOW_MS;
|
|
623
|
+
return SESSION_GAPS.some(
|
|
624
|
+
(existing) => existing.query === gap.query && existing.tool === gap.tool && existing.action === gap.action && existing.timestamp >= cutoff
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
function recordGap(gap) {
|
|
628
|
+
const timestamped = { ...gap, timestamp: Date.now() };
|
|
629
|
+
if (isDuplicate(timestamped)) return false;
|
|
630
|
+
SESSION_GAPS.push(timestamped);
|
|
631
|
+
persistGap(gap);
|
|
632
|
+
return true;
|
|
633
|
+
}
|
|
634
|
+
function persistGap(gap) {
|
|
635
|
+
const sessionId = getAgentSessionId();
|
|
636
|
+
mcpMutation("gaps.record", {
|
|
637
|
+
sessionId: sessionId ?? void 0,
|
|
638
|
+
query: gap.query,
|
|
639
|
+
tool: gap.tool,
|
|
640
|
+
action: gap.action,
|
|
641
|
+
gapType: gap.gapType,
|
|
642
|
+
collectionScope: gap.collectionScope
|
|
643
|
+
}).catch(() => {
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function getSessionGaps() {
|
|
647
|
+
return SESSION_GAPS;
|
|
648
|
+
}
|
|
649
|
+
function getTopGaps(limit = 5) {
|
|
650
|
+
const counts = /* @__PURE__ */ new Map();
|
|
651
|
+
for (const gap of SESSION_GAPS) {
|
|
652
|
+
const key = gap.query.toLowerCase().trim();
|
|
653
|
+
const existing = counts.get(key);
|
|
654
|
+
if (existing) {
|
|
655
|
+
existing.count++;
|
|
656
|
+
} else {
|
|
657
|
+
counts.set(key, { count: 1, gapType: gap.gapType });
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
return [...counts.entries()].map(([query, { count, gapType }]) => ({ query, count, gapType })).sort((a, b) => b.count - a.count).slice(0, limit);
|
|
661
|
+
}
|
|
662
|
+
function clearSessionGaps() {
|
|
663
|
+
SESSION_GAPS.length = 0;
|
|
664
|
+
}
|
|
665
|
+
function resolveGapsForEntry(entryName, entryId) {
|
|
666
|
+
mcpMutation("gaps.resolve", { entryName, entryId }).catch(() => {
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
|
|
618
670
|
// src/lib/collectionRoutingClassifier.ts
|
|
619
671
|
var CLASSIFIER_AUTO_ROUTE_THRESHOLD = 70;
|
|
620
672
|
var CLASSIFIER_AMBIGUITY_MARGIN = 15;
|
|
@@ -2223,6 +2275,7 @@ Or use \`collections action=list\` to see available collections.`
|
|
|
2223
2275
|
});
|
|
2224
2276
|
internalId = result.docId;
|
|
2225
2277
|
finalEntryId = result.entryId;
|
|
2278
|
+
resolveGapsForEntry(name, result.entryId);
|
|
2226
2279
|
} catch (error) {
|
|
2227
2280
|
const msg = error instanceof Error ? error.message : String(error);
|
|
2228
2281
|
if (msg.includes("Duplicate") || msg.includes("already exists")) {
|
|
@@ -2680,6 +2733,7 @@ Use \`entries action=get\` to inspect the existing entry, or \`update-entry\` to
|
|
|
2680
2733
|
});
|
|
2681
2734
|
const internalId = result.docId;
|
|
2682
2735
|
const finalEntryId = result.entryId;
|
|
2736
|
+
resolveGapsForEntry(entry.name, result.entryId);
|
|
2683
2737
|
let finalStatus = "draft";
|
|
2684
2738
|
let commitError;
|
|
2685
2739
|
let autoLinkCount = 0;
|
|
@@ -3084,6 +3138,10 @@ export {
|
|
|
3084
3138
|
initToolSurface,
|
|
3085
3139
|
trackWriteTool,
|
|
3086
3140
|
initFeatureFlags,
|
|
3141
|
+
recordGap,
|
|
3142
|
+
getSessionGaps,
|
|
3143
|
+
getTopGaps,
|
|
3144
|
+
clearSessionGaps,
|
|
3087
3145
|
CLASSIFIER_AUTO_ROUTE_THRESHOLD,
|
|
3088
3146
|
CLASSIFIABLE_COLLECTIONS,
|
|
3089
3147
|
classifyCollection,
|
|
@@ -3111,4 +3169,4 @@ export {
|
|
|
3111
3169
|
formatRubricCoaching,
|
|
3112
3170
|
formatRubricVerdictSection
|
|
3113
3171
|
};
|
|
3114
|
-
//# sourceMappingURL=chunk-
|
|
3172
|
+
//# sourceMappingURL=chunk-UWILSX73.js.map
|