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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
//! # AetherShell
//!
//! **The shell built for AI agents — one language, every platform, deterministic typed output.**
//!
//! AetherShell is a cross-platform shell where every command returns structured, typed data
//! instead of raw text. It provides a single language that works identically on Linux, macOS,
//! and Windows, eliminating the non-deterministic text parsing that makes traditional shell-based
//! agent workflows brittle.
//!
//! ## Core Design
//!
//! - **Deterministic typed output**: All builtins return [`Value`] types (Int, Float, String,
//! Array, Record, Lambda) — never unstructured text.
//! - **Cross-platform uniformity**: One language, one set of builtins, identical behavior everywhere.
//! - **Built-in ontology**: Commands, arguments, and return types are machine-discoverable
//! without documentation scraping or prompt engineering.
//! - **Functional pipelines**: Data flows through typed transformations, not text-munging pipes.
//!
//! ## Architecture
//!
//! The crate is split into core modules (available in both native and WASM builds) and
//! native-only modules that depend on system resources.
//!
//! ### Core (always available)
//! - [`ast`] — Abstract syntax tree definitions
//! - [`parser`] — AetherShell source → AST
//! - [`value`] — Runtime value system (the typed output contract)
//! - [`types`] — Type lattice for inference
//! - [`typecheck`] — Hindley-Milner type inference engine
//! - [`env`] — Environment and scope management
//!
//! ### Native-only (behind `native` feature)
//! - [`eval`] — Expression evaluator and runtime semantics
//! - [`builtins`] — 1,280+ built-in functions across 108 modules
//! - [`modules`] — Module system mapping `module.function()` syntax to builtins
//! - [`ai`] / [`ai_api`] — Multi-provider AI integration
//! - [`agent`] / [`agent_api`] — Autonomous agent framework and HTTP API
//! - [`mcp`] — Model Context Protocol; exposes the builtin catalog as a compact
//! three-tool discovery surface by default (`AETHER_MCP_TOOLS=all` for the
//! flat per-builtin listing)
//! - [`metrics`] — Prometheus-compatible metrics, alerting, and monitoring
//! - [`prompt`] / [`line_editor`] — Prompt styles and fish-style line editing
//! - [`yaml`] — YAML subset parser/emitter with an enforced boundary
//! - [`tui`] — Rich terminal UI with chat, agents, and media viewer
// ── Clippy lint baseline ─────────────────────────────────────────────────────
// This crate predates Clippy adoption; the build bar has been rustc-warning-clean.
// The block below baselines the pre-existing Clippy categories so `cargo clippy`
// is clean and CAN flag *new* lint categories on future code, without a risky
// 180-edit rewrite of working, tested code. Attribute-only — zero behavior change.
//
// (A) Intentional — correct as written; these stay allowed:
// GDPR/HIPAA/SAML/PCI/OIDC are standard acronyms
// SafetyError is an intentionally rich, cold-path error
// index loops in the nn/matrix math read clearer
// parallel branches kept explicit for clarity/extension
// `if x.is_some() { x.unwrap() }` reads clearly here
// intentional inherent from_str/parse shortcuts
// open semantics reviewed and intended
//
// (B) Deferred idiomatic cleanup — safe to tighten incrementally; baselined for now:
//
// (C) Unix-only code paths. These fire exclusively inside
// `#[cfg(not(target_os = "windows"))]` / `#[cfg(target_os = "linux")]` blocks,
// so a Windows checkout never sees them — which is why they accumulated and why
// CI's Linux/macOS lint job had been failing since 2026-06-11. All are style
// lints with no correctness component (42 needless_return, 13 needless borrows,
// a few closures/format args). Baselined rather than blind-fixed: they cannot be
// compiled, let alone verified, from Windows, and 60+ unverifiable edits inside
// a 49k-line file is a worse trade than an honest, documented allow.
// To clean up: work from a Linux checkout and remove these one at a time.
/// Abstract syntax tree — core AST definitions (Stmt, Expr, BinOp).
/// Environment — variable bindings, scopes, and module resolution.
/// Parser — transforms AetherShell source text into an AST.
/// Type lattice — type definitions used by the inference engine.
/// Runtime values — the typed output contract (Int, Float, String, Array, Record, Lambda).
/// YAML — a documented subset parser/emitter that fails loudly outside it.
// Core modules available in both native and WASM builds
/// Shell feature flags — runtime capability detection.
/// Type checker — Hindley-Milner type inference engine.
// Native-only modules (including eval which depends on builtins)
/// Autonomous agent framework — single agents and swarm coordination.
/// Agent HTTP API — REST/WebSocket server with OpenAI/Claude/Gemini schemas.
/// AI integration — multi-provider LLM client with model URIs.
/// AI API server — OpenRouter-style API with local model management.
/// Authentication — token and credential management.
/// Built-in functions — 1,280+ typed builtins across 108 modules.
/// Configuration — XDG-compliant config, themes, and settings.
/// Evaluator — expression evaluation and runtime semantics.
/// Evolutionary algorithms — genetic algorithms and NEAT.
/// External tools — integration with system-installed CLI tools.
/// Line editing — fish-style autosuggestions, abbreviations, history recall.
/// Local inference — Candle and ONNX Runtime backends for in-process model inference.
/// Marketplace — community plugin and agent marketplace.
/// MCP — Model Context Protocol server; compact tool-discovery surface by default.
/// Metrics — Prometheus-compatible metrics, alerting, and dashboards.
/// Module system — maps module.function() syntax to builtin dispatch.
/// Neural networks — feedforward networks and training.
/// OS tools — platform-specific tool discovery and metadata.
/// Package management — import resolution and aether.toml manifests.
/// Persistence — session state and data persistence.
/// Plugin system — dynamic TOML-based plugin loading.
/// Prompt rendering — fish-, oh-my-posh-, and pure-inspired prompt styles.
/// AI providers — provider registry and model routing.
/// REPL — interactive read-eval-print loop.
/// Reinforcement learning — Q-Learning, DQN, Actor-Critic agents.
/// RL models — reinforcement learning model definitions.
/// Safety core — effect taxonomy, policy/approval engine, hash-chained audit.
/// Secure configuration — encrypted secrets and credential storage.
/// Security — RBAC, audit logging, SSO integration.
/// Syntax knowledge base — command documentation and help system.
/// Transpiler — AetherShell ↔ Bash compatibility layer.
/// Terminal UI — rich TUI with chat, agent dashboard, and media viewer.
/// Transactions — filesystem checkpoint/rollback journal for undoable actions.
/// Workflows — workflow engine for multi-step automation.
/// WASM bindings — browser REPL and web integration.