The entire exported Highlight API, available within your Highlight app.

interface HighlightAPI {
    addEventListener: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => void);
    app: {
        addListener: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => (() => void));
        getHotkey: (() => Promise<string>);
        hasDesktopShortcut: (() => Promise<boolean>);
        openApp: ((appId: string) => Promise<void>);
        requestCreateDesktopShortcut: (() => Promise<void>);
        setBackgroundStatus: ((status: boolean) => Promise<void>);
        showNotification: ((title: string, body: string) => void);
    };
    appStorage: {
        all: (() => Record<string, any>);
        clear: (() => void);
        delete: ((key: string) => void);
        get: ((key: string) => any);
        isHydrated: (() => boolean);
        set: ((key: string, value: any) => void);
        setAll: ((value: Record<string, any>) => void);
        whenHydrated: (() => Promise<boolean>);
    };
    auth: {
        signIn: (() => Promise<{
            accessToken: string;
            refreshToken: string;
        }>);
    };
    conversations: {
        addConversation: ((conversation: ConversationData) => Promise<void>);
        deleteAllConversations: (() => Promise<void>);
        deleteConversation: ((id: string) => Promise<void>);
        getAllConversations: (() => Promise<ConversationData[]>);
        getAutoClearDays: (() => Promise<number>);
        getAutoSaveTime: (() => Promise<number>);
        getConversationById: ((id: string) => Promise<ConversationData>);
        getCurrentConversation: (() => Promise<string>);
        getElapsedTime: (() => Promise<number>);
        getRecentConversations: (() => Promise<ConversationData[]>);
        saveCurrentConversation: (() => Promise<void>);
        setAutoClearDays: ((days: number) => Promise<void>);
        setAutoSaveTime: ((time: number) => Promise<void>);
        updateConversation: ((conversation: ConversationData) => Promise<void>);
        updateConversations: ((conversations: ConversationData[]) => Promise<void>);
    };
    inference: {
        getEmbedding: ((text: string) => Promise<number[]>);
        getTextPrediction: ((messages: LLMMessage[], params?: ChatOpenAIParams) => AsyncGenerator<string, any, unknown>);
        getTextPredictionSlm: ((messages: LLMMessage[], grammar?: string) => Promise<string>);
        isSlmCapable: (() => Promise<boolean>);
        getStructuredTextPrediction<T>(structure: ZodType<T, ZodTypeDef, T>, messages: LLMMessage[], params?: ChatOpenAIParams): AsyncGenerator<T, any, unknown>;
    };
    isRunningInHighlight: (() => boolean);
    once: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => void);
    permissions: {
        requestBackgroundPermission: (() => Promise<boolean>);
        requestClipboardReadPermission: (() => Promise<boolean>);
        requestScreenshotPermission: (() => Promise<boolean>);
        requestWindowContextPermission: (() => Promise<boolean>);
    };
    removeEventListener: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => void);
    user: {
        addFact: ((fact: string) => Promise<void>);
        deleteFact: ((index: number) => Promise<void>);
        getAudio: ((longAudio: boolean) => Promise<string>);
        getAudioForDuration: ((duration: number) => Promise<string>);
        getClipboardContents: (() => Promise<undefined | {
            type: "image" | "text";
            value: string;
        }>);
        getContext: ((paneDetectionEnabled?: boolean) => Promise<HighlightContext>);
        getDisplayScreenshots: (() => Promise<{
            thumbnail: string;
        }[]>);
        getEmail: (() => Promise<string>);
        getFacts: (() => Promise<string[]>);
        getMicActivity: ((lastNumMs: number) => Promise<number>);
        getMicActivityInDecibels: ((lastNumMs: number) => Promise<number>);
        getNativeWindows: (() => Promise<{
            appName: string;
            pid: number;
            title: string;
        }[]>);
        getScreenshot: (() => Promise<string>);
        getWindowContext: ((windowTitle: string, scope?: WindowContextScope) => Promise<HighlightContext>);
        getWindowScreenshot: ((windowTitle: string) => Promise<string>);
        getWindows: (() => Promise<{
            appIcon?: string;
            windowTitle: string;
        }[]>);
        setAsrRealtime: ((isActive: boolean) => void);
        updateFact: ((index: number, fact: string) => Promise<void>);
    };
    vectorDB: {
        createTable: ((tableName: string) => Promise<void>);
        deleteItem: ((tableName: string, id: string) => Promise<void>);
        deleteTable: ((tableName: string) => Promise<void>);
        getAllItems: ((tableName: string) => Promise<any[]>);
        insertItem: ((tableName: string, text: string, metadata: object) => Promise<void>);
        search: ((tableName: string, text: string, maxResults: number) => Promise<any[]>);
        updateMetadata: ((tableName: string, id: string, metadata: object) => Promise<void>);
        updateText: ((tableName: string, id: string, text: string, metadata: object) => Promise<void>);
    };
}

Properties

addEventListener: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => void)

Adds an event listener for your Highlight app.

Type declaration

    • (event, listener): void
    • Parameters

      • event: HighlightEvent

        The name of the event to listen for.

      • listener: ((...args: any[]) => void)

        The listener Highlight will call when the event is emitted.

          • (...args): void
          • Parameters

            • Rest...args: any[]

            Returns void

      Returns void

use Highlight.app.addListener instead

app: {
    addListener: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => (() => void));
    getHotkey: (() => Promise<string>);
    hasDesktopShortcut: (() => Promise<boolean>);
    openApp: ((appId: string) => Promise<void>);
    requestCreateDesktopShortcut: (() => Promise<void>);
    setBackgroundStatus: ((status: boolean) => Promise<void>);
    showNotification: ((title: string, body: string) => void);
}

Type declaration

  • addListener: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => (() => void))

    Adds an event listener for your Highlight app.

      • (event, listener): (() => void)
      • Parameters

        • event: HighlightEvent

          The name of the event to listen for.

        • listener: ((...args: any[]) => void)

          The listener Highlight will call when the event is emitted.

            • (...args): void
            • Parameters

              • Rest...args: any[]

              Returns void

        Returns (() => void)

        A function to remove the listener when you are done with it

          • (): void
          • Returns void

  • getHotkey: (() => Promise<string>)

    Get the hotkey the user should use to bring up the Highlight overlay window. This is useful when onboarding users to show them how to activate your app.

      • (): Promise<string>
      • Returns Promise<string>

  • hasDesktopShortcut: (() => Promise<boolean>)

    Check if the user has created a desktop shortcut for your app.

      • (): Promise<boolean>
      • Returns Promise<boolean>

  • openApp: ((appId: string) => Promise<void>)

    Open a Highlight app

      • (appId): Promise<void>
      • Parameters

        • appId: string

          The ID of the app to open

        Returns Promise<void>

        A promise that resolves when the app is opened

  • requestCreateDesktopShortcut: (() => Promise<void>)

    Prompt the user to create a desktop shortcut for your app.

      • (): Promise<void>
      • Returns Promise<void>

  • setBackgroundStatus: ((status: boolean) => Promise<void>)

    Tell Highlight your app should run in the background. If you don't have permission to run in the background, this will throw an error.

    Highlight.permissions.requestBackgroundPermission

      • (status): Promise<void>
      • Parameters

        • status: boolean

        Returns Promise<void>

  • showNotification: ((title: string, body: string) => void)

    Show a notification to the user.

      • (title, body): void
      • Parameters

        • title: string

          The title of the notification.

        • body: string

          The body of the notification.

        Returns void

appStorage: {
    all: (() => Record<string, any>);
    clear: (() => void);
    delete: ((key: string) => void);
    get: ((key: string) => any);
    isHydrated: (() => boolean);
    set: ((key: string, value: any) => void);
    setAll: ((value: Record<string, any>) => void);
    whenHydrated: (() => Promise<boolean>);
}

A secure store for your app to save data.

auth: {
    signIn: (() => Promise<{
        accessToken: string;
        refreshToken: string;
    }>);
}

Type declaration

  • signIn: (() => Promise<{
        accessToken: string;
        refreshToken: string;
    }>)

    Get an access token and refresh token that can be used to validate the user's session on your backend.

      • (): Promise<{
            accessToken: string;
            refreshToken: string;
        }>
      • Returns Promise<{
            accessToken: string;
            refreshToken: string;
        }>

conversations: {
    addConversation: ((conversation: ConversationData) => Promise<void>);
    deleteAllConversations: (() => Promise<void>);
    deleteConversation: ((id: string) => Promise<void>);
    getAllConversations: (() => Promise<ConversationData[]>);
    getAutoClearDays: (() => Promise<number>);
    getAutoSaveTime: (() => Promise<number>);
    getConversationById: ((id: string) => Promise<ConversationData>);
    getCurrentConversation: (() => Promise<string>);
    getElapsedTime: (() => Promise<number>);
    getRecentConversations: (() => Promise<ConversationData[]>);
    saveCurrentConversation: (() => Promise<void>);
    setAutoClearDays: ((days: number) => Promise<void>);
    setAutoSaveTime: ((time: number) => Promise<void>);
    updateConversation: ((conversation: ConversationData) => Promise<void>);
    updateConversations: ((conversations: ConversationData[]) => Promise<void>);
}

Type declaration

  • addConversation: ((conversation: ConversationData) => Promise<void>)

    Adds a new conversation.

      • (conversation): Promise<void>
      • Parameters

        Returns Promise<void>

        A promise that resolves when the conversation is added.

  • deleteAllConversations: (() => Promise<void>)

    Deletes all conversations.

      • (): Promise<void>
      • Returns Promise<void>

        A promise that resolves when all conversations are deleted.

  • deleteConversation: ((id: string) => Promise<void>)

    Deletes a conversation by its ID.

      • (id): Promise<void>
      • Parameters

        • id: string

          The ID of the conversation to delete.

        Returns Promise<void>

        A promise that resolves when the conversation is deleted.

  • getAllConversations: (() => Promise<ConversationData[]>)

    Gets all conversations.

  • getAutoClearDays: (() => Promise<number>)

    Gets the number of days after which conversations are automatically cleared.

      • (): Promise<number>
      • Returns Promise<number>

        A promise that resolves with the number of days.

  • getAutoSaveTime: (() => Promise<number>)

    Gets the auto-save time for conversations.

      • (): Promise<number>
      • Returns Promise<number>

        A promise that resolves with the auto-save time in milliseconds.

  • getConversationById: ((id: string) => Promise<ConversationData>)

    Gets a specific conversation by its ID.

      • (id): Promise<ConversationData>
      • Parameters

        • id: string

          The ID of the conversation to retrieve.

        Returns Promise<ConversationData>

        A promise that resolves with the conversation data.

  • getCurrentConversation: (() => Promise<string>)

    Gets the current conversation.

      • (): Promise<string>
      • Returns Promise<string>

        A promise that resolves with the current conversation data.

  • getElapsedTime: (() => Promise<number>)

    Gets the elapsed time of the current conversation.

      • (): Promise<number>
      • Returns Promise<number>

        A promise that resolves with the elapsed time in milliseconds.

  • getRecentConversations: (() => Promise<ConversationData[]>)

    Gets conversations from the last 24 hours.

  • saveCurrentConversation: (() => Promise<void>)

    Saves the current conversation.

      • (): Promise<void>
      • Returns Promise<void>

        A promise that resolves when the conversation is saved.

  • setAutoClearDays: ((days: number) => Promise<void>)

    Sets the number of days after which conversations are automatically cleared.

      • (days): Promise<void>
      • Parameters

        • days: number

          The number of days.

        Returns Promise<void>

        A promise that resolves when the auto-clear days are set.

  • setAutoSaveTime: ((time: number) => Promise<void>)

    Sets the auto-save time for conversations.

      • (time): Promise<void>
      • Parameters

        • time: number

          The auto-save time in milliseconds.

        Returns Promise<void>

        A promise that resolves when the auto-save time is set.

  • updateConversation: ((conversation: ConversationData) => Promise<void>)

    Updates an existing conversation.

      • (conversation): Promise<void>
      • Parameters

        Returns Promise<void>

        A promise that resolves when the conversation is updated.

  • updateConversations: ((conversations: ConversationData[]) => Promise<void>)

    Updates multiple conversations at once.

      • (conversations): Promise<void>
      • Parameters

        Returns Promise<void>

        A promise that resolves when the conversations are updated.

inference: {
    getEmbedding: ((text: string) => Promise<number[]>);
    getTextPrediction: ((messages: LLMMessage[], params?: ChatOpenAIParams) => AsyncGenerator<string, any, unknown>);
    getTextPredictionSlm: ((messages: LLMMessage[], grammar?: string) => Promise<string>);
    isSlmCapable: (() => Promise<boolean>);
    getStructuredTextPrediction<T>(structure: ZodType<T, ZodTypeDef, T>, messages: LLMMessage[], params?: ChatOpenAIParams): AsyncGenerator<T, any, unknown>;
}

Type declaration

  • getEmbedding: ((text: string) => Promise<number[]>)

    Get an embedding from a locally running embedding model.

      • (text): Promise<number[]>
      • Parameters

        • text: string

          The text to embed.

        Returns Promise<number[]>

        An embedding.

  • getTextPrediction: ((messages: LLMMessage[], params?: ChatOpenAIParams) => AsyncGenerator<string, any, unknown>)

    Get a stream of text predictions from an LLM.

      • (messages, params?): AsyncGenerator<string, any, unknown>
      • Parameters

        Returns AsyncGenerator<string, any, unknown>

        A stream of text predictions.

  • getTextPredictionSlm: ((messages: LLMMessage[], grammar?: string) => Promise<string>)

    Get a text prediction from a locally running Small Language Model(SLM).

      • (messages, grammar?): Promise<string>
      • Parameters

        • messages: LLMMessage[]

          The messages to send to the SLM.

        • Optionalgrammar: string

          The grammar in GBNF format to send to the SLM.

        Returns Promise<string>

        A text prediction.

  • isSlmCapable: (() => Promise<boolean>)
      • (): Promise<boolean>
      • Returns Promise<boolean>

        • Whether the user's device is capable of running a Small Language Model.
  • getStructuredTextPrediction:function
    • Get a stream of structured text predictions from an LLM.

      Type Parameters

      • T

      Parameters

      Returns AsyncGenerator<T, any, unknown>

isRunningInHighlight: (() => boolean)

Check if your app is running in Highlight.

once: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => void)

Adds an event listener for your Highlight app that will only fire once.

use Highlight.app.addListener instead, and call the return value to remove the listener after you've used it

permissions: {
    requestBackgroundPermission: (() => Promise<boolean>);
    requestClipboardReadPermission: (() => Promise<boolean>);
    requestScreenshotPermission: (() => Promise<boolean>);
    requestWindowContextPermission: (() => Promise<boolean>);
}

Type declaration

  • requestBackgroundPermission: (() => Promise<boolean>)

    Request permission to run your app in the background when Highlight starts.

      • (): Promise<boolean>
      • Returns Promise<boolean>

  • requestClipboardReadPermission: (() => Promise<boolean>)

    Request permission to read the contents of the user's clipboard.

      • (): Promise<boolean>
      • Returns Promise<boolean>

  • requestScreenshotPermission: (() => Promise<boolean>)

    Request permission to capture screenshots of the user's displays and windows

      • (): Promise<boolean>
      • Returns Promise<boolean>

  • requestWindowContextPermission: (() => Promise<boolean>)

    Request permission to capture the contents of the user's windows

      • (): Promise<boolean>
      • Returns Promise<boolean>

removeEventListener: ((event: HighlightEvent, listener: ((...args: any[]) => void)) => void)

Removes an event listener that you previously registered.

use Highlight.app.addListener instead, and call the return value to remove the listener

user: {
    addFact: ((fact: string) => Promise<void>);
    deleteFact: ((index: number) => Promise<void>);
    getAudio: ((longAudio: boolean) => Promise<string>);
    getAudioForDuration: ((duration: number) => Promise<string>);
    getClipboardContents: (() => Promise<undefined | {
        type: "image" | "text";
        value: string;
    }>);
    getContext: ((paneDetectionEnabled?: boolean) => Promise<HighlightContext>);
    getDisplayScreenshots: (() => Promise<{
        thumbnail: string;
    }[]>);
    getEmail: (() => Promise<string>);
    getFacts: (() => Promise<string[]>);
    getMicActivity: ((lastNumMs: number) => Promise<number>);
    getMicActivityInDecibels: ((lastNumMs: number) => Promise<number>);
    getNativeWindows: (() => Promise<{
        appName: string;
        pid: number;
        title: string;
    }[]>);
    getScreenshot: (() => Promise<string>);
    getWindowContext: ((windowTitle: string, scope?: WindowContextScope) => Promise<HighlightContext>);
    getWindowScreenshot: ((windowTitle: string) => Promise<string>);
    getWindows: (() => Promise<{
        appIcon?: string;
        windowTitle: string;
    }[]>);
    setAsrRealtime: ((isActive: boolean) => void);
    updateFact: ((index: number, fact: string) => Promise<void>);
}

Type declaration

  • addFact: ((fact: string) => Promise<void>)

    Add a fact to the user's facts.

      • (fact): Promise<void>
      • Parameters

        • fact: string

        Returns Promise<void>

  • deleteFact: ((index: number) => Promise<void>)

    Delete a fact at a given index.

      • (index): Promise<void>
      • Parameters

        • index: number

        Returns Promise<void>

  • getAudio: ((longAudio: boolean) => Promise<string>)

    Get the audio captions from the user's device.

      • (longAudio): Promise<string>
      • Parameters

        • longAudio: boolean

          If you want to get the long audio captions. Fetch ASR text for the last 2 hours

        Returns Promise<string>

        • The audio captions.
  • getAudioForDuration: ((duration: number) => Promise<string>)

    Get the audio captions from the user's device for the specified duration.

      • (duration): Promise<string>
      • Parameters

        • duration: number

          The duration in seconds for which you want to get the audio captions.

        Returns Promise<string>

        • The audio captions.
  • getClipboardContents: (() => Promise<undefined | {
        type: "image" | "text";
        value: string;
    }>)

    Get the contents of the clipboard.

      • (): Promise<undefined | {
            type: "image" | "text";
            value: string;
        }>
      • Returns Promise<undefined | {
            type: "image" | "text";
            value: string;
        }>

        • The type and value of the contents of the clipboard
  • getContext: ((paneDetectionEnabled?: boolean) => Promise<HighlightContext>)

    Fetches the context of the window (ignoring Highlight), the same as the eventListener "onContext". May be polled for repeated updates.

  • getDisplayScreenshots: (() => Promise<{
        thumbnail: string;
    }[]>)
      • (): Promise<{
            thumbnail: string;
        }[]>
      • Returns Promise<{
            thumbnail: string;
        }[]>

        • An array of base64 encoded screenshots of the user's displays.
  • getEmail: (() => Promise<string>)

    Get an email address for the user, for privacy, this address will forward to the user's real email address.

      • (): Promise<string>
      • Returns Promise<string>

        • The email address.
  • getFacts: (() => Promise<string[]>)

    Get the facts the user has set for themselves. This could be "I only want concise responses", "my name is...", etc.

      • (): Promise<string[]>
      • Returns Promise<string[]>

  • getMicActivity: ((lastNumMs: number) => Promise<number>)

    Get the microphone activity as a number from 0-5. 0 means no audio, 5 means absolute loudest.

      • (lastNumMs): Promise<number>
      • Parameters

        • lastNumMs: number

          specifies the duration in milliseconds for which you want to calculate the average energy of the mic input.

        Returns Promise<number>

        • The microphone activity from 0-5.
  • getMicActivityInDecibels: ((lastNumMs: number) => Promise<number>)

    Get the microphone activity in decibels.

      • (lastNumMs): Promise<number>
      • Parameters

        • lastNumMs: number

          specifies the duration in milliseconds for which you want to calculate the average energy of the mic input.

        Returns Promise<number>

        • The microphone activity in decibels.
  • getNativeWindows: (() => Promise<{
        appName: string;
        pid: number;
        title: string;
    }[]>)

    Gets the titles, app names and PID's of the user's open windows - This will also return app names and PIDs

      • (): Promise<{
            appName: string;
            pid: number;
            title: string;
        }[]>
      • Returns Promise<{
            appName: string;
            pid: number;
            title: string;
        }[]>

        • An array of window titles, PIDs and app names
  • getScreenshot: (() => Promise<string>)
      • (): Promise<string>
      • Returns Promise<string>

  • getWindowContext: ((windowTitle: string, scope?: WindowContextScope) => Promise<HighlightContext>)

    Get the context of a specific window

  • getWindowScreenshot: ((windowTitle: string) => Promise<string>)

    Get a screenshot of a specific window.

      • (windowTitle): Promise<string>
      • Parameters

        • windowTitle: string

          The title of the window to screenshot. This is the same as the window title you get from getWindows.

        Returns Promise<string>

        • Base64 encoded screenshot of the window.
  • getWindows: (() => Promise<{
        appIcon?: string;
        windowTitle: string;
    }[]>)

    Gets the titles and app icons of the user's open windows

      • (): Promise<{
            appIcon?: string;
            windowTitle: string;
        }[]>
      • Returns Promise<{
            appIcon?: string;
            windowTitle: string;
        }[]>

        • An array of window titles and app icons.
  • setAsrRealtime: ((isActive: boolean) => void)

    Set the ASR to run in realtime (1.1 seconds). This will use about 10x more GPU processing than non realtime, so once you are finished needing realtime transcripton, you should also set this to false

      • (isActive): void
      • Parameters

        • isActive: boolean

        Returns void

  • updateFact: ((index: number, fact: string) => Promise<void>)

    Update a fact at a given index.

      • (index, fact): Promise<void>
      • Parameters

        • index: number
        • fact: string

        Returns Promise<void>

vectorDB: {
    createTable: ((tableName: string) => Promise<void>);
    deleteItem: ((tableName: string, id: string) => Promise<void>);
    deleteTable: ((tableName: string) => Promise<void>);
    getAllItems: ((tableName: string) => Promise<any[]>);
    insertItem: ((tableName: string, text: string, metadata: object) => Promise<void>);
    search: ((tableName: string, text: string, maxResults: number) => Promise<any[]>);
    updateMetadata: ((tableName: string, id: string, metadata: object) => Promise<void>);
    updateText: ((tableName: string, id: string, text: string, metadata: object) => Promise<void>);
}

Type declaration

  • createTable: ((tableName: string) => Promise<void>)

    Create a table in the vector database.

      • (tableName): Promise<void>
      • Parameters

        • tableName: string

        Returns Promise<void>

  • deleteItem: ((tableName: string, id: string) => Promise<void>)

    Delete an item from a table in the vector database.

      • (tableName, id): Promise<void>
      • Parameters

        • tableName: string
        • id: string

        Returns Promise<void>

  • deleteTable: ((tableName: string) => Promise<void>)

    Delete a table from the vector database.

      • (tableName): Promise<void>
      • Parameters

        • tableName: string

        Returns Promise<void>

  • getAllItems: ((tableName: string) => Promise<any[]>)

    Get all items in a table in the vector database.

      • (tableName): Promise<any[]>
      • Parameters

        • tableName: string

        Returns Promise<any[]>

  • insertItem: ((tableName: string, text: string, metadata: object) => Promise<void>)

    Insert an item into a table in the vector database.

      • (tableName, text, metadata): Promise<void>
      • Parameters

        • tableName: string
        • text: string
        • metadata: object

        Returns Promise<void>

  • search: ((tableName: string, text: string, maxResults: number) => Promise<any[]>)

    Search for items in a table in the vector database.

      • (tableName, text, maxResults): Promise<any[]>
      • Parameters

        • tableName: string
        • text: string
        • maxResults: number

        Returns Promise<any[]>

  • updateMetadata: ((tableName: string, id: string, metadata: object) => Promise<void>)

    Update metadata for an item in a table in the vector database.

      • (tableName, id, metadata): Promise<void>
      • Parameters

        • tableName: string
        • id: string
        • metadata: object

        Returns Promise<void>

  • updateText: ((tableName: string, id: string, text: string, metadata: object) => Promise<void>)

    Update text for an item in a table in the vector database.

      • (tableName, id, text, metadata): Promise<void>
      • Parameters

        • tableName: string
        • id: string
        • text: string
        • metadata: object

        Returns Promise<void>