Skip to main content

Module widget_handlers

Module widget_handlers 

Source
Expand description

The widget packages’ RPCs and routes (docs/specs/SPEC_USER_WIDGETS_AND_WIDGET_API_2026_10_09.md §5.2, §8): listing and managing packages, serving an approved package’s files, and the user’s approval, which only the host can carry.

Structs§

WidgetCatalogResult
The widget catalog, checked, with what is installed here (SPEC_WIDGET_SHARING_2026_10_10.md §4.5).
WidgetIdReq
WidgetInstallReq
WidgetInstallResult
WidgetPackagesResult
WidgetReadFileReq
WidgetReadFileResult
WidgetSectionEntryReq
“Pin this section to the widget bar”: the section’s widget-bar entry, added to the user’s widgets.json when no entry opens that section yet (pane-sections.ts).
WidgetSectionEntryResult
WidgetSetEnabledReq

Constants§

SDK_README 🔒
SDK_V1_CSS 🔒
SDK_V1_JS 🔒
The widget SDK and its stylesheet (spec §7), served next to the widgets.
SDK_V1_TYPES 🔒

Functions§

handle_host_widget_approval 🔒
POST /api/v1/host/widget_approval: the user’s answer to an install prompt (spec §8.3), relayed by the CEF host with its own token. The instance auth key, which every agent has, isn’t enough.
handle_widget_file 🔒
GET /agentmux/widget-files/<id>/<hash>/<key>/<path>: an approved, enabled package’s file, as approved (spec §5.2). No auth key: an iframe loads these, and the key segment is what keeps other web pages out.
handle_widget_sdk 🔒
GET /agentmux/widget-sdk/<file>: v1.js and am-widget.css, which a widget’s iframe imports like its own files, and v1.d.ts and README.md, the reference an agent writing a widget reads. No auth.
packages_result 🔒
The list, with the publishers this instance has pinned.
register_widget_handlers
section_entry_key
The widgets.json key for a section’s entry, or why the request can’t make one. Names are lowercase letters, digits and -, with at most one / in the section.
svc 🔒
widgets_catalog 🔒
widgets.catalog: the catalog’s widgets, its signature checked against the key pinned in this AgentMux, each with what is installed here.
widgets_catalog_install 🔒
widgets.catalog.install: download a catalog widget, check it against the (freshly fetched and checked) index, and copy it in. Like any install, it doesn’t run until the user approves it.
widgets_install 🔒
widgets.install: copy a package in. It doesn’t run until the user approves it in the UI (the host-only route below).
widgets_list 🔒
widgets.list: every package and its state.
widgets_read_file 🔒
widgets.readfile: a trusted widget’s module, for the loader. Only the approved version’s bytes, checked like the files route.
widgets_rescan 🔒
widgets.rescan.
widgets_section_entry 🔒
widgets.sectionentry: “Pin this section to the widget bar”. Adds the section’s entry to the user’s widgets.json and applies it before answering, so the bar can pin it at once.
widgets_set_enabled 🔒
widgets.setenabled.
widgets_uninstall 🔒
widgets.uninstall: delete the package folder and its approval. A v1 widget is a widgets.json entry, which stays the user’s to edit.