Web plugin: extension point architecture (following CLI pattern) #80
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Competitor
Kind/Documentation
Kind/Enhancement
Kind/Epic
Kind/Feature
Kind/Security
Kind/Story
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Scope/Core
Scope/Cross-Plugin
Scope/Plugin-System
Scope/Single-Plugin
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ultanio/cobot#80
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The web admin dashboard (#48) needs an architecture that lets plugins contribute panels, routes, and settings. The original PR (#48) used base class methods (
web_panels(),web_settings(),web_routes()) — the same anti-pattern we just fixed for CLI in #75/#78.Lesson from CLI Refactor (#78)
The CLI plugin refactor proved the pattern:
implementsin their PluginMetaregistry.get_implementations()— no base class methods, no raw iterationimplementsedgesProposed: Web Plugin with Extension Points
Web plugin
Extension point contracts
web.panels— contribute a panel to the admin dashboard:web.routes— contribute HTTP routes:web.settings— contribute a settings section:Example: Plugin graph as a web panel
The inspect functionality (now in
PluginRegistry.inspect()via #77) becomes a panel:Or any other plugin could contribute its own panel — wallet shows balance, knowledge shows search, logger shows recent logs, etc.
Web plugin startup flow
Technology choices (from #48)
Acceptance Criteria
webplugin created withextension_points: ["web.panels", "web.routes", "web.settings"]web_panels()/web_settings()/web_routes()on Plugin base classimplements(plugin graph)registry.get_implementations()used for discoveryPluginRegistry.inspect()) shows web contributions asimplementsedgesRelated
PluginRegistry.inspect()Architecture Review: Issue #80 — Web Plugin Extension Points
Verdict: APPROVE ✅
This proposal correctly applies the CLI extension point pattern from #78 to the web admin dashboard. The architecture is sound.
1. Extension Point Design ✅
web.panelsweb.routesweb.settingsSuggestion: Consider defining
TypedDictclasses for the return contracts (likePanelDef,RouteDef) ininterfaces.py. This provides IDE completion and enables static type checking:2. Architecture Fit ✅
extension_pointsdeclaration → plugins useimplements→ discovery viaregistry.get_implementations()— exactly right.toolsplugin aggregates tool definitions.["config"]: Correct — needs config for port/host settings.3. Implementation Concerns ⚠️
Missing from proposal:
Shutdown handling: How does the Starlette server stop gracefully? The
stop()method needs to shutdown uvicorn:Authentication: Admin routes (
/admin/*) need auth. Suggest a config option:And middleware that checks
Authorization: Bearer <token>for/admin/*paths.Error handling: What happens if a plugin's
get_web_routes()raises? Should log and continue, not crash the server.4. Acceptance Criteria ✅
All ACs are testable:
Missing AC (suggest adding):
stop()cleanly shuts down the Starlette server5. Scope Assessment
Verdict: Single Story ✅
This is appropriately scoped. It defines:
webplugin skeleton with extension pointsIt does NOT include:
Recommended follow-up stories:
web: add wallet panel(implementsweb.panels)web: add knowledge panelweb: add logger panelweb: add settings panelsSummary
Approved — proceed with implementation. Address shutdown and auth in the PR.
Reviewed by sub-agent
review-80per Plugin Design Guide principlesGood review. Agreed on all three implementation concerns:
stop()get_web_panels()/get_web_routes()wrapped in try/except, log and skipAlso adding the 2 suggested ACs:
stop()cleanly shuts down StarletteTypedDictfor contracts (PanelDef,RouteDef) — good idea, will add tointerfaces.py.Ready to implement.