Support platform tools through CLI (#5570)
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -28,7 +28,7 @@ use goose::utils::safe_truncate;
|
|||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use completion::GooseCompleter;
|
use completion::GooseCompleter;
|
||||||
use goose::agents::extension::{Envs, ExtensionConfig};
|
use goose::agents::extension::{Envs, ExtensionConfig, PLATFORM_EXTENSIONS};
|
||||||
use goose::agents::types::RetryConfig;
|
use goose::agents::types::RetryConfig;
|
||||||
use goose::agents::{Agent, SessionConfig, MANUAL_COMPACT_TRIGGER};
|
use goose::agents::{Agent, SessionConfig, MANUAL_COMPACT_TRIGGER};
|
||||||
use goose::config::{Config, GooseMode};
|
use goose::config::{Config, GooseMode};
|
||||||
@@ -299,15 +299,24 @@ impl CliSession {
|
|||||||
/// * `builtin_name` - Name of the builtin extension(s), comma separated
|
/// * `builtin_name` - Name of the builtin extension(s), comma separated
|
||||||
pub async fn add_builtin(&mut self, builtin_name: String) -> Result<()> {
|
pub async fn add_builtin(&mut self, builtin_name: String) -> Result<()> {
|
||||||
for name in builtin_name.split(',') {
|
for name in builtin_name.split(',') {
|
||||||
let extension_name = name.trim().to_string();
|
let extension_name = name.trim();
|
||||||
let config = ExtensionConfig::Builtin {
|
|
||||||
name: extension_name,
|
let config = if PLATFORM_EXTENSIONS.contains_key(extension_name) {
|
||||||
display_name: None,
|
ExtensionConfig::Platform {
|
||||||
// TODO: should set a timeout
|
name: extension_name.to_string(),
|
||||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
bundled: None,
|
||||||
bundled: None,
|
description: name.to_string(),
|
||||||
description: name.trim().to_string(),
|
available_tools: Vec::new(),
|
||||||
available_tools: Vec::new(),
|
}
|
||||||
|
} else {
|
||||||
|
ExtensionConfig::Builtin {
|
||||||
|
name: extension_name.to_string(),
|
||||||
|
display_name: None,
|
||||||
|
timeout: None,
|
||||||
|
bundled: None,
|
||||||
|
description: name.to_string(),
|
||||||
|
available_tools: Vec::new(),
|
||||||
|
}
|
||||||
};
|
};
|
||||||
self.agent
|
self.agent
|
||||||
.add_extension(config)
|
.add_extension(config)
|
||||||
|
|||||||
Reference in New Issue
Block a user