Relationships
#619 Extension API: allow export const extension to add resource specs, or document that it cannot
Opened by jentz · 6/11/2026· Shipped 6/11/2026
Problem
export const extension (and modelRegistry.extend(type, methods, checks)) lets
an extension add methods and checks to an existing model type, but there is
no documented way to add resources. The documented extend signature has no
resources parameter, the examples show only methods, and the model API note
states "Extensions use the target model's resources/files".
This is a problem when you want to extend a type whose domain you are targeting
but whose declared resources do not fit the new method's output. Concrete case:
adding an audit method to a type that declares a single state resource, where
the audit naturally emits many rows plus a summary (a different output shape).
With no way to declare new resource specs, the options are to overload the
existing resource (semantically wrong, schema mismatch) or to abandon the
extension and build a standalone model — even though the guidance ("extend an
existing type if it covers the domain but lacks the method you need") points at
extension.
A quick check (extending command/shell with an extra method plus a resources
map) suggests the methods are merged onto the target type while a resources
map has no visible effect — but the behavior is undocumented either way.
Proposed solution
Support an optional resources: {...} map on export const extension, merged
into the target type's resources with conflict detection on spec names (mirroring
how checks are added via the third extend parameter).
Alternatives considered
- Build a standalone model with its own resources (works, but defeats the "extend, don't be clever" guidance when the domain is already covered by an existing type).
If unsupported by design
Please document explicitly that extensions cannot add resource specs and that a standalone model is the intended path when a new output shape is needed — the current docs are ambiguous on this point.
Environment
swamp 20260608.234005.0-sha.ed5f78a4.
Shipped
Click a lifecycle step above to view its details.