agentool 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +132 -21
  2. package/dist/ask-user/index.cjs +5 -2
  3. package/dist/ask-user/index.d.cts +10 -1
  4. package/dist/ask-user/index.d.ts +10 -1
  5. package/dist/ask-user/index.js +5 -2
  6. package/dist/bash/index.cjs +5 -2
  7. package/dist/bash/index.d.cts +14 -1
  8. package/dist/bash/index.d.ts +14 -1
  9. package/dist/bash/index.js +5 -2
  10. package/dist/chunk-2JBLVFB7.cjs +74 -0
  11. package/dist/{chunk-K77GC2QI.js → chunk-2JF3ZF2J.js} +32 -2
  12. package/dist/{chunk-XKG2A3EW.js → chunk-2WSZCOJP.js} +54 -18
  13. package/dist/chunk-3FT4ZPB2.cjs +65 -0
  14. package/dist/{chunk-VLNDEVKS.js → chunk-3LGXZLBH.js} +46 -8
  15. package/dist/{chunk-G3ITTPGX.js → chunk-4MXDQEPA.js} +12 -1
  16. package/dist/{chunk-CGTPF6IS.js → chunk-4UUSERSH.js} +31 -7
  17. package/dist/{chunk-I6KFFQPV.cjs → chunk-5T3SQYI4.cjs} +34 -4
  18. package/dist/chunk-6ULQG2W2.cjs +99 -0
  19. package/dist/chunk-ABXTBB2N.cjs +67 -0
  20. package/dist/{chunk-CAEVLIQB.cjs → chunk-BIAODQ2P.cjs} +17 -1
  21. package/dist/chunk-CJA76MKM.js +59 -0
  22. package/dist/chunk-CM3VRCNX.cjs +59 -0
  23. package/dist/{chunk-SUSAPI5W.cjs → chunk-CXBWF5ON.cjs} +51 -4
  24. package/dist/{chunk-U2YMJM25.cjs → chunk-G6ZVJA4V.cjs} +31 -8
  25. package/dist/chunk-GPHCXS2S.js +99 -0
  26. package/dist/chunk-HG5T47NA.cjs +77 -0
  27. package/dist/chunk-HO4NIRU5.js +65 -0
  28. package/dist/{chunk-HZAQRHBT.js → chunk-IBC4QCGR.js} +27 -2
  29. package/dist/chunk-JYTOARJV.cjs +69 -0
  30. package/dist/chunk-KONXT2SF.cjs +8 -0
  31. package/dist/chunk-KUFZFNPT.cjs +61 -0
  32. package/dist/chunk-L7R4UZSK.js +61 -0
  33. package/dist/{chunk-FV2R5FFQ.cjs → chunk-LNAR3NJQ.cjs} +47 -9
  34. package/dist/chunk-M74OQYNK.js +69 -0
  35. package/dist/{chunk-IMZQ7ELK.cjs → chunk-NQIV6LBH.cjs} +51 -14
  36. package/dist/chunk-NTGDU5X3.js +67 -0
  37. package/dist/{chunk-ONBH74ZV.cjs → chunk-OYLTQJXT.cjs} +32 -8
  38. package/dist/{chunk-6PQLFDGT.js → chunk-PWBVB6MN.js} +17 -1
  39. package/dist/{chunk-QEJV2KZ4.cjs → chunk-RIGL3JTS.cjs} +55 -19
  40. package/dist/chunk-SFDZRLSX.cjs +91 -0
  41. package/dist/chunk-T6STO7PS.cjs +126 -0
  42. package/dist/{chunk-LPV5CN2K.js → chunk-TI4ZZ3IJ.js} +32 -2
  43. package/dist/chunk-TM5L4HA5.js +126 -0
  44. package/dist/{chunk-4YI2H55A.js → chunk-TXZ3BMMR.js} +49 -2
  45. package/dist/chunk-UCA6LURO.js +74 -0
  46. package/dist/{chunk-EA3YV7ZG.js → chunk-VE4U27HI.js} +35 -15
  47. package/dist/chunk-VHLY7LQE.js +53 -0
  48. package/dist/{chunk-FW3UJ622.cjs → chunk-VPRUYL4T.cjs} +34 -4
  49. package/dist/{chunk-3VO6NETR.cjs → chunk-VPV6WG5V.cjs} +41 -21
  50. package/dist/chunk-VQSWMGG7.cjs +53 -0
  51. package/dist/{chunk-Y7KOKDFP.js → chunk-VZRXTFS4.js} +29 -6
  52. package/dist/chunk-WCR62UZ3.js +67 -0
  53. package/dist/chunk-X6ZY2KFU.js +8 -0
  54. package/dist/chunk-XGDE7S2D.cjs +67 -0
  55. package/dist/chunk-XPTW45XY.js +77 -0
  56. package/dist/{chunk-YPPPGGLA.cjs → chunk-YCWJVQYO.cjs} +28 -3
  57. package/dist/chunk-YGXLT6SS.js +91 -0
  58. package/dist/{chunk-5NW4OGRI.cjs → chunk-YTPZHJDC.cjs} +12 -1
  59. package/dist/{chunk-6MDPYALY.js → chunk-ZHVRP3EH.js} +49 -12
  60. package/dist/context-compaction/index.cjs +5 -2
  61. package/dist/context-compaction/index.d.cts +11 -1
  62. package/dist/context-compaction/index.d.ts +11 -1
  63. package/dist/context-compaction/index.js +5 -2
  64. package/dist/diff/index.cjs +6 -2
  65. package/dist/diff/index.d.cts +12 -2
  66. package/dist/diff/index.d.ts +12 -2
  67. package/dist/diff/index.js +7 -3
  68. package/dist/edit/index.cjs +7 -3
  69. package/dist/edit/index.d.cts +15 -5
  70. package/dist/edit/index.d.ts +15 -5
  71. package/dist/edit/index.js +8 -4
  72. package/dist/glob/index.cjs +5 -2
  73. package/dist/glob/index.d.cts +13 -3
  74. package/dist/glob/index.d.ts +13 -3
  75. package/dist/glob/index.js +5 -2
  76. package/dist/grep/index.cjs +6 -2
  77. package/dist/grep/index.d.cts +13 -3
  78. package/dist/grep/index.d.ts +13 -3
  79. package/dist/grep/index.js +6 -2
  80. package/dist/http-request/index.cjs +5 -2
  81. package/dist/http-request/index.d.cts +11 -1
  82. package/dist/http-request/index.d.ts +11 -1
  83. package/dist/http-request/index.js +5 -2
  84. package/dist/index.cjs +93 -19
  85. package/dist/index.d.cts +21 -16
  86. package/dist/index.d.ts +21 -16
  87. package/dist/index.js +113 -39
  88. package/dist/lsp/index.cjs +6 -2
  89. package/dist/lsp/index.d.cts +16 -10
  90. package/dist/lsp/index.d.ts +16 -10
  91. package/dist/lsp/index.js +6 -2
  92. package/dist/memory/index.cjs +6 -2
  93. package/dist/memory/index.d.cts +10 -1
  94. package/dist/memory/index.d.ts +10 -1
  95. package/dist/memory/index.js +6 -2
  96. package/dist/multi-edit/index.cjs +7 -4
  97. package/dist/multi-edit/index.d.cts +12 -2
  98. package/dist/multi-edit/index.d.ts +12 -2
  99. package/dist/multi-edit/index.js +7 -4
  100. package/dist/read/index.cjs +6 -3
  101. package/dist/read/index.d.cts +11 -1
  102. package/dist/read/index.d.ts +11 -1
  103. package/dist/read/index.js +6 -3
  104. package/dist/sleep/index.cjs +5 -2
  105. package/dist/sleep/index.d.cts +11 -1
  106. package/dist/sleep/index.d.ts +11 -1
  107. package/dist/sleep/index.js +5 -2
  108. package/dist/task-create/index.cjs +13 -0
  109. package/dist/task-create/index.d.cts +28 -0
  110. package/dist/task-create/index.d.ts +28 -0
  111. package/dist/task-create/index.js +13 -0
  112. package/dist/task-get/index.cjs +13 -0
  113. package/dist/task-get/index.d.cts +24 -0
  114. package/dist/task-get/index.d.ts +24 -0
  115. package/dist/task-get/index.js +13 -0
  116. package/dist/task-list/index.cjs +13 -0
  117. package/dist/task-list/index.d.cts +20 -0
  118. package/dist/task-list/index.d.ts +20 -0
  119. package/dist/task-list/index.js +13 -0
  120. package/dist/task-update/index.cjs +13 -0
  121. package/dist/task-update/index.d.cts +40 -0
  122. package/dist/task-update/index.d.ts +40 -0
  123. package/dist/task-update/index.js +13 -0
  124. package/dist/tool-search/index.cjs +11 -0
  125. package/dist/tool-search/index.d.cts +27 -0
  126. package/dist/tool-search/index.d.ts +27 -0
  127. package/dist/tool-search/index.js +11 -0
  128. package/dist/web-fetch/index.cjs +5 -2
  129. package/dist/web-fetch/index.d.cts +11 -3
  130. package/dist/web-fetch/index.d.ts +11 -3
  131. package/dist/web-fetch/index.js +5 -2
  132. package/dist/web-search/index.cjs +11 -0
  133. package/dist/web-search/index.d.cts +30 -0
  134. package/dist/web-search/index.d.ts +30 -0
  135. package/dist/web-search/index.js +11 -0
  136. package/dist/write/index.cjs +6 -3
  137. package/dist/write/index.d.cts +13 -3
  138. package/dist/write/index.d.ts +13 -3
  139. package/dist/write/index.js +6 -3
  140. package/package.json +31 -6
  141. package/dist/chunk-3EPGFWZV.cjs +0 -30
  142. package/dist/chunk-7QL4BQCH.js +0 -40
  143. package/dist/chunk-FAEGCFTO.js +0 -136
  144. package/dist/chunk-HDKXSKMO.js +0 -30
  145. package/dist/chunk-JCTBB7H2.cjs +0 -40
  146. package/dist/chunk-MF7CJVIZ.js +0 -40
  147. package/dist/chunk-MXFW3XY6.cjs +0 -73
  148. package/dist/chunk-OXLQ7QVL.cjs +0 -40
  149. package/dist/chunk-S6QEY7UY.js +0 -73
  150. package/dist/chunk-TBVHHF3H.cjs +0 -47
  151. package/dist/chunk-XLD2Y3SS.cjs +0 -136
  152. package/dist/chunk-ZHCMEQJJ.js +0 -47
  153. package/dist/task/index.cjs +0 -8
  154. package/dist/task/index.d.cts +0 -67
  155. package/dist/task/index.d.ts +0 -67
  156. package/dist/task/index.js +0 -8
@@ -0,0 +1,53 @@
1
+ import {
2
+ readTextContent,
3
+ writeTextContent
4
+ } from "./chunk-PWBVB6MN.js";
5
+
6
+ // src/shared/task-store.ts
7
+ import { randomBytes } from "crypto";
8
+ function generateId() {
9
+ return randomBytes(4).toString("hex");
10
+ }
11
+ async function loadTasks(filePath) {
12
+ try {
13
+ const data = await readTextContent(filePath);
14
+ return JSON.parse(data);
15
+ } catch {
16
+ return [];
17
+ }
18
+ }
19
+ async function saveTasks(filePath, tasks) {
20
+ await writeTextContent(filePath, JSON.stringify(tasks, null, 2));
21
+ }
22
+ function formatTask(t) {
23
+ const lines = [
24
+ `ID: ${t.id}`,
25
+ `Subject: ${t.subject}`,
26
+ `Description: ${t.description}`,
27
+ `Status: ${t.status}`
28
+ ];
29
+ if (t.owner) lines.push(`Owner: ${t.owner}`);
30
+ if (t.activeForm) lines.push(`Active: ${t.activeForm}`);
31
+ if (t.blocks.length > 0) lines.push(`Blocks: ${t.blocks.join(", ")}`);
32
+ if (t.blockedBy.length > 0) lines.push(`Blocked by: ${t.blockedBy.join(", ")}`);
33
+ if (t.metadata && Object.keys(t.metadata).length > 0) {
34
+ lines.push(`Metadata: ${JSON.stringify(t.metadata)}`);
35
+ }
36
+ lines.push(`Created: ${t.createdAt}`);
37
+ lines.push(`Updated: ${t.updatedAt}`);
38
+ return lines.join("\n");
39
+ }
40
+ function formatTaskSummary(t) {
41
+ const parts = [`#${t.id} [${t.status}] ${t.subject}`];
42
+ if (t.owner) parts.push(`(owner: ${t.owner})`);
43
+ if (t.blockedBy.length > 0) parts.push(`[blocked by ${t.blockedBy.join(", ")}]`);
44
+ return parts.join(" ");
45
+ }
46
+
47
+ export {
48
+ generateId,
49
+ loadTasks,
50
+ saveTasks,
51
+ formatTask,
52
+ formatTaskSummary
53
+ };
@@ -1,6 +1,35 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/context-compaction/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 _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
4
+
5
+ // src/context-compaction/index.ts
2
6
  var _ai = require('ai');
3
7
  var _zod = require('zod');
8
+
9
+ // src/context-compaction/prompt.ts
10
+ function getPrompt(config = {}) {
11
+ const maxTokens = _nullishCoalesce(config.maxTokens, () => ( 4096));
12
+ return `Compact conversation history by summarizing older messages to reduce context size. Target budget: ${maxTokens} tokens.
13
+
14
+ Requires a summarize callback to be configured \u2014 the application provides the summarization implementation.
15
+
16
+ ## When to Use
17
+ - When the conversation is getting long and approaching context limits
18
+ - When earlier messages contain details no longer relevant to the current task
19
+ - To free up context space for new work without losing important context
20
+
21
+ ## When NOT to Use
22
+ - When the conversation is still within budget \u2014 the tool returns early if already compact
23
+ - When every message contains critical details that shouldn't be summarized
24
+ - For persisting information long-term \u2014 use the memory tool instead
25
+
26
+ ## Usage Guidelines
27
+ - Messages already within the token budget (${maxTokens} tokens, ~${maxTokens * 4} characters) are returned unchanged
28
+ - The summarize callback receives all messages and should return a condensed summary
29
+ - The result replaces the original messages with a single system message containing the summary`;
30
+ }
31
+
32
+ // src/context-compaction/index.ts
4
33
  var parametersSchema = _zod.z.object({
5
34
  messages: _zod.z.array(
6
35
  _zod.z.object({
@@ -14,7 +43,7 @@ var parametersSchema = _zod.z.object({
14
43
  });
15
44
  function createContextCompaction(config = {}) {
16
45
  return _ai.tool.call(void 0, {
17
- description: "Compact conversation history by summarizing older messages to reduce context size. Requires a summarize function in config. Returns compacted messages where total chars < maxTokens * 4.",
46
+ description: _nullishCoalesce(config.description, () => ( getPrompt(config))),
18
47
  inputSchema: _ai.zodSchema.call(void 0, parametersSchema),
19
48
  execute: async ({
20
49
  messages,
@@ -45,7 +74,7 @@ function createContextCompaction(config = {}) {
45
74
  originalCount: messages.length
46
75
  });
47
76
  } catch (error) {
48
- const msg = error instanceof Error ? error.message : String(error);
77
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
49
78
  return `Error [context-compaction]: Summarization failed: ${msg}`;
50
79
  }
51
80
  }
@@ -56,4 +85,5 @@ var contextCompaction = createContextCompaction();
56
85
 
57
86
 
58
87
 
59
- exports.createContextCompaction = createContextCompaction; exports.contextCompaction = contextCompaction;
88
+
89
+ exports.getPrompt = getPrompt; exports.createContextCompaction = createContextCompaction; exports.contextCompaction = contextCompaction;
@@ -2,32 +2,51 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk5NW4OGRIcjs = require('./chunk-5NW4OGRI.cjs');
6
5
 
6
+ var _chunkYTPZHJDCcjs = require('./chunk-YTPZHJDC.cjs');
7
7
 
8
- var _chunkCAEVLIQBcjs = require('./chunk-CAEVLIQB.cjs');
8
+
9
+
10
+ var _chunkBIAODQ2Pcjs = require('./chunk-BIAODQ2P.cjs');
9
11
 
10
12
 
11
13
  var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
12
14
 
15
+
16
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
17
+
13
18
  // src/multi-edit/index.ts
14
- var _promises = require('fs/promises');
15
19
  var _ai = require('ai');
16
20
  var _zod = require('zod');
17
- function countOccurrences(text, search) {
18
- if (search.length === 0) return 0;
19
- let count = 0;
20
- let pos = 0;
21
- while ((pos = text.indexOf(search, pos)) !== -1) {
22
- count++;
23
- pos += search.length;
24
- }
25
- return count;
21
+
22
+ // src/multi-edit/prompt.ts
23
+ function getPrompt() {
24
+ return `Atomically apply multiple text edits to a single file. All edits succeed together or none are applied.
25
+
26
+ Each edit replaces one occurrence of old_string with new_string. Edits are applied sequentially in the order provided.
27
+
28
+ ## When to Use
29
+ - When you need to make several related changes to the same file in one operation
30
+ - When changes depend on each other and partial application would leave the file in a broken state
31
+ - To rename a variable in multiple locations within the same file
32
+
33
+ ## When NOT to Use
34
+ - For a single edit \u2014 use the regular file editing tool instead (simpler)
35
+ - For changes across multiple files \u2014 make separate edit calls per file
36
+ - For creating new files \u2014 use the file writing tool instead
37
+
38
+ ## Usage Guidelines
39
+ - If any edit fails (old_string not found or not unique), the entire batch is rolled back \u2014 the file stays unchanged
40
+ - Each old_string must appear exactly once in the file at the time that edit is applied
41
+ - Edits are applied in order, so later edits see the result of earlier ones
42
+ - Supports curly-quote fallback matching and quote-style preservation`;
26
43
  }
44
+
45
+ // src/multi-edit/index.ts
27
46
  function createMultiEdit(config = {}) {
28
47
  const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
29
48
  return _ai.tool.call(void 0, {
30
- description: "Atomically apply multiple text edits to a single file. All edits succeed together or none are applied (rollback on failure). Each edit replaces one occurrence of old_string with new_string. Edits are applied sequentially in the order provided.",
49
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
31
50
  inputSchema: _zod.z.object({
32
51
  file_path: _zod.z.string().describe("Path to the file to edit (absolute or relative to cwd)"),
33
52
  edits: _zod.z.array(
@@ -43,29 +62,29 @@ function createMultiEdit(config = {}) {
43
62
  return "No edits provided. File unchanged.";
44
63
  }
45
64
  const resolvedPath = _chunkQZ5GS6HWcjs.expandPath.call(void 0, file_path, cwd);
46
- const originalContent = await _promises.readFile.call(void 0, resolvedPath, "utf-8");
65
+ const originalContent = await _chunkBIAODQ2Pcjs.readTextContent.call(void 0, resolvedPath);
47
66
  let content = originalContent;
48
67
  for (let i = 0; i < edits.length; i++) {
49
68
  const edit = edits[i];
50
- const actualOldString = _chunk5NW4OGRIcjs.findActualString.call(void 0, content, edit.old_string);
69
+ const actualOldString = _chunkYTPZHJDCcjs.findActualString.call(void 0, content, edit.old_string);
51
70
  if (actualOldString === null) {
52
71
  return `Error [multi-edit]: Edit ${i + 1}/${edits.length} failed \u2014 old_string not found in file. No edits were applied. File: ${resolvedPath}`;
53
72
  }
54
- const occurrences = countOccurrences(content, actualOldString);
73
+ const occurrences = _chunkYTPZHJDCcjs.countOccurrences.call(void 0, content, actualOldString);
55
74
  if (occurrences > 1) {
56
75
  return `Error [multi-edit]: Edit ${i + 1}/${edits.length} failed \u2014 old_string matches ${occurrences} locations (must be unique). No edits were applied. File: ${resolvedPath}`;
57
76
  }
58
- const styledNewString = _chunk5NW4OGRIcjs.preserveQuoteStyle.call(void 0,
77
+ const styledNewString = _chunkYTPZHJDCcjs.preserveQuoteStyle.call(void 0,
59
78
  edit.old_string,
60
79
  actualOldString,
61
80
  edit.new_string
62
81
  );
63
- content = _chunk5NW4OGRIcjs.applyEditToFile.call(void 0, content, actualOldString, styledNewString);
82
+ content = _chunkYTPZHJDCcjs.applyEditToFile.call(void 0, content, actualOldString, styledNewString);
64
83
  }
65
- await _chunkCAEVLIQBcjs.writeTextContent.call(void 0, resolvedPath, content);
84
+ await _chunkBIAODQ2Pcjs.writeTextContent.call(void 0, resolvedPath, content);
66
85
  return `Successfully applied ${edits.length} edit${edits.length === 1 ? "" : "s"} to ${resolvedPath}`;
67
86
  } catch (error) {
68
- const msg = error instanceof Error ? error.message : String(error);
87
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
69
88
  return `Error [multi-edit]: ${msg}`;
70
89
  }
71
90
  }
@@ -76,4 +95,5 @@ var multiEdit = createMultiEdit();
76
95
 
77
96
 
78
97
 
79
- exports.createMultiEdit = createMultiEdit; exports.multiEdit = multiEdit;
98
+
99
+ exports.getPrompt = getPrompt; exports.createMultiEdit = createMultiEdit; exports.multiEdit = multiEdit;
@@ -0,0 +1,53 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkBIAODQ2Pcjs = require('./chunk-BIAODQ2P.cjs');
5
+
6
+ // src/shared/task-store.ts
7
+ var _crypto = require('crypto');
8
+ function generateId() {
9
+ return _crypto.randomBytes.call(void 0, 4).toString("hex");
10
+ }
11
+ async function loadTasks(filePath) {
12
+ try {
13
+ const data = await _chunkBIAODQ2Pcjs.readTextContent.call(void 0, filePath);
14
+ return JSON.parse(data);
15
+ } catch (e) {
16
+ return [];
17
+ }
18
+ }
19
+ async function saveTasks(filePath, tasks) {
20
+ await _chunkBIAODQ2Pcjs.writeTextContent.call(void 0, filePath, JSON.stringify(tasks, null, 2));
21
+ }
22
+ function formatTask(t) {
23
+ const lines = [
24
+ `ID: ${t.id}`,
25
+ `Subject: ${t.subject}`,
26
+ `Description: ${t.description}`,
27
+ `Status: ${t.status}`
28
+ ];
29
+ if (t.owner) lines.push(`Owner: ${t.owner}`);
30
+ if (t.activeForm) lines.push(`Active: ${t.activeForm}`);
31
+ if (t.blocks.length > 0) lines.push(`Blocks: ${t.blocks.join(", ")}`);
32
+ if (t.blockedBy.length > 0) lines.push(`Blocked by: ${t.blockedBy.join(", ")}`);
33
+ if (t.metadata && Object.keys(t.metadata).length > 0) {
34
+ lines.push(`Metadata: ${JSON.stringify(t.metadata)}`);
35
+ }
36
+ lines.push(`Created: ${t.createdAt}`);
37
+ lines.push(`Updated: ${t.updatedAt}`);
38
+ return lines.join("\n");
39
+ }
40
+ function formatTaskSummary(t) {
41
+ const parts = [`#${t.id} [${t.status}] ${t.subject}`];
42
+ if (t.owner) parts.push(`(owner: ${t.owner})`);
43
+ if (t.blockedBy.length > 0) parts.push(`[blocked by ${t.blockedBy.join(", ")}]`);
44
+ return parts.join(" ");
45
+ }
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+ exports.generateId = generateId; exports.loadTasks = loadTasks; exports.saveTasks = saveTasks; exports.formatTask = formatTask; exports.formatTaskSummary = formatTaskSummary;
@@ -1,3 +1,7 @@
1
+ import {
2
+ extractErrorMessage
3
+ } from "./chunk-X6ZY2KFU.js";
4
+
1
5
  // src/web-fetch/index.ts
2
6
  import { tool } from "ai";
3
7
  import { z } from "zod";
@@ -73,15 +77,33 @@ async function fetchUrl(url, options) {
73
77
  };
74
78
  }
75
79
 
80
+ // src/web-fetch/prompt.ts
81
+ function getPrompt(config = {}) {
82
+ const timeout = config.timeout ?? 3e4;
83
+ return `Fetch a URL and return its content. HTML pages are automatically converted to markdown for easier reading. JSON and other text content is returned as-is.
84
+
85
+ ## When to Use
86
+ - To retrieve and read web page content, documentation, or articles
87
+ - To fetch API responses, JSON data, or raw text from URLs
88
+ - To check what a web page contains
89
+
90
+ ## When NOT to Use
91
+ - For API interactions that need custom HTTP methods (POST, PUT, DELETE) \u2014 use the dedicated HTTP request tool instead
92
+ - For searching the web \u2014 use the dedicated web search tool instead
93
+
94
+ ## Usage Guidelines
95
+ - Content is truncated at 100,000 characters to manage context size
96
+ - The URL must be a fully-formed valid URL (e.g., https://example.com)
97
+ - Timeout: ${timeout}ms
98
+ - This tool is read-only \u2014 it does not modify any files or state`;
99
+ }
100
+
76
101
  // src/web-fetch/index.ts
77
102
  function createWebFetch(config = {}) {
78
103
  return tool({
79
- description: "Fetch a URL and return its content. HTML pages are automatically converted to markdown for easier reading. JSON and other text content is returned as-is. Content is truncated at 100,000 characters to manage context size.",
104
+ description: config.description ?? getPrompt(config),
80
105
  inputSchema: z.object({
81
- url: z.string().describe("The URL to fetch"),
82
- prompt: z.string().optional().describe(
83
- "Optional context about what to extract from the page"
84
- )
106
+ url: z.string().url().describe("The URL to fetch")
85
107
  }),
86
108
  execute: async ({ url }) => {
87
109
  try {
@@ -101,7 +123,7 @@ function createWebFetch(config = {}) {
101
123
  parts.push(result.content);
102
124
  return parts.join("\n");
103
125
  } catch (error) {
104
- const msg = error instanceof Error ? error.message : String(error);
126
+ const msg = extractErrorMessage(error);
105
127
  return `Error [web-fetch]: Failed to fetch ${url}: ${msg}`;
106
128
  }
107
129
  }
@@ -110,6 +132,7 @@ function createWebFetch(config = {}) {
110
132
  var webFetch = createWebFetch();
111
133
 
112
134
  export {
135
+ getPrompt,
113
136
  createWebFetch,
114
137
  webFetch
115
138
  };
@@ -0,0 +1,67 @@
1
+ import {
2
+ formatTask,
3
+ loadTasks
4
+ } from "./chunk-VHLY7LQE.js";
5
+ import {
6
+ extractErrorMessage
7
+ } from "./chunk-X6ZY2KFU.js";
8
+
9
+ // src/task-get/index.ts
10
+ import { tool } from "ai";
11
+ import { z } from "zod";
12
+ import { join } from "path";
13
+
14
+ // src/task-get/prompt.ts
15
+ function getPrompt() {
16
+ return `Retrieve a task by its ID to see full details including description, dependencies, and metadata.
17
+
18
+ ## When to Use
19
+ - Before starting work on a task \u2014 read the full description and requirements
20
+ - To check a task's dependencies (what it blocks, what blocks it)
21
+ - To verify a task's current status before updating it
22
+ - When you need more detail than the task list summary provides
23
+
24
+ ## Output
25
+ Returns full task details:
26
+ - **id**, **subject**, **description**, **status**
27
+ - **owner**: Who is assigned (if set)
28
+ - **activeForm**: Present continuous label (if set)
29
+ - **blocks**: Tasks waiting on this one to complete
30
+ - **blockedBy**: Tasks that must complete before this one can start
31
+ - **metadata**: Attached key-value data
32
+ - **createdAt**, **updatedAt**: Timestamps
33
+
34
+ ## Tips
35
+ - Always verify a task's \`blockedBy\` list is empty before beginning work on it
36
+ - Use the task list tool to see all tasks in summary form, then this tool for details on specific ones`;
37
+ }
38
+
39
+ // src/task-get/index.ts
40
+ function createTaskGet(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
+ taskId: z.string().describe("The ID of the task to retrieve")
47
+ }),
48
+ execute: async ({ taskId }) => {
49
+ try {
50
+ const tasks = await loadTasks(tasksFile);
51
+ const found = tasks.find((t) => t.id === taskId);
52
+ if (!found) return `Error [task-get]: Task "${taskId}" not found.`;
53
+ return formatTask(found);
54
+ } catch (error) {
55
+ const msg = extractErrorMessage(error);
56
+ return `Error [task-get]: ${msg}`;
57
+ }
58
+ }
59
+ });
60
+ }
61
+ var taskGet = createTaskGet();
62
+
63
+ export {
64
+ getPrompt,
65
+ createTaskGet,
66
+ taskGet
67
+ };
@@ -0,0 +1,8 @@
1
+ // src/shared/errors.ts
2
+ function extractErrorMessage(error) {
3
+ return error instanceof Error ? error.message : String(error);
4
+ }
5
+
6
+ export {
7
+ extractErrorMessage
8
+ };
@@ -0,0 +1,67 @@
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 _chunkVQSWMGG7cjs = require('./chunk-VQSWMGG7.cjs');
5
+
6
+
7
+ var _chunkKONXT2SFcjs = require('./chunk-KONXT2SF.cjs');
8
+
9
+ // src/task-get/index.ts
10
+ var _ai = require('ai');
11
+ var _zod = require('zod');
12
+ var _path = require('path');
13
+
14
+ // src/task-get/prompt.ts
15
+ function getPrompt() {
16
+ return `Retrieve a task by its ID to see full details including description, dependencies, and metadata.
17
+
18
+ ## When to Use
19
+ - Before starting work on a task \u2014 read the full description and requirements
20
+ - To check a task's dependencies (what it blocks, what blocks it)
21
+ - To verify a task's current status before updating it
22
+ - When you need more detail than the task list summary provides
23
+
24
+ ## Output
25
+ Returns full task details:
26
+ - **id**, **subject**, **description**, **status**
27
+ - **owner**: Who is assigned (if set)
28
+ - **activeForm**: Present continuous label (if set)
29
+ - **blocks**: Tasks waiting on this one to complete
30
+ - **blockedBy**: Tasks that must complete before this one can start
31
+ - **metadata**: Attached key-value data
32
+ - **createdAt**, **updatedAt**: Timestamps
33
+
34
+ ## Tips
35
+ - Always verify a task's \`blockedBy\` list is empty before beginning work on it
36
+ - Use the task list tool to see all tasks in summary form, then this tool for details on specific ones`;
37
+ }
38
+
39
+ // src/task-get/index.ts
40
+ function createTaskGet(config = {}) {
41
+ const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
42
+ const tasksFile = _nullishCoalesce(config.tasksFile, () => ( _path.join.call(void 0, cwd, ".agentool", "tasks.json")));
43
+ return _ai.tool.call(void 0, {
44
+ description: _nullishCoalesce(config.description, () => ( getPrompt())),
45
+ inputSchema: _zod.z.object({
46
+ taskId: _zod.z.string().describe("The ID of the task to retrieve")
47
+ }),
48
+ execute: async ({ taskId }) => {
49
+ try {
50
+ const tasks = await _chunkVQSWMGG7cjs.loadTasks.call(void 0, tasksFile);
51
+ const found = tasks.find((t) => t.id === taskId);
52
+ if (!found) return `Error [task-get]: Task "${taskId}" not found.`;
53
+ return _chunkVQSWMGG7cjs.formatTask.call(void 0, found);
54
+ } catch (error) {
55
+ const msg = _chunkKONXT2SFcjs.extractErrorMessage.call(void 0, error);
56
+ return `Error [task-get]: ${msg}`;
57
+ }
58
+ }
59
+ });
60
+ }
61
+ var taskGet = createTaskGet();
62
+
63
+
64
+
65
+
66
+
67
+ exports.getPrompt = getPrompt; exports.createTaskGet = createTaskGet; exports.taskGet = taskGet;
@@ -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;