Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.5 KB
Raw Blame
import type { CanvasSpec } from '@block-canvas/definition';
import type { BlockChatSpec } from '@block-chat/blockClient';
import type { BlockName } from './block';

// Base type for all block method specs
type BlockMethodSpec = Record<string, (...args: any[]) => any | Promise<any>>;

export type SharedBlockSpec = {
  goToLocationFromParams: (params: Record<string, any>) => Promise<void>;
  /** Land the block on its latest content (e.g. newest channel messages). */
  goToLatest: () => Promise<void>;
};

// Ensure all block specs extend BlockMethodSpec
type EmptySpec = {};
type AssertSpec<T> = T extends BlockMethodSpec ? T : EmptySpec;

export interface BlockMethodRegistry {
  call: EmptySpec;
  calendar: EmptySpec;
  chat: AssertSpec<BlockChatSpec>;
  database: EmptySpec;
  form: EmptySpec;
  channel: EmptySpec;
  write: EmptySpec;
  pdf: EmptySpec;
  html: EmptySpec;
  md: EmptySpec;
  code: EmptySpec;
  image: EmptySpec;
  canvas: AssertSpec<CanvasSpec>;
  spreadsheet: EmptySpec;
  pptx: EmptySpec;
  psd: EmptySpec;
  fig: EmptySpec;
  ai: EmptySpec;
  project: EmptySpec;
  start: EmptySpec;
  unknown: EmptySpec;
  video: EmptySpec;
  email: EmptySpec;
  contact: EmptySpec;
  company: EmptySpec;
  color: EmptySpec;
  component: EmptySpec;
  task: EmptySpec;
  routine: EmptySpec;
  pr: EmptySpec;
  agent: EmptySpec;
  initiative: EmptySpec;
  pipeline: EmptySpec;
}

// Type helper to get the method spec for a block name
export type BlockMethodsFor<T extends BlockName> = SharedBlockSpec &
  BlockMethodRegistry[T];