Core Concepts
Plugins
Plugins are the unit of extension. A plugin subclasses Plugin and contributes into Workbench during register() and boot().
import { Plugin, type Workbench } from "@artisansdk/workbench"
export default class ExamplePlugin extends Plugin {
readonly id = "example"
register(workbench: Workbench) {
// register tools, screens, commands, listeners...
}
}
Every contribution is attributed to the currently running plugin. Calling workbench.tool() or similar outside register() or boot() throws.
Contributions
Workbench exposes several contribution types:
tool: sidebar panel contentscreen: primary content areamodal: overlay contentactivity: icon bar item that can activate a tool, screen, or modalcommand: action for palette-style executionhotkey: keyboard shortcutevent: event class registration for discoverability and deduplication
All contribution IDs must be unique within their type.
Activities
Activities are the top-level navigation model (a mode). They can activate any combination of:
- a screen
- a tool
- a modal
They can also emit an event for behavior that is not covered by direct activation.
workbench.activity({
id: "users",
label: "Users",
icon: <UsersIcon />,
activates: { screen: "users", tool: "user-filters" },
})
Top-placement activities render above the spacer in the icon bar. Bottom-placement activities render below it.
Tools and placement
Tools belong to either the primary or secondary sidebar.
- If
sidebaris omitted, the tool starts inprimary. - If
sidebaris set explicitly, the placement is locked to that target. ordercontrols initial ordering.
Workbench tracks placement separately from the tool definition so sidebars can be reordered or moved at runtime.
Commands and hotkeys
Commands and hotkeys share the same execution model:
event: the common path, dispatching throughworkbench.emit()run: an escape hatch for imperative behavior
Use event when possible. Use run when you need direct method calls or non-event logic.
Events
Workbench exposes its own event bus contract and will fall back to an internal bus when no external bus is provided. If @artisansdk/architect is installed and loadable, Workbench will use Architect’s Bus automatically.
The shell itself ships three core event classes:
SideBarOpenSideBarCloseSideBarToggle
These are registered by the constructor and available even if no plugin adds them.