2.7 KiB, 1 run
created by r2519314175:951, which is this file's identity for as long as the history lasts, whatever it is later renamed to
download · who wrote it · its history
| 1 | //! Daimond — AI agent and web chatbot for the Hematite Steel server. |
| 2 | //! |
| 3 | //! Daimond provides a web-based chat interface to an LLM (via an OpenAI-compatible |
| 4 | //! API) with tool-calling capability. It replaces the tmux/PTY terminal |
| 5 | //! bridge approach with a structured WebSocket protocol using JDAT |
| 6 | //! serialisation. |
| 7 | //! |
| 8 | //! Key components: |
| 9 | //! |
| 10 | //! - [`llm`] — async LLM client with SSE streaming |
| 11 | //! - [`session`] — per-user session and conversation storage (O3db) |
| 12 | //! - [`agent`] — the agent loop: message → LLM → tools → streamed response |
| 13 | //! - [`protocol`] — WS message types (JDAT serialisation) |
| 14 | //! - [`handler`] — `WebSocketHandler` impl for Steel integration |
| 15 | |
| 16 | #![forbid(unsafe_code)] |
| 17 | |
| 18 | pub mod agent; |
| 19 | pub mod executor; |
| 20 | /// The Steel WebSocket handler is a native-only server concern; the |
| 21 | /// browser (wasm32) build drives the agent directly, so this module is |
| 22 | /// gated out of the wasm target. |
| 23 | #[cfg(not(target_arch = "wasm32"))] |
| 24 | pub mod handler; |
| 25 | /// Crystal version history as a delta log: when a version stores a full copy |
| 26 | /// and when it stores splices, and which stored files rebuild any one version. |
| 27 | pub mod diamond_delta; |
| 28 | /// The pure core of a Diamond's `meta.json` — its shape, its parse/serialise |
| 29 | /// pair, and tag normalisation. Target-agnostic, so it is tested natively |
| 30 | /// while the OPFS edge over it stays in [`wasm::diamond`]. |
| 31 | pub mod diamond_link; |
| 32 | pub mod diamond_meta; |
| 33 | /// How one path component is spelled on a filesystem that will not take it as it stands. |
| 34 | /// |
| 35 | /// Target-agnostic on purpose: the rules are a browser's, but the codec is a pure string |
| 36 | /// transform whose reversibility is the whole of its correctness, and that is provable |
| 37 | /// natively rather than only in a page. The edge that applies it is [`wasm::opfs`]. |
| 38 | pub mod fsname; |
| 39 | pub mod llm; |
| 40 | /// The system prompt each kind of agent runs under, and the part of it a user |
| 41 | /// may replace from their workspace. |
| 42 | pub mod prompts; |
| 43 | pub mod protocol; |
| 44 | pub mod session; |
| 45 | /// Named instruction bundles, and the two ways a turn invokes one. |
| 46 | /// |
| 47 | /// Target-agnostic on purpose. The directory walk ([`skills::list_skills`]) is `std::fs` and so |
| 48 | /// serves the native `handler` alone, but the parts that decide what a `/name` means and what the |
| 49 | /// model is finally handed are pure, and the browser drives them over OPFS from `wasm::app` -- |
| 50 | /// because in the browser, which is where the user actually works, this module used to compile and |
| 51 | /// be read by nothing. |
| 52 | pub mod skills; |
| 53 | pub mod syntax; |
| 54 | pub mod tools; |
| 55 | /// The browser (wasm32) entry surface — a `#[wasm_bindgen]` API plus the |
| 56 | /// OPFS filesystem edge. Gated to wasm32 so the native build never sees |
| 57 | /// `wasm-bindgen`'s generated glue. |
| 58 | #[cfg(target_arch = "wasm32")] |
| 59 | pub mod wasm; |
| 60 | pub mod workspace; |