DevCanvas uses Chrome's Messaging API for communication between the Popup, Content Script, and Background Worker.
Sends a payload to the background script.
// Type Signature
function sendMessage(type: string, payload: any): Promise<any>;
// Example: Fetch File Tree
const tree = await sendMessage('FETCH_TREE', { repo: 'owner/repo' });We use chrome.storage.local to persist user settings and cached diagrams.
interface StorageSchema {
settings: {
githubToken: string;
aiProvider: 'openai' | 'mistral' | 'anthropic';
apiKeys: Record<string, string>;
};
cache: {
[repoId: string]: {
diagram: GraphNode[];
timestamp: number;
};
};
}