main
md 50 lines 1.95 KB
Rendered Raw
1 # ed-agent-tauri
2
3 Tauri bindings for [Ed](https://crates.io/crates/ed-agent), the embeddable
4 local-model chat agent.
5
6 Ed's core is framework-agnostic and reports through a `StatusSink`. This crate
7 is the Tauri implementation of that sink plus the commands a webview calls.
8
9 ```rust
10 use ed_agent::Ed;
11 use ed_agent_tauri::{EdState, TauriSink};
12 use tauri::Manager;
13
14 let ed = Ed::with_sink(TauriSink::new(app.handle().clone()));
15 app.manage(EdState::new(ed));
16 ```
17
18 Then register `chat_get_status`, `chat_get_history`, `chat_clear_history`,
19 `chat_send_message`, `chat_run`, and `chat_cancel` on the builder's
20 `invoke_handler`.
21
22 These events reach the webview: `chat_status_changed`, `chat_reply`,
23 `chat_tool_requested`, `chat_approval_requested`, `chat_tool_started`,
24 `chat_tool_finished`, `chat_agent_reply`, and `chat_warning`.
25
26 ## Several conversations
27
28 `EdSessions` is the multi-session form. Give it a `SessionStore` and it handles
29 switching, the in-memory cache, logout (`reset`) and approvals. Register
30 `chat_list_sessions`, `chat_new_session`, `chat_switch_session`,
31 `chat_delete_session`, `chat_get_session_history`, `chat_submit` and
32 `chat_respond_approval`.
33
34 `chat_submit` returns immediately; the answer is a `chat_reply` event
35 `{id, session, reply, duration, error}`, preceded by `chat_text_delta
36 {session, id, delta}` events. Approvals use `chat_approval_requested
37 {request_id, session, call, risk}` and `chat_approval_resolved {request_id}`;
38 answer with `chat_respond_approval`. To rewrite the message first, wrap
39 `EdSessions::submit_with` in your own command.
40
41 Loading a model is deliberately not a command here — which model, and from
42 where, is an application decision. Call `Ed::load` or `Ed::load_with` from your
43 own command.
44
45 Without `EdSessions`, tool calling needs both halves from you: build the agent with `Ed::with_agent` to pass a `ToolExecutor` and an `ApprovalHandler`.
46
47 ## Copyright
48
49 © 2026 [Onde Inference](https://ondeinference.com).
50 Licensed under MIT or Apache-2.0.