@@ -78,136 +78,66 @@ pub type LoadError {
7878 DotenvReadFailed ( path : String , reason : String )
7979}
8080
81- const default_service_name = "lummy_agent"
82-
83- const default_environment = "dev"
84-
85- const default_host = "localhost"
86-
87- const default_port = 4000
88-
89- const default_database_path = "lummy_agent.db"
90-
9181const minimum_secret_key_base_bytes = 64
9282
93- const default_secret_key_base = "lummy-agent-dev-secret-key-base-00000000000000000000000000000000"
94-
95- const default_openrouter_api_key = ""
96-
97- const default_openrouter_base_url = "https://openrouter.ai/api/v1"
98-
99- const default_openrouter_site_url = "http://localhost"
100-
101- const default_openrouter_app_name = "lummy_agent"
102-
103- const default_openrouter_timeout_ms = 30_000
104-
105- const default_openai_compatible_api_key = ""
106-
107- const default_openai_compatible_base_url = "https://api.openai.com/v1"
108-
109- const default_openai_compatible_timeout_ms = 30_000
110-
111- const default_provider_id = "basic-local"
112-
113- const default_provider_fallback_ids = [ ]
114-
115- const default_model_selection = "basic-local"
116-
117- const default_agent_system_prompt = "You are lummy_agent, a local-first assistant. Be concise, accurate, and use tools when they help answer the user."
118-
119- const default_agent_context_message_limit = 12
120-
121- const default_agent_context_summary_chars = 600
122-
123- const default_agent_context_summary_mode = "model"
124-
125- const default_agent_context_summary_input_chars = 2400
126-
127- const default_agent_max_steps = 4
128-
129- const default_agent_max_total_tokens = 16_000
130-
131- const default_agent_max_cost_micros = 5_000_000
132-
133- const default_agent_max_duration_ms = 60_000
134-
135- const default_agent_tool_timeout_ms = 5000
136-
137- const default_agent_tool_max_retries = 1
138-
139- const default_agent_tool_file_root = "."
140-
141- const default_agent_tool_shell_working_directory = "."
142-
143- const default_agent_tool_notes_path = ".lummy_agent_notes.md"
144-
145- const default_agent_allowed_tools = [
146- "calculator" ,
147- "web_fetch" ,
148- "web_search" ,
149- "file_read" ,
150- "file_write" ,
151- "shell_command" ,
152- "notes_memory" ,
153- ]
154-
155- const default_agent_allowed_tool_capabilities = [
156- "math" ,
157- "filesystem_read" ,
158- "network" ,
159- "external_api" ,
160- "memory" ,
161- ]
162-
163- const default_agent_max_tool_risk = "low"
164-
165- const default_agent_external_provider_max_tool_risk = "low"
166-
16783pub fn defaults ( ) -> Config {
16884 Config (
169- service_name : default_service_name ,
170- environment : default_environment ,
85+ service_name : "lummy_agent" ,
86+ environment : "dev" ,
17187 server : ServerConfig (
172- host : default_host ,
173- port : default_port ,
174- secret_key_base : default_secret_key_base ,
88+ host : "localhost" ,
89+ port : 4000 ,
90+ secret_key_base : "lummy-agent-dev-secret-key-base-00000000000000000000000000000000" ,
17591 ) ,
176- storage : StorageConfig ( database_path : default_database_path ) ,
92+ storage : StorageConfig ( database_path : "lummy_agent.db" ) ,
17793 providers : ProviderConfig (
178- default_provider_id : default_provider_id ,
179- fallback_ids : default_provider_fallback_ids ,
180- default_model_selection : default_model_selection ,
181- openrouter_api_key : default_openrouter_api_key ,
182- openrouter_base_url : default_openrouter_base_url ,
183- openrouter_site_url : default_openrouter_site_url ,
184- openrouter_app_name : default_openrouter_app_name ,
185- openrouter_timeout_ms : default_openrouter_timeout_ms ,
186- openai_compatible_api_key : default_openai_compatible_api_key ,
187- openai_compatible_base_url : default_openai_compatible_base_url ,
188- openai_compatible_timeout_ms : default_openai_compatible_timeout_ms ,
94+ default_provider_id : "basic-local" ,
95+ fallback_ids : [ ] ,
96+ default_model_selection : "basic-local" ,
97+ openrouter_api_key : "" ,
98+ openrouter_base_url : "https://openrouter.ai/api/v1" ,
99+ openrouter_site_url : "http://localhost" ,
100+ openrouter_app_name : "lummy_agent" ,
101+ openrouter_timeout_ms : 30_000 ,
102+ openai_compatible_api_key : "" ,
103+ openai_compatible_base_url : "https://api.openai.com/v1" ,
104+ openai_compatible_timeout_ms : 30_000 ,
189105 ) ,
190106 agent : AgentConfig (
191- system_prompt : default_agent_system_prompt ,
192- context_message_limit : default_agent_context_message_limit ,
193- context_summary_chars : default_agent_context_summary_chars ,
194- context_summary_mode : default_agent_context_summary_mode ,
195- context_summary_input_chars : default_agent_context_summary_input_chars ,
196- max_steps : default_agent_max_steps ,
197- max_total_tokens : default_agent_max_total_tokens ,
198- max_cost_micros : default_agent_max_cost_micros ,
199- max_duration_ms : default_agent_max_duration_ms ,
107+ system_prompt : "You are lummy_agent, a local-first assistant. Be concise, accurate, and use tools when they help answer the user." ,
108+ context_message_limit : 12 ,
109+ context_summary_chars : 600 ,
110+ context_summary_mode : "model" ,
111+ context_summary_input_chars : 2400 ,
112+ max_steps : 4 ,
113+ max_total_tokens : 16_000 ,
114+ max_cost_micros : 5_000_000 ,
115+ max_duration_ms : 60_000 ,
200116 ) ,
201117 tools : ToolsConfig (
202- timeout_ms : default_agent_tool_timeout_ms ,
203- max_retries : default_agent_tool_max_retries ,
204- file_root : default_agent_tool_file_root ,
205- shell_working_directory : default_agent_tool_shell_working_directory ,
206- notes_path : default_agent_tool_notes_path ,
207- allowed_tools : default_agent_allowed_tools ,
208- allowed_tool_capabilities : default_agent_allowed_tool_capabilities ,
209- max_tool_risk : default_agent_max_tool_risk ,
210- external_provider_max_tool_risk : default_agent_external_provider_max_tool_risk ,
118+ timeout_ms : 5000 ,
119+ max_retries : 1 ,
120+ file_root : "." ,
121+ shell_working_directory : "." ,
122+ notes_path : ".lummy_agent_notes.md" ,
123+ allowed_tools : [
124+ "calculator" ,
125+ "web_fetch" ,
126+ "web_search" ,
127+ "file_read" ,
128+ "file_write" ,
129+ "shell_command" ,
130+ "notes_memory" ,
131+ ] ,
132+ allowed_tool_capabilities : [
133+ "math" ,
134+ "filesystem_read" ,
135+ "network" ,
136+ "external_api" ,
137+ "memory" ,
138+ ] ,
139+ max_tool_risk : "low" ,
140+ external_provider_max_tool_risk : "low" ,
211141 ) ,
212142 )
213143}
@@ -465,19 +395,12 @@ fn csv_list_from_env(
465395fn parse_csv_list ( value : String ) -> List ( String ) {
466396 value
467397 |> string . split ( on : "," )
468- |> non_blank_csv_values ( [ ] )
469- }
470-
471- fn non_blank_csv_values ( values : List ( String ) , acc : List ( String ) ) -> List ( String ) {
472- case values {
473- [ ] -> list . reverse ( acc )
474-
475- [ value , .. rest ] ->
476- case string . trim ( value ) {
477- "" -> non_blank_csv_values ( rest , acc )
478- trimmed -> non_blank_csv_values ( rest , [ trimmed , .. acc ] )
479- }
480- }
398+ |> list . filter_map ( fn ( raw ) {
399+ case string . trim ( raw ) {
400+ "" -> Error ( Nil )
401+ trimmed -> Ok ( trimmed )
402+ }
403+ } )
481404}
482405
483406fn valid_tool_risk ( value : String ) -> Bool {
0 commit comments