Skip to main content

strike48_connector/
lib.rs

1// Internal modules -- not accessible to external consumers
2pub(crate) mod auth;
3pub(crate) mod client;
4pub(crate) mod constants;
5pub(crate) mod logger;
6pub(crate) mod metrics_recorder;
7pub(crate) mod sdk_metadata;
8pub(crate) mod system_metrics;
9pub(crate) mod transport;
10
11// Public modules
12pub mod behaviors;
13pub mod connector;
14pub mod error;
15pub mod process;
16pub mod simple;
17pub mod types;
18pub mod url_parser;
19pub mod utils;
20
21// =============================================================================
22// PRELUDE - The simplest way to use this SDK
23// =============================================================================
24//
25// Just add: `use strike48_connector::prelude::*;`
26//
27// This gives you everything you need to build connectors quickly.
28//
29pub use simple::prelude;
30
31// Core types
32pub use connector::{
33    BaseConnector, ConnectorConfig, ConnectorHandle, ConnectorRunner, InvokeCapabilityOptions,
34    ShutdownHandle,
35};
36pub use error::{ConnectorError, Result};
37pub use types::*;
38pub use utils::{deserialize_payload, error_response, serialize_payload, success_response};
39
40// App behavior
41pub use behaviors::app::{
42    AppConnector, AppManifest, AppPageRequest, AppPageResponse, BodyEncoding, NavigationConfig,
43    NavigationPlacement, StaticFileConfig,
44};
45pub use behaviors::serve::{App, AppBuilder};
46
47// Source behavior
48pub use behaviors::source::{FetchRequest, FetchResponse, SourceConfig, SourceConnector};
49
50// Sink behavior
51pub use behaviors::sink::{IdempotentSink, ItemError, SinkConfig, SinkConnector, WriteResult};
52
53// Tool behavior
54pub use behaviors::tool::{
55    ParamType, ParameterSchema, ToolConnector, ToolParam, ToolResult, ToolSchema,
56};
57
58// PubSub behavior
59pub use behaviors::pubsub::{
60    InMemoryPubSub, Message, PubSubConfig, PubSubConnector, PublishOptions, SubscribeOptions,
61    Subscription, SubscriptionError, TopicPattern,
62};
63
64// RequestResponse behavior
65pub use behaviors::request_response::{
66    BatchRequest, BatchResponse, ConcurrentRequestHandler, RequestContext, RequestError,
67    RequestMetrics, RequestResponseConfig, RequestResponseConnector, Response,
68};
69
70// Utilities
71pub use behaviors::utilities::{
72    Cache, CacheStats, OperationMetrics, RetryConfig, Timer, ValidationError, retry_async, timed,
73    validate_against_schema, validate_json,
74};
75
76// Async process execution (non-blocking command runner)
77pub use process::{
78    CommandBuilder, CommandOptions, CommandOutput, run_command, run_command_opts,
79    run_command_stdout, run_command_with_timeout, run_shell, run_shell_with_timeout,
80};
81
82// URL parser for auto-detecting transport from URL scheme
83pub use url_parser::{ParsedEndpoint, get_transport_from_url, is_valid_url, parse_url};
84
85// Transport config types (re-exported from internal module)
86pub use transport::{TransportOptions, TransportType};
87
88// Invoke options for ConnectorHandle (re-exported from internal module)
89pub use client::InvokeOptions;
90
91// Logger initialization (re-exported from internal module)
92pub use logger::init_logger;
93
94// Advanced: low-level client for connectors that manage their own gRPC streams.
95// Prefer ConnectorRunner + BaseConnector for new connectors.
96pub use client::{ClientOptions, ConnectorClient};
97
98// Auth provider for connectors with custom auth flows
99pub use auth::{OAuthError, OAuthManager, OttProvider};
100
101// Re-export the `metrics` crate so connector authors can use
102// `strike48_connector::metrics::{counter, gauge, histogram}` without
103// adding `metrics` to their own Cargo.toml.
104pub use metrics;
105
106// =============================================================================
107// SIMPLIFIED API - For developers who want the easiest possible experience
108// =============================================================================
109
110// Simple connector trait and helpers
111pub use simple::{SimpleConnector, html, json, not_found, run_connector, serve_app, serve_static};