fix: include graph-agent descriptions in .agent <TAB> completions
This commit is contained in:
+11
-4
@@ -1,6 +1,6 @@
|
||||
use crate::client::{ModelType, list_models};
|
||||
use crate::config::paths;
|
||||
use crate::config::{AppConfig, Config, list_agents, list_sessions};
|
||||
use crate::config::{AppConfig, Config, list_agents_with_descriptions, list_sessions};
|
||||
use crate::utils::list_file_names;
|
||||
use crate::vault::Vault;
|
||||
use clap_complete::{CompletionCandidate, Shell, generate};
|
||||
@@ -73,10 +73,17 @@ pub(super) fn role_completer(current: &OsStr) -> Vec<CompletionCandidate> {
|
||||
|
||||
pub(super) fn agent_completer(current: &OsStr) -> Vec<CompletionCandidate> {
|
||||
let cur = current.to_string_lossy();
|
||||
list_agents()
|
||||
list_agents_with_descriptions()
|
||||
.into_iter()
|
||||
.filter(|a| a.starts_with(&*cur))
|
||||
.map(CompletionCandidate::new)
|
||||
.filter(|(a, _)| a.starts_with(&*cur))
|
||||
.map(|(name, desc)| {
|
||||
let help = if desc.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(desc.into())
|
||||
};
|
||||
CompletionCandidate::new(name).help(help)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use super::agent::AgentConfig;
|
||||
use super::rag_cache::{RagCache, RagKey};
|
||||
use super::session::Session;
|
||||
use super::skill::{SKILL_SCAFFOLD, Skill};
|
||||
@@ -10,7 +9,7 @@ use super::{
|
||||
AGENTS_DIR_NAME, Agent, AgentVariables, AppConfig, AppState, AssetCategory, CREATE_TITLE_ROLE,
|
||||
Input, InstallFilter, LEFT_PROMPT, LastMessage, MESSAGES_FILE_NAME, RIGHT_PROMPT, Role,
|
||||
RoleLike, SESSIONS_DIR_NAME, SUMMARIZATION_PROMPT, SUMMARY_CONTEXT_PROMPT, StateFlags,
|
||||
TEMP_ROLE_NAME, TEMP_SESSION_NAME, WorkingMode, ensure_parent_exists, list_agents,
|
||||
TEMP_ROLE_NAME, TEMP_SESSION_NAME, WorkingMode, ensure_parent_exists,
|
||||
list_agents_with_descriptions, memory, paths,
|
||||
};
|
||||
use super::{MessageContentToolCalls, prompts};
|
||||
@@ -2876,15 +2875,9 @@ impl RequestContext {
|
||||
}
|
||||
}
|
||||
".rag" => super::map_completion_values(paths::list_rags()),
|
||||
".agent" => list_agents()
|
||||
".agent" => list_agents_with_descriptions()
|
||||
.into_iter()
|
||||
.map(|name| {
|
||||
let description = AgentConfig::load(&paths::agent_config_file(&name))
|
||||
.ok()
|
||||
.map(|c| c.description)
|
||||
.filter(|d| !d.is_empty());
|
||||
(name, description)
|
||||
})
|
||||
.map(|(name, desc)| (name, if desc.is_empty() { None } else { Some(desc) }))
|
||||
.collect(),
|
||||
".install" => {
|
||||
let mut values: Vec<String> =
|
||||
|
||||
Reference in New Issue
Block a user