Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import { match } from 'ts-pattern';
export type ActivityAction =
| { kind: 'created' }
| { kind: 'edited' }
| { kind: 'opened' }
| { kind: 'deleted' }
| { kind: 'messaged' }
| { kind: 'email-sent' }
| { kind: 'call-started' }
/** Someone answered a form; attributed to the respondent when signed in. */
| { kind: 'responded' }
| { kind: 'property-changed'; property: string; from: unknown; to: unknown }
| { kind: 'participant-added'; participant: string }
| { kind: 'participant-removed'; participant: string }
| { kind: 'task-added'; taskId?: string }
| { kind: 'task-removed'; taskId?: string }
| { kind: 'unknown'; tag: string };
/**
* Whose activity the Activity screen reads: the viewer's own, or their
* teammates' on items shared with the viewer.
*/
export type ActivityScope = 'mine' | 'team';
export type ActivityEntityType =
| 'document'
| 'project'
| 'initiative'
| 'chat'
| 'email-thread'
| 'channel'
| 'user'
| 'database'
| 'form'
| { kind: 'unsupported'; raw: string };
export type ActivityEvent = {
id: string;
actorId: string;
entityId: string;
entityType: ActivityEntityType;
occurredAt: string;
action: ActivityAction;
};
export type ActivityTopEntity = {
entityId: string;
entityType: ActivityEntityType;
count: number;
};
export type ActivityOverview = {
from: string;
to: string;
timeZone: string;
total: number;
days: Array<{ date: string; count: number }>;
topEntities: ActivityTopEntity[];
};
export type PropertyEntityType =
| 'DOCUMENT'
| 'PROJECT'
| 'INITIATIVE'
| 'CHAT'
| 'THREAD'
| 'CHANNEL'
| 'USER';
/** Entity kinds the activity UI can resolve a name, icon, and link for. */
export type ActivityDisplayEntityType =
| PropertyEntityType
| 'DATABASE'
| 'FORM';
export function toDisplayEntityType(
entityType: ActivityEntityType
): ActivityDisplayEntityType | undefined {
return match(entityType)
.with({ kind: 'unsupported' }, () => undefined)
.with('document', () => 'DOCUMENT' as const)
.with('initiative', () => 'INITIATIVE' as const)
.with('project', () => 'PROJECT' as const)
.with('chat', () => 'CHAT' as const)
.with('email-thread', () => 'THREAD' as const)
.with('channel', () => 'CHANNEL' as const)
.with('user', () => 'USER' as const)
.with('database', () => 'DATABASE' as const)
.with('form', () => 'FORM' as const)
.exhaustive();
}