Fix provider tool history handling

This commit is contained in:
2026-08-12 14:19:51 -05:00
parent c79634e76f
commit b3f3a72435
18 changed files with 838 additions and 34 deletions
@@ -231,28 +231,26 @@ async fn suggestions_for_parse_error(
ParseErrorReason::ArgumentError {
command: _,
error: UnexpectedArgument(arg),
} => {
if arg.span.end() == input.len() {
// The unexpected argument could be a prefix for a subcommand.
let prefix = arg.item.as_str();
let results = (command_signature.subcommands.iter().filter_map(|subcmd| {
options
.match_strategy
.get_match_type(prefix, subcmd.name.as_str())
.map(|match_type| {
let suggestion = Suggestion::with_same_display_and_replacement(
subcmd.name.clone(),
subcmd.description.as_ref().cloned(),
SuggestionType::Subcommand,
subcmd.priority.into(),
);
MatchedSuggestion::new(suggestion, match_type)
})
}))
.sorted_by(MatchedSuggestion::cmp_by_display)
.collect();
return (results, false);
}
} if arg.span.end() == input.len() => {
// The unexpected argument could be a prefix for a subcommand.
let prefix = arg.item.as_str();
let results = (command_signature.subcommands.iter().filter_map(|subcmd| {
options
.match_strategy
.get_match_type(prefix, subcmd.name.as_str())
.map(|match_type| {
let suggestion = Suggestion::with_same_display_and_replacement(
subcmd.name.clone(),
subcmd.description.as_ref().cloned(),
SuggestionType::Subcommand,
subcmd.priority.into(),
);
MatchedSuggestion::new(suggestion, match_type)
})
}))
.sorted_by(MatchedSuggestion::cmp_by_display)
.collect();
return (results, false);
}
_ => {}
}
@@ -11,6 +11,8 @@ mod registry;
use std::cmp::Ordering;
#[cfg(feature = "v2")]
use galaxy_js::TypedJsFunctionRef;
pub use lookup::*;
pub use registry::*;
use serde::{Deserialize, Serialize};