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
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+ var _chunkBIAODQ2Pcjs = require('./chunk-BIAODQ2P.cjs');
5
+
6
+
7
+ var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
8
+
9
+
10
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
11
+
12
+ // src/read/index.ts
13
+ var _ai = require('ai');
14
+ var _zod = require('zod');
15
+
16
+ // src/read/prompt.ts
17
+ function getPrompt(config = {}) {
18
+ const maxLines = _nullishCoalesce(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 = _nullishCoalesce(config.cwd, () => ( process.cwd()));
43
+ const defaultMaxLines = _nullishCoalesce(config.maxLines, () => ( 2e3));
44
+ return _ai.tool.call(void 0, {
45
+ description: _nullishCoalesce(config.description, () => ( getPrompt(config))),
46
+ inputSchema: _zod.z.object({
47
+ file_path: _zod.z.string().describe("The absolute path to the file to read"),
48
+ offset: _zod.z.number().int().nonnegative().optional().describe("The line number to start reading from (default: 0)"),
49
+ limit: _zod.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 = _chunkQZ5GS6HWcjs.expandPath.call(void 0, file_path, cwd);
54
+ const result = await _chunkBIAODQ2Pcjs.readFileInRange.call(void 0,
55
+ absolutePath,
56
+ _nullishCoalesce(offset, () => ( 0)),
57
+ _nullishCoalesce(limit, () => ( defaultMaxLines))
58
+ );
59
+ const numbered = _chunkBIAODQ2Pcjs.addLineNumbers.call(void 0, {
60
+ content: result.content,
61
+ startLine: (_nullishCoalesce(offset, () => ( 0))) + 1
62
+ });
63
+ return numbered;
64
+ } catch (error) {
65
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
66
+ return `Error [read]: ${msg}`;
67
+ }
68
+ }
69
+ });
70
+ }
71
+ var read = createRead();
72
+
73
+
74
+
75
+
76
+
77
+ exports.getPrompt = getPrompt; exports.createRead = createRead; exports.read = read;
@@ -0,0 +1,65 @@
1
+ import {
2
+ formatTaskSummary,
3
+ loadTasks
4
+ } from "./chunk-VHLY7LQE.js";
5
+ import {
6
+ extractErrorMessage
7
+ } from "./chunk-X6ZY2KFU.js";
8
+
9
+ // src/task-list/index.ts
10
+ import { tool } from "ai";
11
+ import { z } from "zod";
12
+ import { join } from "path";
13
+
14
+ // src/task-list/prompt.ts
15
+ function getPrompt() {
16
+ return `List all tasks with their status, owner, and dependencies.
17
+
18
+ ## When to Use
19
+ - To see what tasks are available to work on (status: pending, not blocked)
20
+ - To check overall progress on the current work
21
+ - To find tasks that are blocked and need dependencies resolved
22
+ - After completing a task \u2014 check for newly unblocked work
23
+ - Before creating new tasks \u2014 check for duplicates
24
+
25
+ ## Output Format
26
+ Returns a summary of each non-deleted task:
27
+ - **id**: Task identifier (use with task-get or task-update)
28
+ - **status**: pending, in_progress, or completed
29
+ - **subject**: Brief description of the task
30
+ - **owner**: Who is assigned (if set)
31
+ - **blockedBy**: Tasks that must complete before this one can start
32
+
33
+ ## Tips
34
+ - Tasks with non-empty \`blockedBy\` lists cannot be started until their dependencies are resolved
35
+ - Use task-get with a specific ID to see full details including description and metadata
36
+ - After marking a task completed, call this tool to find the next available task`;
37
+ }
38
+
39
+ // src/task-list/index.ts
40
+ function createTaskList(config = {}) {
41
+ const cwd = config.cwd ?? process.cwd();
42
+ const tasksFile = config.tasksFile ?? join(cwd, ".agentool", "tasks.json");
43
+ return tool({
44
+ description: config.description ?? getPrompt(),
45
+ inputSchema: z.object({}),
46
+ execute: async () => {
47
+ try {
48
+ const tasks = await loadTasks(tasksFile);
49
+ const visible = tasks.filter((t) => t.status !== "deleted");
50
+ if (visible.length === 0) return "No tasks found.";
51
+ return visible.map(formatTaskSummary).join("\n");
52
+ } catch (error) {
53
+ const msg = extractErrorMessage(error);
54
+ return `Error [task-list]: ${msg}`;
55
+ }
56
+ }
57
+ });
58
+ }
59
+ var taskList = createTaskList();
60
+
61
+ export {
62
+ getPrompt,
63
+ createTaskList,
64
+ taskList
65
+ };
@@ -4,6 +4,9 @@ import {
4
4
  import {
5
5
  expandPath
6
6
  } from "./chunk-I3ONDY7P.js";
7
+ import {
8
+ extractErrorMessage
9
+ } from "./chunk-X6ZY2KFU.js";
7
10
 
8
11
  // src/glob/index.ts
9
12
  import { tool } from "ai";
@@ -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 = config.cwd ?? process.cwd();
71
95
  return tool({
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: config.description ?? getPrompt(),
73
97
  inputSchema: z.object({
74
98
  pattern: z.string().describe("Glob pattern to match files against"),
75
99
  path: 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 = extractErrorMessage(error);
89
113
  return `Error [glob]: Failed to search for files: ${message}`;
90
114
  }
91
115
  }
@@ -94,6 +118,7 @@ ${files.join("\n")}`;
94
118
  var glob2 = createGlob();
95
119
 
96
120
  export {
121
+ getPrompt,
97
122
  createGlob,
98
123
  glob2 as glob
99
124
  };
@@ -0,0 +1,69 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
4
+
5
+ // src/sleep/index.ts
6
+ var _ai = require('ai');
7
+ var _zod = require('zod');
8
+
9
+ // src/sleep/prompt.ts
10
+ function getPrompt(config = {}) {
11
+ const maxDuration = _nullishCoalesce(config.maxDuration, () => ( 3e5));
12
+ const maxSec = maxDuration / 1e3;
13
+ return `Pause execution for a specified duration. Maximum duration: ${maxSec} seconds (${maxDuration}ms).
14
+
15
+ ## When to Use
16
+ - When rate-limited by an external API and need to wait before retrying
17
+ - When waiting for an external process to complete
18
+ - Prefer this over shell sleep commands \u2014 it doesn't hold a shell process
19
+
20
+ ## When NOT to Use
21
+ - Don't sleep between commands that can run immediately \u2014 just run them
22
+ - Don't retry failing commands in a sleep loop \u2014 diagnose the root cause first
23
+ - Avoid long sleeps that block the user \u2014 keep durations short when possible
24
+
25
+ ## Usage Guidelines
26
+ - Durations exceeding the maximum are automatically clamped to ${maxDuration}ms
27
+ - Provide a \`reason\` parameter to document why the sleep is needed
28
+ - Each sleep costs an API turn \u2014 use judiciously`;
29
+ }
30
+
31
+ // src/sleep/index.ts
32
+ function createSleep(config = {}) {
33
+ const maxDuration = _nullishCoalesce(config.maxDuration, () => ( 3e5));
34
+ return _ai.tool.call(void 0, {
35
+ description: _nullishCoalesce(config.description, () => ( getPrompt(config))),
36
+ inputSchema: _ai.zodSchema.call(void 0,
37
+ _zod.z.object({
38
+ durationMs: _zod.z.number().describe("Duration to sleep in milliseconds"),
39
+ reason: _zod.z.string().optional().describe("Optional reason for the sleep")
40
+ })
41
+ ),
42
+ execute: async ({ durationMs, reason }) => {
43
+ try {
44
+ const clamped = Math.max(0, Math.min(durationMs, maxDuration));
45
+ const start = Date.now();
46
+ await new Promise((resolve) => setTimeout(resolve, clamped));
47
+ const elapsed = Date.now() - start;
48
+ const parts = [`Slept for ${elapsed}ms`];
49
+ if (reason) parts.push(`Reason: ${reason}`);
50
+ if (clamped !== durationMs) {
51
+ parts.push(
52
+ `(clamped from ${durationMs}ms to ${clamped}ms, max: ${maxDuration}ms)`
53
+ );
54
+ }
55
+ return parts.join(". ");
56
+ } catch (error) {
57
+ const message = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
58
+ return `Sleep failed: ${message}`;
59
+ }
60
+ }
61
+ });
62
+ }
63
+ var sleep = createSleep();
64
+
65
+
66
+
67
+
68
+
69
+ exports.getPrompt = getPrompt; exports.createSleep = createSleep; exports.sleep = sleep;
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/shared/errors.ts
2
+ function extractErrorMessage(error) {
3
+ return error instanceof Error ? error.message : String(error);
4
+ }
5
+
6
+
7
+
8
+ exports.extractErrorMessage = extractErrorMessage;
@@ -0,0 +1,61 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
4
+
5
+ // src/ask-user/index.ts
6
+ var _ai = require('ai');
7
+ var _zod = require('zod');
8
+
9
+ // src/ask-user/prompt.ts
10
+ function getPrompt() {
11
+ return `Ask the user a question and wait for their response. Pauses execution until the user replies.
12
+
13
+ Requires an onQuestion callback to be configured \u2014 the application provides the user interaction mechanism.
14
+
15
+ ## When to Use
16
+ - When you need clarification about ambiguous requirements before proceeding
17
+ - When you need the user to choose between multiple valid approaches
18
+ - When you need confirmation before taking a potentially destructive action
19
+ - When missing critical information that cannot be reasonably inferred
20
+
21
+ ## When NOT to Use
22
+ - When you can make a reasonable decision autonomously
23
+ - For trivial confirmations that slow down workflow
24
+ - When the answer is clearly implied by the user's request
25
+
26
+ ## Usage Guidelines
27
+ - Ask clear, specific questions \u2014 avoid vague or overly broad queries
28
+ - Provide options when there are a small number of valid choices
29
+ - Batch related questions together rather than asking one at a time
30
+ - Prefer making progress autonomously when the right course of action is clear`;
31
+ }
32
+
33
+ // src/ask-user/index.ts
34
+ function createAskUser(config = {}) {
35
+ return _ai.tool.call(void 0, {
36
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
37
+ inputSchema: _zod.z.object({
38
+ question: _zod.z.string().describe("The question to ask the user"),
39
+ options: _zod.z.array(_zod.z.string()).optional().describe("Optional list of suggested response options")
40
+ }),
41
+ execute: async ({ question, options }) => {
42
+ if (!config.onQuestion) {
43
+ return "Error [ask-user]: No onQuestion callback configured. Provide an onQuestion function in the tool config to enable user interaction.";
44
+ }
45
+ try {
46
+ const response = await config.onQuestion(question, options);
47
+ return response;
48
+ } catch (error) {
49
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
50
+ return `Error [ask-user]: Failed to get user response: ${msg}`;
51
+ }
52
+ }
53
+ });
54
+ }
55
+ var askUser = createAskUser();
56
+
57
+
58
+
59
+
60
+
61
+ exports.getPrompt = getPrompt; exports.createAskUser = createAskUser; exports.askUser = askUser;
@@ -0,0 +1,61 @@
1
+ import {
2
+ extractErrorMessage
3
+ } from "./chunk-X6ZY2KFU.js";
4
+
5
+ // src/ask-user/index.ts
6
+ import { tool } from "ai";
7
+ import { z } from "zod";
8
+
9
+ // src/ask-user/prompt.ts
10
+ function getPrompt() {
11
+ return `Ask the user a question and wait for their response. Pauses execution until the user replies.
12
+
13
+ Requires an onQuestion callback to be configured \u2014 the application provides the user interaction mechanism.
14
+
15
+ ## When to Use
16
+ - When you need clarification about ambiguous requirements before proceeding
17
+ - When you need the user to choose between multiple valid approaches
18
+ - When you need confirmation before taking a potentially destructive action
19
+ - When missing critical information that cannot be reasonably inferred
20
+
21
+ ## When NOT to Use
22
+ - When you can make a reasonable decision autonomously
23
+ - For trivial confirmations that slow down workflow
24
+ - When the answer is clearly implied by the user's request
25
+
26
+ ## Usage Guidelines
27
+ - Ask clear, specific questions \u2014 avoid vague or overly broad queries
28
+ - Provide options when there are a small number of valid choices
29
+ - Batch related questions together rather than asking one at a time
30
+ - Prefer making progress autonomously when the right course of action is clear`;
31
+ }
32
+
33
+ // src/ask-user/index.ts
34
+ function createAskUser(config = {}) {
35
+ return tool({
36
+ description: config.description ?? getPrompt(),
37
+ inputSchema: z.object({
38
+ question: z.string().describe("The question to ask the user"),
39
+ options: z.array(z.string()).optional().describe("Optional list of suggested response options")
40
+ }),
41
+ execute: async ({ question, options }) => {
42
+ if (!config.onQuestion) {
43
+ return "Error [ask-user]: No onQuestion callback configured. Provide an onQuestion function in the tool config to enable user interaction.";
44
+ }
45
+ try {
46
+ const response = await config.onQuestion(question, options);
47
+ return response;
48
+ } catch (error) {
49
+ const msg = extractErrorMessage(error);
50
+ return `Error [ask-user]: Failed to get user response: ${msg}`;
51
+ }
52
+ }
53
+ });
54
+ }
55
+ var askUser = createAskUser();
56
+
57
+ export {
58
+ getPrompt,
59
+ createAskUser,
60
+ askUser
61
+ };
@@ -1,12 +1,50 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
+
4
+
5
+
6
+ var _chunkBIAODQ2Pcjs = require('./chunk-BIAODQ2P.cjs');
7
+
8
+
3
9
  var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
4
10
 
11
+
12
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
13
+
5
14
  // src/memory/index.ts
6
15
  var _ai = require('ai');
7
16
  var _zod = require('zod');
8
- var _promises = require('fs/promises');
9
17
  var _path = require('path');
18
+
19
+ // src/memory/prompt.ts
20
+ function getPrompt() {
21
+ return `File-based key-value memory store for persisting notes, context, or any text data across conversations.
22
+
23
+ Entries are stored as individual .md files in the memory directory.
24
+
25
+ ## Operations
26
+ - **write**: Store content under a key (creates or overwrites)
27
+ - **read**: Retrieve content by key
28
+ - **list**: List all stored keys
29
+ - **delete**: Remove a key and its content
30
+
31
+ ## When to Use
32
+ - To persist information that should survive across conversations or sessions
33
+ - To store user preferences, project notes, or context summaries
34
+ - To keep a running log of decisions, findings, or important details
35
+
36
+ ## When NOT to Use
37
+ - For temporary data within a single conversation \u2014 just keep it in context
38
+ - For structured task tracking \u2014 use the task management tools instead
39
+
40
+ ## Usage Guidelines
41
+ - Keys are sanitized to prevent path traversal (no ../ allowed)
42
+ - The \`key\` parameter is required for read, write, and delete operations
43
+ - The \`content\` parameter is required for write operations
44
+ - Use descriptive key names for easy discovery (e.g., "user-preferences", "project-architecture")`;
45
+ }
46
+
47
+ // src/memory/index.ts
10
48
  function sanitizeKey(key) {
11
49
  if (!key || key.trim() === "") {
12
50
  return { err: "Error [memory]: Key must not be empty." };
@@ -24,7 +62,7 @@ function createMemory(config = {}) {
24
62
  const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
25
63
  const memoryDir = _nullishCoalesce(config.memoryDir, () => ( _path.join.call(void 0, cwd, ".agentool", "memory")));
26
64
  return _ai.tool.call(void 0, {
27
- description: "File-based key-value memory store. Use this to persist notes, context, or any text data across conversations. Supports write, read, list, and delete operations.",
65
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
28
66
  inputSchema: _zod.z.object({
29
67
  action: _zod.z.enum(["read", "write", "list", "delete"]).describe(
30
68
  "The operation to perform: read, write, list, or delete"
@@ -55,7 +93,7 @@ function createMemory(config = {}) {
55
93
  return `Error [memory]: Unknown action "${String(action)}".`;
56
94
  }
57
95
  } catch (error) {
58
- const msg = error instanceof Error ? error.message : String(error);
96
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
59
97
  return `Error [memory]: ${msg}`;
60
98
  }
61
99
  }
@@ -65,20 +103,19 @@ async function writeEntry(dir, key, content) {
65
103
  if (!content && content !== "") {
66
104
  return "Error [memory]: Content is required for write action.";
67
105
  }
68
- await _promises.mkdir.call(void 0, dir, { recursive: true });
69
- await _promises.writeFile.call(void 0, _path.join.call(void 0, dir, `${key}.md`), content, "utf-8");
106
+ await _chunkBIAODQ2Pcjs.writeTextContent.call(void 0, _path.join.call(void 0, dir, `${key}.md`), content);
70
107
  return `Saved memory "${key}".`;
71
108
  }
72
109
  async function readEntry(dir, key) {
73
110
  try {
74
- return await _promises.readFile.call(void 0, _path.join.call(void 0, dir, `${key}.md`), "utf-8");
111
+ return await _chunkBIAODQ2Pcjs.readTextContent.call(void 0, _path.join.call(void 0, dir, `${key}.md`));
75
112
  } catch (e) {
76
113
  return `Error [memory]: Key "${key}" not found.`;
77
114
  }
78
115
  }
79
116
  async function listKeys(dir) {
80
117
  try {
81
- const files = await _promises.readdir.call(void 0, dir);
118
+ const files = await _chunkBIAODQ2Pcjs.listDirectory.call(void 0, dir);
82
119
  const keys = files.filter((f) => f.endsWith(".md")).map((f) => f.slice(0, -3));
83
120
  if (keys.length === 0) return "No memory entries found.";
84
121
  return keys.join("\n");
@@ -88,7 +125,7 @@ async function listKeys(dir) {
88
125
  }
89
126
  async function deleteEntry(dir, key) {
90
127
  try {
91
- await _promises.unlink.call(void 0, _path.join.call(void 0, dir, `${key}.md`));
128
+ await _chunkBIAODQ2Pcjs.removeFile.call(void 0, _path.join.call(void 0, dir, `${key}.md`));
92
129
  return `Deleted memory "${key}".`;
93
130
  } catch (e3) {
94
131
  return `Error [memory]: Key "${key}" not found.`;
@@ -99,4 +136,5 @@ var memory = createMemory();
99
136
 
100
137
 
101
138
 
102
- exports.createMemory = createMemory; exports.memory = memory;
139
+
140
+ exports.getPrompt = getPrompt; exports.createMemory = createMemory; exports.memory = memory;
@@ -0,0 +1,69 @@
1
+ import {
2
+ extractErrorMessage
3
+ } from "./chunk-X6ZY2KFU.js";
4
+
5
+ // src/sleep/index.ts
6
+ import { tool, zodSchema } from "ai";
7
+ import { z } from "zod";
8
+
9
+ // src/sleep/prompt.ts
10
+ function getPrompt(config = {}) {
11
+ const maxDuration = config.maxDuration ?? 3e5;
12
+ const maxSec = maxDuration / 1e3;
13
+ return `Pause execution for a specified duration. Maximum duration: ${maxSec} seconds (${maxDuration}ms).
14
+
15
+ ## When to Use
16
+ - When rate-limited by an external API and need to wait before retrying
17
+ - When waiting for an external process to complete
18
+ - Prefer this over shell sleep commands \u2014 it doesn't hold a shell process
19
+
20
+ ## When NOT to Use
21
+ - Don't sleep between commands that can run immediately \u2014 just run them
22
+ - Don't retry failing commands in a sleep loop \u2014 diagnose the root cause first
23
+ - Avoid long sleeps that block the user \u2014 keep durations short when possible
24
+
25
+ ## Usage Guidelines
26
+ - Durations exceeding the maximum are automatically clamped to ${maxDuration}ms
27
+ - Provide a \`reason\` parameter to document why the sleep is needed
28
+ - Each sleep costs an API turn \u2014 use judiciously`;
29
+ }
30
+
31
+ // src/sleep/index.ts
32
+ function createSleep(config = {}) {
33
+ const maxDuration = config.maxDuration ?? 3e5;
34
+ return tool({
35
+ description: config.description ?? getPrompt(config),
36
+ inputSchema: zodSchema(
37
+ z.object({
38
+ durationMs: z.number().describe("Duration to sleep in milliseconds"),
39
+ reason: z.string().optional().describe("Optional reason for the sleep")
40
+ })
41
+ ),
42
+ execute: async ({ durationMs, reason }) => {
43
+ try {
44
+ const clamped = Math.max(0, Math.min(durationMs, maxDuration));
45
+ const start = Date.now();
46
+ await new Promise((resolve) => setTimeout(resolve, clamped));
47
+ const elapsed = Date.now() - start;
48
+ const parts = [`Slept for ${elapsed}ms`];
49
+ if (reason) parts.push(`Reason: ${reason}`);
50
+ if (clamped !== durationMs) {
51
+ parts.push(
52
+ `(clamped from ${durationMs}ms to ${clamped}ms, max: ${maxDuration}ms)`
53
+ );
54
+ }
55
+ return parts.join(". ");
56
+ } catch (error) {
57
+ const message = extractErrorMessage(error);
58
+ return `Sleep failed: ${message}`;
59
+ }
60
+ }
61
+ });
62
+ }
63
+ var sleep = createSleep();
64
+
65
+ export {
66
+ getPrompt,
67
+ createSleep,
68
+ sleep
69
+ };
@@ -1,10 +1,45 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/lsp/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkBIAODQ2Pcjs = require('./chunk-BIAODQ2P.cjs');
4
+
5
+
6
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
7
+
8
+ // src/lsp/index.ts
2
9
  var _ai = require('ai');
3
10
  var _zod = require('zod');
4
11
  var _child_process = require('child_process');
5
- var _promises = require('fs/promises');
6
12
  var _url = require('url');
7
13
  var _path = require('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 _promises.readFile.call(void 0, absolutePath, "utf-8");
161
+ const content = await _chunkBIAODQ2Pcjs.readTextContent.call(void 0, absolutePath);
127
162
  const langId = _path.extname.call(void 0, 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 = _nullishCoalesce(config.timeout, () => ( 3e4));
160
195
  return _ai.tool.call(void 0, {
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: _nullishCoalesce(config.description, () => ( getPrompt())),
162
197
  inputSchema: _zod.z.object({
163
198
  operation: _zod.z.enum(LSP_OPERATIONS).describe("The LSP operation to perform"),
164
199
  filePath: _zod.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 = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
186
221
  return `Error [lsp]: ${operation} failed for ${filePath}: ${msg}`;
187
222
  }
188
223
  }
@@ -194,4 +229,5 @@ var lsp = createLsp();
194
229
 
195
230
 
196
231
 
197
- exports.executeLspOperation = executeLspOperation; exports.createLsp = createLsp; exports.lsp = lsp;
232
+
233
+ exports.getPrompt = getPrompt; exports.executeLspOperation = executeLspOperation; exports.createLsp = createLsp; exports.lsp = lsp;