@@ -3,27 +3,37 @@ use std::sync::Arc;
33use forge_domain:: App ;
44
55use crate :: conversation:: ForgeConversationService ;
6- use crate :: prompt:: ForgePromptService ;
76use crate :: provider:: ForgeProviderService ;
7+ use crate :: suggestion:: ForgeSuggestionService ;
8+ use crate :: template:: ForgeTemplateService ;
89use crate :: tool_service:: ForgeToolService ;
910use crate :: Infrastructure ;
1011
12+ /// ForgeApp is the main application container that implements the App trait.
13+ /// It provides access to all core services required by the application.
14+ ///
15+ /// Type Parameters:
16+ /// - F: The infrastructure implementation that provides core services like
17+ /// environment, file reading, vector indexing, and embedding.
1118pub struct ForgeApp < F > {
1219 infra : Arc < F > ,
13- _tool_service : ForgeToolService ,
14- _provider_service : ForgeProviderService ,
15- _conversation_service : ForgeConversationService ,
16- _prompt_service : ForgePromptService ,
20+ tool_service : ForgeToolService ,
21+ provider_service : ForgeProviderService ,
22+ conversation_service : ForgeConversationService ,
23+ prompt_service : ForgeTemplateService ,
24+ suggestion_service : Arc < ForgeSuggestionService < F > > ,
1725}
1826
1927impl < F : Infrastructure > ForgeApp < F > {
2028 pub fn new ( infra : Arc < F > ) -> Self {
29+ let suggestion_service = Arc :: new ( ForgeSuggestionService :: new ( infra. clone ( ) ) ) ;
2130 Self {
2231 infra : infra. clone ( ) ,
23- _tool_service : ForgeToolService :: new ( infra. clone ( ) ) ,
24- _provider_service : ForgeProviderService :: new ( infra. clone ( ) ) ,
25- _conversation_service : ForgeConversationService :: new ( ) ,
26- _prompt_service : ForgePromptService :: new ( ) ,
32+ tool_service : ForgeToolService :: new ( infra. clone ( ) , suggestion_service. clone ( ) ) ,
33+ provider_service : ForgeProviderService :: new ( infra. clone ( ) ) ,
34+ conversation_service : ForgeConversationService :: new ( ) ,
35+ prompt_service : ForgeTemplateService :: new ( ) ,
36+ suggestion_service,
2737 }
2838 }
2939}
@@ -32,29 +42,34 @@ impl<F: Infrastructure> App for ForgeApp<F> {
3242 type ToolService = ForgeToolService ;
3343 type ProviderService = ForgeProviderService ;
3444 type ConversationService = ForgeConversationService ;
35- type PromptService = ForgePromptService ;
45+ type PromptService = ForgeTemplateService ;
46+ type SuggestionService = ForgeSuggestionService < F > ;
3647
3748 fn tool_service ( & self ) -> & Self :: ToolService {
38- & self . _tool_service
49+ & self . tool_service
50+ }
51+
52+ fn suggestion_service ( & self ) -> & Self :: SuggestionService {
53+ & self . suggestion_service
3954 }
4055
4156 fn provider_service ( & self ) -> & Self :: ProviderService {
42- & self . _provider_service
57+ & self . provider_service
4358 }
4459
4560 fn conversation_service ( & self ) -> & Self :: ConversationService {
46- & self . _conversation_service
61+ & self . conversation_service
4762 }
4863
4964 fn prompt_service ( & self ) -> & Self :: PromptService {
50- & self . _prompt_service
65+ & self . prompt_service
5166 }
5267}
5368
5469impl < F : Infrastructure > Infrastructure for ForgeApp < F > {
5570 type EnvironmentService = F :: EnvironmentService ;
5671 type FileReadService = F :: FileReadService ;
57- type KnowledgeRepository = F :: KnowledgeRepository ;
72+ type VectorIndex = F :: VectorIndex ;
5873 type EmbeddingService = F :: EmbeddingService ;
5974
6075 fn environment_service ( & self ) -> & Self :: EnvironmentService {
@@ -65,8 +80,8 @@ impl<F: Infrastructure> Infrastructure for ForgeApp<F> {
6580 self . infra . file_read_service ( )
6681 }
6782
68- fn textual_knowledge_repo ( & self ) -> & Self :: KnowledgeRepository {
69- self . infra . textual_knowledge_repo ( )
83+ fn vector_index ( & self ) -> & Self :: VectorIndex {
84+ self . infra . vector_index ( )
7085 }
7186
7287 fn embedding_service ( & self ) -> & Self :: EmbeddingService {
0 commit comments