import { Handle, Ref } from 'actor'; import { Record, Value } from 'preserves'; export const _Assert = Symbol.for('assert'); export const Assert = Record.makeConstructor<{assertion: Value, handle: Handle}, WireRef>()( _Assert, ['assertion', 'handle']); export const _Retract = Symbol.for('retract'); export const Retract = Record.makeConstructor<{handle: Handle}, WireRef>()( _Retract, ['handle']); export const _Message = Symbol.for('message'); export const Message = Record.makeConstructor<{body: Value}, WireRef>()( _Message, ['body']); export const _Sync = Symbol.for('sync'); export const Sync = Record.makeConstructor<{peer: WireRef}, WireRef>()( _Sync, ['peer']); export type EntityMessage = | Record, Handle], WireRef> | Record | Record], WireRef> | Record; export type TurnMessage = Array<[Oid, EntityMessage]>; export type Oid = number; export type RefLocation = "mine" | "your"; export type WireRef = { loc: RefLocation, oid: Oid }; export type WireSymbol = { name: WireRef, ref: Ref, count: number };