Thread API
The thread module of the @codebolt/plugin-sdk.
import plugin from '@codebolt/plugin-sdk';
Quick Reference
| Method | Description |
|---|---|
createAndStartThread | Creates and immediately starts a new thread. |
createThread | Creates a new thread with comprehensive options. |
createThreadInBackground | Creates a thread in the background and resolves when the agent starts or fails. |
deleteThread | Deletes a thread. |
getThreadDetail | Retrieves detailed information about a specific thread. |
getThreadFileChanges | Retrieves file changes associated with a specific thread. |
getThreadFileChangesSummary | Retrieves file changes summary for ChangesSummaryPanel. |
getThreadList | Retrieves a list of threads with optional filtering. |
getThreadMessages | Retrieves messages for a specific thread. |
startThread | Starts a thread. |
updateThread | Updates an existing thread. |
updateThreadStatus | Updates the status of a thread. |
Methods
createAndStartThread
plugin.thread.createAndStartThread(options: object): Promise<object>
Creates and immediately starts a new thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
options | object | Yes | The thread creation and start parameters |
Returns: Promise<object> — A promise that resolves with the thread start response
createThread
plugin.thread.createThread(options: object): Promise<object>
Creates a new thread with comprehensive options.
| Parameter | Type | Required | Description |
|---|---|---|---|
options | object | Yes | The thread creation parameters |
Returns: Promise<object> — A promise that resolves with the thread creation response
createThreadInBackground
plugin.thread.createThreadInBackground(options: object): Promise<object | object>
Creates a thread in the background and resolves when the agent starts or fails.
| Parameter | Type | Required | Description |
|---|---|---|---|
options | object | Yes | The thread creation and start parameters |
Returns: Promise<object | object> — A promise that resolves with ThreadAgentStarted or ThreadAgentStartFailed response
deleteThread
plugin.thread.deleteThread(threadId: string): Promise<object>
Deletes a thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | string | Yes | The thread ID to delete |
Returns: Promise<object> — A promise that resolves with the thread deletion response
getThreadDetail
plugin.thread.getThreadDetail(options: object): Promise<object>
Retrieves detailed information about a specific thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
options | object | Yes | The thread detail options |
Returns: Promise<object> — A promise that resolves with the thread detail response
getThreadFileChanges
plugin.thread.getThreadFileChanges(threadId: string): Promise<ThreadFileChangesResponse>
Retrieves file changes associated with a specific thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | string | Yes | The thread ID |
Returns: Promise<ThreadFileChangesResponse> — A promise that resolves with the file changes
getThreadFileChangesSummary
plugin.thread.getThreadFileChangesSummary(threadId: string): Promise<ThreadFileChangesSummaryResponse>
Retrieves file changes summary for ChangesSummaryPanel. Returns data in the format: { title, changes, files }
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | string | Yes | The thread ID |
Returns: Promise<ThreadFileChangesSummaryResponse> — A promise that resolves with the file changes summary
getThreadList
plugin.thread.getThreadList(options: object): Promise<object>
Retrieves a list of threads with optional filtering.
| Parameter | Type | Required | Description |
|---|---|---|---|
options | object | Yes | Optional filters for threads (default: {}) |
Returns: Promise<object> — A promise that resolves with the thread list response
getThreadMessages
plugin.thread.getThreadMessages(options: object): Promise<object>
Retrieves messages for a specific thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
options | object | Yes | The thread messages options |
Returns: Promise<object> — A promise that resolves with the thread messages response
startThread
plugin.thread.startThread(threadId: string): Promise<object>
Starts a thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | string | Yes | The thread ID to start |
Returns: Promise<object> — A promise that resolves with the thread start response
updateThread
plugin.thread.updateThread(threadId: string, updates: object): Promise<object>
Updates an existing thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | string | Yes | The thread ID to update |
updates | object | Yes | The thread update parameters |
Returns: Promise<object> — A promise that resolves with the thread update response
updateThreadStatus
plugin.thread.updateThreadStatus(threadId: string, status: string): Promise<object>
Updates the status of a thread.
| Parameter | Type | Required | Description |
|---|---|---|---|
threadId | string | Yes | The thread ID |
status | string | Yes | The new status |
Returns: Promise<object> — A promise that resolves with the thread status update response