@eko-ai/eko 1.0.8 → 1.0.9
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 +14 -6
- package/dist/core/eko.d.ts +3 -2
- package/dist/extension/tools/get_all_tabs.d.ts +9 -0
- package/dist/extension/tools/index.d.ts +3 -1
- package/dist/extension/tools/tab_management.d.ts +1 -1
- package/dist/extension/utils.d.ts +1 -1
- package/dist/extension.cjs.js +687 -216
- package/dist/extension.esm.js +687 -216
- package/dist/index.cjs.js +451 -127
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +451 -128
- package/dist/models/action.d.ts +8 -4
- package/dist/models/workflow.d.ts +8 -3
- package/dist/nodejs/tools/index.d.ts +1 -0
- package/dist/nodejs.cjs.js +211 -2
- package/dist/nodejs.esm.js +211 -2
- package/dist/schemas/workflow.schema.d.ts +2 -13
- package/dist/services/llm/claude-provider.d.ts +2 -1
- package/dist/services/llm/openai-provider.d.ts +2 -1
- package/dist/services/parser/workflow-parser.d.ts +0 -7
- package/dist/types/action.types.d.ts +8 -3
- package/dist/types/tools.types.d.ts +44 -1
- package/dist/types/workflow.types.d.ts +22 -9
- package/dist/universal_tools/cancel_workflow.d.ts +9 -0
- package/dist/universal_tools/human.d.ts +30 -0
- package/dist/universal_tools/index.d.ts +4 -0
- package/dist/universal_tools/summary_workflow.d.ts +9 -0
- package/dist/utils/execution-logger.d.ts +69 -0
- package/package.json +2 -3
|
@@ -41,6 +41,13 @@ export interface OpenUrlResult {
|
|
|
41
41
|
windowId: number;
|
|
42
42
|
title?: string;
|
|
43
43
|
}
|
|
44
|
+
export interface BrowserTab {
|
|
45
|
+
id: number;
|
|
46
|
+
url?: string;
|
|
47
|
+
title?: string;
|
|
48
|
+
content: string;
|
|
49
|
+
description: string;
|
|
50
|
+
}
|
|
44
51
|
export interface ScreenshotResult {
|
|
45
52
|
image: ScreenshotImage;
|
|
46
53
|
}
|
|
@@ -50,7 +57,7 @@ export interface ScreenshotImage {
|
|
|
50
57
|
data: string;
|
|
51
58
|
}
|
|
52
59
|
export interface TabManagementParam {
|
|
53
|
-
|
|
60
|
+
command: string;
|
|
54
61
|
}
|
|
55
62
|
export type TabManagementResult = TabInfo | CloseTabInfo | TabInfo[];
|
|
56
63
|
export interface TabInfo {
|
|
@@ -86,3 +93,39 @@ export interface ElementRect {
|
|
|
86
93
|
width?: number;
|
|
87
94
|
height?: number;
|
|
88
95
|
}
|
|
96
|
+
export interface CancelWorkflowInput {
|
|
97
|
+
reason: string;
|
|
98
|
+
}
|
|
99
|
+
export interface HumanInputTextInput {
|
|
100
|
+
question: string;
|
|
101
|
+
}
|
|
102
|
+
export interface HumanInputTextResult {
|
|
103
|
+
status: string;
|
|
104
|
+
answer: string;
|
|
105
|
+
}
|
|
106
|
+
export interface HumanInputSingleChoiceInput {
|
|
107
|
+
question: string;
|
|
108
|
+
choices: string[];
|
|
109
|
+
}
|
|
110
|
+
export interface HumanInputSingleChoiceResult {
|
|
111
|
+
status: string;
|
|
112
|
+
answer: string;
|
|
113
|
+
}
|
|
114
|
+
export interface HumanInputMultipleChoiceInput {
|
|
115
|
+
question: string;
|
|
116
|
+
choices: string[];
|
|
117
|
+
}
|
|
118
|
+
export interface HumanInputMultipleChoiceResult {
|
|
119
|
+
status: string;
|
|
120
|
+
answer: string[];
|
|
121
|
+
}
|
|
122
|
+
export interface HumanOperateInput {
|
|
123
|
+
reason: string;
|
|
124
|
+
}
|
|
125
|
+
export interface HumanOperateResult {
|
|
126
|
+
status: string;
|
|
127
|
+
userOperation: string;
|
|
128
|
+
}
|
|
129
|
+
export interface SummaryWorkflowInput {
|
|
130
|
+
summary: string;
|
|
131
|
+
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { Action, ExecutionContext, Tool } from "./action.types";
|
|
2
2
|
import { LLMProvider } from "./llm.types";
|
|
3
|
+
import { ExecutionLogger } from "@/utils/execution-logger";
|
|
4
|
+
export interface NodeOutput {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
value?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface NodeInput {
|
|
10
|
+
items: NodeOutput[];
|
|
11
|
+
}
|
|
3
12
|
export interface WorkflowNode {
|
|
4
13
|
id: string;
|
|
5
14
|
name: string;
|
|
6
15
|
description?: string;
|
|
7
|
-
input: NodeIO;
|
|
8
|
-
output: NodeIO;
|
|
9
|
-
action: Action;
|
|
10
16
|
dependencies: string[];
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
schema: object;
|
|
15
|
-
value: unknown;
|
|
17
|
+
action: Action;
|
|
18
|
+
input: NodeInput;
|
|
19
|
+
output: NodeOutput;
|
|
16
20
|
}
|
|
17
21
|
export interface Workflow {
|
|
18
22
|
id: string;
|
|
@@ -21,7 +25,9 @@ export interface Workflow {
|
|
|
21
25
|
nodes: WorkflowNode[];
|
|
22
26
|
variables: Map<string, any>;
|
|
23
27
|
llmProvider?: LLMProvider;
|
|
24
|
-
|
|
28
|
+
setLogger(logger: ExecutionLogger): void;
|
|
29
|
+
execute(callback?: WorkflowCallback): Promise<NodeOutput[]>;
|
|
30
|
+
cancel(): Promise<void>;
|
|
25
31
|
addNode(node: WorkflowNode): void;
|
|
26
32
|
removeNode(nodeId: string): void;
|
|
27
33
|
getNode(nodeId: string): WorkflowNode;
|
|
@@ -35,5 +41,12 @@ export interface WorkflowCallback {
|
|
|
35
41
|
afterToolUse?: (tool: Tool<any, any>, context: ExecutionContext, result: any) => Promise<any>;
|
|
36
42
|
afterSubtask?: (subtask: WorkflowNode, context: ExecutionContext, result: any) => Promise<void>;
|
|
37
43
|
afterWorkflow?: (workflow: Workflow, variables: Map<string, unknown>) => Promise<void>;
|
|
44
|
+
onTabCreated?: (tabId: number) => Promise<void>;
|
|
45
|
+
onLlmMessage?: (textContent: string) => Promise<void>;
|
|
46
|
+
onHumanInputText?: (question: string) => Promise<string>;
|
|
47
|
+
onHumanInputSingleChoice?: (question: string, choices: string[]) => Promise<string>;
|
|
48
|
+
onHumanInputMultipleChoice?: (question: string, choices: string[]) => Promise<string[]>;
|
|
49
|
+
onHumanOperate?: (reason: string) => Promise<string>;
|
|
50
|
+
onSummaryWorkflow?: (summary: string) => Promise<void>;
|
|
38
51
|
};
|
|
39
52
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CancelWorkflowInput } from '../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../types/action.types';
|
|
3
|
+
export declare class CancelWorkflow implements Tool<CancelWorkflowInput, void> {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
input_schema: InputSchema;
|
|
7
|
+
constructor();
|
|
8
|
+
execute(context: ExecutionContext, params: CancelWorkflowInput): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HumanInputTextInput, HumanInputTextResult, HumanInputSingleChoiceInput, HumanInputSingleChoiceResult, HumanInputMultipleChoiceInput, HumanInputMultipleChoiceResult, HumanOperateInput, HumanOperateResult } from '../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../types/action.types';
|
|
3
|
+
export declare class HumanInputText implements Tool<HumanInputTextInput, HumanInputTextResult> {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
input_schema: InputSchema;
|
|
7
|
+
constructor();
|
|
8
|
+
execute(context: ExecutionContext, params: HumanInputTextInput): Promise<HumanInputTextResult>;
|
|
9
|
+
}
|
|
10
|
+
export declare class HumanInputSingleChoice implements Tool<HumanInputSingleChoiceInput, HumanInputSingleChoiceResult> {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
input_schema: InputSchema;
|
|
14
|
+
constructor();
|
|
15
|
+
execute(context: ExecutionContext, params: HumanInputSingleChoiceInput): Promise<HumanInputSingleChoiceResult>;
|
|
16
|
+
}
|
|
17
|
+
export declare class HumanInputMultipleChoice implements Tool<HumanInputMultipleChoiceInput, HumanInputMultipleChoiceResult> {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
input_schema: InputSchema;
|
|
21
|
+
constructor();
|
|
22
|
+
execute(context: ExecutionContext, params: HumanInputMultipleChoiceInput): Promise<HumanInputMultipleChoiceResult>;
|
|
23
|
+
}
|
|
24
|
+
export declare class HumanOperate implements Tool<HumanOperateInput, HumanOperateResult> {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
input_schema: InputSchema;
|
|
28
|
+
constructor();
|
|
29
|
+
execute(context: ExecutionContext, params: HumanOperateInput): Promise<HumanOperateResult>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CancelWorkflow } from "./cancel_workflow";
|
|
2
|
+
import { HumanInputText, HumanInputSingleChoice, HumanInputMultipleChoice, HumanOperate } from "./human";
|
|
3
|
+
import { SummaryWorkflow } from "./summary_workflow";
|
|
4
|
+
export { CancelWorkflow, HumanInputText, HumanInputSingleChoice, HumanInputMultipleChoice, HumanOperate, SummaryWorkflow, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SummaryWorkflowInput } from '../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../types/action.types';
|
|
3
|
+
export declare class SummaryWorkflow implements Tool<SummaryWorkflowInput, any> {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
input_schema: InputSchema;
|
|
7
|
+
constructor();
|
|
8
|
+
execute(context: ExecutionContext, params: SummaryWorkflowInput): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Message } from '../types/llm.types';
|
|
2
|
+
import { ExecutionContext } from '../types/action.types';
|
|
3
|
+
interface ImageData {
|
|
4
|
+
type: 'base64';
|
|
5
|
+
media_type: string;
|
|
6
|
+
data: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LogOptions {
|
|
9
|
+
maxHistoryLength?: number;
|
|
10
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
11
|
+
includeTimestamp?: boolean;
|
|
12
|
+
debugImagePath?: string;
|
|
13
|
+
imageSaver?: (imageData: ImageData, filename: string) => Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Manages logging for action execution, providing a cleaner view of the execution
|
|
17
|
+
* flow while maintaining important context and history.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ExecutionLogger {
|
|
20
|
+
private history;
|
|
21
|
+
private readonly maxHistoryLength;
|
|
22
|
+
private readonly logLevel;
|
|
23
|
+
private readonly includeTimestamp;
|
|
24
|
+
private readonly debugImagePath?;
|
|
25
|
+
private readonly imageSaver?;
|
|
26
|
+
private readonly isNode;
|
|
27
|
+
constructor(options?: LogOptions);
|
|
28
|
+
/**
|
|
29
|
+
* Logs a message with execution context
|
|
30
|
+
*/
|
|
31
|
+
log(level: string, message: string, context?: ExecutionContext): void;
|
|
32
|
+
/**
|
|
33
|
+
* Updates conversation history while maintaining size limit
|
|
34
|
+
*/
|
|
35
|
+
updateHistory(messages: Message[]): void;
|
|
36
|
+
/**
|
|
37
|
+
* Gets current conversation history
|
|
38
|
+
*/
|
|
39
|
+
getHistory(): Message[];
|
|
40
|
+
/**
|
|
41
|
+
* Summarizes the execution context for logging
|
|
42
|
+
*/
|
|
43
|
+
private summarizeContext;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if message should be logged based on log level
|
|
46
|
+
*/
|
|
47
|
+
private shouldLog;
|
|
48
|
+
/**
|
|
49
|
+
* Logs the start of an action execution
|
|
50
|
+
*/
|
|
51
|
+
logActionStart(actionName: string, input: unknown, context?: ExecutionContext): void;
|
|
52
|
+
/**
|
|
53
|
+
* Logs the completion of an action execution
|
|
54
|
+
*/
|
|
55
|
+
logActionComplete(actionName: string, result: unknown, context?: ExecutionContext): void;
|
|
56
|
+
/**
|
|
57
|
+
* Logs a tool execution
|
|
58
|
+
*/
|
|
59
|
+
logToolExecution(toolName: string, input: unknown, context?: ExecutionContext): void;
|
|
60
|
+
/**
|
|
61
|
+
* Logs an error that occurred during execution
|
|
62
|
+
*/
|
|
63
|
+
logError(error: Error, context?: ExecutionContext): void;
|
|
64
|
+
private extractFromDataUrl;
|
|
65
|
+
private saveDebugImage;
|
|
66
|
+
private formatToolResult;
|
|
67
|
+
logToolResult(toolName: string, result: unknown, context?: ExecutionContext): Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eko-ai/eko",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Empowering language to transform human words into action.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -102,6 +102,5 @@
|
|
|
102
102
|
},
|
|
103
103
|
"engines": {
|
|
104
104
|
"node": ">=18.0.0"
|
|
105
|
-
}
|
|
106
|
-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
105
|
+
}
|
|
107
106
|
}
|