Entity

Entity is the abstract base for first-class Mission domain objects. It owns shared mechanics only: canonical id, clone-protected data access, command descriptor support, remote method dispatch conventions, and common storage/data schema parents.

Contract

  • Class: packages/core/src/entities/Entity/Entity.ts
  • Schema: packages/core/src/entities/Entity/EntitySchema.ts
  • Method dispatcher: packages/core/src/entities/Entity/EntityMethod.ts

Ownership

Entity does not own Mission, Repository, Task, Artifact, AgentExecution, Terminal, or System behavior. Concrete Entity classes own their own invariants and state transitions.

Schema Roles

  • EntityStorageSchema: canonical persisted base with id.
  • EntitySchema: hydrated base that extends storage with shared surface material such as commands.
  • EntityContractType: declarative method/event/schema binding shape.
  • EntityEventEnvelopeSchema: canonical daemon-published event envelope for contract-declared Entity events.

Event Publication

The Entity base owns generic event envelope helpers only. createContractEntityEventEnvelope(...) validates an event name and payload against the declaring EntityContractType, derives the Entity channel, and returns EntityEventEnvelopeSchema data. Concrete Entities request publication through the generic entityEventPublisher capability on EntityExecutionContext; daemon infrastructure resolves concrete contracts and broadcasts validated envelopes to IPC subscribers. Browser surfaces receive those daemon notifications through SSE.

Terminal WebSocket communication is not the generic Entity event system. WebSocket carries transport-specific terminal I/O, while events such as data.changed cross the Entity boundary as contract-declared envelopes.

ERD Placement

Every concrete Entity specializes Entity. If a domain object needs identity, behavior, storage, and a remote contract, it should appear as a concrete Entity in the ERD.