@robota-sdk/agent-tools 3.0.0-beta.33 → 3.0.0-beta.34

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 CHANGED
@@ -46,16 +46,16 @@ const agent = new Robota({
46
46
 
47
47
  ## Built-in Tools (8)
48
48
 
49
- | Export | Tool Name | Description |
50
- | --------------- | --------- | ------------------------------------ |
51
- | `bashTool` | Bash | Execute shell commands |
52
- | `readTool` | Read | Read file contents with line numbers |
53
- | `writeTool` | Write | Write content to a file |
54
- | `editTool` | Edit | Replace a specific string in a file |
55
- | `globTool` | Glob | Find files matching a glob pattern |
56
- | `grepTool` | Grep | Search file contents with regex |
57
- | `webFetchTool` | WebFetch | Fetch URL content (HTML-to-text) |
58
- | `webSearchTool` | WebSearch | Web search via Brave Search API |
49
+ | Export | Tool Name | Description |
50
+ | --------------- | --------- | ------------------------------------------------ |
51
+ | `bashTool` | Bash | Execute shell commands via `child_process.spawn` |
52
+ | `readTool` | Read | Read file contents with line numbers (cat -n) |
53
+ | `writeTool` | Write | Write content to a file (creates parent dirs) |
54
+ | `editTool` | Edit | Replace a specific string in a file |
55
+ | `globTool` | Glob | Find files matching a glob pattern (fast-glob) |
56
+ | `grepTool` | Grep | Search file contents with regex patterns |
57
+ | `webFetchTool` | WebFetch | Fetch URL content (HTML-to-text conversion) |
58
+ | `webSearchTool` | WebSearch | Web search via Brave Search API |
59
59
 
60
60
  ## Tool Infrastructure
61
61
 
@@ -66,7 +66,31 @@ const agent = new Robota({
66
66
  | `createFunctionTool` | Factory for creating function tools |
67
67
  | `createZodFunctionTool` | Factory with Zod validation and JSON Schema conversion |
68
68
  | `OpenAPITool` | Tool generated from OpenAPI specification |
69
+ | `createOpenAPITool` | Factory for creating OpenAPI tools |
69
70
  | `zodToJsonSchema` | Converts Zod schemas to JSON Schema format |
71
+ | `TToolResult` | Result type for built-in CLI tool invocations |
72
+
73
+ ## TToolResult Shape
74
+
75
+ ```typescript
76
+ interface TToolResult {
77
+ success: boolean;
78
+ output: string;
79
+ error?: string;
80
+ exitCode?: number;
81
+ startLine?: number; // Start line number of the edit in the original file (Edit tool only)
82
+ }
83
+ ```
84
+
85
+ `TToolResult` is the inner result type used by built-in tools. It is serialized to JSON and placed inside the `IToolResult.data` field before being returned to the Robota execution loop.
86
+
87
+ ## Dependencies
88
+
89
+ | Dependency | Kind | Purpose |
90
+ | ------------------------ | ---- | ------------------------------------------------------ |
91
+ | `@robota-sdk/agent-core` | Peer | Abstract tool base class, tool interfaces, event types |
92
+ | `fast-glob` | Prod | High-performance glob matching for the Glob tool |
93
+ | `zod` | Prod | Schema validation for function tool parameters |
70
94
 
71
95
  ## License
72
96
 
@@ -1096,9 +1096,12 @@ async function editFileTool(args) {
1096
1096
  return JSON.stringify(result2);
1097
1097
  }
1098
1098
  const count = replaceAll ? content.split(oldString).length - 1 : 1;
1099
+ const matchIdx = content.indexOf(oldString);
1100
+ const startLine = matchIdx >= 0 ? content.substring(0, matchIdx).split("\n").length : 1;
1099
1101
  const result = {
1100
1102
  success: true,
1101
- output: `Replaced ${count} occurrence(s) in ${filePath}`
1103
+ output: `Replaced ${count} occurrence(s) in ${filePath}`,
1104
+ startLine
1102
1105
  };
1103
1106
  return JSON.stringify(result);
1104
1107
  }
@@ -8,6 +8,8 @@ interface TToolResult {
8
8
  output: string;
9
9
  error?: string;
10
10
  exitCode?: number;
11
+ /** Start line number of the edit in the original file (Edit tool only) */
12
+ startLine?: number;
11
13
  }
12
14
 
13
15
  /**
@@ -8,6 +8,8 @@ interface TToolResult {
8
8
  output: string;
9
9
  error?: string;
10
10
  exitCode?: number;
11
+ /** Start line number of the edit in the original file (Edit tool only) */
12
+ startLine?: number;
11
13
  }
12
14
 
13
15
  /**
@@ -1046,9 +1046,12 @@ async function editFileTool(args) {
1046
1046
  return JSON.stringify(result2);
1047
1047
  }
1048
1048
  const count = replaceAll ? content.split(oldString).length - 1 : 1;
1049
+ const matchIdx = content.indexOf(oldString);
1050
+ const startLine = matchIdx >= 0 ? content.substring(0, matchIdx).split("\n").length : 1;
1049
1051
  const result = {
1050
1052
  success: true,
1051
- output: `Replaced ${count} occurrence(s) in ${filePath}`
1053
+ output: `Replaced ${count} occurrence(s) in ${filePath}`,
1054
+ startLine
1052
1055
  };
1053
1056
  return JSON.stringify(result);
1054
1057
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-tools",
3
- "version": "3.0.0-beta.33",
3
+ "version": "3.0.0-beta.34",
4
4
  "description": "Tool registry and implementations for Robota SDK",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.js",
@@ -26,7 +26,7 @@
26
26
  "zod": "^3.24.0"
27
27
  },
28
28
  "peerDependencies": {
29
- "@robota-sdk/agent-core": "3.0.0-beta.33"
29
+ "@robota-sdk/agent-core": "3.0.0-beta.34"
30
30
  },
31
31
  "devDependencies": {
32
32
  "openapi-types": "^12.1.3",
@@ -34,7 +34,7 @@
34
34
  "tsup": "^8.0.1",
35
35
  "typescript": "^5.3.3",
36
36
  "vitest": "^1.6.1",
37
- "@robota-sdk/agent-core": "3.0.0-beta.33"
37
+ "@robota-sdk/agent-core": "3.0.0-beta.34"
38
38
  },
39
39
  "license": "MIT",
40
40
  "publishConfig": {