runtara_workflow_stdlib/lib.rs
1// Copyright (C) 2025 SyncMyOrders Sp. z o.o.
2// SPDX-License-Identifier: AGPL-3.0-or-later
3//! Runtara Workflow Standard Library
4//!
5//! Unified library for workflow binaries. Combines agents and runtime
6//! into a single crate that workflows link against.
7//!
8//! This library integrates with runtara-core via runtara-sdk for:
9//! - Instance registration and lifecycle management
10//! - Checkpointing for crash recovery
11//! - Signal handling (pause, cancel, resume)
12//! - Heartbeat/tick for liveness monitoring
13//!
14//! Usage in generated workflow code:
15//! ```rust
16//! extern crate runtara_workflow_stdlib;
17//! use runtara_workflow_stdlib::prelude::*;
18//! use runtara_workflow_stdlib::agents::*;
19//! ```
20
21// Re-export the agents crate
22pub use runtara_agents as agents;
23
24// Runtime module (wraps runtara-sdk)
25pub mod runtime;
26
27// Condition helpers for generated conditional steps
28pub mod conditions;
29
30// Connection management (fetches connections from external service)
31pub mod connections;
32
33// Instance output handling (for Environment communication)
34pub mod instance_output;
35
36// Re-export serde at top level
37pub use serde;
38pub use serde_json;
39
40// Re-export libc for stderr redirection in generated workflows
41pub use libc;
42
43// Re-export tokio for async runtime in generated workflows
44pub use tokio;
45
46// Re-export runtara-sdk for direct use
47pub use runtara_sdk;
48
49// Prelude for convenient imports
50pub mod prelude {
51 // Runtime types
52 pub use crate::runtime::{Error, Result};
53
54 // SDK types for durability
55 pub use crate::runtime::{RuntaraSdk, SdkConfig, durable, register_sdk, sdk};
56
57 // Condition helpers for generated conditional steps
58 pub use crate::conditions::{is_truthy, to_number, values_equal};
59
60 // Connection types
61 pub use crate::connections::{
62 ConnectionError, ConnectionResponse, RateLimitState, fetch_connection,
63 };
64
65 // Instance output types (for Environment communication)
66 pub use crate::instance_output::{
67 InstanceOutput, InstanceOutputStatus, write_cancelled, write_completed, write_failed,
68 write_sleeping, write_suspended,
69 };
70
71 // Serde types
72 pub use serde::{Deserialize, Serialize};
73 pub use serde_json;
74
75 // Agent registry
76 pub use runtara_agents::registry;
77}
78
79// Direct access to commonly used modules
80pub use runtara_agents::registry;
81pub use runtime::{Error, Result};