This library provides a set of tools and utilities for creating Codebolt agents, enabling seamless integration with the Codebolt platform with full TypeScript support.
- Create and manage Codebolt agents
- Interact with the Codebolt platform
- Utilize Codebolt's powerful API
- Full TypeScript support with comprehensive type definitions
- Type-safe API interactions
- IntelliSense support in TypeScript/JavaScript IDEs
npm install @codebolt/codeboltjs
const codebolt = require('@codebolt/codeboltjs');
// Set up message handling
codebolt.onMessage(async (userMessage) => {
console.log('User said:', userMessage.userMessage);
// Read a file
const content = await codebolt.fs.readFile({ path: './example.txt' });
console.log('File content:', content);
return { status: 'completed' };
});
import codebolt from 'codeboltjs';
import type {
ChatMessageFromUser,
ReadFileOptions,
BrowserScreenshotOptions
} from 'codeboltjs';
// Type-safe message handling
codebolt.onMessage(async (userMessage: ChatMessageFromUser) => {
console.log('User said:', userMessage.userMessage);
console.log('Mentioned files:', userMessage.mentionedFiles);
// Type-safe file operations
const readOptions: ReadFileOptions = {
path: './config.json',
encoding: 'utf8',
askForPermission: true
};
const content = await codebolt.fs.readFile(readOptions);
// Type-safe browser operations
const screenshotOptions: BrowserScreenshotOptions = {
fullPage: true,
quality: 90,
format: 'png'
};
const screenshot = await codebolt.browser.takeScreenshot(screenshotOptions);
return { status: 'completed', data: content };
});
This library provides comprehensive TypeScript support with over 200+ type definitions covering:
- Message & Tool Types:
Message
,ToolCall
,Tool
,LLMInferenceParams
- API Response Types:
APIResponse
,SuccessResponse
,FailureResponse
- Configuration Types:
CodeboltConfig
,AgentConfiguration
- File System:
ReadFileOptions
,WriteFileOptions
,SearchFilesOptions
- Browser:
BrowserNavigationOptions
,BrowserScreenshotOptions
- Terminal:
TerminalExecuteOptions
- Git:
GitCommitOptions
,GitLogOptions
- LLM:
LLMChatOptions
,OpenAIMessage
- Vector DB:
VectorAddOptions
,VectorQueryOptions
import codebolt, { type Message, type ToolCall } from 'codeboltjs';
import codebolt from 'codeboltjs';
import type { Message, ToolCall, LLMChatOptions } from 'codeboltjs/types';
import codebolt from 'codeboltjs';
import type * as CodeboltTypes from 'codeboltjs/types';
For detailed type usage examples, see TYPES.md.
codebolt.fs
- File system operationscodebolt.git
- Git operationscodebolt.browser
- Browser automationcodebolt.terminal
- Terminal/shell operationscodebolt.llm
- LLM interactionscodebolt.chat
- Chat managementcodebolt.agent
- Agent operationscodebolt.vectordb
- Vector database operationscodebolt.mcp
- MCP (Model Context Protocol) tools
// Wait for connection
await codebolt.waitForReady();
// File operations
const files = await codebolt.fs.listFiles({ path: './src', recursive: true });
const content = await codebolt.fs.readFile({ path: './package.json' });
// Browser operations
await codebolt.browser.navigateTo({ url: 'https://example.com' });
const screenshot = await codebolt.browser.takeScreenshot({ fullPage: true });
// Terminal operations
const result = await codebolt.terminal.execute({
command: 'npm install',
cwd: './my-project'
});
// LLM operations
const response = await codebolt.llm.chat({
messages: [{ role: 'user', content: 'Explain TypeScript' }],
temperature: 0.7
});
# Install dependencies
npm install
# Build TypeScript to dist/ (recommended for development)
npm run build
# Build webpack bundle to build/bundle.js (single file for distribution)
npm run build:webpack
# Build both TypeScript and webpack versions
npm run build:all
# Clean all build artifacts
npm run clean
# Build documentation
npm run build:docs
The project supports two build methods:
-
TypeScript Build (
npm run build
)- Outputs to
dist/
directory - Preserves module structure
- Includes separate
.js
and.d.ts
files - Recommended for npm publishing and development
- Outputs to
-
Webpack Build (
npm run build:webpack
)- Outputs to
build/bundle.js
- Single bundled file
- Optimized for production deployment
- Works in Node.js environments
- Outputs to
src/
- TypeScript source codecore/
- Core library classes (Codebolt class, WebSocket management)modules/
- Feature modules (fs, git, browser, etc.)types/
- TypeScript type definitionsutils/
- Utility functions
dist/
- Compiled JavaScript and type definitions (generated by TypeScript)build/
- Webpack bundle (generated by webpack)docs/
- Generated documentation
- Type Definitions Guide - Comprehensive TypeScript usage guide
- Codebolt Documentation - Platform documentation
- API Reference - Generated from source code (coming soon)