agentool 0.0.1 → 1.0.0
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.
- package/README.md +627 -52
- package/dist/ask-user/index.cjs +8 -0
- package/dist/ask-user/index.d.cts +68 -0
- package/dist/ask-user/index.d.ts +68 -0
- package/dist/ask-user/index.js +8 -0
- package/dist/bash/index.cjs +8 -0
- package/dist/bash/index.d.cts +63 -0
- package/dist/bash/index.d.ts +63 -0
- package/dist/bash/index.js +8 -0
- package/dist/chunk-3EPGFWZV.cjs +30 -0
- package/dist/chunk-3VO6NETR.cjs +79 -0
- package/dist/chunk-4YI2H55A.js +142 -0
- package/dist/chunk-5NW4OGRI.cjs +99 -0
- package/dist/chunk-6MDPYALY.js +196 -0
- package/dist/chunk-6PQLFDGT.js +117 -0
- package/dist/chunk-7QL4BQCH.js +40 -0
- package/dist/chunk-CAEVLIQB.cjs +117 -0
- package/dist/chunk-CGTPF6IS.js +90 -0
- package/dist/chunk-EA3YV7ZG.js +79 -0
- package/dist/chunk-FAEGCFTO.js +136 -0
- package/dist/chunk-FV2R5FFQ.cjs +102 -0
- package/dist/chunk-FW3UJ622.cjs +59 -0
- package/dist/chunk-G3ITTPGX.js +99 -0
- package/dist/chunk-HDKXSKMO.js +30 -0
- package/dist/chunk-HZAQRHBT.js +99 -0
- package/dist/chunk-I3ONDY7P.js +46 -0
- package/dist/chunk-I6KFFQPV.cjs +58 -0
- package/dist/chunk-IMZQ7ELK.cjs +196 -0
- package/dist/chunk-JCTBB7H2.cjs +40 -0
- package/dist/chunk-K77GC2QI.js +59 -0
- package/dist/chunk-LPV5CN2K.js +58 -0
- package/dist/chunk-MF7CJVIZ.js +40 -0
- package/dist/chunk-MIYA7TNR.cjs +123 -0
- package/dist/chunk-MJCAXASI.js +123 -0
- package/dist/chunk-MXFW3XY6.cjs +73 -0
- package/dist/chunk-ONBH74ZV.cjs +90 -0
- package/dist/chunk-OXLQ7QVL.cjs +40 -0
- package/dist/chunk-QEJV2KZ4.cjs +159 -0
- package/dist/chunk-QZ5GS6HW.cjs +46 -0
- package/dist/chunk-S6QEY7UY.js +73 -0
- package/dist/chunk-SUSAPI5W.cjs +142 -0
- package/dist/chunk-TBVHHF3H.cjs +47 -0
- package/dist/chunk-U2YMJM25.cjs +115 -0
- package/dist/chunk-VLNDEVKS.js +102 -0
- package/dist/chunk-XKG2A3EW.js +159 -0
- package/dist/chunk-XLD2Y3SS.cjs +136 -0
- package/dist/chunk-Y7KOKDFP.js +115 -0
- package/dist/chunk-YPPPGGLA.cjs +99 -0
- package/dist/chunk-ZHCMEQJJ.js +47 -0
- package/dist/context-compaction/index.cjs +8 -0
- package/dist/context-compaction/index.d.cts +77 -0
- package/dist/context-compaction/index.d.ts +77 -0
- package/dist/context-compaction/index.js +8 -0
- package/dist/diff/index.cjs +9 -0
- package/dist/diff/index.d.cts +72 -0
- package/dist/diff/index.d.ts +72 -0
- package/dist/diff/index.js +9 -0
- package/dist/edit/index.cjs +10 -0
- package/dist/edit/index.d.cts +53 -0
- package/dist/edit/index.d.ts +53 -0
- package/dist/edit/index.js +10 -0
- package/dist/glob/index.cjs +10 -0
- package/dist/glob/index.d.cts +47 -0
- package/dist/glob/index.d.ts +47 -0
- package/dist/glob/index.js +10 -0
- package/dist/grep/index.cjs +10 -0
- package/dist/grep/index.d.cts +50 -0
- package/dist/grep/index.d.ts +50 -0
- package/dist/grep/index.js +10 -0
- package/dist/http-request/index.cjs +8 -0
- package/dist/http-request/index.d.cts +60 -0
- package/dist/http-request/index.d.ts +60 -0
- package/dist/http-request/index.js +8 -0
- package/dist/index.cjs +102 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +102 -0
- package/dist/lsp/index.cjs +10 -0
- package/dist/lsp/index.d.cts +38 -0
- package/dist/lsp/index.d.ts +38 -0
- package/dist/lsp/index.js +10 -0
- package/dist/memory/index.cjs +9 -0
- package/dist/memory/index.d.cts +63 -0
- package/dist/memory/index.d.ts +63 -0
- package/dist/memory/index.js +9 -0
- package/dist/multi-edit/index.cjs +11 -0
- package/dist/multi-edit/index.d.cts +72 -0
- package/dist/multi-edit/index.d.ts +72 -0
- package/dist/multi-edit/index.js +11 -0
- package/dist/read/index.cjs +10 -0
- package/dist/read/index.d.cts +67 -0
- package/dist/read/index.d.ts +67 -0
- package/dist/read/index.js +10 -0
- package/dist/sleep/index.cjs +8 -0
- package/dist/sleep/index.d.cts +60 -0
- package/dist/sleep/index.d.ts +60 -0
- package/dist/sleep/index.js +8 -0
- package/dist/task/index.cjs +8 -0
- package/dist/task/index.d.cts +67 -0
- package/dist/task/index.d.ts +67 -0
- package/dist/task/index.js +8 -0
- package/dist/types-3QPDuCXN.d.cts +45 -0
- package/dist/types-3QPDuCXN.d.ts +45 -0
- package/dist/web-fetch/index.cjs +8 -0
- package/dist/web-fetch/index.d.cts +56 -0
- package/dist/web-fetch/index.d.ts +56 -0
- package/dist/web-fetch/index.js +8 -0
- package/dist/write/index.cjs +10 -0
- package/dist/write/index.d.cts +47 -0
- package/dist/write/index.d.ts +47 -0
- package/dist/write/index.js +10 -0
- package/package.json +145 -20
- package/dist/core/index.d.ts +0 -20
- package/dist/core/index.js +0 -1
- package/dist/core/index.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the task tool.
|
|
6
|
+
* Extends {@link BaseToolConfig} with an optional tasks file path.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import type { TaskConfig } from 'agentool/task';
|
|
11
|
+
* const config: TaskConfig = { cwd: '/my/project' };
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
interface TaskConfig extends BaseToolConfig {
|
|
15
|
+
/** Path to the tasks JSON file. Defaults to `<cwd>/.agentool/tasks.json`. */
|
|
16
|
+
tasksFile?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a task tool that provides JSON file-based task tracking.
|
|
20
|
+
*
|
|
21
|
+
* Tasks are stored in a single JSON file with CRUD operations.
|
|
22
|
+
* Each task has an id, subject, description, status, and timestamps.
|
|
23
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional configuration for cwd and tasks file path.
|
|
26
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { createTask } from 'agentool/task';
|
|
31
|
+
*
|
|
32
|
+
* const taskTool = createTask({ cwd: '/my/project' });
|
|
33
|
+
* const result = await taskTool.execute(
|
|
34
|
+
* { action: 'create', subject: 'Fix bug', description: 'Fix the login bug' },
|
|
35
|
+
* { toolCallId: 'id', messages: [] },
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function createTask(config?: TaskConfig): ai.Tool<{
|
|
40
|
+
action: "list" | "delete" | "create" | "get" | "update";
|
|
41
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
id?: string | undefined;
|
|
44
|
+
subject?: string | undefined;
|
|
45
|
+
}, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Default task tool instance using `.agentool/tasks.json` under the current
|
|
48
|
+
* working directory.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import { task } from 'agentool/task';
|
|
53
|
+
* const result = await task.execute(
|
|
54
|
+
* { action: 'list' },
|
|
55
|
+
* { toolCallId: 'id', messages: [] },
|
|
56
|
+
* );
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const task: ai.Tool<{
|
|
60
|
+
action: "list" | "delete" | "create" | "get" | "update";
|
|
61
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
62
|
+
description?: string | undefined;
|
|
63
|
+
id?: string | undefined;
|
|
64
|
+
subject?: string | undefined;
|
|
65
|
+
}, string>;
|
|
66
|
+
|
|
67
|
+
export { type TaskConfig, createTask, task };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base configuration shared by all agentool tools.
|
|
3
|
+
* Every tool's factory function accepts a config extending this type.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import type { BaseToolConfig } from 'agentool';
|
|
8
|
+
* const config: BaseToolConfig = { cwd: '/my/project' };
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
interface BaseToolConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Working directory for file operations.
|
|
14
|
+
* Defaults to process.cwd() when not specified.
|
|
15
|
+
*/
|
|
16
|
+
cwd?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Result returned by tool execute functions.
|
|
20
|
+
* Tools always return strings -- never throw.
|
|
21
|
+
* Error results include operation, error type, and remediation.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import type { ToolResult } from 'agentool';
|
|
26
|
+
* const result: ToolResult = 'Found 3 matches in src/index.ts';
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
type ToolResult = string;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration for tools that support timeouts.
|
|
32
|
+
* Extends {@link BaseToolConfig} with an optional timeout duration.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import type { TimeoutConfig } from 'agentool';
|
|
37
|
+
* const config: TimeoutConfig = { cwd: '/project', timeout: 30000 };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
interface TimeoutConfig extends BaseToolConfig {
|
|
41
|
+
/** Timeout in milliseconds. Defaults vary by tool. */
|
|
42
|
+
timeout?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type { BaseToolConfig as B, TimeoutConfig as T, ToolResult as a };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base configuration shared by all agentool tools.
|
|
3
|
+
* Every tool's factory function accepts a config extending this type.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import type { BaseToolConfig } from 'agentool';
|
|
8
|
+
* const config: BaseToolConfig = { cwd: '/my/project' };
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
interface BaseToolConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Working directory for file operations.
|
|
14
|
+
* Defaults to process.cwd() when not specified.
|
|
15
|
+
*/
|
|
16
|
+
cwd?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Result returned by tool execute functions.
|
|
20
|
+
* Tools always return strings -- never throw.
|
|
21
|
+
* Error results include operation, error type, and remediation.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import type { ToolResult } from 'agentool';
|
|
26
|
+
* const result: ToolResult = 'Found 3 matches in src/index.ts';
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
type ToolResult = string;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration for tools that support timeouts.
|
|
32
|
+
* Extends {@link BaseToolConfig} with an optional timeout duration.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import type { TimeoutConfig } from 'agentool';
|
|
37
|
+
* const config: TimeoutConfig = { cwd: '/project', timeout: 30000 };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
interface TimeoutConfig extends BaseToolConfig {
|
|
41
|
+
/** Timeout in milliseconds. Defaults vary by tool. */
|
|
42
|
+
timeout?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type { BaseToolConfig as B, TimeoutConfig as T, ToolResult as a };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { T as TimeoutConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the web-fetch tool.
|
|
6
|
+
* Extends {@link TimeoutConfig} with optional content-length cap and user-agent.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const config: WebFetchConfig = {
|
|
11
|
+
* timeout: 10000,
|
|
12
|
+
* maxContentLength: 5 * 1024 * 1024,
|
|
13
|
+
* userAgent: 'my-agent/1.0',
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
interface WebFetchConfig extends TimeoutConfig {
|
|
18
|
+
/** Maximum response body size in bytes. Passed to {@link fetchUrl}. */
|
|
19
|
+
maxContentLength?: number;
|
|
20
|
+
/** Custom User-Agent header sent with every request. */
|
|
21
|
+
userAgent?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Factory that creates a web-fetch tool with the given configuration.
|
|
25
|
+
* The returned tool fetches a URL, automatically converts HTML to markdown
|
|
26
|
+
* via turndown, and truncates content at 100 000 characters.
|
|
27
|
+
*
|
|
28
|
+
* @param config - Optional configuration (timeout, max content length, user agent).
|
|
29
|
+
* @returns An AI SDK tool instance for fetching web pages.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { createWebFetch } from 'agentool/web-fetch';
|
|
34
|
+
* const myTool = createWebFetch({ timeout: 5000 });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare function createWebFetch(config?: WebFetchConfig): ai.Tool<{
|
|
38
|
+
url: string;
|
|
39
|
+
prompt?: string | undefined;
|
|
40
|
+
}, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Pre-configured web-fetch tool with default settings.
|
|
43
|
+
* Uses a 30 000 ms timeout, no content-length cap override, and no custom user-agent.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { webFetch } from 'agentool/web-fetch';
|
|
48
|
+
* // Register directly with your AI SDK agent
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare const webFetch: ai.Tool<{
|
|
52
|
+
url: string;
|
|
53
|
+
prompt?: string | undefined;
|
|
54
|
+
}, string>;
|
|
55
|
+
|
|
56
|
+
export { type WebFetchConfig, createWebFetch, webFetch };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { T as TimeoutConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the web-fetch tool.
|
|
6
|
+
* Extends {@link TimeoutConfig} with optional content-length cap and user-agent.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const config: WebFetchConfig = {
|
|
11
|
+
* timeout: 10000,
|
|
12
|
+
* maxContentLength: 5 * 1024 * 1024,
|
|
13
|
+
* userAgent: 'my-agent/1.0',
|
|
14
|
+
* };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
interface WebFetchConfig extends TimeoutConfig {
|
|
18
|
+
/** Maximum response body size in bytes. Passed to {@link fetchUrl}. */
|
|
19
|
+
maxContentLength?: number;
|
|
20
|
+
/** Custom User-Agent header sent with every request. */
|
|
21
|
+
userAgent?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Factory that creates a web-fetch tool with the given configuration.
|
|
25
|
+
* The returned tool fetches a URL, automatically converts HTML to markdown
|
|
26
|
+
* via turndown, and truncates content at 100 000 characters.
|
|
27
|
+
*
|
|
28
|
+
* @param config - Optional configuration (timeout, max content length, user agent).
|
|
29
|
+
* @returns An AI SDK tool instance for fetching web pages.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import { createWebFetch } from 'agentool/web-fetch';
|
|
34
|
+
* const myTool = createWebFetch({ timeout: 5000 });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare function createWebFetch(config?: WebFetchConfig): ai.Tool<{
|
|
38
|
+
url: string;
|
|
39
|
+
prompt?: string | undefined;
|
|
40
|
+
}, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Pre-configured web-fetch tool with default settings.
|
|
43
|
+
* Uses a 30 000 ms timeout, no content-length cap override, and no custom user-agent.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { webFetch } from 'agentool/web-fetch';
|
|
48
|
+
* // Register directly with your AI SDK agent
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare const webFetch: ai.Tool<{
|
|
52
|
+
url: string;
|
|
53
|
+
prompt?: string | undefined;
|
|
54
|
+
}, string>;
|
|
55
|
+
|
|
56
|
+
export { type WebFetchConfig, createWebFetch, webFetch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkJCTBB7H2cjs = require('../chunk-JCTBB7H2.cjs');
|
|
5
|
+
require('../chunk-CAEVLIQB.cjs');
|
|
6
|
+
require('../chunk-QZ5GS6HW.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.createWrite = _chunkJCTBB7H2cjs.createWrite; exports.write = _chunkJCTBB7H2cjs.write;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.cjs';
|
|
3
|
+
|
|
4
|
+
type WriteConfig = BaseToolConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a write tool that writes text content to a file.
|
|
7
|
+
*
|
|
8
|
+
* The tool creates parent directories as needed (mkdir -p behavior).
|
|
9
|
+
* If the file already exists it is overwritten, not appended.
|
|
10
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
11
|
+
*
|
|
12
|
+
* @param config - Optional configuration with a custom working directory.
|
|
13
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createWrite } from 'agentool/write';
|
|
18
|
+
*
|
|
19
|
+
* const writeTool = createWrite({ cwd: '/my/project' });
|
|
20
|
+
* const result = await writeTool.execute(
|
|
21
|
+
* { file_path: 'src/index.ts', content: 'export {}' },
|
|
22
|
+
* { toolCallId: 'id', messages: [] },
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function createWrite(config?: BaseToolConfig): ai.Tool<{
|
|
27
|
+
content: string;
|
|
28
|
+
file_path: string;
|
|
29
|
+
}, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Default write tool instance using the current working directory.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { write } from 'agentool/write';
|
|
36
|
+
* const result = await write.execute(
|
|
37
|
+
* { file_path: '/tmp/hello.txt', content: 'hello' },
|
|
38
|
+
* { toolCallId: 'id', messages: [] },
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare const write: ai.Tool<{
|
|
43
|
+
content: string;
|
|
44
|
+
file_path: string;
|
|
45
|
+
}, string>;
|
|
46
|
+
|
|
47
|
+
export { type WriteConfig, createWrite, write };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as ai from 'ai';
|
|
2
|
+
import { B as BaseToolConfig } from '../types-3QPDuCXN.js';
|
|
3
|
+
|
|
4
|
+
type WriteConfig = BaseToolConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a write tool that writes text content to a file.
|
|
7
|
+
*
|
|
8
|
+
* The tool creates parent directories as needed (mkdir -p behavior).
|
|
9
|
+
* If the file already exists it is overwritten, not appended.
|
|
10
|
+
* Execute never throws; errors are returned as descriptive strings.
|
|
11
|
+
*
|
|
12
|
+
* @param config - Optional configuration with a custom working directory.
|
|
13
|
+
* @returns A Vercel AI SDK tool with `description`, `parameters`, and `execute`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createWrite } from 'agentool/write';
|
|
18
|
+
*
|
|
19
|
+
* const writeTool = createWrite({ cwd: '/my/project' });
|
|
20
|
+
* const result = await writeTool.execute(
|
|
21
|
+
* { file_path: 'src/index.ts', content: 'export {}' },
|
|
22
|
+
* { toolCallId: 'id', messages: [] },
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function createWrite(config?: BaseToolConfig): ai.Tool<{
|
|
27
|
+
content: string;
|
|
28
|
+
file_path: string;
|
|
29
|
+
}, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Default write tool instance using the current working directory.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { write } from 'agentool/write';
|
|
36
|
+
* const result = await write.execute(
|
|
37
|
+
* { file_path: '/tmp/hello.txt', content: 'hello' },
|
|
38
|
+
* { toolCallId: 'id', messages: [] },
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare const write: ai.Tool<{
|
|
43
|
+
content: string;
|
|
44
|
+
file_path: string;
|
|
45
|
+
}, string>;
|
|
46
|
+
|
|
47
|
+
export { type WriteConfig, createWrite, write };
|
package/package.json
CHANGED
|
@@ -1,38 +1,163 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentool",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "Lightweight, provider-agnostic AI agent toolkit for CI/CD",
|
|
3
|
+
"version": "1.0.0",
|
|
5
4
|
"type": "module",
|
|
5
|
+
"description": "16 AI agent tools as standalone Vercel AI SDK modules",
|
|
6
|
+
"author": "Z-M-Huang",
|
|
6
7
|
"license": "Apache-2.0",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Z-M-Huang/agentool.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/Z-M-Huang/agentool#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Z-M-Huang/agentool/issues"
|
|
9
15
|
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ai",
|
|
18
|
+
"agent",
|
|
19
|
+
"tools",
|
|
20
|
+
"vercel-ai-sdk",
|
|
21
|
+
"llm",
|
|
22
|
+
"bash",
|
|
23
|
+
"grep",
|
|
24
|
+
"glob",
|
|
25
|
+
"file-operations",
|
|
26
|
+
"code-search",
|
|
27
|
+
"web-fetch",
|
|
28
|
+
"typescript",
|
|
29
|
+
"claude",
|
|
30
|
+
"openai",
|
|
31
|
+
"anthropic"
|
|
32
|
+
],
|
|
33
|
+
"main": "./dist/index.cjs",
|
|
34
|
+
"module": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
10
36
|
"exports": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"require": "./dist/index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./bash": {
|
|
43
|
+
"types": "./dist/bash/index.d.ts",
|
|
44
|
+
"import": "./dist/bash/index.js",
|
|
45
|
+
"require": "./dist/bash/index.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./grep": {
|
|
48
|
+
"types": "./dist/grep/index.d.ts",
|
|
49
|
+
"import": "./dist/grep/index.js",
|
|
50
|
+
"require": "./dist/grep/index.cjs"
|
|
51
|
+
},
|
|
52
|
+
"./glob": {
|
|
53
|
+
"types": "./dist/glob/index.d.ts",
|
|
54
|
+
"import": "./dist/glob/index.js",
|
|
55
|
+
"require": "./dist/glob/index.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./read": {
|
|
58
|
+
"types": "./dist/read/index.d.ts",
|
|
59
|
+
"import": "./dist/read/index.js",
|
|
60
|
+
"require": "./dist/read/index.cjs"
|
|
61
|
+
},
|
|
62
|
+
"./edit": {
|
|
63
|
+
"types": "./dist/edit/index.d.ts",
|
|
64
|
+
"import": "./dist/edit/index.js",
|
|
65
|
+
"require": "./dist/edit/index.cjs"
|
|
66
|
+
},
|
|
67
|
+
"./write": {
|
|
68
|
+
"types": "./dist/write/index.d.ts",
|
|
69
|
+
"import": "./dist/write/index.js",
|
|
70
|
+
"require": "./dist/write/index.cjs"
|
|
71
|
+
},
|
|
72
|
+
"./web-fetch": {
|
|
73
|
+
"types": "./dist/web-fetch/index.d.ts",
|
|
74
|
+
"import": "./dist/web-fetch/index.js",
|
|
75
|
+
"require": "./dist/web-fetch/index.cjs"
|
|
76
|
+
},
|
|
77
|
+
"./memory": {
|
|
78
|
+
"types": "./dist/memory/index.d.ts",
|
|
79
|
+
"import": "./dist/memory/index.js",
|
|
80
|
+
"require": "./dist/memory/index.cjs"
|
|
81
|
+
},
|
|
82
|
+
"./multi-edit": {
|
|
83
|
+
"types": "./dist/multi-edit/index.d.ts",
|
|
84
|
+
"import": "./dist/multi-edit/index.js",
|
|
85
|
+
"require": "./dist/multi-edit/index.cjs"
|
|
86
|
+
},
|
|
87
|
+
"./diff": {
|
|
88
|
+
"types": "./dist/diff/index.d.ts",
|
|
89
|
+
"import": "./dist/diff/index.js",
|
|
90
|
+
"require": "./dist/diff/index.cjs"
|
|
91
|
+
},
|
|
92
|
+
"./task": {
|
|
93
|
+
"types": "./dist/task/index.d.ts",
|
|
94
|
+
"import": "./dist/task/index.js",
|
|
95
|
+
"require": "./dist/task/index.cjs"
|
|
96
|
+
},
|
|
97
|
+
"./lsp": {
|
|
98
|
+
"types": "./dist/lsp/index.d.ts",
|
|
99
|
+
"import": "./dist/lsp/index.js",
|
|
100
|
+
"require": "./dist/lsp/index.cjs"
|
|
101
|
+
},
|
|
102
|
+
"./http-request": {
|
|
103
|
+
"types": "./dist/http-request/index.d.ts",
|
|
104
|
+
"import": "./dist/http-request/index.js",
|
|
105
|
+
"require": "./dist/http-request/index.cjs"
|
|
106
|
+
},
|
|
107
|
+
"./context-compaction": {
|
|
108
|
+
"types": "./dist/context-compaction/index.d.ts",
|
|
109
|
+
"import": "./dist/context-compaction/index.js",
|
|
110
|
+
"require": "./dist/context-compaction/index.cjs"
|
|
111
|
+
},
|
|
112
|
+
"./ask-user": {
|
|
113
|
+
"types": "./dist/ask-user/index.d.ts",
|
|
114
|
+
"import": "./dist/ask-user/index.js",
|
|
115
|
+
"require": "./dist/ask-user/index.cjs"
|
|
116
|
+
},
|
|
117
|
+
"./sleep": {
|
|
118
|
+
"types": "./dist/sleep/index.d.ts",
|
|
119
|
+
"import": "./dist/sleep/index.js",
|
|
120
|
+
"require": "./dist/sleep/index.cjs"
|
|
14
121
|
}
|
|
15
122
|
},
|
|
123
|
+
"scripts": {
|
|
124
|
+
"build": "tsup",
|
|
125
|
+
"typecheck": "tsc --noEmit",
|
|
126
|
+
"test": "vitest run --project unit",
|
|
127
|
+
"test:functional": "vitest run --project functional",
|
|
128
|
+
"lint": "eslint src/"
|
|
129
|
+
},
|
|
130
|
+
"engines": {
|
|
131
|
+
"node": ">=18.0.0"
|
|
132
|
+
},
|
|
16
133
|
"files": [
|
|
17
|
-
"dist"
|
|
134
|
+
"dist",
|
|
135
|
+
"README.md",
|
|
136
|
+
"LICENSE"
|
|
18
137
|
],
|
|
19
138
|
"peerDependencies": {
|
|
20
|
-
"ai": "
|
|
139
|
+
"ai": ">=4.0.0",
|
|
140
|
+
"zod": ">=3.23.0"
|
|
141
|
+
},
|
|
142
|
+
"dependencies": {
|
|
143
|
+
"diff": "^7.0.0",
|
|
144
|
+
"turndown": "^7.2.0"
|
|
21
145
|
},
|
|
22
146
|
"devDependencies": {
|
|
147
|
+
"@ai-sdk/openai": "^3.0.50",
|
|
148
|
+
"@types/diff": "^7.0.0",
|
|
149
|
+
"@types/node": "^22.0.0",
|
|
150
|
+
"@types/turndown": "^5.0.0",
|
|
151
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
152
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
153
|
+
"@vitest/coverage-v8": "^3.0.0",
|
|
23
154
|
"ai": "^6.0.0",
|
|
155
|
+
"dotenv": "^17.4.0",
|
|
156
|
+
"eslint": "^10.2.0",
|
|
24
157
|
"tsup": "^8.0.0",
|
|
25
158
|
"typescript": "^5.7.0",
|
|
159
|
+
"typescript-eslint": "^8.58.0",
|
|
26
160
|
"vitest": "^3.0.0",
|
|
27
|
-
"zod": "^3.
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"zod": "^3.24.0"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsup",
|
|
34
|
-
"typecheck": "tsc --noEmit",
|
|
35
|
-
"test": "vitest run",
|
|
36
|
-
"test:watch": "vitest"
|
|
161
|
+
"zod": "^3.25.0"
|
|
37
162
|
}
|
|
38
|
-
}
|
|
163
|
+
}
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { tool } from 'ai';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Result returned by every tool execution.
|
|
5
|
-
*/
|
|
6
|
-
interface ToolResult {
|
|
7
|
-
success: boolean;
|
|
8
|
-
output: string;
|
|
9
|
-
error?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A single tool definition — the return type of AI SDK `tool()`.
|
|
13
|
-
*/
|
|
14
|
-
type ToolDefinition = ReturnType<typeof tool<ZodType, ToolResult>>;
|
|
15
|
-
/**
|
|
16
|
-
* A record of named tool definitions, returned by ToolPack factories.
|
|
17
|
-
*/
|
|
18
|
-
type ToolPack = Record<string, ToolDefinition>;
|
|
19
|
-
|
|
20
|
-
export type { ToolDefinition, ToolPack, ToolResult };
|
package/dist/core/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|