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
- Found
- A package found on disk, before approval is applied.
- 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§
- 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. - WIDGET_
CSP - The policy every widget file is served with (spec §6.1).
Functions§
- content_
type - The content type a widget file is served with.
- 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). - hash_
files_ except hash_files, leaving outsig_fileat the root instead: another signing domain’s signature file.- 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. - install_
within installfor a package a container agent built in its workspace, whose host folder isroot: every file is read only if it is insideroot. On Unix the copy walks open folders and follows no link (widget::beneath); elsewhere each file is checked as it is opened (see [open_within]).- 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.
- publish
- Tell every UI the package list (Settings → Widgets and the loader follow it).
- read_
approvals - The approvals that read, each on its own: one this build cannot read (a kind a newer AgentMux wrote) is left out of the answer,
not the whole file, and
write_approvalskeeps it on disk as it was. - 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.
- 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*. - validate
- Check a manifest; the first problem, in words the user can act on.
- 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 - Writes
approvals, and keeps every approval already on disk that this build cannot read, exactly as it was. - write_
approvals_ removing write_approvalsfor an uninstall: the approval ofremovedis dropped from the file even when this build cannot read it.