Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 798 Bytes

File metadata and controls

36 lines (28 loc) · 798 Bytes

Extension API Reference

DevCanvas uses Chrome's Messaging API for communication between the Popup, Content Script, and Background Worker.

Message Passing

sendMessage

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' });

Storage Schema

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;
    };
  };
}