@@ -38,17 +38,12 @@ class AIService {
3838
3939 try {
4040 log . info ( 'Initializing AI Service...' ) ;
41- // Dynamic require of index.js bootstrap to initialize the agent
4241 const { initializeAISystem } = require ( '../index.js' ) ;
4342 const result = await initializeAISystem ( appDataDir , workspaceRoot , llmProvider , embeddingConfig ) ;
4443 const { getAIAgent } = require ( '../index.js' ) ;
4544 this . agent = getAIAgent ( ) ;
4645
47- const AIFlow = require ( './AIFlow' ) ;
48- this . aiFlow = new AIFlow ( this . agent ) ;
49- this . agent . aiFlow = this . aiFlow ;
50-
51- log . info ( 'AI Service & AIFlow Orchestrator successfully initialized' ) ;
46+ log . info ( 'AI Service successfully initialized (embeddings + graph ready)' ) ;
5247 return result ;
5348 } catch ( error ) {
5449 log . error ( 'Failed to initialize AI Service:' , error . message ) ;
@@ -120,14 +115,12 @@ class AIService {
120115 const { shutdownAISystem } = require ( '../index.js' ) ;
121116 shutdownAISystem ( ) ;
122117 this . agent = null ;
123- this . aiFlow = null ;
124118 }
125119
126120 shutdown ( ) {
127121 const { shutdownAISystem } = require ( '../index.js' ) ;
128122 shutdownAISystem ( ) ;
129123 this . agent = null ;
130- this . aiFlow = null ;
131124 log . info ( 'AI Service shut down' ) ;
132125 }
133126
@@ -227,78 +220,6 @@ class AIService {
227220 }
228221 }
229222
230- async chat ( message , context = { } ) {
231- if ( ! this . enabled || ! this . agent ) {
232- throw new Error ( 'AI is currently disabled or uninitialized.' ) ;
233- }
234- if ( ! this . aiFlow ) {
235- const AIFlow = require ( './AIFlow' ) ;
236- this . aiFlow = new AIFlow ( this . agent ) ;
237- this . agent . aiFlow = this . aiFlow ;
238- }
239- return this . aiFlow . execute ( message , context ) ;
240- }
241-
242- /**
243- * Main chat query streaming wrapper
244- */
245- async stream ( message , context = { } , onChunk , abortSignal ) {
246- if ( ! this . enabled || ! this . agent ) {
247- throw new Error ( 'AI is currently disabled or uninitialized.' ) ;
248- }
249- if ( ! this . aiFlow ) {
250- const AIFlow = require ( './AIFlow' ) ;
251- this . aiFlow = new AIFlow ( this . agent ) ;
252- this . agent . aiFlow = this . aiFlow ;
253- }
254- return this . aiFlow . stream ( message , context , onChunk , abortSignal ) ;
255- }
256-
257- // --- Facade API Methods for Subsystem Modules ---
258-
259- getGraphStatus ( ) {
260- return this . agent ?. graphDb ? this . agent . graphDb . getStatus ( ) : null ;
261- }
262-
263- getGraphData ( ) {
264- return this . agent ?. graphDb ? this . agent . graphDb . getAll ( ) : null ;
265- }
266-
267- clearGraphData ( ) {
268- if ( this . agent ?. graphDb ) {
269- this . agent . graphDb . clearAllData ( ) ;
270- }
271- }
272-
273- async buildGraph ( onProgress ) {
274- return this . agent ? this . agent . buildRelationshipGraph ( onProgress ) : { success : false , error : 'Agent not initialized' } ;
275- }
276-
277- getEmbeddingStats ( ) {
278- return this . agent ?. embeddingDb ? this . agent . embeddingDb . getStats ( ) : null ;
279- }
280-
281- clearEmbeddingData ( ) {
282- if ( this . agent ?. embeddingDb ) {
283- this . agent . embeddingDb . clearAllData ( ) ;
284- }
285- }
286-
287- async generateEmbeddings ( forceRefresh = false ) {
288- return this . agent ? this . agent . generateEmbeddings ( forceRefresh ) : { success : false , error : 'Agent not initialized' } ;
289- }
290-
291- detectPatterns ( ) {
292- return this . agent ? this . agent . detectPatterns ( ) : { success : false , error : 'Agent not initialized' } ;
293- }
294-
295- getConversationStore ( ) {
296- return this . agent ?. conversationStore || null ;
297- }
298-
299- getPersonaManager ( ) {
300- return this . agent ?. personaManager || null ;
301- }
302223}
303224
304225const aiServiceInstance = new AIService ( ) ;
0 commit comments