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.
Two runtimes
Section titled “Two runtimes”| 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.
How it works
Section titled “How it works”- The user installs the package, sees the permission list with your reasons (
reason) and grants them. - The host starts the plugin and calls initialization (
init). - 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). - In response the plugin makes operations (
messages.send,storage.set,net.fetch…). - A plugin can free its memory by calling
plugin.unload; the host starts it again on the next event.
Versions
Section titled “Versions”- The Python SDK’s
API_VERSIONis currently 5; the host declares API level 7. The manifest sets the accepted range incompat.api. - The client version is checked against the
compat.freshgramrange, for example>=7.0.0 <8.0.0.
