agentool 0.0.1 → 1.0.0
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 +627 -52
- package/dist/ask-user/index.cjs +8 -0
- package/dist/ask-user/index.d.cts +68 -0
- package/dist/ask-user/index.d.ts +68 -0
- package/dist/ask-user/index.js +8 -0
- package/dist/bash/index.cjs +8 -0
- package/dist/bash/index.d.cts +63 -0
- package/dist/bash/index.d.ts +63 -0
- package/dist/bash/index.js +8 -0
- package/dist/chunk-3EPGFWZV.cjs +30 -0
- package/dist/chunk-3VO6NETR.cjs +79 -0
- package/dist/chunk-4YI2H55A.js +142 -0
- package/dist/chunk-5NW4OGRI.cjs +99 -0
- package/dist/chunk-6MDPYALY.js +196 -0
- package/dist/chunk-6PQLFDGT.js +117 -0
- package/dist/chunk-7QL4BQCH.js +40 -0
- package/dist/chunk-CAEVLIQB.cjs +117 -0
- package/dist/chunk-CGTPF6IS.js +90 -0
- package/dist/chunk-EA3YV7ZG.js +79 -0
- package/dist/chunk-FAEGCFTO.js +136 -0
- package/dist/chunk-FV2R5FFQ.cjs +102 -0
- package/dist/chunk-FW3UJ622.cjs +59 -0
- package/dist/chunk-G3ITTPGX.js +99 -0
- package/dist/chunk-HDKXSKMO.js +30 -0
- package/dist/chunk-HZAQRHBT.js +99 -0
- package/dist/chunk-I3ONDY7P.js +46 -0
- package/dist/chunk-I6KFFQPV.cjs +58 -0
- package/dist/chunk-IMZQ7ELK.cjs +196 -0
- package/dist/chunk-JCTBB7H2.cjs +40 -0
- package/dist/chunk-K77GC2QI.js +59 -0
- package/dist/chunk-LPV5CN2K.js +58 -0
- package/dist/chunk-MF7CJVIZ.js +40 -0
- package/dist/chunk-MIYA7TNR.cjs +123 -0
- package/dist/chunk-MJCAXASI.js +123 -0
- package/dist/chunk-MXFW3XY6.cjs +73 -0
- package/dist/chunk-ONBH74ZV.cjs +90 -0
- package/dist/chunk-OXLQ7QVL.cjs +40 -0
- package/dist/chunk-QEJV2KZ4.cjs +159 -0
- package/dist/chunk-QZ5GS6HW.cjs +46 -0
- package/dist/chunk-S6QEY7UY.js +73 -0
- package/dist/chunk-SUSAPI5W.cjs +142 -0
- package/dist/chunk-TBVHHF3H.cjs +47 -0
- package/dist/chunk-U2YMJM25.cjs +115 -0
- package/dist/chunk-VLNDEVKS.js +102 -0
- package/dist/chunk-XKG2A3EW.js +159 -0
- package/dist/chunk-XLD2Y3SS.cjs +136 -0
- package/dist/chunk-Y7KOKDFP.js +115 -0
- package/dist/chunk-YPPPGGLA.cjs +99 -0
- package/dist/chunk-ZHCMEQJJ.js +47 -0
- package/dist/context-compaction/index.cjs +8 -0
- package/dist/context-compaction/index.d.cts +77 -0
- package/dist/context-compaction/index.d.ts +77 -0
- package/dist/context-compaction/index.js +8 -0
- package/dist/diff/index.cjs +9 -0
- package/dist/diff/index.d.cts +72 -0
- package/dist/diff/index.d.ts +72 -0
- package/dist/diff/index.js +9 -0
- package/dist/edit/index.cjs +10 -0
- package/dist/edit/index.d.cts +53 -0
- package/dist/edit/index.d.ts +53 -0
- package/dist/edit/index.js +10 -0
- package/dist/glob/index.cjs +10 -0
- package/dist/glob/index.d.cts +47 -0
- package/dist/glob/index.d.ts +47 -0
- package/dist/glob/index.js +10 -0
- package/dist/grep/index.cjs +10 -0
- package/dist/grep/index.d.cts +50 -0
- package/dist/grep/index.d.ts +50 -0
- package/dist/grep/index.js +10 -0
- package/dist/http-request/index.cjs +8 -0
- package/dist/http-request/index.d.cts +60 -0
- package/dist/http-request/index.d.ts +60 -0
- package/dist/http-request/index.js +8 -0
- package/dist/index.cjs +102 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +102 -0
- package/dist/lsp/index.cjs +10 -0
- package/dist/lsp/index.d.cts +38 -0
- package/dist/lsp/index.d.ts +38 -0
- package/dist/lsp/index.js +10 -0
- package/dist/memory/index.cjs +9 -0
- package/dist/memory/index.d.cts +63 -0
- package/dist/memory/index.d.ts +63 -0
- package/dist/memory/index.js +9 -0
- package/dist/multi-edit/index.cjs +11 -0
- package/dist/multi-edit/index.d.cts +72 -0
- package/dist/multi-edit/index.d.ts +72 -0
- package/dist/multi-edit/index.js +11 -0
- package/dist/read/index.cjs +10 -0
- package/dist/read/index.d.cts +67 -0
- package/dist/read/index.d.ts +67 -0
- package/dist/read/index.js +10 -0
- package/dist/sleep/index.cjs +8 -0
- package/dist/sleep/index.d.cts +60 -0
- package/dist/sleep/index.d.ts +60 -0
- package/dist/sleep/index.js +8 -0
- package/dist/task/index.cjs +8 -0
- package/dist/task/index.d.cts +67 -0
- package/dist/task/index.d.ts +67 -0
- package/dist/task/index.js +8 -0
- package/dist/types-3QPDuCXN.d.cts +45 -0
- package/dist/types-3QPDuCXN.d.ts +45 -0
- package/dist/web-fetch/index.cjs +8 -0
- package/dist/web-fetch/index.d.cts +56 -0
- package/dist/web-fetch/index.d.ts +56 -0
- package/dist/web-fetch/index.js +8 -0
- package/dist/write/index.cjs +10 -0
- package/dist/write/index.d.cts +47 -0
- package/dist/write/index.d.ts +47 -0
- package/dist/write/index.js +10 -0
- package/package.json +145 -20
- package/dist/core/index.d.ts +0 -20
- package/dist/core/index.js +0 -1
- package/dist/core/index.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the memory tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional memory directory path.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { MemoryConfig } from 'agentool/memory';
|
|
11
|
+
* const config: MemoryConfig = { memoryDir: '/my/project/.agentool/memory' };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface MemoryConfig extends BaseToolConfig {
|
|
15
|
+
/** Directory for memory files. Defaults to `<cwd>/.agentool/memory`. */
|
|
16
|
+
memoryDir?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a memory tool that provides file-based key-value storage.
|
|
20
|
+
*
|
|
21
|
+
* Memory entries are stored as individual `.md` files inside the configured
|
|
22
|
+
* memory directory. Keys are sanitized to prevent path traversal.
|
|
23
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional configuration for cwd and memory directory.
|
|
26
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { createMemory } from 'agentool/memory';
|
|
31
|
+
*
|
|
32
|
+
* const memTool = createMemory({ cwd: '/my/project' });
|
|
33
|
+
* const result = await memTool.execute(
|
|
34
|
+
* { action: 'write', key: 'notes', content: 'Hello' },
|
|
35
|
+
* { toolCallId: 'id', messages: [] },
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function createMemory(config?: MemoryConfig): ai.Tool<{
|
|
40
|
+
action: "read" | "write" | "list" | "delete";
|
|
41
|
+
content?: string | undefined;
|
|
42
|
+
key?: string | undefined;
|
|
43
|
+
}, string>;
|
|
44
|
+
/**
|
|
45
|
+
* Default memory tool instance using `.agentool/memory` under the current
|
|
46
|
+
* working directory.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* import { memory } from 'agentool/memory';
|
|
51
|
+
* const result = await memory.execute(
|
|
52
|
+
* { action: 'list' },
|
|
53
|
+
* { toolCallId: 'id', messages: [] },
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const memory: ai.Tool<{
|
|
58
|
+
action: "read" | "write" | "list" | "delete";
|
|
59
|
+
content?: string | undefined;
|
|
60
|
+
key?: string | undefined;
|
|
61
|
+
}, string>;
|
|
62
|
+
|
|
63
|
+
export { type MemoryConfig, createMemory, memory };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the memory tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional memory directory path.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { MemoryConfig } from 'agentool/memory';
|
|
11
|
+
* const config: MemoryConfig = { memoryDir: '/my/project/.agentool/memory' };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface MemoryConfig extends BaseToolConfig {
|
|
15
|
+
/** Directory for memory files. Defaults to `<cwd>/.agentool/memory`. */
|
|
16
|
+
memoryDir?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a memory tool that provides file-based key-value storage.
|
|
20
|
+
*
|
|
21
|
+
* Memory entries are stored as individual `.md` files inside the configured
|
|
22
|
+
* memory directory. Keys are sanitized to prevent path traversal.
|
|
23
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional configuration for cwd and memory directory.
|
|
26
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { createMemory } from 'agentool/memory';
|
|
31
|
+
*
|
|
32
|
+
* const memTool = createMemory({ cwd: '/my/project' });
|
|
33
|
+
* const result = await memTool.execute(
|
|
34
|
+
* { action: 'write', key: 'notes', content: 'Hello' },
|
|
35
|
+
* { toolCallId: 'id', messages: [] },
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function createMemory(config?: MemoryConfig): ai.Tool<{
|
|
40
|
+
action: "read" | "write" | "list" | "delete";
|
|
41
|
+
content?: string | undefined;
|
|
42
|
+
key?: string | undefined;
|
|
43
|
+
}, string>;
|
|
44
|
+
/**
|
|
45
|
+
* Default memory tool instance using `.agentool/memory` under the current
|
|
46
|
+
* working directory.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* import { memory } from 'agentool/memory';
|
|
51
|
+
* const result = await memory.execute(
|
|
52
|
+
* { action: 'list' },
|
|
53
|
+
* { toolCallId: 'id', messages: [] },
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare const memory: ai.Tool<{
|
|
58
|
+
action: "read" | "write" | "list" | "delete";
|
|
59
|
+
content?: string | undefined;
|
|
60
|
+
key?: string | undefined;
|
|
61
|
+
}, string>;
|
|
62
|
+
|
|
63
|
+
export { type MemoryConfig, createMemory, memory };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk3VO6NETRcjs = require('../chunk-3VO6NETR.cjs');
|
|
5
|
+
require('../chunk-5NW4OGRI.cjs');
|
|
6
|
+
require('../chunk-CAEVLIQB.cjs');
|
|
7
|
+
require('../chunk-QZ5GS6HW.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.createMultiEdit = _chunk3VO6NETRcjs.createMultiEdit; exports.multiEdit = _chunk3VO6NETRcjs.multiEdit;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the multi-edit tool.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import type { MultiEditConfig } from 'agentool/multi-edit';
|
|
10
|
+
* const config: MultiEditConfig = { cwd: '/my/project' };
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
type MultiEditConfig = BaseToolConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a multi-edit tool that atomically applies multiple string
|
|
16
|
+
* replacements to a single file.
|
|
17
|
+
*
|
|
18
|
+
* All edits are validated and applied in memory first. The file is only
|
|
19
|
+
* written when every edit succeeds. If any edit fails (not found or
|
|
20
|
+
* non-unique), the file is left unchanged and an error is returned.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Optional configuration for the working directory.
|
|
23
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createMultiEdit } from 'agentool/multi-edit';
|
|
28
|
+
*
|
|
29
|
+
* const multiEditTool = createMultiEdit({ cwd: '/my/project' });
|
|
30
|
+
* const result = await multiEditTool.execute(
|
|
31
|
+
* {
|
|
32
|
+
* file_path: 'src/index.ts',
|
|
33
|
+
* edits: [
|
|
34
|
+
* { old_string: 'foo', new_string: 'bar' },
|
|
35
|
+
* { old_string: 'baz', new_string: 'qux' },
|
|
36
|
+
* ],
|
|
37
|
+
* },
|
|
38
|
+
* { toolCallId: 'id', messages: [] },
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare function createMultiEdit(config?: MultiEditConfig): ai.Tool<{
|
|
43
|
+
file_path: string;
|
|
44
|
+
edits: {
|
|
45
|
+
old_string: string;
|
|
46
|
+
new_string: string;
|
|
47
|
+
}[];
|
|
48
|
+
}, string>;
|
|
49
|
+
/**
|
|
50
|
+
* Default multi-edit tool instance using the current working directory.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { multiEdit } from 'agentool/multi-edit';
|
|
55
|
+
* const result = await multiEdit.execute(
|
|
56
|
+
* {
|
|
57
|
+
* file_path: 'file.txt',
|
|
58
|
+
* edits: [{ old_string: 'a', new_string: 'b' }],
|
|
59
|
+
* },
|
|
60
|
+
* { toolCallId: 'id', messages: [] },
|
|
61
|
+
* );
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const multiEdit: ai.Tool<{
|
|
65
|
+
file_path: string;
|
|
66
|
+
edits: {
|
|
67
|
+
old_string: string;
|
|
68
|
+
new_string: string;
|
|
69
|
+
}[];
|
|
70
|
+
}, string>;
|
|
71
|
+
|
|
72
|
+
export { type MultiEditConfig, createMultiEdit, multiEdit };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the multi-edit tool.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import type { MultiEditConfig } from 'agentool/multi-edit';
|
|
10
|
+
* const config: MultiEditConfig = { cwd: '/my/project' };
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
type MultiEditConfig = BaseToolConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a multi-edit tool that atomically applies multiple string
|
|
16
|
+
* replacements to a single file.
|
|
17
|
+
*
|
|
18
|
+
* All edits are validated and applied in memory first. The file is only
|
|
19
|
+
* written when every edit succeeds. If any edit fails (not found or
|
|
20
|
+
* non-unique), the file is left unchanged and an error is returned.
|
|
21
|
+
*
|
|
22
|
+
* @param config - Optional configuration for the working directory.
|
|
23
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createMultiEdit } from 'agentool/multi-edit';
|
|
28
|
+
*
|
|
29
|
+
* const multiEditTool = createMultiEdit({ cwd: '/my/project' });
|
|
30
|
+
* const result = await multiEditTool.execute(
|
|
31
|
+
* {
|
|
32
|
+
* file_path: 'src/index.ts',
|
|
33
|
+
* edits: [
|
|
34
|
+
* { old_string: 'foo', new_string: 'bar' },
|
|
35
|
+
* { old_string: 'baz', new_string: 'qux' },
|
|
36
|
+
* ],
|
|
37
|
+
* },
|
|
38
|
+
* { toolCallId: 'id', messages: [] },
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare function createMultiEdit(config?: MultiEditConfig): ai.Tool<{
|
|
43
|
+
file_path: string;
|
|
44
|
+
edits: {
|
|
45
|
+
old_string: string;
|
|
46
|
+
new_string: string;
|
|
47
|
+
}[];
|
|
48
|
+
}, string>;
|
|
49
|
+
/**
|
|
50
|
+
* Default multi-edit tool instance using the current working directory.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { multiEdit } from 'agentool/multi-edit';
|
|
55
|
+
* const result = await multiEdit.execute(
|
|
56
|
+
* {
|
|
57
|
+
* file_path: 'file.txt',
|
|
58
|
+
* edits: [{ old_string: 'a', new_string: 'b' }],
|
|
59
|
+
* },
|
|
60
|
+
* { toolCallId: 'id', messages: [] },
|
|
61
|
+
* );
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const multiEdit: ai.Tool<{
|
|
65
|
+
file_path: string;
|
|
66
|
+
edits: {
|
|
67
|
+
old_string: string;
|
|
68
|
+
new_string: string;
|
|
69
|
+
}[];
|
|
70
|
+
}, string>;
|
|
71
|
+
|
|
72
|
+
export { type MultiEditConfig, createMultiEdit, multiEdit };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkTBVHHF3Hcjs = require('../chunk-TBVHHF3H.cjs');
|
|
5
|
+
require('../chunk-CAEVLIQB.cjs');
|
|
6
|
+
require('../chunk-QZ5GS6HW.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.createRead = _chunkTBVHHF3Hcjs.createRead; exports.read = _chunkTBVHHF3Hcjs.read;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the read tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional maximum line count.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { ReadConfig } from 'agentool/read';
|
|
11
|
+
* const config: ReadConfig = { cwd: '/my/project', maxLines: 500 };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface ReadConfig extends BaseToolConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Maximum number of lines to return when no explicit limit is given.
|
|
17
|
+
* @default 2000
|
|
18
|
+
*/
|
|
19
|
+
maxLines?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a read tool that reads file contents with line numbers.
|
|
23
|
+
*
|
|
24
|
+
* The tool resolves the given path (supporting `~` and relative paths),
|
|
25
|
+
* reads the requested range of lines, and returns the content with
|
|
26
|
+
* `cat -n` style line numbers. It never throws; errors are returned as
|
|
27
|
+
* descriptive strings.
|
|
28
|
+
*
|
|
29
|
+
* @param config - Optional configuration for cwd and max lines.
|
|
30
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { createRead } from 'agentool/read';
|
|
35
|
+
*
|
|
36
|
+
* const readTool = createRead({ cwd: '/my/project' });
|
|
37
|
+
* const result = await readTool.execute(
|
|
38
|
+
* { file_path: 'src/index.ts' },
|
|
39
|
+
* { toolCallId: 'id', messages: [] },
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare function createRead(config?: ReadConfig): ai.Tool<{
|
|
44
|
+
file_path: string;
|
|
45
|
+
offset?: number | undefined;
|
|
46
|
+
limit?: number | undefined;
|
|
47
|
+
}, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Default read tool instance using the current working directory
|
|
50
|
+
* and a 2000-line default limit.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { read } from 'agentool/read';
|
|
55
|
+
* const result = await read.execute(
|
|
56
|
+
* { file_path: '/tmp/file.txt' },
|
|
57
|
+
* { toolCallId: 'id', messages: [] },
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare const read: ai.Tool<{
|
|
62
|
+
file_path: string;
|
|
63
|
+
offset?: number | undefined;
|
|
64
|
+
limit?: number | undefined;
|
|
65
|
+
}, string>;
|
|
66
|
+
|
|
67
|
+
export { type ReadConfig, createRead, read };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the read tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional maximum line count.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { ReadConfig } from 'agentool/read';
|
|
11
|
+
* const config: ReadConfig = { cwd: '/my/project', maxLines: 500 };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface ReadConfig extends BaseToolConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Maximum number of lines to return when no explicit limit is given.
|
|
17
|
+
* @default 2000
|
|
18
|
+
*/
|
|
19
|
+
maxLines?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a read tool that reads file contents with line numbers.
|
|
23
|
+
*
|
|
24
|
+
* The tool resolves the given path (supporting `~` and relative paths),
|
|
25
|
+
* reads the requested range of lines, and returns the content with
|
|
26
|
+
* `cat -n` style line numbers. It never throws; errors are returned as
|
|
27
|
+
* descriptive strings.
|
|
28
|
+
*
|
|
29
|
+
* @param config - Optional configuration for cwd and max lines.
|
|
30
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { createRead } from 'agentool/read';
|
|
35
|
+
*
|
|
36
|
+
* const readTool = createRead({ cwd: '/my/project' });
|
|
37
|
+
* const result = await readTool.execute(
|
|
38
|
+
* { file_path: 'src/index.ts' },
|
|
39
|
+
* { toolCallId: 'id', messages: [] },
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare function createRead(config?: ReadConfig): ai.Tool<{
|
|
44
|
+
file_path: string;
|
|
45
|
+
offset?: number | undefined;
|
|
46
|
+
limit?: number | undefined;
|
|
47
|
+
}, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Default read tool instance using the current working directory
|
|
50
|
+
* and a 2000-line default limit.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { read } from 'agentool/read';
|
|
55
|
+
* const result = await read.execute(
|
|
56
|
+
* { file_path: '/tmp/file.txt' },
|
|
57
|
+
* { toolCallId: 'id', messages: [] },
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare const read: ai.Tool<{
|
|
62
|
+
file_path: string;
|
|
63
|
+
offset?: number | undefined;
|
|
64
|
+
limit?: number | undefined;
|
|
65
|
+
}, string>;
|
|
66
|
+
|
|
67
|
+
export { type ReadConfig, createRead, read };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the sleep tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional maximum duration cap.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { SleepConfig } from 'agentool/sleep';
|
|
11
|
+
* const config: SleepConfig = { maxDuration: 60000 };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface SleepConfig extends BaseToolConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Maximum allowed sleep duration in milliseconds.
|
|
17
|
+
* Requested durations exceeding this value are clamped.
|
|
18
|
+
* @default 300000 (5 minutes)
|
|
19
|
+
*/
|
|
20
|
+
maxDuration?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates a sleep tool that pauses execution for a specified duration.
|
|
24
|
+
*
|
|
25
|
+
* The tool clamps the requested duration to `[0, maxDuration]` and reports
|
|
26
|
+
* the actual elapsed time. It never throws; errors are returned as strings.
|
|
27
|
+
*
|
|
28
|
+
* @param config - Optional configuration with a custom max duration.
|
|
29
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { createSleep } from 'agentool/sleep';
|
|
34
|
+
*
|
|
35
|
+
* // Default max of 300 000 ms
|
|
36
|
+
* const sleepTool = createSleep();
|
|
37
|
+
*
|
|
38
|
+
* // Custom max of 10 seconds
|
|
39
|
+
* const shortSleep = createSleep({ maxDuration: 10000 });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare function createSleep(config?: SleepConfig): ai.Tool<{
|
|
43
|
+
durationMs: number;
|
|
44
|
+
reason?: string | undefined;
|
|
45
|
+
}, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Default sleep tool instance with a 300 000 ms (5-minute) maximum duration.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { sleep } from 'agentool/sleep';
|
|
52
|
+
* const result = await sleep.execute({ durationMs: 1000, reason: 'rate limit' });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare const sleep: ai.Tool<{
|
|
56
|
+
durationMs: number;
|
|
57
|
+
reason?: string | undefined;
|
|
58
|
+
}, string>;
|
|
59
|
+
|
|
60
|
+
export { type SleepConfig, createSleep, sleep };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the sleep tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional maximum duration cap.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { SleepConfig } from 'agentool/sleep';
|
|
11
|
+
* const config: SleepConfig = { maxDuration: 60000 };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface SleepConfig extends BaseToolConfig {
|
|
15
|
+
/**
|
|
16
|
+
* Maximum allowed sleep duration in milliseconds.
|
|
17
|
+
* Requested durations exceeding this value are clamped.
|
|
18
|
+
* @default 300000 (5 minutes)
|
|
19
|
+
*/
|
|
20
|
+
maxDuration?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates a sleep tool that pauses execution for a specified duration.
|
|
24
|
+
*
|
|
25
|
+
* The tool clamps the requested duration to `[0, maxDuration]` and reports
|
|
26
|
+
* the actual elapsed time. It never throws; errors are returned as strings.
|
|
27
|
+
*
|
|
28
|
+
* @param config - Optional configuration with a custom max duration.
|
|
29
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { createSleep } from 'agentool/sleep';
|
|
34
|
+
*
|
|
35
|
+
* // Default max of 300 000 ms
|
|
36
|
+
* const sleepTool = createSleep();
|
|
37
|
+
*
|
|
38
|
+
* // Custom max of 10 seconds
|
|
39
|
+
* const shortSleep = createSleep({ maxDuration: 10000 });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare function createSleep(config?: SleepConfig): ai.Tool<{
|
|
43
|
+
durationMs: number;
|
|
44
|
+
reason?: string | undefined;
|
|
45
|
+
}, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Default sleep tool instance with a 300 000 ms (5-minute) maximum duration.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { sleep } from 'agentool/sleep';
|
|
52
|
+
* const result = await sleep.execute({ durationMs: 1000, reason: 'rate limit' });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
declare const sleep: ai.Tool<{
|
|
56
|
+
durationMs: number;
|
|
57
|
+
reason?: string | undefined;
|
|
58
|
+
}, string>;
|
|
59
|
+
|
|
60
|
+
export { type SleepConfig, createSleep, sleep };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the task tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional tasks file path.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { TaskConfig } from 'agentool/task';
|
|
11
|
+
* const config: TaskConfig = { cwd: '/my/project' };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface TaskConfig extends BaseToolConfig {
|
|
15
|
+
/** Path to the tasks JSON file. Defaults to `<cwd>/.agentool/tasks.json`. */
|
|
16
|
+
tasksFile?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a task tool that provides JSON file-based task tracking.
|
|
20
|
+
*
|
|
21
|
+
* Tasks are stored in a single JSON file with CRUD operations.
|
|
22
|
+
* Each task has an id, subject, description, status, and timestamps.
|
|
23
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional configuration for cwd and tasks file path.
|
|
26
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { createTask } from 'agentool/task';
|
|
31
|
+
*
|
|
32
|
+
* const taskTool = createTask({ cwd: '/my/project' });
|
|
33
|
+
* const result = await taskTool.execute(
|
|
34
|
+
* { action: 'create', subject: 'Fix bug', description: 'Fix the login bug' },
|
|
35
|
+
* { toolCallId: 'id', messages: [] },
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function createTask(config?: TaskConfig): ai.Tool<{
|
|
40
|
+
action: "list" | "delete" | "create" | "get" | "update";
|
|
41
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
id?: string | undefined;
|
|
44
|
+
subject?: string | undefined;
|
|
45
|
+
}, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Default task tool instance using `.agentool/tasks.json` under the current
|
|
48
|
+
* working directory.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import { task } from 'agentool/task';
|
|
53
|
+
* const result = await task.execute(
|
|
54
|
+
* { action: 'list' },
|
|
55
|
+
* { toolCallId: 'id', messages: [] },
|
|
56
|
+
* );
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const task: ai.Tool<{
|
|
60
|
+
action: "list" | "delete" | "create" | "get" | "update";
|
|
61
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
62
|
+
description?: string | undefined;
|
|
63
|
+
id?: string | undefined;
|
|
64
|
+
subject?: string | undefined;
|
|
65
|
+
}, string>;
|
|
66
|
+
|
|
67
|
+
export { type TaskConfig, createTask, task };
|