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.
Files changed (115) hide show
  1. package/README.md +627 -52
  2. package/dist/ask-user/index.cjs +8 -0
  3. package/dist/ask-user/index.d.cts +68 -0
  4. package/dist/ask-user/index.d.ts +68 -0
  5. package/dist/ask-user/index.js +8 -0
  6. package/dist/bash/index.cjs +8 -0
  7. package/dist/bash/index.d.cts +63 -0
  8. package/dist/bash/index.d.ts +63 -0
  9. package/dist/bash/index.js +8 -0
  10. package/dist/chunk-3EPGFWZV.cjs +30 -0
  11. package/dist/chunk-3VO6NETR.cjs +79 -0
  12. package/dist/chunk-4YI2H55A.js +142 -0
  13. package/dist/chunk-5NW4OGRI.cjs +99 -0
  14. package/dist/chunk-6MDPYALY.js +196 -0
  15. package/dist/chunk-6PQLFDGT.js +117 -0
  16. package/dist/chunk-7QL4BQCH.js +40 -0
  17. package/dist/chunk-CAEVLIQB.cjs +117 -0
  18. package/dist/chunk-CGTPF6IS.js +90 -0
  19. package/dist/chunk-EA3YV7ZG.js +79 -0
  20. package/dist/chunk-FAEGCFTO.js +136 -0
  21. package/dist/chunk-FV2R5FFQ.cjs +102 -0
  22. package/dist/chunk-FW3UJ622.cjs +59 -0
  23. package/dist/chunk-G3ITTPGX.js +99 -0
  24. package/dist/chunk-HDKXSKMO.js +30 -0
  25. package/dist/chunk-HZAQRHBT.js +99 -0
  26. package/dist/chunk-I3ONDY7P.js +46 -0
  27. package/dist/chunk-I6KFFQPV.cjs +58 -0
  28. package/dist/chunk-IMZQ7ELK.cjs +196 -0
  29. package/dist/chunk-JCTBB7H2.cjs +40 -0
  30. package/dist/chunk-K77GC2QI.js +59 -0
  31. package/dist/chunk-LPV5CN2K.js +58 -0
  32. package/dist/chunk-MF7CJVIZ.js +40 -0
  33. package/dist/chunk-MIYA7TNR.cjs +123 -0
  34. package/dist/chunk-MJCAXASI.js +123 -0
  35. package/dist/chunk-MXFW3XY6.cjs +73 -0
  36. package/dist/chunk-ONBH74ZV.cjs +90 -0
  37. package/dist/chunk-OXLQ7QVL.cjs +40 -0
  38. package/dist/chunk-QEJV2KZ4.cjs +159 -0
  39. package/dist/chunk-QZ5GS6HW.cjs +46 -0
  40. package/dist/chunk-S6QEY7UY.js +73 -0
  41. package/dist/chunk-SUSAPI5W.cjs +142 -0
  42. package/dist/chunk-TBVHHF3H.cjs +47 -0
  43. package/dist/chunk-U2YMJM25.cjs +115 -0
  44. package/dist/chunk-VLNDEVKS.js +102 -0
  45. package/dist/chunk-XKG2A3EW.js +159 -0
  46. package/dist/chunk-XLD2Y3SS.cjs +136 -0
  47. package/dist/chunk-Y7KOKDFP.js +115 -0
  48. package/dist/chunk-YPPPGGLA.cjs +99 -0
  49. package/dist/chunk-ZHCMEQJJ.js +47 -0
  50. package/dist/context-compaction/index.cjs +8 -0
  51. package/dist/context-compaction/index.d.cts +77 -0
  52. package/dist/context-compaction/index.d.ts +77 -0
  53. package/dist/context-compaction/index.js +8 -0
  54. package/dist/diff/index.cjs +9 -0
  55. package/dist/diff/index.d.cts +72 -0
  56. package/dist/diff/index.d.ts +72 -0
  57. package/dist/diff/index.js +9 -0
  58. package/dist/edit/index.cjs +10 -0
  59. package/dist/edit/index.d.cts +53 -0
  60. package/dist/edit/index.d.ts +53 -0
  61. package/dist/edit/index.js +10 -0
  62. package/dist/glob/index.cjs +10 -0
  63. package/dist/glob/index.d.cts +47 -0
  64. package/dist/glob/index.d.ts +47 -0
  65. package/dist/glob/index.js +10 -0
  66. package/dist/grep/index.cjs +10 -0
  67. package/dist/grep/index.d.cts +50 -0
  68. package/dist/grep/index.d.ts +50 -0
  69. package/dist/grep/index.js +10 -0
  70. package/dist/http-request/index.cjs +8 -0
  71. package/dist/http-request/index.d.cts +60 -0
  72. package/dist/http-request/index.d.ts +60 -0
  73. package/dist/http-request/index.js +8 -0
  74. package/dist/index.cjs +102 -0
  75. package/dist/index.d.cts +18 -0
  76. package/dist/index.d.ts +18 -0
  77. package/dist/index.js +102 -0
  78. package/dist/lsp/index.cjs +10 -0
  79. package/dist/lsp/index.d.cts +38 -0
  80. package/dist/lsp/index.d.ts +38 -0
  81. package/dist/lsp/index.js +10 -0
  82. package/dist/memory/index.cjs +9 -0
  83. package/dist/memory/index.d.cts +63 -0
  84. package/dist/memory/index.d.ts +63 -0
  85. package/dist/memory/index.js +9 -0
  86. package/dist/multi-edit/index.cjs +11 -0
  87. package/dist/multi-edit/index.d.cts +72 -0
  88. package/dist/multi-edit/index.d.ts +72 -0
  89. package/dist/multi-edit/index.js +11 -0
  90. package/dist/read/index.cjs +10 -0
  91. package/dist/read/index.d.cts +67 -0
  92. package/dist/read/index.d.ts +67 -0
  93. package/dist/read/index.js +10 -0
  94. package/dist/sleep/index.cjs +8 -0
  95. package/dist/sleep/index.d.cts +60 -0
  96. package/dist/sleep/index.d.ts +60 -0
  97. package/dist/sleep/index.js +8 -0
  98. package/dist/task/index.cjs +8 -0
  99. package/dist/task/index.d.cts +67 -0
  100. package/dist/task/index.d.ts +67 -0
  101. package/dist/task/index.js +8 -0
  102. package/dist/types-3QPDuCXN.d.cts +45 -0
  103. package/dist/types-3QPDuCXN.d.ts +45 -0
  104. package/dist/web-fetch/index.cjs +8 -0
  105. package/dist/web-fetch/index.d.cts +56 -0
  106. package/dist/web-fetch/index.d.ts +56 -0
  107. package/dist/web-fetch/index.js +8 -0
  108. package/dist/write/index.cjs +10 -0
  109. package/dist/write/index.d.cts +47 -0
  110. package/dist/write/index.d.ts +47 -0
  111. package/dist/write/index.js +10 -0
  112. package/package.json +145 -20
  113. package/dist/core/index.d.ts +0 -20
  114. package/dist/core/index.js +0 -1
  115. package/dist/core/index.js.map +0 -1
@@ -0,0 +1,99 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkMIYA7TNRcjs = require('./chunk-MIYA7TNR.cjs');
4
+
5
+
6
+ var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
7
+
8
+ // src/glob/index.ts
9
+ var _ai = require('ai');
10
+ var _zod = require('zod');
11
+
12
+ // src/shared/glob.ts
13
+ var _path = require('path');
14
+ function extractGlobBaseDirectory(pattern) {
15
+ const globChars = /[*?[{]/;
16
+ const match = pattern.match(globChars);
17
+ if (!match || match.index === void 0) {
18
+ const dir = _path.dirname.call(void 0, pattern);
19
+ const file = _path.basename.call(void 0, pattern);
20
+ return { baseDir: dir, relativePattern: file };
21
+ }
22
+ const staticPrefix = pattern.slice(0, match.index);
23
+ const lastSepIndex = Math.max(
24
+ staticPrefix.lastIndexOf("/"),
25
+ staticPrefix.lastIndexOf(_path.sep)
26
+ );
27
+ if (lastSepIndex === -1) {
28
+ return { baseDir: "", relativePattern: pattern };
29
+ }
30
+ let baseDir = staticPrefix.slice(0, lastSepIndex);
31
+ const relativePattern = pattern.slice(lastSepIndex + 1);
32
+ if (baseDir === "" && lastSepIndex === 0) {
33
+ baseDir = "/";
34
+ }
35
+ return { baseDir, relativePattern };
36
+ }
37
+ async function glob(pattern, cwd, options) {
38
+ const limit = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.limit]), () => ( 100));
39
+ const offset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _2 => _2.offset]), () => ( 0));
40
+ let searchDir = cwd;
41
+ let searchPattern = pattern;
42
+ if (_path.isAbsolute.call(void 0, pattern)) {
43
+ const { baseDir, relativePattern } = extractGlobBaseDirectory(pattern);
44
+ if (baseDir) {
45
+ searchDir = baseDir;
46
+ searchPattern = relativePattern;
47
+ }
48
+ }
49
+ const args = [
50
+ "--files",
51
+ "--glob",
52
+ searchPattern,
53
+ "--sort=modified",
54
+ "--hidden",
55
+ "--no-ignore"
56
+ ];
57
+ const allPaths = await _chunkMIYA7TNRcjs.executeRipgrep.call(void 0, args, searchDir, {
58
+ signal: _optionalChain([options, 'optionalAccess', _3 => _3.signal])
59
+ });
60
+ const absolutePaths = allPaths.map(
61
+ (p) => _path.isAbsolute.call(void 0, p) ? p : _path.join.call(void 0, searchDir, p)
62
+ );
63
+ const truncated = absolutePaths.length > offset + limit;
64
+ const files = absolutePaths.slice(offset, offset + limit);
65
+ return { files, truncated };
66
+ }
67
+
68
+ // src/glob/index.ts
69
+ function createGlob(config = {}) {
70
+ const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
71
+ return _ai.tool.call(void 0, {
72
+ description: 'Find files matching a glob pattern. Returns absolute file paths sorted by modification time (newest first). Supports patterns like "**/*.ts", "src/**/*.js", or "*.json".',
73
+ inputSchema: _zod.z.object({
74
+ pattern: _zod.z.string().describe("Glob pattern to match files against"),
75
+ path: _zod.z.string().optional().describe("Directory to search in. Defaults to the working directory.")
76
+ }),
77
+ execute: async ({ pattern, path }) => {
78
+ try {
79
+ const searchDir = path ? _chunkQZ5GS6HWcjs.expandPath.call(void 0, path, cwd) : cwd;
80
+ const { files, truncated } = await glob(pattern, searchDir);
81
+ if (files.length === 0) {
82
+ return "No files found";
83
+ }
84
+ const header = truncated ? `Found ${files.length}+ files (results truncated)` : `Found ${files.length} files`;
85
+ return `${header}
86
+ ${files.join("\n")}`;
87
+ } catch (error) {
88
+ const message = error instanceof Error ? error.message : String(error);
89
+ return `Error [glob]: Failed to search for files: ${message}`;
90
+ }
91
+ }
92
+ });
93
+ }
94
+ var glob2 = createGlob();
95
+
96
+
97
+
98
+
99
+ exports.createGlob = createGlob; exports.glob = glob2;
@@ -0,0 +1,47 @@
1
+ import {
2
+ addLineNumbers,
3
+ readFileInRange
4
+ } from "./chunk-6PQLFDGT.js";
5
+ import {
6
+ expandPath
7
+ } from "./chunk-I3ONDY7P.js";
8
+
9
+ // src/read/index.ts
10
+ import { tool } from "ai";
11
+ import { z } from "zod";
12
+ function createRead(config = {}) {
13
+ const cwd = config.cwd ?? process.cwd();
14
+ const defaultMaxLines = config.maxLines ?? 2e3;
15
+ return tool({
16
+ description: 'Read a file from the local filesystem and return its contents with line numbers. Supports absolute paths, relative paths (resolved against the working directory), and tilde (~) home directory expansion. Returns numbered lines in "lineNumber\\tcontent" format. Use offset and limit to read specific ranges of large files.',
17
+ inputSchema: z.object({
18
+ file_path: z.string().describe("The path to the file to read (absolute, relative, or ~/...)"),
19
+ offset: z.number().optional().describe("0-indexed line number to start reading from (default: 0)"),
20
+ limit: z.number().optional().describe("Maximum number of lines to return (default: 2000)")
21
+ }),
22
+ execute: async ({ file_path, offset, limit }) => {
23
+ try {
24
+ const absolutePath = expandPath(file_path, cwd);
25
+ const result = await readFileInRange(
26
+ absolutePath,
27
+ offset ?? 0,
28
+ limit ?? defaultMaxLines
29
+ );
30
+ const numbered = addLineNumbers({
31
+ content: result.content,
32
+ startLine: (offset ?? 0) + 1
33
+ });
34
+ return numbered;
35
+ } catch (error) {
36
+ const msg = error instanceof Error ? error.message : String(error);
37
+ return `Error [read]: ${msg}`;
38
+ }
39
+ }
40
+ });
41
+ }
42
+ var read = createRead();
43
+
44
+ export {
45
+ createRead,
46
+ read
47
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkFW3UJ622cjs = require('../chunk-FW3UJ622.cjs');
5
+
6
+
7
+
8
+ exports.contextCompaction = _chunkFW3UJ622cjs.contextCompaction; exports.createContextCompaction = _chunkFW3UJ622cjs.createContextCompaction;
@@ -0,0 +1,77 @@
1
+ import * as ai from 'ai';
2
+ import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
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,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,8 @@
1
+ import {
2
+ contextCompaction,
3
+ createContextCompaction
4
+ } from "../chunk-K77GC2QI.js";
5
+ export {
6
+ contextCompaction,
7
+ createContextCompaction
8
+ };
@@ -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,9 @@
1
+ import {
2
+ createDiff,
3
+ diff
4
+ } from "../chunk-CGTPF6IS.js";
5
+ import "../chunk-I3ONDY7P.js";
6
+ export {
7
+ createDiff,
8
+ diff
9
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkMXFW3XY6cjs = require('../chunk-MXFW3XY6.cjs');
5
+ require('../chunk-5NW4OGRI.cjs');
6
+ require('../chunk-QZ5GS6HW.cjs');
7
+
8
+
9
+
10
+ exports.createEdit = _chunkMXFW3XY6cjs.createEdit; exports.edit = _chunkMXFW3XY6cjs.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;
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;
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;
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;
51
+ }, string>;
52
+
53
+ export { type EditConfig, createEdit, edit };
@@ -0,0 +1,10 @@
1
+ import {
2
+ createEdit,
3
+ edit
4
+ } from "../chunk-S6QEY7UY.js";
5
+ import "../chunk-G3ITTPGX.js";
6
+ import "../chunk-I3ONDY7P.js";
7
+ export {
8
+ createEdit,
9
+ edit
10
+ };
@@ -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 };