Annex of AGENTS.md. Read this file before touching the slot catalog, the renderer catalog, or ctx.emitContribution. Affects kernel, BFF, UI, and plugin manifests, the sections below say which.
The "Plugin UI Contributions Model" introduces two layers, slot, contribution, for plugins to surface per-node data in the UI without shipping any UI code. Design narrative + decision table live in ROADMAP.md § "UI contribution system". The normative spec is split between spec/view-slots.md (slot catalog), spec/input-types.md (settings catalog), spec/architecture.md § "View contribution system" (kernel surface), and spec/plugin-author-guide.md § "View contributions" (author tutorial).
This annex is the agent-facing operating guide: where each catalog lives, how to extend it safely, what the lint analyzers forbid, and which data-testids the new components carry.
| Layer | Owner | Lives in | Visible to plugin author? |
|---|---|---|---|
| Slot | Spec + kernel + UI (the catalog is normative) | spec/schemas/view-slots.schema.json (catalog enum + payload schemas), src/kernel/types/view-catalog.ts (TSlotName type), ui/src/app/slots/slot-config.ts (SLOT_REGISTRY layout config), ui/src/app/slots/slot-renderer-map.ts (SLOT_RENDERERS 1:1 map) |
Yes, picked by name |
| Contribution | Plugin (per-node payload) | Emitted via ctx.emitContribution(ref, payload) (the declared ui object by reference; kernel recovers the id by object identity, readDeclaredContributionRefs); payload typed by SlotPayload<C['slot']> (generated) + AJV-validated; persisted in scan_contributions |
Yes, plugin authors emit |
The plugin author picks a slot. The slot fixes both the renderer (which Angular component draws) and the payload shape (what AJV validates at emit). There is no separate "contract" abstraction, the slot IS the contract.
19 slots, listed in spec/schemas/view-slots.schema.json#/$defs/SlotName and mirrored in src/kernel/types/view-catalog.ts#TSlotName. Five of them are the inspector.surface.* family (2026-07-23): dedicated single-cardinality slots, one per named UI surface (version, stability, tags, summary, auto-tag), consumed by their own components via surfaceContribution in ui/src/models/node-derived.ts, never mounted by the generic host; they replaced the retired payload-level surface re-homing field on inspector.action.button, and an extension claiming one is generically excluded from the AI-actions launcher rows (no id literals in the UI). To add a new slot:
- Spec first (per
AGENTS.md): add the slot id to the closed enum inview-slots.schema.json, add a$defs.payloads.<slot>schema (or$refto a shared shape), regeneratespec/index.json. - Mirror the type in
src/kernel/types/view-catalog.ts#TSlotName. - UI: add an entry to
SLOT_REGISTRYinui/src/app/slots/slot-config.tswithcardinality,maxItems,order,strategy. Add the slot id to theTSlotIdunion (mirrors the kernel type). Add the renderer mapping inslot-renderer-map.ts#SLOT_RENDERERS. - Mount
<sm-view-contributions-host slot="<new-id>" ...>in the relevant template (inspector / card / graph / topbar). - Document in this annex's table and in
spec/view-slots.md.
| Slot id | Renderer | Mounted in |
|---|---|---|
card.title.right |
NodeIcon | node-card.html (right of title) |
card.subtitle.left |
NodeCounter | node-card.html (subtitle row, left) |
card.footer.left |
NodeCounter | node-card.html (footer left cluster) |
card.footer.right |
NodeCounter | node-card.html (footer right cluster) |
graph.node.alert |
NodeAlert | graph-view.html (corner badge inside [fNode]). Reserved: catalog keeps the surface available for special-case signals, NO built-in core analyzer emits here. Routine "this node has a problem" findings (reference-broken, annotation-field-unknown, schema-violation) ship as chips on card.footer.right instead. See the policy note on the slot entry in ui/src/app/slots/slot-config.ts. |
inspector.header.badge |
NodeBadge | inspector-view.html (unified badge row under title: icon and/or label and/or count, optional severity). Replaces the retired inspector.header.badge.counter / .tag sub-slots. |
inspector.action.button |
NodeActionButton | inspector-view.html (action buttons; click dispatches a kernel Action by qualified id via POST /api/actions/:id). Self-projected by the dispatching Action's own scan-time project(ctx) (deterministic, read-only graph), not by a separate projector Analyzer; the Action computes per-node enabled / prompt options from the graph and is itself the dispatch target. |
inspector.body.panel.breakdown |
NodeBreakdown | inspector-plugin-sections (grouped one section per plugin) |
inspector.body.panel.records |
NodeRecords | inspector-plugin-sections (grouped one section per plugin) |
inspector.body.panel.tree |
NodeTree | inspector-plugin-sections (grouped one section per plugin) |
inspector.body.panel.key-values |
NodeKeyValues | inspector-plugin-sections (grouped one section per plugin) |
inspector.body.panel.link-list |
NodeLinkList | inspector-plugin-sections (grouped one section per plugin) |
inspector.body.panel.markdown |
NodeMarkdown | inspector-plugin-sections (grouped one section per plugin) |
topbar.nav.start |
ScopeStat | app.html (topbar) |
Default order across the catalog (when SLOT_REGISTRY[slot].order === 'alphabetical'): pluginId ASC → extensionId ASC → contributionId ASC. Deterministic. Slots with order: 'priority' sort by the manifest-declared priority (default 100) with alphabetical tie-break.
strategy: 'replace-with-warning' is opt-in by the kernel/UI per slot, never by the plugin. When two plugins compete for a single-cardinality slot: last-load-wins; emit one console warning per slot per scan AND surface it in sm plugins doctor.
One Angular component per slot under ui/src/app/renderers/<renderer-id>/. The renderer id is the historical name of the visual primitive (e.g. node-counter, node-badge); multiple slots may bind to the same renderer (NodeCounter is reused across card.subtitle.left, card.footer.left, and card.footer.right). Mapping lives in ui/src/app/slots/slot-renderer-map.ts:
export const SLOT_RENDERERS: Record<TSlotId, Type<unknown>> = {
'card.title.right': NodeIcon,
'card.subtitle.left': NodeCounter,
'card.footer.left': NodeCounter,
'card.footer.right': NodeCounter,
'graph.node.alert': NodeAlert,
'inspector.header.badge': NodeBadge,
'inspector.action.button': NodeActionButton,
'inspector.body.panel.breakdown': NodeBreakdown,
'inspector.body.panel.records': NodeRecords,
'inspector.body.panel.tree': NodeTree,
'inspector.body.panel.key-values': NodeKeyValues,
'inspector.body.panel.link-list': NodeLinkList,
'inspector.body.panel.markdown': NodeMarkdown,
'topbar.nav.start': ScopeStat,
};The host (view-contributions-host.ts) filters node.contributions[] by c.slot === thisSlot and dispatches via SLOT_RENDERERS[slot]. No per-contract → multi-slot indirection, the slot is the routing key.
To add a new visual primitive (rare, discuss in ROADMAP first):
- Spec change first (
spec/view-slots.md+spec/schemas/view-slots.schema.json); regeneratespec/index.json. - Add the renderer component under
ui/src/app/renderers/<id>/. - Add one or more slot entries to
TSlotName(kernel) +TSlotId(UI) +SLOT_REGISTRY+SLOT_RENDERERS. - Mount the host in the appropriate template.
- Add a conformance fixture under
spec/conformance/cases/. - Update the scaffolder catalog (
VIEW_SLOTS_CATALOGinsrc/cli/commands/plugins/slots-catalog.ts).
Every analyzer that wants to surface a finding on the graph card has TWO independent channels:
Issue(returned fromevaluate(ctx)): a structured record withseverity: 'error' | 'warn' | 'info'. Issues feed the card's aggregated stat indicators (errorCount()/warnCount()inui/src/app/components/node-card/node-card.ts) andsm scan/sm checkexit codes (error→ exit 1, others → exit 0).infoissues are tracked but neither displayed in the card's expanded issues list nor counted in the aggregated stats. They surface only insm show/sm check --json.- View contribution to
card.footer.right(a chip): a payload with optionalseverity: 'info' | 'success' | 'warn' | 'danger'. The chip'sseveritycontrols only the chip's own color, never the aggregated count, never the exit code. A chip withvalue: NshowsNnext to its icon; a chip withvalue: 0renders icon-only.
The two channels are decoupled by design: an analyzer chooses what to emit on each independently. The 4 combinations and what they mean:
| Goal | Emit Issue? | Emit chip? | Issue severity | Chip severity | Visible in card |
|---|---|---|---|---|---|
| Surface a problem AND count it | yes | yes | error or warn |
danger (matches error) or warn (matches warn) |
Chip in footer + adds to the aggregated stat |
Show an attribute without counting (e.g. experimental flag, stale marker) |
no, or info |
yes | info (or none) |
info / success / none (neutral) |
Chip in footer only, no stat impact |
| Count without a dedicated chip | yes | no | error or warn |
(none) | Aggregated stat + entry in the expanded issues list |
| No surface | no | no | (none) | (none) | nothing |
Aggregate severity chips count findings too (read-time BFF sum). The warn / error chips core/issue-counter owns on card.footer.right are the per-card severity total. Since the findings pipeline they sum BOTH provenances: deterministic issues (scan_issues) PLUS the node's unresolved, non-stale findings (state_findings, everything except fixed, so open + human-decision both count, matching the inspector). issue-counter still emits the deterministic component at scan time (so sm scan --json is unchanged); the findings are added at read time by the BFF node decoration (like isFavorite, on /api/nodes AND the /api/scan cold-boot hydration), under issue-counter's own warnCount / errorCount ids, with a provenance-breakdown tooltip. Findings are post-scan (async queue), so the sum can only be computed at read time, this is NOT the banned host-filter anti-pattern (it sums a second real source, it does not silence chips). The card chip is thus the node's TOTAL problem count and may exceed sm check; drill into the inspector for the per-provenance split. Normative: spec/view-slots.md §card.footer.right.
A chip MAY paint warn (yellow) or danger (red) only when the same analyzer also emits a matching Issue:
- chip
severity: 'danger'→ MUST emit at least oneIssuewithseverity: 'error'for the same node - chip
severity: 'warn'→ MUST emit at least oneIssuewithseverity: 'warn'(or'error') for the same node
A purely informational / decorative chip uses severity: 'info', 'success', or omits the field (the renderer pick its neutral default). Concrete examples in the built-ins:
reference-brokenemits Issueerrorper genuinely-dangling link (the aggregatedangerchip is owned bycore/issue-counter). Consistent (red chip backed byerrorissues, counts as error, escalatessm scanto exit 1). Since 2026-07-27 the analyzer is two-tier: a broken@-trigger whose token is code-shaped (@ApiSecurity,@nestjs/swagger, perkernel/util/code-shaped-token.ts) emitswarninstead, feeding the amberwarnCountchip and never the exit code; the danger chip stays backed exclusively byerrorissues, so the policy holds in both tiers.node-stabilityforexperimentalemits chip with no severity (neutral) + Issueinfo. Consistent (chip shows, nothing counts).node-stabilityfordeprecatedemits chipwarn+ Issuewarn. Consistent (yellow chip, counts as warn, no exit-code impact).
The rule is enforced by code review only at present, the analyzer manifest doesn't carry a severity constraint cross-channel. If you author a new analyzer whose chip wants to read as "attention" without producing a finding, choose a neutral colour and use the tooltip for the explanatory text.
The corner slot is reserved (see policy on the graph.node.alert table row above). No built-in core analyzer emits there, and the chip-vs-issue dual-channel decision does not apply: the corner is a single-decoration surface for genuinely independent signals, not a "this node has X findings" mirror. Routine findings always belong on the footer chip.
Renderer components MUST NOT bind contribution data to:
[innerHTML][style](object form or string form)[src]on<img>,<iframe>,<script>,<embed>,<object>[href]on<a>or<link>[srcdoc][formaction],[action]- Any attribute Angular's
DomSanitizerflags asDANGEROUS_ATTR
Use Angular's interpolation {{ }} (auto-sanitized text), [textContent], [attr.title] (auto-sanitized), and [attr.aria-*]. For displaying user-provided URLs (e.g. node-link-list), pass through Router.navigate with the path as a route param, never emit raw [href] from contribution data.
Why: contribution data crosses the plugin/UI trust boundary. An emoji-named, alphabetic icon name from a plugin counter feels harmless until it's <img src="x" onerror="..."> injected via [innerHTML]. Angular's interpolation sanitizes; the listed bindings do not.
The analyzer is enforced via @angular-eslint/template/no-any in .eslintrc for renderer-component templates. Adding a new renderer that needs one of these bindings → discuss in ROADMAP, do not bypass the lint.
(Full text in ROADMAP.md § "UI contribution system" → "Isolation".)
- No raw DOM from plugin, typed data only.
- CSS scoping by Angular view encapsulation; plugin doesn't write CSS.
- Data path namespaced and BFF-enforced (
pluginId↔ namespace). - Click actions are typed kernel verb dispatches by qualified id.
- AJV at three layers: manifest at load, payload at emit, envelope at BFF response.
- Renderer attr-sanitization (see above).
Honest note (extends spec/plugin-kv-api.md:194-200): isolated against accidents, not hostile code, until worker-thread / iframe sandbox post-v1.0.
Follows the existing repo convention (kebab-case, <area>-<element>):
| Component | testid |
|---|---|
<sm-view-contributions-host> (slot host) |
view-contributions-host-<slot-id> with dots replaced by dashes (e.g. view-contributions-host-card-footer-left) |
<sm-view-contributions> (inspector body grouping panel) |
view-contributions |
| Per-renderer root | renderer-<renderer-id> (e.g. renderer-node-counter) |
| Per-contribution rendered instance | contribution-<plugin-id>-<extension-id>-<contribution-id> (sanitized to kebab-case) |
| Empty placeholder | <base>-empty |
| Invalid placeholder | <base>-invalid |
Overflow +N chip |
<base>-overflow |
Two existing components consume the word "contributions", DO NOT collide:
<sm-plugin-contributions>, existing, surfaces sidecar root keys (annotation contributions). Lives atui/src/app/components/plugin-contributions/.<sm-inspector-plugin-sections>, groups theinspector.body.panel.*contributions into one collapsible section per plugin (titled by the trustedpluginId, collapsed by default), ordered by the manifestorderfields. Lives atui/src/app/components/inspector-plugin-sections/. Replaced the former shared "View contributions" drawer and the retiredinspector.body.sectionslot.<sm-view-contributions-host>, generic slot host that filters / sorts / dispatches per slot (card / header / action / graph / topbar mounts). Lives atui/src/app/components/view-contributions-host/.
The two systems are independent: annotation contributions write to the sidecar .sm file; view contributions emit per-node payloads stored in scan_contributions. They share the "plugin contributes data, kernel exposes catalog, UI renders" pattern but never overlap in storage or routing.
The scan_contributions table is NOT pure replace-all like scan_links / scan_issues. The watcher's cached pass leaves the contributions buffer empty for cached nodes (no extract() → no emitContribution); a wipe-all would silently drop their valid prior rows on every watcher boot. The persist runs three passes inside the same tx:
- Orphan sweep, drop rows whose
node_pathis NOT inlivePaths(derived fromresult.nodes). - Catalog sweep, drop rows whose qualified id is NOT in
registeredContributionKeys(derived fromcomposed.extractors + composed.analyzers + composed.actionsviacollectRegisteredContributionKeys; actions are included because an Action with a scan-timeproject()self-projects its own contributions). - Upsert,
INSERT ... ON CONFLICT DO UPDATE SET payload_json = excluded.payload_json, slot = excluded.slotfor every buffer row.
When extending the persist path:
- Pass
livePathsandregisteredContributionKeystoIPersistOptionsso the sweeps activate. Absent / empty values fall back to legacy wipe-all (orphan) and skip-sweep (catalog). - Don't add
replaceAllScanContributions(trx, [])calls outside the sweep flow, empty buffer is the cached-pass case and wiping it is the bug we just fixed.
Full contract in spec/db-schema.md §scan_contributions. Note: column is slot TEXT NOT NULL (mirrors view-slots.schema.json#/$defs/SlotName).
The collection-loader hydrates from /api/scan on F5 / cold boot, that endpoint MUST embed contributions[] per node alongside the standard fields, otherwise the inspector / card slot hosts have nothing to render until the next per-node fetch. The decoration is a single bulk port.contributions.listForPaths(...) round-trip after scans.load(). Bulk /api/nodes and single /api/nodes/:pathB64 already embed via the route-level decorator; /api/scan joined the family explicitly.
Projection layer: ui/src/services/collection-loader.ts:projectNode(api: INodeApi): INodeView MUST copy contributions through. Forgetting to project drops the data silently, any new view-contribution-aware UI surface needs to verify the projection before debugging the host.
| Concern | File |
|---|---|
| Design narrative | ROADMAP.md § "UI contribution system" |
| Decision table | Same section, "Decisions" subsection |
| Slot catalog (normative) | spec/view-slots.md + spec/schemas/view-slots.schema.json |
| Input-type catalog (normative) | spec/input-types.md |
| Kernel surface (normative) | spec/architecture.md § "View contribution system" |
| Persistence shape (normative) | spec/db-schema.md § scan_contributions |
| Author tutorial | spec/plugin-author-guide.md § "View contributions" |
| Slot kernel type | src/kernel/types/view-catalog.ts (TSlotName) |
| Slot UI layout config | ui/src/app/slots/slot-config.ts (SLOT_REGISTRY) |
| Slot → renderer map | ui/src/app/slots/slot-renderer-map.ts (SLOT_RENDERERS) |
| Storage table | src/migrations/001_initial.sql (scan_contributions) |
| BFF envelope | src/server/envelope.ts (contributionsRegistry field) |
| Scaffolder + verbs | src/cli/commands/plugins/create.ts (PluginsCreateCommand), src/cli/commands/plugins/slots.ts (PluginsSlotsListCommand), src/cli/commands/plugins/slots-catalog.ts (catalog constants) |