@acontext/acontext 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/sandbox.js +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,4 +10,4 @@ npm install @acontext/acontext
|
|
|
10
10
|
|
|
11
11
|
# 🔍 Document
|
|
12
12
|
|
|
13
|
-
To understand more about this SDK, please view [our docs](https://docs.acontext.
|
|
13
|
+
To understand more about this SDK, please view [our docs](https://docs.acontext.app/) and [api references](https://docs.acontext.app/api-reference/introduction)
|
package/dist/agent/sandbox.js
CHANGED
|
@@ -117,7 +117,8 @@ class BashTool extends base_1.AbstractBaseTool {
|
|
|
117
117
|
}
|
|
118
118
|
async execute(ctx, llmArguments) {
|
|
119
119
|
const command = llmArguments.command;
|
|
120
|
-
const
|
|
120
|
+
const timeoutSec = llmArguments.timeout ?? this._timeout;
|
|
121
|
+
const timeout = timeoutSec != null ? timeoutSec * 1000 : undefined;
|
|
121
122
|
if (!command) {
|
|
122
123
|
throw new Error('command is required');
|
|
123
124
|
}
|
|
@@ -177,6 +178,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
|
|
|
177
178
|
async execute(ctx, llmArguments) {
|
|
178
179
|
const command = llmArguments.command;
|
|
179
180
|
const path = llmArguments.path;
|
|
181
|
+
const timeoutMs = this._timeout != null ? this._timeout * 1000 : undefined;
|
|
180
182
|
if (!command) {
|
|
181
183
|
throw new Error('command is required');
|
|
182
184
|
}
|
|
@@ -185,7 +187,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
|
|
|
185
187
|
}
|
|
186
188
|
if (command === 'view') {
|
|
187
189
|
const viewRange = llmArguments.view_range;
|
|
188
|
-
const result = await (0, text_editor_1.viewFile)(ctx, path, viewRange,
|
|
190
|
+
const result = await (0, text_editor_1.viewFile)(ctx, path, viewRange, timeoutMs);
|
|
189
191
|
return JSON.stringify(result);
|
|
190
192
|
}
|
|
191
193
|
else if (command === 'create') {
|
|
@@ -193,7 +195,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
|
|
|
193
195
|
if (fileText === null || fileText === undefined) {
|
|
194
196
|
throw new Error('file_text is required for create command');
|
|
195
197
|
}
|
|
196
|
-
const result = await (0, text_editor_1.createFile)(ctx, path, fileText,
|
|
198
|
+
const result = await (0, text_editor_1.createFile)(ctx, path, fileText, timeoutMs);
|
|
197
199
|
return JSON.stringify(result);
|
|
198
200
|
}
|
|
199
201
|
else if (command === 'str_replace') {
|
|
@@ -205,7 +207,7 @@ class TextEditorTool extends base_1.AbstractBaseTool {
|
|
|
205
207
|
if (newStr === null || newStr === undefined) {
|
|
206
208
|
throw new Error('new_str is required for str_replace command');
|
|
207
209
|
}
|
|
208
|
-
const result = await (0, text_editor_1.strReplace)(ctx, path, oldStr, newStr,
|
|
210
|
+
const result = await (0, text_editor_1.strReplace)(ctx, path, oldStr, newStr, timeoutMs);
|
|
209
211
|
return JSON.stringify(result);
|
|
210
212
|
}
|
|
211
213
|
else {
|