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
/**
* The sync service as a shared Photoshop document needs it: whether the
* shared copy exists, storing its first snapshot, and the live transport.
*/
import { syncServiceClient } from '@service-sync/client';
import { createSyncServiceSource } from '@service-sync/source';
import type { PsdConnection } from './psd-collab';
/** Whether the sync service holds this document. */
export async function psdSyncExists(documentId: string): Promise<boolean> {
const result = await syncServiceClient.exists({ documentId });
if (result.isErr()) throw new Error('Unable to reach the sync service.');
return result.value.exists;
}
/** Stores the first shared snapshot of a document. */
export async function initializePsdSync(
documentId: string,
snapshot: Uint8Array
): Promise<void> {
const result = await syncServiceClient.initializeFromSnapshot({
documentId,
snapshot,
});
if (result.isErr()) throw new Error('Unable to share the document.');
}
/** The live transport; it fetches a fresh permission token on each connect. */
export function connectPsdSync(documentId: string): PsdConnection {
return createSyncServiceSource(documentId, undefined);
}