Skip to content
Merged
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
65 changes: 57 additions & 8 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ nostr-sdk = "0.38.0"
nostr = "0.38.0"
chrono = { version = "0.4.41", features = ["serde"] }
tokio_with_wasm = { version = "0.8.5", features = ["rt"] }

# Released Amico crates
amico-core = "1.0.2"
amico-sdk = "1.0.0"

# Dev releases
amico-hal = { version = "0.0.2", default-features = false }
2 changes: 1 addition & 1 deletion amico-hal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "amico-hal"
version = "0.0.1"
version = "0.0.2"
edition = "2024"
description = "The HAL of the Amico AI Agent Framework"
repository = "https://github.com/AIMOverse/amico"
Expand Down
14 changes: 7 additions & 7 deletions amico-mods/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "amico-mods"
version = "0.0.1"
version = "0.0.3"
edition = "2024"
description = "The plugins of the Amico AI Agent Framework"
repository = "https://github.com/AIMOverse/amico"
Expand All @@ -23,11 +23,11 @@ std-cli-chatbot = []
std-audio-chatbot = ["dep:amico-hal", "amico-hal/os-common"]

# Core plugins
std-core = ["amico-core", "chrono"]
std-core = ["chrono"]

# Runtime
storage-fs = ["amico-core"]
storage-in-mem = ["amico-core"]
storage-fs = []
storage-in-mem = []

# A2A features
a2a = ["amico-sdk/a2a", "sodiumoxide", "base64"]
Expand Down Expand Up @@ -70,9 +70,9 @@ full = [
]

[dependencies]
amico-sdk = { path = "../amico-sdk", default-features = false }
amico-hal = { path = "../amico-hal", default-features = false, optional = true }
amico-core = { path = "../amico-core", default-features = false, optional = true }
amico-sdk = { workspace = true }
amico-hal = { workspace = true, optional = true }
amico-core = { workspace = true }

# Plugin-specific dependencies

Expand Down
54 changes: 54 additions & 0 deletions amico-mods/src/interface.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
use amico_core::{Agent, traits::Strategy};

/// A module is a plugin that can be applied to an agent.
pub trait Module {
/// Apply the module to an agent.
fn apply<S: Strategy>(&self, agent: &mut Agent<S>);
}

#[cfg(test)]
mod tests {
use amico_core::{
Agent,
traits::{PhantomEvent, Strategy, System},
};

use crate::Module;

struct TestSystem;

impl System for TestSystem {
fn register_to(self, mut registry: amico_core::world::HandlerRegistry) {
registry.register(|_: amico_core::ecs::Receiver<PhantomEvent>| {
println!("inside TestSystem handler");
});
}
}

struct TestStrategy;

impl Strategy for TestStrategy {
async fn deliberate(
&mut self,
_agent_event: &amico_core::types::AgentEvent,
_sender: amico_core::world::ActionSender<'_>,
) -> anyhow::Result<()> {
Ok(())
}
}

struct TestModule;

impl Module for TestModule {
fn apply<S: Strategy>(&self, agent: &mut amico_core::Agent<S>) {
println!("Applying TestModule");
agent.add_system(TestSystem);
}
}

#[tokio::test]
async fn test_build_agent_with_module() {
let mut agent = Agent::new(TestStrategy);
TestModule.apply(&mut agent);
}
}
2 changes: 0 additions & 2 deletions amico-mods/src/interface/mod.rs

This file was deleted.

54 changes: 0 additions & 54 deletions amico-mods/src/interface/plugin.rs

This file was deleted.

5 changes: 3 additions & 2 deletions amico-mods/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
pub mod interface;
pub mod plugin_manager;
pub mod runtime;
pub mod std;

Expand All @@ -11,3 +9,6 @@ pub mod a2a;

#[cfg(feature = "aoe")]
pub mod aoe;

mod interface;
pub use interface::*;
1 change: 0 additions & 1 deletion amico-mods/src/plugin_manager/loader.rs

This file was deleted.

3 changes: 0 additions & 3 deletions amico-mods/src/plugin_manager/mod.rs

This file was deleted.

10 changes: 0 additions & 10 deletions amico-mods/src/std/ai/providers/rig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use rig::{
use std::fmt::Debug;

use super::rig_helpers::*;
use crate::interface::{Plugin, PluginCategory, PluginInfo};

/// Re-export providers from rig-core
/// so that SDK users do not need to add `rig-core` as a dependency
Expand Down Expand Up @@ -94,12 +93,3 @@ impl Model for RigProvider {
provider_completion(self, &req.model, into_rig_request(req)).await
}
}

impl Plugin for RigProvider {
fn info(&self) -> &'static PluginInfo {
&PluginInfo {
name: "StdOpenAIProvider",
category: PluginCategory::Service,
}
}
}
12 changes: 1 addition & 11 deletions amico-mods/src/std/ai/services/in_memory.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::interface::{Plugin, PluginCategory, PluginInfo};
use amico::{
ai::{
completion::{Error, Model, ModelChoice, RequestBuilder, Session, SessionContext},
Expand Down Expand Up @@ -37,15 +36,6 @@ pub struct InMemoryService<M: Model + Send> {
pub history: Vec<Message>,
}

impl<M: Model + Send> Plugin for InMemoryService<M> {
fn info(&self) -> &'static PluginInfo {
&PluginInfo {
name: "StdInMemoryService",
category: PluginCategory::Service,
}
}
}

impl<M: Model + Send> Session for InMemoryService<M> {
type Model = M;

Expand Down Expand Up @@ -135,6 +125,6 @@ impl<M: Model + Send> Session for InMemoryService<M> {

impl<M: Model + Send> IntoResourceMut<InMemoryService<M>> for InMemoryService<M> {
fn into_resource_mut(self) -> ResourceMut<InMemoryService<M>> {
ResourceMut::new(self.info().name, self)
ResourceMut::new("InMemoryService", self)
}
}
4 changes: 2 additions & 2 deletions amico/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ repository = "https://github.com/AIMOverse/amico"
license = "MIT OR Apache-2.0"

[dependencies]
amico-core = { path = "../amico-core" }
amico-core = { workspace = true }
tokio = { workspace = true, features = ["full"] }
amico-sdk = { path = "../amico-sdk" }
amico-sdk = { workspace = true }
amico-mods = { path = "../amico-mods" }
serde_json = { workspace = true }
tracing = { workspace = true }
Expand Down
2 changes: 0 additions & 2 deletions amico/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::process;
use amico::ai::completion::SessionBuilder;
use amico::resource::{IntoResource, IntoResourceMut};
use amico_core::{Agent, OnFinish};
use amico_mods::interface::Plugin;
use amico_mods::runtime::storage::fs::FsStorage;
use amico_mods::std::ai::providers::rig::{RigProvider, providers};
use amico_mods::std::ai::services::InMemoryService;
Expand Down Expand Up @@ -132,7 +131,6 @@ async fn main() {
println!("{}", wallet.get().pubkey_list());

println!();
println!("Using service plugin: {}", service.info().name);
println!("Tools enabled:\n{}", service.ctx.tools.describe());

let service_resource = service.into_resource_mut();
Expand Down