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
//! # 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`] — 430+ built-in functions across 50 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 (130+ tools)
//! - [`metrics`] — Prometheus-compatible metrics, alerting, and monitoring
//! - [`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:
/// 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).
// 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 — 430+ typed builtins across 50 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.
/// Local inference — Candle and ONNX Runtime backends for in-process model inference.
/// Marketplace — community plugin and agent marketplace.
/// MCP — Model Context Protocol with 130+ tools and HTTP server.
/// 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.
/// 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.