Plugin contracts
This page lists the Core types a plugin registers through. It covers the plugin interfaces, the composition that assembles them, the registries they fill, and pipeline observation.
Plugin interfaces
The plugin registration contracts live in SheetForge.Core.Plugins. ISheetForgePlugin is the base contract. Every other interface is an opt-in add-on.
| Type | Kind | Role |
|---|---|---|
ISheetForgePlugin | interface | The base domain-plugin contract |
ISheetForgeValidatorPlugin | interface | Validation rules |
ISheetForgeEdgePlugin | interface | Edge declarations |
ISheetForgeMarkerPlugin | interface | Custom structural markers |
ISheetForgeTemplatePlugin | interface | Create sheet templates |
ISheetForgeGraphPlugin | interface | Per-tab Data Studio canvas overrides |
ISheetForgeCodeRegistryPlugin | interface | Code-owned reference targets (locked virtual tabs) |
ISheetForgeThemePlugin | interface | Window color presets |
ISheetForgeStudioPlugin | interface | Declarative authoring surfaces |
ISheetForgeStringsPlugin | interface | The plugin's own UI strings per language |
ISheetForgePipelinePlugin | interface | Pipeline observers |
Interface members
| Type | Members |
|---|---|
ISheetForgePlugin | string Name · RegisterEnums(EnumRegistry) · RegisterCellParsers(CellParserRegistry) |
ISheetForgeValidatorPlugin | RegisterValidators(DomainValidatorRegistry) |
ISheetForgeEdgePlugin | RegisterEdgeContributors(EdgeContributorRegistry) |
ISheetForgeMarkerPlugin | RegisterStructuralMarkers(MarkerRegistry) |
ISheetForgeTemplatePlugin | RegisterTemplates(TemplateRegistry) |
ISheetForgeGraphPlugin | RegisterGraphShapes(GraphShapeRegistry) |
ISheetForgeCodeRegistryPlugin | RegisterCodeRegistries(CodeRegistryCatalog) |
ISheetForgeThemePlugin | RegisterThemes(ThemeRegistry) |
ISheetForgeStudioPlugin | RegisterStudioUi(StudioUiRegistry) |
ISheetForgeStringsPlugin | RegisterStrings(StringOverlayRegistry) |
ISheetForgePipelinePlugin | RegisterPipelineObservers(PipelineObserverRegistry) |
Contracts that reach both hosts
ISheetForgeStudioPlugin registers actions, panels, column badges and cell-editor hints. It lives in Core rather than Editor, so one registration renders in both the UIToolkit editor and the browser.
ISheetForgeStringsPlugin also lives in Core, so a plugin's UI strings reach both hosts. If you upgrade a plugin that used the Editor-side pair ISheetForgeLocPlugin and PluginLocRegistry, port it to ISheetForgeStringsPlugin. That pair is retired, because it could only reach the editor. See Port retired plugin contracts.
Composition and compatibility
These types live in SheetForge.Core.Plugins.
Discovery is per host. The editor uses Unity's TypeCache. The web uses the browser's uploaded-assembly scan.
Everything after discovery is one shared Core function: instantiation, ordering, isolation of plugins from each other and the compatibility gate. The shared function keeps the two hosts from drifting slot by slot.
| Type | Kind | Role |
|---|---|---|
PluginComposition | static class | The single assembly path |
PluginSet | sealed class | The assembled result |
SheetForgePluginCompatAttribute | sealed attribute (assembly) | The compatibility declaration of one plugin assembly |
SheetForgePluginFormat | static class | The generation constants |
PluginComposition
PluginComposition creates one instance per type and casts it to every contract the type implements. It has two members.
| Member | Role |
|---|---|
IReadOnlyList<Type> ContractTypes | The discovery filter |
PluginSet Compose(IReadOnlyList<Type> candidateTypes, string hostVersion, ErrorCollector errors, ICollection<string> failures, Func<string,bool> isProductKey = null) | The assembly call itself |
The order of ContractTypes is fixed, because it decides the order diagnostics appear in.
Diagnostics and failures
Compose keeps two kinds of trouble apart.
| Trouble | Where it goes |
|---|---|
| Registration conflicts and compatibility refusals | Structured diagnostics in errors |
| Implementation bugs, such as a construction failure or a throwing callback | English lines in failures |
Passing null as failures discards those lines.
The product key predicate
The string overlay has a rule: a plugin may not overwrite a product key. The trailing isProductKey predicate enforces that rule without Core ever seeing the language tables. The rule lives in Core, and the host supplies only the material.
If you omit the predicate, only that one rule is skipped.
PluginSet
PluginSet holds twelve slots:
EnumsParsersValidatorsEdgeContributorsMarkersTemplatesGraphShapesCodeRegistriesThemesStringsStudioUiPipelineObservers
A new slot reaches both hosts by being added here.
SheetForgePluginCompatAttribute
The attribute is declared once per assembly:
[assembly: SheetForgePluginCompat(SheetForgePluginFormat.Current, MinHostVersion = "…", PluginVersion = "…")]
| Member | Meaning |
|---|---|
int FormatVersion | The declared generation of the plugin format |
string MinHostVersion | Numeric dotted comparison. Null or empty means no requirement |
string PluginVersion | Display only, never compared |
The attribute is read without instantiating anything.
It is judged per assembly. A refused assembly loses every registration rather than half-loading.
When the attribute is absent, the assembly is read as generation Minimum with no host requirement.
SheetForgePluginFormat
SheetForgePluginFormat holds the generation constants const int Current and const int Minimum.
The number moves only if the plugin format itself is replaced. Purely additive growth keeps the number where it is.
Registries
The registries live in SheetForge.Core.Model, .Validation and .Edges.
| Type | Role |
|---|---|
EnumRegistry | Enum name → CLR type (codegen material) |
CellParserRegistry | Type name → cell parser (open-closed) |
DomainValidatorRegistry | Append-only validator list, order preserved |
EdgeContributorRegistry | Append-only contributor list, order preserved |
MarkerRegistry | Marker name (no @) → custom structural marker |
TemplateRegistry | Create sheet template key → template |
EnumRegistry
Members:
Register<TEnum>()Register(name, memberNames)TryGetMembersTryGetClrTypeNameTryGetClrAssemblyNameRegisteredEnumNames
Three further members need more detail.
| Member | Role |
|---|---|
EnumRegistry(EnumRegistry parent) | Creates a child that reads through to a parent and registers only on itself |
Contains(name) | Looks in its own names, then the parent's. Ordinal |
SetClrTypeName(name, fullTypeName) | Fills in a CLR name after a string-only registration |
The parent holds plugin-registered CLR enums until the next domain reload. The child holds this import's sheet-defined enums. An import therefore never mutates the shared cache.
Registering a name the parent already owns throws rather than shadowing it.
After SetClrTypeName, the assembly name stays empty because the type does not exist yet.
CellParserRegistry
Duplicate registration throws.
Members:
Register(ICellValueParser)TryGetTryGetCustomRendererRegisteredTypeNames
Wrapper types have their own members:
RegisterWrapper(ICellWrapperType)TryGetWrapperRegisteredWrapperNames
Validator and contributor registries
| Type | Members |
|---|---|
DomainValidatorRegistry | Register(IDomainValidator) · Validators |
EdgeContributorRegistry | Register(IEdgeContributor) · Contributors |
MarkerRegistry
Members:
Register(IStructuralMarkerDefinition)TryGetIsEmptyRegisteredMarkerNamesAppendMarkerTokens
Registration throws in three cases:
- The name collides with a built-in marker.
- The name is a duplicate.
- The name is an invalid identifier.
The built-in markers are SheetSyntax.ReservedMarkers: @name, @type, @desc, @overlap, @style, @enum and @loc.
TemplateRegistry
Members:
Register(DataTemplate)TryGetTemplatesIsEmpty
Registration throws in four cases:
- The key is empty or a duplicate.
- The display name is empty.
- The template has zero tabs.
- A tab's TSV is empty.
Create sheet templates
The template types live in SheetForge.Core.Model.
| Type | Role |
|---|---|
DataTemplate | A plugin-registered template |
DataTemplateTab | One tab of a template |
DataTemplate
| Member | Meaning |
|---|---|
string Key | Registry identity |
string DisplayName | Plugin-owned text |
IReadOnlyList<DataTemplateTab> Tabs | One or more tabs |
DataTemplateTab
Members:
string TabNamestring Tsv
string Tsv is a complete normalized TSV. It holds marker rows plus example data.
Plugin UI strings
StringOverlayRegistry lives in SheetForge.Core.Model. It is both the collector and the lookup overlay for plugin-registered UI strings.
Loc.Tr in the editor and t() in the browser consult it before the product tables.
Members:
Register(key, language, value)Register(key, IReadOnlyDictionary<string,string> byLanguage)bool TryGet(key, language, out value)RegisteredKeys
Language matching
language is an IETF code, such as "en", "ko", "zh-Hans" or "pt-BR". It is matched case-insensitively.
Lookup falls back in this order: requested language, English, miss. The fallback lives in the registry, so both hosts answer identically.
Refused registrations
Four registrations are refused. Each refusal records a developer-facing reason rather than failing silently.
- A product built-in key. An overlay may add keys. It never overwrites the product's own sentences or menu paths.
- A key and language that another plugin already registered. The first one found wins, because otherwise install order would decide the screen.
- An empty key or value.
- A language code the product does not know. Such a code is never folded into English.
Pipeline observation
These types live in SheetForge.Core.Plugins and .Model.
| Type | Role |
|---|---|
IPipelineObserver | Read-only notification |
PipelineObserverRegistry | Append-only observer list, order preserved |
PipelineRunView | The immutable snapshot an observer receives |
IPipelineObserver
The interface has one member, void OnImportCompleted(PipelineRunView view). It is called once per explicit import cycle, at the end of the cycle, on success or failure.
An observer only reads. It cannot change what an import produces, because changing values and reporting problems are the jobs of a cell type and of IDomainValidator:
- No hook alters a value or adds a diagnostic.
- No hook runs during the pre-flight, the validation that runs before staged edits are written to the source.
- An exception thrown by an observer is caught, and its reason is collected. The import output is unchanged.
Future observation points arrive as sibling capability interfaces, cast from the registered observer. An implementation written today keeps compiling.
PipelineObserverRegistry
Members:
Register(IPipelineObserver)Observers
PipelineRunView
| Member | Meaning |
|---|---|
Success | The validation result: whether the definition registry was assembled |
Tables | The tabs that parsed |
Diagnostics | The same list the report shows |
The snapshot also has SkippedTabs and EnumTabs.
Success speaks for validation only. Codegen and bake outcomes are read from the diagnostics.
On a failed run, only the tabs that could not be parsed are missing from Tables. No-partial-assembly is a rule about the import's outputs, not about observation.
Collections are copied on construction. The constructor is internal, so no half-built snapshot can be handed to an observer.
Next steps
- Plugin authoring
The contracts in use, with full examples.
- Types and grammar
Custom cell types, grammar constants and asset references.
- Validation and edges
The validator and edge contributor contracts.
- Plugin extension limits
What a plugin cannot extend.