Plugin UI and Chat Attachments
Status: local plugin panels and structured chat widgets exist. Generic hosted plugin attachments are proposed and still require implementation.
Authoring guide
Use the canonical plugin development guide for the package layout, manifest, tools, state, local UI, and publication flow. The UI and chat attachment contract defines the proposed hosted behavior and delivery plan. Keep contract changes in those documents so this site and plugin templates share one reference.
One plugin, several surfaces
| Surface | Current support | UI approach |
|---|---|---|
| CLI browser workspace | HTML views declared with config.views | Local transport for tools, state, and live updates |
| Web/mobile chat widgets | Structured charts, tables, and other registered widgets | Existing shared chat render packages |
| Hosted interactive plugin in chat | Proposed | Registered view bound to an authorized, durable result |
Reuse domain operations and result schemas across surfaces. Keep environment access in an adapter so a view does not depend on CLI paths or a local token.
Dynamic chat flow
- A plugin tool produces a result with a stable reference and useful summary.
- The main agent chooses a registered view for that result and discussion. A single default view can also be selected deterministically.
- The backend checks the view, result ownership, and enabled deployment, then saves an attachment bound to the assistant message.
- Chat displays a compact preview and can expand the same result.
- UI actions go through the existing authorized executor; updates return to the view. Filtering and expanding need no model call.
This flow is the target architecture. The current upload attachment type is for files and does not yet represent plugin UI.
For hosted MCP plugins, the proposal uses the existing MCP Apps protocol for UI resources and host communication. Bahulam must add the client integration, saved attachment records, and permission binding described in the contract.
Shared UI rules
- Use host theme tokens and consistent typography, spacing, and status colors.
- Fit a narrow chat card; provide an expanded view for large editors or tables.
- Keep the same result and selection when switching display modes.
- Provide loading, empty, error, disconnected, and access-required states.
- Support keyboard use, visible focus, labeled controls, and text alternatives.
- Let the host own attachment controls and approvals.
- Supply a readable fallback and authorized open action for unsupported clients.
The CLI already serves /vendor/bahulam-plugin/bahulam-plugin.css. Hosted UI
must bundle its required assets and receive theme updates through its host
adapter. Loading that local stylesheet alone does not enable hosted chat UI.
Implementation boundary
The agent selects a view and supplies result references. Plugin authors provide the reviewed view code. The host validates data and permissions before loading the registered resource. This design needs no separate rendering model.
Workplane may render rich documents inside a view; it retains its existing document and adapter contracts. Ordinary chat charts and tables can continue using the shared chat renderers.
See the canonical contract for registration examples, persistence/replay, snapshots versus live results, scoped actions, and acceptance criteria.