Skip to content

Commit 60aa4ca

Browse files
committed
Manage skills as sources over ACP
1 parent e81465c commit 60aa4ca

11 files changed

Lines changed: 827 additions & 335 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/goose-acp/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ regex = { workspace = true }
3737
fs-err = "3"
3838
strum = { workspace = true }
3939
url = { workspace = true }
40+
dirs = { workspace = true }
4041

4142
# HTTP server dependencies
4243
axum = { workspace = true, features = ["ws"] }

crates/goose-acp/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ pub use goose_sdk::custom_requests;
55
mod fs;
66
pub mod server;
77
pub mod server_factory;
8+
pub mod sources;
89
pub(crate) mod tools;
910
pub mod transport;

crates/goose-acp/src/server.rs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,6 +2904,86 @@ impl GooseAcpAgent {
29042904
.map_err(|e| sacp::Error::internal_error().data(e.to_string()))?;
29052905
Ok(EmptyResponse {})
29062906
}
2907+
2908+
#[custom_method(CreateSourceRequest)]
2909+
async fn on_create_source(
2910+
&self,
2911+
req: CreateSourceRequest,
2912+
) -> Result<CreateSourceResponse, sacp::Error> {
2913+
let source = crate::sources::create_source(
2914+
req.source_type,
2915+
&req.name,
2916+
&req.description,
2917+
&req.content,
2918+
req.global,
2919+
req.project_dir.as_deref(),
2920+
)?;
2921+
Ok(CreateSourceResponse { source })
2922+
}
2923+
2924+
#[custom_method(ListSourcesRequest)]
2925+
async fn on_list_sources(
2926+
&self,
2927+
req: ListSourcesRequest,
2928+
) -> Result<ListSourcesResponse, sacp::Error> {
2929+
let sources =
2930+
crate::sources::list_sources(req.source_type, req.project_dir.as_deref())?;
2931+
Ok(ListSourcesResponse { sources })
2932+
}
2933+
2934+
#[custom_method(UpdateSourceRequest)]
2935+
async fn on_update_source(
2936+
&self,
2937+
req: UpdateSourceRequest,
2938+
) -> Result<UpdateSourceResponse, sacp::Error> {
2939+
let source = crate::sources::update_source(
2940+
req.source_type,
2941+
&req.name,
2942+
&req.description,
2943+
&req.content,
2944+
req.global,
2945+
req.project_dir.as_deref(),
2946+
)?;
2947+
Ok(UpdateSourceResponse { source })
2948+
}
2949+
2950+
#[custom_method(DeleteSourceRequest)]
2951+
async fn on_delete_source(
2952+
&self,
2953+
req: DeleteSourceRequest,
2954+
) -> Result<EmptyResponse, sacp::Error> {
2955+
crate::sources::delete_source(
2956+
req.source_type,
2957+
&req.name,
2958+
req.global,
2959+
req.project_dir.as_deref(),
2960+
)?;
2961+
Ok(EmptyResponse {})
2962+
}
2963+
2964+
#[custom_method(ExportSourceRequest)]
2965+
async fn on_export_source(
2966+
&self,
2967+
req: ExportSourceRequest,
2968+
) -> Result<ExportSourceResponse, sacp::Error> {
2969+
let (json, filename) = crate::sources::export_source(
2970+
req.source_type,
2971+
&req.name,
2972+
req.global,
2973+
req.project_dir.as_deref(),
2974+
)?;
2975+
Ok(ExportSourceResponse { json, filename })
2976+
}
2977+
2978+
#[custom_method(ImportSourcesRequest)]
2979+
async fn on_import_sources(
2980+
&self,
2981+
req: ImportSourcesRequest,
2982+
) -> Result<ImportSourcesResponse, sacp::Error> {
2983+
let sources =
2984+
crate::sources::import_sources(&req.data, req.global, req.project_dir.as_deref())?;
2985+
Ok(ImportSourcesResponse { sources })
2986+
}
29072987
}
29082988

29092989
pub struct GooseAcpHandler {

0 commit comments

Comments
 (0)