Expand description
Widget packages: user widgets as folders with a widget.json manifest,
which run only once the user approves them
(docs/specs/SPEC_USER_WIDGETS_AND_WIDGET_API_2026_10_09.md §5, §8).
srv scans ~/.agentmux/widgets/ (shared by every channel), validates each
package’s manifest, hashes every file, and keeps this instance’s approval
record. A package’s files are served (/agentmux/widget-files/…) only while
they still hash to what the user approved, checked per file on every read,
so an edit after approval can’t run until it is approved again — whether
or not the folder watcher saw it.
Structs§
- Approval
- Budget 🔒
- What a package may still take while it is copied or unpacked: the limits apply to the bytes actually written, so neither a large folder nor a zip whose header understates its sizes can fill the disk before hash_files.
- Found
- A package found on disk, before approval is applied.
- Inner 🔒
- Manifest
- Manifest
Command - A command palette entry (spec §6.8).
- Manifest
Contributes - Manifest
Pane - Manifest
Status Item - A status bar item (spec §6.8).
- Widget
Command Info - A palette command, as the UI registers it (spec §6.8).
- Widget
Package Info - Widget
Packages - srv’s view of the widgets folder and this instance’s approvals.
- Widget
Pane Info - Widget
Status Item Info - A status bar item, before any pane of the widget updates it.
Enums§
Constants§
- APPROVALS_
FILE 🔒 - MANIFEST_
FILE - MANIFEST_
VERSION - MAX_
COMMANDS - Palette commands and status bar items a package may add (spec §6.8).
- MAX_
PACKAGE_ BYTES - MAX_
PACKAGE_ FILES - MAX_
STATUS_ ITEMS - PERMISSIONS
- Every permission a manifest may ask for (spec §6.4).
net:<origin>is checked separately. - PUBLISHERS_
FILE 🔒 - Publisher → the key its first approved signed package was signed with.
- WIDGET_
CSP - The policy every widget file is served with (spec §6.1).
Statics§
- SERVICE 🔒
Functions§
- content_
type - The content type a widget file is served with.
- copy_
tree 🔒 - describe
- Combine what’s on disk with this instance’s approvals and pins.
- files_
key - The files URL’s unguessable part: HMAC(instance secret, id, hash), so a web page outside AgentMux can’t name a package’s files (they aren’t secret, but nothing else needs them).
- hash_
files - Every file in
dir(relative path → SHA-256 hex), within the limits, with no symlinks.widget.sigat the root is left out: it signs the hash of the rest (SPEC_WIDGET_SHARING_2026_10_10.md §2.1). - implied_
from_ v1 - A v1
widgets.jsonentry with amoduleas an implied trusted package (spec §5.5): its one module file is the package. - install
- Copy the package at
source(a folder, awidget.jsonin one, or a.zip) into the widgets folder; returns its id. Validates first; refuses to replace an existing package unlessreplace. - is_slug 🔒
- package_
hash - The package’s content hash: SHA-256 over each file’s path and hash, in path order. Any change to any file changes it.
- pane_
view 🔒 - The view a pane opens as:
ext:<id>/<name>, or a v1 widget’s own name. - publish
- Tell every UI the package list (Settings → Widgets and the loader follow it).
- put_
in_ 🔒place - Moves the staged package to
dest, or copies it when they’re on different drives. - read_
approvals - refresh
- Scan again, merge the widget bar again, and tell every UI.
- refresh_
off_ thread refreshon a blocking thread: a rescan reads and hashes every file of every package, which mustn’t stall an async worker.- scan
- Every folder in
widgets_dir(a missing folder is none). - service
- start
- Start the service: scan, merge, and watch the widgets folder.
- unzip 🔒
- valid_
icon 🔒 - A Font Awesome name: lowercase letters, digits and
-. - valid_
id - valid_
permission - A permission is a known name, or
net:<origin>:http(s)://host[:port], where host may start with*.(subdomains), never a bare*. - valid_
rel_ 🔒path - A path inside a package: relative,
/-separated, no... - valid_
semver 🔒 - validate
- Check a manifest; the first problem, in words the user can act on.
- validate_
contributions 🔒 contributes.commandsandcontributes.statusItems(spec §6.8).- widget_
entries - The widget-bar entries an approved, enabled package adds, keyed
ext@<id>/<name>(spec §5.4). v1 widgets already have theirs. - widgets_
dir ~/.agentmux/widgets, shared by every channel (spec §3, decision 5).- write_
approvals - yes 🔒