Optional[symbolThis is optional and used from an index resource to get the correct caller. This is the reason we allow it here as well.
Optional Internal[symbolOrdered isolate declarations preserved across builder composition.
Optional Internal[symbolOrdered subtree declarations preserved across builder composition.
OptionalconfigOptional validation schema for runtime config validation. When provided, resource config will be validated when .with() is called.
OptionalcontextCreate a private, mutable context shared between init, ready,
cooldown, and dispose.
OptionalcooldownCooldown hook for the resource. This runs during shutdown to stop intake quickly before runtime drains in-flight business work.
Keep this fast and non-blocking in intent: trigger ingress stop, capture handles/promises in context, and return promptly. The cooling resource is always allowed as a resource-origin source during the later drain window. Returning additional resource definitions extends that shutdown allowlist.
OptionaldependenciesStatic or lazy dependency map. Receives config when provided.
OptionaldisposeClean-up function for the resource. This is called when the resource is no longer needed.
The value of the resource (undefined if no init method)
The configuration it received
The dependencies it needed
Promise
OptionalhealthOptional async health probe for this resource.
Resources without health are excluded from runtime health reports.
Stable identifier.
OptionalinitInitialize and return the resource value. Called once during boot.
OptionalisolateIsolates this resource boundary, restricting which external definitions can be referenced by this resource and its subtree.
Why: this provides a fail-fast dependency boundary that prevents accidental cross-module wiring, even when visibility rules would otherwise allow it.
OptionalmetaOptional metadata used by docs and tooling.
OptionalmiddlewareMiddleware applied around resource creation.
This affects how initialization is performed and what value the resource resolves to.
It does not wrap ready(), cooldown(), or dispose(), so shutdown behavior should
still be modeled with lifecycle hooks.
OptionaloverridesSafe overrides to swap behavior while preserving identities. See README: Overrides.
OptionalreadyReady hook for the resource. This runs after initialization completes and right before Runner emits the global system ready event.
Use this for startup ingress actions that should begin only after runtime internals are locked and all startup-initialized dependencies are ready.
OptionalregisterRegister other registerables (resources/tasks/middleware/events). Accepts a
static array or a function of config to support dynamic wiring.
OptionalresultOptional validation schema for the resource's resolved value.
When provided, the value will be validated immediately after init resolves,
without considering middleware.
OptionalsubtreeDeclares subtree policies for tasks/resources registered under this resource.
OptionaltagsTags attached to this resource definition.
OptionalthrowsDeclares which typed errors are part of this resource's contract.
This is a declarative contract only:
Use Runner error helpers only.
Declarative resource definition contract.
Resources own lifecycle, subtree registration, and isolation boundaries.