agentool 1.1.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/dist/ask-user/index.cjs +5 -2
  2. package/dist/ask-user/index.d.cts +10 -1
  3. package/dist/ask-user/index.d.ts +10 -1
  4. package/dist/ask-user/index.js +5 -2
  5. package/dist/bash/index.cjs +5 -2
  6. package/dist/bash/index.d.cts +14 -1
  7. package/dist/bash/index.d.ts +14 -1
  8. package/dist/bash/index.js +5 -2
  9. package/dist/{chunk-IEX4NOVN.cjs → chunk-2JBLVFB7.cjs} +30 -4
  10. package/dist/{chunk-K77GC2QI.js → chunk-2JF3ZF2J.js} +32 -2
  11. package/dist/{chunk-UDIG7332.js → chunk-2WSZCOJP.js} +40 -4
  12. package/dist/chunk-3FT4ZPB2.cjs +65 -0
  13. package/dist/{chunk-VLNDEVKS.js → chunk-3LGXZLBH.js} +46 -8
  14. package/dist/{chunk-G3ITTPGX.js → chunk-4MXDQEPA.js} +12 -1
  15. package/dist/{chunk-CGTPF6IS.js → chunk-4UUSERSH.js} +31 -7
  16. package/dist/{chunk-I6KFFQPV.cjs → chunk-5T3SQYI4.cjs} +34 -4
  17. package/dist/chunk-6ULQG2W2.cjs +99 -0
  18. package/dist/chunk-ABXTBB2N.cjs +67 -0
  19. package/dist/{chunk-CAEVLIQB.cjs → chunk-BIAODQ2P.cjs} +17 -1
  20. package/dist/chunk-CJA76MKM.js +59 -0
  21. package/dist/chunk-CM3VRCNX.cjs +59 -0
  22. package/dist/{chunk-SUSAPI5W.cjs → chunk-CXBWF5ON.cjs} +51 -4
  23. package/dist/{chunk-5O55DKOB.cjs → chunk-G6ZVJA4V.cjs} +30 -4
  24. package/dist/{chunk-P6Z5XFDS.js → chunk-GPHCXS2S.js} +41 -15
  25. package/dist/chunk-HG5T47NA.cjs +77 -0
  26. package/dist/chunk-HO4NIRU5.js +65 -0
  27. package/dist/{chunk-HZAQRHBT.js → chunk-IBC4QCGR.js} +27 -2
  28. package/dist/chunk-JYTOARJV.cjs +69 -0
  29. package/dist/chunk-KONXT2SF.cjs +8 -0
  30. package/dist/chunk-KUFZFNPT.cjs +61 -0
  31. package/dist/chunk-L7R4UZSK.js +61 -0
  32. package/dist/{chunk-FV2R5FFQ.cjs → chunk-LNAR3NJQ.cjs} +47 -9
  33. package/dist/chunk-M74OQYNK.js +69 -0
  34. package/dist/{chunk-5TDZF4IM.cjs → chunk-NQIV6LBH.cjs} +42 -6
  35. package/dist/chunk-NTGDU5X3.js +67 -0
  36. package/dist/{chunk-ONBH74ZV.cjs → chunk-OYLTQJXT.cjs} +32 -8
  37. package/dist/{chunk-6PQLFDGT.js → chunk-PWBVB6MN.js} +17 -1
  38. package/dist/{chunk-HNP7JDQC.cjs → chunk-RIGL3JTS.cjs} +41 -5
  39. package/dist/chunk-SFDZRLSX.cjs +91 -0
  40. package/dist/{chunk-ZFQZWXOI.cjs → chunk-T6STO7PS.cjs} +58 -7
  41. package/dist/{chunk-LPV5CN2K.js → chunk-TI4ZZ3IJ.js} +32 -2
  42. package/dist/{chunk-S7IVHOA6.js → chunk-TM5L4HA5.js} +54 -3
  43. package/dist/{chunk-4YI2H55A.js → chunk-TXZ3BMMR.js} +49 -2
  44. package/dist/{chunk-IRRNYFI5.js → chunk-UCA6LURO.js} +28 -2
  45. package/dist/{chunk-EA3YV7ZG.js → chunk-VE4U27HI.js} +35 -15
  46. package/dist/{chunk-E6NBEYZD.js → chunk-VHLY7LQE.js} +7 -5
  47. package/dist/{chunk-FW3UJ622.cjs → chunk-VPRUYL4T.cjs} +34 -4
  48. package/dist/{chunk-3VO6NETR.cjs → chunk-VPV6WG5V.cjs} +41 -21
  49. package/dist/{chunk-L5JH4I77.cjs → chunk-VQSWMGG7.cjs} +8 -6
  50. package/dist/{chunk-4HIATLKI.js → chunk-VZRXTFS4.js} +28 -2
  51. package/dist/chunk-WCR62UZ3.js +67 -0
  52. package/dist/chunk-X6ZY2KFU.js +8 -0
  53. package/dist/chunk-XGDE7S2D.cjs +67 -0
  54. package/dist/chunk-XPTW45XY.js +77 -0
  55. package/dist/{chunk-YPPPGGLA.cjs → chunk-YCWJVQYO.cjs} +28 -3
  56. package/dist/chunk-YGXLT6SS.js +91 -0
  57. package/dist/{chunk-5NW4OGRI.cjs → chunk-YTPZHJDC.cjs} +12 -1
  58. package/dist/{chunk-XAQGZ374.js → chunk-ZHVRP3EH.js} +40 -4
  59. package/dist/context-compaction/index.cjs +5 -2
  60. package/dist/context-compaction/index.d.cts +11 -1
  61. package/dist/context-compaction/index.d.ts +11 -1
  62. package/dist/context-compaction/index.js +5 -2
  63. package/dist/diff/index.cjs +6 -2
  64. package/dist/diff/index.d.cts +12 -2
  65. package/dist/diff/index.d.ts +12 -2
  66. package/dist/diff/index.js +7 -3
  67. package/dist/edit/index.cjs +7 -3
  68. package/dist/edit/index.d.cts +13 -3
  69. package/dist/edit/index.d.ts +13 -3
  70. package/dist/edit/index.js +8 -4
  71. package/dist/glob/index.cjs +5 -2
  72. package/dist/glob/index.d.cts +13 -3
  73. package/dist/glob/index.d.ts +13 -3
  74. package/dist/glob/index.js +5 -2
  75. package/dist/grep/index.cjs +6 -2
  76. package/dist/grep/index.d.cts +13 -3
  77. package/dist/grep/index.d.ts +13 -3
  78. package/dist/grep/index.js +6 -2
  79. package/dist/http-request/index.cjs +5 -2
  80. package/dist/http-request/index.d.cts +11 -1
  81. package/dist/http-request/index.d.ts +11 -1
  82. package/dist/http-request/index.js +5 -2
  83. package/dist/index.cjs +68 -25
  84. package/dist/index.d.cts +21 -21
  85. package/dist/index.d.ts +21 -21
  86. package/dist/index.js +73 -30
  87. package/dist/lsp/index.cjs +6 -2
  88. package/dist/lsp/index.d.cts +10 -1
  89. package/dist/lsp/index.d.ts +10 -1
  90. package/dist/lsp/index.js +6 -2
  91. package/dist/memory/index.cjs +6 -2
  92. package/dist/memory/index.d.cts +10 -1
  93. package/dist/memory/index.d.ts +10 -1
  94. package/dist/memory/index.js +6 -2
  95. package/dist/multi-edit/index.cjs +7 -4
  96. package/dist/multi-edit/index.d.cts +12 -2
  97. package/dist/multi-edit/index.d.ts +12 -2
  98. package/dist/multi-edit/index.js +7 -4
  99. package/dist/read/index.cjs +6 -3
  100. package/dist/read/index.d.cts +11 -1
  101. package/dist/read/index.d.ts +11 -1
  102. package/dist/read/index.js +6 -3
  103. package/dist/sleep/index.cjs +5 -2
  104. package/dist/sleep/index.d.cts +11 -1
  105. package/dist/sleep/index.d.ts +11 -1
  106. package/dist/sleep/index.js +5 -2
  107. package/dist/task-create/index.cjs +7 -3
  108. package/dist/task-create/index.d.cts +10 -1
  109. package/dist/task-create/index.d.ts +10 -1
  110. package/dist/task-create/index.js +7 -3
  111. package/dist/task-get/index.cjs +7 -3
  112. package/dist/task-get/index.d.cts +10 -1
  113. package/dist/task-get/index.d.ts +10 -1
  114. package/dist/task-get/index.js +7 -3
  115. package/dist/task-list/index.cjs +7 -3
  116. package/dist/task-list/index.d.cts +10 -1
  117. package/dist/task-list/index.d.ts +10 -1
  118. package/dist/task-list/index.js +7 -3
  119. package/dist/task-update/index.cjs +7 -3
  120. package/dist/task-update/index.d.cts +12 -3
  121. package/dist/task-update/index.d.ts +12 -3
  122. package/dist/task-update/index.js +7 -3
  123. package/dist/tool-search/index.cjs +5 -2
  124. package/dist/tool-search/index.d.cts +10 -1
  125. package/dist/tool-search/index.d.ts +10 -1
  126. package/dist/tool-search/index.js +5 -2
  127. package/dist/web-fetch/index.cjs +5 -2
  128. package/dist/web-fetch/index.d.cts +11 -1
  129. package/dist/web-fetch/index.d.ts +11 -1
  130. package/dist/web-fetch/index.js +5 -2
  131. package/dist/web-search/index.cjs +5 -2
  132. package/dist/web-search/index.d.cts +10 -1
  133. package/dist/web-search/index.d.ts +10 -1
  134. package/dist/web-search/index.js +5 -2
  135. package/dist/write/index.cjs +6 -3
  136. package/dist/write/index.d.cts +13 -3
  137. package/dist/write/index.d.ts +13 -3
  138. package/dist/write/index.js +6 -3
  139. package/package.json +1 -1
  140. package/dist/chunk-3EPGFWZV.cjs +0 -30
  141. package/dist/chunk-44AFQ2B7.js +0 -30
  142. package/dist/chunk-4HXAKPQH.cjs +0 -36
  143. package/dist/chunk-56CL4JCW.cjs +0 -53
  144. package/dist/chunk-6DJSWTWQ.cjs +0 -40
  145. package/dist/chunk-ACGW44YT.js +0 -47
  146. package/dist/chunk-ECYT46FP.js +0 -40
  147. package/dist/chunk-HDKXSKMO.js +0 -30
  148. package/dist/chunk-HNUL2CID.cjs +0 -34
  149. package/dist/chunk-LK6SQH2G.cjs +0 -30
  150. package/dist/chunk-LTE5NG4D.js +0 -53
  151. package/dist/chunk-MF7CJVIZ.js +0 -40
  152. package/dist/chunk-OM2UFTGS.cjs +0 -47
  153. package/dist/chunk-OXLQ7QVL.cjs +0 -40
  154. package/dist/chunk-TMW3XKKJ.js +0 -34
  155. package/dist/chunk-VXZ4RKJI.js +0 -36
  156. package/dist/chunk-ZBLQV6UO.cjs +0 -73
@@ -0,0 +1,77 @@
1
+ import {
2
+ addLineNumbers,
3
+ readFileInRange
4
+ } from "./chunk-PWBVB6MN.js";
5
+ import {
6
+ expandPath
7
+ } from "./chunk-I3ONDY7P.js";
8
+ import {
9
+ extractErrorMessage
10
+ } from "./chunk-X6ZY2KFU.js";
11
+
12
+ // src/read/index.ts
13
+ import { tool } from "ai";
14
+ import { z } from "zod";
15
+
16
+ // src/read/prompt.ts
17
+ function getPrompt(config = {}) {
18
+ const maxLines = config.maxLines ?? 2e3;
19
+ return `Read a file and return its contents with line numbers.
20
+
21
+ Supports absolute paths, relative paths (resolved against the working directory), and tilde (~) home directory expansion. Returns numbered lines in "lineNumber\\tcontent" format.
22
+
23
+ ## When to Use
24
+ - To examine source code, configuration files, or any text file
25
+ - Before editing a file \u2014 read it first to understand its current content
26
+ - To check specific sections of large files using offset and limit
27
+
28
+ ## When NOT to Use
29
+ - To list directory contents \u2014 use a shell command instead
30
+ - To search across many files \u2014 use the dedicated content search tool instead
31
+ - To find files by name \u2014 use the dedicated file search tool instead
32
+
33
+ ## Usage Guidelines
34
+ - By default, reads up to ${maxLines} lines from the start of the file
35
+ - Use \`offset\` and \`limit\` to read specific ranges of large files rather than reading the entire file
36
+ - When you already know which part of the file you need, read only that part to save context
37
+ - Results use cat -n style line numbering starting at 1`;
38
+ }
39
+
40
+ // src/read/index.ts
41
+ function createRead(config = {}) {
42
+ const cwd = config.cwd ?? process.cwd();
43
+ const defaultMaxLines = config.maxLines ?? 2e3;
44
+ return tool({
45
+ description: config.description ?? getPrompt(config),
46
+ inputSchema: z.object({
47
+ file_path: z.string().describe("The absolute path to the file to read"),
48
+ offset: z.number().int().nonnegative().optional().describe("The line number to start reading from (default: 0)"),
49
+ limit: z.number().int().positive().optional().describe("The number of lines to read (default: 2000)")
50
+ }),
51
+ execute: async ({ file_path, offset, limit }) => {
52
+ try {
53
+ const absolutePath = expandPath(file_path, cwd);
54
+ const result = await readFileInRange(
55
+ absolutePath,
56
+ offset ?? 0,
57
+ limit ?? defaultMaxLines
58
+ );
59
+ const numbered = addLineNumbers({
60
+ content: result.content,
61
+ startLine: (offset ?? 0) + 1
62
+ });
63
+ return numbered;
64
+ } catch (error) {
65
+ const msg = extractErrorMessage(error);
66
+ return `Error [read]: ${msg}`;
67
+ }
68
+ }
69
+ });
70
+ }
71
+ var read = createRead();
72
+
73
+ export {
74
+ getPrompt,
75
+ createRead,
76
+ read
77
+ };
@@ -5,6 +5,9 @@ var _chunkMIYA7TNRcjs = require('./chunk-MIYA7TNR.cjs');
5
5
 
6
6
  var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
7
7
 
8
+
9
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
10
+
8
11
  // src/glob/index.ts
9
12
  var _ai = require('ai');
10
13
  var _zod = require('zod');
@@ -65,11 +68,32 @@ async function glob(pattern, cwd, options) {
65
68
  return { files, truncated };
66
69
  }
67
70
 
71
+ // src/glob/prompt.ts
72
+ function getPrompt() {
73
+ return `Find files matching a glob pattern. Returns absolute file paths sorted by modification time (newest first).
74
+
75
+ Fast file pattern matching powered by ripgrep. Supports patterns like "**/*.ts", "src/**/*.js", or "*.json".
76
+
77
+ ## When to Use
78
+ - To find files by name or extension across a codebase
79
+ - To locate configuration files, test files, or specific file types
80
+ - To discover project structure and file organization
81
+
82
+ ## When NOT to Use
83
+ - To search file *contents* \u2014 use the dedicated content search tool instead
84
+ - To read a specific file whose path you already know \u2014 use the file reading tool directly
85
+
86
+ ## Usage Guidelines
87
+ - Results are sorted by modification time (most recently modified first)
88
+ - The optional \`path\` parameter lets you narrow the search to a specific directory
89
+ - Results may be truncated for very large result sets`;
90
+ }
91
+
68
92
  // src/glob/index.ts
69
93
  function createGlob(config = {}) {
70
94
  const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
71
95
  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".',
96
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
73
97
  inputSchema: _zod.z.object({
74
98
  pattern: _zod.z.string().describe("Glob pattern to match files against"),
75
99
  path: _zod.z.string().optional().describe("Directory to search in. Defaults to the working directory.")
@@ -85,7 +109,7 @@ function createGlob(config = {}) {
85
109
  return `${header}
86
110
  ${files.join("\n")}`;
87
111
  } catch (error) {
88
- const message = error instanceof Error ? error.message : String(error);
112
+ const message = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
89
113
  return `Error [glob]: Failed to search for files: ${message}`;
90
114
  }
91
115
  }
@@ -96,4 +120,5 @@ var glob2 = createGlob();
96
120
 
97
121
 
98
122
 
99
- exports.createGlob = createGlob; exports.glob = glob2;
123
+
124
+ exports.getPrompt = getPrompt; exports.createGlob = createGlob; exports.glob = glob2;
@@ -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);
@@ -123,7 +158,7 @@ async function executeLspOperation(serverConfig, params, timeoutMs) {
123
158
  const rpc = (id) => Promise.race([waitForResponse(proc, id, timeoutMs), spawnError]);
124
159
  await rpc(initId);
125
160
  sendNotification(proc, "initialized", {});
126
- const content = await readFile(absolutePath, "utf-8");
161
+ const content = await readTextContent(absolutePath);
127
162
  const langId = extname(absolutePath).replace(".", "") || "plaintext";
128
163
  sendNotification(proc, "textDocument/didOpen", {
129
164
  textDocument: { uri, languageId: langId, version: 1, text: content }
@@ -158,7 +193,7 @@ var LSP_OPERATIONS = [
158
193
  function createLsp(config = {}) {
159
194
  const timeoutMs = config.timeout ?? 3e4;
160
195
  return tool({
161
- description: "Perform language server operations like go-to-definition, find-references, and hover. Requires LSP server configuration. Supports 9 operations: goToDefinition, findReferences, hover, documentSymbol, workspaceSymbol, goToImplementation, prepareCallHierarchy, incomingCalls, outgoingCalls.",
196
+ description: config.description ?? getPrompt(),
162
197
  inputSchema: z.object({
163
198
  operation: z.enum(LSP_OPERATIONS).describe("The LSP operation to perform"),
164
199
  filePath: z.string().describe("Path to the file"),
@@ -182,7 +217,7 @@ function createLsp(config = {}) {
182
217
  timeoutMs
183
218
  );
184
219
  } catch (error) {
185
- const msg = error instanceof Error ? error.message : String(error);
220
+ const msg = extractErrorMessage(error);
186
221
  return `Error [lsp]: ${operation} failed for ${filePath}: ${msg}`;
187
222
  }
188
223
  }
@@ -191,6 +226,7 @@ function createLsp(config = {}) {
191
226
  var lsp = createLsp();
192
227
 
193
228
  export {
229
+ getPrompt,
194
230
  executeLspOperation,
195
231
  createLsp,
196
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 _chunkZBLQV6UOcjs = require('../chunk-ZBLQV6UO.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 = _chunkZBLQV6UOcjs.createEdit; exports.edit = _chunkZBLQV6UOcjs.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,7 +35,7 @@ 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;
@@ -50,4 +60,4 @@ declare const edit: ai.Tool<{
50
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,7 +35,7 @@ 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;
@@ -50,4 +60,4 @@ declare const edit: ai.Tool<{
50
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-P6Z5XFDS.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;