Skip to content

Commit 36e2125

Browse files
committed
2 parents 57b2132 + 60b6d41 commit 36e2125

22 files changed

+2868
-107
lines changed

src/agentlib/promptbuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { UserMessage } from "./usermessage";
22
import { SystemPrompt } from "./systemprompt";
33
import { TaskInstruction } from "./taskInstruction";
4-
import { UserMessage as CLIUserMessage } from "../types/cliWebSocketInterfaces";
4+
import { UserMessage as CLIUserMessage } from "../types/socketMessageTypes";
55
import yaml from 'js-yaml';
66
import fs from 'fs';
77
import path from 'path';

src/index.ts

Lines changed: 14 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -25,78 +25,22 @@ import {chatSummary} from './modules/history'
2525
import codeboltTools from './modules/mcp';
2626
import cbagent from './modules/agent';
2727
import cbutils from './modules/utils';
28-
import type { ChatMessageFromUser, LLMResponse, UserMessage } from './types/cliWebSocketInterfaces';
28+
import type { ChatMessageFromUser, LLMResponse, UserMessage } from './types/socketMessageTypes';
2929
import { userInfo } from 'os';
3030

31-
/**
32-
* Represents a message in the conversation with roles and content.
33-
*/
34-
export interface Message {
35-
/** The role of the message sender: user, assistant, tool, or system */
36-
role: 'user' | 'assistant' | 'tool' | 'system';
37-
/** The content of the message, can be an array of content blocks or a string */
38-
content: any[] | string;
39-
/** Optional ID for tool calls */
40-
tool_call_id?: string;
41-
/** Optional tool calls for assistant messages */
42-
tool_calls?: ToolCall[];
43-
/** Additional properties that might be present */
44-
[key: string]: any;
45-
}
46-
47-
/**
48-
* Represents a tool call in OpenAI format
49-
*/
50-
export interface ToolCall {
51-
/** Unique identifier for this tool call */
52-
id: string;
53-
/** The type of tool call */
54-
type: 'function';
55-
/** Function call details */
56-
function: {
57-
/** Name of the function to call */
58-
name: string;
59-
/** Arguments for the function call as JSON string */
60-
arguments: string;
61-
};
62-
}
63-
64-
/**
65-
* Represents a tool definition in OpenAI format
66-
*/
67-
export interface Tool {
68-
/** The type of tool */
69-
type: 'function';
70-
/** Function definition */
71-
function: {
72-
/** Name of the function */
73-
name: string;
74-
/** Description of what the function does */
75-
description?: string;
76-
/** JSON schema for the function parameters */
77-
parameters?: any;
78-
};
79-
}
80-
81-
/**
82-
* LLM inference request parameters
83-
*/
84-
export interface LLMInferenceParams {
85-
/** Array of messages in the conversation */
86-
messages: Message[];
87-
/** Available tools for the model to use */
88-
tools?: Tool[];
89-
/** How the model should use tools */
90-
tool_choice?: 'auto' | 'none' | 'required' | { type: 'function'; function: { name: string } };
91-
/** The LLM role to determine which model to use */
92-
llmrole: string;
93-
/** Maximum number of tokens to generate */
94-
max_tokens?: number;
95-
/** Temperature for response generation */
96-
temperature?: number;
97-
/** Whether to stream the response */
98-
stream?: boolean;
99-
}
31+
// Re-export public API types for user convenience
32+
export type {
33+
Message,
34+
ToolCall,
35+
Tool,
36+
LLMInferenceParams,
37+
APIResponse,
38+
CodeboltConfig,
39+
ProgressCallback,
40+
ErrorCallback,
41+
SuccessCallback,
42+
CompletionCallback
43+
} from './types/libFunctionTypes';
10044

10145
/**
10246
* @class Codebolt

src/modules/agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GetAgentStateResponse, FindAgentByTaskResponse, ListAgentsResponse, AgentsDetailResponse, TaskCompletionResponse } from '../types/cliWebSocketInterfaces';
1+
import { GetAgentStateResponse, FindAgentByTaskResponse, ListAgentsResponse, AgentsDetailResponse, TaskCompletionResponse } from '../types/socketMessageTypes';
22
import cbws from '../core/websocket';
33

44

src/modules/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import cbws from '../core/websocket';
2-
import { GoToPageResponse, UrlResponse, GetMarkdownResponse, HtmlReceived, ExtractTextResponse, GetContentResponse, BrowserActionResponseData, BrowserScreenshotResponse, BrowserInfoResponse, BrowserSnapshotResponse } from '../types/cliWebSocketInterfaces';
2+
import { GoToPageResponse, UrlResponse, GetMarkdownResponse, HtmlReceived, ExtractTextResponse, GetContentResponse, BrowserActionResponseData, BrowserScreenshotResponse, BrowserInfoResponse, BrowserSnapshotResponse } from '../types/socketMessageTypes';
33
/**
44
* A module for interacting with a browser through WebSockets.
55
*/

src/modules/chat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// chat.ts
22
import cbws from '../core/websocket';
3-
import { ChatMessage, UserMessage } from '../types/cliWebSocketInterfaces';
3+
import { ChatMessage, UserMessage } from '../types/socketMessageTypes';
44

55
type RequestHandler = (request: any, response: (data: any) => void) => Promise<void> | void;
66
/**

src/modules/codeutils.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,12 @@ import path from 'path';
55
// import JavaScript from 'tree-sitter-javascript';
66
// import typescript from "tree-sitter-typescript"; // TypeScript and TSX grammar
77

8-
import { MatchProblemResponse, GetMatcherListTreeResponse, getMatchDetail } from '../types/cliWebSocketInterfaces';
8+
import { MatchProblemResponse, GetMatcherListTreeResponse, getMatchDetail } from '../types/socketMessageTypes';
99
import { loadRequiredLanguageParsers } from '../utils/parse-source-code/languageParser';
1010

11-
// Define our own interface for the JS tree response
12-
export interface JSTreeStructureItem {
13-
type: string;
14-
name: string;
15-
startLine: number;
16-
endLine: number;
17-
startColumn: number;
18-
endColumn: number;
19-
nodeType: string;
20-
}
21-
22-
export interface JSTreeResponse {
23-
event: string;
24-
payload?: {
25-
filePath: string;
26-
structure: JSTreeStructureItem[];
27-
};
28-
error?: string;
29-
}
11+
// Import and re-export types from InternalTypes for consistency
12+
import type { JSTreeStructureItem, JSTreeResponse } from '../types/InternalTypes';
13+
export type { JSTreeStructureItem, JSTreeResponse };
3014

3115
/**
3216
* A utility module for working with code.

src/modules/dbmemory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import cbws from '../core/websocket';
2-
import { MemorySetResponse, MemoryGetResponse } from '../types/cliWebSocketInterfaces';
2+
import { MemorySetResponse, MemoryGetResponse } from '../types/socketMessageTypes';
33

44
/**
55
* A module for handling in-memory database operations via WebSocket.

src/modules/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import cbws from '../core/websocket';
2-
import { DebugAddLogResponse, OpenDebugBrowserResponse } from '../types/cliWebSocketInterfaces';
2+
import { DebugAddLogResponse, OpenDebugBrowserResponse } from '../types/socketMessageTypes';
33
export enum logType{
44
info="info",
55
error="error",

src/modules/fs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import cbws from '../core/websocket';
2-
import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse } from '../types/cliWebSocketInterfaces';
2+
import { CreateFileResponse, CreateFolderResponse, ReadFileResponse, UpdateFileResponse, DeleteFileResponse, DeleteFolderResponse } from '../types/socketMessageTypes';
33
/**
44
* @module cbfs
55
* @description This module provides functionality to interact with the filesystem.

src/modules/history.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import cbws from '../core/websocket';
2-
import { GetSummarizeAllResponse, GetSummarizeResponse } from '../types/cliWebSocketInterfaces';
2+
import { GetSummarizeAllResponse, GetSummarizeResponse } from '../types/socketMessageTypes';
3+
import { LogType } from '../types/commonTypes';
34

45
/**
56
* Enum representing different types of log messages.
7+
* @deprecated Use LogType from commonTypes instead
68
*/
79
export enum logType {
810
/** Informational messages */
@@ -13,6 +15,9 @@ export enum logType {
1315
warning = "warning"
1416
}
1517

18+
// Re-export the new LogType for consistency
19+
export { LogType };
20+
1621
/**
1722
* Object with methods for summarizing chat history.
1823
* Provides functionality to create summaries of conversation history.

0 commit comments

Comments
 (0)