Skip to content

Commit f75aaa5

Browse files
Merge pull request #73 from code0-tech/feat/enhance-rest-action
enhance rest action
2 parents f701cbe + 76d9421 commit f75aaa5

28 files changed

Lines changed: 1458 additions & 509 deletions

actions/cron-action/Cargo.lock

Lines changed: 16 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actions/cron-action/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2024"
55
publish = false
66

77
[dependencies]
8-
hercules = { git = "https://github.com/code0-tech/hercules.git", branch = "#22-primitive-rust-sdk" }
8+
hercules-sdk = { version = "1.4.4" }
99
tucana = { version = "0.0.82", default-features = false }
1010
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }
1111
tokio-stream = "0.1"

actions/cron-action/src/data_types.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! The five standard cron expression fields.
22
3-
use hercules::JsonSchema;
3+
use hercules_sdk::JsonSchema;
44
use serde::{Deserialize, Serialize};
55

6-
#[hercules::data_type(
6+
#[hercules_sdk::data_type(
77
identifier = "CRON_MINUTE",
88
name(en_US = "Cron Minute"),
99
display_message(en_US = "Cron Minute"),
@@ -18,7 +18,7 @@ pub struct CronMinute(
1818
pub String,
1919
);
2020

21-
#[hercules::data_type(
21+
#[hercules_sdk::data_type(
2222
identifier = "CRON_HOUR",
2323
name(en_US = "Cron Hour"),
2424
display_message(en_US = "Cron Hour"),
@@ -33,7 +33,7 @@ pub struct CronHour(
3333
pub String,
3434
);
3535

36-
#[hercules::data_type(
36+
#[hercules_sdk::data_type(
3737
identifier = "CRON_DAY_OF_MONTH",
3838
name(en_US = "Cron Day of Month"),
3939
display_message(en_US = "Cron Day of Month"),
@@ -48,7 +48,7 @@ pub struct CronDayOfMonth(
4848
pub String,
4949
);
5050

51-
#[hercules::data_type(
51+
#[hercules_sdk::data_type(
5252
identifier = "CRON_MONTH",
5353
name(en_US = "Cron Month"),
5454
display_message(en_US = "Cron Month"),
@@ -64,7 +64,7 @@ pub struct CronMonth(
6464
pub String,
6565
);
6666

67-
#[hercules::data_type(
67+
#[hercules_sdk::data_type(
6868
identifier = "CRON_DAY_OF_WEEK",
6969
name(en_US = "Cron Day of Week"),
7070
display_message(en_US = "Cron Day of Week"),

actions/cron-action/src/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! to this action as an `ActionFlow` with these five settings filled in per
66
//! flow.
77
8-
#[hercules::runtime_event(
8+
#[hercules_sdk::runtime_event(
99
identifier = "CRON",
1010
signature = "(cron_minute: CRON_MINUTE, cron_hour: CRON_HOUR, cron_day_of_month: CRON_DAY_OF_MONTH, cron_month: CRON_MONTH, cron_day_of_week: CRON_DAY_OF_WEEK): void",
1111
name(en_US = "Cron Job"),

actions/cron-action/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ mod data_types;
22
mod events;
33
mod schedule;
44

5-
use hercules::{Action, HerculesEvent, ScalingOption, Translation};
5+
use hercules_sdk::{Action, HerculesEvent, ScalingOption, Translation};
66
use tokio_stream::StreamExt;
77

88
fn env(key: &str, default: &str) -> String {
99
std::env::var(key).unwrap_or_else(|_| default.to_string())
1010
}
1111

1212
/// `CronMinute`/`CronHour`/... and `CronRuntimeEvent` never appear below —
13-
/// attaching `#[hercules::data_type]` / `#[hercules::runtime_event]`
13+
/// attaching `#[hercules_sdk::data_type]` / `#[hercules_sdk::runtime_event]`
1414
/// registered each of them automatically as part of `Action::new` (see
15-
/// `hercules::registration`).
15+
/// `hercules_sdk::registration`).
1616
fn build_action() -> Action {
1717
Action::new(
1818
env("HERCULES_ACTION_ID", "cron-action"),
@@ -29,7 +29,7 @@ fn build_action() -> Action {
2929
}
3030

3131
#[tokio::main]
32-
async fn main() -> hercules::Result<()> {
32+
async fn main() -> hercules_sdk::Result<()> {
3333
// Defaults to info-level logs for this action and the SDK even without
3434
// RUST_LOG set; override with e.g. RUST_LOG=hercules=debug,cron_action=debug.
3535
env_logger::Builder::from_env(

actions/cron-action/src/schedule.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::str::FromStr;
55

66
use chrono::{DateTime, Datelike, Timelike, Utc};
77
use cron::Schedule;
8-
use hercules::Connected;
9-
use hercules::wire::ActionFlow;
8+
use hercules_sdk::Connected;
9+
use hercules_sdk::wire::ActionFlow;
1010
use tucana::shared::value::Kind;
1111

1212
const TICK_EXPRESSION: &str = "0 * * * * *";

actions/mcp-action/Cargo.lock

Lines changed: 18 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actions/mcp-action/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ edition = "2024"
55
publish = false
66

77
[dependencies]
8-
hercules = { git = "https://github.com/code0-tech/hercules.git", branch = "#22-primitive-rust-sdk" }
9-
tucana = { version = "0.0.80", default-features = false }
8+
hercules-sdk = { version = "1.4.4" }
9+
tucana = { version = "0.0.82", default-features = false }
1010
rmcp = { version = "2.2.0", default-features = false, features = ["server", "transport-streamable-http-server"] }
1111
tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "sync"] }
1212
tokio-stream = "0.1"

actions/mcp-action/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod server;
22
mod tools;
33

4-
use hercules::{Action, ConfigurationDefinition, HerculesEvent, ScalingOption, Translation};
4+
use hercules_sdk::{Action, ConfigurationDefinition, HerculesEvent, ScalingOption, Translation};
55
use tokio_stream::StreamExt;
66

77
use crate::tools::TOKEN_CONFIG_ID;
@@ -35,7 +35,7 @@ fn build_action() -> Action {
3535
}
3636

3737
#[tokio::main]
38-
async fn main() -> hercules::Result<()> {
38+
async fn main() -> hercules_sdk::Result<()> {
3939
env_logger::Builder::from_env(
4040
env_logger::Env::default().default_filter_or("mcp_action=info,hercules=info"),
4141
)

actions/mcp-action/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use std::net::SocketAddr;
77
use std::sync::Arc;
88

9-
use hercules::Connected;
9+
use hercules_sdk::Connected;
1010
use hyper::server::conn::http1;
1111
use hyper_util::rt::TokioIo;
1212
use hyper_util::service::TowerToHyperService;

0 commit comments

Comments
 (0)