bashkit 0.1.3 → 0.2.2
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 +318 -43
- package/dist/middleware/anthropic-cache.d.ts +20 -1
- package/dist/middleware/index.d.ts +1 -1
- package/dist/sandbox/e2b.d.ts +2 -0
- package/dist/sandbox/interface.d.ts +7 -0
- package/dist/sandbox/vercel.d.ts +2 -0
- 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
package/dist/skills/loader.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SkillBundle } from "./fetch";
|
|
1
2
|
import type { SkillMetadata } from "./types";
|
|
2
3
|
/**
|
|
3
4
|
* Parses YAML frontmatter from a SKILL.md file content.
|
|
@@ -9,3 +10,38 @@ import type { SkillMetadata } from "./types";
|
|
|
9
10
|
* @throws Error if required fields (name, description) are missing
|
|
10
11
|
*/
|
|
11
12
|
export declare function parseSkillMetadata(content: string, skillPath: string): SkillMetadata;
|
|
13
|
+
/**
|
|
14
|
+
* Loads all files from a local skill directory as a SkillBundle.
|
|
15
|
+
* Recursively reads all files, preserving directory structure.
|
|
16
|
+
*
|
|
17
|
+
* @param skillDir - Absolute path to skill directory (containing SKILL.md)
|
|
18
|
+
* @returns SkillBundle with all files
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const bundle = await loadSkillBundle('/path/to/.skills/pdf-processing');
|
|
23
|
+
* // bundle.files = {
|
|
24
|
+
* // 'SKILL.md': '---\nname: pdf-processing\n...',
|
|
25
|
+
* // 'templates/report.md': '# Report Template...',
|
|
26
|
+
* // 'scripts/extract.sh': '#!/bin/bash...',
|
|
27
|
+
* // }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadSkillBundle(skillDir: string): Promise<SkillBundle>;
|
|
31
|
+
/**
|
|
32
|
+
* Loads multiple discovered skills as bundles.
|
|
33
|
+
* Takes the output of discoverSkills() and loads all files for each skill.
|
|
34
|
+
*
|
|
35
|
+
* @param skills - Array of skill metadata from discoverSkills()
|
|
36
|
+
* @returns Record mapping skill names to their bundles
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const discovered = await discoverSkills();
|
|
41
|
+
* const bundles = await loadSkillBundles(discovered);
|
|
42
|
+
*
|
|
43
|
+
* // Use with setupAgentEnvironment
|
|
44
|
+
* await setupAgentEnvironment(sandbox, { skills: bundles });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function loadSkillBundles(skills: SkillMetadata[]): Promise<Record<string, SkillBundle>>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ToolConfig } from "../types";
|
|
2
1
|
export interface ExitPlanModeOutput {
|
|
3
2
|
message: string;
|
|
4
3
|
approved?: boolean;
|
|
@@ -6,6 +5,6 @@ export interface ExitPlanModeOutput {
|
|
|
6
5
|
export interface ExitPlanModeError {
|
|
7
6
|
error: string;
|
|
8
7
|
}
|
|
9
|
-
export declare function createExitPlanModeTool(
|
|
8
|
+
export declare function createExitPlanModeTool(onPlanSubmit?: (plan: string) => Promise<boolean> | boolean): import("ai").Tool<{
|
|
10
9
|
plan: string;
|
|
11
10
|
}, ExitPlanModeOutput | ExitPlanModeError>;
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -69,9 +69,9 @@ export type { SubagentEventData, SubagentStepEvent, SubagentTypeConfig, TaskErro
|
|
|
69
69
|
export { createTaskTool } from "./task";
|
|
70
70
|
export type { TodoItem, TodoState, TodoWriteError, TodoWriteOutput, } from "./todo-write";
|
|
71
71
|
export { createTodoWriteTool } from "./todo-write";
|
|
72
|
-
export type { WebFetchError, WebFetchOutput
|
|
72
|
+
export type { WebFetchError, WebFetchOutput } from "./web-fetch";
|
|
73
73
|
export { createWebFetchTool } from "./web-fetch";
|
|
74
|
-
export type { WebSearchError, WebSearchOutput, WebSearchResult,
|
|
74
|
+
export type { WebSearchError, WebSearchOutput, WebSearchResult, } from "./web-search";
|
|
75
75
|
export { createWebSearchTool } from "./web-search";
|
|
76
76
|
export type { WriteError, WriteOutput } from "./write";
|
|
77
77
|
export { createWriteTool } from "./write";
|
package/dist/tools/task.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ModelMessage, type LanguageModel, type PrepareStepFunction, type StepResult, type StopCondition, type UIMessageStreamWriter, type Tool, type ToolSet } from "ai";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
export interface TaskOutput {
|
|
3
4
|
result: string;
|
|
4
5
|
usage?: {
|
|
@@ -12,6 +13,14 @@ export interface TaskOutput {
|
|
|
12
13
|
export interface TaskError {
|
|
13
14
|
error: string;
|
|
14
15
|
}
|
|
16
|
+
declare const taskInputSchema: z.ZodObject<{
|
|
17
|
+
description: z.ZodString;
|
|
18
|
+
prompt: z.ZodString;
|
|
19
|
+
subagent_type: z.ZodString;
|
|
20
|
+
system_prompt: z.ZodOptional<z.ZodString>;
|
|
21
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
type TaskInput = z.infer<typeof taskInputSchema>;
|
|
15
24
|
/** Event emitted for each step a subagent takes */
|
|
16
25
|
export interface SubagentStepEvent {
|
|
17
26
|
subagentType: string;
|
|
@@ -55,4 +64,5 @@ export interface TaskToolConfig {
|
|
|
55
64
|
/** Optional stream writer for real-time subagent activity (uses streamText instead of generateText) */
|
|
56
65
|
streamWriter?: UIMessageStreamWriter;
|
|
57
66
|
}
|
|
58
|
-
export declare function createTaskTool(config: TaskToolConfig): Tool
|
|
67
|
+
export declare function createTaskTool(config: TaskToolConfig): Tool<TaskInput, TaskOutput | TaskError>;
|
|
68
|
+
export {};
|
|
@@ -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.
|
|
3
|
+
"version": "0.2.2",
|
|
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",
|