Intelligence · class
CommandLog
What was accepted, and when — beside TickTrace rather than inside it.
Explained in Agents and behaviour.
class CommandLogimport { 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)| Parameter | Type | Description |
|---|---|---|
capacity? | number |
Accessors
| Name | Type | Description |
|---|---|---|
lengthget | number | How many commands are still retained, not how many were ever recorded. |
Methods
record
record(entry: LogEntry): void| Parameter | Type | Description |
|---|---|---|
entry | LogEntry |
at
at(tick: number, out: LogEntry[]): numberCommands accepted at exactly this tick, in acceptance order, written into out.
| Parameter | Type | Description |
|---|---|---|
tick | number | |
out | LogEntry[] |
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.