mlx-bun library API
    Preparing search index...

    Capability contract for cache layouts that own their dynamic-row batching. The scheduler uses this for every storage family (plain and quantized KV, sliding windows, recurrent state, and layouts such as GLM's compressed MLA/DSA state) instead of teaching the scheduler their tensor layout. mergeRows writes into an empty cache and does not consume inputs: its sources are a running layout or one serial cache, then one serial cache per joining row. Extracted rows are independent owned serial caches.

    Implements

    Index
    batchSize: number | null = null

    Rows in the layout, or null before the first append.

    dsa: DSAIndexCache | null
    kvLoraRank: number
    latent: MlxArray | null = null
    leftPad: number[] = []
    maxTokens: number
    offset: number = 0
    role: "mtp" | "target"
    rope: MlxArray | null = null
    ropeHeadDim: number
    rowOffsets: number[] = []
    • Stable storage identity for compatibility guards and persistence. REQUIRED: every capability predicate (isPlainKvCache, isRotating*, packages/inference/src/state/persistence.ts codecs) is a string compare on this value, so a missing override used to fail OPEN into wrong routing (PRs #42/#43: BatchedRotatingCache shipped without one and batched joins dropped running rows). Wrappers report their own kind plus the inner kind.

      Returns string

    • Speculative verify-round support for NON-trimmable recurrent caches (SSMCache — gated-DeltaNet conv + recurrent state). A cache exposing these is spec-eligible without isTrimmable(): the serve loop arms a round before the verify forward (the layer snapshots pre-round state — free, MLX arrays are immutable — and records its position-local kernel inputs), then resolves it: commit on full accept, or rollback(keep) which restores the snapshot and bit-exactly REPLAYS the first keep window tokens through the recurrence (identical arithmetic prefix ⇒ identical state). Trimmable caches leave these unset and keep trim().

      Returns void

    • Drop the last n tokens (future writes overwrite them). bypass (default false → unchanged behavior) skips the isTrimmable guard for the speculative-decode rollback case (trim the last n ≤ γ tips right after a

      1 concat write); rotating caches then physically shrink the buffer tail.

      Parameters

      • n: number

      Returns void