Skip to main content

Application API

Application API

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

Quick Reference

MethodDescription
addEnvAndServicesTriggers the addition of environment variables and services.
getAppStateRetrieves the current application state.
getAppStateLayoutRetrieves the application state layout.
getCurrentLayoutRetrieves the current active layout.
getEnvAndServicesRetrieves environment variables and service configurations.
getPinnedAgentRetrieves the currently pinned agent.
getRootAppStateRetrieves the root application state.
getThreadTokenRetrieves the current thread token.
getTreeViewRetrieves the saved tree view state.
saveTreeViewSaves the tree view state.
setCurrentLayoutSets the current active layout.
setModeLayoutSets the mode layout configuration.
setPinnedAgentSets the pinned agent for the application.
stopAllProcessStops all running processes.
unpinAgentUnpins the currently pinned agent.
updateAppStateUpdates the application state.
updateRootAppStateUpdates the root application state.

Methods


addEnvAndServices

client.application.addEnvAndServices(): Promise<void>

Triggers the addition of environment variables and services.

Initiates the process of detecting and adding environment variables and service configurations to the current workspace.

No parameters.

Returns: Promise<void> — A promise that resolves when the operation is complete

Full reference →


getAppState

client.application.getAppState(): Promise<AppState>

Retrieves the current application state.

Returns the full application state object containing the active configuration, user preferences, and runtime status.

No parameters.

Returns: Promise<AppState> — A promise that resolves to the current AppState object

Full reference →


getAppStateLayout

client.application.getAppStateLayout(): Promise<AppStateLayout>

Retrieves the application state layout.

Returns the full layout configuration for the application, including all mode-specific layout definitions.

No parameters.

Returns: Promise<AppStateLayout> — A promise that resolves to the AppStateLayout object

Full reference →


getCurrentLayout

client.application.getCurrentLayout(): Promise<CurrentLayout>

Retrieves the current active layout.

Returns the layout configuration that is currently being displayed in the application UI.

No parameters.

Returns: Promise<CurrentLayout> — A promise that resolves to the CurrentLayout object

Full reference →


getEnvAndServices

client.application.getEnvAndServices(): Promise<EnvAndServices>

Retrieves environment variables and service configurations.

Returns the environment variables and external service connection details configured for the current workspace.

No parameters.

Returns: Promise<EnvAndServices> — A promise that resolves to the EnvAndServices object

Full reference →


getPinnedAgent

client.application.getPinnedAgent(): Promise<PinnedAgent | null>

Retrieves the currently pinned agent.

Returns the agent that is currently pinned to the UI, or null if no agent is pinned.

No parameters.

Returns: Promise<PinnedAgent | null> — A promise that resolves to the PinnedAgent or null

Full reference →


getRootAppState

client.application.getRootAppState(): Promise<RootAppState>

Retrieves the root application state.

Returns the top-level state object that encompasses all workspace and global application settings.

No parameters.

Returns: Promise<RootAppState> — A promise that resolves to the RootAppState object

Full reference →


getThreadToken

client.application.getThreadToken(): Promise<ThreadToken>

Retrieves the current thread token.

Returns the authentication token associated with the current thread, used for securing inter-process communication.

No parameters.

Returns: Promise<ThreadToken> — A promise that resolves to the ThreadToken object

Full reference →


getTreeView

client.application.getTreeView(): Promise<TreeViewState>

Retrieves the saved tree view state.

Returns the previously persisted tree view configuration so the UI can restore the user's preferred view.

No parameters.

Returns: Promise<TreeViewState> — A promise that resolves to the TreeViewState object

Full reference →


saveTreeView

client.application.saveTreeView(data: SaveTreeViewRequest): Promise<void>

Saves the tree view state.

Persists the current state of the file/project tree view, including expanded nodes, scroll position, and selection.

ParameterTypeRequiredDescription
dataSaveTreeViewRequestYesThe tree view state to save

Returns: Promise<void> — A promise that resolves when the state has been saved

Full reference →


setCurrentLayout

client.application.setCurrentLayout(data: SetCurrentLayoutRequest): Promise<void>

Sets the current active layout.

Switches the application to use a specific layout configuration, rearranging panels and views accordingly.

ParameterTypeRequiredDescription
dataSetCurrentLayoutRequestYesThe layout selection

Returns: Promise<void> — A promise that resolves when the layout has been applied

Full reference →


setModeLayout

client.application.setModeLayout(data: SetModeLayoutRequest): Promise<void>

Sets the mode layout configuration.

Configures how the application layout behaves in a specific mode (e.g., coding, debugging, reviewing).

ParameterTypeRequiredDescription
dataSetModeLayoutRequestYesThe mode layout configuration

Returns: Promise<void> — A promise that resolves when the layout has been set

Full reference →


setPinnedAgent

client.application.setPinnedAgent(data: SetPinnedAgentRequest): Promise<void>

Sets the pinned agent for the application.

Pins a specific agent to the UI, making it the default or always-visible agent for quick access.

ParameterTypeRequiredDescription
dataSetPinnedAgentRequestYesThe pinning configuration

Returns: Promise<void> — A promise that resolves when the agent has been pinned

Full reference →


stopAllProcess

client.application.stopAllProcess(data?: StopAllProcessRequest): Promise<void>

Stops all running processes.

Terminates every active process in the CodeBolt runtime, including agents, terminals, and background tasks. Use with caution.

ParameterTypeRequiredDescription
dataStopAllProcessRequestNoOptional configuration for the stop operation

Returns: Promise<void> — A promise that resolves when all processes have been stopped

Full reference →


unpinAgent

client.application.unpinAgent(data?: UnpinAgentRequest): Promise<void>

Unpins the currently pinned agent.

Removes the pinned agent from the UI, reverting to the default agent selection behavior.

ParameterTypeRequiredDescription
dataUnpinAgentRequestNoOptional unpin configuration

Returns: Promise<void> — A promise that resolves when the agent has been unpinned

Full reference →


updateAppState

client.application.updateAppState(data: UpdateAppStateRequest): Promise<void>

Updates the application state.

Applies changes to the application state, persisting the updated configuration across sessions.

ParameterTypeRequiredDescription
dataUpdateAppStateRequestYesThe state update payload

Returns: Promise<void> — A promise that resolves when the state has been updated

Full reference →


updateRootAppState

client.application.updateRootAppState(data: UpdateRootAppStateRequest): Promise<void>

Updates the root application state.

Applies changes to the top-level application state, affecting global settings across all workspaces.

ParameterTypeRequiredDescription
dataUpdateRootAppStateRequestYesThe root state update payload

Returns: Promise<void> — A promise that resolves when the state has been updated

Full reference →