Namespace DotBoxD.Abstractions
Classes
- CapabilityAttribute
Gates an event property behind a capability. Reading the property from kernel IR contributes
idto the manifest's required capabilities, so a kernel that touches the property only installs under a policy granting it. Unannotated properties stay ungated (default-allow).
- GeneratePluginRegistrationAccumulatorAttribute
Requests a generated client-side registration accumulator for a control type. The generated accumulator queues calls to
methodNameand flushes them in order when the plugin builder starts.
- GeneratePluginRegistrationRootAccumulatorAttribute
Requests a generated root registration accumulator that exposes child accumulators for annotated child control properties.
- GeneratePluginServerAttribute
Requests a generated plugin facade and builder for the annotated partial class.
- GeneratedKernelMethodDescriptorAttribute
Analyzer-visible generated IR for server-authored SDK context
[KernelMethod]helpers.
- GeneratedPluginServerRegistryAttribute
Identifies a generated plugin-server hook or subscription registry and the context type its parameterless
On<TEvent>method uses.
- HandleSubtypeAttribute
Declares one supported subtype for a PolymorphicHandleAttribute handle. The analyzer lowers
handle is T localto{BindingPrefix}.is(key), and instance host-binding calls on the declared subtype receive that key as their leading sandbox argument.
- HookAttribute
Associates a hook context type with a stable hook name and exactly one result type, so
context.Server.Hooks.On<TContext>()can resolve the result type from the context alone (rather than requiring a second generic argument at the call site). The analyzer reads this attribute to validate that a.Register(...)/.RegisterLocal(...)terminal produces ResultType, and persists Name as the runtime hook-point identity.The ResultType must be a readonly partial record struct decorated with HookResultAttribute that declares a
bool Successand astring? Reasonfield (see that attribute for the contract).
- HookResultAttribute
Marks a readonly partial record struct as a hook result: a value a
.Register(...)/.RegisterLocal(...)terminal returns and the host applies. The DotBoxD generator emits builder members the user did not declare manually —Ok(),Reject(string? reason = null), and aWith<Field>(value)per non-discriminator field — so result construction reads fluently and lowers to verifiedrecord.newIR.A hook result must be a top-level readonly partial record struct that declares a
bool Successfield and astring? Reasonfield.Success = falsemeans "abstain, fall through to the next matching registration"; a successful result may still carry a domain veto such asCanDie = false, so abstain and veto never overload the same field.
- HostBindingAttribute
Marks a host-service method as a sandbox binding the DotBoxD.Kernels generator may call from verified kernel IR. A kernel reaches the service through Host<THost>() or through a constructor-injected service field (e.g.
_world.GetHealth(id)); the generator lowers that call to aCallExpression(, recordsbindingId, …)capabilityin the manifest's required capabilities, and addseffectsto the manifest's effects. The host registers a matching binding (same id, capability, and effects) so install-time policy and effect validation gate the call. Set IsAsync when that registered binding declares asynchronous host work.
- HostCapabilityAttribute
Declares the capability and host-state effects required by an analyzer-visible host binding contract.
- KernelMethodAttribute
Marks a reusable helper method whose body the DotBoxD.Kernels generator inlines into the kernel/hook IR at every call site, so plugin authors can factor shared gate/handler logic out of a
Where/Select/Runlambda (or a kernel-classShouldHandle/Handle) without leaving the sandbox. The helper can be a static method, or an instance method called on the generated server-context parameter. For example:server.Hooks.On<MonsterAggroEvent>() .Where((e, ctx) => IsBullying(e.MonsterLevel, e.PlayerLevel)) .Run((e, ctx) => ctx.Messages.Send(e.MonsterId, "calm")); [KernelMethod] public static bool IsBullying(int monsterLevel, int playerLevel) => monsterLevel - playerLevel >= 3;The call lowers exactly as if the body were written inline: each parameter is replaced by its already-lowered argument IR, and any
[HostBinding]calls or[Capability]-gated reads inside the body contribute their capabilities to the calling kernel's manifest.Static helpers may be called through ordinary static-call syntax or extension-method syntax, and named arguments plus supported optional parameter defaults are bound before lowering.
Constraints (verified at generation time; a violation fails the chain/kernel safely rather than miscompiling): the method must be static or called on the server-context parameter, have an expression body or a single
returnstatement, and use types the kernel marshaller can represent in the current lowering surface (scalars, supported nullable scalars, enums, GUIDs, records/DTOs, lists, and maps where that surface supports them). Recursion, generic helpers,ref/out/inparameters, andparamsarrays are not allowed.
- LocalAttribute
Marks a server-authored context helper as native-only and unavailable to lowered IR.
- PolymorphicHandleAttribute
Marks a polymorphic host handle type whose sandbox representation is the scalar value stored in the configured key member. Hook contexts may expose the handle type, while generated verified IR receives only the key and calls host bindings to discriminate or query the concrete host-side entity.
- ServerExtensionAttribute
Marks a class as a server extension: a batch operation the plugin ships as verified IR and the server runs request/response in a single roundtrip, so a loop over many entities executes server-side (calling the host's existing bindings) instead of one network call per entity. The generator lowers the class's single public batch method — its body may use locals, a
foreachover a list parameter, host bindings viactx.Host<T>()or constructor-injected service fields, and may build and return complex objects (records/DTOs) and lists of them. For example:[ServerExtension("monster-killer", typeof(IMonsterKillerService))] public sealed partial class MonsterKillerKernel { private readonly IGameWorld _world; public MonsterKillerKernel(IGameWorld world) => _world = world; public List<KillResult> KillMonsters(List<int> monsterIds, HookContext ctx) { var results = new List<KillResult>(); foreach (var id in monsterIds) results.Add(new KillResult(id, _world.Kill(id))); return results; } } public readonly record struct KillResult(int MonsterId, bool Success);The trailing HookContext parameter is the lowering marker for host bindings (as in a kernel's
Handle) and is not part of the wire signature. Parameters, return type, and DTO fields must use the supported scalar types, lists, or nested DTOs. Supplying the optional service interface type lets the analyzer emit a source-generated plugin-side client that marshals directly to compact server-extension value bytes instead of using a reflection proxy.
- ServerExtensionClientAttribute
Requests a generated C# 14 extension property on
receiverTypethat resolves the source-generated server extension client for this service. The receiver type must expose aServerExtensionsproperty whose value can invoke server extensions and resolve the installed service id.
- ServerExtensionMethodAttribute
Requests a generated C# 14 extension method on
receiverTypethat forwards to the source-generated server extension client. Whennameis omitted, the kernel method name is used; supply a custom name to make the receiver's domain API read naturally or avoid conflicts.
Interfaces
- IExtensibleControl
A domain control that can host plugin-owned server extensions.
- IHookResult
The runtime contract every hook result satisfies so dispatch can apply the abstain/fallthrough rule without reflecting on the concrete type:
Success == falsemeans "abstain, fall through to the next matching registration". The DotBoxD generator adds this interface to every HookResultAttribute record (itsSuccessfield implements the member), so authors never write it by hand.
- ILiveSettingsHandle<TKernel>
Strongly typed live-settings tuner for an installed kernel.
- IPluginEventValueWriter<TEvent>
Optional low-allocation event adapter path. Implement this when event values can be written directly into the runtime input buffer; EventValueCount must match Parameters.
- IPluginServer<TWorld>
Lifecycle and anonymous server-side invocation surface mixed into a generated plugin facade.
- IServerExtensionClientRegistry
Registry used by generated domain controls to resolve server-extension clients.
- IServerExtensionWireClient
Wire client used by generated server-extension proxies.
- IServiceControl
The root plugin-service control verbs exposed by a generated plugin facade.
Enums
- HostBindingEffect
Explicit host-service effects for analyzer-visible auto bindings.
Delegates
- RemoteServerInvocation<TWorld, TCaptures, TReturn>
Lambda shape for the explicit capture-bag invoke overload on IPluginServer<TWorld>.