@ugm/desiagent 0.1.21
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 +251 -0
- package/dist/__tests__/test-utils.d.ts +24 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -0
- package/dist/__tests__/test-utils.js +32 -0
- package/dist/__tests__/test-utils.js.map +1 -0
- package/dist/core/execution/agents.d.ts +60 -0
- package/dist/core/execution/agents.d.ts.map +1 -0
- package/dist/core/execution/agents.js +249 -0
- package/dist/core/execution/agents.js.map +1 -0
- package/dist/core/execution/artifacts.d.ts +27 -0
- package/dist/core/execution/artifacts.d.ts.map +1 -0
- package/dist/core/execution/artifacts.js +93 -0
- package/dist/core/execution/artifacts.js.map +1 -0
- package/dist/core/execution/costs.d.ts +160 -0
- package/dist/core/execution/costs.d.ts.map +1 -0
- package/dist/core/execution/costs.js +196 -0
- package/dist/core/execution/costs.js.map +1 -0
- package/dist/core/execution/dagExecutor.d.ts +112 -0
- package/dist/core/execution/dagExecutor.d.ts.map +1 -0
- package/dist/core/execution/dagExecutor.js +647 -0
- package/dist/core/execution/dagExecutor.js.map +1 -0
- package/dist/core/execution/dags.d.ts +167 -0
- package/dist/core/execution/dags.d.ts.map +1 -0
- package/dist/core/execution/dags.js +713 -0
- package/dist/core/execution/dags.js.map +1 -0
- package/dist/core/execution/executions.d.ts +158 -0
- package/dist/core/execution/executions.d.ts.map +1 -0
- package/dist/core/execution/executions.js +258 -0
- package/dist/core/execution/executions.js.map +1 -0
- package/dist/core/execution/goals.d.ts +62 -0
- package/dist/core/execution/goals.d.ts.map +1 -0
- package/dist/core/execution/goals.js +245 -0
- package/dist/core/execution/goals.js.map +1 -0
- package/dist/core/execution/runs.d.ts +65 -0
- package/dist/core/execution/runs.d.ts.map +1 -0
- package/dist/core/execution/runs.js +219 -0
- package/dist/core/execution/runs.js.map +1 -0
- package/dist/core/execution/tools.d.ts +24 -0
- package/dist/core/execution/tools.d.ts.map +1 -0
- package/dist/core/execution/tools.js +33 -0
- package/dist/core/execution/tools.js.map +1 -0
- package/dist/core/orchestration/index.d.ts +7 -0
- package/dist/core/orchestration/index.d.ts.map +1 -0
- package/dist/core/orchestration/index.js +7 -0
- package/dist/core/orchestration/index.js.map +1 -0
- package/dist/core/orchestration/orchestrator.d.ts +39 -0
- package/dist/core/orchestration/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestration/orchestrator.js +141 -0
- package/dist/core/orchestration/orchestrator.js.map +1 -0
- package/dist/core/orchestration/planner.d.ts +63 -0
- package/dist/core/orchestration/planner.d.ts.map +1 -0
- package/dist/core/orchestration/planner.js +99 -0
- package/dist/core/orchestration/planner.js.map +1 -0
- package/dist/core/providers/factory.d.ts +25 -0
- package/dist/core/providers/factory.d.ts.map +1 -0
- package/dist/core/providers/factory.js +86 -0
- package/dist/core/providers/factory.js.map +1 -0
- package/dist/core/providers/index.d.ts +11 -0
- package/dist/core/providers/index.d.ts.map +1 -0
- package/dist/core/providers/index.js +10 -0
- package/dist/core/providers/index.js.map +1 -0
- package/dist/core/providers/ollama.d.ts +36 -0
- package/dist/core/providers/ollama.d.ts.map +1 -0
- package/dist/core/providers/ollama.js +123 -0
- package/dist/core/providers/ollama.js.map +1 -0
- package/dist/core/providers/openai.d.ts +33 -0
- package/dist/core/providers/openai.d.ts.map +1 -0
- package/dist/core/providers/openai.js +114 -0
- package/dist/core/providers/openai.js.map +1 -0
- package/dist/core/providers/openrouter.d.ts +38 -0
- package/dist/core/providers/openrouter.d.ts.map +1 -0
- package/dist/core/providers/openrouter.js +269 -0
- package/dist/core/providers/openrouter.js.map +1 -0
- package/dist/core/providers/types.d.ts +101 -0
- package/dist/core/providers/types.d.ts.map +1 -0
- package/dist/core/providers/types.js +7 -0
- package/dist/core/providers/types.js.map +1 -0
- package/dist/core/tools/base.d.ts +56 -0
- package/dist/core/tools/base.d.ts.map +1 -0
- package/dist/core/tools/base.js +60 -0
- package/dist/core/tools/base.js.map +1 -0
- package/dist/core/tools/bash.d.ts +50 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +179 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit.d.ts +39 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +67 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/executor.d.ts +33 -0
- package/dist/core/tools/executor.d.ts.map +1 -0
- package/dist/core/tools/executor.js +105 -0
- package/dist/core/tools/executor.js.map +1 -0
- package/dist/core/tools/fetchPage.d.ts +46 -0
- package/dist/core/tools/fetchPage.d.ts.map +1 -0
- package/dist/core/tools/fetchPage.js +87 -0
- package/dist/core/tools/fetchPage.js.map +1 -0
- package/dist/core/tools/fetchURLs.d.ts +39 -0
- package/dist/core/tools/fetchURLs.d.ts.map +1 -0
- package/dist/core/tools/fetchURLs.js +67 -0
- package/dist/core/tools/fetchURLs.js.map +1 -0
- package/dist/core/tools/glob.d.ts +36 -0
- package/dist/core/tools/glob.d.ts.map +1 -0
- package/dist/core/tools/glob.js +78 -0
- package/dist/core/tools/glob.js.map +1 -0
- package/dist/core/tools/grep.d.ts +51 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +152 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +22 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +22 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/llmExecute.d.ts +153 -0
- package/dist/core/tools/llmExecute.d.ts.map +1 -0
- package/dist/core/tools/llmExecute.js +105 -0
- package/dist/core/tools/llmExecute.js.map +1 -0
- package/dist/core/tools/readEmail.d.ts +68 -0
- package/dist/core/tools/readEmail.d.ts.map +1 -0
- package/dist/core/tools/readEmail.js +182 -0
- package/dist/core/tools/readEmail.js.map +1 -0
- package/dist/core/tools/readFile.d.ts +42 -0
- package/dist/core/tools/readFile.d.ts.map +1 -0
- package/dist/core/tools/readFile.js +79 -0
- package/dist/core/tools/readFile.js.map +1 -0
- package/dist/core/tools/registry.d.ts +53 -0
- package/dist/core/tools/registry.d.ts.map +1 -0
- package/dist/core/tools/registry.js +112 -0
- package/dist/core/tools/registry.js.map +1 -0
- package/dist/core/tools/sendEmail.d.ts +83 -0
- package/dist/core/tools/sendEmail.d.ts.map +1 -0
- package/dist/core/tools/sendEmail.js +132 -0
- package/dist/core/tools/sendEmail.js.map +1 -0
- package/dist/core/tools/sendWebhook.d.ts +48 -0
- package/dist/core/tools/sendWebhook.d.ts.map +1 -0
- package/dist/core/tools/sendWebhook.js +61 -0
- package/dist/core/tools/sendWebhook.js.map +1 -0
- package/dist/core/tools/webSearch.d.ts +34 -0
- package/dist/core/tools/webSearch.d.ts.map +1 -0
- package/dist/core/tools/webSearch.js +104 -0
- package/dist/core/tools/webSearch.js.map +1 -0
- package/dist/core/tools/writeFile.d.ts +49 -0
- package/dist/core/tools/writeFile.d.ts.map +1 -0
- package/dist/core/tools/writeFile.js +120 -0
- package/dist/core/tools/writeFile.js.map +1 -0
- package/dist/db/client.d.ts +22 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +178 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/schema.d.ts +1846 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +175 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/errors/index.d.ts +80 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +135 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +172 -0
- package/dist/index.js.map +1 -0
- package/dist/services/initDB.d.ts +17 -0
- package/dist/services/initDB.d.ts.map +1 -0
- package/dist/services/initDB.js +212 -0
- package/dist/services/initDB.js.map +1 -0
- package/dist/types/agent.d.ts +354 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +63 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/client.d.ts +309 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/client.js +2 -0
- package/dist/types/client.js.map +1 -0
- package/dist/types/config.d.ts +96 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +33 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/dag.d.ts +253 -0
- package/dist/types/dag.d.ts.map +1 -0
- package/dist/types/dag.js +46 -0
- package/dist/types/dag.js.map +1 -0
- package/dist/types/execution.d.ts +171 -0
- package/dist/types/execution.d.ts.map +1 -0
- package/dist/types/execution.js +41 -0
- package/dist/types/execution.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/util/cron-validator.d.ts +16 -0
- package/dist/util/cron-validator.d.ts.map +1 -0
- package/dist/util/cron-validator.js +31 -0
- package/dist/util/cron-validator.js.map +1 -0
- package/dist/util/dag-utils.d.ts +54 -0
- package/dist/util/dag-utils.d.ts.map +1 -0
- package/dist/util/dag-utils.js +167 -0
- package/dist/util/dag-utils.js.map +1 -0
- package/dist/util/logger.d.ts +21 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +87 -0
- package/dist/util/logger.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Provider Types
|
|
3
|
+
*
|
|
4
|
+
* Interfaces for different LLM providers (OpenAI, Ollama, etc.)
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolDefinition } from '../../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Message in a conversation
|
|
9
|
+
*/
|
|
10
|
+
export interface Message {
|
|
11
|
+
role: 'system' | 'user' | 'assistant';
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Tool call from LLM response
|
|
16
|
+
*/
|
|
17
|
+
export interface ToolCall {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
arguments: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Usage information from LLM
|
|
24
|
+
*/
|
|
25
|
+
export interface UsageInfo {
|
|
26
|
+
promptTokens: number;
|
|
27
|
+
completionTokens: number;
|
|
28
|
+
totalTokens: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Finish reason for LLM response
|
|
32
|
+
*/
|
|
33
|
+
export type FinishReason = 'stop' | 'tool_calls' | 'length' | 'content_filter' | 'error';
|
|
34
|
+
/**
|
|
35
|
+
* Chat call parameters
|
|
36
|
+
*/
|
|
37
|
+
export interface ChatParams {
|
|
38
|
+
messages: Message[];
|
|
39
|
+
temperature?: number;
|
|
40
|
+
maxTokens?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Chat response
|
|
44
|
+
*/
|
|
45
|
+
export interface ChatResponse {
|
|
46
|
+
content: string;
|
|
47
|
+
usage?: UsageInfo;
|
|
48
|
+
costUsd?: number;
|
|
49
|
+
generationStats?: Record<string, any>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* LLM call with tools parameters
|
|
53
|
+
*/
|
|
54
|
+
export interface LLMCallParams {
|
|
55
|
+
messages: Message[];
|
|
56
|
+
tools: ToolDefinition[];
|
|
57
|
+
temperature?: number;
|
|
58
|
+
maxTokens?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* LLM response with tool calls
|
|
62
|
+
*/
|
|
63
|
+
export interface LLMResponse {
|
|
64
|
+
thought: string;
|
|
65
|
+
toolCalls?: ToolCall[];
|
|
66
|
+
finishReason: FinishReason;
|
|
67
|
+
usage?: UsageInfo;
|
|
68
|
+
costUsd?: number;
|
|
69
|
+
generationStats?: Record<string, any>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* LLM Provider interface
|
|
73
|
+
*/
|
|
74
|
+
export interface LLMProvider {
|
|
75
|
+
name: string;
|
|
76
|
+
/**
|
|
77
|
+
* Validate if model supports tool calling
|
|
78
|
+
*/
|
|
79
|
+
validateToolCallSupport(model: string): Promise<{
|
|
80
|
+
supported: boolean;
|
|
81
|
+
message?: string;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Simple chat call (no tools)
|
|
85
|
+
*/
|
|
86
|
+
chat(params: ChatParams): Promise<ChatResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Call with tool support
|
|
89
|
+
*/
|
|
90
|
+
callWithTools(params: LLMCallParams): Promise<LLMResponse>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Provider configuration
|
|
94
|
+
*/
|
|
95
|
+
export interface ProviderConfig {
|
|
96
|
+
provider?: 'openai' | 'openrouter' | 'ollama';
|
|
97
|
+
apiKey?: string;
|
|
98
|
+
baseUrl?: string;
|
|
99
|
+
model?: string;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/providers/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAA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AC,YAAY,CAAC,CAAC;IAEhD;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC5D;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/providers/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Tool Class
|
|
3
|
+
*
|
|
4
|
+
* Abstract base class for all tools in desiAgent.
|
|
5
|
+
* Tools are self-documenting, validated functions that agents can call.
|
|
6
|
+
*/
|
|
7
|
+
import type { z } from 'zod';
|
|
8
|
+
import type { ToolDefinition } from '../../types/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Tool execution context
|
|
11
|
+
*/
|
|
12
|
+
export interface ToolContext {
|
|
13
|
+
logger: {
|
|
14
|
+
debug: (msg: string | object, data?: any) => void;
|
|
15
|
+
info: (msg: string | object, data?: any) => void;
|
|
16
|
+
warn: (msg: string | object, data?: any) => void;
|
|
17
|
+
error: (msg: string | object, data?: any) => void;
|
|
18
|
+
};
|
|
19
|
+
onEvent?: (event: string, data?: any) => void;
|
|
20
|
+
db?: any;
|
|
21
|
+
runId?: string;
|
|
22
|
+
abortSignal?: AbortSignal;
|
|
23
|
+
executionId?: string;
|
|
24
|
+
subStepId?: string;
|
|
25
|
+
artifactsDir?: string;
|
|
26
|
+
emitEvent?: {
|
|
27
|
+
started?: (message: string) => void;
|
|
28
|
+
progress?: (message: string) => void;
|
|
29
|
+
completed?: (message: string) => void;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Base class for all tool implementations
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class BaseTool<TInput = any, TOutput = any> {
|
|
36
|
+
abstract name: string;
|
|
37
|
+
abstract description: string;
|
|
38
|
+
abstract inputSchema: z.ZodType<TInput>;
|
|
39
|
+
/**
|
|
40
|
+
* Execute the tool with validated input
|
|
41
|
+
*/
|
|
42
|
+
abstract execute(input: TInput, ctx: ToolContext): Promise<TOutput>;
|
|
43
|
+
/**
|
|
44
|
+
* Convert tool to JSON schema for LLM consumption
|
|
45
|
+
*/
|
|
46
|
+
toJSONSchema(): ToolDefinition;
|
|
47
|
+
/**
|
|
48
|
+
* Execute with timeout
|
|
49
|
+
*/
|
|
50
|
+
protected withTimeout<T>(promise: Promise<T>, timeoutMs: number, timeoutMessage?: string): Promise<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Retry with exponential backoff
|
|
53
|
+
*/
|
|
54
|
+
protected retry<T>(fn: () => Promise<T>, maxAttempts?: number, delayMs?: number): Promise<T>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/core/tools/base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE;QACN,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;QAClD,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;QACjD,IAAI,EAAE,CAAC,GAAG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,MAAM,EACjB,cAAc,SAAwB,GACrC,OAAO,CAAC,CAAC,CAAC;IAYb;;OAEG;cACa,KAAK,CAAC,CAAC,EACrB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,WAAW,SAAI,EACf,OAAO,SAAO,GACb,OAAO,CAAC,CAAC,CAAC;CAoBd"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Tool Class
|
|
3
|
+
*
|
|
4
|
+
* Abstract base class for all tools in desiAgent.
|
|
5
|
+
* Tools are self-documenting, validated functions that agents can call.
|
|
6
|
+
*/
|
|
7
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
8
|
+
/**
|
|
9
|
+
* Base class for all tool implementations
|
|
10
|
+
*/
|
|
11
|
+
export class BaseTool {
|
|
12
|
+
/**
|
|
13
|
+
* Convert tool to JSON schema for LLM consumption
|
|
14
|
+
*/
|
|
15
|
+
toJSONSchema() {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
const jsonSchema = zodToJsonSchema(this.inputSchema, {
|
|
18
|
+
$refStrategy: 'none',
|
|
19
|
+
});
|
|
20
|
+
// Remove the root $schema property that zod-to-json-schema adds
|
|
21
|
+
const { $schema, ...parameters } = jsonSchema;
|
|
22
|
+
return {
|
|
23
|
+
type: 'function',
|
|
24
|
+
function: {
|
|
25
|
+
name: this.name,
|
|
26
|
+
description: this.description,
|
|
27
|
+
parameters,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Execute with timeout
|
|
33
|
+
*/
|
|
34
|
+
async withTimeout(promise, timeoutMs, timeoutMessage = 'Operation timed out') {
|
|
35
|
+
return Promise.race([
|
|
36
|
+
promise,
|
|
37
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(timeoutMessage)), timeoutMs)),
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Retry with exponential backoff
|
|
42
|
+
*/
|
|
43
|
+
async retry(fn, maxAttempts = 3, delayMs = 1000) {
|
|
44
|
+
let lastError;
|
|
45
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
46
|
+
try {
|
|
47
|
+
return await fn();
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
lastError =
|
|
51
|
+
error instanceof Error ? error : new Error(String(error));
|
|
52
|
+
if (attempt < maxAttempts) {
|
|
53
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs * attempt));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
throw lastError || new Error('All retry attempts failed');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/core/tools/base.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA2BrD;;GAEG;AACH,MAAM,OAAgB,QAAQ;IAU5B;;OAEG;IACH,YAAY;QACV,8DAA8D;QAC9D,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,WAAkB,EAAE;YAC1D,YAAY,EAAE,MAAM;SACrB,CAAC,CAAC;QAEH,gEAAgE;QAChE,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,UAAiB,CAAC;QAErD,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE;gBACR,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,UAAU;aACX;SACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,WAAW,CACzB,OAAmB,EACnB,SAAiB,EACjB,cAAc,GAAG,qBAAqB;QAEtC,OAAO,OAAO,CAAC,IAAI,CAAC;YAClB,OAAO;YACP,IAAI,OAAO,CAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAC3B,UAAU,CACR,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,EACvC,SAAS,CACV,CACF;SACF,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,KAAK,CACnB,EAAoB,EACpB,WAAW,GAAG,CAAC,EACf,OAAO,GAAG,IAAI;QAEd,IAAI,SAA4B,CAAC;QAEjC,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,IAAI,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;YACxD,IAAI,CAAC;gBACH,OAAO,MAAM,EAAE,EAAE,CAAC;YACpB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,SAAS;oBACP,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAE5D,IAAI,OAAO,GAAG,WAAW,EAAE,CAAC;oBAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CACvC,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,SAAS,IAAI,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BashTool
|
|
3
|
+
*
|
|
4
|
+
* Executes bash commands with safety safeguards.
|
|
5
|
+
* Adapted for bun's subprocess API.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { BaseTool, type ToolContext } from './base.js';
|
|
9
|
+
declare const bashInputSchema: z.ZodObject<{
|
|
10
|
+
command: z.ZodString;
|
|
11
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
12
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
command: string;
|
|
15
|
+
timeoutMs: number;
|
|
16
|
+
cwd?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
command: string;
|
|
19
|
+
cwd?: string | undefined;
|
|
20
|
+
timeoutMs?: number | undefined;
|
|
21
|
+
}>;
|
|
22
|
+
type BashInput = z.infer<typeof bashInputSchema>;
|
|
23
|
+
interface BashOutput {
|
|
24
|
+
command: string;
|
|
25
|
+
stdout: string;
|
|
26
|
+
stderr: string;
|
|
27
|
+
exitCode: number;
|
|
28
|
+
timedOut: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* BashTool for bun runtime
|
|
32
|
+
* Uses bun.spawn() for subprocess execution
|
|
33
|
+
*/
|
|
34
|
+
export declare class BashTool extends BaseTool<any, BashOutput> {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
inputSchema: any;
|
|
38
|
+
private logger;
|
|
39
|
+
private getArtifactsDir;
|
|
40
|
+
/**
|
|
41
|
+
* Validate command for dangerous patterns
|
|
42
|
+
*/
|
|
43
|
+
private validateCommand;
|
|
44
|
+
/**
|
|
45
|
+
* Execute bash command using bun.spawn()
|
|
46
|
+
*/
|
|
47
|
+
execute(input: BashInput, ctx: ToolContext): Promise<BashOutput>;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=bash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAIvD,QAAA,MAAM,eAAe;;;;;;;;;;;;EAOnB,CAAC;AAEH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEjD,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAiBD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACrD,IAAI,SAAU;IACd,WAAW,SAAmD;IAC9D,WAAW,EAAE,GAAG,CAAmB;IAEnC,OAAO,CAAC,MAAM,CAAe;IAE7B,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAuCvB;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;CA8HvE"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BashTool
|
|
3
|
+
*
|
|
4
|
+
* Executes bash commands with safety safeguards.
|
|
5
|
+
* Adapted for bun's subprocess API.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { BaseTool } from './base.js';
|
|
9
|
+
import { resolve } from 'path';
|
|
10
|
+
import { getLogger } from '../../util/logger.js';
|
|
11
|
+
const bashInputSchema = z.object({
|
|
12
|
+
command: z.string().describe('The bash command to execute'),
|
|
13
|
+
cwd: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Working directory (defaults to artifacts dir)'),
|
|
17
|
+
timeoutMs: z.number().default(30000).describe('Command timeout in milliseconds'),
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Dangerous command patterns that are blocked
|
|
21
|
+
*/
|
|
22
|
+
const DANGEROUS_PATTERNS = [
|
|
23
|
+
'rm -rf /',
|
|
24
|
+
'sudo',
|
|
25
|
+
'chmod 777',
|
|
26
|
+
'mkfs',
|
|
27
|
+
'dd if=',
|
|
28
|
+
':(){ :|:& };:',
|
|
29
|
+
'> /dev/sda',
|
|
30
|
+
];
|
|
31
|
+
const DANGEROUS_START_PATTERNS = ['shutdown', 'reboot', 'halt', 'poweroff'];
|
|
32
|
+
/**
|
|
33
|
+
* BashTool for bun runtime
|
|
34
|
+
* Uses bun.spawn() for subprocess execution
|
|
35
|
+
*/
|
|
36
|
+
export class BashTool extends BaseTool {
|
|
37
|
+
name = 'bash';
|
|
38
|
+
description = 'Execute a bash command with safety safeguards';
|
|
39
|
+
inputSchema = bashInputSchema;
|
|
40
|
+
logger = getLogger();
|
|
41
|
+
getArtifactsDir(ctx) {
|
|
42
|
+
return resolve(ctx.artifactsDir || process.env.ARTIFACTS_DIR || './artifacts');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate command for dangerous patterns
|
|
46
|
+
*/
|
|
47
|
+
validateCommand(command) {
|
|
48
|
+
const normalizedCommand = command.toLowerCase().trim();
|
|
49
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
50
|
+
if (normalizedCommand.includes(pattern.toLowerCase())) {
|
|
51
|
+
throw new Error(`Disallowed command pattern detected: ${pattern}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (const pattern of DANGEROUS_START_PATTERNS) {
|
|
55
|
+
if (normalizedCommand.startsWith(pattern)) {
|
|
56
|
+
throw new Error(`Disallowed command: commands starting with '${pattern}' are not allowed`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Check chained commands
|
|
60
|
+
const chainedCommands = command.split(/&&|;/).map((cmd) => cmd.trim().toLowerCase());
|
|
61
|
+
for (const chainedCmd of chainedCommands) {
|
|
62
|
+
for (const pattern of DANGEROUS_PATTERNS) {
|
|
63
|
+
if (chainedCmd.includes(pattern.toLowerCase())) {
|
|
64
|
+
throw new Error(`Disallowed chained command pattern detected: ${pattern}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
for (const pattern of DANGEROUS_START_PATTERNS) {
|
|
68
|
+
if (chainedCmd.startsWith(pattern)) {
|
|
69
|
+
throw new Error(`Disallowed chained command: '${pattern}' is not allowed`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Execute bash command using bun.spawn()
|
|
76
|
+
*/
|
|
77
|
+
async execute(input, ctx) {
|
|
78
|
+
this.validateCommand(input.command);
|
|
79
|
+
const workingDir = input.cwd
|
|
80
|
+
? resolve(input.cwd)
|
|
81
|
+
: this.getArtifactsDir(ctx);
|
|
82
|
+
const timeoutMs = input.timeoutMs ?? 30000;
|
|
83
|
+
this.logger.info(`Executing bash command: ${input.command} (cwd: ${workingDir}, timeout: ${timeoutMs}ms)`);
|
|
84
|
+
try {
|
|
85
|
+
// Use bun's native spawn API
|
|
86
|
+
// In bun, spawn is available globally
|
|
87
|
+
const bunGlobal = globalThis;
|
|
88
|
+
const Bun = bunGlobal.Bun || bunGlobal;
|
|
89
|
+
if (!Bun?.spawn) {
|
|
90
|
+
throw new Error('bun.spawn not available');
|
|
91
|
+
}
|
|
92
|
+
const proc = Bun.spawn({
|
|
93
|
+
cmd: ['bash', '-c', input.command],
|
|
94
|
+
cwd: workingDir,
|
|
95
|
+
stdout: 'pipe',
|
|
96
|
+
stderr: 'pipe',
|
|
97
|
+
});
|
|
98
|
+
// Convert streams to text with timeout
|
|
99
|
+
let stdout = '';
|
|
100
|
+
let stderr = '';
|
|
101
|
+
let timedOut = false;
|
|
102
|
+
const readStdout = proc.stdout
|
|
103
|
+
.text()
|
|
104
|
+
.then((text) => {
|
|
105
|
+
stdout = text;
|
|
106
|
+
})
|
|
107
|
+
.catch(() => {
|
|
108
|
+
/* ignore */
|
|
109
|
+
});
|
|
110
|
+
const readStderr = proc.stderr
|
|
111
|
+
.text()
|
|
112
|
+
.then((text) => {
|
|
113
|
+
stderr = text;
|
|
114
|
+
})
|
|
115
|
+
.catch(() => {
|
|
116
|
+
/* ignore */
|
|
117
|
+
});
|
|
118
|
+
// Set up timeout
|
|
119
|
+
const timeout = new Promise((_, reject) => setTimeout(() => {
|
|
120
|
+
timedOut = true;
|
|
121
|
+
reject(new Error(`Command timed out after ${timeoutMs}ms`));
|
|
122
|
+
}, timeoutMs));
|
|
123
|
+
try {
|
|
124
|
+
// Wait for process and stream reads with timeout
|
|
125
|
+
await Promise.race([
|
|
126
|
+
Promise.all([proc.exited, readStdout, readStderr]),
|
|
127
|
+
timeout,
|
|
128
|
+
]);
|
|
129
|
+
const exitCode = await proc.exited;
|
|
130
|
+
this.logger.info(`Command completed with exit code: ${exitCode} (stdout: ${stdout.length} bytes, stderr: ${stderr.length} bytes)`);
|
|
131
|
+
if (ctx.onEvent) {
|
|
132
|
+
if (exitCode === 0) {
|
|
133
|
+
ctx.onEvent('tool:bash:completed', {
|
|
134
|
+
status: 'success',
|
|
135
|
+
exitCode,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
ctx.onEvent('tool:bash:completed', {
|
|
140
|
+
status: 'failed',
|
|
141
|
+
exitCode,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
command: input.command,
|
|
147
|
+
stdout,
|
|
148
|
+
stderr,
|
|
149
|
+
exitCode,
|
|
150
|
+
timedOut: false,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (timedOut) {
|
|
155
|
+
return {
|
|
156
|
+
command: input.command,
|
|
157
|
+
stdout,
|
|
158
|
+
stderr: stderr || `Command timed out after ${timeoutMs}ms`,
|
|
159
|
+
exitCode: 124, // Standard timeout exit code
|
|
160
|
+
timedOut: true,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
this.logger.error(`Bash command failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
168
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
169
|
+
return {
|
|
170
|
+
command: input.command,
|
|
171
|
+
stdout: '',
|
|
172
|
+
stderr: errorMessage,
|
|
173
|
+
exitCode: 1,
|
|
174
|
+
timedOut: false,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=bash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/core/tools/bash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAoB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC3D,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;IAC5D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,iCAAiC,CAAC;CACjF,CAAC,CAAC;AAYH;;GAEG;AACH,MAAM,kBAAkB,GAAG;IACzB,UAAU;IACV,MAAM;IACN,WAAW;IACX,MAAM;IACN,QAAQ;IACR,eAAe;IACf,YAAY;CACb,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAE5E;;;GAGG;AACH,MAAM,OAAO,QAAS,SA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@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edit Tool
|
|
3
|
+
*
|
|
4
|
+
* Edit an existing file by replacing specific text with new text
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { BaseTool, type ToolContext } from './base.js';
|
|
8
|
+
declare const editInputSchema: z.ZodObject<{
|
|
9
|
+
path: z.ZodString;
|
|
10
|
+
oldText: z.ZodString;
|
|
11
|
+
newText: z.ZodString;
|
|
12
|
+
replaceAll: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
path: string;
|
|
15
|
+
replaceAll: boolean;
|
|
16
|
+
oldText: string;
|
|
17
|
+
newText: string;
|
|
18
|
+
}, {
|
|
19
|
+
path: string;
|
|
20
|
+
oldText: string;
|
|
21
|
+
newText: string;
|
|
22
|
+
replaceAll?: boolean | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
type EditInput = z.infer<typeof editInputSchema>;
|
|
25
|
+
interface EditOutput {
|
|
26
|
+
path: string;
|
|
27
|
+
fullPath: string;
|
|
28
|
+
replacements: number;
|
|
29
|
+
success: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare class EditTool extends BaseTool<any, EditOutput> {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
inputSchema: any;
|
|
35
|
+
private getArtifactsDir;
|
|
36
|
+
execute(input: EditInput, ctx: ToolContext): Promise<EditOutput>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../src/core/tools/edit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAEvD,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;EAKnB,CAAC;AAEH,KAAK,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEjD,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,QAAS,SAAQ,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACrD,IAAI,SAAU;IACd,WAAW,SAAoE;IAC/E,WAAW,EAAE,GAAG,CAAmB;IAEnC,OAAO,CAAC,eAAe;IAIjB,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;CAsDvE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edit Tool
|
|
3
|
+
*
|
|
4
|
+
* Edit an existing file by replacing specific text with new text
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { resolve } from 'path';
|
|
8
|
+
import { BaseTool } from './base.js';
|
|
9
|
+
const editInputSchema = z.object({
|
|
10
|
+
path: z.string().describe('File path relative to artifacts directory'),
|
|
11
|
+
oldText: z.string().describe('The exact text to find and replace'),
|
|
12
|
+
newText: z.string().describe('The text to replace with'),
|
|
13
|
+
replaceAll: z.boolean().default(false).describe('Whether to replace all occurrences'),
|
|
14
|
+
});
|
|
15
|
+
export class EditTool extends BaseTool {
|
|
16
|
+
name = 'edit';
|
|
17
|
+
description = 'Edit an existing file by replacing specific text with new text';
|
|
18
|
+
inputSchema = editInputSchema;
|
|
19
|
+
getArtifactsDir(ctx) {
|
|
20
|
+
return resolve(ctx.artifactsDir || process.env.ARTIFACTS_DIR || './artifacts');
|
|
21
|
+
}
|
|
22
|
+
async execute(input, ctx) {
|
|
23
|
+
const ARTIFACTS_DIR = this.getArtifactsDir(ctx);
|
|
24
|
+
const fullPath = resolve(ARTIFACTS_DIR, input.path);
|
|
25
|
+
if (!fullPath.startsWith(ARTIFACTS_DIR)) {
|
|
26
|
+
throw new Error('Invalid path: must be within artifacts directory');
|
|
27
|
+
}
|
|
28
|
+
const safePath = fullPath.substring(ARTIFACTS_DIR.length + 1);
|
|
29
|
+
ctx.logger.info(`Editing file: ${safePath}`);
|
|
30
|
+
try {
|
|
31
|
+
const file = Bun.file(fullPath);
|
|
32
|
+
const exists = await file.exists();
|
|
33
|
+
if (!exists) {
|
|
34
|
+
throw new Error(`File not found: ${safePath}`);
|
|
35
|
+
}
|
|
36
|
+
const content = await file.text();
|
|
37
|
+
if (!content.includes(input.oldText)) {
|
|
38
|
+
throw new Error(`Text not found in file: "${input.oldText.slice(0, 50)}${input.oldText.length > 50 ? '...' : ''}"`);
|
|
39
|
+
}
|
|
40
|
+
let newContent;
|
|
41
|
+
let replacements;
|
|
42
|
+
if (input.replaceAll) {
|
|
43
|
+
const parts = content.split(input.oldText);
|
|
44
|
+
replacements = parts.length - 1;
|
|
45
|
+
newContent = parts.join(input.newText);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
replacements = 1;
|
|
49
|
+
newContent = content.replace(input.oldText, input.newText);
|
|
50
|
+
}
|
|
51
|
+
await Bun.write(fullPath, newContent);
|
|
52
|
+
ctx.logger.info(`Made ${replacements} replacement(s) in ${safePath}`);
|
|
53
|
+
ctx.emitEvent?.completed?.(`✏️ Made ${replacements} replacement(s) in ${safePath}`);
|
|
54
|
+
return {
|
|
55
|
+
path: safePath,
|
|
56
|
+
fullPath,
|
|
57
|
+
replacements,
|
|
58
|
+
success: true,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
ctx.logger.error({ err: error }, 'File edit failed');
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=edit.js.map
|
|
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CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7D,CAAC;YAED,MAAM,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAEtC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,YAAY,sBAAsB,QAAQ,EAAE,CAAC,CAAC;YACtE,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC,WAAW,YAAY,sBAAsB,QAAQ,EAAE,CAAC,CAAC;YAEpF,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,QAAQ;gBACR,YAAY;gBACZ,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,kBAAkB,CAAC,CAAC;YACrD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Executes tools during agent execution with validation and error handling.
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolResult } from '../../types/index.js';
|
|
7
|
+
import type { ToolRegistry } from './registry.js';
|
|
8
|
+
/**
|
|
9
|
+
* Tool executor for running tools during execution
|
|
10
|
+
*/
|
|
11
|
+
export declare class ToolExecutor {
|
|
12
|
+
private registry;
|
|
13
|
+
private logger;
|
|
14
|
+
private artifactsDir;
|
|
15
|
+
constructor(registry: ToolRegistry, artifactsDir?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Execute a tool call
|
|
18
|
+
*/
|
|
19
|
+
execute(toolName: string, input: any, toolCallId?: string): Promise<ToolResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Validate tool input against schema
|
|
22
|
+
*/
|
|
23
|
+
validateToolInput(toolName: string, input: any): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get tool schema
|
|
26
|
+
*/
|
|
27
|
+
getToolSchema(toolName: string): import("../../types/agent.js").ToolDefinition | null;
|
|
28
|
+
/**
|
|
29
|
+
* List available tools
|
|
30
|
+
*/
|
|
31
|
+
listTools(): import("../../types/agent.js").ToolDefinition[];
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/core/tools/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAKlD;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAS;gBAEjB,QAAQ,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE,MAAM;IAKzD;;OAEG;IACG,OAAO,CACX,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,EACV,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC;IA+DtB;;OAEG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO;IAexD;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM;IAQ9B;;OAEG;IACH,SAAS;CAGV"}
|