Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions cli/golem-cli/src/command_handler/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2144,8 +2144,8 @@ fn extract_simple_method_name(function_name: &str) -> String {
function_name.to_string()
}

/// Fuzzy-matches a method name pattern against both original and WIT-named (kebab-case)
/// method names, returning the **original** method name on success.
/// Fuzzy-matches a method name pattern against the original method names from agent metadata,
/// returning the matched method name on success.
fn resolve_agent_method_name(
provided_method_name: &str,
agent_type: &AgentType,
Expand All @@ -2155,13 +2155,8 @@ fn resolve_agent_method_name(

for m in &agent_type.methods {
let original = m.name.clone();
let wit = original.to_wit_naming();
for alias in [original.clone(), wit] {
if !alias_to_original.contains_key(&alias) {
alias_to_original.insert(alias.clone(), original.clone());
aliases.push(alias);
}
}
alias_to_original.insert(original.clone(), original.clone());
aliases.push(original);
}

let fuzzy_search = FuzzySearch::new(aliases.iter().map(|s| s.as_str()));
Expand Down
5 changes: 2 additions & 3 deletions cli/golem-cli/src/model/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use crate::model::environment::ResolvedEnvironmentIdentity;
use crate::model::wave::function_wave_compatible;
use crate::model::worker::RawAgentId;
use chrono::{DateTime, Utc};
use golem_common::model::agent::wit_naming::ToWitNaming;
use golem_common::model::agent::{
AgentType, ComponentModelElementSchema, DataSchema, ElementSchema,
};
Expand Down Expand Up @@ -148,7 +147,7 @@ impl ComponentView {
.metadata
.agent_types()
.iter()
.map(|a| a.to_wit_naming())
.cloned()
.collect::<Vec<_>>();

show_exported_agents(&agent_types, true, true)
Expand Down Expand Up @@ -332,7 +331,7 @@ pub fn render_agent_constructor(
format!(
"{}({}){}",
agent.wrapper_type_name(),
render_data_schema(&agent.constructor.input_schema.to_wit_naming()),
render_data_schema(&agent.constructor.input_schema),
dummy_return_type
)
} else {
Expand Down
3 changes: 1 addition & 2 deletions cli/golem-cli/src/model/text/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use crate::model::text::fmt::{
use cli_table::Table;
use colored::Colorize;
use golem_client::model::ComponentDto;
use golem_common::model::agent::wit_naming::ToWitNaming;
use golem_common::model::agent::{AgentType, ParsedAgentId};
use golem_common::model::component::ComponentName;
use golem_wasm::analysis::AnalysedType;
Expand Down Expand Up @@ -222,7 +221,7 @@ impl AvailableFunctionNamesHelp {
function_names: agent_type
.methods
.iter()
.map(|m| m.name.to_wit_naming())
.map(|m| m.name.clone())
.collect(),
}
}
Expand Down
3 changes: 1 addition & 2 deletions golem-common/src/model/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,12 @@ impl DataValue {
.iter()
.find(|element_schema| {
element_schema.name == element_name
|| element_schema.name.to_wit_naming() == element_name
})
.ok_or_else(|| {
format!(
"Unknown multimodal element name: `{}`. Should be one of {}",
element_name,
element_schemas.elements.iter().map(|element_schema| element_schema.name.to_wit_naming()).collect::<Vec<_>>().join(", ")
element_schemas.elements.iter().map(|element_schema| element_schema.name.clone()).collect::<Vec<_>>().join(", ")
)
})?;
let element_value =
Expand Down
Loading
Loading