agentool 1.0.0 → 1.1.1

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 (156) hide show
  1. package/README.md +132 -21
  2. package/dist/ask-user/index.cjs +5 -2
  3. package/dist/ask-user/index.d.cts +10 -1
  4. package/dist/ask-user/index.d.ts +10 -1
  5. package/dist/ask-user/index.js +5 -2
  6. package/dist/bash/index.cjs +5 -2
  7. package/dist/bash/index.d.cts +14 -1
  8. package/dist/bash/index.d.ts +14 -1
  9. package/dist/bash/index.js +5 -2
  10. package/dist/chunk-2JBLVFB7.cjs +74 -0
  11. package/dist/{chunk-K77GC2QI.js → chunk-2JF3ZF2J.js} +32 -2
  12. package/dist/{chunk-XKG2A3EW.js → chunk-2WSZCOJP.js} +54 -18
  13. package/dist/chunk-3FT4ZPB2.cjs +65 -0
  14. package/dist/{chunk-VLNDEVKS.js → chunk-3LGXZLBH.js} +46 -8
  15. package/dist/{chunk-G3ITTPGX.js → chunk-4MXDQEPA.js} +12 -1
  16. package/dist/{chunk-CGTPF6IS.js → chunk-4UUSERSH.js} +31 -7
  17. package/dist/{chunk-I6KFFQPV.cjs → chunk-5T3SQYI4.cjs} +34 -4
  18. package/dist/chunk-6ULQG2W2.cjs +99 -0
  19. package/dist/chunk-ABXTBB2N.cjs +67 -0
  20. package/dist/{chunk-CAEVLIQB.cjs → chunk-BIAODQ2P.cjs} +17 -1
  21. package/dist/chunk-CJA76MKM.js +59 -0
  22. package/dist/chunk-CM3VRCNX.cjs +59 -0
  23. package/dist/{chunk-SUSAPI5W.cjs → chunk-CXBWF5ON.cjs} +51 -4
  24. package/dist/{chunk-U2YMJM25.cjs → chunk-G6ZVJA4V.cjs} +31 -8
  25. package/dist/chunk-GPHCXS2S.js +99 -0
  26. package/dist/chunk-HG5T47NA.cjs +77 -0
  27. package/dist/chunk-HO4NIRU5.js +65 -0
  28. package/dist/{chunk-HZAQRHBT.js → chunk-IBC4QCGR.js} +27 -2
  29. package/dist/chunk-JYTOARJV.cjs +69 -0
  30. package/dist/chunk-KONXT2SF.cjs +8 -0
  31. package/dist/chunk-KUFZFNPT.cjs +61 -0
  32. package/dist/chunk-L7R4UZSK.js +61 -0
  33. package/dist/{chunk-FV2R5FFQ.cjs → chunk-LNAR3NJQ.cjs} +47 -9
  34. package/dist/chunk-M74OQYNK.js +69 -0
  35. package/dist/{chunk-IMZQ7ELK.cjs → chunk-NQIV6LBH.cjs} +51 -14
  36. package/dist/chunk-NTGDU5X3.js +67 -0
  37. package/dist/{chunk-ONBH74ZV.cjs → chunk-OYLTQJXT.cjs} +32 -8
  38. package/dist/{chunk-6PQLFDGT.js → chunk-PWBVB6MN.js} +17 -1
  39. package/dist/{chunk-QEJV2KZ4.cjs → chunk-RIGL3JTS.cjs} +55 -19
  40. package/dist/chunk-SFDZRLSX.cjs +91 -0
  41. package/dist/chunk-T6STO7PS.cjs +126 -0
  42. package/dist/{chunk-LPV5CN2K.js → chunk-TI4ZZ3IJ.js} +32 -2
  43. package/dist/chunk-TM5L4HA5.js +126 -0
  44. package/dist/{chunk-4YI2H55A.js → chunk-TXZ3BMMR.js} +49 -2
  45. package/dist/chunk-UCA6LURO.js +74 -0
  46. package/dist/{chunk-EA3YV7ZG.js → chunk-VE4U27HI.js} +35 -15
  47. package/dist/chunk-VHLY7LQE.js +53 -0
  48. package/dist/{chunk-FW3UJ622.cjs → chunk-VPRUYL4T.cjs} +34 -4
  49. package/dist/{chunk-3VO6NETR.cjs → chunk-VPV6WG5V.cjs} +41 -21
  50. package/dist/chunk-VQSWMGG7.cjs +53 -0
  51. package/dist/{chunk-Y7KOKDFP.js → chunk-VZRXTFS4.js} +29 -6
  52. package/dist/chunk-WCR62UZ3.js +67 -0
  53. package/dist/chunk-X6ZY2KFU.js +8 -0
  54. package/dist/chunk-XGDE7S2D.cjs +67 -0
  55. package/dist/chunk-XPTW45XY.js +77 -0
  56. package/dist/{chunk-YPPPGGLA.cjs → chunk-YCWJVQYO.cjs} +28 -3
  57. package/dist/chunk-YGXLT6SS.js +91 -0
  58. package/dist/{chunk-5NW4OGRI.cjs → chunk-YTPZHJDC.cjs} +12 -1
  59. package/dist/{chunk-6MDPYALY.js → chunk-ZHVRP3EH.js} +49 -12
  60. package/dist/context-compaction/index.cjs +5 -2
  61. package/dist/context-compaction/index.d.cts +11 -1
  62. package/dist/context-compaction/index.d.ts +11 -1
  63. package/dist/context-compaction/index.js +5 -2
  64. package/dist/diff/index.cjs +6 -2
  65. package/dist/diff/index.d.cts +12 -2
  66. package/dist/diff/index.d.ts +12 -2
  67. package/dist/diff/index.js +7 -3
  68. package/dist/edit/index.cjs +7 -3
  69. package/dist/edit/index.d.cts +15 -5
  70. package/dist/edit/index.d.ts +15 -5
  71. package/dist/edit/index.js +8 -4
  72. package/dist/glob/index.cjs +5 -2
  73. package/dist/glob/index.d.cts +13 -3
  74. package/dist/glob/index.d.ts +13 -3
  75. package/dist/glob/index.js +5 -2
  76. package/dist/grep/index.cjs +6 -2
  77. package/dist/grep/index.d.cts +13 -3
  78. package/dist/grep/index.d.ts +13 -3
  79. package/dist/grep/index.js +6 -2
  80. package/dist/http-request/index.cjs +5 -2
  81. package/dist/http-request/index.d.cts +11 -1
  82. package/dist/http-request/index.d.ts +11 -1
  83. package/dist/http-request/index.js +5 -2
  84. package/dist/index.cjs +93 -19
  85. package/dist/index.d.cts +21 -16
  86. package/dist/index.d.ts +21 -16
  87. package/dist/index.js +113 -39
  88. package/dist/lsp/index.cjs +6 -2
  89. package/dist/lsp/index.d.cts +16 -10
  90. package/dist/lsp/index.d.ts +16 -10
  91. package/dist/lsp/index.js +6 -2
  92. package/dist/memory/index.cjs +6 -2
  93. package/dist/memory/index.d.cts +10 -1
  94. package/dist/memory/index.d.ts +10 -1
  95. package/dist/memory/index.js +6 -2
  96. package/dist/multi-edit/index.cjs +7 -4
  97. package/dist/multi-edit/index.d.cts +12 -2
  98. package/dist/multi-edit/index.d.ts +12 -2
  99. package/dist/multi-edit/index.js +7 -4
  100. package/dist/read/index.cjs +6 -3
  101. package/dist/read/index.d.cts +11 -1
  102. package/dist/read/index.d.ts +11 -1
  103. package/dist/read/index.js +6 -3
  104. package/dist/sleep/index.cjs +5 -2
  105. package/dist/sleep/index.d.cts +11 -1
  106. package/dist/sleep/index.d.ts +11 -1
  107. package/dist/sleep/index.js +5 -2
  108. package/dist/task-create/index.cjs +13 -0
  109. package/dist/task-create/index.d.cts +28 -0
  110. package/dist/task-create/index.d.ts +28 -0
  111. package/dist/task-create/index.js +13 -0
  112. package/dist/task-get/index.cjs +13 -0
  113. package/dist/task-get/index.d.cts +24 -0
  114. package/dist/task-get/index.d.ts +24 -0
  115. package/dist/task-get/index.js +13 -0
  116. package/dist/task-list/index.cjs +13 -0
  117. package/dist/task-list/index.d.cts +20 -0
  118. package/dist/task-list/index.d.ts +20 -0
  119. package/dist/task-list/index.js +13 -0
  120. package/dist/task-update/index.cjs +13 -0
  121. package/dist/task-update/index.d.cts +40 -0
  122. package/dist/task-update/index.d.ts +40 -0
  123. package/dist/task-update/index.js +13 -0
  124. package/dist/tool-search/index.cjs +11 -0
  125. package/dist/tool-search/index.d.cts +27 -0
  126. package/dist/tool-search/index.d.ts +27 -0
  127. package/dist/tool-search/index.js +11 -0
  128. package/dist/web-fetch/index.cjs +5 -2
  129. package/dist/web-fetch/index.d.cts +11 -3
  130. package/dist/web-fetch/index.d.ts +11 -3
  131. package/dist/web-fetch/index.js +5 -2
  132. package/dist/web-search/index.cjs +11 -0
  133. package/dist/web-search/index.d.cts +30 -0
  134. package/dist/web-search/index.d.ts +30 -0
  135. package/dist/web-search/index.js +11 -0
  136. package/dist/write/index.cjs +6 -3
  137. package/dist/write/index.d.cts +13 -3
  138. package/dist/write/index.d.ts +13 -3
  139. package/dist/write/index.js +6 -3
  140. package/package.json +31 -6
  141. package/dist/chunk-3EPGFWZV.cjs +0 -30
  142. package/dist/chunk-7QL4BQCH.js +0 -40
  143. package/dist/chunk-FAEGCFTO.js +0 -136
  144. package/dist/chunk-HDKXSKMO.js +0 -30
  145. package/dist/chunk-JCTBB7H2.cjs +0 -40
  146. package/dist/chunk-MF7CJVIZ.js +0 -40
  147. package/dist/chunk-MXFW3XY6.cjs +0 -73
  148. package/dist/chunk-OXLQ7QVL.cjs +0 -40
  149. package/dist/chunk-S6QEY7UY.js +0 -73
  150. package/dist/chunk-TBVHHF3H.cjs +0 -47
  151. package/dist/chunk-XLD2Y3SS.cjs +0 -136
  152. package/dist/chunk-ZHCMEQJJ.js +0 -47
  153. package/dist/task/index.cjs +0 -8
  154. package/dist/task/index.d.cts +0 -67
  155. package/dist/task/index.d.ts +0 -67
  156. package/dist/task/index.js +0 -8
@@ -0,0 +1,91 @@
1
+ import {
2
+ formatTask,
3
+ generateId,
4
+ loadTasks,
5
+ saveTasks
6
+ } from "./chunk-VHLY7LQE.js";
7
+ import {
8
+ extractErrorMessage
9
+ } from "./chunk-X6ZY2KFU.js";
10
+
11
+ // src/task-create/index.ts
12
+ import { tool } from "ai";
13
+ import { z } from "zod";
14
+ import { join } from "path";
15
+
16
+ // src/task-create/prompt.ts
17
+ function getPrompt() {
18
+ return `Create a new task to track work. Tasks are stored as JSON and support status tracking, dependencies, and metadata.
19
+
20
+ ## When to Use
21
+ - Complex multi-step tasks requiring 3 or more distinct steps
22
+ - Non-trivial work that benefits from progress tracking
23
+ - When the user provides a list of things to be done
24
+ - After receiving new instructions \u2014 capture requirements as tasks immediately
25
+ - When planning mode is active \u2014 create a task list to track the plan
26
+
27
+ ## When NOT to Use
28
+ - Single, straightforward tasks that need no tracking
29
+ - Trivial work completable in fewer than 3 simple steps
30
+ - Purely conversational or informational requests
31
+ If there is only one simple task, just do it directly instead of creating a task for it.
32
+
33
+ ## Task Fields
34
+ - **subject**: A brief, actionable title in imperative form (e.g., "Fix authentication bug in login flow")
35
+ - **description**: Detailed explanation of what needs to be done
36
+ - **metadata** (optional): Arbitrary key-value pairs to attach to the task
37
+
38
+ All tasks are created with status \`pending\`, empty \`blocks\` and \`blockedBy\` arrays.
39
+
40
+ ## Tips
41
+ - Create tasks with clear, specific subjects that describe the desired outcome
42
+ - After creating tasks, set up dependencies (blocks/blockedBy) if tasks must run in order
43
+ - Check the task list first to avoid creating duplicate tasks
44
+ - When starting work on a task, update its status to \`in_progress\` before beginning
45
+ - After completing a task, mark it \`completed\` and check for newly unblocked tasks`;
46
+ }
47
+
48
+ // src/task-create/index.ts
49
+ function createTaskCreate(config = {}) {
50
+ const cwd = config.cwd ?? process.cwd();
51
+ const tasksFile = config.tasksFile ?? join(cwd, ".agentool", "tasks.json");
52
+ return tool({
53
+ description: config.description ?? getPrompt(),
54
+ inputSchema: z.object({
55
+ subject: z.string().describe("A brief title for the task"),
56
+ description: z.string().describe("What needs to be done"),
57
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata to attach to the task")
58
+ }),
59
+ execute: async ({ subject, description, metadata }) => {
60
+ try {
61
+ const tasks = await loadTasks(tasksFile);
62
+ const now = (/* @__PURE__ */ new Date()).toISOString();
63
+ const entry = {
64
+ id: generateId(),
65
+ subject,
66
+ description,
67
+ status: "pending",
68
+ blocks: [],
69
+ blockedBy: [],
70
+ metadata,
71
+ createdAt: now,
72
+ updatedAt: now
73
+ };
74
+ tasks.push(entry);
75
+ await saveTasks(tasksFile, tasks);
76
+ return `Created task ${entry.id}.
77
+ ${formatTask(entry)}`;
78
+ } catch (error) {
79
+ const msg = extractErrorMessage(error);
80
+ return `Error [task-create]: ${msg}`;
81
+ }
82
+ }
83
+ });
84
+ }
85
+ var taskCreate = createTaskCreate();
86
+
87
+ export {
88
+ getPrompt,
89
+ createTaskCreate,
90
+ taskCreate
91
+ };
@@ -47,6 +47,16 @@ function applyEditToFile(originalContent, oldString, newString, replaceAll = fal
47
47
  const stripTrailingNewline = !oldString.endsWith("\n") && originalContent.includes(oldString + "\n");
48
48
  return stripTrailingNewline ? f(originalContent, oldString + "\n", newString) : f(originalContent, oldString, newString);
49
49
  }
50
+ function countOccurrences(text, search) {
51
+ if (search.length === 0) return 0;
52
+ let count = 0;
53
+ let pos = 0;
54
+ while ((pos = text.indexOf(search, pos)) !== -1) {
55
+ count++;
56
+ pos += search.length;
57
+ }
58
+ return count;
59
+ }
50
60
  function isOpeningContext(chars, index) {
51
61
  if (index === 0) {
52
62
  return true;
@@ -96,4 +106,5 @@ function applyCurlySingleQuotes(str) {
96
106
 
97
107
 
98
108
 
99
- exports.findActualString = findActualString; exports.preserveQuoteStyle = preserveQuoteStyle; exports.applyEditToFile = applyEditToFile;
109
+
110
+ exports.findActualString = findActualString; exports.preserveQuoteStyle = preserveQuoteStyle; exports.applyEditToFile = applyEditToFile; exports.countOccurrences = countOccurrences;
@@ -1,10 +1,45 @@
1
+ import {
2
+ readTextContent
3
+ } from "./chunk-PWBVB6MN.js";
4
+ import {
5
+ extractErrorMessage
6
+ } from "./chunk-X6ZY2KFU.js";
7
+
1
8
  // src/lsp/index.ts
2
9
  import { tool } from "ai";
3
10
  import { z } from "zod";
4
11
  import { spawn } from "child_process";
5
- import { readFile } from "fs/promises";
6
12
  import { pathToFileURL } from "url";
7
13
  import { resolve, extname } from "path";
14
+
15
+ // src/lsp/prompt.ts
16
+ function getPrompt() {
17
+ return `Interact with Language Server Protocol (LSP) servers to get code intelligence features.
18
+
19
+ ## Supported Operations
20
+ - **goToDefinition**: Find where a symbol is defined
21
+ - **findReferences**: Find all references to a symbol
22
+ - **hover**: Get hover information (documentation, type info) for a symbol
23
+ - **documentSymbol**: Get all symbols (functions, classes, variables) in a document
24
+ - **workspaceSymbol**: Search for symbols across the entire workspace
25
+ - **goToImplementation**: Find implementations of an interface or abstract method
26
+ - **prepareCallHierarchy**: Get call hierarchy item at a position
27
+ - **incomingCalls**: Find all functions/methods that call the function at a position
28
+ - **outgoingCalls**: Find all functions/methods called by the function at a position
29
+
30
+ ## When to Use
31
+ - To navigate code: find definitions, references, implementations
32
+ - To understand code structure: list symbols in a file or workspace
33
+ - To analyze call graphs: trace incoming/outgoing calls
34
+
35
+ ## Usage Guidelines
36
+ - All operations require \`filePath\`, \`line\`, and \`character\` parameters
37
+ - Line and character are **1-based** (as shown in editors), not 0-based
38
+ - An LSP server must be configured for the file's language via \`servers\` config
39
+ - Operations that don't need a position (documentSymbol, workspaceSymbol) still require filePath`;
40
+ }
41
+
42
+ // src/lsp/index.ts
8
43
  var nextId = 1;
9
44
  function encodeJsonRpc(msg) {
10
45
  const body = JSON.stringify(msg);
@@ -39,13 +74,14 @@ function operationToMethod(operation) {
39
74
  documentSymbol: "textDocument/documentSymbol",
40
75
  workspaceSymbol: "workspace/symbol",
41
76
  goToImplementation: "textDocument/implementation",
77
+ prepareCallHierarchy: "textDocument/prepareCallHierarchy",
42
78
  incomingCalls: "textDocument/prepareCallHierarchy",
43
79
  outgoingCalls: "textDocument/prepareCallHierarchy"
44
80
  };
45
81
  return map[operation] ?? operation;
46
82
  }
47
- function buildRequestParams(op, uri, line, char, query) {
48
- if (op === "workspaceSymbol") return { query: query ?? "" };
83
+ function buildRequestParams(op, uri, line, char) {
84
+ if (op === "workspaceSymbol") return { query: "" };
49
85
  const td = { uri };
50
86
  if (op === "documentSymbol") return { textDocument: td };
51
87
  const pos = { line, character: char };
@@ -122,13 +158,13 @@ async function executeLspOperation(serverConfig, params, timeoutMs) {
122
158
  const rpc = (id) => Promise.race([waitForResponse(proc, id, timeoutMs), spawnError]);
123
159
  await rpc(initId);
124
160
  sendNotification(proc, "initialized", {});
125
- const content = await readFile(absolutePath, "utf-8");
161
+ const content = await readTextContent(absolutePath);
126
162
  const langId = extname(absolutePath).replace(".", "") || "plaintext";
127
163
  sendNotification(proc, "textDocument/didOpen", {
128
164
  textDocument: { uri, languageId: langId, version: 1, text: content }
129
165
  });
130
166
  const method = operationToMethod(params.operation);
131
- const reqParams = buildRequestParams(params.operation, uri, params.line ?? 0, params.character ?? 0, params.query);
167
+ const reqParams = buildRequestParams(params.operation, uri, params.line ?? 0, params.character ?? 0);
132
168
  let response = await rpc(sendRequest(proc, method, reqParams));
133
169
  if (response.error) return `Error [lsp]: Server error: ${response.error.message} (code ${response.error.code})`;
134
170
  if ((params.operation === "incomingCalls" || params.operation === "outgoingCalls") && Array.isArray(response.result) && response.result.length > 0) {
@@ -150,21 +186,21 @@ var LSP_OPERATIONS = [
150
186
  "documentSymbol",
151
187
  "workspaceSymbol",
152
188
  "goToImplementation",
189
+ "prepareCallHierarchy",
153
190
  "incomingCalls",
154
191
  "outgoingCalls"
155
192
  ];
156
193
  function createLsp(config = {}) {
157
194
  const timeoutMs = config.timeout ?? 3e4;
158
195
  return tool({
159
- description: "Perform language server operations like go-to-definition, find-references, and hover. Requires LSP server configuration. Supports 8 operations: goToDefinition, findReferences, hover, documentSymbol, workspaceSymbol, goToImplementation, incomingCalls, outgoingCalls.",
196
+ description: config.description ?? getPrompt(),
160
197
  inputSchema: z.object({
161
198
  operation: z.enum(LSP_OPERATIONS).describe("The LSP operation to perform"),
162
199
  filePath: z.string().describe("Path to the file"),
163
- line: z.number().optional().describe("Line number (0-indexed)"),
164
- character: z.number().optional().describe("Character offset (0-indexed)"),
165
- query: z.string().optional().describe("Search query for workspaceSymbol")
200
+ line: z.number().int().positive().describe("The line number (1-based, as shown in editors)"),
201
+ character: z.number().int().positive().describe("The character offset (1-based, as shown in editors)")
166
202
  }),
167
- execute: async ({ operation, filePath, line, character, query }) => {
203
+ execute: async ({ operation, filePath, line, character }) => {
168
204
  if (!config.servers || Object.keys(config.servers).length === 0) {
169
205
  return 'Error [lsp]: No LSP servers configured. Provide server configuration via createLsp({ servers: { ".ts": { command: "typescript-language-server", args: ["--stdio"] } } })';
170
206
  }
@@ -177,11 +213,11 @@ function createLsp(config = {}) {
177
213
  try {
178
214
  return await executeLspOperation(
179
215
  serverConfig,
180
- { operation, filePath, line, character, query, cwd: config.cwd ?? process.cwd() },
216
+ { operation, filePath, line: line - 1, character: character - 1, cwd: config.cwd ?? process.cwd() },
181
217
  timeoutMs
182
218
  );
183
219
  } catch (error) {
184
- const msg = error instanceof Error ? error.message : String(error);
220
+ const msg = extractErrorMessage(error);
185
221
  return `Error [lsp]: ${operation} failed for ${filePath}: ${msg}`;
186
222
  }
187
223
  }
@@ -190,6 +226,7 @@ function createLsp(config = {}) {
190
226
  var lsp = createLsp();
191
227
 
192
228
  export {
229
+ getPrompt,
193
230
  executeLspOperation,
194
231
  createLsp,
195
232
  lsp
@@ -1,8 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkFW3UJ622cjs = require('../chunk-FW3UJ622.cjs');
5
4
 
5
+ var _chunkVPRUYL4Tcjs = require('../chunk-VPRUYL4T.cjs');
6
+ require('../chunk-KONXT2SF.cjs');
6
7
 
7
8
 
8
- exports.contextCompaction = _chunkFW3UJ622cjs.contextCompaction; exports.createContextCompaction = _chunkFW3UJ622cjs.createContextCompaction;
9
+
10
+
11
+ exports.contextCompaction = _chunkVPRUYL4Tcjs.contextCompaction; exports.contextCompactionPrompt = _chunkVPRUYL4Tcjs.getPrompt; exports.createContextCompaction = _chunkVPRUYL4Tcjs.createContextCompaction;
@@ -1,6 +1,14 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
3
3
 
4
+ /**
5
+ * Generate the description prompt for the context-compaction tool.
6
+ *
7
+ * @param config - The same config passed to {@link createContextCompaction}.
8
+ * @returns The full description string for the context-compaction tool.
9
+ */
10
+ declare function getPrompt(config?: Pick<ContextCompactionConfig, 'maxTokens'>): string;
11
+
4
12
  /**
5
13
  * Configuration for the context compaction tool.
6
14
  * Extends {@link BaseToolConfig} with summarization options.
@@ -26,6 +34,8 @@ interface ContextCompactionConfig extends BaseToolConfig {
26
34
  }>) => Promise<string>;
27
35
  /** Maximum tokens target. Defaults to 4096. */
28
36
  maxTokens?: number;
37
+ /** Override the default tool description. */
38
+ description?: string;
29
39
  }
30
40
  /**
31
41
  * Create a context compaction tool with the given configuration.
@@ -74,4 +84,4 @@ declare const contextCompaction: ai.Tool<{
74
84
  maxTokens?: number | undefined;
75
85
  }, string>;
76
86
 
77
- export { type ContextCompactionConfig, contextCompaction, createContextCompaction };
87
+ export { type ContextCompactionConfig, contextCompaction, getPrompt as contextCompactionPrompt, createContextCompaction };
@@ -1,6 +1,14 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
3
3
 
4
+ /**
5
+ * Generate the description prompt for the context-compaction tool.
6
+ *
7
+ * @param config - The same config passed to {@link createContextCompaction}.
8
+ * @returns The full description string for the context-compaction tool.
9
+ */
10
+ declare function getPrompt(config?: Pick<ContextCompactionConfig, 'maxTokens'>): string;
11
+
4
12
  /**
5
13
  * Configuration for the context compaction tool.
6
14
  * Extends {@link BaseToolConfig} with summarization options.
@@ -26,6 +34,8 @@ interface ContextCompactionConfig extends BaseToolConfig {
26
34
  }>) => Promise<string>;
27
35
  /** Maximum tokens target. Defaults to 4096. */
28
36
  maxTokens?: number;
37
+ /** Override the default tool description. */
38
+ description?: string;
29
39
  }
30
40
  /**
31
41
  * Create a context compaction tool with the given configuration.
@@ -74,4 +84,4 @@ declare const contextCompaction: ai.Tool<{
74
84
  maxTokens?: number | undefined;
75
85
  }, string>;
76
86
 
77
- export { type ContextCompactionConfig, contextCompaction, createContextCompaction };
87
+ export { type ContextCompactionConfig, contextCompaction, getPrompt as contextCompactionPrompt, createContextCompaction };
@@ -1,8 +1,11 @@
1
1
  import {
2
2
  contextCompaction,
3
- createContextCompaction
4
- } from "../chunk-K77GC2QI.js";
3
+ createContextCompaction,
4
+ getPrompt
5
+ } from "../chunk-2JF3ZF2J.js";
6
+ import "../chunk-X6ZY2KFU.js";
5
7
  export {
6
8
  contextCompaction,
9
+ getPrompt as contextCompactionPrompt,
7
10
  createContextCompaction
8
11
  };
@@ -1,9 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkONBH74ZVcjs = require('../chunk-ONBH74ZV.cjs');
4
+
5
+ var _chunkOYLTQJXTcjs = require('../chunk-OYLTQJXT.cjs');
6
+ require('../chunk-BIAODQ2P.cjs');
5
7
  require('../chunk-QZ5GS6HW.cjs');
8
+ require('../chunk-KONXT2SF.cjs');
9
+
6
10
 
7
11
 
8
12
 
9
- exports.createDiff = _chunkONBH74ZVcjs.createDiff; exports.diff = _chunkONBH74ZVcjs.diff;
13
+ exports.createDiff = _chunkOYLTQJXTcjs.createDiff; exports.diff = _chunkOYLTQJXTcjs.diff; exports.diffPrompt = _chunkOYLTQJXTcjs.getPrompt;
@@ -1,6 +1,13 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
3
3
 
4
+ /**
5
+ * Generate the description prompt for the diff tool.
6
+ *
7
+ * @returns The full description string for the diff tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
4
11
  /**
5
12
  * Configuration for the diff tool.
6
13
  *
@@ -10,7 +17,10 @@ import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
10
17
  * const config: DiffConfig = { cwd: '/my/project' };
11
18
  * ```
12
19
  */
13
- type DiffConfig = BaseToolConfig;
20
+ type DiffConfig = BaseToolConfig & {
21
+ /** Override the default tool description. */
22
+ description?: string;
23
+ };
14
24
  /**
15
25
  * Creates a diff tool that generates unified diffs between files or strings.
16
26
  *
@@ -69,4 +79,4 @@ declare const diff: ai.Tool<{
69
79
  new_content?: string | undefined;
70
80
  }, string>;
71
81
 
72
- export { type DiffConfig, createDiff, diff };
82
+ export { type DiffConfig, createDiff, diff, getPrompt as diffPrompt };
@@ -1,6 +1,13 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
3
3
 
4
+ /**
5
+ * Generate the description prompt for the diff tool.
6
+ *
7
+ * @returns The full description string for the diff tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
4
11
  /**
5
12
  * Configuration for the diff tool.
6
13
  *
@@ -10,7 +17,10 @@ import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
10
17
  * const config: DiffConfig = { cwd: '/my/project' };
11
18
  * ```
12
19
  */
13
- type DiffConfig = BaseToolConfig;
20
+ type DiffConfig = BaseToolConfig & {
21
+ /** Override the default tool description. */
22
+ description?: string;
23
+ };
14
24
  /**
15
25
  * Creates a diff tool that generates unified diffs between files or strings.
16
26
  *
@@ -69,4 +79,4 @@ declare const diff: ai.Tool<{
69
79
  new_content?: string | undefined;
70
80
  }, string>;
71
81
 
72
- export { type DiffConfig, createDiff, diff };
82
+ export { type DiffConfig, createDiff, diff, getPrompt as diffPrompt };
@@ -1,9 +1,13 @@
1
1
  import {
2
2
  createDiff,
3
- diff
4
- } from "../chunk-CGTPF6IS.js";
3
+ diff,
4
+ getPrompt
5
+ } from "../chunk-4UUSERSH.js";
6
+ import "../chunk-PWBVB6MN.js";
5
7
  import "../chunk-I3ONDY7P.js";
8
+ import "../chunk-X6ZY2KFU.js";
6
9
  export {
7
10
  createDiff,
8
- diff
11
+ diff,
12
+ getPrompt as diffPrompt
9
13
  };
@@ -1,10 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkMXFW3XY6cjs = require('../chunk-MXFW3XY6.cjs');
5
- require('../chunk-5NW4OGRI.cjs');
4
+
5
+ var _chunk6ULQG2W2cjs = require('../chunk-6ULQG2W2.cjs');
6
+ require('../chunk-YTPZHJDC.cjs');
7
+ require('../chunk-BIAODQ2P.cjs');
6
8
  require('../chunk-QZ5GS6HW.cjs');
9
+ require('../chunk-KONXT2SF.cjs');
10
+
7
11
 
8
12
 
9
13
 
10
- exports.createEdit = _chunkMXFW3XY6cjs.createEdit; exports.edit = _chunkMXFW3XY6cjs.edit;
14
+ exports.createEdit = _chunk6ULQG2W2cjs.createEdit; exports.edit = _chunk6ULQG2W2cjs.edit; exports.editPrompt = _chunk6ULQG2W2cjs.getPrompt;
@@ -1,7 +1,17 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
3
3
 
4
- type EditConfig = BaseToolConfig;
4
+ /**
5
+ * Generate the description prompt for the edit tool.
6
+ *
7
+ * @returns The full description string for the edit tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
11
+ type EditConfig = BaseToolConfig & {
12
+ /** Override the default tool description. */
13
+ description?: string;
14
+ };
5
15
  /**
6
16
  * Creates an edit tool that performs string replacements in files.
7
17
  *
@@ -25,11 +35,11 @@ type EditConfig = BaseToolConfig;
25
35
  * );
26
36
  * ```
27
37
  */
28
- declare function createEdit(config?: BaseToolConfig): ai.Tool<{
38
+ declare function createEdit(config?: EditConfig): ai.Tool<{
29
39
  file_path: string;
30
40
  old_string: string;
31
41
  new_string: string;
32
- replace_all: boolean;
42
+ replace_all?: boolean | undefined;
33
43
  }, string>;
34
44
  /**
35
45
  * Default edit tool instance using the current working directory.
@@ -47,7 +57,7 @@ declare const edit: ai.Tool<{
47
57
  file_path: string;
48
58
  old_string: string;
49
59
  new_string: string;
50
- replace_all: boolean;
60
+ replace_all?: boolean | undefined;
51
61
  }, string>;
52
62
 
53
- export { type EditConfig, createEdit, edit };
63
+ export { type EditConfig, createEdit, edit, getPrompt as editPrompt };
@@ -1,7 +1,17 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
3
3
 
4
- type EditConfig = BaseToolConfig;
4
+ /**
5
+ * Generate the description prompt for the edit tool.
6
+ *
7
+ * @returns The full description string for the edit tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
11
+ type EditConfig = BaseToolConfig & {
12
+ /** Override the default tool description. */
13
+ description?: string;
14
+ };
5
15
  /**
6
16
  * Creates an edit tool that performs string replacements in files.
7
17
  *
@@ -25,11 +35,11 @@ type EditConfig = BaseToolConfig;
25
35
  * );
26
36
  * ```
27
37
  */
28
- declare function createEdit(config?: BaseToolConfig): ai.Tool<{
38
+ declare function createEdit(config?: EditConfig): ai.Tool<{
29
39
  file_path: string;
30
40
  old_string: string;
31
41
  new_string: string;
32
- replace_all: boolean;
42
+ replace_all?: boolean | undefined;
33
43
  }, string>;
34
44
  /**
35
45
  * Default edit tool instance using the current working directory.
@@ -47,7 +57,7 @@ declare const edit: ai.Tool<{
47
57
  file_path: string;
48
58
  old_string: string;
49
59
  new_string: string;
50
- replace_all: boolean;
60
+ replace_all?: boolean | undefined;
51
61
  }, string>;
52
62
 
53
- export { type EditConfig, createEdit, edit };
63
+ export { type EditConfig, createEdit, edit, getPrompt as editPrompt };
@@ -1,10 +1,14 @@
1
1
  import {
2
2
  createEdit,
3
- edit
4
- } from "../chunk-S6QEY7UY.js";
5
- import "../chunk-G3ITTPGX.js";
3
+ edit,
4
+ getPrompt
5
+ } from "../chunk-GPHCXS2S.js";
6
+ import "../chunk-4MXDQEPA.js";
7
+ import "../chunk-PWBVB6MN.js";
6
8
  import "../chunk-I3ONDY7P.js";
9
+ import "../chunk-X6ZY2KFU.js";
7
10
  export {
8
11
  createEdit,
9
- edit
12
+ edit,
13
+ getPrompt as editPrompt
10
14
  };
@@ -1,10 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkYPPPGGLAcjs = require('../chunk-YPPPGGLA.cjs');
4
+
5
+ var _chunkYCWJVQYOcjs = require('../chunk-YCWJVQYO.cjs');
5
6
  require('../chunk-MIYA7TNR.cjs');
6
7
  require('../chunk-QZ5GS6HW.cjs');
8
+ require('../chunk-KONXT2SF.cjs');
9
+
7
10
 
8
11
 
9
12
 
10
- exports.createGlob = _chunkYPPPGGLAcjs.createGlob; exports.glob = _chunkYPPPGGLAcjs.glob;
13
+ exports.createGlob = _chunkYCWJVQYOcjs.createGlob; exports.glob = _chunkYCWJVQYOcjs.glob; exports.globPrompt = _chunkYCWJVQYOcjs.getPrompt;
@@ -1,6 +1,13 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
3
3
 
4
+ /**
5
+ * Generate the description prompt for the glob tool.
6
+ *
7
+ * @returns The full description string for the glob tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
4
11
  /**
5
12
  * Creates a glob tool that finds files matching a pattern.
6
13
  *
@@ -22,7 +29,7 @@ import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
22
29
  * );
23
30
  * ```
24
31
  */
25
- declare function createGlob(config?: BaseToolConfig): ai.Tool<{
32
+ declare function createGlob(config?: GlobConfig): ai.Tool<{
26
33
  pattern: string;
27
34
  path?: string | undefined;
28
35
  }, string>;
@@ -38,10 +45,13 @@ declare function createGlob(config?: BaseToolConfig): ai.Tool<{
38
45
  * );
39
46
  * ```
40
47
  */
41
- type GlobConfig = BaseToolConfig;
48
+ type GlobConfig = BaseToolConfig & {
49
+ /** Override the default tool description. */
50
+ description?: string;
51
+ };
42
52
  declare const glob: ai.Tool<{
43
53
  pattern: string;
44
54
  path?: string | undefined;
45
55
  }, string>;
46
56
 
47
- export { type GlobConfig, createGlob, glob };
57
+ export { type GlobConfig, createGlob, glob, getPrompt as globPrompt };
@@ -1,6 +1,13 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
3
3
 
4
+ /**
5
+ * Generate the description prompt for the glob tool.
6
+ *
7
+ * @returns The full description string for the glob tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
4
11
  /**
5
12
  * Creates a glob tool that finds files matching a pattern.
6
13
  *
@@ -22,7 +29,7 @@ import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
22
29
  * );
23
30
  * ```
24
31
  */
25
- declare function createGlob(config?: BaseToolConfig): ai.Tool<{
32
+ declare function createGlob(config?: GlobConfig): ai.Tool<{
26
33
  pattern: string;
27
34
  path?: string | undefined;
28
35
  }, string>;
@@ -38,10 +45,13 @@ declare function createGlob(config?: BaseToolConfig): ai.Tool<{
38
45
  * );
39
46
  * ```
40
47
  */
41
- type GlobConfig = BaseToolConfig;
48
+ type GlobConfig = BaseToolConfig & {
49
+ /** Override the default tool description. */
50
+ description?: string;
51
+ };
42
52
  declare const glob: ai.Tool<{
43
53
  pattern: string;
44
54
  path?: string | undefined;
45
55
  }, string>;
46
56
 
47
- export { type GlobConfig, createGlob, glob };
57
+ export { type GlobConfig, createGlob, glob, getPrompt as globPrompt };
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  createGlob,
3
+ getPrompt,
3
4
  glob
4
- } from "../chunk-HZAQRHBT.js";
5
+ } from "../chunk-IBC4QCGR.js";
5
6
  import "../chunk-MJCAXASI.js";
6
7
  import "../chunk-I3ONDY7P.js";
8
+ import "../chunk-X6ZY2KFU.js";
7
9
  export {
8
10
  createGlob,
9
- glob
11
+ glob,
12
+ getPrompt as globPrompt
10
13
  };