Intelligence · class

CommandLog

What was accepted, and when — beside TickTrace rather than inside it.

Explained in Agents and behaviour.

class CommandLog
import { CommandLog } from '@driftengine/ai';

In depth

TickTrace is Float32Array channels plus a Uint8Array of flags, sampled per tick. A command carries a string id and structured arguments, and boxing those into float channels is not a design, it is a defeat. This borrows the ring-buffer discipline and the tick indexing and shares nothing else, which answers the question §33 of the parent design left open for AI-2.

What it costs: two ring buffers where a reader might expect one place to look. What would make it wrong: if a consumer needed one ordered stream of both, this would need a merge read rather than a merged store — the storage shapes have no common representation worth finding.

Constructor

new

constructor(capacity?: number)
ParameterTypeDescription
capacity?number

Accessors

NameTypeDescription
lengthgetnumberHow many commands are still retained, not how many were ever recorded.

Methods

record

record(entry: LogEntry): void
ParameterTypeDescription
entryLogEntry

at

at(tick: number, out: LogEntry[]): number

Commands accepted at exactly this tick, in acceptance order, written into out.

ParameterTypeDescription
ticknumber
outLogEntry[]
More

Returns the count written. Reading a tick allocates nothing, because a replay reads every tick and a per-tick array would put an allocation on that path.