diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2932cec..5c4a426f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,14 @@ jobs: - name: Run clippy run: cargo clippy --all-targets --all-features -- -D warnings + + spelling: + name: spell check with typos + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Spell Check Repo + uses: crate-ci/typos@master test: name: Run Tests diff --git a/crates/rmcp-macros/src/tool.rs b/crates/rmcp-macros/src/tool.rs index feed5350..ce58ebcf 100644 --- a/crates/rmcp-macros/src/tool.rs +++ b/crates/rmcp-macros/src/tool.rs @@ -213,11 +213,11 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu // let mut fommated_fn_args: Punctuated = Punctuated::new(); let mut unextractable_args_indexes = HashSet::new(); for (index, mut fn_arg) in input_fn.sig.inputs.iter_mut().enumerate() { - enum Catched { + enum Caught { Param(ToolFnParamAttrs), Aggregated(PatType), } - let mut catched = None; + let mut caught = None; match &mut fn_arg { FnArg::Receiver(_) => { continue; @@ -244,7 +244,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu "input param must have an ident as name", )); }; - catched.replace(Catched::Param(ToolFnParamAttrs { + caught.replace(Caught::Param(ToolFnParamAttrs { serde_meta: Vec::new(), schemars_meta: Vec::new(), ident: arg_ident, @@ -252,7 +252,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu })); } ParamMarker::Aggregated => { - catched.replace(Catched::Aggregated(pat_type.clone())); + caught.replace(Caught::Aggregated(pat_type.clone())); } } } else if meta_list.path.is_ident(SERDE_IDENT) { @@ -268,8 +268,8 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu } } } - match catched { - Some(Catched::Param(mut param)) => { + match caught { + Some(Caught::Param(mut param)) => { param.serde_meta = serde_metas; param.schemars_meta = schemars_metas; match &mut tool_macro_attrs.params { @@ -282,7 +282,7 @@ pub(crate) fn tool_fn_item(attr: TokenStream, mut input_fn: ItemFn) -> syn::Resu } unextractable_args_indexes.insert(index); } - Some(Catched::Aggregated(rust_type)) => { + Some(Caught::Aggregated(rust_type)) => { tool_macro_attrs.params = ToolParams::Aggregated { rust_type }; unextractable_args_indexes.insert(index); } diff --git a/examples/rig-integration/src/chat.rs b/examples/rig-integration/src/chat.rs index e9998a90..74748ef4 100644 --- a/examples/rig-integration/src/chat.rs +++ b/examples/rig-integration/src/chat.rs @@ -74,9 +74,12 @@ pub async fn output_error( e: impl std::fmt::Display, output: &mut BufWriter, ) -> std::io::Result<()> { - output.write_all(b"\x1b[31mERROR: \x1b[0m").await?; + output + .write_all(b"\x1b[1;31m\xE2\x9D\x8C ERROR: \x1b[0m") + .await?; output.write_all(e.to_string().as_bytes()).await?; output.write_all(b"\n").await?; + output.flush().await?; Ok(()) } @@ -84,7 +87,11 @@ pub async fn output_agent( content: impl std::fmt::Display, output: &mut BufWriter, ) -> std::io::Result<()> { + output + .write_all(b"\x1b[1;34m\xF0\x9F\xA4\x96 Agent: \x1b[0m") + .await?; output.write_all(content.to_string().as_bytes()).await?; + output.write_all(b"\n").await?; output.flush().await?; Ok(()) } @@ -93,16 +100,22 @@ pub async fn stream_output_toolcall( content: impl std::fmt::Display, output: &mut BufWriter, ) -> std::io::Result<()> { - output.write_all(b"\x1b[33mtool>\x1b[0m ").await?; + output + .write_all(b"\x1b[1;33m\xF0\x9F\x9B\xA0 Tool Call: \x1b[0m") + .await?; output.write_all(content.to_string().as_bytes()).await?; output.write_all(b"\n").await?; + output.flush().await?; Ok(()) } pub async fn stream_output_agent_start( output: &mut BufWriter, ) -> std::io::Result<()> { - output.write_all(b"\x1b[34magent>\x1b[0m ").await?; + output + .write_all(b"\x1b[1;34m\xF0\x9F\xA4\x96 Agent: \x1b[0m") + .await?; + output.flush().await?; Ok(()) } @@ -110,5 +123,6 @@ pub async fn stream_output_agent_finished( output: &mut BufWriter, ) -> std::io::Result<()> { output.write_all(b"\n").await?; + output.flush().await?; Ok(()) }