feat: modernize API architecture and deprecation handling
- Modernize BrainyInterface to only contain current API methods (add, relate, find, get) - Update all interface consumers to use modern API patterns - Make Brainy class implement clean modernized interface - Update CLI commands to use add() and relate() instead of deprecated methods - Update all source code components to use modern API consistently - Update examples and integration tests to modern patterns - Improve architectural consistency across the entire codebase BREAKING: BrainyInterface no longer contains deprecated methods Migration: Use add() instead of addNoun(), relate() instead of addVerb()
This commit is contained in:
parent
2128ef5607
commit
1b32870e43
11 changed files with 89 additions and 84 deletions
|
|
@ -8,9 +8,10 @@
|
|||
|
||||
import { v4 as uuidv4 } from '../universal/uuid.js'
|
||||
import { BrainyInterface } from '../types/brainyDataInterface.js'
|
||||
import {
|
||||
MCPRequest,
|
||||
MCPResponse,
|
||||
import { NounType } from '../types/graphTypes.js'
|
||||
import {
|
||||
MCPRequest,
|
||||
MCPResponse,
|
||||
MCPDataAccessRequest,
|
||||
MCPRequestType,
|
||||
MCP_VERSION
|
||||
|
|
@ -75,7 +76,7 @@ export class BrainyMCPAdapter {
|
|||
)
|
||||
}
|
||||
|
||||
const noun = await this.brainyData.getNoun(id)
|
||||
const noun = await this.brainyData.get(id)
|
||||
|
||||
if (!noun) {
|
||||
return this.createErrorResponse(
|
||||
|
|
@ -104,7 +105,7 @@ export class BrainyMCPAdapter {
|
|||
)
|
||||
}
|
||||
|
||||
const results = await this.brainyData.searchText(query, k)
|
||||
const results = await this.brainyData.find({ query, limit: k })
|
||||
return this.createSuccessResponse(request.requestId, results)
|
||||
}
|
||||
|
||||
|
|
@ -124,8 +125,8 @@ export class BrainyMCPAdapter {
|
|||
)
|
||||
}
|
||||
|
||||
// Add data directly using addNoun
|
||||
const id = await this.brainyData.addNoun(text, 'document', metadata)
|
||||
// Add data using modern API (interface only supports modern methods)
|
||||
const id = await this.brainyData.add({ data: text, type: NounType.Document, metadata })
|
||||
return this.createSuccessResponse(request.requestId, { id })
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue