import { RegistryEntryKind, RegistryPayload } from "../debug-protocol.js"; import { BufferCursor } from "./bus-pool.js"; //#region src/debug/DebugRegistry.d.ts /** * Registered CPU array. Holds a *reference* to a host-owned typed array * plus metadata. The host bumps `version` by calling `touch(name)` when * it mutates the buffer in place, or passes a new reference to * `register` (which increments version). The provider samples on flush * and only emits entries whose version has advanced since the last * emission. */ interface RegistryEntry { kind: RegistryEntryKind; ref: Float32Array | Uint32Array | Int32Array; version: number; label?: string; /** Version number last emitted on the bus — for delta skip. */ lastEmittedVersion: number; /** * Shape last emitted — `'full'` (with sample) vs `'meta'` (metadata * only). Tracked separately from `lastEmittedVersion` so a filter * flip from meta→full immediately re-emits even though the version * may not have changed. */ lastEmittedShape: 'full' | 'meta' | 'none'; /** Cached subarray view reused across flushes to avoid allocations. */ sampleView: Float32Array | Uint32Array | Int32Array; /** Snapshot length (sampleView is `ref.subarray(0, length)`). */ length: number; /** True once we've logged the "doesn't fit in pool buffer" warning. */ warnedOversized?: boolean; } /** * Provider-side store for host-owned CPU arrays. Call `register` from * engine code once a buffer exists; call `touch` (or re-`register`) * whenever it changes. `unregister` drops it and queues a `null` delta * so subscribers clear their view. * * The store is attached to a `DevtoolsProvider`; consumers subscribe * with the `'registry'` feature and receive deltas on each batch flush. */ declare class DebugRegistry { private _entries; /** Names removed since the last drain — emitted as `null` deltas. */ private _removed; /** * Register (or replace) a named buffer. Re-calling with the same name * but a new `ref` swaps the reference and bumps `version`; callers * that mutate in place should use `touch(name)` instead. */ register(name: string, ref: RegistryEntry['ref'], kind: RegistryEntryKind, opts?: { label?: string; length?: number; }): void; /** * Mark an in-place mutation. Cheaper than `register` because it keeps * the existing reference — just bumps the version so the next flush * ships a fresh sample. */ touch(name: string, length?: number): void; unregister(name: string): void; /** True if any entry has a new version or a pending removal. */ hasPending(): boolean; /** * Fill `out.entries` with a delta. `filter`: * - `null` → every entry ships with its sample. * - `Set` → entries in the filter ship with samples; others * ship **metadata only** (no sample) so the UI still * knows the entry exists and can offer to stream it. * - empty set → every entry ships metadata only. * * Only emits an entry when its `version` has advanced since the last * time we shipped *that shape* — samples and meta-only track separate * "last emitted" versions, so flipping the filter doesn't strand * the consumer on a stale meta-only snapshot. * * Returns `true` if anything was written. */ drain(out: RegistryPayload, filter?: Set | null, into?: BufferCursor): boolean; /** Force the next drain to re-emit everything. Used when a new consumer subscribes. */ resetDelta(): void; dispose(): void; } //#endregion export { DebugRegistry }; //# sourceMappingURL=DebugRegistry.d.ts.map