Skip to content

Commit 9a9ba73

Browse files
committed
updated
1 parent da00e89 commit 9a9ba73

File tree

10 files changed

+1566
-279
lines changed

10 files changed

+1566
-279
lines changed

docs/api/apiaccess/terminal/executeCommandWithStream.md

Lines changed: 532 additions & 31 deletions
Large diffs are not rendered by default.

docs/api/apiaccess/terminal/sendManualInterrupt.md

Lines changed: 440 additions & 32 deletions
Large diffs are not rendered by default.

docs/api/apiaccess/tokenizer/addToken.md

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,83 @@ cbparameters:
88
typeName: string
99
description: The key/string to be tokenized.
1010
returns:
11-
signatureTypeName: Promise
12-
description: A promise that resolves with the tokenization response.
13-
typeArgs:
14-
- type: reference
15-
name: AddTokenResponse
11+
signatureTypeName: Promise<AddTokenResponse>
12+
description: A promise that resolves with an `AddTokenResponse` object containing the tokenization response.
1613
data:
1714
name: addToken
1815
category: tokenizer
1916
link: addToken.md
2017
---
21-
<CBBaseInfo/>
18+
<CBBaseInfo/>
2219
<CBParameters/>
2320

24-
## Response Structure
21+
### Response Structure
22+
23+
The method returns a Promise that resolves to an `AddTokenResponse` object with the following properties:
24+
25+
- **`type`** (string): Always "addTokenResponse".
26+
- **`token`** (string, optional): The token that was added to the system.
27+
- **`count`** (number, optional): The count or number of tokens processed.
28+
- **`success`** (boolean, optional): Indicates if the operation was successful.
29+
- **`message`** (string, optional): A message with additional information about the operation.
30+
- **`error`** (string, optional): Error details if the operation failed.
31+
- **`messageId`** (string, optional): A unique identifier for the message.
32+
- **`threadId`** (string, optional): The thread identifier.
33+
34+
### Examples
2535

2636
```javascript
27-
{
28-
type: 'addTokenResponse',
29-
message: 'success',
30-
tokens: number[] // Array of token IDs
37+
// Example 1: Basic token addition
38+
const result = await codebolt.tokenizer.addToken("api_key_1");
39+
console.log("Response type:", result.type); // "addTokenResponse"
40+
console.log("Token added:", result.token); // "api_key_1"
41+
console.log("Token count:", result.count); // Number of tokens processed
42+
43+
// Example 2: Add a complex token
44+
const tokenResult = await codebolt.tokenizer.addToken("user_session_token_12345");
45+
if (tokenResult.success) {
46+
console.log("✅ Token added successfully");
47+
console.log("Token:", tokenResult.token);
48+
console.log("Count:", tokenResult.count);
49+
} else {
50+
console.error("❌ Failed to add token:", tokenResult.error);
3151
}
32-
```
3352

34-
## Example
35-
36-
```js
37-
import codebolt from '@codebolt/codeboltjs';
38-
39-
async function addTokenExample() {
40-
try {
41-
const response = await codebolt.tokenizer.addToken("api_key_1");
42-
console.log("Token added:", response);
43-
// Output: {
44-
// type: 'addTokenResponse',
45-
// message: 'success',
46-
// tokens: [15042, 62, 2539, 62, 16]
47-
// }
48-
} catch (error) {
49-
console.error("Failed to add token:", error);
53+
// Example 3: Error handling
54+
try {
55+
const response = await codebolt.tokenizer.addToken("my_token");
56+
57+
if (response.success && response.token) {
58+
console.log('✅ Token added successfully');
59+
console.log('Token:', response.token);
60+
console.log('Count:', response.count);
61+
} else {
62+
console.error('❌ Token addition failed:', response.error);
5063
}
64+
} catch (error) {
65+
console.error('Error adding token:', error);
5166
}
5267

53-
addTokenExample();
54-
```
68+
// Example 4: Batch token addition
69+
const tokensToAdd = [
70+
"auth_token_1",
71+
"session_token_2",
72+
"api_key_3"
73+
];
74+
75+
for (const token of tokensToAdd) {
76+
const result = await codebolt.tokenizer.addToken(token);
77+
if (result.success) {
78+
console.log(`✅ Added token: ${result.token} (count: ${result.count})`);
79+
} else {
80+
console.log(`❌ Failed to add token: ${token}`);
81+
}
82+
}
83+
```
84+
85+
### Notes
86+
87+
- The `key` parameter should be a string representing the token to be added to the system.
88+
- The response will contain the added token and processing information.
89+
- Use error handling to gracefully handle cases where token addition fails.
90+
- This operation communicates with the system via WebSocket for real-time processing.

docs/api/apiaccess/tokenizer/getToken.md

Lines changed: 72 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,89 @@ cbparameters:
88
typeName: string
99
description: The key associated with the token to be retrieved.
1010
returns:
11-
signatureTypeName: Promise
12-
description: A promise that resolves with the token response.
13-
typeArgs:
14-
- type: reference
15-
name: GetTokenResponse
11+
signatureTypeName: Promise<GetTokenResponse>
12+
description: A promise that resolves with a `GetTokenResponse` object containing the token response.
1613
data:
1714
name: getToken
1815
category: tokenizer
1916
link: getToken.md
2017
---
21-
<CBBaseInfo/>
18+
<CBBaseInfo/>
2219
<CBParameters/>
2320

24-
## Response Structure
21+
### Response Structure
22+
23+
The method returns a Promise that resolves to a `GetTokenResponse` object with the following properties:
24+
25+
- **`type`** (string): Always "getTokenResponse".
26+
- **`tokens`** (string[], optional): Array of tokens retrieved from the system.
27+
- **`count`** (number, optional): The count or number of tokens retrieved.
28+
- **`success`** (boolean, optional): Indicates if the operation was successful.
29+
- **`message`** (string, optional): A message with additional information about the operation.
30+
- **`error`** (string, optional): Error details if the operation failed.
31+
- **`messageId`** (string, optional): A unique identifier for the message.
32+
- **`threadId`** (string, optional): The thread identifier.
33+
34+
### Examples
2535

2636
```javascript
27-
{
28-
type: 'getTokenResponse',
29-
token: string // The original token key/value
37+
// Example 1: Basic token retrieval
38+
const result = await codebolt.tokenizer.getToken("api_key_1");
39+
console.log("Response type:", result.type); // "getTokenResponse"
40+
console.log("Tokens retrieved:", result.tokens); // Array of tokens
41+
console.log("Token count:", result.count); // Number of tokens
42+
43+
// Example 2: Retrieve session token
44+
const tokenResult = await codebolt.tokenizer.getToken("user_session_token");
45+
if (tokenResult.success && tokenResult.tokens) {
46+
console.log("✅ Tokens retrieved successfully");
47+
console.log("Tokens:", tokenResult.tokens);
48+
console.log("Count:", tokenResult.count);
49+
} else {
50+
console.error("❌ Failed to retrieve tokens:", tokenResult.error);
3051
}
31-
```
3252

33-
## Example
34-
35-
```js
36-
import codebolt from '@codebolt/codeboltjs';
37-
38-
async function getTokenExample() {
39-
try {
40-
const response = await codebolt.tokenizer.getToken("api_key_1");
41-
console.log("Token retrieved:", response);
42-
// Output: {
43-
// type: 'getTokenResponse',
44-
// token: 'api_key_1'
45-
// }
46-
} catch (error) {
47-
console.error("Failed to retrieve token:", error);
53+
// Example 3: Error handling
54+
try {
55+
const response = await codebolt.tokenizer.getToken("my_token_key");
56+
57+
if (response.success && response.tokens) {
58+
console.log('✅ Tokens retrieved successfully');
59+
console.log('Tokens array:', response.tokens);
60+
console.log('Number of tokens:', response.count);
61+
62+
// Process each token
63+
response.tokens.forEach((token, index) => {
64+
console.log(`Token ${index + 1}: ${token}`);
65+
});
66+
} else {
67+
console.error('❌ Token retrieval failed:', response.error);
4868
}
69+
} catch (error) {
70+
console.error('Error retrieving tokens:', error);
4971
}
5072

51-
getTokenExample();
52-
```
73+
// Example 4: Multiple token key retrieval
74+
const tokenKeys = [
75+
"auth_token",
76+
"session_token",
77+
"api_key"
78+
];
79+
80+
for (const key of tokenKeys) {
81+
const result = await codebolt.tokenizer.getToken(key);
82+
if (result.success && result.tokens) {
83+
console.log(`✅ Retrieved tokens for key '${key}':`, result.tokens);
84+
console.log(` Count: ${result.count}`);
85+
} else {
86+
console.log(`❌ No tokens found for key: ${key}`);
87+
}
88+
}
89+
```
90+
91+
### Notes
92+
93+
- The `key` parameter should be a string representing the token key to retrieve from the system.
94+
- The response will contain an array of tokens associated with the provided key.
95+
- Use error handling to gracefully handle cases where no tokens are found or retrieval fails.
96+
- This operation communicates with the system via WebSocket for real-time processing.

docs/api/apiaccess/tool/configureToolBox.md

Lines changed: 88 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
---
22
name: configureToolBox
33
cbbaseinfo:
4-
description: Configures a toolbox with specified settings and parameters.
4+
description: Configures a specific toolbox with provided configuration settings.
55
cbparameters:
66
parameters:
77
- name: name
88
typeName: string
9-
description: The name of the toolbox to configure
9+
description: The name of the toolbox to configure.
1010
- name: config
1111
typeName: object
12-
description: Configuration object containing toolbox-specific settings
12+
description: Configuration object containing settings specific to the toolbox.
1313
returns:
14-
signatureTypeName: Promise
15-
description: A promise that resolves with configuration result status
16-
typeArgs:
17-
- type: object
14+
signatureTypeName: Promise<ConfigureToolBoxResponse>
15+
description: A promise that resolves with a `ConfigureToolBoxResponse` object containing the configuration result.
1816
data:
1917
name: configureToolBox
2018
category: tool
@@ -23,6 +21,89 @@ data:
2321
<CBBaseInfo/>
2422
<CBParameters/>
2523

24+
### Response Structure
25+
26+
The method returns a Promise that resolves to a `ConfigureToolBoxResponse` object with the following properties:
27+
28+
- **`type`** (string): Always "configureToolBoxResponse".
29+
- **`configuration`** (object, optional): The configuration object that was applied to the toolbox.
30+
- **`data`** (any, optional): Additional data related to the configuration process.
31+
- **`success`** (boolean, optional): Indicates if the operation was successful.
32+
- **`message`** (string, optional): A message with additional information about the operation.
33+
- **`error`** (string, optional): Error details if the operation failed.
34+
- **`messageId`** (string, optional): A unique identifier for the message.
35+
- **`threadId`** (string, optional): The thread identifier.
36+
37+
### Examples
38+
39+
```javascript
40+
// Example 1: Configure a database toolbox
41+
const dbConfig = await codebolt.mcp.configureToolBox('sqlite', {
42+
database_path: './data/myapp.db',
43+
timeout: 30000,
44+
readonly: false
45+
});
46+
console.log("Response type:", dbConfig.type); // "configureToolBoxResponse"
47+
console.log("Configuration applied:", dbConfig.configuration);
48+
49+
// Example 2: Configure with error handling
50+
const result = await codebolt.mcp.configureToolBox('filesystem', {
51+
base_path: '/home/user/projects',
52+
permissions: ['read', 'write'],
53+
max_file_size: '10MB'
54+
});
55+
56+
if (result.success) {
57+
console.log("✅ Toolbox configured successfully");
58+
console.log("Configuration:", result.configuration);
59+
console.log("Additional data:", result.data);
60+
} else {
61+
console.error("❌ Configuration failed:", result.error);
62+
}
63+
64+
// Example 3: Configure web scraping toolbox
65+
const webConfig = await codebolt.mcp.configureToolBox('web-scraper', {
66+
user_agent: 'MyApp/1.0',
67+
timeout: 15000,
68+
max_retries: 3,
69+
rate_limit: {
70+
requests_per_minute: 60
71+
}
72+
});
73+
74+
if (webConfig.success && webConfig.configuration) {
75+
console.log("✅ Web scraper configured");
76+
console.log("User agent:", webConfig.configuration.user_agent);
77+
console.log("Rate limit:", webConfig.configuration.rate_limit);
78+
}
79+
80+
// Example 4: Error handling
81+
try {
82+
const response = await codebolt.mcp.configureToolBox('analytics', {
83+
api_key: 'your-api-key',
84+
endpoint: 'https://api.analytics.com',
85+
version: 'v2'
86+
});
87+
88+
if (response.success && response.configuration) {
89+
console.log('✅ Analytics toolbox configured successfully');
90+
console.log('Configuration:', response.configuration);
91+
} else {
92+
console.error('❌ Configuration failed:', response.error);
93+
}
94+
} catch (error) {
95+
console.error('Error configuring toolbox:', error);
96+
}
97+
```
98+
99+
### Notes
100+
101+
- The `name` parameter must be a valid toolbox name that is available in the system.
102+
- The `config` object structure depends on the specific requirements of each toolbox.
103+
- Configuration settings typically include API keys, endpoints, file paths, and operational parameters.
104+
- Successfully configured toolboxes become available for tool execution.
105+
- This operation communicates with the system via WebSocket for real-time processing.
106+
26107
### Simple Example
27108
```js
28109
// Basic SQLite toolbox configuration

0 commit comments

Comments
 (0)