|
1 | 1 | use anyhow::Result; |
2 | 2 | use fs_err as fs; |
3 | 3 | use goose::agents::extension::{Envs, PLATFORM_EXTENSIONS}; |
4 | | -use goose::agents::{Agent, AgentConfig, ExtensionConfig, SessionConfig}; |
| 4 | +use goose::agents::{Agent, AgentConfig, ExtensionConfig, GoosePlatform, SessionConfig}; |
5 | 5 | use goose::builtin_extension::register_builtin_extensions; |
6 | 6 | use goose::config::base::CONFIG_YAML_NAME; |
7 | 7 | use goose::config::extensions::get_enabled_extensions_with_config; |
@@ -325,6 +325,7 @@ impl GooseAcpAgent { |
325 | 325 | None, |
326 | 326 | self.goose_mode, |
327 | 327 | self.disable_session_naming, |
| 328 | + GoosePlatform::GooseCli, |
328 | 329 | )); |
329 | 330 | let agent = Arc::new(agent); |
330 | 331 |
|
@@ -737,7 +738,8 @@ impl GooseAcpAgent { |
737 | 738 | let config_path = self.config_dir.join(CONFIG_YAML_NAME); |
738 | 739 | let config = Config::new(&config_path, "goose")?; |
739 | 740 | let model_id = config.get_goose_model()?; |
740 | | - goose::model::ModelConfig::new(&model_id)? |
| 741 | + let provider_name = config.get_goose_provider()?; |
| 742 | + goose::model::ModelConfig::new(&model_id)?.with_canonical_limits(&provider_name) |
741 | 743 | } |
742 | 744 | }; |
743 | 745 | let provider = (self.provider_factory)(model_config, Vec::new()).await?; |
@@ -955,9 +957,18 @@ impl GooseAcpAgent { |
955 | 957 | session_id: &str, |
956 | 958 | model_id: &str, |
957 | 959 | ) -> Result<SetSessionModelResponse, sacp::Error> { |
958 | | - let model_config = goose::model::ModelConfig::new(model_id).map_err(|e| { |
959 | | - sacp::Error::invalid_params().data(format!("Invalid model config: {}", e)) |
| 960 | + let config_path = self.config_dir.join(CONFIG_YAML_NAME); |
| 961 | + let config = Config::new(&config_path, "goose").map_err(|e| { |
| 962 | + sacp::Error::internal_error().data(format!("Failed to read config: {}", e)) |
| 963 | + })?; |
| 964 | + let provider_name = config.get_goose_provider().map_err(|_| { |
| 965 | + sacp::Error::internal_error().data("No provider configured".to_string()) |
960 | 966 | })?; |
| 967 | + let model_config = goose::model::ModelConfig::new(model_id) |
| 968 | + .map_err(|e| { |
| 969 | + sacp::Error::invalid_params().data(format!("Invalid model config: {}", e)) |
| 970 | + })? |
| 971 | + .with_canonical_limits(&provider_name); |
961 | 972 | let provider = (self.provider_factory)(model_config, Vec::new()) |
962 | 973 | .await |
963 | 974 | .map_err(|e| { |
@@ -1278,20 +1289,14 @@ print(\"hello, world\") |
1278 | 1289 | "mock" |
1279 | 1290 | } |
1280 | 1291 |
|
1281 | | - async fn complete_with_model( |
| 1292 | + async fn stream( |
1282 | 1293 | &self, |
1283 | | - _session_id: Option<&str>, |
1284 | 1294 | _model_config: &goose::model::ModelConfig, |
| 1295 | + _session_id: &str, |
1285 | 1296 | _system: &str, |
1286 | 1297 | _messages: &[goose::conversation::message::Message], |
1287 | 1298 | _tools: &[rmcp::model::Tool], |
1288 | | - ) -> Result< |
1289 | | - ( |
1290 | | - goose::conversation::message::Message, |
1291 | | - goose::providers::base::ProviderUsage, |
1292 | | - ), |
1293 | | - ProviderError, |
1294 | | - > { |
| 1299 | + ) -> Result<goose::providers::base::MessageStream, ProviderError> { |
1295 | 1300 | unimplemented!() |
1296 | 1301 | } |
1297 | 1302 |
|
|
0 commit comments