@rigstate/mcp 0.4.3 → 0.4.5
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/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/tools/get-latest-decisions.ts +1 -1
- package/src/tools/query-brain.ts +15 -7
package/dist/index.js
CHANGED
|
@@ -982,27 +982,33 @@ async function queryBrain(supabase, userId, projectId, query, limit = 8, thresho
|
|
|
982
982
|
const searchTerms = query.toLowerCase().split(/\s+/).filter((t) => t.length > 2);
|
|
983
983
|
if (searchTerms.length > 0) {
|
|
984
984
|
const orConditions = searchTerms.map((term) => `content.ilike.%${term}%`).join(",");
|
|
985
|
-
const { data: keywordMatches, error: searchError } = await supabase.from("project_memories").select("id, content, category, tags,
|
|
986
|
-
if (
|
|
985
|
+
const { data: keywordMatches, error: searchError } = await supabase.from("project_memories").select("id, content, category, tags, importance, created_at").eq("project_id", projectId).eq("is_active", true).or(orConditions).order("importance", { ascending: false, nullsFirst: false }).limit(limit);
|
|
986
|
+
if (searchError) {
|
|
987
|
+
console.error("Search error:", searchError);
|
|
988
|
+
}
|
|
989
|
+
if (keywordMatches) {
|
|
987
990
|
memories = keywordMatches.map((m) => ({
|
|
988
991
|
id: m.id,
|
|
989
992
|
content: m.content,
|
|
990
993
|
category: m.category || "general",
|
|
991
994
|
tags: m.tags || [],
|
|
992
|
-
netVotes: m.
|
|
995
|
+
netVotes: m.importance || 0,
|
|
993
996
|
createdAt: m.created_at
|
|
994
997
|
}));
|
|
995
998
|
}
|
|
996
999
|
}
|
|
997
1000
|
if (memories.length === 0) {
|
|
998
|
-
const { data: recentMemories, error: recentError } = await supabase.from("project_memories").select("id, content, category, tags,
|
|
999
|
-
if (
|
|
1001
|
+
const { data: recentMemories, error: recentError } = await supabase.from("project_memories").select("id, content, category, tags, importance, created_at").eq("project_id", projectId).eq("is_active", true).order("created_at", { ascending: false }).limit(limit);
|
|
1002
|
+
if (recentError) {
|
|
1003
|
+
console.error("Recent error:", recentError);
|
|
1004
|
+
}
|
|
1005
|
+
if (recentMemories) {
|
|
1000
1006
|
memories = recentMemories.map((m) => ({
|
|
1001
1007
|
id: m.id,
|
|
1002
1008
|
content: m.content,
|
|
1003
1009
|
category: m.category || "general",
|
|
1004
1010
|
tags: m.tags || [],
|
|
1005
|
-
netVotes: m.
|
|
1011
|
+
netVotes: m.importance || 0,
|
|
1006
1012
|
createdAt: m.created_at
|
|
1007
1013
|
}));
|
|
1008
1014
|
}
|
|
@@ -1055,7 +1061,7 @@ async function getLatestDecisions(supabase, userId, projectId, limit = 5) {
|
|
|
1055
1061
|
id: s.id,
|
|
1056
1062
|
projectId: s.project_id,
|
|
1057
1063
|
recruitedAgents: s.recruited_agents || [],
|
|
1058
|
-
feedbackSummary: (s.feedback_summary
|
|
1064
|
+
feedbackSummary: (Array.isArray(s.feedback_summary) ? s.feedback_summary : []).map((f) => ({
|
|
1059
1065
|
agentName: f.agentName || f.agent?.name || "Unknown",
|
|
1060
1066
|
emoji: f.emoji || f.agent?.emoji || "\u{1F916}",
|
|
1061
1067
|
critiques: f.critiques || [],
|