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,67 @@
1
+ import {
2
+ pathExists,
3
+ writeTextContent
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/write/index.ts
13
+ import { tool } from "ai";
14
+ import { z } from "zod";
15
+
16
+ // src/write/prompt.ts
17
+ function getPrompt() {
18
+ return `Write text content to a file, creating parent directories as needed. If the file already exists it is overwritten entirely.
19
+
20
+ Supports absolute paths, relative paths, and tilde (~) expansion.
21
+
22
+ ## When to Use
23
+ - To create new files that don't exist yet
24
+ - To completely rewrite an existing file's content
25
+ - When the changes are so extensive that targeted editing would be impractical
26
+
27
+ ## When NOT to Use
28
+ - To make small, targeted changes to an existing file \u2014 use the file editing tool instead (it only changes what you specify and is less error-prone)
29
+ - Prefer the editing tool for modifications; reserve this tool for creating new files or complete rewrites
30
+
31
+ ## Usage Guidelines
32
+ - This tool overwrites the entire file \u2014 make sure you include all desired content, not just the changes
33
+ - Parent directories are created automatically if they don't exist
34
+ - Read the existing file first before overwriting it, so you don't accidentally lose content`;
35
+ }
36
+
37
+ // src/write/index.ts
38
+ function createWrite(config = {}) {
39
+ const cwd = config.cwd ?? process.cwd();
40
+ return tool({
41
+ description: config.description ?? getPrompt(),
42
+ inputSchema: z.object({
43
+ file_path: z.string().describe("The absolute path to the file to write (must be absolute, not relative)"),
44
+ content: z.string().describe("Text content to write to the file")
45
+ }),
46
+ execute: async ({ file_path, content }) => {
47
+ try {
48
+ const absolutePath = expandPath(file_path, cwd);
49
+ const existed = await pathExists(absolutePath);
50
+ await writeTextContent(absolutePath, content);
51
+ const bytes = Buffer.byteLength(content, "utf-8");
52
+ const verb = existed ? "Updated" : "Created";
53
+ return `${verb} file: ${absolutePath} (${bytes} bytes)`;
54
+ } catch (error) {
55
+ const message = extractErrorMessage(error);
56
+ return `Error [write]: Failed to write file: ${message}`;
57
+ }
58
+ }
59
+ });
60
+ }
61
+ var write = createWrite();
62
+
63
+ export {
64
+ getPrompt,
65
+ createWrite,
66
+ write
67
+ };
@@ -1,14 +1,18 @@
1
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
2
 
3
+ var _chunkBIAODQ2Pcjs = require('./chunk-BIAODQ2P.cjs');
4
+
5
+
3
6
  var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
4
7
 
8
+
9
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
10
+
5
11
  // src/diff/index.ts
6
- var _promises = require('fs/promises');
7
12
  var _ai = require('ai');
8
13
  var _zod = require('zod');
9
14
 
10
15
  // src/shared/diff.ts
11
-
12
16
  var _diff = require('diff');
13
17
  function diffStrings(oldContent, newContent, options) {
14
18
  if (oldContent === newContent) {
@@ -29,8 +33,8 @@ function diffStrings(oldContent, newContent, options) {
29
33
  }
30
34
  async function diffFiles(oldFilePath, newFilePath, options) {
31
35
  const [oldContent, newContent] = await Promise.all([
32
- _promises.readFile.call(void 0, oldFilePath, "utf-8"),
33
- _promises.readFile.call(void 0, newFilePath, "utf-8")
36
+ _chunkBIAODQ2Pcjs.readTextContent.call(void 0, oldFilePath),
37
+ _chunkBIAODQ2Pcjs.readTextContent.call(void 0, newFilePath)
34
38
  ]);
35
39
  return diffStrings(oldContent, newContent, {
36
40
  ...options,
@@ -39,11 +43,30 @@ async function diffFiles(oldFilePath, newFilePath, options) {
39
43
  });
40
44
  }
41
45
 
46
+ // src/diff/prompt.ts
47
+ function getPrompt() {
48
+ return `Generate a unified diff between two files or two strings.
49
+
50
+ Supports three modes:
51
+ 1. **Two file paths**: \`file_path\` + \`other_file_path\` \u2014 compares the contents of both files
52
+ 2. **Two strings**: \`old_content\` + \`new_content\` \u2014 compares the provided strings directly
53
+ 3. **File + string**: \`file_path\` + \`old_content\` or \`new_content\` \u2014 compares a file against provided content
54
+
55
+ ## When to Use
56
+ - To preview what changes would look like before making edits
57
+ - To compare two versions of a file or text
58
+ - To generate a diff for review or documentation purposes
59
+
60
+ ## When NOT to Use
61
+ - To actually apply changes to a file \u2014 use the file editing tool instead
62
+ - To read file contents \u2014 use the file reading tool instead`;
63
+ }
64
+
42
65
  // src/diff/index.ts
43
66
  function createDiff(config = {}) {
44
67
  const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
45
68
  return _ai.tool.call(void 0, {
46
- description: "Generate a unified diff between two files or two strings. Provide file_path + other_file_path to compare files, or old_content + new_content to compare strings. You can also provide file_path with old_content or new_content to compare a file against provided content.",
69
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
47
70
  inputSchema: _zod.z.object({
48
71
  file_path: _zod.z.string().optional().describe("Path to the first file (absolute or relative to cwd)"),
49
72
  other_file_path: _zod.z.string().optional().describe("Path to the second file (absolute or relative to cwd)"),
@@ -62,7 +85,7 @@ function createDiff(config = {}) {
62
85
  }
63
86
  if (file_path && (old_content !== void 0 || new_content !== void 0)) {
64
87
  const resolvedPath = _chunkQZ5GS6HWcjs.expandPath.call(void 0, file_path, cwd);
65
- const fileContent = await _promises.readFile.call(void 0, resolvedPath, "utf-8");
88
+ const fileContent = await _chunkBIAODQ2Pcjs.readTextContent.call(void 0, resolvedPath);
66
89
  if (old_content !== void 0) {
67
90
  return diffStrings(old_content, fileContent, {
68
91
  oldLabel: "provided",
@@ -76,7 +99,7 @@ function createDiff(config = {}) {
76
99
  }
77
100
  return "Error [diff]: Insufficient parameters. Provide either: (1) file_path + other_file_path, (2) old_content + new_content, or (3) file_path + old_content/new_content.";
78
101
  } catch (error) {
79
- const msg = error instanceof Error ? error.message : String(error);
102
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
80
103
  return `Error [diff]: ${msg}`;
81
104
  }
82
105
  }
@@ -87,4 +110,5 @@ var diff = createDiff();
87
110
 
88
111
 
89
112
 
90
- exports.createDiff = createDiff; exports.diff = diff;
113
+
114
+ exports.getPrompt = getPrompt; exports.createDiff = createDiff; exports.diff = diff;
@@ -1,6 +1,6 @@
1
1
  // src/shared/file.ts
2
2
  import { createReadStream } from "fs";
3
- import { mkdir, readFile, stat, writeFile } from "fs/promises";
3
+ import { mkdir, readFile, readdir, stat, unlink, writeFile } from "fs/promises";
4
4
  import { dirname } from "path";
5
5
  var FAST_PATH_MAX_SIZE = 10 * 1024 * 1024;
6
6
  function addLineNumbers({
@@ -25,6 +25,18 @@ async function pathExists(path) {
25
25
  return false;
26
26
  }
27
27
  }
28
+ async function readTextContent(filePath) {
29
+ return readFile(filePath, "utf-8");
30
+ }
31
+ async function listDirectory(dirPath) {
32
+ return readdir(dirPath);
33
+ }
34
+ async function removeFile(filePath) {
35
+ await unlink(filePath);
36
+ }
37
+ async function getFileStats(filePath) {
38
+ return stat(filePath);
39
+ }
28
40
  async function readFileInRange(filePath, offset = 0, maxLines) {
29
41
  const stats = await stat(filePath);
30
42
  if (stats.isDirectory()) {
@@ -113,5 +125,9 @@ export {
113
125
  addLineNumbers,
114
126
  writeTextContent,
115
127
  pathExists,
128
+ readTextContent,
129
+ listDirectory,
130
+ removeFile,
131
+ getFileStats,
116
132
  readFileInRange
117
133
  };
@@ -3,13 +3,48 @@
3
3
  var _chunkMIYA7TNRcjs = require('./chunk-MIYA7TNR.cjs');
4
4
 
5
5
 
6
+ var _chunkBIAODQ2Pcjs = require('./chunk-BIAODQ2P.cjs');
7
+
8
+
6
9
 
7
10
  var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
8
11
 
12
+
13
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
14
+
9
15
  // src/grep/index.ts
10
- var _promises = require('fs/promises');
11
16
  var _ai = require('ai');
12
17
  var _zod = require('zod');
18
+
19
+ // src/grep/prompt.ts
20
+ function getPrompt() {
21
+ return `Search file contents using ripgrep. Supports regex patterns, context lines, and multiple output modes.
22
+
23
+ ## When to Use
24
+ - To find where a function, variable, string, or pattern is used across files
25
+ - To search for specific code patterns, error messages, or configuration values
26
+ - To count occurrences of a pattern across a codebase
27
+
28
+ ## When NOT to Use
29
+ - To find files by name/extension \u2014 use the dedicated file search tool instead
30
+ - To read a specific file \u2014 use the file reading tool instead
31
+ - Don't use shell commands (grep, rg) for content search when this tool is available
32
+
33
+ ## Output Modes
34
+ - \`files_with_matches\` (default): Returns file paths containing matches, sorted by modification time. Best for discovering which files contain a pattern.
35
+ - \`content\`: Returns matching lines with optional context. Supports \`-A\` (after), \`-B\` (before), \`-C\` (context) for surrounding lines and \`-n\` for line numbers (default: true).
36
+ - \`count\`: Returns match counts per file with totals.
37
+
38
+ ## Usage Guidelines
39
+ - Uses ripgrep regex syntax (not grep). Literal braces need escaping: use \`interface\\{\\}\` to find \`interface{}\`
40
+ - Filter files with the \`glob\` parameter (e.g., "*.js", "*.{ts,tsx}") or \`type\` parameter (e.g., "js", "py")
41
+ - Default head_limit is 250 entries. Pass \`head_limit: 0\` for unlimited (use sparingly \u2014 large results waste context)
42
+ - Use \`offset\` to paginate through large result sets
43
+ - Enable \`multiline: true\` for patterns that span lines (e.g., \`struct \\{[\\s\\S]*?field\`)
44
+ - Use \`-i: true\` for case-insensitive search`;
45
+ }
46
+
47
+ // src/grep/index.ts
13
48
  var VCS_DIRS = [".git", ".svn", ".hg", ".bzr", ".jj", ".sl"];
14
49
  var DEFAULT_HEAD_LIMIT = 250;
15
50
  function applyHeadLimit(items, limit, offset = 0) {
@@ -48,7 +83,7 @@ function parseGlobPatterns(globFilter) {
48
83
  function createGrep(config = {}) {
49
84
  const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
50
85
  return _ai.tool.call(void 0, {
51
- description: 'Search file contents using ripgrep. Supports regex patterns, context lines, and three output modes: "content" (matching lines), "files_with_matches" (file paths), and "count" (match counts).',
86
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
52
87
  inputSchema: _zod.z.object({
53
88
  pattern: _zod.z.string().describe("The regular expression pattern to search for in file contents"),
54
89
  path: _zod.z.string().optional().describe("File or directory to search in (rg PATH). Defaults to current working directory."),
@@ -132,7 +167,7 @@ function createGrep(config = {}) {
132
167
 
133
168
  Total: ${totalMatches} matches in ${fileCount} files` + truncationSuffix(appliedLimit2, offset);
134
169
  }
135
- const stats = await Promise.allSettled(results.map((f) => _promises.stat.call(void 0, f)));
170
+ const stats = await Promise.allSettled(results.map((f) => _chunkBIAODQ2Pcjs.getFileStats.call(void 0, f)));
136
171
  const sorted = results.map((fp, i) => {
137
172
  const r = stats[i];
138
173
  const mt = r.status === "fulfilled" ? _nullishCoalesce(r.value.mtimeMs, () => ( 0)) : 0;
@@ -145,7 +180,7 @@ Total: ${totalMatches} matches in ${fileCount} files` + truncationSuffix(applied
145
180
  const relative = items.map((f) => _chunkQZ5GS6HWcjs.toRelativePath.call(void 0, f, cwd));
146
181
  return relative.join("\n") + truncationSuffix(appliedLimit, offset);
147
182
  } catch (error) {
148
- const msg = error instanceof Error ? error.message : String(error);
183
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
149
184
  return `Error [grep]: Failed to search: ${msg}`;
150
185
  }
151
186
  }
@@ -156,4 +191,5 @@ var grep = createGrep();
156
191
 
157
192
 
158
193
 
159
- exports.createGrep = createGrep; exports.grep = grep;
194
+
195
+ exports.getPrompt = getPrompt; exports.createGrep = createGrep; exports.grep = grep;
@@ -0,0 +1,91 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+
5
+
6
+ var _chunkVQSWMGG7cjs = require('./chunk-VQSWMGG7.cjs');
7
+
8
+
9
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
10
+
11
+ // src/task-create/index.ts
12
+ var _ai = require('ai');
13
+ var _zod = require('zod');
14
+ var _path = require('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 = _nullishCoalesce(config.cwd, () => ( process.cwd()));
51
+ const tasksFile = _nullishCoalesce(config.tasksFile, () => ( _path.join.call(void 0, cwd, ".agentool", "tasks.json")));
52
+ return _ai.tool.call(void 0, {
53
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
54
+ inputSchema: _zod.z.object({
55
+ subject: _zod.z.string().describe("A brief title for the task"),
56
+ description: _zod.z.string().describe("What needs to be done"),
57
+ metadata: _zod.z.record(_zod.z.string(), _zod.z.unknown()).optional().describe("Arbitrary metadata to attach to the task")
58
+ }),
59
+ execute: async ({ subject, description, metadata }) => {
60
+ try {
61
+ const tasks = await _chunkVQSWMGG7cjs.loadTasks.call(void 0, tasksFile);
62
+ const now = (/* @__PURE__ */ new Date()).toISOString();
63
+ const entry = {
64
+ id: _chunkVQSWMGG7cjs.generateId.call(void 0, ),
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 _chunkVQSWMGG7cjs.saveTasks.call(void 0, tasksFile, tasks);
76
+ return `Created task ${entry.id}.
77
+ ${_chunkVQSWMGG7cjs.formatTask.call(void 0, entry)}`;
78
+ } catch (error) {
79
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
80
+ return `Error [task-create]: ${msg}`;
81
+ }
82
+ }
83
+ });
84
+ }
85
+ var taskCreate = createTaskCreate();
86
+
87
+
88
+
89
+
90
+
91
+ exports.getPrompt = getPrompt; exports.createTaskCreate = createTaskCreate; exports.taskCreate = taskCreate;
@@ -2,17 +2,67 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkL5JH4I77cjs = require('./chunk-L5JH4I77.cjs');
5
+ var _chunkVQSWMGG7cjs = require('./chunk-VQSWMGG7.cjs');
6
+
7
+
8
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
6
9
 
7
10
  // src/task-update/index.ts
8
11
  var _ai = require('ai');
9
12
  var _zod = require('zod');
10
13
  var _path = require('path');
14
+
15
+ // src/task-update/prompt.ts
16
+ function getPrompt() {
17
+ return `Update a task by its ID. Can change status, subject, description, owner, metadata, and dependency relationships.
18
+
19
+ ## When to Use
20
+
21
+ **Marking tasks as completed:**
22
+ - When you have fully completed the work described in a task
23
+ - ONLY mark a task as completed when the work is truly done
24
+ - If you encounter errors or blockers, keep the task as \`in_progress\`
25
+ - Never mark a task as completed if:
26
+ - Tests are failing
27
+ - Implementation is partial
28
+ - You encountered unresolved errors
29
+
30
+ **Marking tasks as in progress:**
31
+ - When you begin working on a task, set it to \`in_progress\` immediately
32
+
33
+ **Deleting tasks:**
34
+ - When a task is no longer relevant or was created in error
35
+ - Setting status to \`deleted\` permanently removes the task from the list
36
+
37
+ **Updating details:**
38
+ - When requirements change or become clearer
39
+ - When establishing dependencies between tasks
40
+
41
+ ## Status Workflow
42
+ Status progresses: \`pending\` \u2192 \`in_progress\` \u2192 \`completed\`
43
+ Use \`deleted\` to remove a task permanently.
44
+
45
+ ## Fields You Can Update
46
+ - **status**: pending, in_progress, completed, or deleted
47
+ - **subject**: Change the task title
48
+ - **description**: Change the task description
49
+ - **owner**: Assign or reassign the task
50
+ - **activeForm**: Present continuous form shown when in_progress (e.g., "Running tests")
51
+ - **addBlocks**: Add task IDs that cannot start until this task completes
52
+ - **addBlockedBy**: Add task IDs that must complete before this task can start
53
+ - **metadata**: Merge key-value pairs into the task (set a key to null to delete it)
54
+
55
+ ## Tips
56
+ - After completing a task, check the task list for newly unblocked work
57
+ - Use dependencies (blocks/blockedBy) to enforce execution order when tasks depend on each other`;
58
+ }
59
+
60
+ // src/task-update/index.ts
11
61
  function createTaskUpdate(config = {}) {
12
62
  const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
13
63
  const tasksFile = _nullishCoalesce(config.tasksFile, () => ( _path.join.call(void 0, cwd, ".agentool", "tasks.json")));
14
64
  return _ai.tool.call(void 0, {
15
- description: "Update a task by its ID. Can change status, subject, description, owner, metadata, and dependency relationships.",
65
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
16
66
  inputSchema: _zod.z.object({
17
67
  taskId: _zod.z.string().describe("The ID of the task to update"),
18
68
  subject: _zod.z.string().optional().describe("New subject for the task"),
@@ -26,7 +76,7 @@ function createTaskUpdate(config = {}) {
26
76
  }),
27
77
  execute: async (input) => {
28
78
  try {
29
- const tasks = await _chunkL5JH4I77cjs.loadTasks.call(void 0, tasksFile);
79
+ const tasks = await _chunkVQSWMGG7cjs.loadTasks.call(void 0, tasksFile);
30
80
  const idx = tasks.findIndex((t) => t.id === input.taskId);
31
81
  if (idx === -1) return `Error [task-update]: Task "${input.taskId}" not found.`;
32
82
  const entry = tasks[idx];
@@ -57,11 +107,11 @@ function createTaskUpdate(config = {}) {
57
107
  }
58
108
  entry.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
59
109
  tasks[idx] = entry;
60
- await _chunkL5JH4I77cjs.saveTasks.call(void 0, tasksFile, tasks);
110
+ await _chunkVQSWMGG7cjs.saveTasks.call(void 0, tasksFile, tasks);
61
111
  return `Updated task ${input.taskId}.
62
- ${_chunkL5JH4I77cjs.formatTask.call(void 0, entry)}`;
112
+ ${_chunkVQSWMGG7cjs.formatTask.call(void 0, entry)}`;
63
113
  } catch (error) {
64
- const msg = error instanceof Error ? error.message : String(error);
114
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
65
115
  return `Error [task-update]: ${msg}`;
66
116
  }
67
117
  }
@@ -72,4 +122,5 @@ var taskUpdate = createTaskUpdate();
72
122
 
73
123
 
74
124
 
75
- exports.createTaskUpdate = createTaskUpdate; exports.taskUpdate = taskUpdate;
125
+
126
+ exports.getPrompt = getPrompt; exports.createTaskUpdate = createTaskUpdate; exports.taskUpdate = taskUpdate;
@@ -1,9 +1,38 @@
1
+ import {
2
+ extractErrorMessage
3
+ } from "./chunk-X6ZY2KFU.js";
4
+
1
5
  // src/http-request/index.ts
2
6
  import { tool } from "ai";
3
7
  import { z } from "zod";
8
+
9
+ // src/http-request/prompt.ts
10
+ function getPrompt(config = {}) {
11
+ const timeout = config.timeout ?? 3e4;
12
+ return `Make an HTTP request to a URL. Returns the raw response status, headers, and body as JSON.
13
+
14
+ Supports GET, POST, PUT, PATCH, DELETE, and HEAD methods.
15
+
16
+ ## When to Use
17
+ - For API interactions: REST calls, webhook triggers, service health checks
18
+ - When you need full control over HTTP method, headers, and request body
19
+ - When you need the raw response (status codes, headers) not just content
20
+
21
+ ## When NOT to Use
22
+ - To read a web page for its content \u2014 use the web fetch tool instead (it converts HTML to markdown)
23
+ - To search the web \u2014 use the web search tool instead
24
+
25
+ ## Usage Guidelines
26
+ - Default timeout: ${timeout}ms. Override with the timeout parameter.
27
+ - Request body is sent for POST, PUT, and PATCH methods
28
+ - Response is returned as JSON with status, statusText, headers, and body fields
29
+ - Default headers from config are merged with per-request headers (per-request takes precedence)`;
30
+ }
31
+
32
+ // src/http-request/index.ts
4
33
  function createHttpRequest(config = {}) {
5
34
  return tool({
6
- description: "Make an HTTP request to a URL. Returns the response status, headers, and body. Use this for API interactions, webhook calls, and service health checks. Unlike web-fetch, this returns raw response data without markdown conversion.",
35
+ description: config.description ?? getPrompt(config),
7
36
  inputSchema: z.object({
8
37
  method: z.enum(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"]).describe("HTTP method"),
9
38
  url: z.string().describe("The URL to send the request to"),
@@ -44,7 +73,7 @@ function createHttpRequest(config = {}) {
44
73
  if (error instanceof Error && error.name === "AbortError") {
45
74
  return `Error [http-request]: Request timed out after ${effectiveTimeout}ms for ${method} ${url}. Try increasing the timeout or verify the server is responsive.`;
46
75
  }
47
- const msg = error instanceof Error ? error.message : String(error);
76
+ const msg = extractErrorMessage(error);
48
77
  return `Error [http-request]: ${method} ${url} failed: ${msg}. Verify the URL is correct and the server is reachable.`;
49
78
  }
50
79
  }
@@ -53,6 +82,7 @@ function createHttpRequest(config = {}) {
53
82
  var httpRequest = createHttpRequest();
54
83
 
55
84
  export {
85
+ getPrompt,
56
86
  createHttpRequest,
57
87
  httpRequest
58
88
  };
@@ -2,17 +2,67 @@ import {
2
2
  formatTask,
3
3
  loadTasks,
4
4
  saveTasks
5
- } from "./chunk-E6NBEYZD.js";
5
+ } from "./chunk-VHLY7LQE.js";
6
+ import {
7
+ extractErrorMessage
8
+ } from "./chunk-X6ZY2KFU.js";
6
9
 
7
10
  // src/task-update/index.ts
8
11
  import { tool } from "ai";
9
12
  import { z } from "zod";
10
13
  import { join } from "path";
14
+
15
+ // src/task-update/prompt.ts
16
+ function getPrompt() {
17
+ return `Update a task by its ID. Can change status, subject, description, owner, metadata, and dependency relationships.
18
+
19
+ ## When to Use
20
+
21
+ **Marking tasks as completed:**
22
+ - When you have fully completed the work described in a task
23
+ - ONLY mark a task as completed when the work is truly done
24
+ - If you encounter errors or blockers, keep the task as \`in_progress\`
25
+ - Never mark a task as completed if:
26
+ - Tests are failing
27
+ - Implementation is partial
28
+ - You encountered unresolved errors
29
+
30
+ **Marking tasks as in progress:**
31
+ - When you begin working on a task, set it to \`in_progress\` immediately
32
+
33
+ **Deleting tasks:**
34
+ - When a task is no longer relevant or was created in error
35
+ - Setting status to \`deleted\` permanently removes the task from the list
36
+
37
+ **Updating details:**
38
+ - When requirements change or become clearer
39
+ - When establishing dependencies between tasks
40
+
41
+ ## Status Workflow
42
+ Status progresses: \`pending\` \u2192 \`in_progress\` \u2192 \`completed\`
43
+ Use \`deleted\` to remove a task permanently.
44
+
45
+ ## Fields You Can Update
46
+ - **status**: pending, in_progress, completed, or deleted
47
+ - **subject**: Change the task title
48
+ - **description**: Change the task description
49
+ - **owner**: Assign or reassign the task
50
+ - **activeForm**: Present continuous form shown when in_progress (e.g., "Running tests")
51
+ - **addBlocks**: Add task IDs that cannot start until this task completes
52
+ - **addBlockedBy**: Add task IDs that must complete before this task can start
53
+ - **metadata**: Merge key-value pairs into the task (set a key to null to delete it)
54
+
55
+ ## Tips
56
+ - After completing a task, check the task list for newly unblocked work
57
+ - Use dependencies (blocks/blockedBy) to enforce execution order when tasks depend on each other`;
58
+ }
59
+
60
+ // src/task-update/index.ts
11
61
  function createTaskUpdate(config = {}) {
12
62
  const cwd = config.cwd ?? process.cwd();
13
63
  const tasksFile = config.tasksFile ?? join(cwd, ".agentool", "tasks.json");
14
64
  return tool({
15
- description: "Update a task by its ID. Can change status, subject, description, owner, metadata, and dependency relationships.",
65
+ description: config.description ?? getPrompt(),
16
66
  inputSchema: z.object({
17
67
  taskId: z.string().describe("The ID of the task to update"),
18
68
  subject: z.string().optional().describe("New subject for the task"),
@@ -61,7 +111,7 @@ function createTaskUpdate(config = {}) {
61
111
  return `Updated task ${input.taskId}.
62
112
  ${formatTask(entry)}`;
63
113
  } catch (error) {
64
- const msg = error instanceof Error ? error.message : String(error);
114
+ const msg = extractErrorMessage(error);
65
115
  return `Error [task-update]: ${msg}`;
66
116
  }
67
117
  }
@@ -70,6 +120,7 @@ ${formatTask(entry)}`;
70
120
  var taskUpdate = createTaskUpdate();
71
121
 
72
122
  export {
123
+ getPrompt,
73
124
  createTaskUpdate,
74
125
  taskUpdate
75
126
  };