@rigstate/mcp 0.7.8 → 0.7.9
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 +15 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/tools/list-features.ts +7 -4
- package/src/tools/planning-tools.ts +12 -8
- package/src/tools/query-brain.ts +12 -4
package/dist/index.js
CHANGED
|
@@ -2212,13 +2212,14 @@ async function queryBrain(supabase, userId, projectId, query, limit = 8) {
|
|
|
2212
2212
|
}
|
|
2213
2213
|
let relevantFeatures = [];
|
|
2214
2214
|
try {
|
|
2215
|
-
const { data: projectRow } = await supabase.
|
|
2215
|
+
const { data: projectRow } = await supabase.rpc("get_project_context_secure", { p_project_id: projectId, p_user_id: userId }).single();
|
|
2216
2216
|
if (projectRow?.functional_spec) {
|
|
2217
|
-
const spec = projectRow.functional_spec;
|
|
2217
|
+
const spec = typeof projectRow.functional_spec === "string" ? JSON.parse(projectRow.functional_spec) : projectRow.functional_spec;
|
|
2218
2218
|
const features = spec.featureList || spec.features || [];
|
|
2219
2219
|
relevantFeatures = features.filter((f) => (f.name || f.title)?.toLowerCase().includes(query.toLowerCase())).slice(0, 3);
|
|
2220
2220
|
}
|
|
2221
2221
|
} catch (e) {
|
|
2222
|
+
console.error("[query_brain] Failed to fetch project spec for features:", e);
|
|
2222
2223
|
}
|
|
2223
2224
|
const contextLines = memories.map((m) => `- [${(m.category || "GENERAL").toUpperCase()}]: ${m.content}`);
|
|
2224
2225
|
let formatted = `=== PROJECT BRAIN: RELEVANT MEMORIES ===
|
|
@@ -2788,9 +2789,11 @@ Useful for understanding the strategic context and major milestones.`,
|
|
|
2788
2789
|
let dbFeatures = [];
|
|
2789
2790
|
let source = "DB";
|
|
2790
2791
|
try {
|
|
2791
|
-
const { data } = await supabase.rpc("get_project_context_secure", { p_project_id: projectId, p_user_id: userId }).single();
|
|
2792
|
+
const { data, error } = await supabase.rpc("get_project_context_secure", { p_project_id: projectId, p_user_id: userId }).single();
|
|
2793
|
+
if (error || !data) throw error || new Error("Project not found");
|
|
2792
2794
|
projectRow = data;
|
|
2793
2795
|
} catch (e) {
|
|
2796
|
+
console.error("[list_features] Secure Project RPC failed:", e);
|
|
2794
2797
|
const { data } = await supabase.from("projects").select("id, functional_spec").eq("id", projectId).single();
|
|
2795
2798
|
projectRow = data;
|
|
2796
2799
|
}
|
|
@@ -3781,16 +3784,18 @@ ${content}`;
|
|
|
3781
3784
|
p_tags: tags || [],
|
|
3782
3785
|
p_importance: category === "DECISION" || category === "ARCHITECTURE" ? 9 : 5
|
|
3783
3786
|
});
|
|
3784
|
-
if (
|
|
3785
|
-
|
|
3786
|
-
} else {
|
|
3787
|
+
if (error) {
|
|
3788
|
+
console.error("[save_to_project_brain] RPC Error:", error);
|
|
3787
3789
|
saveError = error;
|
|
3790
|
+
} else if (data) {
|
|
3791
|
+
memoryId = data;
|
|
3788
3792
|
}
|
|
3789
3793
|
} catch (e) {
|
|
3794
|
+
console.error("[save_to_project_brain] RPC Exception:", e);
|
|
3790
3795
|
saveError = e;
|
|
3791
3796
|
}
|
|
3792
3797
|
if (!memoryId) {
|
|
3793
|
-
console.warn("
|
|
3798
|
+
console.warn("[save_to_project_brain] Falling back to direct insert. RPC Error/Response was:", saveError);
|
|
3794
3799
|
const { data, error } = await supabase.from("project_memories").insert({
|
|
3795
3800
|
project_id: projectId,
|
|
3796
3801
|
content: fullContent,
|
|
@@ -3803,8 +3808,9 @@ ${content}`;
|
|
|
3803
3808
|
if (data) {
|
|
3804
3809
|
memoryId = data.id;
|
|
3805
3810
|
} else {
|
|
3806
|
-
console.error("Direct insert failed:", error);
|
|
3807
|
-
|
|
3811
|
+
console.error("[save_to_project_brain] Direct insert failed:", error);
|
|
3812
|
+
const detail = error?.message || saveError?.message || "Unknown error";
|
|
3813
|
+
throw new Error(`Failed to save memory: ${detail}. (Note: secure RPC failed first)`);
|
|
3808
3814
|
}
|
|
3809
3815
|
}
|
|
3810
3816
|
return {
|