agentool 0.0.1 → 1.1.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 +738 -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-44AFQ2B7.js +30 -0
- package/dist/chunk-4HIATLKI.js +112 -0
- package/dist/chunk-4HXAKPQH.cjs +36 -0
- package/dist/chunk-4YI2H55A.js +142 -0
- package/dist/chunk-56CL4JCW.cjs +53 -0
- package/dist/chunk-5NW4OGRI.cjs +99 -0
- package/dist/chunk-5O55DKOB.cjs +112 -0
- package/dist/chunk-5TDZF4IM.cjs +197 -0
- package/dist/chunk-6DJSWTWQ.cjs +40 -0
- package/dist/chunk-6PQLFDGT.js +117 -0
- package/dist/chunk-ACGW44YT.js +47 -0
- package/dist/chunk-CAEVLIQB.cjs +117 -0
- package/dist/chunk-CGTPF6IS.js +90 -0
- package/dist/chunk-E6NBEYZD.js +51 -0
- package/dist/chunk-EA3YV7ZG.js +79 -0
- package/dist/chunk-ECYT46FP.js +40 -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-HNP7JDQC.cjs +159 -0
- package/dist/chunk-HNUL2CID.cjs +34 -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-IEX4NOVN.cjs +48 -0
- package/dist/chunk-IRRNYFI5.js +48 -0
- package/dist/chunk-K77GC2QI.js +59 -0
- package/dist/chunk-L5JH4I77.cjs +51 -0
- package/dist/chunk-LK6SQH2G.cjs +30 -0
- package/dist/chunk-LPV5CN2K.js +58 -0
- package/dist/chunk-LTE5NG4D.js +53 -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-OM2UFTGS.cjs +47 -0
- package/dist/chunk-ONBH74ZV.cjs +90 -0
- package/dist/chunk-OXLQ7QVL.cjs +40 -0
- package/dist/chunk-P6Z5XFDS.js +73 -0
- package/dist/chunk-QZ5GS6HW.cjs +46 -0
- package/dist/chunk-S7IVHOA6.js +75 -0
- package/dist/chunk-SUSAPI5W.cjs +142 -0
- package/dist/chunk-TMW3XKKJ.js +34 -0
- package/dist/chunk-UDIG7332.js +159 -0
- package/dist/chunk-VLNDEVKS.js +102 -0
- package/dist/chunk-VXZ4RKJI.js +36 -0
- package/dist/chunk-XAQGZ374.js +197 -0
- package/dist/chunk-YPPPGGLA.cjs +99 -0
- package/dist/chunk-ZBLQV6UO.cjs +73 -0
- package/dist/chunk-ZFQZWXOI.cjs +75 -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 +133 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +133 -0
- package/dist/lsp/index.cjs +10 -0
- package/dist/lsp/index.d.cts +35 -0
- package/dist/lsp/index.d.ts +35 -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-create/index.cjs +9 -0
- package/dist/task-create/index.d.cts +19 -0
- package/dist/task-create/index.d.ts +19 -0
- package/dist/task-create/index.js +9 -0
- package/dist/task-get/index.cjs +9 -0
- package/dist/task-get/index.d.cts +15 -0
- package/dist/task-get/index.d.ts +15 -0
- package/dist/task-get/index.js +9 -0
- package/dist/task-list/index.cjs +9 -0
- package/dist/task-list/index.d.cts +11 -0
- package/dist/task-list/index.d.ts +11 -0
- package/dist/task-list/index.js +9 -0
- package/dist/task-update/index.cjs +9 -0
- package/dist/task-update/index.d.cts +31 -0
- package/dist/task-update/index.d.ts +31 -0
- package/dist/task-update/index.js +9 -0
- package/dist/tool-search/index.cjs +8 -0
- package/dist/tool-search/index.d.cts +18 -0
- package/dist/tool-search/index.d.ts +18 -0
- package/dist/tool-search/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 +54 -0
- package/dist/web-fetch/index.d.ts +54 -0
- package/dist/web-fetch/index.js +8 -0
- package/dist/web-search/index.cjs +8 -0
- package/dist/web-search/index.d.cts +21 -0
- package/dist/web-search/index.d.ts +21 -0
- package/dist/web-search/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 +170 -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,77 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the context compaction tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with summarization options.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createContextCompaction } from 'agentool/context-compaction';
|
|
11
|
+
*
|
|
12
|
+
* const compactor = createContextCompaction({
|
|
13
|
+
* summarize: async (msgs) => `Summary of ${msgs.length} messages`,
|
|
14
|
+
* maxTokens: 2048,
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
interface ContextCompactionConfig extends BaseToolConfig {
|
|
19
|
+
/**
|
|
20
|
+
* Function that summarizes messages into a shorter form.
|
|
21
|
+
* Consumer must provide this for compaction to work.
|
|
22
|
+
*/
|
|
23
|
+
summarize?: (messages: Array<{
|
|
24
|
+
role: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}>) => Promise<string>;
|
|
27
|
+
/** Maximum tokens target. Defaults to 4096. */
|
|
28
|
+
maxTokens?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a context compaction tool with the given configuration.
|
|
32
|
+
* Summarizes conversation history to reduce context size when it
|
|
33
|
+
* exceeds the token budget (estimated as maxTokens * 4 characters).
|
|
34
|
+
*
|
|
35
|
+
* @param config - Configuration including the summarize callback and token budget
|
|
36
|
+
* @returns An AI SDK tool that compacts conversation messages
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* import { createContextCompaction } from 'agentool/context-compaction';
|
|
41
|
+
*
|
|
42
|
+
* const compactor = createContextCompaction({
|
|
43
|
+
* summarize: async (msgs) => {
|
|
44
|
+
* // Call your LLM to summarize
|
|
45
|
+
* return 'Condensed summary of the conversation';
|
|
46
|
+
* },
|
|
47
|
+
* maxTokens: 4096,
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare function createContextCompaction(config?: ContextCompactionConfig): ai.Tool<{
|
|
52
|
+
messages: {
|
|
53
|
+
content: string;
|
|
54
|
+
role: string;
|
|
55
|
+
}[];
|
|
56
|
+
maxTokens?: number | undefined;
|
|
57
|
+
}, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Default context compaction tool instance with no summarize function.
|
|
60
|
+
* Configure with {@link createContextCompaction} for full functionality.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* import { contextCompaction } from 'agentool/context-compaction';
|
|
65
|
+
* // Use directly — will return error if messages exceed budget
|
|
66
|
+
* // since no summarize function is configured.
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare const contextCompaction: ai.Tool<{
|
|
70
|
+
messages: {
|
|
71
|
+
content: string;
|
|
72
|
+
role: string;
|
|
73
|
+
}[];
|
|
74
|
+
maxTokens?: number | undefined;
|
|
75
|
+
}, string>;
|
|
76
|
+
|
|
77
|
+
export { type ContextCompactionConfig, contextCompaction, createContextCompaction };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkONBH74ZVcjs = require('../chunk-ONBH74ZV.cjs');
|
|
5
|
+
require('../chunk-QZ5GS6HW.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.createDiff = _chunkONBH74ZVcjs.createDiff; exports.diff = _chunkONBH74ZVcjs.diff;
|
|
@@ -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 diff tool.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import type { DiffConfig } from 'agentool/diff';
|
|
10
|
+
* const config: DiffConfig = { cwd: '/my/project' };
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
type DiffConfig = BaseToolConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a diff tool that generates unified diffs between files or strings.
|
|
16
|
+
*
|
|
17
|
+
* Supports three modes:
|
|
18
|
+
* 1. Two file paths: diffs the contents of both files.
|
|
19
|
+
* 2. Two strings: diffs old_content against new_content.
|
|
20
|
+
* 3. One file path + string content: reads the file and diffs against
|
|
21
|
+
* the provided content.
|
|
22
|
+
*
|
|
23
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional configuration for the working directory.
|
|
26
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { createDiff } from 'agentool/diff';
|
|
31
|
+
*
|
|
32
|
+
* const diffTool = createDiff({ cwd: '/my/project' });
|
|
33
|
+
*
|
|
34
|
+
* // Diff two files
|
|
35
|
+
* await diffTool.execute(
|
|
36
|
+
* { file_path: 'a.txt', other_file_path: 'b.txt' },
|
|
37
|
+
* { toolCallId: 'id', messages: [] },
|
|
38
|
+
* );
|
|
39
|
+
*
|
|
40
|
+
* // Diff two strings
|
|
41
|
+
* await diffTool.execute(
|
|
42
|
+
* { old_content: 'hello\n', new_content: 'world\n' },
|
|
43
|
+
* { toolCallId: 'id', messages: [] },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function createDiff(config?: DiffConfig): ai.Tool<{
|
|
48
|
+
file_path?: string | undefined;
|
|
49
|
+
other_file_path?: string | undefined;
|
|
50
|
+
old_content?: string | undefined;
|
|
51
|
+
new_content?: string | undefined;
|
|
52
|
+
}, string>;
|
|
53
|
+
/**
|
|
54
|
+
* Default diff tool instance using the current working directory.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { diff } from 'agentool/diff';
|
|
59
|
+
* const result = await diff.execute(
|
|
60
|
+
* { old_content: 'hello\n', new_content: 'world\n' },
|
|
61
|
+
* { toolCallId: 'id', messages: [] },
|
|
62
|
+
* );
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const diff: ai.Tool<{
|
|
66
|
+
file_path?: string | undefined;
|
|
67
|
+
other_file_path?: string | undefined;
|
|
68
|
+
old_content?: string | undefined;
|
|
69
|
+
new_content?: string | undefined;
|
|
70
|
+
}, string>;
|
|
71
|
+
|
|
72
|
+
export { type DiffConfig, createDiff, diff };
|
|
@@ -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 diff tool.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import type { DiffConfig } from 'agentool/diff';
|
|
10
|
+
* const config: DiffConfig = { cwd: '/my/project' };
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
type DiffConfig = BaseToolConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a diff tool that generates unified diffs between files or strings.
|
|
16
|
+
*
|
|
17
|
+
* Supports three modes:
|
|
18
|
+
* 1. Two file paths: diffs the contents of both files.
|
|
19
|
+
* 2. Two strings: diffs old_content against new_content.
|
|
20
|
+
* 3. One file path + string content: reads the file and diffs against
|
|
21
|
+
* the provided content.
|
|
22
|
+
*
|
|
23
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional configuration for the working directory.
|
|
26
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { createDiff } from 'agentool/diff';
|
|
31
|
+
*
|
|
32
|
+
* const diffTool = createDiff({ cwd: '/my/project' });
|
|
33
|
+
*
|
|
34
|
+
* // Diff two files
|
|
35
|
+
* await diffTool.execute(
|
|
36
|
+
* { file_path: 'a.txt', other_file_path: 'b.txt' },
|
|
37
|
+
* { toolCallId: 'id', messages: [] },
|
|
38
|
+
* );
|
|
39
|
+
*
|
|
40
|
+
* // Diff two strings
|
|
41
|
+
* await diffTool.execute(
|
|
42
|
+
* { old_content: 'hello\n', new_content: 'world\n' },
|
|
43
|
+
* { toolCallId: 'id', messages: [] },
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function createDiff(config?: DiffConfig): ai.Tool<{
|
|
48
|
+
file_path?: string | undefined;
|
|
49
|
+
other_file_path?: string | undefined;
|
|
50
|
+
old_content?: string | undefined;
|
|
51
|
+
new_content?: string | undefined;
|
|
52
|
+
}, string>;
|
|
53
|
+
/**
|
|
54
|
+
* Default diff tool instance using the current working directory.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { diff } from 'agentool/diff';
|
|
59
|
+
* const result = await diff.execute(
|
|
60
|
+
* { old_content: 'hello\n', new_content: 'world\n' },
|
|
61
|
+
* { toolCallId: 'id', messages: [] },
|
|
62
|
+
* );
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const diff: ai.Tool<{
|
|
66
|
+
file_path?: string | undefined;
|
|
67
|
+
other_file_path?: string | undefined;
|
|
68
|
+
old_content?: string | undefined;
|
|
69
|
+
new_content?: string | undefined;
|
|
70
|
+
}, string>;
|
|
71
|
+
|
|
72
|
+
export { type DiffConfig, createDiff, diff };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkZBLQV6UOcjs = require('../chunk-ZBLQV6UO.cjs');
|
|
5
|
+
require('../chunk-5NW4OGRI.cjs');
|
|
6
|
+
require('../chunk-QZ5GS6HW.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.createEdit = _chunkZBLQV6UOcjs.createEdit; exports.edit = _chunkZBLQV6UOcjs.edit;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
type EditConfig = BaseToolConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Creates an edit tool that performs string replacements in files.
|
|
7
|
+
*
|
|
8
|
+
* The tool locates `old_string` within the target file and replaces it with
|
|
9
|
+
* `new_string`. It supports curly-quote fallback matching via
|
|
10
|
+
* {@link findActualString} and preserves the file's quote style via
|
|
11
|
+
* {@link preserveQuoteStyle}. Execute never throws; errors are returned as
|
|
12
|
+
* descriptive strings.
|
|
13
|
+
*
|
|
14
|
+
* @param config - Optional configuration for the working directory.
|
|
15
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { createEdit } from 'agentool/edit';
|
|
20
|
+
*
|
|
21
|
+
* const editTool = createEdit({ cwd: '/my/project' });
|
|
22
|
+
* const result = await editTool.execute(
|
|
23
|
+
* { file_path: 'src/index.ts', old_string: 'foo', new_string: 'bar' },
|
|
24
|
+
* { toolCallId: 'id', messages: [] },
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function createEdit(config?: BaseToolConfig): ai.Tool<{
|
|
29
|
+
file_path: string;
|
|
30
|
+
old_string: string;
|
|
31
|
+
new_string: string;
|
|
32
|
+
replace_all?: boolean | undefined;
|
|
33
|
+
}, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Default edit tool instance using the current working directory.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { edit } from 'agentool/edit';
|
|
40
|
+
* const result = await edit.execute(
|
|
41
|
+
* { file_path: 'src/index.ts', old_string: 'foo', new_string: 'bar' },
|
|
42
|
+
* { toolCallId: 'id', messages: [] },
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const edit: ai.Tool<{
|
|
47
|
+
file_path: string;
|
|
48
|
+
old_string: string;
|
|
49
|
+
new_string: string;
|
|
50
|
+
replace_all?: boolean | undefined;
|
|
51
|
+
}, string>;
|
|
52
|
+
|
|
53
|
+
export { type EditConfig, createEdit, edit };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
type EditConfig = BaseToolConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Creates an edit tool that performs string replacements in files.
|
|
7
|
+
*
|
|
8
|
+
* The tool locates `old_string` within the target file and replaces it with
|
|
9
|
+
* `new_string`. It supports curly-quote fallback matching via
|
|
10
|
+
* {@link findActualString} and preserves the file's quote style via
|
|
11
|
+
* {@link preserveQuoteStyle}. Execute never throws; errors are returned as
|
|
12
|
+
* descriptive strings.
|
|
13
|
+
*
|
|
14
|
+
* @param config - Optional configuration for the working directory.
|
|
15
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { createEdit } from 'agentool/edit';
|
|
20
|
+
*
|
|
21
|
+
* const editTool = createEdit({ cwd: '/my/project' });
|
|
22
|
+
* const result = await editTool.execute(
|
|
23
|
+
* { file_path: 'src/index.ts', old_string: 'foo', new_string: 'bar' },
|
|
24
|
+
* { toolCallId: 'id', messages: [] },
|
|
25
|
+
* );
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare function createEdit(config?: BaseToolConfig): ai.Tool<{
|
|
29
|
+
file_path: string;
|
|
30
|
+
old_string: string;
|
|
31
|
+
new_string: string;
|
|
32
|
+
replace_all?: boolean | undefined;
|
|
33
|
+
}, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Default edit tool instance using the current working directory.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { edit } from 'agentool/edit';
|
|
40
|
+
* const result = await edit.execute(
|
|
41
|
+
* { file_path: 'src/index.ts', old_string: 'foo', new_string: 'bar' },
|
|
42
|
+
* { toolCallId: 'id', messages: [] },
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const edit: ai.Tool<{
|
|
47
|
+
file_path: string;
|
|
48
|
+
old_string: string;
|
|
49
|
+
new_string: string;
|
|
50
|
+
replace_all?: boolean | undefined;
|
|
51
|
+
}, string>;
|
|
52
|
+
|
|
53
|
+
export { type EditConfig, createEdit, edit };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkYPPPGGLAcjs = require('../chunk-YPPPGGLA.cjs');
|
|
5
|
+
require('../chunk-MIYA7TNR.cjs');
|
|
6
|
+
require('../chunk-QZ5GS6HW.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.createGlob = _chunkYPPPGGLAcjs.createGlob; exports.glob = _chunkYPPPGGLAcjs.glob;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a glob tool that finds files matching a pattern.
|
|
6
|
+
*
|
|
7
|
+
* Uses ripgrep `--files --glob` under the hood for fast file matching.
|
|
8
|
+
* Returns absolute paths sorted by modification time (newest first).
|
|
9
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
10
|
+
*
|
|
11
|
+
* @param config - Optional configuration with a custom working directory.
|
|
12
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { createGlob } from 'agentool/glob';
|
|
17
|
+
*
|
|
18
|
+
* const globTool = createGlob({ cwd: '/my/project' });
|
|
19
|
+
* const result = await globTool.execute(
|
|
20
|
+
* { pattern: '**\/*.ts' },
|
|
21
|
+
* { toolCallId: 'id', messages: [] },
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function createGlob(config?: BaseToolConfig): ai.Tool<{
|
|
26
|
+
pattern: string;
|
|
27
|
+
path?: string | undefined;
|
|
28
|
+
}, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Default glob tool instance using the current working directory.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { glob } from 'agentool/glob';
|
|
35
|
+
* const result = await glob.execute(
|
|
36
|
+
* { pattern: '**\/*.ts' },
|
|
37
|
+
* { toolCallId: 'id', messages: [] },
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
type GlobConfig = BaseToolConfig;
|
|
42
|
+
declare const glob: ai.Tool<{
|
|
43
|
+
pattern: string;
|
|
44
|
+
path?: string | undefined;
|
|
45
|
+
}, string>;
|
|
46
|
+
|
|
47
|
+
export { type GlobConfig, createGlob, glob };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a glob tool that finds files matching a pattern.
|
|
6
|
+
*
|
|
7
|
+
* Uses ripgrep `--files --glob` under the hood for fast file matching.
|
|
8
|
+
* Returns absolute paths sorted by modification time (newest first).
|
|
9
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
10
|
+
*
|
|
11
|
+
* @param config - Optional configuration with a custom working directory.
|
|
12
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { createGlob } from 'agentool/glob';
|
|
17
|
+
*
|
|
18
|
+
* const globTool = createGlob({ cwd: '/my/project' });
|
|
19
|
+
* const result = await globTool.execute(
|
|
20
|
+
* { pattern: '**\/*.ts' },
|
|
21
|
+
* { toolCallId: 'id', messages: [] },
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function createGlob(config?: BaseToolConfig): ai.Tool<{
|
|
26
|
+
pattern: string;
|
|
27
|
+
path?: string | undefined;
|
|
28
|
+
}, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Default glob tool instance using the current working directory.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { glob } from 'agentool/glob';
|
|
35
|
+
* const result = await glob.execute(
|
|
36
|
+
* { pattern: '**\/*.ts' },
|
|
37
|
+
* { toolCallId: 'id', messages: [] },
|
|
38
|
+
* );
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
type GlobConfig = BaseToolConfig;
|
|
42
|
+
declare const glob: ai.Tool<{
|
|
43
|
+
pattern: string;
|
|
44
|
+
path?: string | undefined;
|
|
45
|
+
}, string>;
|
|
46
|
+
|
|
47
|
+
export { type GlobConfig, createGlob, glob };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkHNP7JDQCcjs = require('../chunk-HNP7JDQC.cjs');
|
|
5
|
+
require('../chunk-MIYA7TNR.cjs');
|
|
6
|
+
require('../chunk-QZ5GS6HW.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.createGrep = _chunkHNP7JDQCcjs.createGrep; exports.grep = _chunkHNP7JDQCcjs.grep;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a grep tool that searches file contents using ripgrep.
|
|
6
|
+
*
|
|
7
|
+
* Supports three output modes: content, files_with_matches, and count.
|
|
8
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
9
|
+
*
|
|
10
|
+
* @param config - Optional configuration with a custom working directory.
|
|
11
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
12
|
+
*/
|
|
13
|
+
declare function createGrep(config?: BaseToolConfig): ai.Tool<{
|
|
14
|
+
pattern: string;
|
|
15
|
+
path?: string | undefined;
|
|
16
|
+
type?: string | undefined;
|
|
17
|
+
glob?: string | undefined;
|
|
18
|
+
output_mode?: "content" | "files_with_matches" | "count" | undefined;
|
|
19
|
+
'-B'?: number | undefined;
|
|
20
|
+
'-A'?: number | undefined;
|
|
21
|
+
'-C'?: number | undefined;
|
|
22
|
+
context?: number | undefined;
|
|
23
|
+
'-n'?: boolean | undefined;
|
|
24
|
+
'-i'?: boolean | undefined;
|
|
25
|
+
head_limit?: number | undefined;
|
|
26
|
+
offset?: number | undefined;
|
|
27
|
+
multiline?: boolean | undefined;
|
|
28
|
+
}, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Default grep tool instance using the current working directory.
|
|
31
|
+
*/
|
|
32
|
+
type GrepConfig = BaseToolConfig;
|
|
33
|
+
declare const grep: ai.Tool<{
|
|
34
|
+
pattern: string;
|
|
35
|
+
path?: string | undefined;
|
|
36
|
+
type?: string | undefined;
|
|
37
|
+
glob?: string | undefined;
|
|
38
|
+
output_mode?: "content" | "files_with_matches" | "count" | undefined;
|
|
39
|
+
'-B'?: number | undefined;
|
|
40
|
+
'-A'?: number | undefined;
|
|
41
|
+
'-C'?: number | undefined;
|
|
42
|
+
context?: number | undefined;
|
|
43
|
+
'-n'?: boolean | undefined;
|
|
44
|
+
'-i'?: boolean | undefined;
|
|
45
|
+
head_limit?: number | undefined;
|
|
46
|
+
offset?: number | undefined;
|
|
47
|
+
multiline?: boolean | undefined;
|
|
48
|
+
}, string>;
|
|
49
|
+
|
|
50
|
+
export { type GrepConfig, createGrep, grep };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates a grep tool that searches file contents using ripgrep.
|
|
6
|
+
*
|
|
7
|
+
* Supports three output modes: content, files_with_matches, and count.
|
|
8
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
9
|
+
*
|
|
10
|
+
* @param config - Optional configuration with a custom working directory.
|
|
11
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
12
|
+
*/
|
|
13
|
+
declare function createGrep(config?: BaseToolConfig): ai.Tool<{
|
|
14
|
+
pattern: string;
|
|
15
|
+
path?: string | undefined;
|
|
16
|
+
type?: string | undefined;
|
|
17
|
+
glob?: string | undefined;
|
|
18
|
+
output_mode?: "content" | "files_with_matches" | "count" | undefined;
|
|
19
|
+
'-B'?: number | undefined;
|
|
20
|
+
'-A'?: number | undefined;
|
|
21
|
+
'-C'?: number | undefined;
|
|
22
|
+
context?: number | undefined;
|
|
23
|
+
'-n'?: boolean | undefined;
|
|
24
|
+
'-i'?: boolean | undefined;
|
|
25
|
+
head_limit?: number | undefined;
|
|
26
|
+
offset?: number | undefined;
|
|
27
|
+
multiline?: boolean | undefined;
|
|
28
|
+
}, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Default grep tool instance using the current working directory.
|
|
31
|
+
*/
|
|
32
|
+
type GrepConfig = BaseToolConfig;
|
|
33
|
+
declare const grep: ai.Tool<{
|
|
34
|
+
pattern: string;
|
|
35
|
+
path?: string | undefined;
|
|
36
|
+
type?: string | undefined;
|
|
37
|
+
glob?: string | undefined;
|
|
38
|
+
output_mode?: "content" | "files_with_matches" | "count" | undefined;
|
|
39
|
+
'-B'?: number | undefined;
|
|
40
|
+
'-A'?: number | undefined;
|
|
41
|
+
'-C'?: number | undefined;
|
|
42
|
+
context?: number | undefined;
|
|
43
|
+
'-n'?: boolean | undefined;
|
|
44
|
+
'-i'?: boolean | undefined;
|
|
45
|
+
head_limit?: number | undefined;
|
|
46
|
+
offset?: number | undefined;
|
|
47
|
+
multiline?: boolean | undefined;
|
|
48
|
+
}, string>;
|
|
49
|
+
|
|
50
|
+
export { type GrepConfig, createGrep, grep };
|