Skip to main content

spawn_dedicated_vfs_proxy

Function spawn_dedicated_vfs_proxy 

Source
pub fn spawn_dedicated_vfs_proxy(
    ns: Arc<Namespace>,
    subject: Subject,
) -> Sender<VfsRequest>
Expand description

Build a VFS namespace suitable for ChatApp usage.

Returns (namespace, subject). The namespace contains:

  • /bin/ — cat, ls, help, mount, echo commands (static entries for listing)
  • /env/ — session variable store
  • /srv/model — remote model service mount (if model service is reachable)
  • /lang/tcl — Tcl interpreter state

Note: Actual VFS command execution goes through TclShell builtins via the VFS proxy channel, not through /bin/ ctl files. The /bin/ entries exist for directory listing so ls /bin shows available commands.

Spawn a VFS proxy on a dedicated thread with its own tokio runtime.

The TUI service’s RequestLoop runs on a current_thread runtime inside a LocalSet. Tasks spawned via tokio::spawn on that runtime may not be polled promptly because the LocalSet’s event loop dominates. By running the proxy on its own thread, we guarantee responsiveness regardless of the service’s runtime state.