Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
30 changes: 22 additions & 8 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["crates/*"]
members = ["crates/*", "crates/service/codegen"]

[workspace.dependencies]
ccore = { path = "crates/core", package = "cydonia-core" }
Expand All @@ -16,9 +16,13 @@ dirs = "5.0.1"
hf-hub = "0.4.1"
llamac-sys = { version = "0.1.86", package = "llama-cpp-sys-2" }
once_cell = "1.20.2"
paste = "1.0.15"
proc-macro2 = "1.0.93"
quote = "1.0.38"
rand = "0.8.5"
serde = "1.0.217"
serde_json = "1.0.134"
syn = "2.0.96"
tokenizers = "0.21.0"
toml = "0.8.19"
tracing = "0.1.41"
Expand Down
6 changes: 0 additions & 6 deletions crates/registry/Cargo.toml

This file was deleted.

29 changes: 0 additions & 29 deletions crates/registry/models.toml

This file was deleted.

3 changes: 0 additions & 3 deletions crates/registry/src/main.rs

This file was deleted.

9 changes: 9 additions & 0 deletions crates/service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "cydonia-service"
version = "0.0.0"
edition = "2021"
description = "The service crate for the cydonia network."

[dependencies]
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
13 changes: 13 additions & 0 deletions crates/service/codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "service-codegen"
version = "0.0.0"
edition = "2021"

[lib]
proc-macro = true

[dependencies]
syn.workspace = true
proc-macro2.workspace = true
quote.workspace = true
paste.workspace = true
64 changes: 64 additions & 0 deletions crates/service/codegen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//! Derive macros for the service crate

use proc_macro::TokenStream;
use syn::parse_macro_input;
use tool::ServiceImpl;

mod tool;

/// Generate tools for the service crate, for example
///
/// ```rust
/// #[cydonia_service::service]
/// impl MyService {
/// /// My function
/// fn my_function(
/// // The first number
/// a: u64,
/// // The second number
/// b: u64,
/// ) -> u64 {
/// // ...
/// }
/// }
/// ```
///
/// generates
///
/// ```rust
/// impl MyService {
/// // My function
/// fn my_function(
/// // The first number
/// a: u64,
/// // The second number
/// b: u64,
/// ) -> u64 {
/// // ...
/// }
///
/// fn tools() -> Vec<Function> {
/// vec![Function {
/// name: "my_function".to_string(),
/// description: "My function".to_string(),
/// arguments: vec![
/// Argument {
/// name: "a".to_string(),
/// description: "The first number".to_string(),
/// type: "uint64".to_string(),
/// },
/// Argument {
/// name: "b".to_string(),
/// description: "The second number".to_string(),
/// type: "uint64".to_string(),
/// },
/// ],
/// }]
/// }
/// }
/// ```
#[proc_macro_attribute]
pub fn service(_: TokenStream, item: TokenStream) -> TokenStream {
let service_impl = parse_macro_input!(item as ServiceImpl);
service_impl.into_token_stream()
}
Loading
Loading