1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! Shared types for the Flashmind AI agent framework.
//!
//! This crate defines the traits, wire types, and event structures shared by all
//! Flashmind crates. It is the foundation that both library consumers and provider
//! implementations depend on.
//!
//! # Core traits
//!
//! | Trait | Purpose |
//! |-------|---------|
//! | [`LlmProvider`] | Streaming completions from any LLM backend |
//! | [`Tool`] | Function-calling tools the agent can invoke |
//! | [`MemoryProvider`] | Store/search/forget long-term memories |
//!
//! # Modules
//!
//! | Module | Types |
//! |--------|-------|
//! | [`event`] | [`AgentEvent`], [`AgentInput`], [`TurnStatus`], [`TurnUsage`] — telemetry |
//! | [`llm`] | [`LlmProvider`], [`CompletionRequest`], [`StreamEvent`], [`FinishReason`] |
//! | [`memory`] | [`MemoryEntry`], [`MemoryMetadata`], [`MemoryProvider`] |
//! | [`message`] | [`Message`], [`Role`], [`ToolCall`], [`ContentPart`] — LLM wire format |
//! | [`model`] | [`Model`], [`Provider`], [`SamplingParams`], [`ReasoningLevel`] |
//! | [`tool`] | [`Tool`], [`ToolRegistry`], [`ToolContext`], [`ToolResult`](tool::ToolResult) |
//! | [`stream`] | [`AgentStream`], [`Outcome`] — stream-with-final-result pattern |
//! | [`utils`] | UTF-8-safe string truncation helpers |
//!
//! # Example: implementing a provider
//!
//! ```rust
//! use async_trait::async_trait;
//! use flashmind_types::{
//! CompletionRequest, CompletionStream, LlmProvider, Provider, StreamEvent, FinishReason,
//! };
//!
//! struct MyProvider;
//!
//! #[async_trait]
//! impl LlmProvider for MyProvider {
//! fn name(&self) -> &str { "my-provider" }
//! fn provider(&self) -> Provider { Provider::OpenAi }
//!
//! fn complete(&self, _request: CompletionRequest) -> CompletionStream {
//! Box::pin(async_stream::stream! {
//! yield Ok(StreamEvent::ContentDelta("Hello!".into()));
//! yield Ok(StreamEvent::Finished(FinishReason::Stop));
//! })
//! }
//! }
//! ```
pub use ;
pub use ;
pub use InteractionMode;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Minimum length for a secret value to be redacted from output.
///
/// Secrets shorter than this are left as-is to avoid false positives.
pub const MIN_SECRET_REDACT_LEN: usize = 8;