elizaos_plugin_farcaster/
lib.rs1#![allow(missing_docs)]
2#![deny(unsafe_code)]
3
4pub mod client;
5pub mod config;
6pub mod error;
7pub mod types;
8
9#[cfg(feature = "native")]
10pub mod service;
11
12#[cfg(feature = "native")]
13pub mod actions;
14
15#[cfg(feature = "native")]
16pub mod providers;
17
18#[cfg(feature = "wasm")]
19pub mod wasm;
20
21pub use client::FarcasterClient;
22pub use config::FarcasterConfig;
23pub use error::{FarcasterError, Result};
24pub use types::{Cast, Profile};
25
26#[cfg(feature = "native")]
27pub use service::FarcasterService;
28
29#[cfg(feature = "native")]
30pub use actions::{ActionResult, ReplyCastAction, SendCastAction};
31
32#[cfg(feature = "native")]
33pub use providers::{
34 ProfileProvider, ProviderResult, ThreadProvider, TimelineProvider,
35};
36
37pub fn create_client_from_env() -> Result<FarcasterClient> {
38 let config = FarcasterConfig::from_env()?;
39 FarcasterClient::new(config)
40}
41
42pub const PLUGIN_NAME: &str = "farcaster";
43pub const PLUGIN_DESCRIPTION: &str =
44 "Farcaster integration for elizaOS - sending and receiving casts via Neynar API";
45pub const PLUGIN_VERSION: &str = env!("CARGO_PKG_VERSION");
46
47pub const FARCASTER_SERVICE_NAME: &str = "farcaster";
48pub const FARCASTER_SOURCE: &str = "farcaster";
49
50pub mod defaults {
51 pub const MAX_CAST_LENGTH: usize = 320;
52 pub const POLL_INTERVAL: u64 = 120;
53 pub const CAST_INTERVAL_MIN: u64 = 90;
54 pub const CAST_INTERVAL_MAX: u64 = 180;
55 pub const CAST_CACHE_TTL: u64 = 1000 * 30 * 60;
56 pub const CAST_CACHE_SIZE: usize = 9000;
57}
58
59#[cfg(feature = "native")]
62pub struct FarcasterPlugin;
63
64#[cfg(feature = "native")]
65impl FarcasterPlugin {
66 pub fn name() -> &'static str {
67 PLUGIN_NAME
68 }
69
70 pub fn description() -> &'static str {
71 PLUGIN_DESCRIPTION
72 }
73
74 pub fn version() -> &'static str {
75 PLUGIN_VERSION
76 }
77
78 pub fn actions() -> Vec<(&'static str, &'static str)> {
80 actions::all_action_names()
81 }
82
83 pub fn providers() -> Vec<(&'static str, &'static str)> {
85 providers::all_provider_names()
86 }
87}