Skip to main content
On this pageFunctions

Block

Functions

assemble

functionsource

inspectBinding

functionsource
/** Returns a Binding's lifecycle registrations and Layer metadata. */
<BindingValue extends Readonly<{
  [ConnectionEvidenceTypeId]: ConnectionEvidence<BindableBlock, unknown, BindingInspection<any, any, any, any>, boolean>
  embedView: (args: readonly Array<any>) => any
  fold: (args: readonly Array<any>) => any
  init: (args: readonly Array<any>) => any
  placement: string
}> & BindingDeliveryEvidence<any, any, any>>(binding: BindingValue): InspectionOfBinding<BindingValue>

makeDefinition

functionsource

makeNamespace

functionsource
/**
 * Creates a shared Block namespace before a generic factory establishes its Model and
 * Message contracts. The returned authoring value is passive configuration.
 */
(id: "" | `${string}/${string}` | `${string}::${string}`): never

<Id extends string>(id: Id & string extends Id
  ? never
  : unknown): Namespace<Id, true>

<Id extends string>(id: Id): Namespace<Id, false>

Types

AnyAuthoredView

typesource
/** Structural bound shared by branded embedded and page-owning views. */
type AnyAuthoredView = (args: ReadonlyArray<any>) => VNode | null | Document & {
  __blockMessage: unknown
  __blockModel: unknown
  __blockMountRequirements: unknown
}

AnyBinding

typesource
/** Structural bound for any child Binding stored by a parent Block. */
type AnyBinding = Readonly<{
  [ConnectionEvidenceTypeId]: ConnectionEvidence<BindableBlock, unknown, BindingInspection<any, any, any, any>, boolean>
  embedView: (args: readonly Array<any>) => any
  fold: (args: readonly Array<any>) => any
  init: (args: readonly Array<any>) => any
  placement: string
}> & BindingDeliveryEvidence<any, any, any>

AnyBlock

typesource
/** Bound for any Block that has passed checked completion. */
type AnyBlock = CompletionProof & Readonly<{
  __blockHandlerRequirements: unknown
  [DefaultViewTypeId]: AnyAuthoredView
  [LocalEffectsLayerTypeId]: AnyLayer
  [LocalMountsTypeId]: ReadonlyArray<Mount.LayeredMountDefinition>
  bindings: ReadonlyArray<AnyBinding>
  EffectsLayer: AnyLayer
  hostHandlers: ReadonlyArray<unknown>
  init: AnyFunction
  makeView: AnyFunction
  managedResources: AnyManagedResources
  Message: AnySchema
  Model: AnySchema
  mounts: ReadonlyArray<Mount.LayeredMountDefinition>
  operations: Readonly<Record<string, AnyFunction>>
  OutMessage: AnySchema
  owner: Owner<any>
  provideHandlers: AnyFunction
  replaceEffectsLayer: AnyFunction
  subscriptions: AnySubscriptions
  update: AnyFunction
}>

AnyBlockView

typesource
/**
 * Structural bound for any branded BlockView, independent of
 *  its Model, Message, and ViewInputs. `h.block` and
 *  BlockConfig constrain their `View` parameter with it so the
 *  concrete types are recovered per call site via the `View*Of`
 *  extractors.
 */
type AnyBlockView = (args: ReadonlyArray<any>) => VNode | null & {
  __blockMessage: unknown
  __blockModel: unknown
  __blockMountRequirements: unknown
}

AnyDocumentView

typesource
/**
 * Structural bound for any branded page-owning DocumentView,
 * independent of its Model, Message, and Mount requirements.
 */
type AnyDocumentView = (args: ReadonlyArray<any>) => Document & {
  __blockMessage: unknown
  __blockModel: unknown
  __blockMountRequirements: unknown
}

AuthoringDefinition

typesource
/**
 * Typed authoring helpers and owned effect declarations before graph
 * registration.
 */
type AuthoringDefinition = Omit<Base<Owner<Id, Concrete>, ModelSchema, MessageSchema, OutMessageSchema, ChildInitContextSchema>, "makeComposition"> & Primitives<Id, MessageSchema["Type"]> & Readonly<{
  makeComposition: AuthoringMakeComposition<Id, ModelSchema, MessageSchema, OutMessageSchema, Concrete, ChildInitContextSchema>
}>

Base

typesource
/**
 * Typed authoring helpers established before the child and Mount graph. Every
 * Definition proceeds through `makeComposition`, including an empty graph.
 */
type Base = Definition<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, readonly [], readonly [], ChildInitContextSchema>

Binding

typesource
/**
 * A registered static or optional child Block in its parent Model and Message
 * context. The Binding is passive until a Runtime starts the composed
 * application.
 */
type Binding = BindingEvidence<BlockValue, Qualify<Placement, HandlerEvidenceOfBlock<BlockValue>>, BindingInspection<{
  readonly [Key in keyof BlockValue["subscriptions"]]: BlockValue["subscriptions"][Key] extends Subscription.Subscription<any, any, infer Dependencies, infer Services>
    ? Subscription.Subscription<ParentModel, ParentMessage, Subscription.GatedDependencies<Dependencies>, Qualify<Placement, Services>> & BlockValue["subscriptions"][Key] extends Readonly<{
      messages: infer Messages
    }>
      ? Readonly<{
        messages: Messages
      }>
      : unknown & BlockValue["subscriptions"][Key] extends Readonly<{
      name: infer Name
      toLayer: infer ToLayer
    }>
      ? Readonly<{
        name: Name
        toLayer: ToLayer
      }>
      : unknown & BlockValue["subscriptions"][Key] extends Readonly<{
      layer: infer EntryLayer
    }>
      ? Readonly<{
        layer: EntryLayer
      }>
      : unknown
    : never
}, {
  readonly [Key in keyof BlockValue["managedResources"]]: BlockValue["managedResources"][Key] extends ManagedResource.Entry<any, any, infer Requirements, infer Value, infer Service, infer OnAcquired, infer LifecycleServices, infer Params>
    ? ManagedResource.Entry<ParentModel, ParentMessage, Requirements, Value, Qualify<Placement, Service>, (args: Parameters<OnAcquired>) => ParentMessage, Qualify<Placement, LifecycleServices>, Params> & BlockValue["managedResources"][Key] extends Readonly<{
      name: infer Name
      toLayer: infer ToLayer
    }>
      ? Readonly<{
        name: Name
        toLayer: ToLayer
      }>
      : unknown & BlockValue["managedResources"][Key] extends Readonly<{
      layer: infer EntryLayer
    }>
      ? Readonly<{
        layer: EntryLayer
      }>
      : unknown
    : never
}, BlockValue["mounts"], Layer.Layer<Qualify<Placement, Layer.Success<BlockValue["EffectsLayer"]>>, Layer.Error<BlockValue["EffectsLayer"]>, Qualify<Placement, Layer.Services<BlockValue["EffectsLayer"]>>>>, false> & BindingDeliveryEvidence<OutgoingMessage, IncomingMessage, GeneratedSchema> & BindingPolicyEvidence<Policy> & Readonly<{
  embedView: BlockValue extends Readonly<{
    [DefaultViewTypeId]: infer CanonicalView
  }>
    ? (config: Omit<BoundBlockFields<View, ParentMessage>, "toParentMessage"> & ValidateEmbeddedViewMounts<BlockValue, View> & [Parameters<View>[0], BlockValue["Model"]["Type"]] extends [BlockValue["Model"]["Type"], Parameters<View>[0]]
      ? [Parameters<unknown>[0], unknown[unknown]["Type"]] extends [unknown[unknown]["Type"], Parameters<unknown>[0]]
        ? unknown
        : never
      : never) => BoundBlockConfig<BoundBlockView<View, Readonly<{
      __blockBindingRequirement: Readonly<{
        block: unknown
        generatedSchema: unknown
        placement: unknown
      }>
    }>>, ParentMessage>
    : (config: Omit<BoundBlockFields<View, ParentMessage>, "toParentMessage"> & ValidateEmbeddedViewMounts<BlockValue, View> & [Parameters<unknown>[0], unknown[unknown]["Type"]] extends [unknown[unknown]["Type"], Parameters<unknown>[0]]
      ? [unknown[unknown], unknown[unknown]] extends [unknown[unknown], unknown[unknown]]
        ? unknown
        : never
      : never) => BoundBlockConfig<BoundBlockView<View, BindingRequirement<Placement, BlockValue>>, ParentMessage>
  fold: (model: Update.GraphInput<ParentModel, BindingRequirement<Placement, BlockValue, GeneratedSchema>>, args: [
    message: BlockValue["Message"]["Type"],
    context: Parameters<BlockValue["update"]> extends readonly [unknown, unknown, ...infer Context]
      ? Context
      : readonly []
  ]) => BindingOperationRecipe<ParentModel, ParentMessage, BlockValue["update"], Policy, Placement, BlockId<BlockValue>, BindingRequirement<Placement, BlockValue, GeneratedSchema>>
  init: BindingInitializer<BlockValue, ParentModel, ParentMessage, Placement, never, false, InitializerMessage, GeneratedSchema>
  placement: Placement
}> & BoundExposedOperations<BlockValue, ParentModel, ParentMessage, Placement, Policy, GeneratedSchema> & OptionalParentBindingContract<ContractModel, ContractMessage, ContractOutMessage>

BindingInspection

typesource
/**
 * Lifecycle registrations and Layer recipe retained by a Binding for
 * composition and tooling.
 */
type BindingInspection = Readonly<{
  EffectsLayer: EffectsLayer
  managedResources: ManagedResources
  mounts: Mounts
  subscriptions: Subscriptions
}>

BindingRequirement

typesource
/**
 * Type-level evidence that an embedded view belongs to one registered Binding
 * placement.
 */
type BindingRequirement = Readonly<{
  __blockBindingRequirement: Readonly<{
    block: BlockValue extends Readonly<{
      mounts: infer Mounts
    }>
      ? Readonly<{
        mountRequirements: () => BlockValue extends Readonly<{
          owner: unknown
        }>
          ? MountRequirementsOf<Mounts>
          : AnyMountHandler
        owner: BlockValue extends Readonly<{
          owner: infer OwnerValue
        }>
          ? OwnerValue
          : unknown
      }>
      : never
    generatedSchema: () => GeneratedSchema
    placement: Placement
  }>
}>

BindingReturn

typesource
/**
 * The readable parent result after applying a child operation and lifting its
 * Commands and OutMessage policy. Operations that cannot emit an OutMessage
 * keep the plain Update.Return contract. Binding projections expose an
 * opaque Update.ResultRecipe until checked composition applies them.
 */
type BindingReturn = Update.WithRegistrationEvidence<[OutMessageOfProducer<ChildProducer>] extends [never]
  ? Update.Return<ParentModel, ParentMessage, Qualify<Placement, Update.RequirementsOf<ChildProducer>>>
  : Policy extends Readonly<{
    fold: (args: ReadonlyArray<any>) => (args: ReadonlyArray<any>) => infer PolicyReturn
  }>
    ? PolicyReturn
    : never extends infer PolicyReturn
    ? Policy extends Readonly<{
      forward: (args: ReadonlyArray<unknown>) => infer ForwardedOutMessage
    }>
      ? Exclude<ForwardedOutMessage, undefined>
      : never | PolicyReturn extends unknown
      ? "outMessage" extends keyof PolicyReturn
        ? PolicyReturn extends Readonly<{
          outMessage: unknown
        }>
          ? Exclude<DerivedOutMessage, undefined>
          : never
        : never
      : never extends infer ParentOutMessage
      ? PolicyReturn extends unknown
        ? "commands" extends keyof PolicyReturn
          ? PolicyReturn extends Readonly<{
            commands: unknown
          }>
            ? NonNullable<unknown> extends ReadonlyArray<unknown>
              ? PolicyCommand
              : never
            : never
          : never
        : never extends infer PolicyCommand
        ? [ParentOutMessage] extends [never]
          ? Update.Return<ParentModel, ParentMessage | PolicyCommand extends Command<unknown, unknown, unknown>
            ? CommandMessage
            : never, Qualify<Placement, Update.RequirementsOf<ChildProducer>> | QualifyOwned<Placement, ChildId, Update.RequirementsOf<() => unknown>>>
          : Update.ReturnWithOutMessage<ParentModel, ParentMessage | PolicyCommand extends Command<unknown, unknown, unknown>
            ? CommandMessage
            : never, ParentOutMessage, Qualify<Placement, Update.RequirementsOf<ChildProducer>> | QualifyOwned<Placement, ChildId, Update.RequirementsOf<() => unknown>>>
        : never
      : never
    : never, Registration | Update.RegistrationEvidenceOf<[OutMessageOfProducer<ChildProducer>] extends [never]
  ? never
  : Policy extends Readonly<{
    fold: (args: ReadonlyArray<any>) => (args: ReadonlyArray<any>) => infer PolicyReturn
  }>
    ? PolicyReturn
    : never>>

BindingWithoutOutMessagePolicy

typesource
/**
 * A full child Binding whose parent-owned OutMessage policy must be selected
 * before Composition registration.
 */
type BindingWithoutOutMessagePolicy = BindChildResultForConfig<BlockValue, ParentModelSchema, ParentMessageSchema, ParentOutMessageSchema, Config & Readonly<{
  outMessage: UnselectedOutMessagePolicy
}>, ChildInitContext> & Readonly<{
  withOutMessagePolicy: WithOutMessagePolicy<BlockValue, ParentModelSchema, ParentMessageSchema, ParentOutMessageSchema, Config, ChildInitContext>
}>

Block

typesource
/**
 * The passive contract produced after a Block definition is completed.
 * It carries the complete local and descendant lifecycle registrations, Layer
 * recipe, exposed operations, and child Bindings needed to install the Block in
 * a parent.
 */
type Block = BlockContract<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children, ImplementationValue> & OutMessageSchema extends Schema.Codec<any, any, any, any>
  ? Readonly<{
    OutMessage: OutMessageSchema
  }>
  : NoOutMessage & ImplementationValue extends Readonly<{
  view: AnyAuthoredView
}>
  ? Readonly<{
    [DefaultViewTypeId]: ImplementationValue["view"]
  }>
  : NoDefaultView

BlockOfBinding

typesource
/** Recovers the completed Block type retained by a Binding. */
type BlockOfBinding = BindingValue extends Readonly<{
  [ConnectionEvidenceTypeId]: Readonly<{
    block: infer BlockValue
  }>
}>
  ? BlockValue
  : never

BoundBlockView

typesource
/**
 * Replaces a view's authored Mount requirements with the capability supplied
 * by its registered child Binding.
 */
type BoundBlockView = BlockView<ViewModelOf<View>, ViewMessageOf<View>, ViewInputsOf<View>, BoundRequirement>

CommandsStep

typesource
/**
 * A Model-preserving Step retaining its Command types and Binding graph
 * obligations, without an OutMessage.
 */
type CommandsStep = (model: Update.GraphInput<Model, Evidence>) => Readonly<{
  commands: ReadonlyArray<CommandValue> & [Evidence] extends [never]
    ? unknown
    : Update.RegistrationEvidence<Evidence>
  model: Model
  outMessage: never
}>

Completed

typesource
/**
 * The completed Block contract retained by a Composition's assembly draft.
 * It derives the exact graph and implementation channels from the Definition
 * and implementation values.
 */
type Completed = DefinitionValue extends Readonly<{
  [LocalMountsTypeId]: infer Mounts
  bindings: infer Children
  Message: infer MessageSchema
  Model: infer ModelSchema
  owner: infer OwnerValue
}>
  ? CompletedImplementationValue<ImplementationValue> extends infer CompletedImplementation
    ? CompletedBlock<OwnerValue, ModelSchema, MessageSchema, DefinitionValue extends Readonly<{
      OutMessage: infer OutMessageSchema
    }>
      ? OutMessageSchema
      : undefined, Mounts, Children, PublicImplementationValue<ModelSchema["Type"], MessageSchema["Type"], CompletedImplementation>>
    : never
  : never

CompletedBlock

typesource
/**
 * Selects the completed Block contract for the Definition's OutMessage and
 * default view capabilities.
 */
type CompletedBlock = OutMessageSchema extends Schema.Codec<any, any, any, any>
  ? ImplementationValue extends Readonly<{
    view: AnyAuthoredView
  }>
    ? CompletedBlockWithViewAndOutMessage<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children, ImplementationValue>
    : CompletedBlockWithOutMessage<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children, ImplementationValue>
  : ImplementationValue extends Readonly<{
    view: AnyAuthoredView
  }>
    ? CompletedBlockWithView<OwnerValue, ModelSchema, MessageSchema, Mounts, Children, ImplementationValue>
    : CompletedBlockWithoutViewOrOutMessage<OwnerValue, ModelSchema, MessageSchema, Mounts, Children, ImplementationValue>

Composition

typesource
/**
 * A passive Definition with its child and Mount graph registered. A Composition
 * supplies graph-aware view authoring and Block completion; it does not build
 * Layers or start child lifecycle work.
 */
type Composition = Pick<Definition<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children>, "owner" | "Model" | "OutMessage" | "mounts" | typeof LocalMountsTypeId | "bindings"> & {
  makeInit: CompositionInit<ModelSchema["Type"], MessageSchema["Type"], Children, DispatchSchemaFor<MessageSchema, Children>["Type"]>
  makeUpdate: DefineCompositionUpdate<ModelSchema["Type"], MessageSchema["Type"], OutMessageSchema extends AnySchema
    ? OutMessageSchema["Type"]
    : never, Children, false, DispatchSchemaFor<MessageSchema, Children>["Type"]>
  makeView: DefineView<OwnerValue, ModelSchema["Type"], DispatchSchemaFor<MessageSchema, Children>["Type"], DefinitionViewRequirements<Mounts, Children>>
  Message: DispatchSchemaFor<MessageSchema, Children>
  prepareBlock: PrepareBlock<OwnerValue, ModelSchema, DispatchSchemaFor<MessageSchema, Children>, OutMessageSchema, Mounts, Children>
}

DefineCompositionUpdate

typesource
/**
 * Authors a Composition update after child Bindings claim their incoming
 * parent Message variants. The callback handles only unclaimed Messages; the
 * returned update accepts the complete parent Message union.
 */
type DefineCompositionUpdate = [CompositionDeliveryErrors<Message, Bindings>] extends [never]
  ? ValidDefineCompositionUpdate<Model, Message, OutMessage, Bindings, PreserveSource, DispatchMessage>
  : CompositionDeliveryErrors<Message, Bindings>

DefineStepFields

typesource
/**
 * Authors a Model-only Step from field transformations. The callback receives
 * the current Model when the Step is applied. Each transformer receives its
 * current field value and must preserve that field's type and the Model's
 * variant constraints. Unknown fields are rejected.
 * 
 * Use Binding operations for child Block transitions. This helper authors
 * changes to the owning Block's fields and returns no Commands or OutMessage.
 */
type DefineStepFields = [Model] extends [ReadonlyArray<unknown>]
  ? never
  : [Model] extends [object]
    ? ObjectStepFields<Extract<Model, object>>
    : never

DefinedStep

typesource
/** The exact operation returned by a Block's `step` authoring helper. */
type DefinedStep = (model: Update.GraphInput<Model, Evidence>, context: Context) => IsAny<DeferredKind> extends true
  ? Update.WithRegistrationEvidence<[OutMessage] extends [never]
    ? Update.Return<Model, Message, R>
    : Update.ReturnWithOutMessage<Model, Message, OutMessage, R>, ResultEvidence>
  : DeferredKind extends "ResultRecipe"
    ? Update.ResultRecipe<Model, Message, OutMessage, R, ResultEvidence>
    : Update.WithRegistrationEvidence<[OutMessage] extends [never]
      ? Update.Return<Model, Message, R>
      : Update.ReturnWithOutMessage<Model, Message, OutMessage, R>, ResultEvidence>

DefinedUpdate

typesource
/** The exact dual update function returned by a Composition's update authoring helper. */
type DefinedUpdate = [Message] extends [never]
  ? (model: Model, message: Message, context: Context) => DefinedUpdateReturn<Model, Message, OutMessage, R, Evidence>
  : (message: Message) => (model: Model, context: Context) => WithRegistrationEvidence<[OutMessage] extends [never]
    ? Return<Model, Message, R>
    : ReturnWithOutMessage<Model, Message, OutMessage, R>, Evidence>

Definition

typesource
/**
 * The passive typed authoring contract created by `Block.makeDefinition`. A Definition
 * owns local identities and Schemas; call `makeComposition` to register child and
 * Mount capabilities before completing the Block.
 */
type Definition = Readonly<{
  bindings: Children
  makeBinding: BindChild<ModelSchema, MessageSchema, OutMessageSchema, ChildInitContextSchema extends AnySchema
    ? ChildInitContextSchema["Type"]
    : never>
  makeCommandsStep: MakeCommandsStep<ModelSchema["Type"], MessageSchema["Type"]>
  makeComposition: MakeComposition<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, ChildInitContextSchema>
  makeFieldsStep: DefineStepFields<ModelSchema["Type"]>
  makeManagedResources: DefineManagedResources<OwnerValue["id"], ModelSchema["Type"], MessageSchema["Type"]>
  makeNoopStep: DefineStepNoop<ModelSchema["Type"]>
  makeOutMessageFold: MakeOutMessageFold<ModelSchema["Type"], MessageSchema["Type"], OutMessageSchema extends Schema.Codec<any, any, any, any>
    ? OutMessageSchema["Type"]
    : never>
  makeStep: DefineStep<ModelSchema["Type"], MessageSchema["Type"], OutMessageSchema extends Schema.Codec<any, any, any, any>
    ? OutMessageSchema["Type"]
    : never>
  makeSubscriptions: DefineSubscriptions<OwnerValue["id"], ModelSchema["Type"], MessageSchema["Type"]>
  Message: MessageSchema
  Model: ModelSchema
  mounts: readonly [...Mounts, ...ReadonlyArray<InspectionOfBinding<unknown[unknown]>["mounts"][number]>]
}> & ChildInitContextSchema extends AnySchema
  ? Readonly<{
    ChildInitContext: ChildInitContextSchema
  }>
  : unknown & OutMessageSchema extends Schema.Codec<any, any, any, any>
  ? Readonly<{
    makeOutMessageForward: MakeOutMessageForward<OutMessageSchema["Type"]>
    makeOutMessageStep: MakeOutMessageStep<ModelSchema["Type"], OutMessageSchema["Type"]>
    OutMessage: OutMessageSchema
  }>
  : NoOutMessage

DefinitionAuthoredView

typesource
/**
 * The authored-view contract accepted by a Composition's completion
 * overloads.
 */
type DefinitionAuthoredView = AnyAuthoredView & Readonly<{
  __blockDefinitionView: Readonly<{
    message: (value: Message) => Message
    model: (value: Model) => Model
    mountRequirements: () => AllowedViewRequirements
    owner: (value: OwnerValue) => OwnerValue
  }>
}>

DefinitionView

typesource
/**
 * The authored-view contract derived from one Block Definition and its
 * registered composition graph.
 */
type DefinitionView = DefinitionAuthoredView<OwnerValue, ModelSchema["Type"], MessageSchema["Type"], DefinitionViewRequirements<Mounts, Children>>

DocumentView

typesource
/**
 * A page-owning view branded with the Model, Message, and Mount requirements
 * of its root Block. Document views cannot be embedded through `h.block`.
 */
type DocumentView = (model: Model, h: HtmlBuilder<Message, RequiredMountRequirements>) => Document & {
  __blockMessage: Message
  __blockModel: Model
  __blockMountRequirements: RequiredMountRequirements
}

FromAssemblyWithOutMessage

typesource
/**
 * Annotates a completed Block with an OutMessage Schema and no default view.
 * 
 * Choose this helper when the Definition declares an OutMessage Schema and
 * `prepareBlock` omits the view. Initialize the annotation with
 * `Block.assemble(prepare)`. Completion preserves the original Model Schema
 * object and every other member without building Layers or starting lifecycle
 * work.
 * 
 * The explicit Model Schema and named producer provide the same TypeScript
 * performance boundary as FromAssemblyWithView.
 * 
 * A producer typed as `any`, or returning `any`, is rejected. A never-returning
 * producer cannot provide a usable Block. Union returns, mutable members, and
 * extra fields are unsupported.
 */
type FromAssemblyWithOutMessage = IsAny<Producer> extends true
  ? never
  : AssemblyWithOutMessage<ModelSchema, Producer>

FromAssemblyWithView

typesource
/**
 * Annotates a completed Block with a default view and no OutMessage Schema.
 * 
 * Choose this helper when `prepareBlock` receives a view and the Definition
 * omits OutMessage. Initialize the annotation with `Block.assemble(prepare)`.
 * Completion preserves the original Model Schema object and every other member
 * without building Layers or starting lifecycle work. Model can stay local to
 * its module while consumers read the completed Block's `Model` member.
 * 
 * Keep the private `prepare` function and explicit annotation together. The
 * annotation exposes the canonical Model Schema directly instead of making a
 * parent Schema infer it through the child's update, view, Bindings, and effects.
 * The function supplies the exact prepared contract for the remaining members,
 * preserving their arguments and requirements. This is a TypeScript performance
 * boundary, not an extra Runtime phase or a guarantee of instantaneous editing.
 * An unannotated `Block.assemble(() => ...)` call is rejected. Use the named
 * producer pattern below so lint can also recognize the checked boundary.
 * 
 * A producer typed as `any`, or returning `any`, is rejected. A never-returning
 * producer cannot provide a usable Block. Union returns, mutable members, and
 * extra fields are unsupported.
 */
type FromAssemblyWithView = IsAny<Producer> extends true
  ? never
  : AssemblyWithView<ModelSchema, Producer>

FromAssemblyWithViewAndOutMessage

typesource
/**
 * Annotates a completed Block with a default view and an OutMessage Schema.
 * 
 * Choose this helper when `prepareBlock` receives a view and the Definition
 * declares an OutMessage Schema. Initialize the annotation with
 * `Block.assemble(prepare)`. Completion preserves the original Model Schema
 * object and every other member without building Layers or starting lifecycle
 * work.
 * 
 * The explicit Model Schema and named producer provide the same TypeScript
 * performance boundary as FromAssemblyWithView.
 * 
 * A producer typed as `any`, or returning `any`, is rejected. A never-returning
 * producer cannot provide a usable Block. Union returns, mutable members, and
 * extra fields are unsupported.
 */
type FromAssemblyWithViewAndOutMessage = IsAny<Producer> extends true
  ? never
  : AssemblyWithViewAndOutMessage<ModelSchema, Producer>

FromAssemblyWithoutViewOrOutMessage

typesource
/**
 * Annotates a completed Block with no default view or OutMessage Schema.
 * 
 * Choose this helper when the Definition omits OutMessage and `prepareBlock`
 * omits the view. Initialize the annotation with `Block.assemble(prepare)`.
 * Completion preserves the original Model Schema object and every other member
 * without building Layers or starting lifecycle work.
 * 
 * The explicit Model Schema and named producer provide the same TypeScript
 * performance boundary as FromAssemblyWithView.
 * 
 * A producer typed as `any`, or returning `any`, is rejected. A never-returning
 * producer cannot provide a usable Block. Union returns, mutable members, and
 * extra fields are unsupported.
 */
type FromAssemblyWithoutViewOrOutMessage = IsAny<Producer> extends true
  ? never
  : AssemblyWithoutViewOrOutMessage<ModelSchema, Producer>

Implementation

typesource
/**
 * The implementation channels accepted by a Block Composition. Use this type
 * with `satisfies` so `prepareBlock` can retain each channel's exact inferred
 * service requirements.
 */
type Implementation = ImplementationChannels<Model, Message, OutMessage, ExposedMessageOperations<Message>>

InitializationPlan

typesource
/**
 * The declarative work returned by a Composition initializer. The parent
 * supplies only its owned Model fields; initialized Bindings supply theirs.
 * Unsupported string fields are rejected rather than silently ignored.
 */
type InitializationPlan = Readonly<{
  commands: ReadonlyArray<Command<Message, never, any>>
  model: ParentOwnedModel<Model, ChildBindings>
  outMessage: never
  steps: ReadonlyArray<InitializationStep<Model, Message, RequirementsOfBindings<ChildBindings>, DispatchMessage>>
}> & ChildInitContextPlan<ChildBindings>

InitializationStep

typesource
/**
 * A parent Model transformation applied after initialized child fields have
 * been assembled. Initialization Steps cannot emit an OutMessage.
 */
type InitializationStep = (model: Update.GraphInput<Model, GraphRequirement>) => Readonly<{
  commands: ReadonlyArray<Command<Message, never, any>>
  model: Model
  outMessage: never
}> | Update.ResultRecipe<Model, DispatchMessage, never, any, unknown>

InspectionOfBinding

typesource
/** The metadata returned by inspectBinding. */
type InspectionOfBinding = BindingValue extends Readonly<{
  [ConnectionEvidenceTypeId]: Readonly<{
    inspection: infer Inspection
  }>
}>
  ? Inspection
  : never

InstanceKey

typesource
/**
 * A stable keyed Binding occurrence identity. Runtime keys must be strings or
 * finite numbers. Numeric zero and negative zero identify the same occurrence,
 * matching JavaScript Map and Set key equality.
 */
type InstanceKey = string | number

KeyedBinding

typesource
/**
 * A registered child collection whose active keys receive independent
 * lifecycle scopes. The Binding is passive until a Runtime starts the composed
 * application.
 */
type KeyedBinding = WithoutBindingEvidence<Omit<Binding<BlockValue, ParentModel, ParentMessage, Placement, Policy>, "placement" | "init" | "fold" | "embedView" | "withOutMessagePolicy" | keyof BlockValue["operations"]>> & BindingEvidence<BlockValue, HandlerRequirementsOfBinding<Binding<BlockValue, ParentModel, ParentMessage, Placement, Policy>>, BindingInspection<Readonly<Record<never, never>>, Readonly<Record<never, never>>, BlockValue["mounts"], Layer.Layer<Qualify, Layer.Error<BlockValue["EffectsLayer"]>, Qualify>>, true> & BindingDeliveryEvidence<OutgoingMessage, IncomingMessage, GeneratedSchema> & Readonly<{
  embedView: KeyedEmbed<BlockValue, ParentMessage, Placement, Key, GeneratedSchema>
  fold: (model: Update.GraphInput<ParentModel, BindingRequirement<Placement, BlockValue, GeneratedSchema>>, key: Key, args: Parameters<Binding<BlockValue, ParentModel, ParentMessage, Placement, Policy>["fold"]> extends readonly [unknown, ...infer Args]
    ? Args
    : never) => BindingOperationRecipe<ParentModel, ParentMessage, BlockValue["update"], Policy, Placement, BlockId<BlockValue>, BindingRequirement<Placement, BlockValue, GeneratedSchema>>
  init: BindingInitializer<BlockValue, ParentModel, ContractMessage, Placement, Key, true, InitializerMessage, GeneratedSchema>
  placement: Placement
}> & KeyedBoundExposedOperations<BlockValue, ParentModel, ParentMessage, Key, Placement, Policy, GeneratedSchema> & [ContractModel] extends [never]
  ? unknown
  : ParentBindingContract<ContractModel, ContractMessage, ContractOutMessage>

KeyedOutMessagePolicy

typesource
/**
 * Defines how a parent handles every OutMessage from one occurrence in a
 * keyed child collection.
 */
type KeyedOutMessagePolicy = Readonly<{
  fold: (key: Key, outMessage: ChildOutMessage, context: Update.FoldContext<ChildMessage, ParentMessage, ParentModel>) => (model: ParentModel) => Readonly<{
    model: ParentModel
  }>
  forward: never
}> | Readonly<{
  fold: (key: Key, outMessage: ChildOutMessage, context: Update.FoldContext<ChildMessage, ParentMessage, ParentModel>) => (model: ParentModel) => Readonly<{
    model: ParentModel
  }>
  forward: (key: Key, outMessage: ChildOutMessage) => unknown | undefined
}>

Namespace

typesource
/**
 * A Block namespace whose owned effects can be declared before a generic
 * factory establishes its Model and Message contracts.
 */
type Namespace = Primitives<Id> & Readonly<{
  makeDefinition: NamespaceMakeDefinition<Id, Concrete>
}>

OperationMessageConstructor

typesource
/** A callable Message variant accepted by a Block's operations record. */
type OperationMessageConstructor = Readonly<{
  ~type.make.in: unknown
  fields: Readonly<Record<string, unknown>>
}> & (args: ReadonlyArray<any>) => Readonly<{
  _tag: string
}>

OutMessagePolicy

typesource
/** Defines how a parent handles every OutMessage from a bound child. */
type OutMessagePolicy = Readonly<{
  fold: (outMessage: ChildOutMessage, context: Update.FoldContext<ChildMessage, ParentMessage, ParentModel>) => OutMessagePolicyStep<ParentModel>
  forward: never
}> | Readonly<{
  fold: (outMessage: ChildOutMessage, context: Update.FoldContext<ChildMessage, ParentMessage, ParentModel>) => OutMessagePolicyStep<ParentModel>
  forward: (outMessage: ChildOutMessage) => unknown | undefined
}>

OutMessageStep

typesource
/**
 * A Step that returns the identical incoming Model and the supplied OutMessage,
 * retaining their exact types without Commands or Service requirements.
 */
type OutMessageStep = (model: Current) => Readonly<{
  commands: never
  model: Current
  outMessage: OutMessage
}>

OwnedSubscriptionRegistry

typesource
/** An owned Subscription registry with an aggregate Layer when every entry has an attached handler. */
type OwnedSubscriptionRegistry = OwnedSubscriptionEntries<Entries, Model, Message> & Subscription.Registry<OwnedSubscriptionEntries<Entries, Model, Message>> & MaybeSubscriptionRegistryLayer<Entries>

Primitives

typesource
/** Effect declaration helpers scoped to one Block identity. */
type Primitives = Readonly<{
  makeCommand: DefineCommand<Id, Message>
  makeMount: DefineMount<Id, Message>
  makeMountStream: DefineMountStream<Id, Message>
  makeResource: DefineResource<Id>
}>

Qualify

typesource
/**
 * Qualifies Foldkit handler and resource capabilities with a Binding path while
 * retaining ordinary Effect Services unchanged.
 */
type Qualify = Requirements extends Scoped<infer ChildPath, infer Contract>
  ? Scoped<`${Path}/${ChildPath}`, Contract>
  : [LocalCapability<Requirements>] extends [never]
    ? Requirements
    : Scoped<Path, Requirements>

RefineViewInputs

typesource
/**
 * Refines an authored generic view's per-render inputs while preserving its
 * definition owner, Model, Message, and View requirements.
 */
type RefineViewInputs = View extends Readonly<{
  __blockDefinitionView: Readonly<{
    message: (value: infer Message) => unknown
    model: (value: infer Model) => unknown
    mountRequirements: () => infer RequiredViewRequirements
  }>
  __blockViewOwner: infer OwnerValue
}>
  ? OwnedAuthoredView<BlockView<Model, Message, AuthoredViewInputs<ViewInputs>, RequiredViewRequirements>, OwnerValue, Model, Message, RequiredViewRequirements>
  : never

RequirementOfBinding

typesource
/** Recovers the registered view capability requirement for one Binding. */
type RequirementOfBinding = BindingValue extends Readonly<{
  [ConnectionEvidenceTypeId]: Readonly<{
    block: infer BlockValue
  }>
  placement: infer Placement
}>
  ? BindingRequirement<Placement, BlockValue, BindingValue extends BindingDeliveryEvidence<any, any, infer Generated>
    ? Generated
    : never>
  : never

RequirementsOfBindings

typesource
/** Collects the registered view capability requirements of child Bindings. */
type RequirementsOfBindings = RequirementOfBinding<Bindings[number]>

SelectedChildBinding

typesource
/** A fully usable child Binding with an exact selected OutMessage policy. */
type SelectedChildBinding = BindChildResultForConfig<BlockValue, ParentModelSchema, ParentMessageSchema, ParentOutMessageSchema, Config & Readonly<{
  outMessage: Policy
}>, ChildInitContext> & Readonly<{
  withOutMessagePolicy: WithOutMessagePolicy<BlockValue, ParentModelSchema, ParentMessageSchema, ParentOutMessageSchema, Config, ChildInitContext>
}>

ValidateConcreteComposition

typesource
/**
 * Validates composition details that remain deferred until a generic Block
 * factory produces a concrete completed Block.
 */
type ValidateConcreteComposition = Composition["owner"] extends Owner<string, true>
  ? unknown
  : Composition["owner"] extends Owner<string, false>
    ? ValidateFullComposition<Composition>
    : unknown

ValidateEmbeddedViewMounts

typesource
/**
 * Validates that an alternate embedded view uses only Mount and child
 * capabilities registered by its Block's Composition.
 */
type ValidateEmbeddedViewMounts = [Exclude<ViewMountRequirementsOf<View>, DefinitionViewMountRequirements<BlockValue>>] extends [never]
  ? unknown
  : never

View

typesource
/**
 * A child view branded with its Model, Message, and registered capabilities.
 * Author the primary view through a named Composition, including an empty graph:
 * 
 * ```ts
 * export const CounterComposition = Counter.makeComposition()
 * 
 * export const view = CounterComposition.makeView((model, h) =>
 *   h.button([h.OnClick(Message.ClickedIncrement())], [globalThis.String(model.count)]),
 * )
 * ```
 * 
 * Use `makeView.withInputs` for data supplied at the embedding site:
 * 
 * ```ts
 * export const view = CounterComposition.makeView.withInputs<ViewInputs>(
 *   (model, viewInputs, h) =>
 *     h.button([h.OnClick(Message.ClickedIncrement())], [viewInputs.label, globalThis.String(model.count)]),
 * )
 * ```
 * 
 * Complete that Composition with the view, then embed the Block through a
 * registered Binding. Plain functions cannot enter `h.block` directly.
 */
type View = [ViewInputs] extends [void]
  ? (model: Model, h: HtmlBuilder<Message, RequiredMountRequirements>) => VNode | null
  : (model: Model, viewInputs: ViewInputs, h: HtmlBuilder<Message, RequiredMountRequirements>) => VNode | null & {
  __blockMessage: Message
  __blockModel: Model
  __blockMountRequirements: RequiredMountRequirements
}

ViewBuilderFor

typesource
/**
 * The `HtmlBuilder` type supplied by a Block or Application Composition.
 * Pass `typeof SearchComposition` to retain that Composition's Message,
 * registered child, and Mount capabilities in extracted view helpers. This
 * type constructs nothing at runtime.
 * 
 * Declare an owner-specific alias immediately after the Composition, such as
 * `SearchViewBuilder` for `SearchComposition`, and export it only when another
 * file uses it. The primary Composition view infers its builder parameter.
 */
type ViewBuilderFor = CompositionValue extends Readonly<{
  [LocalMountsTypeId]: infer Mounts
  bindings: infer Children
  Message: Readonly<{
    Type: infer Message
  }>
}>
  ? HtmlBuilder<Message, DefinitionViewRequirements<Mounts, Children>>
  : never

ViewMountRequirementsOf

typesource
/** Extracts the Mount requirements carried by a branded Block view. */
type ViewMountRequirementsOf = View extends {
  __blockMountRequirements: infer Requirements
}
  ? Requirements
  : never

Interfaces

AssemblyDraft

interfacesource
/**
 * An opaque assembly awaiting `Block.assemble`. Its completed
 * contract is available only after the checked Model and producer boundary.
 */
interface AssemblyDraft {
  [AssemblyDraftTypeId]: Completed
}

AssemblyWithOutMessage

interfacesource
/**
 * Gives emitted declarations a public name for an assembly with an OutMessage Schema and no default view.
 * 
 * Use FromAssemblyWithOutMessage for application annotations. That checked
 * alias also rejects a producer typed as `any`; this interface supports inferred
 * declarations that refer to the completed Block.
 */
interface AssemblyWithOutMessage {
  __blockHandlerRequirements: ProducedMember<Producer, "__blockHandlerRequirements">
  [CompletionTypeId]: true
  [DefaultViewTypeId]: undefined
  [LocalEffectsLayerTypeId]: ProducedMember<Producer, typeof LocalEffectsLayerTypeId>
  [LocalMountsTypeId]: ProducedMember<Producer, typeof LocalMountsTypeId>
  bindings: ProducedMember<Producer, "bindings">
  EffectsLayer: ProducedMember<Producer, "EffectsLayer">
  hostHandlers: ProducedMember<Producer, "hostHandlers">
  init: ProducedMember<Producer, "init">
  makeView: ProducedMember<Producer, "makeView">
  managedResources: ProducedMember<Producer, "managedResources">
  Message: ProducedMember<Producer, "Message">
  Model: ModelSchema
  mounts: ProducedMember<Producer, "mounts">
  operations: ProducedMember<Producer, "operations">
  OutMessage: ProducedMember<Producer, "OutMessage">
  owner: ProducedMember<Producer, "owner">
  provideHandlers: ProducedMember<Producer, "provideHandlers">
  replaceEffectsLayer: ProducedMember<Producer, "replaceEffectsLayer">
  subscriptions: ProducedMember<Producer, "subscriptions">
  update: ProducedMember<Producer, "update">
}

AssemblyWithView

interfacesource
/**
 * Gives emitted declarations a public name for an assembly with a default view and no OutMessage Schema.
 * 
 * Use FromAssemblyWithView for application annotations. That checked
 * alias also rejects a producer typed as `any`; this interface supports inferred
 * declarations that refer to the completed Block.
 */
interface AssemblyWithView {
  __blockHandlerRequirements: ProducedMember<Producer, "__blockHandlerRequirements">
  [CompletionTypeId]: true
  [DefaultViewTypeId]: ProducedMember<Producer, typeof DefaultViewTypeId>
  [LocalEffectsLayerTypeId]: ProducedMember<Producer, typeof LocalEffectsLayerTypeId>
  [LocalMountsTypeId]: ProducedMember<Producer, typeof LocalMountsTypeId>
  bindings: ProducedMember<Producer, "bindings">
  EffectsLayer: ProducedMember<Producer, "EffectsLayer">
  hostHandlers: ProducedMember<Producer, "hostHandlers">
  init: ProducedMember<Producer, "init">
  makeView: ProducedMember<Producer, "makeView">
  managedResources: ProducedMember<Producer, "managedResources">
  Message: ProducedMember<Producer, "Message">
  Model: ModelSchema
  mounts: ProducedMember<Producer, "mounts">
  operations: ProducedMember<Producer, "operations">
  OutMessage: undefined
  owner: ProducedMember<Producer, "owner">
  provideHandlers: ProducedMember<Producer, "provideHandlers">
  replaceEffectsLayer: ProducedMember<Producer, "replaceEffectsLayer">
  subscriptions: ProducedMember<Producer, "subscriptions">
  update: ProducedMember<Producer, "update">
}

AssemblyWithViewAndOutMessage

interfacesource
/**
 * Gives emitted declarations a public name for an assembly with a default view and an OutMessage Schema.
 * 
 * Use FromAssemblyWithViewAndOutMessage for application annotations. That checked
 * alias also rejects a producer typed as `any`; this interface supports inferred
 * declarations that refer to the completed Block.
 */
interface AssemblyWithViewAndOutMessage {
  __blockHandlerRequirements: ProducedMember<Producer, "__blockHandlerRequirements">
  [CompletionTypeId]: true
  [DefaultViewTypeId]: ProducedMember<Producer, typeof DefaultViewTypeId>
  [LocalEffectsLayerTypeId]: ProducedMember<Producer, typeof LocalEffectsLayerTypeId>
  [LocalMountsTypeId]: ProducedMember<Producer, typeof LocalMountsTypeId>
  bindings: ProducedMember<Producer, "bindings">
  EffectsLayer: ProducedMember<Producer, "EffectsLayer">
  hostHandlers: ProducedMember<Producer, "hostHandlers">
  init: ProducedMember<Producer, "init">
  makeView: ProducedMember<Producer, "makeView">
  managedResources: ProducedMember<Producer, "managedResources">
  Message: ProducedMember<Producer, "Message">
  Model: ModelSchema
  mounts: ProducedMember<Producer, "mounts">
  operations: ProducedMember<Producer, "operations">
  OutMessage: ProducedMember<Producer, "OutMessage">
  owner: ProducedMember<Producer, "owner">
  provideHandlers: ProducedMember<Producer, "provideHandlers">
  replaceEffectsLayer: ProducedMember<Producer, "replaceEffectsLayer">
  subscriptions: ProducedMember<Producer, "subscriptions">
  update: ProducedMember<Producer, "update">
}

AssemblyWithoutViewOrOutMessage

interfacesource
/**
 * Gives emitted declarations a public name for an assembly with no default view or OutMessage Schema.
 * 
 * Use FromAssemblyWithoutViewOrOutMessage for application annotations. That checked
 * alias also rejects a producer typed as `any`; this interface supports inferred
 * declarations that refer to the completed Block.
 */
interface AssemblyWithoutViewOrOutMessage {
  __blockHandlerRequirements: ProducedMember<Producer, "__blockHandlerRequirements">
  [CompletionTypeId]: true
  [DefaultViewTypeId]: undefined
  [LocalEffectsLayerTypeId]: ProducedMember<Producer, typeof LocalEffectsLayerTypeId>
  [LocalMountsTypeId]: ProducedMember<Producer, typeof LocalMountsTypeId>
  bindings: ProducedMember<Producer, "bindings">
  EffectsLayer: ProducedMember<Producer, "EffectsLayer">
  hostHandlers: ProducedMember<Producer, "hostHandlers">
  init: ProducedMember<Producer, "init">
  makeView: ProducedMember<Producer, "makeView">
  managedResources: ProducedMember<Producer, "managedResources">
  Message: ProducedMember<Producer, "Message">
  Model: ModelSchema
  mounts: ProducedMember<Producer, "mounts">
  operations: ProducedMember<Producer, "operations">
  OutMessage: undefined
  owner: ProducedMember<Producer, "owner">
  provideHandlers: ProducedMember<Producer, "provideHandlers">
  replaceEffectsLayer: ProducedMember<Producer, "replaceEffectsLayer">
  subscriptions: ProducedMember<Producer, "subscriptions">
  update: ProducedMember<Producer, "update">
}

AuthoringMakeComposition

interfacesource
/**
 * Registers the child and Mount graph for init, update and view authoring. This step only records composition; it does not construct Layers or
 * start lifecycle work.
 */
interface AuthoringMakeComposition unknown

BindChild

interfacesource
/**
 * Creates a child Binding before selecting its exact parent-owned policy with
 * `withOutMessagePolicy`.
 */
interface BindChild unknown

BindingInitRecipe

interfacesource
/**
 * A passive, noncallable child initialization recipe returned by
 * BindingInitializer. It retains the child init arguments, optional
 * keyed identity, parent Model constructor, appended parent Commands, and their
 * requirements without initializing the child eagerly.
 * 
 * Return it intact from a matching Composition `makeInit` or `makeUpdate`
 * callback. A Definition-owned Step preserves or wraps it. An exposed Message
 * can reach an update branch that returns the recipe, and the completed
 * operation interprets that update result. The recipe exposes no `.model` or
 * `.commands` fields.
 */
interface BindingInitRecipe {
  [BindingInitRecipeTypeId]: true
  [BindingInitRecipeTypesTypeId]: readonly [Model, Message, R, Evidence]
  [DeferredUpdateEvidenceTypeId]: readonly [() => Model, () => Message, () => R, () => Evidence]
}

BindingInitializer

interfacesource
/**
 * Creates a passive, noncallable child initialization recipe.
 * 
 * It retains the child init arguments, optional keyed identity, parent Model
 * constructor, appended parent Commands, and their requirements without
 * initializing the child eagerly. Return it intact from a matching Composition
 * `makeInit` or `makeUpdate` callback. A Definition-owned Step preserves or
 * wraps it. An exposed Message can reach an update branch that returns the
 * recipe, and the completed operation interprets that update result. The recipe
 * exposes no `.model` or `.commands` fields.
 * 
 * The constructed parent must match its Model Schema and select the initialized
 * child through the Binding's storage accessors.
 */
interface BindingInitializer unknown

CompletedBlockWithOutMessage

interfacesource
/**
 * A completed Block with an OutMessage Schema and no default view. The
 * contract retains its exact lifecycle registrations, child graph, Layer
 * recipe, host handler requirements, and exposed operations.
 */
interface CompletedBlockWithOutMessage {
  [CompletionTypeId]: true
  [DefaultViewTypeId]: undefined
  bindings: Children
  EffectsLayer: CompleteEffectsLayer<ImplementationValue["EffectsLayer"], Children>
  hostHandlers: ImplementationHostHandlers<ImplementationValue>
  init: ImplementationValue["init"]
  makeView: DefineView<OwnerValue, ModelSchema["Type"], MessageSchema["Type"], DefinitionViewRequirements<Mounts, Children>>
  managedResources: ImplementationManagedResources<ImplementationValue> & MergeRecords<Children, "managedResources">
  Message: MessageSchema
  Model: ModelSchema
  mounts: readonly [Mounts, InspectionOfBinding<Children[number]>["mounts"][number]]
  operations: ImplementationExposedOperations<ImplementationValue>
  OutMessage: OutMessageSchema
  provideHandlers: [ImplementationHostHandlers<ImplementationValue>[number]] extends [never]
    ? never
    : (HandlersLayer: HandlersLayer & ValidateProvidedHandlers<ImplementationValue, HandlersLayer>) => Block<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children, Readonly<{
      [Key in string | number | symbol]: Key extends "EffectsLayer"
        ? MergeLayers<ImplementationValue["EffectsLayer"], HandlersLayer>
        : Key extends "hostHandlers"
          ? readonly []
          : Key extends keyof ImplementationValue
            ? ImplementationValue[Key]
            : never
    }>>
  replaceEffectsLayer: ReplaceEffectsLayer<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children, ImplementationValue>
  subscriptions: ImplementationSubscriptions<ImplementationValue> & MergeRecords<Children, "subscriptions">
  update: ImplementationValue["update"]
}

CompletedBlockWithView

interfacesource
/**
 * A completed Block with a default view and no OutMessage Schema. The
 * contract retains its exact lifecycle registrations, child graph, Layer
 * recipe, host handler requirements, exposed operations, and view inputs.
 */
interface CompletedBlockWithView {
  [CompletionTypeId]: true
  [DefaultViewTypeId]: ImplementationValue["view"]
  bindings: Children
  EffectsLayer: CompleteEffectsLayer<ImplementationValue["EffectsLayer"], Children>
  hostHandlers: ImplementationHostHandlers<ImplementationValue>
  init: ImplementationValue["init"]
  makeView: DefineView<OwnerValue, ModelSchema["Type"], MessageSchema["Type"], DefinitionViewRequirements<Mounts, Children>>
  managedResources: ImplementationManagedResources<ImplementationValue> & MergeRecords<Children, "managedResources">
  Message: MessageSchema
  Model: ModelSchema
  mounts: readonly [Mounts, InspectionOfBinding<Children[number]>["mounts"][number]]
  operations: ImplementationExposedOperations<ImplementationValue>
  OutMessage: undefined
  provideHandlers: [ImplementationHostHandlers<ImplementationValue>[number]] extends [never]
    ? never
    : (HandlersLayer: HandlersLayer & ValidateProvidedHandlers<ImplementationValue, HandlersLayer>) => Block<OwnerValue, ModelSchema, MessageSchema, undefined, Mounts, Children, Readonly<{
      [Key in string | number | symbol]: Key extends "EffectsLayer"
        ? MergeLayers<ImplementationValue["EffectsLayer"], HandlersLayer>
        : Key extends "hostHandlers"
          ? readonly []
          : Key extends keyof ImplementationValue
            ? ImplementationValue[Key]
            : never
    }>>
  replaceEffectsLayer: ReplaceEffectsLayer<OwnerValue, ModelSchema, MessageSchema, undefined, Mounts, Children, ImplementationValue>
  subscriptions: ImplementationSubscriptions<ImplementationValue> & MergeRecords<Children, "subscriptions">
  update: ImplementationValue["update"]
}

CompletedBlockWithViewAndOutMessage

interfacesource
/**
 * A completed Block with an OutMessage Schema and a default view. The
 * contract retains its exact lifecycle registrations, child graph, Layer
 * recipe, host handler requirements, exposed operations, and view inputs.
 */
interface CompletedBlockWithViewAndOutMessage {
  [CompletionTypeId]: true
  [DefaultViewTypeId]: ImplementationValue["view"]
  bindings: Children
  EffectsLayer: CompleteEffectsLayer<ImplementationValue["EffectsLayer"], Children>
  hostHandlers: ImplementationHostHandlers<ImplementationValue>
  init: ImplementationValue["init"]
  makeView: DefineView<OwnerValue, ModelSchema["Type"], MessageSchema["Type"], DefinitionViewRequirements<Mounts, Children>>
  managedResources: ImplementationManagedResources<ImplementationValue> & MergeRecords<Children, "managedResources">
  Message: MessageSchema
  Model: ModelSchema
  mounts: readonly [Mounts, InspectionOfBinding<Children[number]>["mounts"][number]]
  operations: ImplementationExposedOperations<ImplementationValue>
  OutMessage: OutMessageSchema
  provideHandlers: [ImplementationHostHandlers<ImplementationValue>[number]] extends [never]
    ? never
    : (HandlersLayer: HandlersLayer & ValidateProvidedHandlers<ImplementationValue, HandlersLayer>) => Block<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children, Readonly<{
      [Key in string | number | symbol]: Key extends "EffectsLayer"
        ? MergeLayers<ImplementationValue["EffectsLayer"], HandlersLayer>
        : Key extends "hostHandlers"
          ? readonly []
          : Key extends keyof ImplementationValue
            ? ImplementationValue[Key]
            : never
    }>>
  replaceEffectsLayer: ReplaceEffectsLayer<OwnerValue, ModelSchema, MessageSchema, OutMessageSchema, Mounts, Children, ImplementationValue>
  subscriptions: ImplementationSubscriptions<ImplementationValue> & MergeRecords<Children, "subscriptions">
  update: ImplementationValue["update"]
}

CompletedBlockWithoutViewOrOutMessage

interfacesource
/**
 * A completed Block with neither an OutMessage Schema nor a default view. The
 * contract retains its exact lifecycle registrations, child graph, Layer
 * recipe, host handler requirements, and exposed operations.
 */
interface CompletedBlockWithoutViewOrOutMessage {
  [CompletionTypeId]: true
  [DefaultViewTypeId]: undefined
  bindings: Children
  EffectsLayer: CompleteEffectsLayer<ImplementationValue["EffectsLayer"], Children>
  hostHandlers: ImplementationHostHandlers<ImplementationValue>
  init: ImplementationValue["init"]
  makeView: DefineView<OwnerValue, ModelSchema["Type"], MessageSchema["Type"], DefinitionViewRequirements<Mounts, Children>>
  managedResources: ImplementationManagedResources<ImplementationValue> & MergeRecords<Children, "managedResources">
  Message: MessageSchema
  Model: ModelSchema
  mounts: readonly [Mounts, InspectionOfBinding<Children[number]>["mounts"][number]]
  operations: ImplementationExposedOperations<ImplementationValue>
  OutMessage: undefined
  provideHandlers: [ImplementationHostHandlers<ImplementationValue>[number]] extends [never]
    ? never
    : (HandlersLayer: HandlersLayer & ValidateProvidedHandlers<ImplementationValue, HandlersLayer>) => Block<OwnerValue, ModelSchema, MessageSchema, undefined, Mounts, Children, Readonly<{
      [Key in string | number | symbol]: Key extends "EffectsLayer"
        ? MergeLayers<ImplementationValue["EffectsLayer"], HandlersLayer>
        : Key extends "hostHandlers"
          ? readonly []
          : Key extends keyof ImplementationValue
            ? ImplementationValue[Key]
            : never
    }>>
  replaceEffectsLayer: ReplaceEffectsLayer<OwnerValue, ModelSchema, MessageSchema, undefined, Mounts, Children, ImplementationValue>
  subscriptions: ImplementationSubscriptions<ImplementationValue> & MergeRecords<Children, "subscriptions">
  update: ImplementationValue["update"]
}

CompletedWithView

interfacesource
/**
 * A completed Block derived from a Definition and implementation that publish
 * a default view without an OutMessage Schema.
 */
interface CompletedWithView {
  [CompletionTypeId]: true
  [DefaultViewTypeId]: CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["view"]
  bindings: CompletedWithViewArgument
  EffectsLayer: CompleteEffectsLayer<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["EffectsLayer"], CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">>
  hostHandlers: ImplementationHostHandlers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>
  init: CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["init"]
  makeView: DefineView<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "OwnerValue">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ModelSchema">["Type"], CompletedWithViewArgument<DefinitionValue, ImplementationValue, "MessageSchema">["Type"], DefinitionViewRequirements<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">>>
  managedResources: ImplementationManagedResources<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">> & MergeRecords<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, "managedResources">
  Message: CompletedWithViewArgument
  Model: CompletedWithViewArgument
  mounts: readonly [CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, InspectionOfBinding<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">[number]>["mounts"][number]]
  operations: ImplementationExposedOperations<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>
  OutMessage: undefined
  provideHandlers: [ImplementationHostHandlers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>[number]] extends [never]
    ? never
    : (HandlersLayer: HandlersLayer & ValidateProvidedHandlers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">, HandlersLayer>) => Block<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "OwnerValue">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ModelSchema">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "MessageSchema">, undefined, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, Readonly<{
      [Key in string | number | symbol]: Key extends "EffectsLayer"
        ? MergeLayers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["EffectsLayer"], HandlersLayer>
        : Key extends "hostHandlers"
          ? readonly []
          : Key extends keyof CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">
            ? CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">[Key]
            : never
    }>>
  replaceEffectsLayer: ReplaceEffectsLayer<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "OwnerValue">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ModelSchema">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "MessageSchema">, undefined, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>
  subscriptions: ImplementationSubscriptions<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">> & MergeRecords<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, "subscriptions">
  update: CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["update"]
}

CompletedWithViewAndOutMessage

interfacesource
/**
 * A completed Block derived from a Definition and implementation that both
 * publish an OutMessage Schema and a default view.
 */
interface CompletedWithViewAndOutMessage {
  [CompletionTypeId]: true
  [DefaultViewTypeId]: CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["view"]
  bindings: CompletedWithViewArgument
  EffectsLayer: CompleteEffectsLayer<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["EffectsLayer"], CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">>
  hostHandlers: ImplementationHostHandlers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>
  init: CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["init"]
  makeView: DefineView<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "OwnerValue">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ModelSchema">["Type"], CompletedWithViewArgument<DefinitionValue, ImplementationValue, "MessageSchema">["Type"], DefinitionViewRequirements<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">>>
  managedResources: ImplementationManagedResources<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">> & MergeRecords<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, "managedResources">
  Message: CompletedWithViewArgument
  Model: CompletedWithViewArgument
  mounts: readonly [CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, InspectionOfBinding<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">[number]>["mounts"][number]]
  operations: ImplementationExposedOperations<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>
  OutMessage: OutMessageSchemaOf
  provideHandlers: [ImplementationHostHandlers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>[number]] extends [never]
    ? never
    : (HandlersLayer: HandlersLayer & ValidateProvidedHandlers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">, HandlersLayer>) => Block<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "OwnerValue">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ModelSchema">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "MessageSchema">, OutMessageSchemaOf<DefinitionValue>, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, Readonly<{
      [Key in string | number | symbol]: Key extends "EffectsLayer"
        ? MergeLayers<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["EffectsLayer"], HandlersLayer>
        : Key extends "hostHandlers"
          ? readonly []
          : Key extends keyof CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">
            ? CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">[Key]
            : never
    }>>
  replaceEffectsLayer: ReplaceEffectsLayer<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "OwnerValue">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ModelSchema">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "MessageSchema">, OutMessageSchemaOf<DefinitionValue>, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Mounts">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">>
  subscriptions: ImplementationSubscriptions<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">> & MergeRecords<CompletedWithViewArgument<DefinitionValue, ImplementationValue, "Children">, "subscriptions">
  update: CompletedWithViewArgument<DefinitionValue, ImplementationValue, "ImplementationValue">["update"]
}

CompositionInit

interfacesource
/**
 * Authors a Composition-owned initializer. Authoring is passive: the supplied
 * function and child initialization policies run only when the returned
 * initializer is invoked. Its exact default, optional, and rest parameters are
 * preserved.
 */
interface CompositionInit unknown

DefineBlock

interfacesource
/**
 * Establishes Model, Message, and optional OutMessage contracts for Block
 * authoring.
 */
interface DefineBlock unknown

DefineCommand

interfacesource
/**
 * Defines Commands whose runtime names and handler identities belong to one
 * Block. Attached handlers become local Layer recipes; defining a Command does
 * not construct its handler or perform its Effect.
 */
interface DefineCommand unknown

DefineManagedResources

interfacesource
/** Defines ManagedResource registries against one Block's Model and Message. */
interface DefineManagedResources unknown

DefineMount

interfacesource
/**
 * Defines one-shot Mounts whose runtime names and handler identities belong to
 * one Block. A Runtime acquires the Mount when a matching element is mounted.
 */
interface DefineMount unknown

DefineMountStream

interfacesource
/**
 * Defines streaming Mounts whose runtime names and handler identities belong to
 * one Block. A Runtime runs the Stream only while a matching element is
 * mounted.
 */
interface DefineMountStream unknown

DefineResource

interfacesource
/**
 * Defines ManagedResource accessors whose service identities belong to one
 * Block. The accessor declares identity only; a Runtime acquires registered
 * resources for active Block occurrences.
 */
interface DefineResource unknown

DefineStep

interfacesource
/**
 * Defines an internal Model transformation owned by a Block Definition.
 * 
 * Use these Steps in update, init, and child OutMessage policies. A Step may
 * return an ordinary update result, another connected Step, or a passive child
 * initialization recipe. The helper preserves graph obligations until the
 * matching Composition interprets them under its registered graph.
 * 
 * Public parent-driven operations belong in `prepareBlock({ operations })`. Each
 * exposed producer returns a local Message and its update context instead of a
 * Model transformation.
 */
interface DefineStep unknown

DefineStepNoop

interfacesource
/**
 * Creates a Step that returns the identical incoming Model and no Commands or
 * OutMessage. In an OutMessage policy it acknowledges the named child fact
 * without undoing the child transition or suppressing its Message.
 */
interface DefineStepNoop unknown

DefineSubscriptions

interfacesource
/** Defines Subscription registries against one Block's Model and Message. */
interface DefineSubscriptions unknown

DefineView

interfacesource
/** Defines a view against one Block's Model, Message, and View requirements. */
interface DefineView {
  withInputs: (view: ViewWithInputs<Model, Message, ViewInputs, RequiredViewRequirements>) => OwnedAuthoredView<BlockView<Model, Message, AuthoredViewInputs<ViewInputs>, RequiredViewRequirements>, OwnerValue, Model, Message, RequiredViewRequirements>
}

MakeCommandsStep

interfacesource
/**
 * Creates a reusable Step that preserves the incoming Model and returns the
 * supplied Commands for Runtime execution. Construction does not execute them.
 * 
 * Result Messages must belong to the owning Block. Command types retain their
 * Service requirements and child Binding registration evidence.
 * Use the general Step helper when Commands depend on the current Model or the
 * transition also changes fields or produces an OutMessage.
 */
interface MakeCommandsStep unknown

MakeComposition

interfacesource
/**
 * Registers the child and Mount graph after the Block's typed operations are
 * authored. Both fields default to empty collections. Child OutMessage policies
 * must return this parent's Steps and declared OutMessages, and every sibling
 * Binding used by a policy must be registered here.
 */
interface MakeComposition unknown

MakeOutMessageFold

interfacesource
/**
 * Authors exhaustive child OutMessage handlers against the owning Definition's
 * Model, Message, and optional OutMessage contracts. Each handler returns a
 * parent Step; its Commands and connected Binding requirements remain inferred.
 * 
 * Pass the completed child Block so refined OutMessage payloads and the child
 * Message type used by FoldContext remain available. The resulting fold
 * requires FoldContext only when a handler declares it.
 */
interface MakeOutMessageFold unknown

MakeOutMessageForward

interfacesource
/**
 * Authors an exhaustive child OutMessage mapper against the owning Definition's
 * declared parent OutMessage contract. Each named handler forwards one parent
 * OutMessage or returns `undefined` for that child variant.
 * 
 * Inside `Binding.withOutMessagePolicy`, omit the child Block; the Binding
 * supplies its refined OutMessage payloads. Pass the completed child Block when
 * extracting a forward. At least one handler must forward a parent OutMessage.
 */
interface MakeOutMessageForward unknown

MakeOutMessageStep

interfacesource
/**
 * Creates a reusable Step that preserves the incoming Model and emits a value
 * from the owning Block's declared OutMessage contract. Construction is passive.
 * 
 * Use `makeStep` when the OutMessage depends on the current Model. Use
 * `Update.withOutMessage` to attach an OutMessage to an existing plain result,
 * preserving its Model and Commands, or when the OutMessage may be undefined.
 */
interface MakeOutMessageStep unknown

NamespaceMakeDefinition

interfacesource
/**
 * Establishes Model, Message, and optional OutMessage Schemas under an already
 * declared Block identity.
 */
interface NamespaceMakeDefinition unknown

OutMessageFold

interfacesource
/** An exhaustive child OutMessage fold authored against its owning Definition. */
interface OutMessageFold {
  [OutMessageHelperEvidenceTypeId]: Readonly<{
    input: (outMessage: ChildOutMessage) => void
    output: ChildOutMessage
    role: Role
  }>
}

OutMessageFoldStep

interfacesource
/** A parent Step inferred from one child OutMessage variant handler. */
interface OutMessageFoldStep unknown

OutMessageForward

interfacesource
/** An exhaustive child OutMessage forward authored against its owning Definition. */
interface OutMessageForward {
  [OutMessageHelperEvidenceTypeId]: Readonly<{
    input: (outMessage: ChildOutMessage) => void
    output: ChildOutMessage
    role: Role
  }>
}

OwnedManagedResourceEntryBuilder

interfacesource
/** Defines locally named ManagedResource entries for one Block. */
interface OwnedManagedResourceEntryBuilder unknown

OwnedSubscriptionEntryBuilder

interfacesource
/** Defines locally named Subscription entries for one Block. */
interface OwnedSubscriptionEntryBuilder unknown

Owner

interfacesource
/**
 * The stable type and runtime identity shared by one named Block's Definitions
 * and completed Blocks.
 */
interface Owner {
  [ConcreteOwnerTypeId]: Concrete
  id: Id
  namespace: Id
  token: object
}

PrepareBlock

interfacesource
/**
 * Prepares a Composition's implementation channels as an opaque, passive
 * draft. Assemble its private producer through a matching `FromAssembly`
 * annotation and `Block.assemble(prepare)` before using the Block.
 * 
 * Call this method inside a private zero-argument `prepare` function. The
 * matching `FromAssembly` annotation names `typeof Model` and `typeof prepare`.
 * That explicit boundary lets a parent read the canonical `ChildBlock.Model`
 * Schema without inferring it through the child's complete implementation,
 * reducing TypeScript checking and editor work. See `Block.FromAssemblyWithView`
 * for the full pattern. It does not guarantee that every editor operation is fast.
 * 
 * `init` and `update` are required. At an inferred concrete
 * call, an omitted `EffectsLayer` defaults to `Layer.empty`. Omitted local view,
 * exposed operations, lifecycle registrations, and host handlers become their
 * empty completed forms while registered children still contribute their
 * channels.
 * 
 * Assembly does not build Layers, run init, call exposed producers, or start
 * lifecycle work. `EffectsLayer` contains the Block's local handler recipes;
 * child Bindings contribute their recipes automatically, and ordinary Service
 * requirements remain for the application root to provide.
 */
interface PrepareBlock unknown

Scoped

interfacesource
/**
 * A handler or resource capability qualified by its Binding path in the
 * composition graph.
 */
interface Scoped {
  [ScopedTypeId]: Readonly<{
    contract: (contract: Contract) => Contract
    path: (path: Path) => Path
  }>
}

WithOutMessagePolicy

interfacesource
/** Selects the exact parent-owned OutMessage policy for a child Binding. */
interface WithOutMessagePolicy unknown

Constants

LocalMountsTypeId

constsource
/**
 * Property key retaining the Mount definitions owned directly by a Block.
 * Composition uses it to distinguish local registrations from descendant
 * Mounts collected through child Bindings.
 */
const LocalMountsTypeId: typeof LocalMountsTypeId