diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3be243f..b906221 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -26,3 +26,27 @@ jobs:
- name: Run tests
run: npm run test
+ rust:
+ runs-on: ubuntu-latest
+
+ defaults:
+ run:
+ shell: bash
+ working-directory: rust
+
+ steps:
+ - uses: actions/checkout@v6
+ - name: Set up Rust
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ components: rustfmt, clippy
+ - name: Cache cargo
+ uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: rust
+ - name: Check formatting
+ run: cargo fmt --all -- --check
+ - name: Lint
+ run: cargo clippy --workspace --all-targets -- -D warnings
+ - name: Run tests
+ run: cargo test --workspace
diff --git a/README.md b/README.md
index 1590bb5..ecb7260 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,7 @@ The action sdk to connect with aquila
This action sdk is currently implemented in:
- [Typescript](./ts/README.md)
+- [Rust](./rust/README.md)
# GRPC Communcation Flow
diff --git a/docs/getting-started/introduction.mdx b/docs/getting-started/introduction.mdx
index 711c986..749f5ce 100644
--- a/docs/getting-started/introduction.mdx
+++ b/docs/getting-started/introduction.mdx
@@ -11,7 +11,7 @@ An action is a service **you** build and run. It connects to the Code0 runtime (
what functions it provides, what events it can fire, and what custom data types it understands.
Users then pick your functions and events inside the flow editor.
-Hercules is the TypeScript SDK for building actions.
+Hercules is the SDK for building actions, available for TypeScript and Rust.
## What an Action does
diff --git a/docs/tutorials/first-simple-action.mdx b/docs/tutorials/first-simple-action.mdx
index a05bb30..367b1a8 100644
--- a/docs/tutorials/first-simple-action.mdx
+++ b/docs/tutorials/first-simple-action.mdx
@@ -3,6 +3,8 @@ title: First Simple Action
description: Build a complete action with a function, event, and data type from scratch
---
+import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
+
This tutorial walks through building a complete action that:
- Exposes a `fibonacci` function
@@ -11,8 +13,11 @@ This tutorial walks through building a complete action that:
## 1. Create the RuntimeFunction
-A `RuntimeFunction` contains the actual implementation. Decorate it with `@Identifier`, `@Signature`, and `@Name`,
-then implement the `run()` method.
+A `RuntimeFunction` contains the actual implementation.
+
+
+
+Decorate it with `@Identifier`, `@Signature`, and `@Name`, then implement the `run()` method.
```ts
// src/functions/fibonacciRuntimeFunction.ts
@@ -47,11 +52,62 @@ export class FibonacciRuntimeFunction {
`@OmitRuntimeFunction()` prevents Hercules from auto-generating a public function definition from this class — we'll
define that separately below.
+
+
+Attach `#[hercules::runtime_function(...)]`, giving it an `identifier` and `signature`, then implement
+`RuntimeFunctionHandler`. Attaching the macro registers it automatically — there's no separate registration call to
+make later.
+
+```rust
+// src/functions/fibonacci_runtime_function.rs
+use hercules::{
+ async_trait, Arguments, FunctionContext, PlainValue, Result, RuntimeFunctionHandler,
+};
+
+#[hercules::runtime_function(
+ identifier = "fibonacci_runtime",
+ signature = "(test: NUMBER): NUMBER",
+ name(en_US = "Fibonacci (Runtime)"),
+ display_message(en_US = "Computes the n-th Fibonacci number"),
+ omit_definition
+)]
+#[parameter(runtime_name = "test", name(en_US = "N"))]
+pub struct FibonacciRuntimeFunction;
+
+#[async_trait]
+impl RuntimeFunctionHandler for FibonacciRuntimeFunction {
+ async fn run(&self, context: &FunctionContext, args: &Arguments) -> Result {
+ let n: u64 = args.get("test")?;
+
+ log::debug!(
+ "computing fibonacci({n}) for project={} execution={}",
+ context.project_id,
+ context.execution_id
+ );
+ Ok(fib(n).into())
+ }
+}
+
+fn fib(n: u64) -> u64 {
+ if n <= 1 {
+ n
+ } else {
+ fib(n - 1) + fib(n - 2)
+ }
+}
+```
+
+`omit_definition` prevents Hercules from auto-publishing this runtime function as its own public function — we'll
+define that separately below.
+
+
## 2. Create the Function
A `Function` extends the `RuntimeFunction` and adds public-facing metadata without changing the implementation.
+
+
```ts
// src/functions/fibonacciFunction.ts
import { Identifier, Name, Parameter } from '@code0-tech/hercules';
@@ -67,9 +123,31 @@ import { FibonacciRuntimeFunction } from './fibonacciRuntimeFunction.js';
})
export class FibonacciFunction extends FibonacciRuntimeFunction {}
```
+
+
+`#[hercules::function(base = ...)]` plays the same role as `extends` here: it points at the runtime function that
+actually executes, and carries only metadata overrides — no `run()` of its own.
+
+```rust
+// src/functions/fibonacci_function.rs
+use super::fibonacci_runtime_function::FibonacciRuntimeFunction;
+
+#[hercules::function(base = FibonacciRuntimeFunction, identifier = "fibonacci")]
+#[parameter(
+ runtime_name = "test",
+ name(en_US = "Input Number"),
+ description(en_US = "The position in the Fibonacci sequence"),
+ default_value = 10
+)]
+pub struct FibonacciFunction;
+```
+
+
## 3. Create the RuntimeEvent
+
+
```ts
// src/events/userCreatedRuntimeEvent.ts
import { Identifier, Signature, Name, EventSetting } from '@code0-tech/hercules';
@@ -85,9 +163,30 @@ import { Identifier, Signature, Name, EventSetting } from '@code0-tech/hercules'
})
export class UserCreatedRuntimeEvent {}
```
+
+
+```rust
+// src/events/user_created_runtime_event.rs
+#[hercules::runtime_event(
+ identifier = "user_created",
+ signature = "(userId: NUMBER): void",
+ name(en_US = "User Created")
+)]
+#[setting(
+ identifier = "FILTER_ROLE",
+ name(en_US = "Role Filter"),
+ description(en_US = "Only trigger for users with this role"),
+ optional
+)]
+pub struct UserCreatedRuntimeEvent;
+```
+
+
## 4. Create the Event
+
+
```ts
// src/events/userCreatedEvent.ts
import { Identifier, Name, Editable } from '@code0-tech/hercules';
@@ -98,9 +197,29 @@ import { UserCreatedRuntimeEvent } from './userCreatedRuntimeEvent.js';
@Editable(false)
export class UserCreatedEvent extends UserCreatedRuntimeEvent {}
```
+
+
+```rust
+// src/events/user_created_event.rs
+use super::user_created_runtime_event::UserCreatedRuntimeEvent;
+
+#[hercules::event(
+ base = UserCreatedRuntimeEvent,
+ identifier = "user_created_event",
+ name(en_US = "On User Created")
+)]
+pub struct UserCreatedEvent;
+```
+
+`editable` defaults to `false`, so there's nothing to set explicitly here — add the bare `editable` flag to turn it
+on.
+
+
## 5. Create the DataType
+
+
Data types are backed by a Zod schema. Decorate the class with `@Identifier`, `@Name`, and `@Schema`.
```ts
@@ -115,9 +234,28 @@ const EmailSchema = z.string().regex(/^[^@]+@[^@]+\.[^@]+$/);
@Schema(EmailSchema)
export class EmailDataType {}
```
+
+
+Data types are derived from a real Rust type's `schemars::JsonSchema` impl instead of a hand-written schema DSL —
+`schemars`' own validation attributes (`#[schemars(regex(...))]`) double as the wire validation rules.
+
+```rust
+// src/data_types/email_data_type.rs
+use hercules::JsonSchema;
+use serde::{Deserialize, Serialize};
+
+#[hercules::data_type(identifier = "email_address", name(en_US = "Email Address"))]
+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
+#[serde(transparent)]
+pub struct EmailAddress(#[schemars(regex(pattern = r"^[^@]+@[^@]+\.[^@]+$"))] pub String);
+```
+
+
## 6. Wire It All Together
+
+
```ts
// src/index.ts
import { Action, CodeZeroEvent } from '@code0-tech/hercules';
@@ -164,14 +302,86 @@ action.connect(process.env.AUTH_TOKEN ?? 'token').catch((err: unknown) => {
process.exit(1);
});
```
+
+
+Every type above already registered itself when its module got linked into the binary, so there's nothing left to
+wire up beyond building the `Action` and connecting it:
+
+```rust
+// src/main.rs
+mod data_types;
+mod events;
+mod functions;
+
+use hercules::{Action, ConfigurationDefinition, HerculesEvent, Translation};
+use tokio_stream::StreamExt;
+
+fn env(key: &str, default: &str) -> String {
+ std::env::var(key).unwrap_or_else(|_| default.to_string())
+}
+
+fn build_action() -> Action {
+ Action::new(env("ACTION_ID", "example-action"), env("VERSION", "0.0.0"))
+ .aquila_url(env("AQUILA_URL", "127.0.0.1:8081"))
+ .author("my-org")
+ .icon("tabler:bolt")
+ .documentation("A simple example action")
+ .name([Translation::new("en-US", "Example Action")])
+ .configuration(
+ ConfigurationDefinition::new("EXAMPLE_CONFIG", "string")
+ .name([Translation::new("en-US", "Example Config")]),
+ )
+}
+
+#[tokio::main]
+async fn main() -> hercules::Result<()> {
+ let action = build_action();
+ let mut events = action.subscribe();
+
+ // The returned `Connected` handle can be discarded immediately: the
+ // background dispatch task (started inside `connect`) holds its own
+ // `Arc` to the shared connection state.
+ action
+ .connect(env("AUTH_TOKEN", "token"), None)
+ .await
+ .unwrap_or_else(|err| panic!("failed to connect to Aquila: {err}"));
+
+ // React to connection lifecycle events on the main task for as long as
+ // the process runs. Panicking here (unlike inside a spawned task) takes
+ // the whole process down on an unrecoverable stream error.
+ while let Some(event) = events.next().await {
+ match event {
+ HerculesEvent::Connected => log::info!("connected to Aquila"),
+ HerculesEvent::Error(error) => panic!("Aquila stream error: {error}"),
+ _ => {}
+ }
+ }
+
+ Ok(())
+}
+```
+
+
## Firing an Event
To fire the `user_created` event from within your action (e.g. after a webhook call):
+
+
```ts
await action.fire(UserCreatedRuntimeEvent, projectId, { userId: 42 });
```
The second argument is the project ID this event belongs to, and the third is the payload matching the event's
signature.
+
+
+```rust
+action.fire("user_created", project_id, serde_json::json!({ "userId": 42 }))?;
+```
+
+The second argument is the project ID this event belongs to, and the third is the payload matching the event's
+signature.
+
+
diff --git a/rust/.gitignore b/rust/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/rust/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
new file mode 100644
index 0000000..bddb385
--- /dev/null
+++ b/rust/Cargo.lock
@@ -0,0 +1,1362 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 4
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "anstream"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
+
+[[package]]
+name = "anstyle-parse"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
+dependencies = [
+ "anstyle",
+ "once_cell_polyfill",
+ "windows-sys",
+]
+
+[[package]]
+name = "anyhow"
+version = "1.0.104"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
+
+[[package]]
+name = "async-trait"
+version = "0.1.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae36dc4177970ef04fde5178d3e2429882def40e57a451f919c098f72baa6cec"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.2",
+]
+
+[[package]]
+name = "atomic-waker"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+
+[[package]]
+name = "autocfg"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
+
+[[package]]
+name = "axum"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90"
+dependencies = [
+ "axum-core",
+ "bytes",
+ "futures-util",
+ "http",
+ "http-body",
+ "http-body-util",
+ "itoa",
+ "matchit",
+ "memchr",
+ "mime",
+ "percent-encoding",
+ "pin-project-lite",
+ "serde_core",
+ "sync_wrapper",
+ "tower",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "axum-core"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "http-body-util",
+ "mime",
+ "pin-project-lite",
+ "sync_wrapper",
+ "tower-layer",
+ "tower-service",
+]
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "bitflags"
+version = "2.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
+
+[[package]]
+name = "bytes"
+version = "1.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
+
+[[package]]
+name = "chrono"
+version = "0.4.45"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "colorchoice"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
+
+[[package]]
+name = "defmt"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2953bfe4f93bbd20cc71198842756f77d161884c99ebbabc41d80231ded88d1"
+dependencies = [
+ "bitflags 1.3.2",
+ "defmt-macros",
+]
+
+[[package]]
+name = "defmt-macros"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bad9c72e7ca2137e0dc3813245a0d282fd6daad32fd800af018306a9169b5fe8"
+dependencies = [
+ "defmt-parser",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "defmt-parser"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e"
+dependencies = [
+ "thiserror",
+]
+
+[[package]]
+name = "dyn-clone"
+version = "1.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
+
+[[package]]
+name = "either"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
+
+[[package]]
+name = "env_filter"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "900d271a03799a1ee8d1ca9b19893b48ca674a9284fefcfb85f05e74ed314217"
+dependencies = [
+ "log",
+ "regex",
+]
+
+[[package]]
+name = "env_logger"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de671bd27a75a797dc9ae289ba1e77276e75e2026408aab65185384e2d5cd3f6"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "env_filter",
+ "jiff",
+ "log",
+]
+
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
+[[package]]
+name = "errno"
+version = "0.3.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "fastrand"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
+
+[[package]]
+name = "fixedbitset"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
+
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
+[[package]]
+name = "foldhash"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
+
+[[package]]
+name = "futures-channel"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "262590f4fe6afeb0bc83be1daa64e52657fe185690a958af7f3ad0e92085c5ae"
+dependencies = [
+ "futures-core",
+]
+
+[[package]]
+name = "futures-core"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"
+
+[[package]]
+name = "futures-sink"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307"
+
+[[package]]
+name = "futures-task"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"
+
+[[package]]
+name = "futures-util"
+version = "0.3.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "pin-project-lite",
+ "slab",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi",
+]
+
+[[package]]
+name = "h2"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.15.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
+dependencies = [
+ "foldhash",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+
+[[package]]
+name = "heck"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+
+[[package]]
+name = "hercules"
+version = "0.0.0"
+dependencies = [
+ "async-trait",
+ "hercules-macros",
+ "inventory",
+ "log",
+ "schemars",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "tokio",
+ "tokio-stream",
+ "tonic",
+ "tucana",
+]
+
+[[package]]
+name = "hercules-macros"
+version = "0.0.0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "http"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425"
+dependencies = [
+ "bytes",
+ "itoa",
+]
+
+[[package]]
+name = "http-body"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"
+dependencies = [
+ "bytes",
+ "http",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9f41fd6a08e4d4ec69df65976da761afd5ad5e58a9d4acb46bd1c953a9e3ff2"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "http",
+ "http-body",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "httparse"
+version = "1.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
+
+[[package]]
+name = "httpdate"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
+
+[[package]]
+name = "hyper"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "futures-channel",
+ "futures-core",
+ "h2",
+ "http",
+ "http-body",
+ "httparse",
+ "httpdate",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+ "want",
+]
+
+[[package]]
+name = "hyper-timeout"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
+dependencies = [
+ "hyper",
+ "hyper-util",
+ "pin-project-lite",
+ "tokio",
+ "tower-service",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
+dependencies = [
+ "bytes",
+ "futures-channel",
+ "futures-util",
+ "http",
+ "http-body",
+ "hyper",
+ "libc",
+ "pin-project-lite",
+ "socket2",
+ "tokio",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.17.1",
+]
+
+[[package]]
+name = "inventory"
+version = "0.3.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4f0c30c76f2f4ccee3fe55a2435f691ca00c0e4bd87abe4f4a851b1d4dac39b"
+dependencies = [
+ "rustversion",
+]
+
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
+
+[[package]]
+name = "itertools"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
+
+[[package]]
+name = "jiff"
+version = "0.2.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e184d09547b80eb7e20d141ba2fb1fbac843ca53f4cf1b31210adc4c1adc6e16"
+dependencies = [
+ "defmt",
+ "jiff-core",
+ "jiff-static",
+ "log",
+ "portable-atomic",
+ "portable-atomic-util",
+ "serde_core",
+]
+
+[[package]]
+name = "jiff-core"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7feca88439efe53da3754500c1851dedf3cb36c524dd5cf8225cc0794de95d09"
+dependencies = [
+ "defmt",
+]
+
+[[package]]
+name = "jiff-static"
+version = "0.2.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "323da076b7a6faf914dc677cb05a4b907742ff7375c8322c9e7f5061e5e0e9de"
+dependencies = [
+ "jiff-core",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.188"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22053b6a34f84abc97f9129e61334f40174659a1b9bd18c970b83db6a9a6348b"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
+
+[[package]]
+name = "log"
+version = "0.4.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
+
+[[package]]
+name = "matchit"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
+
+[[package]]
+name = "memchr"
+version = "2.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
+
+[[package]]
+name = "mime"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
+
+[[package]]
+name = "mio"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys",
+]
+
+[[package]]
+name = "multimap"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084"
+
+[[package]]
+name = "num-traits"
+version = "0.2.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
+
+[[package]]
+name = "once_cell_polyfill"
+version = "1.70.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
+
+[[package]]
+name = "pbjson"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8edd1efdd8ab23ba9cb9ace3d9987a72663d5d7c9f74fa00b51d6213645cf6c"
+dependencies = [
+ "base64",
+ "serde",
+]
+
+[[package]]
+name = "pbjson-build"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ed4d5c6ae95e08ac768883c8401cf0e8deb4e6e1d6a4e1fd3d2ec4f0ec63200"
+dependencies = [
+ "heck",
+ "itertools",
+ "prost",
+ "prost-types",
+]
+
+[[package]]
+name = "pbjson-types"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a14e2757d877c0f607a82ce1b8560e224370f159d66c5d52eb55ea187ef0350e"
+dependencies = [
+ "bytes",
+ "chrono",
+ "pbjson",
+ "pbjson-build",
+ "prost",
+ "prost-build",
+ "serde",
+]
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
+
+[[package]]
+name = "petgraph"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
+dependencies = [
+ "fixedbitset",
+ "hashbrown 0.15.5",
+ "indexmap",
+]
+
+[[package]]
+name = "pin-project"
+version = "1.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924"
+dependencies = [
+ "pin-project-internal",
+]
+
+[[package]]
+name = "pin-project-internal"
+version = "1.1.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
+
+[[package]]
+name = "portable-atomic"
+version = "1.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3"
+
+[[package]]
+name = "portable-atomic-util"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"
+dependencies = [
+ "portable-atomic",
+]
+
+[[package]]
+name = "prettyplease"
+version = "0.2.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
+dependencies = [
+ "proc-macro2",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.107"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "prost"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1"
+dependencies = [
+ "bytes",
+ "prost-derive",
+]
+
+[[package]]
+name = "prost-build"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03da047801ff44bb6a4d407d4860c05fd70bb81714e6b2f3812603d5b145b042"
+dependencies = [
+ "heck",
+ "itertools",
+ "log",
+ "multimap",
+ "petgraph",
+ "prettyplease",
+ "prost",
+ "prost-types",
+ "pulldown-cmark",
+ "pulldown-cmark-to-cmark",
+ "regex",
+ "syn 2.0.119",
+ "tempfile",
+]
+
+[[package]]
+name = "prost-derive"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf"
+dependencies = [
+ "anyhow",
+ "itertools",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "prost-types"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f94967dc7688f3054c7fac87473ffae4cc4c3904800e2d9f5b857246d8963b0a"
+dependencies = [
+ "prost",
+]
+
+[[package]]
+name = "pulldown-cmark"
+version = "0.13.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e"
+dependencies = [
+ "bitflags 2.13.1",
+ "memchr",
+ "unicase",
+]
+
+[[package]]
+name = "pulldown-cmark-to-cmark"
+version = "22.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90"
+dependencies = [
+ "pulldown-cmark",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.47"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
+name = "ref-cast"
+version = "1.0.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "216e8f773d7923bcba9ceb86a86c93cabb3903a11872fc3f138c49630e50b96d"
+dependencies = [
+ "ref-cast-impl",
+]
+
+[[package]]
+name = "ref-cast-impl"
+version = "1.0.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c9283685feec7d69af75fb0e858d5e7378f33fe4fc699383b2916ab9273e03c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.2",
+]
+
+[[package]]
+name = "regex"
+version = "1.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
+
+[[package]]
+name = "rustix"
+version = "1.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
+dependencies = [
+ "bitflags 2.13.1",
+ "errno",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys",
+]
+
+[[package]]
+name = "rustversion"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
+
+[[package]]
+name = "schemars"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc"
+dependencies = [
+ "dyn-clone",
+ "ref-cast",
+ "schemars_derive",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "schemars_derive"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "serde_derive_internals",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
+dependencies = [
+ "serde_core",
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_core"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.229"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.2",
+]
+
+[[package]]
+name = "serde_derive_internals"
+version = "0.29.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.151"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
+dependencies = [
+ "indexmap",
+ "itoa",
+ "memchr",
+ "serde",
+ "serde_core",
+ "zmij",
+]
+
+[[package]]
+name = "simple-example-rs"
+version = "0.0.0"
+dependencies = [
+ "env_logger",
+ "hercules",
+ "log",
+ "schemars",
+ "serde",
+ "serde_json",
+ "tokio",
+ "tokio-stream",
+ "tucana",
+]
+
+[[package]]
+name = "slab"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
+
+[[package]]
+name = "smallvec"
+version = "1.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
+
+[[package]]
+name = "socket2"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.119"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "syn"
+version = "3.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a207d6d6a2b7fc470b80443726053f18a2481b7e1eee970597051596567987a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+
+[[package]]
+name = "tempfile"
+version = "3.27.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
+dependencies = [
+ "fastrand",
+ "getrandom",
+ "once_cell",
+ "rustix",
+ "windows-sys",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.2",
+]
+
+[[package]]
+name = "tokio"
+version = "1.53.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "pin-project-lite",
+ "socket2",
+ "tokio-macros",
+ "windows-sys",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6328af13490e73a9b4694030fafd93f8c8c6a9dede33e821c3fc63eddf8042ba"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "tokio-stream"
+version = "0.1.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70"
+dependencies = [
+ "futures-core",
+ "pin-project-lite",
+ "tokio",
+ "tokio-util",
+]
+
+[[package]]
+name = "tokio-util"
+version = "0.7.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "libc",
+ "pin-project-lite",
+ "tokio",
+]
+
+[[package]]
+name = "tonic"
+version = "0.14.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef"
+dependencies = [
+ "async-trait",
+ "axum",
+ "base64",
+ "bytes",
+ "h2",
+ "http",
+ "http-body",
+ "http-body-util",
+ "hyper",
+ "hyper-timeout",
+ "hyper-util",
+ "percent-encoding",
+ "pin-project",
+ "socket2",
+ "sync_wrapper",
+ "tokio",
+ "tokio-stream",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "tonic-build"
+version = "0.14.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c68f61875ac5293cf72e6c8cf0158086428c82c37229e98c840878f1706b0322"
+dependencies = [
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "tonic-prost"
+version = "0.14.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "50849f68853be452acf590cde0b146665b8d507b3b8af17261df47e02c209ea0"
+dependencies = [
+ "bytes",
+ "prost",
+ "tonic",
+]
+
+[[package]]
+name = "tonic-prost-build"
+version = "0.14.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "654e5643eff75d7f8c99197ce1440ed19a3474eada74c12bbac488b2cafdae27"
+dependencies = [
+ "prettyplease",
+ "proc-macro2",
+ "prost-build",
+ "prost-types",
+ "quote",
+ "syn 2.0.119",
+ "tempfile",
+ "tonic-build",
+]
+
+[[package]]
+name = "tower"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
+dependencies = [
+ "futures-core",
+ "futures-util",
+ "indexmap",
+ "pin-project-lite",
+ "slab",
+ "sync_wrapper",
+ "tokio",
+ "tokio-util",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+]
+
+[[package]]
+name = "tower-layer"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
+
+[[package]]
+name = "tower-service"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
+
+[[package]]
+name = "tracing"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
+dependencies = [
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-attributes"
+version = "0.1.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.119",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
+dependencies = [
+ "once_cell",
+]
+
+[[package]]
+name = "try-lock"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
+
+[[package]]
+name = "tucana"
+version = "0.0.76"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "473db4c6dff2f83d8275b92abe90873a5e68b5ca5cf02e2aa0154fdd69bc925a"
+dependencies = [
+ "pbjson",
+ "pbjson-build",
+ "pbjson-types",
+ "prost",
+ "prost-build",
+ "prost-types",
+ "serde",
+ "serde_json",
+ "tonic",
+ "tonic-build",
+ "tonic-prost",
+ "tonic-prost-build",
+]
+
+[[package]]
+name = "unicase"
+version = "2.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+
+[[package]]
+name = "want"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
+dependencies = [
+ "try-lock",
+]
+
+[[package]]
+name = "wasi"
+version = "0.11.1+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
+
+[[package]]
+name = "windows-link"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
+
+[[package]]
+name = "windows-sys"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
+dependencies = [
+ "windows-link",
+]
+
+[[package]]
+name = "zmij"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
new file mode 100644
index 0000000..359566e
--- /dev/null
+++ b/rust/Cargo.toml
@@ -0,0 +1,31 @@
+[workspace]
+resolver = "2"
+members = [
+ "hercules",
+ "hercules-macros",
+ "examples/simple-example-rs",
+]
+
+[workspace.package]
+version = "0.0.0"
+edition = "2021"
+license = "ISC"
+repository = "https://github.com/code0-tech/hercules"
+
+[workspace.dependencies]
+# Published from https://github.com/code0-tech/tucana (build/rust) — the same proto
+# definitions the TS SDK consumes as `@code0-tech/tucana` from npm.
+tucana = { version = "0.0.76", default-features = false, features = ["aquila"] }
+tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time"] }
+tonic = "0.14"
+async-trait = "0.1"
+thiserror = "2"
+serde = { version = "1", features = ["derive"] }
+# preserve_order: DataType field order in the generated wire `type` string
+# must match the struct's declaration order, the same way Zod's object types
+# preserve declaration order — see hercules::data_type.
+serde_json = { version = "1", features = ["preserve_order"] }
+schemars = "1"
+log = "0.4"
+inventory = "0.3"
+tokio-stream = { version = "0.1", features = ["sync"] }
diff --git a/rust/README.md b/rust/README.md
new file mode 100644
index 0000000..336a76b
--- /dev/null
+++ b/rust/README.md
@@ -0,0 +1,119 @@
+# hercules
+
+Rust SDK for building Hercules actions that connect to Aquila. An action
+registers the functions it exposes, the events it can fire, and any custom
+data types it needs, then talks to Aquila over a persistent gRPC stream.
+
+Depends on the [`tucana`](https://crates.io/crates/tucana) crate for the
+underlying protobuf types.
+
+**Not yet included:** the `definitions/` standard library (the ~150
+`std::*` function/data-type declarations) and an equivalent of the `hercules
+export` CLI. Both are independent of the core framework and can be added
+later.
+
+## Installation
+
+Not yet published to crates.io — until then, link it locally by path:
+
+```toml
+[dependencies]
+hercules = { path = "../hercules" }
+```
+
+## Quick start
+
+Attach `#[hercules::runtime_function]` to a struct and implement
+`RuntimeFunctionHandler` — that's enough to register it, no separate call
+required:
+
+```rust
+use hercules::{Arguments, FunctionContext, PlainValue, Result, RuntimeFunctionHandler, async_trait};
+
+#[hercules::runtime_function(identifier = "add", signature = "(a: NUMBER, b: NUMBER): NUMBER")]
+struct Add;
+
+#[async_trait]
+impl RuntimeFunctionHandler for Add {
+ async fn run(&self, _ctx: &FunctionContext, args: &Arguments) -> Result {
+ let a: f64 = args.get("a")?;
+ let b: f64 = args.get("b")?;
+ Ok((a + b).into())
+ }
+}
+
+#[tokio::main]
+async fn main() -> Result<()> {
+ let action = hercules::Action::new("my-action", "0.1.0").aquila_url("127.0.0.1:8081");
+
+ let action = action.connect("token", None).await?;
+ std::future::pending::<()>().await; // keep dispatching execution requests
+ # let _ = action;
+ Ok(())
+}
+```
+
+Only `identifier` and `version` are required on `Action::new` — `author`,
+`icon`, `documentation`, `name`, and `configuration` are optional chained
+setters.
+
+See [`examples/simple-example-rs`](./examples/simple-example-rs) for a
+runnable action exercising every registration kind: a runtime function, its
+public variant, a data type, and a runtime event.
+
+```bash
+cd examples/simple-example-rs
+cp .env.example .env && set -a && source .env && set +a
+cargo run
+```
+
+## Public vs. runtime functions
+
+A `RuntimeFunction` holds the actual implementation. A `Function` is an
+optional, separately-identified public variant of it — same execution
+behavior, its own metadata (identifier, parameter defaults, ...). Use
+`#[hercules::function(base = ...)]` when you want to expose a runtime
+function under different public-facing metadata without duplicating logic:
+
+```rust
+#[hercules::function(base = Add, identifier = "sum")]
+#[parameter(runtime_name = "a", default_value = 0)]
+struct Sum;
+```
+
+Events follow the same pattern: `#[hercules::runtime_event]` for the
+internal definition, `#[hercules::event(base = ...)]` for a public,
+user-facing variant.
+
+## Data types
+
+Data types are derived from a Rust type's `schemars::JsonSchema` impl
+instead of a hand-written schema DSL — `schemars`' own validation attributes
+double as the wire validation rules:
+
+```rust
+use hercules::JsonSchema;
+use serde::{Deserialize, Serialize};
+
+#[hercules::data_type(identifier = "email_address", name(en_US = "Email Address"))]
+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
+#[serde(transparent)]
+pub struct EmailAddress(#[schemars(regex(pattern = r"^[^@]+@[^@]+\.[^@]+$"))] pub String);
+```
+
+## Firing events
+
+```rust
+action.fire("user_created", project_id, serde_json::json!({ "userId": 42 }))?;
+```
+
+The second argument is the project ID the event belongs to; the third is
+the payload matching the event's signature.
+
+## Testing without a live Aquila
+
+`Action::build_module()` returns the wire `Module` without connecting, so
+registration logic (macro-generated metadata, `Function`/`Event` merging,
+data type schema resolution) can be unit tested directly — see
+[`examples/simple-example-rs/src/main.rs`](./examples/simple-example-rs/src/main.rs)'s
+`tests` module for a working example.
diff --git a/rust/examples/simple-example-rs/.env.example b/rust/examples/simple-example-rs/.env.example
new file mode 100644
index 0000000..745e25f
--- /dev/null
+++ b/rust/examples/simple-example-rs/.env.example
@@ -0,0 +1,4 @@
+ACTION_ID=example-action
+VERSION=0.0.0
+AQUILA_URL=127.0.0.1:8081
+AUTH_TOKEN=token
diff --git a/rust/examples/simple-example-rs/Cargo.toml b/rust/examples/simple-example-rs/Cargo.toml
new file mode 100644
index 0000000..72cdddc
--- /dev/null
+++ b/rust/examples/simple-example-rs/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "simple-example-rs"
+version = "0.0.0"
+edition = "2021"
+publish = false
+
+[dependencies]
+hercules = { path = "../../hercules" }
+tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
+tokio-stream.workspace = true
+serde = { workspace = true }
+serde_json.workspace = true
+schemars.workspace = true
+log.workspace = true
+env_logger = "0.11"
+
+[dev-dependencies]
+tucana.workspace = true
diff --git a/rust/examples/simple-example-rs/src/data_types/email_data_type.rs b/rust/examples/simple-example-rs/src/data_types/email_data_type.rs
new file mode 100644
index 0000000..27e6945
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/data_types/email_data_type.rs
@@ -0,0 +1,11 @@
+use hercules::JsonSchema;
+use serde::{Deserialize, Serialize};
+
+/// A data type derived from a real Rust type instead of a hand-written
+/// schema DSL: `#[derive(JsonSchema)]` gives us the structural type
+/// (`"string"`), and `#[schemars(regex(...))]` gives us the validation rule
+/// Aquila enforces on top of it.
+#[hercules::data_type(identifier = "email_address", name(en_US = "Email Address"))]
+#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
+#[serde(transparent)]
+pub struct EmailAddress(#[schemars(regex(pattern = r"^[^@]+@[^@]+\.[^@]+$"))] pub String);
diff --git a/rust/examples/simple-example-rs/src/data_types/mod.rs b/rust/examples/simple-example-rs/src/data_types/mod.rs
new file mode 100644
index 0000000..c5671ad
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/data_types/mod.rs
@@ -0,0 +1 @@
+pub mod email_data_type;
diff --git a/rust/examples/simple-example-rs/src/events/mod.rs b/rust/examples/simple-example-rs/src/events/mod.rs
new file mode 100644
index 0000000..1335f7d
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/events/mod.rs
@@ -0,0 +1 @@
+pub mod user_created_runtime_event;
diff --git a/rust/examples/simple-example-rs/src/events/user_created_runtime_event.rs b/rust/examples/simple-example-rs/src/events/user_created_runtime_event.rs
new file mode 100644
index 0000000..a1ec2ed
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/events/user_created_runtime_event.rs
@@ -0,0 +1,10 @@
+#[hercules::runtime_event(
+ identifier = "user_created",
+ signature = "(): { userId: NUMBER }",
+ name(en_US = "User created event"),
+ display_message(en_US = "Triggers on user creation"),
+ description(
+ en_US = "Triggers on user creation and has a payload including the user database id"
+ )
+)]
+pub struct UserCreatedRuntimeEvent;
diff --git a/rust/examples/simple-example-rs/src/functions/fibonacci_function.rs b/rust/examples/simple-example-rs/src/functions/fibonacci_function.rs
new file mode 100644
index 0000000..8fb9202
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/functions/fibonacci_function.rs
@@ -0,0 +1,14 @@
+use super::fibonacci_runtime_function::FibonacciRuntimeFunction;
+
+/// The public, user-facing variant of [`FibonacciRuntimeFunction`]: same
+/// execution behavior, its own identifier and a default input value.
+/// Execution always dispatches through the runtime function — this struct
+/// carries no `run()` of its own, only metadata overrides.
+#[hercules::function(base = FibonacciRuntimeFunction, identifier = "fibonacci")]
+#[parameter(
+ runtime_name = "test",
+ name(en_US = "Input Number"),
+ description(en_US = "The position in the Fibonacci sequence"),
+ default_value = 10
+)]
+pub struct FibonacciFunction;
diff --git a/rust/examples/simple-example-rs/src/functions/fibonacci_runtime_function.rs b/rust/examples/simple-example-rs/src/functions/fibonacci_runtime_function.rs
new file mode 100644
index 0000000..95b997b
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/functions/fibonacci_runtime_function.rs
@@ -0,0 +1,37 @@
+use hercules::{
+ async_trait, Arguments, FunctionContext, PlainValue, Result, RuntimeFunctionHandler,
+};
+
+#[hercules::runtime_function(
+ identifier = "fibonacci_runtime",
+ signature = "(test: NUMBER): NUMBER",
+ name(en_US = "Fibonacci (Runtime)"),
+ display_message(en_US = "Computes the n-th Fibonacci number"),
+ omit_definition
+)]
+#[parameter(runtime_name = "test", name(en_US = "N"))]
+pub struct FibonacciRuntimeFunction;
+
+#[async_trait]
+impl RuntimeFunctionHandler for FibonacciRuntimeFunction {
+ async fn run(&self, context: &FunctionContext, args: &Arguments) -> Result {
+ // Missing or malformed, `args.get` reports it back to Aquila as a
+ // runtime error on its own — nothing to check by hand here.
+ let n: u64 = args.get("test")?;
+
+ log::debug!(
+ "computing fibonacci({n}) for project={} execution={}",
+ context.project_id,
+ context.execution_id
+ );
+ Ok(fib(n).into())
+ }
+}
+
+fn fib(n: u64) -> u64 {
+ if n <= 1 {
+ n
+ } else {
+ fib(n - 1) + fib(n - 2)
+ }
+}
diff --git a/rust/examples/simple-example-rs/src/functions/mod.rs b/rust/examples/simple-example-rs/src/functions/mod.rs
new file mode 100644
index 0000000..e1f67dd
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/functions/mod.rs
@@ -0,0 +1,2 @@
+pub mod fibonacci_function;
+pub mod fibonacci_runtime_function;
diff --git a/rust/examples/simple-example-rs/src/main.rs b/rust/examples/simple-example-rs/src/main.rs
new file mode 100644
index 0000000..603614c
--- /dev/null
+++ b/rust/examples/simple-example-rs/src/main.rs
@@ -0,0 +1,119 @@
+mod data_types;
+mod events;
+mod functions;
+
+use hercules::{Action, ConfigurationDefinition, HerculesEvent, Translation};
+use tokio_stream::StreamExt;
+
+fn env(key: &str, default: &str) -> String {
+ std::env::var(key).unwrap_or_else(|_| default.to_string())
+}
+
+/// `FibonacciRuntimeFunction`, `FibonacciFunction`, `EmailAddress` and
+/// `UserCreatedRuntimeEvent` never appear below — attaching
+/// `#[hercules::runtime_function]` / `function` / `data_type` /
+/// `runtime_event` registered each of them automatically as part of
+/// `Action::new` (see `hercules::registration`). There's simply nothing left
+/// to wire up by hand for this example.
+fn build_action() -> Action {
+ Action::new(env("ACTION_ID", "example-action"), env("VERSION", "0.0.0"))
+ .aquila_url(env("AQUILA_URL", "127.0.0.1:8081"))
+ .author("code0-tech")
+ .icon("tabler:bolt")
+ .documentation("A simple example action")
+ .name([Translation::new("en-US", "Example Action")])
+ .configuration(
+ ConfigurationDefinition::new("EXAMPLE_CONFIG", "string")
+ .name([Translation::new("en-US", "Example Config")]),
+ )
+}
+
+#[tokio::main]
+async fn main() -> hercules::Result<()> {
+ // RUST_LOG=hercules=debug,simple_example_rs=debug cargo run
+ env_logger::init();
+
+ let action = build_action();
+ let mut events = action.subscribe();
+
+ // The returned `Connected` handle can be discarded immediately: the
+ // background dispatch task (started inside `connect`) holds its own
+ // `Arc` to the shared connection state, so nothing here needs to keep
+ // it alive.
+ action
+ .connect(env("AUTH_TOKEN", "token"), None)
+ .await
+ .unwrap_or_else(|err| panic!("failed to connect to Aquila: {err}"));
+
+ // React to connection lifecycle events on the main task for as long as
+ // the process runs. Panicking here (unlike inside a spawned task) takes
+ // the whole process down on an unrecoverable stream error.
+ while let Some(event) = events.next().await {
+ match event {
+ HerculesEvent::Connected => log::info!("connected to Aquila"),
+ HerculesEvent::Error(error) => panic!("Aquila stream error: {error}"),
+ _ => {}
+ }
+ }
+
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use hercules::wire::Module;
+
+ use super::build_action;
+
+ /// Exercises the real registration path end to end — link-time
+ /// `inventory` auto-registration, `Function`/`RuntimeFunction` merging,
+ /// and `schemars`-driven data type resolution — by building the wire
+ /// `Module` without connecting.
+ #[test]
+ fn builds_a_well_formed_module() {
+ let module: Module = build_action().build_module();
+
+ assert_eq!(module.identifier, "example-action");
+
+ let email = module
+ .definition_data_types
+ .iter()
+ .find(|dt| dt.identifier == "email_address")
+ .expect("email_address data type");
+ assert_eq!(email.r#type, "string");
+ assert!(matches!(
+ email.rules.first().and_then(|r| r.config.clone()),
+ Some(tucana::shared::definition_data_type_rule::Config::Regex(_))
+ ));
+
+ let fibonacci = module
+ .function_definitions
+ .iter()
+ .find(|f| f.runtime_name == "fibonacci")
+ .expect("fibonacci function");
+ assert_eq!(fibonacci.runtime_definition_name, "fibonacci_runtime");
+ let param = &fibonacci.parameter_definitions[0];
+ assert_eq!(param.runtime_name, "test");
+ assert_eq!(
+ param.default_value.as_ref().and_then(|v| v.kind.clone()),
+ Some(tucana::shared::value::Kind::NumberValue(
+ tucana::shared::NumberValue {
+ number: Some(tucana::shared::number_value::Number::Integer(10))
+ }
+ ))
+ );
+
+ // omit_definition on the runtime function means it isn't separately
+ // published under its own identifier.
+ assert!(module
+ .function_definitions
+ .iter()
+ .all(|f| f.runtime_name != "fibonacci_runtime"));
+ assert_eq!(
+ module.runtime_function_definitions[0].runtime_name,
+ "fibonacci_runtime"
+ );
+
+ assert_eq!(module.runtime_flow_types[0].identifier, "user_created");
+ }
+}
diff --git a/rust/hercules-macros/Cargo.toml b/rust/hercules-macros/Cargo.toml
new file mode 100644
index 0000000..d0b9c6e
--- /dev/null
+++ b/rust/hercules-macros/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "hercules-macros"
+description = "Attribute macros for the hercules action SDK"
+version.workspace = true
+edition.workspace = true
+license.workspace = true
+repository.workspace = true
+
+[lib]
+proc-macro = true
+
+[dependencies]
+syn = { version = "2", features = ["full", "extra-traits"] }
+quote = "1"
+proc-macro2 = "1"
diff --git a/rust/hercules-macros/src/data_type.rs b/rust/hercules-macros/src/data_type.rs
new file mode 100644
index 0000000..e7d654e
--- /dev/null
+++ b/rust/hercules-macros/src/data_type.rs
@@ -0,0 +1,41 @@
+use proc_macro2::TokenStream;
+use quote::quote;
+use syn::ItemStruct;
+
+use crate::parse::{hercules_path, translation_vec, AttrArgs};
+
+pub fn expand(attr: TokenStream, item: TokenStream) -> syn::Result {
+ let item_struct: ItemStruct = syn::parse2(item)?;
+ let args = AttrArgs::parse(attr)?;
+ let hercules = hercules_path();
+
+ let identifier = args.required_string("identifier")?;
+ let name = translation_vec(&args.translations("name")?, &hercules);
+ let display_message = translation_vec(&args.translations("display_message")?, &hercules);
+ let alias = translation_vec(&args.translations("alias")?, &hercules);
+ let generic_keys: Vec = args.string_list("generic_keys")?;
+
+ let ident = &item_struct.ident;
+ Ok(quote! {
+ #item_struct
+
+ impl #hercules::DataType for #ident {
+ fn meta() -> #hercules::DataTypeMeta {
+ #hercules::DataTypeMeta {
+ identifier: #identifier.to_string(),
+ name: #name,
+ display_message: #display_message,
+ alias: #alias,
+ generic_keys: vec![#(#generic_keys.to_string()),*],
+ }
+ }
+ }
+
+ #hercules::inventory::submit! {
+ #hercules::Registration(|action| {
+ action.register_data_type::<#ident>()
+ .unwrap_or_else(|e| panic!("failed to register data type {}: {e}", stringify!(#ident)));
+ })
+ }
+ })
+}
diff --git a/rust/hercules-macros/src/event.rs b/rust/hercules-macros/src/event.rs
new file mode 100644
index 0000000..5907ea4
--- /dev/null
+++ b/rust/hercules-macros/src/event.rs
@@ -0,0 +1,71 @@
+use proc_macro2::{Span, TokenStream};
+use quote::quote;
+use syn::ItemStruct;
+
+use crate::items::setting_tokens;
+use crate::parse::{
+ hercules_path, optional_string, optional_translation_vec, take_repeated, AttrArgs,
+};
+
+pub fn expand(attr: TokenStream, item: TokenStream) -> syn::Result {
+ let mut item_struct: ItemStruct = syn::parse2(item)?;
+ let args = AttrArgs::parse(attr)?;
+ let hercules = hercules_path();
+
+ let base = args.path("base")?.ok_or_else(|| {
+ syn::Error::new(
+ Span::call_site(),
+ "missing required `base = SomeRuntimeEvent`",
+ )
+ })?;
+
+ let settings = take_repeated(&mut item_struct, "setting")?
+ .iter()
+ .map(|s| setting_tokens(s, &hercules))
+ .collect::>>()?;
+
+ let identifier = optional_string(args.string("identifier"))?;
+ let signature = optional_string(args.string("signature"))?;
+ let name = optional_translation_vec(&args, "name", &hercules)?;
+ let description = optional_translation_vec(&args, "description", &hercules)?;
+ let documentation = optional_translation_vec(&args, "documentation", &hercules)?;
+ let display_message = optional_translation_vec(&args, "display_message", &hercules)?;
+ let alias = optional_translation_vec(&args, "alias", &hercules)?;
+ let display_icon = optional_string(args.string("display_icon"))?;
+ let editable = if args.flag("editable") {
+ quote!(Some(true))
+ } else {
+ quote!(None)
+ };
+
+ let ident = &item_struct.ident;
+ Ok(quote! {
+ #item_struct
+
+ impl #hercules::Event for #ident {
+ type Base = #base;
+
+ fn meta() -> #hercules::EventMeta {
+ #hercules::EventMeta {
+ identifier: #identifier,
+ signature: #signature,
+ settings: vec![#(#settings),*],
+ editable: #editable,
+ name: #name,
+ description: #description,
+ documentation: #documentation,
+ display_message: #display_message,
+ alias: #alias,
+ display_icon: #display_icon,
+ }
+ }
+ }
+
+ #hercules::inventory::submit! {
+ #hercules::Registration(|action| {
+ action.register_event::<#ident>()
+ .unwrap_or_else(|e| panic!("failed to register event {}: {e}", stringify!(#ident)));
+ })
+ }
+ })
+}
diff --git a/rust/hercules-macros/src/function.rs b/rust/hercules-macros/src/function.rs
new file mode 100644
index 0000000..29cb9de
--- /dev/null
+++ b/rust/hercules-macros/src/function.rs
@@ -0,0 +1,80 @@
+use proc_macro2::{Span, TokenStream};
+use quote::quote;
+use syn::ItemStruct;
+
+use crate::items::parameter_tokens;
+use crate::parse::{
+ hercules_path, optional_string, optional_translation_vec, take_repeated, AttrArgs,
+};
+
+pub fn expand(attr: TokenStream, item: TokenStream) -> syn::Result {
+ let mut item_struct: ItemStruct = syn::parse2(item)?;
+ let args = AttrArgs::parse(attr)?;
+ let hercules = hercules_path();
+
+ let base = args.path("base")?.ok_or_else(|| {
+ syn::Error::new(
+ Span::call_site(),
+ "missing required `base = SomeRuntimeFunction`",
+ )
+ })?;
+
+ let parameters = take_repeated(&mut item_struct, "parameter")?
+ .iter()
+ .map(|p| parameter_tokens(p, &hercules))
+ .collect::>>()?;
+
+ let identifier = optional_string(args.string("identifier"))?;
+ let signature = optional_string(args.string("signature"))?;
+ let name = optional_translation_vec(&args, "name", &hercules)?;
+ let description = optional_translation_vec(&args, "description", &hercules)?;
+ let documentation = optional_translation_vec(&args, "documentation", &hercules)?;
+ let deprecation_message = optional_translation_vec(&args, "deprecation_message", &hercules)?;
+ let display_message = optional_translation_vec(&args, "display_message", &hercules)?;
+ let alias = optional_translation_vec(&args, "alias", &hercules)?;
+ let display_icon = optional_string(args.string("display_icon"))?;
+ let design = optional_string(args.string("design"))?;
+ // Presence-only: this overrides `throws_error` to `true`; to leave it
+ // unset (inherit the base), simply omit the flag.
+ let throws_error = if args.flag("throws_error") {
+ quote!(Some(true))
+ } else {
+ quote!(None)
+ };
+
+ let ident = &item_struct.ident;
+ Ok(quote! {
+ #item_struct
+
+ impl #hercules::Function for #ident {
+ type Base = #base;
+
+ fn meta() -> #hercules::FunctionMeta {
+ #hercules::FunctionMeta {
+ identifier: #identifier,
+ signature: #signature,
+ name: #name,
+ description: #description,
+ documentation: #documentation,
+ deprecation_message: #deprecation_message,
+ display_message: #display_message,
+ alias: #alias,
+ display_icon: #display_icon,
+ design: #design,
+ throws_error: #throws_error,
+ parameters: vec![#(#parameters),*],
+ }
+ }
+ }
+
+ // `Function` carries no instance/state (dispatch always resolves
+ // through `Base`), so unlike `runtime_function` this needs no
+ // `manual` escape hatch — it's always safe to auto-register.
+ #hercules::inventory::submit! {
+ #hercules::Registration(|action| {
+ action.register_function::<#ident>()
+ .unwrap_or_else(|e| panic!("failed to register function {}: {e}", stringify!(#ident)));
+ })
+ }
+ })
+}
diff --git a/rust/hercules-macros/src/items.rs b/rust/hercules-macros/src/items.rs
new file mode 100644
index 0000000..dd27bde
--- /dev/null
+++ b/rust/hercules-macros/src/items.rs
@@ -0,0 +1,67 @@
+//! Token builders for the two repeatable child items:
+//! `#[parameter(...)]` (functions) and `#[setting(...)]` (events).
+
+use proc_macro2::TokenStream;
+use quote::quote;
+
+use crate::parse::{translation_vec, AttrArgs};
+
+pub fn parameter_tokens(args: &AttrArgs, hercules: &TokenStream) -> syn::Result {
+ let runtime_name = args.required_string("runtime_name")?;
+ let runtime_definition_name = match args.string("runtime_definition_name")? {
+ Some(s) => quote!(Some(#s.to_string())),
+ None => quote!(None),
+ };
+ let name = translation_vec(&args.translations("name")?, hercules);
+ let description = translation_vec(&args.translations("description")?, hercules);
+ let documentation = translation_vec(&args.translations("documentation")?, hercules);
+ let default_value = match args.value_tokens("default_value")? {
+ Some(v) => quote!(Some(#hercules::serde_json::json!(#v))),
+ None => quote!(None),
+ };
+ let hidden = args.flag("hidden");
+ let optional = args.flag("optional");
+
+ Ok(quote! {
+ #hercules::ParameterMeta {
+ runtime_name: #runtime_name.to_string(),
+ runtime_definition_name: #runtime_definition_name,
+ name: #name,
+ description: #description,
+ documentation: #documentation,
+ default_value: #default_value,
+ hidden: #hidden,
+ optional: #optional,
+ }
+ })
+}
+
+pub fn setting_tokens(args: &AttrArgs, hercules: &TokenStream) -> syn::Result {
+ let identifier = args.required_string("identifier")?;
+ let unique = match args.string("unique")?.as_deref() {
+ Some("project") => quote!(#hercules::UniquenessScope::Project),
+ _ => quote!(#hercules::UniquenessScope::None),
+ };
+ let linked: Vec = args.string_list("linked_data_type_identifiers")?;
+ let name = translation_vec(&args.translations("name")?, hercules);
+ let description = translation_vec(&args.translations("description")?, hercules);
+ let default_value = match args.value_tokens("default_value")? {
+ Some(v) => quote!(Some(#hercules::serde_json::json!(#v))),
+ None => quote!(None),
+ };
+ let hidden = args.flag("hidden");
+ let optional = args.flag("optional");
+
+ Ok(quote! {
+ #hercules::EventSettingMeta {
+ identifier: #identifier.to_string(),
+ unique: #unique,
+ linked_data_type_identifiers: vec![#(#linked.to_string()),*],
+ default_value: #default_value,
+ name: #name,
+ description: #description,
+ hidden: #hidden,
+ optional: #optional,
+ }
+ })
+}
diff --git a/rust/hercules-macros/src/lib.rs b/rust/hercules-macros/src/lib.rs
new file mode 100644
index 0000000..a9baf67
--- /dev/null
+++ b/rust/hercules-macros/src/lib.rs
@@ -0,0 +1,62 @@
+//! Attribute macros that turn `identifier = "...", name(en_US = "...")`
+//! arguments — plus any repeated `#[parameter(...)]`/`#[setting(...)]` helper
+//! attributes on the annotated struct — into a `meta()` associated function
+//! implementing the corresponding `hercules` trait. Each macro parses its
+//! arguments and generates that function once, at compile time; there's no
+//! runtime reflection or metadata registry involved.
+
+mod data_type;
+mod event;
+mod function;
+mod items;
+mod parse;
+mod runtime_event;
+mod runtime_function;
+
+use proc_macro::TokenStream;
+
+fn run(
+ f: impl FnOnce(
+ proc_macro2::TokenStream,
+ proc_macro2::TokenStream,
+ ) -> syn::Result,
+ attr: TokenStream,
+ item: TokenStream,
+) -> TokenStream {
+ f(attr.into(), item.into())
+ .unwrap_or_else(syn::Error::into_compile_error)
+ .into()
+}
+
+/// Declares a function Aquila can invoke. See the crate-level docs on
+/// `hercules::RuntimeFunction` for the full attribute grammar.
+#[proc_macro_attribute]
+pub fn runtime_function(attr: TokenStream, item: TokenStream) -> TokenStream {
+ run(runtime_function::expand, attr, item)
+}
+
+/// Declares a public [`hercules::Function`] that overrides metadata on top
+/// of a `base = SomeRuntimeFunction`.
+#[proc_macro_attribute]
+pub fn function(attr: TokenStream, item: TokenStream) -> TokenStream {
+ run(function::expand, attr, item)
+}
+
+/// Declares a data type derived from the struct's `schemars::JsonSchema` impl.
+#[proc_macro_attribute]
+pub fn data_type(attr: TokenStream, item: TokenStream) -> TokenStream {
+ run(data_type::expand, attr, item)
+}
+
+/// Declares an internal event/flow-type an action can fire.
+#[proc_macro_attribute]
+pub fn runtime_event(attr: TokenStream, item: TokenStream) -> TokenStream {
+ run(runtime_event::expand, attr, item)
+}
+
+/// Declares a public [`hercules::Event`] that overrides metadata on top of a
+/// `base = SomeRuntimeEvent`.
+#[proc_macro_attribute]
+pub fn event(attr: TokenStream, item: TokenStream) -> TokenStream {
+ run(event::expand, attr, item)
+}
diff --git a/rust/hercules-macros/src/parse.rs b/rust/hercules-macros/src/parse.rs
new file mode 100644
index 0000000..d299322
--- /dev/null
+++ b/rust/hercules-macros/src/parse.rs
@@ -0,0 +1,214 @@
+//! Shared parsing for the `#[hercules::...]` attribute macros' argument
+//! lists (`identifier = "...", name(en_US = "...")`) and for the repeatable
+//! helper attributes (`#[parameter(...)]`, `#[setting(...)]`) they read off
+//! a struct and strip before re-emitting it.
+
+use proc_macro2::TokenStream;
+use quote::quote;
+use syn::parse::Parser;
+use syn::punctuated::Punctuated;
+use syn::{Attribute, Expr, ExprLit, ItemStruct, Lit, Meta, MetaNameValue, Token};
+
+pub struct AttrArgs {
+ metas: Vec,
+}
+
+fn expr_str(expr: &Expr) -> syn::Result {
+ match expr {
+ Expr::Lit(ExprLit {
+ lit: Lit::Str(s), ..
+ }) => Ok(s.value()),
+ other => Err(syn::Error::new_spanned(other, "expected a string literal")),
+ }
+}
+
+impl AttrArgs {
+ pub fn parse(tokens: TokenStream) -> syn::Result {
+ let metas = Punctuated::::parse_terminated.parse2(tokens)?;
+ Ok(Self {
+ metas: metas.into_iter().collect(),
+ })
+ }
+
+ fn find(&self, key: &str) -> Option<&Meta> {
+ self.metas.iter().find(|m| m.path().is_ident(key))
+ }
+
+ /// `key = "..."`.
+ pub fn string(&self, key: &str) -> syn::Result