Skip to content

Interface: AIPeerContext\<TPresence\>

@roomful/core


@roomful/core / AIPeerContext

Defined in: packages/core/src/ai-peer.ts:141

The room snapshot plus action handles handed to an AIPeerAgent each tick. Reads are a snapshot taken at the start of the tick; the action methods apply immediately.

TPresence extends PresenceData = PresenceData

readonly cursors: CursorPosition[]

Defined in: packages/core/src/ai-peer.ts:149

The current cursor positions of all peers.


readonly events: readonly AIPeerEvent<TPresence>[]

Defined in: packages/core/src/ai-peer.ts:151

Events observed since the previous tick (only for observeEvents names).


readonly others: Peer<TPresence>[]

Defined in: packages/core/src/ai-peer.ts:147

Every other peer in the room.


readonly proposals: readonly AgentProposal[]

Defined in: packages/core/src/ai-peer.ts:153

The room’s agent-approval proposals (snapshot at tick start), newest first.


readonly self: Peer<TPresence>

Defined in: packages/core/src/ai-peer.ts:145

The AI peer’s own peer snapshot.


readonly tick: number

Defined in: packages/core/src/ai-peer.ts:143

The tick counter, incremented after each agent run (starts at 0).

emit(name, payload): void

Defined in: packages/core/src/ai-peer.ts:161

Emits a custom event to the room.

string

unknown

void


moveCursor(x, y): void

Defined in: packages/core/src/ai-peer.ts:155

Moves the AI peer’s cursor to a normalized position (each axis 0..1).

number

number

void


propose(type, payload?): string

Defined in: packages/core/src/ai-peer.ts:174

Proposes an action for human approval instead of applying it, and sets the agent’s state to waiting-approval. Watch proposals on later ticks for the decision, then apply or drop it.

string

unknown

string

The new proposal’s id.


recordAction(type, payload?): void

Defined in: packages/core/src/ai-peer.ts:167

Records a structured, auditable action into the room’s activity feed (prefixed AGENT_ACTION_PREFIX), e.g. recordAction('proposed-edit', { field, value }). Read the agent’s actions back anywhere with getAgentActions.

string

unknown

void


setPresence(data): void

Defined in: packages/core/src/ai-peer.ts:157

Merges a patch into the AI peer’s presence.

Partial<TPresence>

void


setState(state): void

Defined in: packages/core/src/ai-peer.ts:159

Announces what the agent is doing right now, for a live UI indicator.

AgentState

void