Reactive component tree (the rendering layer that consumes @aihu/signals).
_getComponentInstanceRegistryfunction _getComponentInstanceRegistry(): ReadonlyMap<string, LiveBinding[]>Export the registry getter for injection into `@aihu/agent-service`.
branchfunction branch(tag: string | null, attrs?: AttrMap, children?: ChildList): Branch`branch(tag, attrs?, children?)` — public factory for branch nodes per `.team/phase-3/spec-arbor.md` §1.2.
eachfunction each<T>( list: Signal<T[]>, key: (item: T) => string | number, grow: (item: T, index: number) => Node, ): StructuralNodehydratefunction hydrate( component: () => Node, host: Element | ShadowRoot, snapshot: Snapshot, options?: MountOptions, ): ReturnType<typeof mount>Attach reactive effects from `component`'s arbor tree to pre-rendered DOM nodes under `host` without re-creating elements.
mountfunction mount(node: Node, host: Element | ShadowRoot, options?: MountOptions): MountScopeMaterialize `node` into `host` synchronously and return a `MountScope` owning the lifecycle.
whenfunction when(condition: Signal<boolean>, grow: () => Node): StructuralNode`when()` and `each()` — v1 reconciler per spec §2 (Plan 1.1).
leafconst leaf: LeafFactoryslotconst slot = (name?: string): Leaf => …`slot(name?)` — creates a `<slot>` DOM element for Shadow DOM content projection per Plan 1.4.
AgentBindingSpecinterface AgentBindingSpec {
readonly tag: string
readonly actions: Record<string, (args: unknown) => unknown>
readonly reads: Record<string, () => unknown>
readonly writes: Record<string, (v: unknown) => void>
readonly scope: string | undefined
readonly rateLimit: string | undefined
}Shape of the `__agentBinding` named export emitted by the compiler into server artifacts for components with an `@agent` block (RFC §3).
AgentContextinterface AgentContext {
readonly _brand: 'AgentContext'
/** Root ID from the mount scope (only present on live contexts). */
readonly rootId?: number
/** Tag name (only present on live contexts). */
readonly tag?: string
/** Read the current value of a named signal (live context only). */
readonly readSignal?: (name: string) => unknown
/** Write a value to a named writable signal (live context only). */
readonly writeSignal?: (name: string, value: unknown) => void
/** Invoke a named action (live context only). */
readonly callAction?: (name: string, args: unknown[]) => Promise<unknown>
}Agent context attached to a `MountScope`.
Branchinterface Branch {
readonly kind: 'branch'
readonly tag: string | null
readonly attrs: AttrMap | null
readonly children: ChildList
/** Written by `_materialize`; undefined until the branch is mounted. */
el?: Element
}A `branch` node.
Leafinterface Leaf {
readonly kind: 'leaf'
readonly leafKind: 'text' | 'element'
readonly value: Signal<string> | string | null
readonly tag: string | null
readonly attrs: AttrMap | null
}A `leaf` node — either a text leaf (`leaf(value)`) or a terminal element leaf (`leaf.element(tag, attrs?)`).
MountOptionsinterface MountOptions {
/** Error boundary handler. See ErrorHandler. */
onError?: ErrorHandler
/**
* v0.3.0 — the `__agentBinding` export from the component's server artifact.
* When present, `mount()` registers a `LiveBinding` in the
* `componentInstanceRegistry`. Components without an `@agent` block
* never pass this option (zero overhead on the non-agent path).
*/
agentBinding?: AgentBindingSpec
}Options for mount().
MountScopeinterface MountScope {
dispose(): void
readonly agent: AgentContext
serialize(): Snapshot
}Public `MountScope` returned by `mount()`.
AttrMaptype AttrMap = Record<string, string | number | boolean | Signal<unknown> | EventHandler>Attribute map.
ChildListtype ChildList = ReadonlyArray<Branch | Leaf | StructuralNode>Children are static at construction time.
ErrorHandlertype ErrorHandler = (error: unknown, path: string) => Node | undefinedError handler for a mount scope.
EventHandlertype EventHandler = (event: Event) => voidEvent listener handler.
Nodetype Node = Branch | Leaf | StructuralNodeDiscriminated union of node kinds accepted by `mount()`.
Snapshottype Snapshot = Record<string, unknown>Sub-project #6 — SSR/serialize and hydration (Plan 3.2).