Initial commit: RA-H Open Source Edition

Local-first knowledge management system with BYO API keys.

Features:
- 3-panel UI (Nodes | Focus | Helpers)
- SQLite + sqlite-vec for vector search
- Agent system (Easy/Hard mode orchestrators)
- Content extraction (YouTube, PDF, web)
- Integrate workflow for connection discovery
- Dimension system with auto-assignment

Tech stack:
- Next.js 15 + TypeScript + Tailwind CSS
- Anthropic (Claude) + OpenAI (GPT) via Vercel AI SDK

Setup:
  npm install && npm rebuild better-sqlite3
  scripts/dev/bootstrap-local.sh
  npm run dev

MIT License
This commit is contained in:
“BeeRad”
2025-12-15 16:14:28 +11:00
commit 733d1c3407
226 changed files with 46231 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
import { tool } from 'ai';
import { z } from 'zod';
import { edgeService } from '@/services/database/edges';
export const updateEdgeTool = tool({
description: 'Update edge context/source/feedback',
inputSchema: z.object({
edge_id: z.number().describe('The ID of the edge to update'),
updates: z.object({
context: z.record(z.any()).optional().describe('Updated context information for this edge - can include explanation, relationship type, strength, notes, etc.'),
source: z.enum(['user', 'ai_similarity', 'helper_name']).optional().describe('Updated source classification for this edge'),
user_feedback: z.boolean().optional().describe('User feedback on this edge connection (true = positive, false = negative)')
}).describe('Fields to update on the edge')
}),
execute: async (params) => {
console.log('📝 UpdateEdge tool called with params:', JSON.stringify(params, null, 2));
try {
// Validate that edge exists before updating
const existingEdge = await edgeService.getEdgeById(params.edge_id);
if (!existingEdge) {
return {
success: false,
error: `Edge with ID ${params.edge_id} not found`,
data: null
};
}
// Filter out undefined values from updates
const cleanUpdates = Object.fromEntries(
Object.entries(params.updates).filter(([_, value]) => value !== undefined)
);
if (Object.keys(cleanUpdates).length === 0) {
return {
success: false,
error: 'No valid updates provided',
data: existingEdge
};
}
// Update the edge
const updatedEdge = await edgeService.updateEdge(params.edge_id, cleanUpdates);
// Build descriptive message
const updateDescriptions = [];
if (cleanUpdates.context) updateDescriptions.push('context');
if (cleanUpdates.source) updateDescriptions.push(`source to ${cleanUpdates.source}`);
if (cleanUpdates.user_feedback !== undefined) {
updateDescriptions.push(`user feedback to ${cleanUpdates.user_feedback ? 'positive' : 'negative'}`);
}
return {
success: true,
data: updatedEdge,
message: `Updated edge ${params.edge_id}: ${updateDescriptions.join(', ')}`
};
} catch (error) {
console.error('UpdateEdge tool error:', error);
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to update edge',
data: null
};
}
}
});