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
@@ -1,7 +1,17 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
3
3
 
4
- type WriteConfig = BaseToolConfig;
4
+ /**
5
+ * Generate the description prompt for the write tool.
6
+ *
7
+ * @returns The full description string for the write tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
11
+ type WriteConfig = BaseToolConfig & {
12
+ /** Override the default tool description. */
13
+ description?: string;
14
+ };
5
15
  /**
6
16
  * Creates a write tool that writes text content to a file.
7
17
  *
@@ -23,7 +33,7 @@ type WriteConfig = BaseToolConfig;
23
33
  * );
24
34
  * ```
25
35
  */
26
- declare function createWrite(config?: BaseToolConfig): ai.Tool<{
36
+ declare function createWrite(config?: WriteConfig): ai.Tool<{
27
37
  content: string;
28
38
  file_path: string;
29
39
  }, string>;
@@ -44,4 +54,4 @@ declare const write: ai.Tool<{
44
54
  file_path: string;
45
55
  }, string>;
46
56
 
47
- export { type WriteConfig, createWrite, write };
57
+ export { type WriteConfig, createWrite, write, getPrompt as writePrompt };
@@ -1,7 +1,17 @@
1
1
  import * as ai from 'ai';
2
2
  import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
3
3
 
4
- type WriteConfig = BaseToolConfig;
4
+ /**
5
+ * Generate the description prompt for the write tool.
6
+ *
7
+ * @returns The full description string for the write tool.
8
+ */
9
+ declare function getPrompt(): string;
10
+
11
+ type WriteConfig = BaseToolConfig & {
12
+ /** Override the default tool description. */
13
+ description?: string;
14
+ };
5
15
  /**
6
16
  * Creates a write tool that writes text content to a file.
7
17
  *
@@ -23,7 +33,7 @@ type WriteConfig = BaseToolConfig;
23
33
  * );
24
34
  * ```
25
35
  */
26
- declare function createWrite(config?: BaseToolConfig): ai.Tool<{
36
+ declare function createWrite(config?: WriteConfig): ai.Tool<{
27
37
  content: string;
28
38
  file_path: string;
29
39
  }, string>;
@@ -44,4 +54,4 @@ declare const write: ai.Tool<{
44
54
  file_path: string;
45
55
  }, string>;
46
56
 
47
- export { type WriteConfig, createWrite, write };
57
+ export { type WriteConfig, createWrite, write, getPrompt as writePrompt };
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  createWrite,
3
+ getPrompt,
3
4
  write
4
- } from "../chunk-ECYT46FP.js";
5
- import "../chunk-6PQLFDGT.js";
5
+ } from "../chunk-NTGDU5X3.js";
6
+ import "../chunk-PWBVB6MN.js";
6
7
  import "../chunk-I3ONDY7P.js";
8
+ import "../chunk-X6ZY2KFU.js";
7
9
  export {
8
10
  createWrite,
9
- write
11
+ write,
12
+ getPrompt as writePrompt
10
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentool",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "22 AI agent tools as standalone Vercel AI SDK modules",
6
6
  "author": "Z-M-Huang",
@@ -1,30 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/ask-user/index.ts
2
- var _ai = require('ai');
3
- var _zod = require('zod');
4
- function createAskUser(config = {}) {
5
- return _ai.tool.call(void 0, {
6
- description: "Ask the user a question and wait for their response. Use this when you need clarification, confirmation, or additional information from the user before proceeding.",
7
- inputSchema: _zod.z.object({
8
- question: _zod.z.string().describe("The question to ask the user"),
9
- options: _zod.z.array(_zod.z.string()).optional().describe("Optional list of suggested response options")
10
- }),
11
- execute: async ({ question, options }) => {
12
- if (!config.onQuestion) {
13
- return "Error [ask-user]: No onQuestion callback configured. Provide an onQuestion function in the tool config to enable user interaction.";
14
- }
15
- try {
16
- const response = await config.onQuestion(question, options);
17
- return response;
18
- } catch (error) {
19
- const msg = error instanceof Error ? error.message : String(error);
20
- return `Error [ask-user]: Failed to get user response: ${msg}`;
21
- }
22
- }
23
- });
24
- }
25
- var askUser = createAskUser();
26
-
27
-
28
-
29
-
30
- exports.createAskUser = createAskUser; exports.askUser = askUser;
@@ -1,30 +0,0 @@
1
- // src/web-search/index.ts
2
- import { tool } from "ai";
3
- import { z } from "zod";
4
- function createWebSearch(config = {}) {
5
- return tool({
6
- description: "Search the web for information using a search query. Results can be filtered by allowed or blocked domains.",
7
- inputSchema: z.object({
8
- query: z.string().min(2).describe("The search query to use"),
9
- allowed_domains: z.array(z.string()).optional().describe("Only include search results from these domains"),
10
- blocked_domains: z.array(z.string()).optional().describe("Never include search results from these domains")
11
- }),
12
- execute: async ({ query, allowed_domains, blocked_domains }) => {
13
- try {
14
- if (!config.onSearch) {
15
- return "Error [web-search]: No search callback configured. Provide onSearch via createWebSearch({ onSearch: async (query, opts) => ... })";
16
- }
17
- return await config.onSearch(query, { allowed_domains, blocked_domains });
18
- } catch (error) {
19
- const msg = error instanceof Error ? error.message : String(error);
20
- return `Error [web-search]: ${msg}`;
21
- }
22
- }
23
- });
24
- }
25
- var webSearch = createWebSearch();
26
-
27
- export {
28
- createWebSearch,
29
- webSearch
30
- };
@@ -1,36 +0,0 @@
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 _chunkL5JH4I77cjs = require('./chunk-L5JH4I77.cjs');
5
-
6
- // src/task-get/index.ts
7
- var _ai = require('ai');
8
- var _zod = require('zod');
9
- var _path = require('path');
10
- function createTaskGet(config = {}) {
11
- const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
12
- const tasksFile = _nullishCoalesce(config.tasksFile, () => ( _path.join.call(void 0, cwd, ".agentool", "tasks.json")));
13
- return _ai.tool.call(void 0, {
14
- description: "Retrieve a task by its ID to see full details.",
15
- inputSchema: _zod.z.object({
16
- taskId: _zod.z.string().describe("The ID of the task to retrieve")
17
- }),
18
- execute: async ({ taskId }) => {
19
- try {
20
- const tasks = await _chunkL5JH4I77cjs.loadTasks.call(void 0, tasksFile);
21
- const found = tasks.find((t) => t.id === taskId);
22
- if (!found) return `Error [task-get]: Task "${taskId}" not found.`;
23
- return _chunkL5JH4I77cjs.formatTask.call(void 0, found);
24
- } catch (error) {
25
- const msg = error instanceof Error ? error.message : String(error);
26
- return `Error [task-get]: ${msg}`;
27
- }
28
- }
29
- });
30
- }
31
- var taskGet = createTaskGet();
32
-
33
-
34
-
35
-
36
- exports.createTaskGet = createTaskGet; exports.taskGet = taskGet;
@@ -1,53 +0,0 @@
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 _chunkL5JH4I77cjs = require('./chunk-L5JH4I77.cjs');
7
-
8
- // src/task-create/index.ts
9
- var _ai = require('ai');
10
- var _zod = require('zod');
11
- var _path = require('path');
12
- function createTaskCreate(config = {}) {
13
- const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
14
- const tasksFile = _nullishCoalesce(config.tasksFile, () => ( _path.join.call(void 0, cwd, ".agentool", "tasks.json")));
15
- return _ai.tool.call(void 0, {
16
- description: 'Create a new task to track work. Each task gets a unique ID, starts with "pending" status, and can include optional metadata.',
17
- inputSchema: _zod.z.object({
18
- subject: _zod.z.string().describe("A brief title for the task"),
19
- description: _zod.z.string().describe("What needs to be done"),
20
- metadata: _zod.z.record(_zod.z.string(), _zod.z.unknown()).optional().describe("Arbitrary metadata to attach to the task")
21
- }),
22
- execute: async ({ subject, description, metadata }) => {
23
- try {
24
- const tasks = await _chunkL5JH4I77cjs.loadTasks.call(void 0, tasksFile);
25
- const now = (/* @__PURE__ */ new Date()).toISOString();
26
- const entry = {
27
- id: _chunkL5JH4I77cjs.generateId.call(void 0, ),
28
- subject,
29
- description,
30
- status: "pending",
31
- blocks: [],
32
- blockedBy: [],
33
- metadata,
34
- createdAt: now,
35
- updatedAt: now
36
- };
37
- tasks.push(entry);
38
- await _chunkL5JH4I77cjs.saveTasks.call(void 0, tasksFile, tasks);
39
- return `Created task ${entry.id}.
40
- ${_chunkL5JH4I77cjs.formatTask.call(void 0, entry)}`;
41
- } catch (error) {
42
- const msg = error instanceof Error ? error.message : String(error);
43
- return `Error [task-create]: ${msg}`;
44
- }
45
- }
46
- });
47
- }
48
- var taskCreate = createTaskCreate();
49
-
50
-
51
-
52
-
53
- exports.createTaskCreate = createTaskCreate; exports.taskCreate = taskCreate;
@@ -1,40 +0,0 @@
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 _chunkCAEVLIQBcjs = require('./chunk-CAEVLIQB.cjs');
5
-
6
-
7
- var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
8
-
9
- // src/write/index.ts
10
- var _ai = require('ai');
11
- var _zod = require('zod');
12
- function createWrite(config = {}) {
13
- const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
14
- return _ai.tool.call(void 0, {
15
- description: "Write text content to a file, creating parent directories as needed. If the file exists it is overwritten. Use this to create new files or replace existing file contents.",
16
- inputSchema: _zod.z.object({
17
- file_path: _zod.z.string().describe("The absolute path to the file to write (must be absolute, not relative)"),
18
- content: _zod.z.string().describe("Text content to write to the file")
19
- }),
20
- execute: async ({ file_path, content }) => {
21
- try {
22
- const absolutePath = _chunkQZ5GS6HWcjs.expandPath.call(void 0, file_path, cwd);
23
- const existed = await _chunkCAEVLIQBcjs.pathExists.call(void 0, absolutePath);
24
- await _chunkCAEVLIQBcjs.writeTextContent.call(void 0, absolutePath, content);
25
- const bytes = Buffer.byteLength(content, "utf-8");
26
- const verb = existed ? "Updated" : "Created";
27
- return `${verb} file: ${absolutePath} (${bytes} bytes)`;
28
- } catch (error) {
29
- const message = error instanceof Error ? error.message : String(error);
30
- return `Error [write]: Failed to write file: ${message}`;
31
- }
32
- }
33
- });
34
- }
35
- var write = createWrite();
36
-
37
-
38
-
39
-
40
- exports.createWrite = createWrite; exports.write = write;
@@ -1,47 +0,0 @@
1
- import {
2
- addLineNumbers,
3
- readFileInRange
4
- } from "./chunk-6PQLFDGT.js";
5
- import {
6
- expandPath
7
- } from "./chunk-I3ONDY7P.js";
8
-
9
- // src/read/index.ts
10
- import { tool } from "ai";
11
- import { z } from "zod";
12
- function createRead(config = {}) {
13
- const cwd = config.cwd ?? process.cwd();
14
- const defaultMaxLines = config.maxLines ?? 2e3;
15
- return tool({
16
- description: 'Read a file from the local filesystem and return its contents with line numbers. Supports absolute paths, relative paths (resolved against the working directory), and tilde (~) home directory expansion. Returns numbered lines in "lineNumber\\tcontent" format. Use offset and limit to read specific ranges of large files.',
17
- inputSchema: z.object({
18
- file_path: z.string().describe("The absolute path to the file to read"),
19
- offset: z.number().int().nonnegative().optional().describe("The line number to start reading from (default: 0)"),
20
- limit: z.number().int().positive().optional().describe("The number of lines to read (default: 2000)")
21
- }),
22
- execute: async ({ file_path, offset, limit }) => {
23
- try {
24
- const absolutePath = expandPath(file_path, cwd);
25
- const result = await readFileInRange(
26
- absolutePath,
27
- offset ?? 0,
28
- limit ?? defaultMaxLines
29
- );
30
- const numbered = addLineNumbers({
31
- content: result.content,
32
- startLine: (offset ?? 0) + 1
33
- });
34
- return numbered;
35
- } catch (error) {
36
- const msg = error instanceof Error ? error.message : String(error);
37
- return `Error [read]: ${msg}`;
38
- }
39
- }
40
- });
41
- }
42
- var read = createRead();
43
-
44
- export {
45
- createRead,
46
- read
47
- };
@@ -1,40 +0,0 @@
1
- import {
2
- pathExists,
3
- writeTextContent
4
- } from "./chunk-6PQLFDGT.js";
5
- import {
6
- expandPath
7
- } from "./chunk-I3ONDY7P.js";
8
-
9
- // src/write/index.ts
10
- import { tool } from "ai";
11
- import { z } from "zod";
12
- function createWrite(config = {}) {
13
- const cwd = config.cwd ?? process.cwd();
14
- return tool({
15
- description: "Write text content to a file, creating parent directories as needed. If the file exists it is overwritten. Use this to create new files or replace existing file contents.",
16
- inputSchema: z.object({
17
- file_path: z.string().describe("The absolute path to the file to write (must be absolute, not relative)"),
18
- content: z.string().describe("Text content to write to the file")
19
- }),
20
- execute: async ({ file_path, content }) => {
21
- try {
22
- const absolutePath = expandPath(file_path, cwd);
23
- const existed = await pathExists(absolutePath);
24
- await writeTextContent(absolutePath, content);
25
- const bytes = Buffer.byteLength(content, "utf-8");
26
- const verb = existed ? "Updated" : "Created";
27
- return `${verb} file: ${absolutePath} (${bytes} bytes)`;
28
- } catch (error) {
29
- const message = error instanceof Error ? error.message : String(error);
30
- return `Error [write]: Failed to write file: ${message}`;
31
- }
32
- }
33
- });
34
- }
35
- var write = createWrite();
36
-
37
- export {
38
- createWrite,
39
- write
40
- };
@@ -1,30 +0,0 @@
1
- // src/ask-user/index.ts
2
- import { tool } from "ai";
3
- import { z } from "zod";
4
- function createAskUser(config = {}) {
5
- return tool({
6
- description: "Ask the user a question and wait for their response. Use this when you need clarification, confirmation, or additional information from the user before proceeding.",
7
- inputSchema: z.object({
8
- question: z.string().describe("The question to ask the user"),
9
- options: z.array(z.string()).optional().describe("Optional list of suggested response options")
10
- }),
11
- execute: async ({ question, options }) => {
12
- if (!config.onQuestion) {
13
- return "Error [ask-user]: No onQuestion callback configured. Provide an onQuestion function in the tool config to enable user interaction.";
14
- }
15
- try {
16
- const response = await config.onQuestion(question, options);
17
- return response;
18
- } catch (error) {
19
- const msg = error instanceof Error ? error.message : String(error);
20
- return `Error [ask-user]: Failed to get user response: ${msg}`;
21
- }
22
- }
23
- });
24
- }
25
- var askUser = createAskUser();
26
-
27
- export {
28
- createAskUser,
29
- askUser
30
- };
@@ -1,34 +0,0 @@
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 _chunkL5JH4I77cjs = require('./chunk-L5JH4I77.cjs');
5
-
6
- // src/task-list/index.ts
7
- var _ai = require('ai');
8
- var _zod = require('zod');
9
- var _path = require('path');
10
- function createTaskList(config = {}) {
11
- const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
12
- const tasksFile = _nullishCoalesce(config.tasksFile, () => ( _path.join.call(void 0, cwd, ".agentool", "tasks.json")));
13
- return _ai.tool.call(void 0, {
14
- description: "List all tasks with their status, owner, and dependencies.",
15
- inputSchema: _zod.z.object({}),
16
- execute: async () => {
17
- try {
18
- const tasks = await _chunkL5JH4I77cjs.loadTasks.call(void 0, tasksFile);
19
- const visible = tasks.filter((t) => t.status !== "deleted");
20
- if (visible.length === 0) return "No tasks found.";
21
- return visible.map(_chunkL5JH4I77cjs.formatTaskSummary).join("\n");
22
- } catch (error) {
23
- const msg = error instanceof Error ? error.message : String(error);
24
- return `Error [task-list]: ${msg}`;
25
- }
26
- }
27
- });
28
- }
29
- var taskList = createTaskList();
30
-
31
-
32
-
33
-
34
- exports.createTaskList = createTaskList; exports.taskList = taskList;
@@ -1,30 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/web-search/index.ts
2
- var _ai = require('ai');
3
- var _zod = require('zod');
4
- function createWebSearch(config = {}) {
5
- return _ai.tool.call(void 0, {
6
- description: "Search the web for information using a search query. Results can be filtered by allowed or blocked domains.",
7
- inputSchema: _zod.z.object({
8
- query: _zod.z.string().min(2).describe("The search query to use"),
9
- allowed_domains: _zod.z.array(_zod.z.string()).optional().describe("Only include search results from these domains"),
10
- blocked_domains: _zod.z.array(_zod.z.string()).optional().describe("Never include search results from these domains")
11
- }),
12
- execute: async ({ query, allowed_domains, blocked_domains }) => {
13
- try {
14
- if (!config.onSearch) {
15
- return "Error [web-search]: No search callback configured. Provide onSearch via createWebSearch({ onSearch: async (query, opts) => ... })";
16
- }
17
- return await config.onSearch(query, { allowed_domains, blocked_domains });
18
- } catch (error) {
19
- const msg = error instanceof Error ? error.message : String(error);
20
- return `Error [web-search]: ${msg}`;
21
- }
22
- }
23
- });
24
- }
25
- var webSearch = createWebSearch();
26
-
27
-
28
-
29
-
30
- exports.createWebSearch = createWebSearch; exports.webSearch = webSearch;
@@ -1,53 +0,0 @@
1
- import {
2
- formatTask,
3
- generateId,
4
- loadTasks,
5
- saveTasks
6
- } from "./chunk-E6NBEYZD.js";
7
-
8
- // src/task-create/index.ts
9
- import { tool } from "ai";
10
- import { z } from "zod";
11
- import { join } from "path";
12
- function createTaskCreate(config = {}) {
13
- const cwd = config.cwd ?? process.cwd();
14
- const tasksFile = config.tasksFile ?? join(cwd, ".agentool", "tasks.json");
15
- return tool({
16
- description: 'Create a new task to track work. Each task gets a unique ID, starts with "pending" status, and can include optional metadata.',
17
- inputSchema: z.object({
18
- subject: z.string().describe("A brief title for the task"),
19
- description: z.string().describe("What needs to be done"),
20
- metadata: z.record(z.string(), z.unknown()).optional().describe("Arbitrary metadata to attach to the task")
21
- }),
22
- execute: async ({ subject, description, metadata }) => {
23
- try {
24
- const tasks = await loadTasks(tasksFile);
25
- const now = (/* @__PURE__ */ new Date()).toISOString();
26
- const entry = {
27
- id: generateId(),
28
- subject,
29
- description,
30
- status: "pending",
31
- blocks: [],
32
- blockedBy: [],
33
- metadata,
34
- createdAt: now,
35
- updatedAt: now
36
- };
37
- tasks.push(entry);
38
- await saveTasks(tasksFile, tasks);
39
- return `Created task ${entry.id}.
40
- ${formatTask(entry)}`;
41
- } catch (error) {
42
- const msg = error instanceof Error ? error.message : String(error);
43
- return `Error [task-create]: ${msg}`;
44
- }
45
- }
46
- });
47
- }
48
- var taskCreate = createTaskCreate();
49
-
50
- export {
51
- createTaskCreate,
52
- taskCreate
53
- };
@@ -1,40 +0,0 @@
1
- // src/sleep/index.ts
2
- import { tool, zodSchema } from "ai";
3
- import { z } from "zod";
4
- function createSleep(config = {}) {
5
- const maxDuration = config.maxDuration ?? 3e5;
6
- return tool({
7
- description: "Pause execution for a specified duration. Useful for rate limiting, polling intervals, or waiting for external processes. Maximum duration is 300 seconds (5 minutes).",
8
- inputSchema: zodSchema(
9
- z.object({
10
- durationMs: z.number().describe("Duration to sleep in milliseconds"),
11
- reason: z.string().optional().describe("Optional reason for the sleep")
12
- })
13
- ),
14
- execute: async ({ durationMs, reason }) => {
15
- try {
16
- const clamped = Math.max(0, Math.min(durationMs, maxDuration));
17
- const start = Date.now();
18
- await new Promise((resolve) => setTimeout(resolve, clamped));
19
- const elapsed = Date.now() - start;
20
- const parts = [`Slept for ${elapsed}ms`];
21
- if (reason) parts.push(`Reason: ${reason}`);
22
- if (clamped !== durationMs) {
23
- parts.push(
24
- `(clamped from ${durationMs}ms to ${clamped}ms, max: ${maxDuration}ms)`
25
- );
26
- }
27
- return parts.join(". ");
28
- } catch (error) {
29
- const message = error instanceof Error ? error.message : String(error);
30
- return `Sleep failed: ${message}`;
31
- }
32
- }
33
- });
34
- }
35
- var sleep = createSleep();
36
-
37
- export {
38
- createSleep,
39
- sleep
40
- };
@@ -1,47 +0,0 @@
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 _chunkCAEVLIQBcjs = require('./chunk-CAEVLIQB.cjs');
5
-
6
-
7
- var _chunkQZ5GS6HWcjs = require('./chunk-QZ5GS6HW.cjs');
8
-
9
- // src/read/index.ts
10
- var _ai = require('ai');
11
- var _zod = require('zod');
12
- function createRead(config = {}) {
13
- const cwd = _nullishCoalesce(config.cwd, () => ( process.cwd()));
14
- const defaultMaxLines = _nullishCoalesce(config.maxLines, () => ( 2e3));
15
- return _ai.tool.call(void 0, {
16
- description: 'Read a file from the local filesystem and return its contents with line numbers. Supports absolute paths, relative paths (resolved against the working directory), and tilde (~) home directory expansion. Returns numbered lines in "lineNumber\\tcontent" format. Use offset and limit to read specific ranges of large files.',
17
- inputSchema: _zod.z.object({
18
- file_path: _zod.z.string().describe("The absolute path to the file to read"),
19
- offset: _zod.z.number().int().nonnegative().optional().describe("The line number to start reading from (default: 0)"),
20
- limit: _zod.z.number().int().positive().optional().describe("The number of lines to read (default: 2000)")
21
- }),
22
- execute: async ({ file_path, offset, limit }) => {
23
- try {
24
- const absolutePath = _chunkQZ5GS6HWcjs.expandPath.call(void 0, file_path, cwd);
25
- const result = await _chunkCAEVLIQBcjs.readFileInRange.call(void 0,
26
- absolutePath,
27
- _nullishCoalesce(offset, () => ( 0)),
28
- _nullishCoalesce(limit, () => ( defaultMaxLines))
29
- );
30
- const numbered = _chunkCAEVLIQBcjs.addLineNumbers.call(void 0, {
31
- content: result.content,
32
- startLine: (_nullishCoalesce(offset, () => ( 0))) + 1
33
- });
34
- return numbered;
35
- } catch (error) {
36
- const msg = error instanceof Error ? error.message : String(error);
37
- return `Error [read]: ${msg}`;
38
- }
39
- }
40
- });
41
- }
42
- var read = createRead();
43
-
44
-
45
-
46
-
47
- exports.createRead = createRead; exports.read = read;
@@ -1,40 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/sleep/index.ts
2
- var _ai = require('ai');
3
- var _zod = require('zod');
4
- function createSleep(config = {}) {
5
- const maxDuration = _nullishCoalesce(config.maxDuration, () => ( 3e5));
6
- return _ai.tool.call(void 0, {
7
- description: "Pause execution for a specified duration. Useful for rate limiting, polling intervals, or waiting for external processes. Maximum duration is 300 seconds (5 minutes).",
8
- inputSchema: _ai.zodSchema.call(void 0,
9
- _zod.z.object({
10
- durationMs: _zod.z.number().describe("Duration to sleep in milliseconds"),
11
- reason: _zod.z.string().optional().describe("Optional reason for the sleep")
12
- })
13
- ),
14
- execute: async ({ durationMs, reason }) => {
15
- try {
16
- const clamped = Math.max(0, Math.min(durationMs, maxDuration));
17
- const start = Date.now();
18
- await new Promise((resolve) => setTimeout(resolve, clamped));
19
- const elapsed = Date.now() - start;
20
- const parts = [`Slept for ${elapsed}ms`];
21
- if (reason) parts.push(`Reason: ${reason}`);
22
- if (clamped !== durationMs) {
23
- parts.push(
24
- `(clamped from ${durationMs}ms to ${clamped}ms, max: ${maxDuration}ms)`
25
- );
26
- }
27
- return parts.join(". ");
28
- } catch (error) {
29
- const message = error instanceof Error ? error.message : String(error);
30
- return `Sleep failed: ${message}`;
31
- }
32
- }
33
- });
34
- }
35
- var sleep = createSleep();
36
-
37
-
38
-
39
-
40
- exports.createSleep = createSleep; exports.sleep = sleep;