Skip to content

Overview

A freshGram plugin is a package with a manifest.json file and code. The client runs the code in a separate host process (plugins_host) inside a sandbox. The plugin has no direct access to files, network or processes: everything goes through host calls, and each call is checked against the permissions the user granted at install time.

Python Wasm
runtime.kind python wasm
What runs entry (for example main.py) module (for example counter.wasm)
SDK the freshgram package the Rust crate freshgram, the C header freshgram.h, or your own code
When to choose fast start, rich API, UI small size, strict isolation, your own language

A Wasm plugin can be written in anything that builds to wasm32: Rust, C/C++, Zig, Go (TinyGo), AssemblyScript. The host provides exactly one custom import, freshgram.call, and a subset of WASI. See Wasm ABI.

  1. The user installs the package, sees the permission list with your reasons (reason) and grants them.
  2. The host starts the plugin and calls initialization (init).
  3. The client then delivers events to the plugin (a new message, a command, a menu click, a timer). Each event is handled with a timeout (eventTimeoutMs, 500 ms by default).
  4. In response the plugin makes operations (messages.send, storage.set, net.fetch …).
  5. A plugin can free its memory by calling plugin.unload; the host starts it again on the next event.
  • The Python SDK’s API_VERSION is currently 5; the host declares API level 7. The manifest sets the accepted range in compat.api.
  • The client version is checked against the compat.freshgram range, for example >=7.0.0 <8.0.0.