Skip to content

PluginV3Context ​

Methods ​

addTheme() ​

addTheme(name: string, theme: object): Promise<void>

Add a custom theme to Altair's theme registry which can later be used

Parameters ​

• name: string

• theme

• theme.color.bg?: string= undefined

Main background color for the application

• theme.color.black?: string= undefined

Black color used for high contrast elements

• theme.color.blue?: string= undefined

Blue color for informational elements and links

• theme.color.border?: string= undefined

Primary border color for main UI elements

• theme.color.cerise?: string= undefined

Bright magenta/cerise color for special emphasis

• theme.color.darkGray?: string= undefined

Dark gray color for muted text and secondary elements

• theme.color.darkPurple?: string= undefined

Dark purple color for premium features or special elements

• theme.color.editor.atom?: string= undefined

Color for atomic values like boolean literals

• theme.color.editor.attribute?: string= undefined

Color for HTML/XML/GraphQL attributes

• theme.color.editor.builtin?: string= undefined

Color for built-in functions and types

• theme.color.editor.comment?: string= undefined

Color for code comments and documentation

• theme.color.editor.cursor?: string= undefined

Color for the text cursor in the editor

• theme.color.editor.definition?: string= undefined

Color for function, class, type definitions

• theme.color.editor.keyword?: string= undefined

Color for programming language keywords

• theme.color.editor.number?: string= undefined

Color for numeric literals in code

• theme.color.editor.property?: string= undefined

Color for properties

• theme.color.editor.punctuation?: string= undefined

Color for punctuation marks like brackets and commas

• theme.color.editor.string?: string= undefined

Color for string literals in code

• theme.color.editor.variable?: string= undefined

Color for variable names and identifiers

• theme.color.font?: string= undefined

Primary text color for readable content

• theme.color.gray?: string= undefined

Medium gray color for neutral backgrounds and borders

• theme.color.green?: string= undefined

Green color typically used for success states and positive actions

• theme.color.headerBg?: string= undefined

Background color specifically for the header section

• theme.color.lightGray?: string= undefined

Light gray color for subtle backgrounds and dividers

• theme.color.lightRed?: string= undefined

Light red/salmon color for subtle error indicators

• theme.color.offBg?: string= undefined

Alternative background color for cards, panels, and sections

• theme.color.offBorder?: string= undefined

Secondary border color for subtle divisions

• theme.color.offFont?: string= undefined

Secondary text color for less emphasized content

• theme.color.orange?: string= undefined

Orange color for warning states and secondary actions

• theme.color.primary?: string= undefined

Primary brand color used for main interactive elements

• theme.color.red?: string= undefined

Red color for error states and destructive actions

• theme.color.rose?: string= undefined

Rose/pink color for accent elements and highlights

• theme.color.secondary?: string= undefined

Secondary brand color used for supporting interactive elements

• theme.color.tertiary?: string= undefined

Tertiary brand color used for accent and decorative elements

• theme.color.white?: string= undefined

White color for light backgrounds and text

• theme.color.yellow?: string= undefined

Yellow color for caution states and highlights

• theme.easing?: string= undefined

CSS transition easing function for smooth animations

• theme.fontFamily.code?: string= undefined

Font family specifically for code editor and monospace content

• theme.fontFamily.default?: string= undefined

Default system font stack for UI elements

• theme.fontSize.base?: number= undefined

Base font size in pixels used for calculations

• theme.fontSize.body?: number= undefined

Standard body text font size

• theme.fontSize.bodySmaller?: number= undefined

Smaller body text font size for secondary content

• theme.fontSize.code?: number= undefined

Font size for code editor text

• theme.fontSize.remBase?: number= undefined

Root em base size in pixels for responsive typography

• theme.isSystem?: boolean= undefined

Whether this theme follows system preferences (light/dark mode)

• theme.shadow.color?: string= undefined

Color used for drop shadows and elevation effects

• theme.shadow.opacity?: number= undefined

Opacity level for shadow effects (0.0 to 1.0)

Returns ​

Promise<void>


createAction() ​

createAction(options: CreateActionOptions): Promise<undefined | string>

Adds an action button in the app to perform an action. The action is defined by the plugin and is executed when the button is clicked.

This returns the unique id of the action.

Parameters ​

• options: CreateActionOptions

Returns ​

Promise<undefined | string>


createAiSession() ​

createAiSession(): Promise<undefined | ISession>

Returns ​

Promise<undefined | ISession>


createPanel() ​

createPanel(panelName: string, options?: CreatePanelOptions): Promise<undefined | string>

Create an AltairPanel instance for displaying content in the app based on the panel name. The panel names are defined in the plugin options when the plugin is initialized.

This returns the unique id of the panel.

Parameters ​

• panelName: string

• options?: CreatePanelOptions

Returns ​

Promise<undefined | string>


createWindow() ​

createWindow(data: ExportWindowState): Promise<void>

Create a new window in the app with the given data

Parameters ​

• data: ExportWindowState

Returns ​

Promise<void>


destroyAction() ​

destroyAction(actionId: string): Promise<void>

Destroy an action based on its unique id

Parameters ​

• actionId: string

Returns ​

Promise<void>


destroyPanel() ​

destroyPanel(panelId: string): Promise<void>

Destroy a panel based on its unique id

Parameters ​

• panelId: string

Returns ​

Promise<void>


enableTheme() ​

enableTheme(name: string, darkMode?: boolean): Promise<void>

Enable a theme in the app

Parameters ​

• name: string

• darkMode?: boolean

Returns ​

Promise<void>


getActiveAiSession() ​

getActiveAiSession(): Promise<undefined | ISession>

Returns ​

Promise<undefined | ISession>


getAiSessionMessages() ​

getAiSessionMessages(sessionId: string): Promise<undefined | IMessage[]>

Parameters ​

• sessionId: string

Returns ​

Promise<undefined | IMessage[]>


getAvailableCredits() ​

getAvailableCredits(): Promise<undefined | IAvailableCredits>

Returns ​

Promise<undefined | IAvailableCredits>


getCurrentWindowState() ​

getCurrentWindowState(): Promise<undefined | PluginWindowState>

Returns data about the current window (tab) in the app

Returns ​

Promise<undefined | PluginWindowState>


getUserInfo() ​

getUserInfo(): Promise<undefined | PluginUserInfo>

Returns ​

Promise<undefined | PluginUserInfo>


getWindowState() ​

getWindowState(windowId: string): Promise<undefined | PluginWindowState>

Returns data about a window (tab) in the app

Parameters ​

• windowId: string

Returns ​

Promise<undefined | PluginWindowState>


isElectron() ​

isElectron(): Promise<boolean>

Check if the app is running in an Electron environment

Returns ​

Promise<boolean>


off() ​

off(): void

Remove all the event listeners

Returns ​

void


on() ​

on<E>(event: E, callback: PluginEventCallback<E>): object

Subscribe to an event in the app to perform an action within the plugin

Type parameters ​

• E extends keyof PluginEventPayloadMap

Parameters ​

• event: E

• callback: PluginEventCallback<E>

Returns ​

object

unsubscribe() ​

unsubscribe: () => void

Returns ​

void


rateAiSessionMessage() ​

rateAiSessionMessage(sessionId: string, messageId: string, rating: number): Promise<undefined | IMessage>

Parameters ​

• sessionId: string

• messageId: string

• rating: number

Returns ​

Promise<undefined | IMessage>


sendMessageToAiSession() ​

sendMessageToAiSession(sessionId: string, message: ISendMessageDto): Promise<undefined | object>

Parameters ​

• sessionId: string

• message: ISendMessageDto

Returns ​

Promise<undefined | object>


setEndpoint() ​

setEndpoint(windowId: string, url: string): Promise<void>

Set the endpoint in the app for the given window

Parameters ​

• windowId: string

• url: string

Returns ​

Promise<void>


setHeader() ​

setHeader(windowId: string, key: string, value: string): Promise<void>

Add a header in the app for the given window

Parameters ​

• windowId: string

• key: string

• value: string

Returns ​

Promise<void>


setQuery() ​

setQuery(windowId: string, query: string): Promise<void>

Set the query in the app for the given window

Parameters ​

• windowId: string

• query: string

Returns ​

Promise<void>


setVariables() ​

setVariables(windowId: string, variables: string): Promise<void>

Set the variables in the app for the given window

Parameters ​

• windowId: string

• variables: string

Returns ​

Promise<void>