Expand description
§fude (筆)
A minimal wry + tao shell for AI-assisted document editors. The brush: the tool you reach for to write with an AI as co-author. A lightweight alternative to Tauri for this narrow use case.
- Boots a single-window webview loading
asset://localhost/from a localdist/directory - Exposes
window.__shell_ipc(cmd, args) => Promiseto the frontend with JSON request/reply semantics, pluswindow.__shell_listen(name, fn)for server-push events - Ships opt-in building blocks for allow-list file I/O and native dialogs
- Leaves app-specific commands (PTY for AI CLI panes, ACP clients, custom
business logic) to the consumer via
App::command
§Example
use fude::App;
fn main() -> Result<(), Box<dyn std::error::Error>> {
App::new("com.example.my-editor")
.title("My Editor")
.assets("./dist")
.with_fs_sandbox()
.with_dialogs()
.command("ping", |_ctx, _args| Ok(serde_json::json!("pong")))
.run()
}Re-exports§
pub use acp::AcpAdapterConfig;pub use events::EventEmitter;pub use fs::FsState;pub use sandbox::app_config_dir;pub use sandbox::app_data_dir;pub use sandbox::atomic_write;pub use sandbox::ensure_scratch;pub use sandbox::is_dir_allowed;pub use sandbox::is_path_allowed;pub use sandbox::new_list;pub use sandbox::safe_lock;pub use sandbox::validate_path;
Modules§
- acp
- ACP (Agent Client Protocol) client.
- acp_
commands - Synchronous dispatch wrappers for ACP IPC commands. Runs the underlying async ops on a dedicated current-thread tokio runtime.
- dialogs
- Native dialogs backed by rfd. Registered by
crate::App::with_dialogs. - events
- Event emitter: background threads push named events to the webview via the tao event loop proxy.
- fs
- Sandbox-backed file I/O commands. Registered by
crate::App::with_fs_sandbox. - pty
- PTY sessions for spawning CLI tools from inside a fude window.
- sandbox
- Path sandbox primitives: an allow-list model where the user grants access to files/directories via native dialogs, and read/write ops refuse to touch anything outside that list. Also blocks well-known credential locations (~/.ssh, ~/.aws, etc.) regardless of allow-list.
- settings
- JSON settings persistence. Registered by
crate::App::with_settings. - shell
- Opens URLs or allow-listed files in the OS default application.
Registered by
crate::App::with_shell_open.
Structs§
- App
- Builder for a fude application.
- Ctx
- Runtime context passed to every command. Provides the app identifier,
the shared
EventEmitterfor server-push events, and the allow-list state ifwith_fs_sandboxwas called. - Main
Dispatcher - Dispatches a closure to run on the main (UI) thread and blocks the
caller until it completes. Required on macOS for native dialogs —
AppKit
NSOpenPanel/NSSavePanel/NSAlertrefuse to run from background threads.
Functions§
- asset_
url_ from_ file - Returns an
asset://URL that streams an allow-listed local file to the webview. Equivalent towindow.__shell_asset_url(path)on the frontend: path is percent-encoded and suffixed ontoasset://localhost/__file/. The file is served only when its canonical path is in theFsStateallow-list at request time; calling this function does not grant access on its own. - ensure_
scratch_ dir - Create and allow-list
<app_data_dir>/<name>. Convenience wrapper aroundensure_scratchfor app-owned scratch directories (e.g."temp-images","cache").
Type Aliases§
- Command
Handler - Handler signature for commands registered via
App::command.