bashkit 0.1.3 → 0.2.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.
- package/AGENTS.md +108 -0
- package/README.md +148 -1
- package/dist/cache/cached.d.ts +37 -0
- package/dist/cache/index.d.ts +6 -0
- package/dist/cache/lru.d.ts +25 -0
- package/dist/cache/redis.d.ts +41 -0
- package/dist/cache/types.d.ts +53 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +294 -37
- package/dist/middleware/anthropic-cache.d.ts +20 -1
- package/dist/middleware/index.d.ts +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/loader.d.ts +36 -0
- package/dist/tools/exit-plan-mode.d.ts +1 -2
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/task.d.ts +11 -1
- package/dist/tools/todo-write.d.ts +1 -2
- package/dist/tools/web-constants.d.ts +5 -0
- package/dist/tools/web-fetch.d.ts +2 -6
- package/dist/tools/web-search.d.ts +2 -4
- package/dist/types.d.ts +54 -4
- package/dist/utils/http-constants.d.ts +5 -0
- package/package.json +4 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ToolConfig } from "../types";
|
|
2
1
|
export interface TodoItem {
|
|
3
2
|
content: string;
|
|
4
3
|
status: "pending" | "in_progress" | "completed";
|
|
@@ -19,7 +18,7 @@ export interface TodoWriteError {
|
|
|
19
18
|
export interface TodoState {
|
|
20
19
|
todos: TodoItem[];
|
|
21
20
|
}
|
|
22
|
-
export declare function createTodoWriteTool(state: TodoState,
|
|
21
|
+
export declare function createTodoWriteTool(state: TodoState, onUpdate?: (todos: TodoItem[]) => void): import("ai").Tool<{
|
|
23
22
|
todos: {
|
|
24
23
|
content: string;
|
|
25
24
|
status: "pending" | "in_progress" | "completed";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WebFetchConfig } from "../types";
|
|
2
2
|
export interface WebFetchOutput {
|
|
3
3
|
response: string;
|
|
4
4
|
url: string;
|
|
@@ -10,11 +10,7 @@ export interface WebFetchError {
|
|
|
10
10
|
status_code?: number;
|
|
11
11
|
retryable?: boolean;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
14
|
-
apiKey: string;
|
|
15
|
-
model: LanguageModel;
|
|
16
|
-
}
|
|
17
|
-
export declare function createWebFetchTool(config: WebFetchToolConfig): import("ai").Tool<{
|
|
13
|
+
export declare function createWebFetchTool(config: WebFetchConfig): import("ai").Tool<{
|
|
18
14
|
url: string;
|
|
19
15
|
prompt: string;
|
|
20
16
|
}, WebFetchOutput | WebFetchError>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WebSearchConfig } from "../types";
|
|
1
2
|
export interface WebSearchResult {
|
|
2
3
|
title: string;
|
|
3
4
|
url: string;
|
|
@@ -14,10 +15,7 @@ export interface WebSearchError {
|
|
|
14
15
|
status_code?: number;
|
|
15
16
|
retryable?: boolean;
|
|
16
17
|
}
|
|
17
|
-
export
|
|
18
|
-
apiKey: string;
|
|
19
|
-
}
|
|
20
|
-
export declare function createWebSearchTool(config: WebSearchToolConfig): import("ai").Tool<{
|
|
18
|
+
export declare function createWebSearchTool(config: WebSearchConfig): import("ai").Tool<{
|
|
21
19
|
query: string;
|
|
22
20
|
allowed_domains?: string[] | undefined;
|
|
23
21
|
blocked_domains?: string[] | undefined;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
|
-
import type { LanguageModel } from "ai";
|
|
1
|
+
import type { LanguageModel, Tool } from "ai";
|
|
2
|
+
import type { CacheStore } from "./cache/types";
|
|
2
3
|
import type { SkillMetadata } from "./skills/types";
|
|
4
|
+
/**
|
|
5
|
+
* SDK tool options picked from the Tool type.
|
|
6
|
+
* This automatically adapts to the user's installed AI SDK version.
|
|
7
|
+
* - v5 users get v5 options (if any)
|
|
8
|
+
* - v6 users get v6 options (needsApproval, strict, etc.)
|
|
9
|
+
*
|
|
10
|
+
* Uses `any` for input/output to allow typed needsApproval functions.
|
|
11
|
+
*/
|
|
12
|
+
export type SDKToolOptions = Partial<Pick<Tool<any, any>, "strict" | "needsApproval" | "providerOptions">>;
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for sandbox-based tools.
|
|
15
|
+
* Extends AI SDK tool options for version-appropriate type safety.
|
|
16
|
+
*/
|
|
3
17
|
export type ToolConfig = {
|
|
4
18
|
timeout?: number;
|
|
5
19
|
maxFileSize?: number;
|
|
6
20
|
maxOutputLength?: number;
|
|
7
21
|
allowedPaths?: string[];
|
|
8
22
|
blockedCommands?: string[];
|
|
9
|
-
};
|
|
23
|
+
} & SDKToolOptions;
|
|
10
24
|
export type GrepToolConfig = ToolConfig & {
|
|
11
25
|
/** Use ripgrep (rg) instead of grep. Requires ripgrep to be installed. Default: false */
|
|
12
26
|
useRipgrep?: boolean;
|
|
13
27
|
};
|
|
14
28
|
export type WebSearchConfig = {
|
|
15
29
|
apiKey: string;
|
|
16
|
-
};
|
|
30
|
+
} & SDKToolOptions;
|
|
17
31
|
export type WebFetchConfig = {
|
|
18
32
|
apiKey: string;
|
|
19
33
|
model: LanguageModel;
|
|
20
|
-
};
|
|
34
|
+
} & SDKToolOptions;
|
|
21
35
|
export type AskUserConfig = {
|
|
22
36
|
/** Callback to handle questions and return answers */
|
|
23
37
|
onQuestion?: (question: string) => Promise<string> | string;
|
|
@@ -28,6 +42,40 @@ export type SkillConfig = {
|
|
|
28
42
|
/** Callback when a skill is activated */
|
|
29
43
|
onActivate?: (skill: SkillMetadata, instructions: string) => void | Promise<void>;
|
|
30
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Cache configuration for tool result caching.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Enable with defaults (LRU cache, 5min TTL, safe tools only)
|
|
51
|
+
* cache: true
|
|
52
|
+
*
|
|
53
|
+
* // Custom cache store
|
|
54
|
+
* cache: myRedisStore
|
|
55
|
+
*
|
|
56
|
+
* // Per-tool control
|
|
57
|
+
* cache: { Read: true, Glob: true, Bash: false }
|
|
58
|
+
*
|
|
59
|
+
* // Full options
|
|
60
|
+
* cache: { store: myStore, ttl: 600000, debug: true, Read: true }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export type CacheConfig = boolean | CacheStore | {
|
|
64
|
+
/** Custom cache store (default: LRUCacheStore) */
|
|
65
|
+
store?: CacheStore;
|
|
66
|
+
/** TTL in milliseconds (default: 5 minutes) */
|
|
67
|
+
ttl?: number;
|
|
68
|
+
/** Enable debug logging for cache hits/misses */
|
|
69
|
+
debug?: boolean;
|
|
70
|
+
/** Callback when cache hit occurs */
|
|
71
|
+
onHit?: (toolName: string, key: string) => void;
|
|
72
|
+
/** Callback when cache miss occurs */
|
|
73
|
+
onMiss?: (toolName: string, key: string) => void;
|
|
74
|
+
/** Custom key generator for cache keys */
|
|
75
|
+
keyGenerator?: (toolName: string, params: unknown) => string;
|
|
76
|
+
/** Per-tool overrides - any tool name can be enabled/disabled */
|
|
77
|
+
[toolName: string]: boolean | CacheStore | number | ((toolName: string, key: string) => void) | ((toolName: string, params: unknown) => string) | undefined;
|
|
78
|
+
};
|
|
31
79
|
export type AgentConfig = {
|
|
32
80
|
tools?: {
|
|
33
81
|
Bash?: ToolConfig;
|
|
@@ -47,6 +95,8 @@ export type AgentConfig = {
|
|
|
47
95
|
webSearch?: WebSearchConfig;
|
|
48
96
|
/** Include WebFetch tool with this config */
|
|
49
97
|
webFetch?: WebFetchConfig;
|
|
98
|
+
/** Enable tool result caching */
|
|
99
|
+
cache?: CacheConfig;
|
|
50
100
|
defaultTimeout?: number;
|
|
51
101
|
workingDirectory?: string;
|
|
52
102
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bashkit",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Agentic coding tools for the Vercel AI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,17 +54,18 @@
|
|
|
54
54
|
"@clack/prompts": "^0.7.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@ai-sdk/anthropic": "^
|
|
57
|
+
"@ai-sdk/anthropic": "^3.0.1",
|
|
58
58
|
"@biomejs/biome": "^2.3.9",
|
|
59
59
|
"@e2b/code-interpreter": "^1.5.1",
|
|
60
60
|
"@types/bun": "latest",
|
|
61
61
|
"@types/node": "^24.10.0",
|
|
62
62
|
"@vercel/sandbox": "^1.0.4",
|
|
63
|
+
"ai": "^6.0.0",
|
|
63
64
|
"parallel-web": "^0.2.4",
|
|
64
65
|
"typescript": "^5.9.3"
|
|
65
66
|
},
|
|
66
67
|
"peerDependencies": {
|
|
67
|
-
"ai": "
|
|
68
|
+
"ai": ">=5.0.0",
|
|
68
69
|
"zod": "^4.1.8",
|
|
69
70
|
"@vercel/sandbox": "^1.0.0",
|
|
70
71
|
"@e2b/code-interpreter": "^1.0.0",
|