Application API
Application API
import { CodeBoltClient } from '@codebolt/clientsdk';
const client = new CodeBoltClient();
Quick Reference
| Method | Description |
|---|---|
addEnvAndServices | Triggers the addition of environment variables and services. |
getAppState | Retrieves the current application state. |
getAppStateLayout | Retrieves the application state layout. |
getCurrentLayout | Retrieves the current active layout. |
getEnvAndServices | Retrieves environment variables and service configurations. |
getPinnedAgent | Retrieves the currently pinned agent. |
getRootAppState | Retrieves the root application state. |
getThreadToken | Retrieves the current thread token. |
getTreeView | Retrieves the saved tree view state. |
saveTreeView | Saves the tree view state. |
setCurrentLayout | Sets the current active layout. |
setModeLayout | Sets the mode layout configuration. |
setPinnedAgent | Sets the pinned agent for the application. |
stopAllProcess | Stops all running processes. |
unpinAgent | Unpins the currently pinned agent. |
updateAppState | Updates the application state. |
updateRootAppState | Updates 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
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
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
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
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
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
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
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
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
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | SaveTreeViewRequest | Yes | The tree view state to save |
Returns: Promise<void> — A promise that resolves when the state has been saved
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | SetCurrentLayoutRequest | Yes | The layout selection |
Returns: Promise<void> — A promise that resolves when the layout has been applied
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).
| Parameter | Type | Required | Description |
|---|---|---|---|
data | SetModeLayoutRequest | Yes | The mode layout configuration |
Returns: Promise<void> — A promise that resolves when the layout has been set
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | SetPinnedAgentRequest | Yes | The pinning configuration |
Returns: Promise<void> — A promise that resolves when the agent has been pinned
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | StopAllProcessRequest | No | Optional configuration for the stop operation |
Returns: Promise<void> — A promise that resolves when all processes have been stopped
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | UnpinAgentRequest | No | Optional unpin configuration |
Returns: Promise<void> — A promise that resolves when the agent has been unpinned
updateAppState
client.application.updateAppState(data: UpdateAppStateRequest): Promise<void>
Updates the application state.
Applies changes to the application state, persisting the updated configuration across sessions.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | UpdateAppStateRequest | Yes | The state update payload |
Returns: Promise<void> — A promise that resolves when the state has been updated
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | UpdateRootAppStateRequest | Yes | The root state update payload |
Returns: Promise<void> — A promise that resolves when the state has been updated