@compilr-dev/agents 0.3.15 → 0.3.17
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/episodes/index.d.ts +1 -1
- package/dist/episodes/types.d.ts +14 -0
- package/dist/index.d.ts +1 -1
- package/dist/rehearsal/types.d.ts +5 -0
- 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
package/LICENSE
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
Abbreviation: FSL-1.1-MIT
|
|
4
|
+
|
|
5
|
+
Notice
|
|
6
|
+
|
|
7
|
+
Copyright 2026 Carmelo Scozzola
|
|
8
|
+
|
|
9
|
+
Terms and Conditions
|
|
10
|
+
|
|
11
|
+
Licensor ("We")
|
|
12
|
+
|
|
13
|
+
The party offering the Software under these Terms and Conditions.
|
|
14
|
+
|
|
15
|
+
The Software
|
|
16
|
+
|
|
17
|
+
The "Software" is each version of the software that we make available under
|
|
18
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
19
|
+
Conditions with the Software.
|
|
20
|
+
|
|
21
|
+
License Grant
|
|
22
|
+
|
|
23
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
24
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
25
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
26
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
27
|
+
|
|
28
|
+
Permitted Purpose
|
|
29
|
+
|
|
30
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
31
|
+
means making the Software available to others in a commercial product or
|
|
32
|
+
service that:
|
|
33
|
+
|
|
34
|
+
1. substitutes for the Software;
|
|
35
|
+
|
|
36
|
+
2. substitutes for any other product or service we offer using the Software
|
|
37
|
+
that exists as of the date we make the Software available; or
|
|
38
|
+
|
|
39
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
40
|
+
|
|
41
|
+
Permitted Purposes specifically include using the Software:
|
|
42
|
+
|
|
43
|
+
1. for your internal use and access;
|
|
44
|
+
|
|
45
|
+
2. for non-commercial education;
|
|
46
|
+
|
|
47
|
+
3. for non-commercial research; and
|
|
48
|
+
|
|
49
|
+
4. in connection with professional services that you provide to a licensee
|
|
50
|
+
using the Software in accordance with these Terms and Conditions.
|
|
51
|
+
|
|
52
|
+
Patents
|
|
53
|
+
|
|
54
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
55
|
+
patents, the license grant above includes a license under our patents. If you
|
|
56
|
+
make a claim against any party that the Software infringes or contributes to
|
|
57
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
58
|
+
immediately.
|
|
59
|
+
|
|
60
|
+
Redistribution
|
|
61
|
+
|
|
62
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
63
|
+
the Software.
|
|
64
|
+
|
|
65
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
66
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
67
|
+
remove any copyright notices provided in or with the Software.
|
|
68
|
+
|
|
69
|
+
Disclaimer
|
|
70
|
+
|
|
71
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
72
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
73
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
74
|
+
|
|
75
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
76
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
77
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
78
|
+
|
|
79
|
+
Trademarks
|
|
80
|
+
|
|
81
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
82
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
83
|
+
trademarks, trade names, service marks or product names.
|
|
84
|
+
|
|
85
|
+
Grant of Future License
|
|
86
|
+
|
|
87
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
88
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
89
|
+
the Software available. On or after that date, you may use the Software under
|
|
90
|
+
the MIT license, in which case the following will apply:
|
|
91
|
+
|
|
92
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
93
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
94
|
+
the Software without restriction, including without limitation the rights to
|
|
95
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
96
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
97
|
+
so, subject to the following conditions:
|
|
98
|
+
|
|
99
|
+
The above copyright notice and this permission notice shall be included in all
|
|
100
|
+
copies or substantial portions of the Software.
|
|
101
|
+
|
|
102
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
103
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
104
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
105
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
106
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
107
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
108
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
> Lightweight multi-LLM agent library for building CLI AI assistants
|
|
14
14
|
|
|
15
15
|
[](https://www.npmjs.com/package/@compilr-dev/agents)
|
|
16
|
-
[](https://fsl.software/)
|
|
17
17
|
|
|
18
18
|
> [!WARNING]
|
|
19
19
|
> This package is in beta. APIs may change between minor versions.
|
|
@@ -1314,7 +1314,7 @@ const agent = new Agent({ provider, tracing });
|
|
|
1314
1314
|
|
|
1315
1315
|
## License
|
|
1316
1316
|
|
|
1317
|
-
MIT - See [LICENSE](LICENSE) for details.
|
|
1317
|
+
[FSL-1.1-MIT](https://fsl.software/) - See [LICENSE](LICENSE) for details. Converts to MIT after 2 years per version.
|
|
1318
1318
|
|
|
1319
1319
|
---
|
|
1320
1320
|
|
package/dist/episodes/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Work history tracking with effort estimation.
|
|
5
5
|
*/
|
|
6
|
-
export type { Effort, WorkEpisode, EffortSignals, EffortWeights, EffortSummary, ProjectWorkSummary, EpisodeStore, } from './types.js';
|
|
6
|
+
export type { Effort, WorkEpisode, EffortSignals, EffortWeights, EffortSummary, ProjectWorkSummary, WorkAtRisk, EpisodeStore, } from './types.js';
|
|
7
7
|
export { estimateEffort, DEFAULT_WEIGHTS, EFFORT_ORDER } from './effort.js';
|
package/dist/episodes/types.d.ts
CHANGED
|
@@ -127,6 +127,20 @@ export interface ProjectWorkSummary {
|
|
|
127
127
|
/** Episodes since the last git commit */
|
|
128
128
|
uncommittedWork: WorkEpisode[];
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Summary of work that would be at risk from a destructive operation.
|
|
132
|
+
* Used by guardrails and rehearsal to warn agents before they destroy work.
|
|
133
|
+
*/
|
|
134
|
+
export interface WorkAtRisk {
|
|
135
|
+
/** Episodes involving the affected files */
|
|
136
|
+
episodes: WorkEpisode[];
|
|
137
|
+
/** Maximum effort across at-risk episodes */
|
|
138
|
+
totalEffort: Effort;
|
|
139
|
+
/** Agents who did the work (e.g., ['default (abc123)', 'backend (xyz999)']) */
|
|
140
|
+
agentAttribution: string[];
|
|
141
|
+
/** Human-readable warning message */
|
|
142
|
+
warningMessage: string;
|
|
143
|
+
}
|
|
130
144
|
/**
|
|
131
145
|
* Persistence interface for work episodes.
|
|
132
146
|
* Write methods may be async (for file I/O), read methods are synchronous
|
package/dist/index.d.ts
CHANGED
|
@@ -67,4 +67,4 @@ export type { RateLimiterConfig, RateLimiterStats, RetryConfig, RateLimitRetryCo
|
|
|
67
67
|
export { RehearsalManager, createRehearsalManager, GitRehearsalAnalyzer, createGitAnalyzer, FileRehearsalAnalyzer, createFileAnalyzer, } from './rehearsal/index.js';
|
|
68
68
|
export type { ImpactSeverity, RehearsalRecommendation, OperationCategory, AffectedFile, RehearsalImpact, RehearsalResult, RehearsalContext, RehearsalAnalyzer, RehearsalManagerOptions, RehearsalEventType, RehearsalEvent, RehearsalEventHandler, } from './rehearsal/index.js';
|
|
69
69
|
export { estimateEffort, DEFAULT_WEIGHTS, EFFORT_ORDER } from './episodes/index.js';
|
|
70
|
-
export type { Effort, WorkEpisode, EffortSignals, EffortWeights, EffortSummary, ProjectWorkSummary, EpisodeStore, } from './episodes/index.js';
|
|
70
|
+
export type { Effort, WorkEpisode, EffortSignals, EffortWeights, EffortSummary, ProjectWorkSummary, WorkAtRisk, EpisodeStore, } from './episodes/index.js';
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* before they are executed. This is a novel safety feature that goes beyond
|
|
6
6
|
* simple dry-run by actually analyzing what would be affected.
|
|
7
7
|
*/
|
|
8
|
+
import type { WorkAtRisk } from '../episodes/types.js';
|
|
8
9
|
/**
|
|
9
10
|
* Severity level of the operation's potential impact
|
|
10
11
|
*/
|
|
@@ -120,6 +121,10 @@ export interface RehearsalResult {
|
|
|
120
121
|
* Suggested safer alternatives (if any)
|
|
121
122
|
*/
|
|
122
123
|
alternatives?: string[];
|
|
124
|
+
/**
|
|
125
|
+
* Work episodes at risk from this operation (populated by episodic memory)
|
|
126
|
+
*/
|
|
127
|
+
workAtRisk?: WorkAtRisk;
|
|
123
128
|
/**
|
|
124
129
|
* Time taken to perform the analysis (ms)
|
|
125
130
|
*/
|
|
@@ -75,10 +75,8 @@ async function askSimpleWithReadline(question, options, defaultValue) {
|
|
|
75
75
|
*/
|
|
76
76
|
export const askUserSimpleTool = defineTool({
|
|
77
77
|
name: 'ask_user_simple',
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
'Provide 2-4 clear, concise options. ' +
|
|
81
|
-
'The user can select by number or by typing the option text.',
|
|
78
|
+
// Original: 'Ask a single simple question with string options. Use this instead of ask_user when you only need one question. Provide 2-4 clear, concise options. The user can select by number or by typing the option text.'
|
|
79
|
+
description: 'Ask a single question with 2-4 string options.',
|
|
82
80
|
inputSchema: {
|
|
83
81
|
type: 'object',
|
|
84
82
|
properties: {
|
|
@@ -90,10 +90,8 @@ async function askWithReadline(questions) {
|
|
|
90
90
|
*/
|
|
91
91
|
export const askUserTool = defineTool({
|
|
92
92
|
name: 'ask_user',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
'Each question should have 2-4 clear options. ' +
|
|
96
|
-
'Prefer ask_user_simple for single simple questions.',
|
|
93
|
+
// Original: 'Ask the user one or more questions with predefined options. Use this to gather preferences, make decisions, or get user input during workflows. Each question should have 2-4 clear options. Prefer ask_user_simple for single simple questions.'
|
|
94
|
+
description: 'Ask 1-4 questions with predefined options. Prefer ask_user_simple for single questions.',
|
|
97
95
|
inputSchema: {
|
|
98
96
|
type: 'object',
|
|
99
97
|
properties: {
|
|
@@ -86,9 +86,8 @@ function generateItemId(type, items) {
|
|
|
86
86
|
*/
|
|
87
87
|
export const backlogReadTool = defineTool({
|
|
88
88
|
name: 'backlog_read',
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
'Returns items sorted by priority (critical first) then by creation date.',
|
|
89
|
+
// Original: 'Read backlog items from the project. Use filters to narrow results. Use id parameter to get a specific item. Returns items sorted by priority (critical first) then by creation date.'
|
|
90
|
+
description: 'Read backlog items, sorted by priority then creation date.',
|
|
92
91
|
inputSchema: {
|
|
93
92
|
type: 'object',
|
|
94
93
|
properties: {
|
|
@@ -189,9 +188,8 @@ export const backlogReadTool = defineTool({
|
|
|
189
188
|
*/
|
|
190
189
|
export const backlogWriteTool = defineTool({
|
|
191
190
|
name: 'backlog_write',
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
'IDs are auto-generated for new items based on type (e.g., FEAT-001, BUG-002).',
|
|
191
|
+
// Original: 'Create, update, or delete backlog items. Actions: add (new item), update (modify existing), delete (remove), replace (full list). IDs are auto-generated for new items based on type (e.g., FEAT-001, BUG-002).'
|
|
192
|
+
description: 'Create, update, or delete backlog items.',
|
|
195
193
|
inputSchema: {
|
|
196
194
|
type: 'object',
|
|
197
195
|
properties: {
|
|
@@ -8,9 +8,8 @@ import { getDefaultShellManager } from './shell-manager.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export const bashOutputTool = defineTool({
|
|
10
10
|
name: 'bash_output',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
'Use this to monitor long-running commands started with run_in_background.',
|
|
11
|
+
// Original: 'Retrieve output from a running or completed background bash shell. Returns only new output since the last check. Use this to monitor long-running commands started with run_in_background.'
|
|
12
|
+
description: 'Retrieve output from a background bash shell.',
|
|
14
13
|
inputSchema: {
|
|
15
14
|
type: 'object',
|
|
16
15
|
properties: {
|
|
@@ -67,24 +66,8 @@ export function createBashOutputTool(options) {
|
|
|
67
66
|
const manager = options?.shellManager ?? getDefaultShellManager();
|
|
68
67
|
return defineTool({
|
|
69
68
|
name: 'bash_output',
|
|
70
|
-
description:
|
|
71
|
-
|
|
72
|
-
'Use this to monitor long-running commands started with run_in_background.',
|
|
73
|
-
inputSchema: {
|
|
74
|
-
type: 'object',
|
|
75
|
-
properties: {
|
|
76
|
-
bash_id: {
|
|
77
|
-
type: 'string',
|
|
78
|
-
description: 'The ID of the background shell to retrieve output from',
|
|
79
|
-
},
|
|
80
|
-
filter: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
description: 'Optional regular expression to filter output lines. ' +
|
|
83
|
-
'Only lines matching this regex will be included.',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
required: ['bash_id'],
|
|
87
|
-
},
|
|
69
|
+
description: bashOutputTool.definition.description,
|
|
70
|
+
inputSchema: bashOutputTool.definition.inputSchema,
|
|
88
71
|
execute: (input) => Promise.resolve(executeBashOutput(input, manager)),
|
|
89
72
|
});
|
|
90
73
|
}
|
|
@@ -78,9 +78,9 @@ function truncateOutput(output, maxSize) {
|
|
|
78
78
|
*/
|
|
79
79
|
export const bashTool = defineTool({
|
|
80
80
|
name: 'bash',
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
'
|
|
81
|
+
// Original: 'Execute a shell command and return its output. Commands run in bash shell. Use for system operations, git commands, npm, etc. Set run_in_background=true for long-running commands, then use bash_output to monitor.'
|
|
82
|
+
description: 'Execute a shell command. ' +
|
|
83
|
+
'For long-running commands, set run_in_background and poll with bash_output.',
|
|
84
84
|
inputSchema: {
|
|
85
85
|
type: 'object',
|
|
86
86
|
properties: {
|
|
@@ -94,7 +94,8 @@ export const bashTool = defineTool({
|
|
|
94
94
|
},
|
|
95
95
|
timeout: {
|
|
96
96
|
type: 'number',
|
|
97
|
-
description: 'Timeout in milliseconds
|
|
97
|
+
description: 'Timeout in milliseconds. Ignored for background commands.',
|
|
98
|
+
default: 60000,
|
|
98
99
|
},
|
|
99
100
|
env: {
|
|
100
101
|
type: 'object',
|
|
@@ -479,39 +480,8 @@ function isExecError(error) {
|
|
|
479
480
|
export function createBashTool(options) {
|
|
480
481
|
return defineTool({
|
|
481
482
|
name: 'bash',
|
|
482
|
-
description:
|
|
483
|
-
|
|
484
|
-
'Set run_in_background=true for long-running commands, then use bash_output to monitor.',
|
|
485
|
-
inputSchema: {
|
|
486
|
-
type: 'object',
|
|
487
|
-
properties: {
|
|
488
|
-
command: {
|
|
489
|
-
type: 'string',
|
|
490
|
-
description: 'The shell command to execute',
|
|
491
|
-
},
|
|
492
|
-
cwd: {
|
|
493
|
-
type: 'string',
|
|
494
|
-
description: 'Working directory for the command',
|
|
495
|
-
},
|
|
496
|
-
timeout: {
|
|
497
|
-
type: 'number',
|
|
498
|
-
description: 'Timeout in milliseconds (default: 60000). Ignored for background commands.',
|
|
499
|
-
},
|
|
500
|
-
env: {
|
|
501
|
-
type: 'object',
|
|
502
|
-
description: 'Additional environment variables',
|
|
503
|
-
},
|
|
504
|
-
run_in_background: {
|
|
505
|
-
type: 'boolean',
|
|
506
|
-
description: 'Run command in background and return shell ID. Use bash_output to get results.',
|
|
507
|
-
},
|
|
508
|
-
description: {
|
|
509
|
-
type: 'string',
|
|
510
|
-
description: 'Brief description of what this command does',
|
|
511
|
-
},
|
|
512
|
-
},
|
|
513
|
-
required: ['command'],
|
|
514
|
-
},
|
|
483
|
+
description: bashTool.definition.description,
|
|
484
|
+
inputSchema: bashTool.definition.inputSchema,
|
|
515
485
|
execute: async (input, context) => {
|
|
516
486
|
const { cwd: defaultCwd, timeout: defaultTimeout = DEFAULT_TIMEOUT, maxOutputSize = DEFAULT_MAX_OUTPUT_SIZE, blockedCommands = [], restrictToAllowed = false, allowedCommands = [], shell = '/bin/bash', shellManager, fifoMode = 'warn', } = options ?? {};
|
|
517
487
|
const command = input.command.trim();
|
|
@@ -157,35 +157,8 @@ function truncate(str, maxLength) {
|
|
|
157
157
|
export function createEditTool(options) {
|
|
158
158
|
return defineTool({
|
|
159
159
|
name: 'edit',
|
|
160
|
-
description:
|
|
161
|
-
|
|
162
|
-
'Use replaceAll to replace all occurrences.',
|
|
163
|
-
inputSchema: {
|
|
164
|
-
type: 'object',
|
|
165
|
-
properties: {
|
|
166
|
-
filePath: {
|
|
167
|
-
type: 'string',
|
|
168
|
-
description: 'Path to the file to edit',
|
|
169
|
-
},
|
|
170
|
-
oldString: {
|
|
171
|
-
type: 'string',
|
|
172
|
-
description: 'The text to search for and replace',
|
|
173
|
-
},
|
|
174
|
-
newString: {
|
|
175
|
-
type: 'string',
|
|
176
|
-
description: 'The replacement text',
|
|
177
|
-
},
|
|
178
|
-
replaceAll: {
|
|
179
|
-
type: 'boolean',
|
|
180
|
-
description: 'Replace all occurrences instead of requiring uniqueness',
|
|
181
|
-
},
|
|
182
|
-
createIfMissing: {
|
|
183
|
-
type: 'boolean',
|
|
184
|
-
description: 'Create the file with newString content if it does not exist',
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
required: ['filePath', 'oldString', 'newString'],
|
|
188
|
-
},
|
|
160
|
+
description: editTool.definition.description,
|
|
161
|
+
inputSchema: editTool.definition.inputSchema,
|
|
189
162
|
execute: async (input) => {
|
|
190
163
|
let targetPath = input.filePath;
|
|
191
164
|
// Resolve relative paths
|
|
@@ -34,9 +34,8 @@ const DEFAULT_EXCLUDE_DIRS = [
|
|
|
34
34
|
export const globTool = defineTool({
|
|
35
35
|
name: 'glob',
|
|
36
36
|
readonly: true,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'Returns a list of matching file paths.',
|
|
37
|
+
// Original: 'Find files matching glob patterns. Supports common patterns like **/*.ts for recursive matching. Returns a list of matching file paths.'
|
|
38
|
+
description: 'Find files matching glob patterns.',
|
|
40
39
|
inputSchema: {
|
|
41
40
|
type: 'object',
|
|
42
41
|
properties: {
|
|
@@ -50,7 +49,7 @@ export const globTool = defineTool({
|
|
|
50
49
|
},
|
|
51
50
|
includeHidden: {
|
|
52
51
|
type: 'boolean',
|
|
53
|
-
description: 'Include hidden files/directories
|
|
52
|
+
description: 'Include hidden files/directories',
|
|
54
53
|
},
|
|
55
54
|
onlyDirectories: {
|
|
56
55
|
type: 'boolean',
|
|
@@ -58,7 +57,8 @@ export const globTool = defineTool({
|
|
|
58
57
|
},
|
|
59
58
|
onlyFiles: {
|
|
60
59
|
type: 'boolean',
|
|
61
|
-
description: 'Only match files
|
|
60
|
+
description: 'Only match files',
|
|
61
|
+
default: true,
|
|
62
62
|
},
|
|
63
63
|
maxDepth: {
|
|
64
64
|
type: 'number',
|
|
@@ -66,7 +66,8 @@ export const globTool = defineTool({
|
|
|
66
66
|
},
|
|
67
67
|
maxResults: {
|
|
68
68
|
type: 'number',
|
|
69
|
-
description: 'Maximum number of results
|
|
69
|
+
description: 'Maximum number of results',
|
|
70
|
+
default: 1000,
|
|
70
71
|
},
|
|
71
72
|
absolute: {
|
|
72
73
|
type: 'boolean',
|
|
@@ -224,52 +225,8 @@ export function createGlobTool(options) {
|
|
|
224
225
|
return defineTool({
|
|
225
226
|
name: 'glob',
|
|
226
227
|
readonly: true,
|
|
227
|
-
description:
|
|
228
|
-
|
|
229
|
-
'Returns a list of matching file paths.',
|
|
230
|
-
inputSchema: {
|
|
231
|
-
type: 'object',
|
|
232
|
-
properties: {
|
|
233
|
-
pattern: {
|
|
234
|
-
type: 'string',
|
|
235
|
-
description: 'Glob pattern (e.g., "**/*.ts", "src/**/*.js", "*.md")',
|
|
236
|
-
},
|
|
237
|
-
path: {
|
|
238
|
-
type: 'string',
|
|
239
|
-
description: 'Base directory to search in (default: current directory)',
|
|
240
|
-
},
|
|
241
|
-
includeHidden: {
|
|
242
|
-
type: 'boolean',
|
|
243
|
-
description: 'Include hidden files/directories (default: false)',
|
|
244
|
-
},
|
|
245
|
-
onlyDirectories: {
|
|
246
|
-
type: 'boolean',
|
|
247
|
-
description: 'Only match directories',
|
|
248
|
-
},
|
|
249
|
-
onlyFiles: {
|
|
250
|
-
type: 'boolean',
|
|
251
|
-
description: 'Only match files (default: true)',
|
|
252
|
-
},
|
|
253
|
-
maxDepth: {
|
|
254
|
-
type: 'number',
|
|
255
|
-
description: 'Maximum directory depth to traverse',
|
|
256
|
-
},
|
|
257
|
-
maxResults: {
|
|
258
|
-
type: 'number',
|
|
259
|
-
description: 'Maximum number of results (default: 1000)',
|
|
260
|
-
},
|
|
261
|
-
absolute: {
|
|
262
|
-
type: 'boolean',
|
|
263
|
-
description: 'Return absolute paths instead of relative',
|
|
264
|
-
},
|
|
265
|
-
excludeDirs: {
|
|
266
|
-
type: 'array',
|
|
267
|
-
items: { type: 'string' },
|
|
268
|
-
description: 'Directory names to exclude (default: node_modules, .git, dist, build, etc.)',
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
required: ['pattern'],
|
|
272
|
-
},
|
|
228
|
+
description: globTool.definition.description,
|
|
229
|
+
inputSchema: globTool.definition.inputSchema,
|
|
273
230
|
execute: async (input) => {
|
|
274
231
|
let searchPath = input.path ?? '.';
|
|
275
232
|
// Resolve relative paths
|
|
@@ -35,9 +35,8 @@ const DEFAULT_EXCLUDE_DIRS = [
|
|
|
35
35
|
export const grepTool = defineTool({
|
|
36
36
|
name: 'grep',
|
|
37
37
|
readonly: true,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
'Returns matching lines with optional context.',
|
|
38
|
+
// Original: 'Search for patterns in files using regular expressions. Can search a single file or recursively through directories. Returns matching lines with optional context.'
|
|
39
|
+
description: 'Search for regex patterns in files or directories.',
|
|
41
40
|
inputSchema: {
|
|
42
41
|
type: 'object',
|
|
43
42
|
properties: {
|
|
@@ -51,11 +50,13 @@ export const grepTool = defineTool({
|
|
|
51
50
|
},
|
|
52
51
|
ignoreCase: {
|
|
53
52
|
type: 'boolean',
|
|
54
|
-
description: 'Case insensitive search
|
|
53
|
+
description: 'Case insensitive search',
|
|
54
|
+
default: false,
|
|
55
55
|
},
|
|
56
56
|
lineNumbers: {
|
|
57
57
|
type: 'boolean',
|
|
58
|
-
description: 'Include line numbers in output
|
|
58
|
+
description: 'Include line numbers in output',
|
|
59
|
+
default: true,
|
|
59
60
|
},
|
|
60
61
|
before: {
|
|
61
62
|
type: 'number',
|
|
@@ -80,11 +81,13 @@ export const grepTool = defineTool({
|
|
|
80
81
|
},
|
|
81
82
|
maxMatches: {
|
|
82
83
|
type: 'number',
|
|
83
|
-
description: 'Maximum number of matches to return
|
|
84
|
+
description: 'Maximum number of matches to return',
|
|
85
|
+
default: 100,
|
|
84
86
|
},
|
|
85
87
|
recursive: {
|
|
86
88
|
type: 'boolean',
|
|
87
|
-
description: 'Search recursively in directories
|
|
89
|
+
description: 'Search recursively in directories',
|
|
90
|
+
default: true,
|
|
88
91
|
},
|
|
89
92
|
},
|
|
90
93
|
required: ['pattern', 'path'],
|
|
@@ -321,65 +324,8 @@ export function createGrepTool(options) {
|
|
|
321
324
|
return defineTool({
|
|
322
325
|
name: 'grep',
|
|
323
326
|
readonly: true,
|
|
324
|
-
description:
|
|
325
|
-
|
|
326
|
-
'Returns matching lines with optional context.',
|
|
327
|
-
inputSchema: {
|
|
328
|
-
type: 'object',
|
|
329
|
-
properties: {
|
|
330
|
-
pattern: {
|
|
331
|
-
type: 'string',
|
|
332
|
-
description: 'Regular expression pattern to search for',
|
|
333
|
-
},
|
|
334
|
-
path: {
|
|
335
|
-
type: 'string',
|
|
336
|
-
description: 'Path to file or directory to search in',
|
|
337
|
-
},
|
|
338
|
-
ignoreCase: {
|
|
339
|
-
type: 'boolean',
|
|
340
|
-
description: 'Case insensitive search (default: false)',
|
|
341
|
-
},
|
|
342
|
-
lineNumbers: {
|
|
343
|
-
type: 'boolean',
|
|
344
|
-
description: 'Include line numbers in output (default: true)',
|
|
345
|
-
},
|
|
346
|
-
before: {
|
|
347
|
-
type: 'number',
|
|
348
|
-
description: 'Number of context lines before match',
|
|
349
|
-
},
|
|
350
|
-
after: {
|
|
351
|
-
type: 'number',
|
|
352
|
-
description: 'Number of context lines after match',
|
|
353
|
-
},
|
|
354
|
-
filesOnly: {
|
|
355
|
-
type: 'boolean',
|
|
356
|
-
description: 'Only return filenames with matches',
|
|
357
|
-
},
|
|
358
|
-
includeHidden: {
|
|
359
|
-
type: 'boolean',
|
|
360
|
-
description: 'Include hidden files/directories',
|
|
361
|
-
},
|
|
362
|
-
extensions: {
|
|
363
|
-
type: 'array',
|
|
364
|
-
items: { type: 'string' },
|
|
365
|
-
description: 'File extensions to include (e.g., [".ts", ".js"])',
|
|
366
|
-
},
|
|
367
|
-
maxMatches: {
|
|
368
|
-
type: 'number',
|
|
369
|
-
description: 'Maximum number of matches to return (default: 100)',
|
|
370
|
-
},
|
|
371
|
-
recursive: {
|
|
372
|
-
type: 'boolean',
|
|
373
|
-
description: 'Search recursively in directories (default: true)',
|
|
374
|
-
},
|
|
375
|
-
excludeDirs: {
|
|
376
|
-
type: 'array',
|
|
377
|
-
items: { type: 'string' },
|
|
378
|
-
description: 'Directory names to exclude (default: node_modules, .git, dist, build, etc.)',
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
required: ['pattern', 'path'],
|
|
382
|
-
},
|
|
327
|
+
description: grepTool.definition.description,
|
|
328
|
+
inputSchema: grepTool.definition.inputSchema,
|
|
383
329
|
execute: async (input) => {
|
|
384
330
|
let searchPath = input.path;
|
|
385
331
|
// Resolve relative paths
|
|
@@ -8,8 +8,8 @@ import { getDefaultShellManager } from './shell-manager.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export const killShellTool = defineTool({
|
|
10
10
|
name: 'kill_shell',
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// Original: 'Kill a running background bash shell by its ID. Use this to terminate long-running commands that are no longer needed.'
|
|
12
|
+
description: 'Terminate a background bash shell by ID.',
|
|
13
13
|
inputSchema: {
|
|
14
14
|
type: 'object',
|
|
15
15
|
properties: {
|
|
@@ -63,18 +63,8 @@ export function createKillShellTool(options) {
|
|
|
63
63
|
const manager = options?.shellManager ?? getDefaultShellManager();
|
|
64
64
|
return defineTool({
|
|
65
65
|
name: 'kill_shell',
|
|
66
|
-
description:
|
|
67
|
-
|
|
68
|
-
inputSchema: {
|
|
69
|
-
type: 'object',
|
|
70
|
-
properties: {
|
|
71
|
-
shell_id: {
|
|
72
|
-
type: 'string',
|
|
73
|
-
description: 'The ID of the background shell to kill',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
required: ['shell_id'],
|
|
77
|
-
},
|
|
66
|
+
description: killShellTool.definition.description,
|
|
67
|
+
inputSchema: killShellTool.definition.inputSchema,
|
|
78
68
|
execute: (input) => Promise.resolve(executeKillShell(input, manager)),
|
|
79
69
|
});
|
|
80
70
|
}
|
|
@@ -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.17",
|
|
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
|
},
|