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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//! Rust client SDK for the [Reasoning Layer](https://github.com/kortexya/reasoninglayer) API.
//!
//! The SDK is a direct port of the TypeScript SDK (`@kortexya/reasoninglayer`) — it speaks the
//! same HTTP contract, sends the same auth headers, follows the same retry / backoff rules, and
//! exposes the same resource surface. Method naming follows Rust conventions (`snake_case`), with
//! [`ReasoningLayerClient`] as the single entry point.
//!
//! # Quick start
//!
//! ```no_run
//! # async fn run() -> Result<(), reasoninglayer::Error> {
//! use reasoninglayer::{psi, var, guard, constrained, GuardOp,
//! ClientConfig, ReasoningLayerClient, CreateSortRequest,
//! AddRuleRequest, BackwardChainRequest};
//!
//! let client = ReasoningLayerClient::new(
//! ClientConfig::new("http://localhost:8083", "00000000-0000-0000-0000-000000000001"),
//! )?;
//!
//! let person = client.sorts().create_sort(CreateSortRequest::with_name("person"), None).await?;
//! client.inference().add_rule(
//! AddRuleRequest {
//! term: psi("well_paid", [("person", var("?X"))]),
//! antecedents: vec![psi("employee", [
//! ("name", var("?X")),
//! ("salary", constrained("?S", guard(GuardOp::Gt, 80_000_i64))),
//! ])],
//! certainty: None,
//! },
//! None,
//! ).await?;
//! # let _ = person; Ok(()) }
//! ```
//!
//! # Resources
//!
//! Every resource client is accessible via an accessor on [`ReasoningLayerClient`]:
//!
//! - **Core knowledge base:** [`sorts()`](ReasoningLayerClient::sorts) / [`types()`](ReasoningLayerClient::types),
//! [`terms()`](ReasoningLayerClient::terms) / [`records()`](ReasoningLayerClient::records),
//! [`inference()`](ReasoningLayerClient::inference) / [`rules()`](ReasoningLayerClient::rules),
//! [`query()`](ReasoningLayerClient::query)
//! - **AI / ML:** [`cognitive()`](ReasoningLayerClient::cognitive) / [`agents()`](ReasoningLayerClient::agents),
//! [`oversight()`](ReasoningLayerClient::oversight), [`neuro_symbolic()`](ReasoningLayerClient::neuro_symbolic),
//! [`rag()`](ReasoningLayerClient::rag), [`generation()`](ReasoningLayerClient::generation),
//! [`synthetic()`](ReasoningLayerClient::synthetic), [`proof_engine()`](ReasoningLayerClient::proof_engine),
//! [`context()`](ReasoningLayerClient::context), [`rl_training()`](ReasoningLayerClient::rl_training)
//! - **Reasoning:** [`optimize()`](ReasoningLayerClient::optimize), [`ilp()`](ReasoningLayerClient::ilp),
//! [`cdl()`](ReasoningLayerClient::cdl), [`execution()`](ReasoningLayerClient::execution),
//! [`reasoning()`](ReasoningLayerClient::reasoning), [`preferences()`](ReasoningLayerClient::preferences),
//! [`discovery()`](ReasoningLayerClient::discovery)
//! - **Analysis:** [`causal()`](ReasoningLayerClient::causal), [`statistical()`](ReasoningLayerClient::statistical),
//! [`fuzzy()`](ReasoningLayerClient::fuzzy), [`scenarios()`](ReasoningLayerClient::scenarios),
//! [`communities()`](ReasoningLayerClient::communities), [`visualization()`](ReasoningLayerClient::visualization),
//! [`analysis()`](ReasoningLayerClient::analysis)
//! - **Data:** [`ingestion()`](ReasoningLayerClient::ingestion), [`extract()`](ReasoningLayerClient::extract),
//! [`sources()`](ReasoningLayerClient::sources), [`collections()`](ReasoningLayerClient::collections),
//! [`image_extraction()`](ReasoningLayerClient::image_extraction), [`row()`](ReasoningLayerClient::row)
//! - **Workflow:** [`control()`](ReasoningLayerClient::control), [`reviews()`](ReasoningLayerClient::reviews),
//! [`action_reviews()`](ReasoningLayerClient::action_reviews), [`webhook_actions()`](ReasoningLayerClient::webhook_actions)
//! - **System:** [`health()`](ReasoningLayerClient::health), [`admin()`](ReasoningLayerClient::admin),
//! [`spaces()`](ReasoningLayerClient::spaces), [`namespaces()`](ReasoningLayerClient::namespaces),
//! [`utilities()`](ReasoningLayerClient::utilities), [`ontology()`](ReasoningLayerClient::ontology),
//! [`osfql()`](ReasoningLayerClient::osfql), [`ui()`](ReasoningLayerClient::ui),
//! [`conversation()`](ReasoningLayerClient::conversation), [`research()`](ReasoningLayerClient::research),
//! [`functions()`](ReasoningLayerClient::functions)
//!
//! # Coverage phases
//!
//! - **Phase 1 (this crate, stable):** sorts, terms, inference, query with fully typed DTOs, builders,
//! retry / timeout / auth / error mapping.
//! - **Phase 2 (this crate, typed where obvious, [`serde_json::Value`] otherwise):** every other
//! resource has an HTTP client exposed at the right path with the right verb. The wire contract is
//! identical to the TypeScript SDK. Typed DTOs for the Phase 2 resources are landing in patch
//! releases — subscribe to the repo for the upgrade path. Users can always deserialize the
//! returned `Value` into their own types.
//! - **WebSocket + SSE:** exposed via [`ws::WebSocketConnection`] and [`sse::stream`].
// ─── Main entry points ────────────────────────────────────────────────────────
pub use ReasoningLayerClient;
pub use ;
pub use ;
// ─── Resource clients ─────────────────────────────────────────────────────────
pub use ;
pub use ;
// ─── Common types ─────────────────────────────────────────────────────────────
pub use ;
// ─── Builders ────────────────────────────────────────────────────────────────
pub use ;
// ─── Commonly-used DTOs ──────────────────────────────────────────────────────
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;