Intelligence · class
AuthoritativeAgent
An agent whose model decisions are taken in one place.
Explained in Agents and behaviour.
class AuthoritativeAgentimport { AuthoritativeAgent } from '@driftengine/ai';In depth
Wraps the two sessions the package already has and picks between them. It adds no policy, no provider handling and no replay logic; all three exist and are reused.
Constructor
new
constructor(session: AgentSession<unknown>, replay: ReplaySession, options: AuthoritativeAgentOptions)| Parameter | Type | Description |
|---|---|---|
session | AgentSession<unknown> | |
replay | ReplaySession | |
options | AuthoritativeAgentOptions |
Accessors
| Name | Type | Description |
|---|---|---|
publishedDecisionsget | number | Decisions this peer put on the wire. Zero on a participant, always. |
acceptedDecisionsget | number | Decisions taken off the wire. Zero on the authority, always. |
earliestLateTickget | number | The oldest tick a decision arrived for after that tick had already run, or -1.MoreA consumer holding a |
Methods
clearLate
clearLate(): voidtick
tick(tickNumber: number, nowMs: number): IntentAdvance one tick and return what the agent is doing.
| Parameter | Type | Description |
|---|---|---|
tickNumber | number | |
nowMs | number |
More
Arriving decisions are drained before the tick runs, so a command for this tick is in the
log by the time the replay reads it. A command for an earlier tick is recorded anyway — the log
is keyed by acceptance tick, so it lands where a later rewind will find it — and noted in
earliestLateTick.