@compilr-dev/agents 0.3.16 → 0.3.18
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/LICENSE +108 -0
- package/README.md +2 -2
- package/dist/agent.d.ts +28 -0
- package/dist/agent.js +43 -2
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.js +4 -0
- package/dist/context/observation-masker.d.ts +80 -0
- package/dist/context/observation-masker.js +192 -0
- package/dist/context/result-compactor.d.ts +15 -0
- package/dist/context/result-compactor.js +165 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -1
- package/dist/tools/builtin/ask-user-simple.js +2 -4
- package/dist/tools/builtin/ask-user.js +2 -4
- package/dist/tools/builtin/backlog.js +4 -6
- package/dist/tools/builtin/bash-output.js +4 -21
- package/dist/tools/builtin/bash.js +7 -37
- package/dist/tools/builtin/edit.js +2 -29
- package/dist/tools/builtin/glob.js +9 -52
- package/dist/tools/builtin/grep.js +12 -66
- package/dist/tools/builtin/kill-shell.js +4 -14
- package/dist/tools/builtin/read-file.js +6 -27
- package/dist/tools/builtin/recall-result.js +2 -3
- package/dist/tools/builtin/suggest.js +4 -24
- package/dist/tools/builtin/todo.js +13 -15
- package/dist/tools/builtin/web-fetch.js +11 -10
- package/dist/tools/builtin/write-file.js +10 -33
- package/package.json +2 -2
|
@@ -19,8 +19,8 @@ const DEFAULT_MAX_CONTENT_SIZE = 100 * 1024;
|
|
|
19
19
|
export const readFileTool = defineTool({
|
|
20
20
|
name: 'read_file',
|
|
21
21
|
readonly: true,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
// Original: 'Read the contents of a file. Returns the file content as text. Use maxLines and startLine to read specific portions of large files.'
|
|
23
|
+
description: 'Read file contents. Use maxLines/startLine for large files.',
|
|
24
24
|
inputSchema: {
|
|
25
25
|
type: 'object',
|
|
26
26
|
properties: {
|
|
@@ -30,7 +30,8 @@ export const readFileTool = defineTool({
|
|
|
30
30
|
},
|
|
31
31
|
encoding: {
|
|
32
32
|
type: 'string',
|
|
33
|
-
description: 'File encoding
|
|
33
|
+
description: 'File encoding',
|
|
34
|
+
default: 'utf-8',
|
|
34
35
|
},
|
|
35
36
|
maxLines: {
|
|
36
37
|
type: 'number',
|
|
@@ -139,30 +140,8 @@ export function createReadFileTool(options) {
|
|
|
139
140
|
return defineTool({
|
|
140
141
|
name: 'read_file',
|
|
141
142
|
readonly: true,
|
|
142
|
-
description:
|
|
143
|
-
|
|
144
|
-
inputSchema: {
|
|
145
|
-
type: 'object',
|
|
146
|
-
properties: {
|
|
147
|
-
path: {
|
|
148
|
-
type: 'string',
|
|
149
|
-
description: 'Absolute or relative path to the file',
|
|
150
|
-
},
|
|
151
|
-
encoding: {
|
|
152
|
-
type: 'string',
|
|
153
|
-
description: 'File encoding (default: utf-8)',
|
|
154
|
-
},
|
|
155
|
-
maxLines: {
|
|
156
|
-
type: 'number',
|
|
157
|
-
description: 'Maximum number of lines to read',
|
|
158
|
-
},
|
|
159
|
-
startLine: {
|
|
160
|
-
type: 'number',
|
|
161
|
-
description: 'Line number to start reading from (1-indexed)',
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
required: ['path'],
|
|
165
|
-
},
|
|
143
|
+
description: readFileTool.definition.description,
|
|
144
|
+
inputSchema: readFileTool.definition.inputSchema,
|
|
166
145
|
execute: async (input) => {
|
|
167
146
|
const { baseDir, allowedExtensions, maxFileSize, maxContentSize, truncateIfLarge } = options ?? {};
|
|
168
147
|
let filePath = input.path;
|
|
@@ -12,9 +12,8 @@ export function createRecallResultTool(options) {
|
|
|
12
12
|
const { store, onEvent } = options;
|
|
13
13
|
return defineTool({
|
|
14
14
|
name: 'recall_full_result',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'Results expire after 10 minutes.',
|
|
15
|
+
// Original: 'Retrieve the full output of a previously delegated tool result. Use when a summary is insufficient and you need the complete data. Results expire after 10 minutes.'
|
|
16
|
+
description: 'Retrieve full output of a delegated tool result. Results expire after 10 minutes.',
|
|
18
17
|
inputSchema: {
|
|
19
18
|
type: 'object',
|
|
20
19
|
properties: {
|
|
@@ -15,11 +15,8 @@ import { defineTool, createSuccessResult } from '../define.js';
|
|
|
15
15
|
*/
|
|
16
16
|
export const suggestTool = defineTool({
|
|
17
17
|
name: 'suggest',
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'Good suggestions are actionable, specific, and follow naturally from what you just did. ' +
|
|
21
|
-
'Examples: "run npm test to verify the fix", "review the changes in src/index.ts", ' +
|
|
22
|
-
'"commit the changes with git commit". Only suggest when there is a clear, helpful next step.',
|
|
18
|
+
// Original: 'Suggest a next action for the user. The suggestion appears as ghost text in the input prompt. Use this after completing a task to guide the user toward a logical next step. Good suggestions are actionable, specific, and follow naturally from what you just did. Examples: "run npm test to verify the fix", "review the changes in src/index.ts", "commit the changes with git commit". Only suggest when there is a clear, helpful next step.'
|
|
19
|
+
description: 'Suggest a next action as ghost text in the input prompt. Use after completing a task.',
|
|
23
20
|
inputSchema: {
|
|
24
21
|
type: 'object',
|
|
25
22
|
properties: {
|
|
@@ -61,25 +58,8 @@ export function createSuggestTool(options = {}) {
|
|
|
61
58
|
const { onSuggest } = options;
|
|
62
59
|
return defineTool({
|
|
63
60
|
name: 'suggest',
|
|
64
|
-
description:
|
|
65
|
-
|
|
66
|
-
'Good suggestions are actionable, specific, and follow naturally from what you just did. ' +
|
|
67
|
-
'Examples: "run npm test to verify the fix", "review the changes in src/index.ts", ' +
|
|
68
|
-
'"commit the changes with git commit". Only suggest when there is a clear, helpful next step.',
|
|
69
|
-
inputSchema: {
|
|
70
|
-
type: 'object',
|
|
71
|
-
properties: {
|
|
72
|
-
action: {
|
|
73
|
-
type: 'string',
|
|
74
|
-
description: 'The suggested action or command for the user to take next',
|
|
75
|
-
},
|
|
76
|
-
reason: {
|
|
77
|
-
type: 'string',
|
|
78
|
-
description: 'Brief explanation of why this action is suggested (optional)',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
required: ['action'],
|
|
82
|
-
},
|
|
61
|
+
description: suggestTool.definition.description,
|
|
62
|
+
inputSchema: suggestTool.definition.inputSchema,
|
|
83
63
|
execute: (input) => {
|
|
84
64
|
// Emit the suggest event if handler is configured
|
|
85
65
|
if (onSuggest) {
|
|
@@ -158,10 +158,9 @@ const defaultStore = new TodoStore();
|
|
|
158
158
|
*/
|
|
159
159
|
export const todoWriteTool = defineTool({
|
|
160
160
|
name: 'todo_write',
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
'
|
|
164
|
-
'Use blockedBy to declare task dependencies (1-based positions in the array).',
|
|
161
|
+
// Original: 'Update the SESSION todo list (shown in CLI footer). These are ephemeral tasks for the current session only - NOT persistent backlog items. For persistent project backlog, use workitem_* tools. Provide the complete list to replace current todos. Use blockedBy to declare task dependencies (1-based positions in the array).'
|
|
162
|
+
description: 'Replace the session todo list (ephemeral, shown in footer). ' +
|
|
163
|
+
'For persistent backlog, use workitem_* tools.',
|
|
165
164
|
inputSchema: {
|
|
166
165
|
type: 'object',
|
|
167
166
|
properties: {
|
|
@@ -229,8 +228,8 @@ export const todoWriteTool = defineTool({
|
|
|
229
228
|
export const todoReadTool = defineTool({
|
|
230
229
|
name: 'todo_read',
|
|
231
230
|
readonly: true,
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
// Original: 'Get the SESSION todo list (shown in CLI footer). These are ephemeral session tasks - for persistent project backlog, use workitem_query. Optionally filter by status or owner.'
|
|
232
|
+
description: 'Get the session todo list. For persistent backlog, use workitem_query.',
|
|
234
233
|
inputSchema: {
|
|
235
234
|
type: 'object',
|
|
236
235
|
properties: {
|
|
@@ -241,7 +240,8 @@ export const todoReadTool = defineTool({
|
|
|
241
240
|
},
|
|
242
241
|
includeCompleted: {
|
|
243
242
|
type: 'boolean',
|
|
244
|
-
description: 'Include completed tasks
|
|
243
|
+
description: 'Include completed tasks',
|
|
244
|
+
default: true,
|
|
245
245
|
},
|
|
246
246
|
owner: {
|
|
247
247
|
type: 'string',
|
|
@@ -291,9 +291,7 @@ export function createTodoTools(store) {
|
|
|
291
291
|
const todoStore = store ?? new TodoStore();
|
|
292
292
|
const todoWrite = defineTool({
|
|
293
293
|
name: 'todo_write',
|
|
294
|
-
description:
|
|
295
|
-
'NOT persistent backlog items. For persistent project backlog, use workitem_* tools. ' +
|
|
296
|
-
'Use blockedBy to declare task dependencies (1-based positions in the array).',
|
|
294
|
+
description: todoWriteTool.definition.description,
|
|
297
295
|
inputSchema: {
|
|
298
296
|
type: 'object',
|
|
299
297
|
properties: {
|
|
@@ -342,8 +340,7 @@ export function createTodoTools(store) {
|
|
|
342
340
|
const todoRead = defineTool({
|
|
343
341
|
name: 'todo_read',
|
|
344
342
|
readonly: true,
|
|
345
|
-
description:
|
|
346
|
-
'for persistent project backlog, use workitem_query.',
|
|
343
|
+
description: todoReadTool.definition.description,
|
|
347
344
|
inputSchema: {
|
|
348
345
|
type: 'object',
|
|
349
346
|
properties: {
|
|
@@ -395,7 +392,8 @@ export function createTodoTools(store) {
|
|
|
395
392
|
});
|
|
396
393
|
const todoClaim = defineTool({
|
|
397
394
|
name: 'todo_claim',
|
|
398
|
-
|
|
395
|
+
// Original: 'Claim an unassigned SESSION todo (from CLI footer). For persistent backlog items, use workitem_claim.'
|
|
396
|
+
description: 'Claim an unassigned session todo. For persistent items, use workitem_claim.',
|
|
399
397
|
inputSchema: {
|
|
400
398
|
type: 'object',
|
|
401
399
|
properties: {
|
|
@@ -436,8 +434,8 @@ export function createTodoTools(store) {
|
|
|
436
434
|
});
|
|
437
435
|
const todoHandoff = defineTool({
|
|
438
436
|
name: 'todo_handoff',
|
|
439
|
-
|
|
440
|
-
|
|
437
|
+
// Original: 'Hand off a SESSION todo (from CLI footer) to another agent. For persistent backlog items, use workitem_handoff.'
|
|
438
|
+
description: 'Hand off a session todo to another agent. For persistent items, use workitem_handoff.',
|
|
441
439
|
inputSchema: {
|
|
442
440
|
type: 'object',
|
|
443
441
|
properties: {
|
|
@@ -18,9 +18,8 @@ const DEFAULT_MAX_SIZE = 100 * 1024;
|
|
|
18
18
|
export const webFetchTool = defineTool({
|
|
19
19
|
name: 'web_fetch',
|
|
20
20
|
readonly: true,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
'HTTP URLs are automatically upgraded to HTTPS.',
|
|
21
|
+
// Original: 'Fetch content from a URL. Returns the page content as text. Use for retrieving documentation, API responses, or web pages. HTTP URLs are automatically upgraded to HTTPS.'
|
|
22
|
+
description: 'Fetch content from a URL and return as text.',
|
|
24
23
|
inputSchema: {
|
|
25
24
|
type: 'object',
|
|
26
25
|
properties: {
|
|
@@ -35,11 +34,13 @@ export const webFetchTool = defineTool({
|
|
|
35
34
|
},
|
|
36
35
|
timeout: {
|
|
37
36
|
type: 'number',
|
|
38
|
-
description: 'Request timeout in milliseconds
|
|
37
|
+
description: 'Request timeout in milliseconds',
|
|
38
|
+
default: 30000,
|
|
39
39
|
},
|
|
40
40
|
maxSize: {
|
|
41
41
|
type: 'number',
|
|
42
|
-
description: 'Maximum content size to return in bytes
|
|
42
|
+
description: 'Maximum content size to return in bytes',
|
|
43
|
+
default: 102400,
|
|
43
44
|
},
|
|
44
45
|
},
|
|
45
46
|
required: ['url'],
|
|
@@ -170,9 +171,7 @@ export function createWebFetchTool(options) {
|
|
|
170
171
|
return defineTool({
|
|
171
172
|
name: 'web_fetch',
|
|
172
173
|
readonly: true,
|
|
173
|
-
description:
|
|
174
|
-
'Use for retrieving documentation, API responses, or web pages. ' +
|
|
175
|
-
'HTTP URLs are automatically upgraded to HTTPS.',
|
|
174
|
+
description: webFetchTool.definition.description,
|
|
176
175
|
inputSchema: {
|
|
177
176
|
type: 'object',
|
|
178
177
|
properties: {
|
|
@@ -187,11 +186,13 @@ export function createWebFetchTool(options) {
|
|
|
187
186
|
},
|
|
188
187
|
timeout: {
|
|
189
188
|
type: 'number',
|
|
190
|
-
description:
|
|
189
|
+
description: 'Request timeout in milliseconds',
|
|
190
|
+
default: defaultTimeout,
|
|
191
191
|
},
|
|
192
192
|
maxSize: {
|
|
193
193
|
type: 'number',
|
|
194
|
-
description:
|
|
194
|
+
description: 'Maximum content size to return in bytes',
|
|
195
|
+
default: defaultMaxSize,
|
|
195
196
|
},
|
|
196
197
|
},
|
|
197
198
|
required: ['url'],
|
|
@@ -10,8 +10,8 @@ import { isNodeError, isExtensionAllowed } from './utils.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export const writeFileTool = defineTool({
|
|
12
12
|
name: 'write_file',
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
// Original: 'Write content to a file. Creates the file if it does not exist. Use append: true to add to existing content instead of overwriting.'
|
|
14
|
+
description: 'Write content to a file, creating it if needed.',
|
|
15
15
|
inputSchema: {
|
|
16
16
|
type: 'object',
|
|
17
17
|
properties: {
|
|
@@ -25,15 +25,18 @@ export const writeFileTool = defineTool({
|
|
|
25
25
|
},
|
|
26
26
|
encoding: {
|
|
27
27
|
type: 'string',
|
|
28
|
-
description: 'File encoding
|
|
28
|
+
description: 'File encoding',
|
|
29
|
+
default: 'utf-8',
|
|
29
30
|
},
|
|
30
31
|
createDirs: {
|
|
31
32
|
type: 'boolean',
|
|
32
|
-
description: 'Create parent directories if needed
|
|
33
|
+
description: 'Create parent directories if needed',
|
|
34
|
+
default: true,
|
|
33
35
|
},
|
|
34
36
|
append: {
|
|
35
37
|
type: 'boolean',
|
|
36
|
-
description: 'Append to file instead of overwriting
|
|
38
|
+
description: 'Append to file instead of overwriting',
|
|
39
|
+
default: false,
|
|
37
40
|
},
|
|
38
41
|
},
|
|
39
42
|
required: ['path', 'content'],
|
|
@@ -86,34 +89,8 @@ async function executeWriteFile(input) {
|
|
|
86
89
|
export function createWriteFileTool(options) {
|
|
87
90
|
return defineTool({
|
|
88
91
|
name: 'write_file',
|
|
89
|
-
description:
|
|
90
|
-
|
|
91
|
-
inputSchema: {
|
|
92
|
-
type: 'object',
|
|
93
|
-
properties: {
|
|
94
|
-
path: {
|
|
95
|
-
type: 'string',
|
|
96
|
-
description: 'Absolute or relative path to the file',
|
|
97
|
-
},
|
|
98
|
-
content: {
|
|
99
|
-
type: 'string',
|
|
100
|
-
description: 'Content to write to the file',
|
|
101
|
-
},
|
|
102
|
-
encoding: {
|
|
103
|
-
type: 'string',
|
|
104
|
-
description: 'File encoding (default: utf-8)',
|
|
105
|
-
},
|
|
106
|
-
createDirs: {
|
|
107
|
-
type: 'boolean',
|
|
108
|
-
description: 'Create parent directories if needed (default: true)',
|
|
109
|
-
},
|
|
110
|
-
append: {
|
|
111
|
-
type: 'boolean',
|
|
112
|
-
description: 'Append to file instead of overwriting (default: false)',
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
required: ['path', 'content'],
|
|
116
|
-
},
|
|
92
|
+
description: writeFileTool.definition.description,
|
|
93
|
+
inputSchema: writeFileTool.definition.inputSchema,
|
|
117
94
|
execute: async (input) => {
|
|
118
95
|
const { baseDir, allowedExtensions, maxContentSize = 10 * 1024 * 1024, blockedPaths = [], } = options ?? {};
|
|
119
96
|
let filePath = input.path;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/agents",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "Lightweight multi-LLM agent library for building CLI AI assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"anthropic"
|
|
44
44
|
],
|
|
45
45
|
"author": "Carmelo Scozzola",
|
|
46
|
-
"license": "MIT",
|
|
46
|
+
"license": "FSL-1.1-MIT",
|
|
47
47
|
"bugs": {
|
|
48
48
|
"url": "https://github.com/compilr-dev/agents/issues"
|
|
49
49
|
},
|