@minded-ai/mindedjs 2.0.11-beta.1 → 2.0.11
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/dist/browserTask/executeBrowserTask.d.ts +4 -11
- package/dist/browserTask/executeBrowserTask.d.ts.map +1 -1
- package/dist/browserTask/executeBrowserTask.js +12 -20
- package/dist/browserTask/executeBrowserTask.js.map +1 -1
- package/dist/browserTask/executeBrowserTask.py +10 -52
- package/dist/cli/index.js +0 -0
- package/dist/nodes/addBrowserTaskNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskNode.js +6 -4
- package/dist/nodes/addBrowserTaskNode.js.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.js +12 -1
- package/dist/nodes/addBrowserTaskRunNode.js.map +1 -1
- package/dist/platform/config.d.ts +2 -0
- package/dist/platform/config.d.ts.map +1 -1
- package/dist/platform/config.js +21 -0
- package/dist/platform/config.js.map +1 -1
- package/dist/types/Flows.types.d.ts +0 -2
- package/dist/types/Flows.types.d.ts.map +1 -1
- package/dist/types/Flows.types.js.map +1 -1
- package/docs/getting-started/environment-configuration.md +15 -0
- package/docs/platform/operator.md +0 -1
- package/package.json +1 -1
- package/src/browserTask/executeBrowserTask.py +10 -52
- package/src/browserTask/executeBrowserTask.ts +21 -35
- package/src/browserTask/types.ts +37 -0
- package/src/nodes/addBrowserTaskNode.ts +8 -5
- package/src/nodes/addBrowserTaskRunNode.ts +6 -5
- package/src/platform/config.ts +23 -0
- package/src/types/Flows.types.ts +0 -2
- package/dist/browserTask/cdp.d.ts +0 -23
- package/dist/browserTask/cdp.d.ts.map +0 -1
- package/dist/browserTask/cdp.js +0 -162
- package/dist/browserTask/cdp.js.map +0 -1
- package/dist/guidelines/guidelinesManager.d.ts +0 -37
- package/dist/guidelines/guidelinesManager.d.ts.map +0 -1
- package/dist/guidelines/guidelinesManager.js +0 -172
- package/dist/guidelines/guidelinesManager.js.map +0 -1
- package/dist/internalTools/retell.d.ts +0 -12
- package/dist/internalTools/retell.d.ts.map +0 -1
- package/dist/internalTools/retell.js +0 -54
- package/dist/internalTools/retell.js.map +0 -1
- package/dist/internalTools/sendPlaceholderMessage.d.ts +0 -14
- package/dist/internalTools/sendPlaceholderMessage.d.ts.map +0 -1
- package/dist/internalTools/sendPlaceholderMessage.js +0 -61
- package/dist/internalTools/sendPlaceholderMessage.js.map +0 -1
- package/dist/platform/mindedChatOpenAI.d.ts +0 -5
- package/dist/platform/mindedChatOpenAI.d.ts.map +0 -1
- package/dist/platform/mindedChatOpenAI.js +0 -23
- package/dist/platform/mindedChatOpenAI.js.map +0 -1
- package/dist/utils/extractStateMemoryResponse.d.ts +0 -5
- package/dist/utils/extractStateMemoryResponse.d.ts.map +0 -1
- package/dist/utils/extractStateMemoryResponse.js +0 -91
- package/dist/utils/extractStateMemoryResponse.js.map +0 -1
- package/dist/utils/extractToolMemoryResponse.d.ts +0 -4
- package/dist/utils/extractToolMemoryResponse.d.ts.map +0 -1
- package/dist/utils/extractToolMemoryResponse.js +0 -16
- package/dist/utils/extractToolMemoryResponse.js.map +0 -1
|
@@ -5,8 +5,6 @@ from pydantic import BaseModel, create_model, Field
|
|
|
5
5
|
from browser_use import Agent, Controller
|
|
6
6
|
from browser_use.browser import BrowserProfile, BrowserSession
|
|
7
7
|
from browser_use.llm import ChatOpenAI
|
|
8
|
-
from browser_use.core.controller import ActionResult
|
|
9
|
-
from playwright.async_api import Page
|
|
10
8
|
import os
|
|
11
9
|
import sys
|
|
12
10
|
from dotenv import load_dotenv
|
|
@@ -45,12 +43,12 @@ def create_pydantic_model_from_schema(output_schema: Optional[List[Dict[str, Any
|
|
|
45
43
|
return None
|
|
46
44
|
|
|
47
45
|
|
|
48
|
-
async def main(session_id: str, cdp_url: str, task: str, output_schema_json: Optional[str] = None
|
|
46
|
+
async def main(session_id: str, cdp_url: str, task: str, output_schema_json: Optional[str] = None):
|
|
49
47
|
llm = ChatOpenAI(
|
|
50
48
|
model="gpt-4.1",
|
|
51
49
|
api_key=os.getenv("OPENAI_API_KEY"),
|
|
52
50
|
)
|
|
53
|
-
folder_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
51
|
+
folder_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'downloads')
|
|
54
52
|
|
|
55
53
|
# Create folder if it doesn't exist
|
|
56
54
|
os.makedirs(folder_path, exist_ok=True)
|
|
@@ -71,31 +69,11 @@ async def main(session_id: str, cdp_url: str, task: str, output_schema_json: Opt
|
|
|
71
69
|
output_schema = None
|
|
72
70
|
|
|
73
71
|
output_model = create_pydantic_model_from_schema(output_schema)
|
|
74
|
-
|
|
75
|
-
# Build controller and register dynamic tools
|
|
76
|
-
controller = Controller(output_model=output_model) if output_model is not None else Controller()
|
|
77
|
-
|
|
78
|
-
# Dynamically add generate_otp action when OTP secret is provided
|
|
79
|
-
|
|
80
|
-
if otp_secret:
|
|
81
|
-
# Ensure pyotp is available when OTP is requested
|
|
82
|
-
try:
|
|
83
|
-
import pyotp # type: ignore
|
|
84
|
-
except Exception as e:
|
|
85
|
-
raise RuntimeError("pyotp is required when otpSecret is provided. Install it with 'uv add pyotp'.") from e
|
|
86
|
-
|
|
87
|
-
@controller.registry.action("Generate a current 6-digit TOTP code")
|
|
88
|
-
async def generate_otp(page: Page) -> ActionResult:
|
|
89
|
-
try:
|
|
90
|
-
code = pyotp.TOTP(otp_secret).now()
|
|
91
|
-
return ActionResult(extracted_content=code)
|
|
92
|
-
except Exception as e:
|
|
93
|
-
return ActionResult(extracted_content=f"Failed to generate OTP: {e}")
|
|
94
72
|
|
|
95
73
|
agent = Agent(
|
|
96
74
|
task=task,
|
|
97
75
|
llm=llm,
|
|
98
|
-
controller=
|
|
76
|
+
controller=Controller(output_model=output_model) if output_model is not None else Controller(),
|
|
99
77
|
available_file_paths=available_files,
|
|
100
78
|
browser_session=browser_session,
|
|
101
79
|
)
|
|
@@ -124,30 +102,10 @@ async def main(session_id: str, cdp_url: str, task: str, output_schema_json: Opt
|
|
|
124
102
|
print(final_result)
|
|
125
103
|
|
|
126
104
|
if __name__ == '__main__':
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if payload_str:
|
|
136
|
-
try:
|
|
137
|
-
payload = json.loads(payload_str)
|
|
138
|
-
except Exception as e:
|
|
139
|
-
raise SystemExit(f"Failed to parse JSON payload from stdin: {e}")
|
|
140
|
-
|
|
141
|
-
session_id = payload.get('sessionId')
|
|
142
|
-
cdp_url = payload.get('cdpUrl')
|
|
143
|
-
task = payload.get('task')
|
|
144
|
-
output_schema = payload.get('outputSchema')
|
|
145
|
-
otp_secret = payload.get('otpSecret')
|
|
146
|
-
|
|
147
|
-
if not session_id or not cdp_url or not task:
|
|
148
|
-
raise SystemExit("Missing required fields in JSON payload: sessionId, cdpUrl, task")
|
|
149
|
-
|
|
150
|
-
output_schema_json = json.dumps(output_schema) if output_schema is not None else None
|
|
151
|
-
asyncio.run(main(session_id, cdp_url, task, output_schema_json, otp_secret))
|
|
152
|
-
else:
|
|
153
|
-
raise SystemExit("Usage: uv run executeBrowserTask.py; send a JSON payload via stdin")
|
|
105
|
+
if len(sys.argv) < 4:
|
|
106
|
+
raise SystemExit("Usage: uv run executeBrowserTask.py <session_id> <cdp_url> <task> [output_schema_json]")
|
|
107
|
+
session_id = sys.argv[1]
|
|
108
|
+
cdp_url = sys.argv[2]
|
|
109
|
+
task = sys.argv[3]
|
|
110
|
+
output_schema_json = sys.argv[4] if len(sys.argv) > 4 else None
|
|
111
|
+
asyncio.run(main(session_id, cdp_url, task, output_schema_json))
|
|
@@ -12,12 +12,13 @@ import {
|
|
|
12
12
|
DestroyBrowserSessionResponse,
|
|
13
13
|
} from '../platform/mindedConnectionTypes';
|
|
14
14
|
import { kill, getOrStartLocalCDP } from './localBrowserTask';
|
|
15
|
+
import { BrowserTaskMode, InvokeBrowserTaskOptions } from './types';
|
|
15
16
|
|
|
16
17
|
// Socket-based browser task functions
|
|
17
|
-
export const createBrowserSession = async ({ sessionId, proxy,
|
|
18
|
+
export const createBrowserSession = async ({ sessionId, proxy, browserTaskMode }: { sessionId: string, proxy?: string, browserTaskMode: BrowserTaskMode }): Promise<CreateBrowserSessionResponse> => {
|
|
18
19
|
logger.debug({ msg: 'Creating browser session via socket', proxy });
|
|
19
20
|
|
|
20
|
-
if (
|
|
21
|
+
if (browserTaskMode === BrowserTaskMode.LOCAL) {
|
|
21
22
|
const { cdpUrl } = await getOrStartLocalCDP({ headless: false });
|
|
22
23
|
return {
|
|
23
24
|
sessionId,
|
|
@@ -30,7 +31,7 @@ export const createBrowserSession = async ({ sessionId, proxy, onPrem, localRun
|
|
|
30
31
|
{
|
|
31
32
|
type: mindedConnectionSocketMessageType.CREATE_BROWSER_SESSION,
|
|
32
33
|
proxy,
|
|
33
|
-
onPrem:
|
|
34
|
+
onPrem: browserTaskMode === BrowserTaskMode.ON_PREM,
|
|
34
35
|
},
|
|
35
36
|
60000, // 60 seconds timeout
|
|
36
37
|
);
|
|
@@ -79,45 +80,30 @@ export const destroyBrowserSession = async ({ sessionId, onPrem, localRun }: { s
|
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
export const invokeBrowserTask = async (
|
|
82
|
-
|
|
83
|
-
cdpUrl: string,
|
|
84
|
-
task: string,
|
|
85
|
-
keepAlive?: boolean,
|
|
86
|
-
hooks?: { name: string }[],
|
|
87
|
-
onPrem?: boolean,
|
|
88
|
-
localRun?: boolean,
|
|
89
|
-
toolSchemas?: any[],
|
|
90
|
-
outputSchema?: {
|
|
91
|
-
name: string;
|
|
92
|
-
type: 'string' | 'number';
|
|
93
|
-
description?: string;
|
|
94
|
-
required?: boolean;
|
|
95
|
-
}[],
|
|
83
|
+
options: InvokeBrowserTaskOptions,
|
|
96
84
|
): Promise<InvokeBrowserTaskResponse> => {
|
|
97
85
|
|
|
98
86
|
try {
|
|
87
|
+
const {
|
|
88
|
+
sessionId,
|
|
89
|
+
cdpUrl,
|
|
90
|
+
task,
|
|
91
|
+
keepAlive,
|
|
92
|
+
hooks,
|
|
93
|
+
browserTaskMode,
|
|
94
|
+
toolSchemas,
|
|
95
|
+
outputSchema,
|
|
96
|
+
} = options;
|
|
99
97
|
|
|
100
|
-
if (
|
|
98
|
+
if (browserTaskMode === BrowserTaskMode.LOCAL) {
|
|
101
99
|
const pythonScriptPath = path.resolve(__dirname, 'executeBrowserTask.py');
|
|
100
|
+
const outputSchemaArg = JSON.stringify(outputSchema || []);
|
|
102
101
|
|
|
103
|
-
const args = ['run', pythonScriptPath];
|
|
102
|
+
const args = ['run', pythonScriptPath, sessionId, cdpUrl, task, outputSchemaArg];
|
|
104
103
|
|
|
105
104
|
logger.info({ message: 'Spawning Python process', args });
|
|
106
105
|
|
|
107
|
-
const child = spawn('uv', args, { stdio: ['
|
|
108
|
-
|
|
109
|
-
// Build payload to send over stdin
|
|
110
|
-
const payload = {
|
|
111
|
-
sessionId,
|
|
112
|
-
cdpUrl,
|
|
113
|
-
task,
|
|
114
|
-
outputSchema,
|
|
115
|
-
otpSecret: process.env.OTP_SECRET,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// Write JSON payload to stdin
|
|
119
|
-
child.stdin.write(JSON.stringify(payload));
|
|
120
|
-
child.stdin.end();
|
|
106
|
+
const child = spawn('uv', args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
121
107
|
|
|
122
108
|
let stdoutBuffer = '';
|
|
123
109
|
let stderrBuffer = '';
|
|
@@ -168,7 +154,7 @@ export const invokeBrowserTask = async (
|
|
|
168
154
|
taskLength: task.length,
|
|
169
155
|
keepAlive,
|
|
170
156
|
hooksCount: hooks?.length || 0,
|
|
171
|
-
onPrem,
|
|
157
|
+
onPrem: browserTaskMode === BrowserTaskMode.ON_PREM,
|
|
172
158
|
outputSchemaFields: outputSchema?.length || 0,
|
|
173
159
|
});
|
|
174
160
|
|
|
@@ -181,7 +167,7 @@ export const invokeBrowserTask = async (
|
|
|
181
167
|
sessionId,
|
|
182
168
|
keepAlive,
|
|
183
169
|
hooks,
|
|
184
|
-
onPrem,
|
|
170
|
+
onPrem: browserTaskMode === BrowserTaskMode.ON_PREM,
|
|
185
171
|
toolSchemas,
|
|
186
172
|
outputSchema,
|
|
187
173
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export enum BrowserTaskMode {
|
|
2
|
+
ON_PREM = 'onPrem',
|
|
3
|
+
LOCAL = 'localRun',
|
|
4
|
+
CLOUD = 'cloud',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Types used for invoking browser tasks
|
|
8
|
+
export type BrowserTaskHook = { name: string };
|
|
9
|
+
|
|
10
|
+
export type OutputSchemaField = {
|
|
11
|
+
name: string;
|
|
12
|
+
type: 'string' | 'number';
|
|
13
|
+
description?: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ToolSchema = {
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
inputParams: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
23
|
+
description?: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export interface InvokeBrowserTaskOptions {
|
|
29
|
+
sessionId: string;
|
|
30
|
+
cdpUrl: string;
|
|
31
|
+
task: string;
|
|
32
|
+
keepAlive?: boolean;
|
|
33
|
+
hooks?: BrowserTaskHook[];
|
|
34
|
+
browserTaskMode: BrowserTaskMode;
|
|
35
|
+
toolSchemas?: ToolSchema[];
|
|
36
|
+
outputSchema?: OutputSchemaField[];
|
|
37
|
+
}
|
|
@@ -12,6 +12,8 @@ import { tool as langchainTool } from '@langchain/core/tools';
|
|
|
12
12
|
import { LLMProviders } from '../types/LLM.types';
|
|
13
13
|
import { compilePrompt } from './compilePrompt';
|
|
14
14
|
import { combinePlaybooks } from '../playbooks/playbooks';
|
|
15
|
+
import { BrowserTaskMode } from '../browserTask/types';
|
|
16
|
+
import { getConfig } from '../platform/config';
|
|
15
17
|
import { createZodSchemaFromFields } from '../utils/schemaUtils';
|
|
16
18
|
|
|
17
19
|
type AddBrowserTaskNodeParams = {
|
|
@@ -29,7 +31,7 @@ export const addBrowserTaskNode = async ({ graph, node, agent, llm }: AddBrowser
|
|
|
29
31
|
const zodSchema = createZodSchemaFromFields(node.inputSchema);
|
|
30
32
|
|
|
31
33
|
// Create langchain tool
|
|
32
|
-
const tool = langchainTool(() => {}, {
|
|
34
|
+
const tool = langchainTool(() => { }, {
|
|
33
35
|
name: 'browser-task',
|
|
34
36
|
description: node.prompt,
|
|
35
37
|
schema: zodSchema,
|
|
@@ -75,12 +77,13 @@ ${compiledPrompt}
|
|
|
75
77
|
|
|
76
78
|
${Object.keys(inputParams).length > 0 ? `# Input parameters:\n${JSON.stringify(inputParams, null, 2)}\n\n` : ''}`;
|
|
77
79
|
|
|
80
|
+
const { browserTaskMode } = getConfig();
|
|
81
|
+
|
|
78
82
|
// Create browser session using socket
|
|
79
83
|
const session = await createBrowserSession({
|
|
80
84
|
sessionId: state.sessionId,
|
|
81
85
|
proxy: node.proxy,
|
|
82
|
-
|
|
83
|
-
localRun: node.localRun,
|
|
86
|
+
browserTaskMode,
|
|
84
87
|
});
|
|
85
88
|
|
|
86
89
|
if (!session.sessionId || !session.cdpUrl) {
|
|
@@ -120,8 +123,8 @@ ${Object.keys(inputParams).length > 0 ? `# Input parameters:\n${JSON.stringify(i
|
|
|
120
123
|
liveUrl: session.liveViewUrl,
|
|
121
124
|
keepAlive,
|
|
122
125
|
hooks: node.hooks || [],
|
|
123
|
-
onPrem:
|
|
124
|
-
localRun:
|
|
126
|
+
onPrem: browserTaskMode === BrowserTaskMode.ON_PREM,
|
|
127
|
+
localRun: browserTaskMode === BrowserTaskMode.LOCAL,
|
|
125
128
|
outputSchema: node.outputSchema,
|
|
126
129
|
},
|
|
127
130
|
},
|
|
@@ -9,6 +9,7 @@ import { HistoryStep } from '../types/Agent.types';
|
|
|
9
9
|
import { v4 as uuidv4 } from 'uuid';
|
|
10
10
|
import { invokeBrowserTask } from '../browserTask/executeBrowserTask';
|
|
11
11
|
import { zodSchemaToParams } from '../platform/utils/tools';
|
|
12
|
+
import { getConfig } from '../platform/config';
|
|
12
13
|
|
|
13
14
|
type AddBrowserTaskRunNodeParams = {
|
|
14
15
|
graph: PreCompiledGraph;
|
|
@@ -49,18 +50,18 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
49
50
|
inputParams: zodSchemaToParams(tool.input),
|
|
50
51
|
}));
|
|
51
52
|
|
|
53
|
+
const { browserTaskMode } = getConfig();
|
|
52
54
|
// Invoke browser task via socket
|
|
53
|
-
const result = await invokeBrowserTask(
|
|
55
|
+
const result = await invokeBrowserTask({
|
|
54
56
|
sessionId,
|
|
55
57
|
cdpUrl,
|
|
56
|
-
prompt,
|
|
58
|
+
task: prompt,
|
|
57
59
|
keepAlive,
|
|
58
60
|
hooks,
|
|
59
|
-
|
|
60
|
-
browserTaskNode.localRun,
|
|
61
|
+
browserTaskMode,
|
|
61
62
|
toolSchemas,
|
|
62
63
|
outputSchema,
|
|
63
|
-
);
|
|
64
|
+
});
|
|
64
65
|
|
|
65
66
|
logger.debug({
|
|
66
67
|
msg: 'Browser task completed',
|
package/src/platform/config.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { config } from 'dotenv';
|
|
3
3
|
import { Environment } from '../types/Platform.types';
|
|
4
|
+
import { BrowserTaskMode } from '../browserTask/types';
|
|
5
|
+
import { logger } from '../utils/logger';
|
|
4
6
|
const path = resolve(__dirname, '../../.env');
|
|
5
7
|
config({ path });
|
|
6
8
|
|
|
@@ -13,6 +15,23 @@ type MindedConfig = {
|
|
|
13
15
|
dashboardConnected: boolean;
|
|
14
16
|
elevenLabsKey: string | null;
|
|
15
17
|
elevenLabsAgentId: string | null;
|
|
18
|
+
browserTaskMode: BrowserTaskMode;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const parseBrowserTaskMode = (value: string | undefined): BrowserTaskMode => {
|
|
22
|
+
if (!value) {
|
|
23
|
+
return BrowserTaskMode.CLOUD;
|
|
24
|
+
}
|
|
25
|
+
const allowedModes = new Set<string>(Object.values(BrowserTaskMode));
|
|
26
|
+
if (allowedModes.has(value)) {
|
|
27
|
+
return value as BrowserTaskMode;
|
|
28
|
+
}
|
|
29
|
+
logger.warn({
|
|
30
|
+
message: 'Invalid BROWSER_TASK_MODE provided; defaulting to cloud',
|
|
31
|
+
provided: value,
|
|
32
|
+
allowed: Array.from(allowedModes),
|
|
33
|
+
});
|
|
34
|
+
return BrowserTaskMode.CLOUD;
|
|
16
35
|
};
|
|
17
36
|
|
|
18
37
|
export const getConfig = (): MindedConfig => {
|
|
@@ -28,6 +47,7 @@ export const getConfig = (): MindedConfig => {
|
|
|
28
47
|
dashboardConnected: false,
|
|
29
48
|
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
30
49
|
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || null,
|
|
50
|
+
browserTaskMode: parseBrowserTaskMode(process.env.BROWSER_TASK_MODE),
|
|
31
51
|
};
|
|
32
52
|
case Environment.DEVELOPMENT:
|
|
33
53
|
return {
|
|
@@ -39,6 +59,7 @@ export const getConfig = (): MindedConfig => {
|
|
|
39
59
|
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
40
60
|
dashboardConnected: true,
|
|
41
61
|
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || 'agent_01jye194psezr909nwec27m2t9',
|
|
62
|
+
browserTaskMode: parseBrowserTaskMode(process.env.BROWSER_TASK_MODE),
|
|
42
63
|
};
|
|
43
64
|
case Environment.STAGING:
|
|
44
65
|
return {
|
|
@@ -50,6 +71,7 @@ export const getConfig = (): MindedConfig => {
|
|
|
50
71
|
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
51
72
|
dashboardConnected: false,
|
|
52
73
|
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || 'agent_01jye1ajkaf17axpcxg220qwcm',
|
|
74
|
+
browserTaskMode: parseBrowserTaskMode(process.env.BROWSER_TASK_MODE),
|
|
53
75
|
};
|
|
54
76
|
case Environment.PRODUCTION:
|
|
55
77
|
return {
|
|
@@ -61,6 +83,7 @@ export const getConfig = (): MindedConfig => {
|
|
|
61
83
|
elevenLabsKey: process.env.ELEVEN_LABS_API_KEY || null,
|
|
62
84
|
dashboardConnected: false,
|
|
63
85
|
elevenLabsAgentId: process.env.ELEVEN_LABS_AGENT_ID || 'agent_01jye1ajkaf17axpcxg220qwcm',
|
|
86
|
+
browserTaskMode: parseBrowserTaskMode(process.env.BROWSER_TASK_MODE),
|
|
64
87
|
};
|
|
65
88
|
}
|
|
66
89
|
};
|
package/src/types/Flows.types.ts
CHANGED
|
@@ -121,8 +121,6 @@ export interface BrowserTaskNode extends BaseNode {
|
|
|
121
121
|
defaultPayload?: string;
|
|
122
122
|
proxy?: string; // 2-digit country code like 'IL'
|
|
123
123
|
hooks?: { name: string }[]; // Array of hooks to be passed to the browser-use lambda
|
|
124
|
-
onPrem?: boolean;
|
|
125
|
-
localRun?: boolean;
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
export enum RpaActionType {
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type StartChromiumOptions = {
|
|
2
|
-
/** Headless by default. Set to false to see a window. */
|
|
3
|
-
headless?: boolean;
|
|
4
|
-
/** Extra CLI flags to pass to Chromium. */
|
|
5
|
-
extraArgs?: string[];
|
|
6
|
-
/** Provide your own user-data-dir. If omitted, a temp dir is created and later removable via `kill()`. */
|
|
7
|
-
userDataDir?: string;
|
|
8
|
-
/** Extra env vars. */
|
|
9
|
-
env?: NodeJS.ProcessEnv;
|
|
10
|
-
/** How long to wait for the DevTools port to come up (ms). Default: 10000 */
|
|
11
|
-
timeoutMs?: number;
|
|
12
|
-
};
|
|
13
|
-
export type StartedChromium = {
|
|
14
|
-
/** DevTools CDP WebSocket URL, e.g. ws://127.0.0.1:12345/devtools/browser/<id> */
|
|
15
|
-
cdpUrl: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Launch Chromium with --remote-debugging-port=0 and return the CDP ws URL.
|
|
19
|
-
* Works with Chrome/Chromium/Chrome for Testing.
|
|
20
|
-
*/
|
|
21
|
-
export declare function startChromiumAndGetCDP(opts: StartChromiumOptions): Promise<StartedChromium>;
|
|
22
|
-
export declare function kill(): Promise<void>;
|
|
23
|
-
//# sourceMappingURL=cdp.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cdp.d.ts","sourceRoot":"","sources":["../../src/browserTask/cdp.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,oBAAoB,GAAG;IACjC,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,0GAA0G;IAC1G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,eAAe,CAAC,CAmF1B;AA4DD,wBAAsB,IAAI,kBAMzB"}
|
package/dist/browserTask/cdp.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.startChromiumAndGetCDP = startChromiumAndGetCDP;
|
|
27
|
-
exports.kill = kill;
|
|
28
|
-
// startChromiumAndGetCDP.ts
|
|
29
|
-
const child_process_1 = require("child_process");
|
|
30
|
-
const fs = __importStar(require("fs/promises"));
|
|
31
|
-
const fscb = __importStar(require("fs"));
|
|
32
|
-
const path = __importStar(require("path"));
|
|
33
|
-
const os = __importStar(require("os"));
|
|
34
|
-
const http = __importStar(require("http"));
|
|
35
|
-
const playwright_1 = require("playwright");
|
|
36
|
-
let proc;
|
|
37
|
-
/**
|
|
38
|
-
* Launch Chromium with --remote-debugging-port=0 and return the CDP ws URL.
|
|
39
|
-
* Works with Chrome/Chromium/Chrome for Testing.
|
|
40
|
-
*/
|
|
41
|
-
async function startChromiumAndGetCDP(opts) {
|
|
42
|
-
var _a;
|
|
43
|
-
const { headless = true, extraArgs = [], env, timeoutMs = 10000, } = opts;
|
|
44
|
-
const executablePath = playwright_1.chromium.executablePath();
|
|
45
|
-
const userDataDir = (_a = opts.userDataDir) !== null && _a !== void 0 ? _a : (await fs.mkdtemp(path.join(os.tmpdir(), "chromium-profile-")));
|
|
46
|
-
const args = [
|
|
47
|
-
"--remote-debugging-port=0", // let Chrome choose a free port
|
|
48
|
-
`--user-data-dir=${userDataDir}`,
|
|
49
|
-
"--no-first-run",
|
|
50
|
-
"--no-default-browser-check",
|
|
51
|
-
...(headless ? ["--headless=new", "--disable-gpu"] : []),
|
|
52
|
-
// Add your own flags if needed (e.g., '--no-sandbox' in some containers)
|
|
53
|
-
...extraArgs,
|
|
54
|
-
"about:blank",
|
|
55
|
-
];
|
|
56
|
-
proc = (0, child_process_1.spawn)(executablePath, args, {
|
|
57
|
-
stdio: ["ignore", "ignore", "pipe"], // stderr is useful for debugging
|
|
58
|
-
env: { ...process.env, ...env },
|
|
59
|
-
});
|
|
60
|
-
// If Chromium dies early, surface the error.
|
|
61
|
-
const earlyExit = new Promise((_, reject) => {
|
|
62
|
-
proc.once("exit", (code, signal) => {
|
|
63
|
-
reject(new Error(`Chromium exited prematurely (code=${code}, signal=${signal}).`));
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
const devtoolsPortFile = path.join(userDataDir, "DevToolsActivePort");
|
|
67
|
-
// Wait for DevToolsActivePort file to appear, then read it for port + browserId.
|
|
68
|
-
const whenReady = (async () => {
|
|
69
|
-
const startedAt = Date.now();
|
|
70
|
-
while (Date.now() - startedAt < timeoutMs) {
|
|
71
|
-
try {
|
|
72
|
-
// Access succeeds once the file is written.
|
|
73
|
-
await fs.access(devtoolsPortFile, fscb.constants.F_OK);
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
catch (_a) {
|
|
77
|
-
await delay(50);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// If still not there, bail.
|
|
81
|
-
await fs.access(devtoolsPortFile, fscb.constants.F_OK).catch(() => {
|
|
82
|
-
throw new Error(`Timed out after ${timeoutMs}ms waiting for DevToolsActivePort at ${devtoolsPortFile}`);
|
|
83
|
-
});
|
|
84
|
-
const raw = await fs.readFile(devtoolsPortFile, "utf8");
|
|
85
|
-
const [portLine, browserIdLine] = raw.trim().split(/\r?\n/);
|
|
86
|
-
const port = Number(portLine);
|
|
87
|
-
if (!Number.isFinite(port)) {
|
|
88
|
-
throw new Error(`Invalid DevTools port read from file: "${portLine}"`);
|
|
89
|
-
}
|
|
90
|
-
// Optional: ping /json/version to ensure the endpoint is responsive.
|
|
91
|
-
await waitForHttpOk(`http://127.0.0.1:${port}/json/version`, timeoutMs);
|
|
92
|
-
const browserId = (browserIdLine || "").trim();
|
|
93
|
-
const cdpUrl = browserId.length > 0
|
|
94
|
-
? `ws://127.0.0.1:${port}/devtools/browser/${browserId}`
|
|
95
|
-
: // Fallback: some builds don't include the second line; /json/version has the ws url too.
|
|
96
|
-
await fetchWsFromVersionEndpoint(port, timeoutMs);
|
|
97
|
-
return { port, cdpUrl };
|
|
98
|
-
})();
|
|
99
|
-
const { cdpUrl } = await Promise.race([whenReady, earlyExit]);
|
|
100
|
-
return { cdpUrl };
|
|
101
|
-
}
|
|
102
|
-
// ---- helpers ----
|
|
103
|
-
function delay(ms) {
|
|
104
|
-
return new Promise((r) => setTimeout(r, ms));
|
|
105
|
-
}
|
|
106
|
-
async function waitForHttpOk(url, timeoutMs) {
|
|
107
|
-
const startedAt = Date.now();
|
|
108
|
-
while (Date.now() - startedAt < timeoutMs) {
|
|
109
|
-
const ok = await httpGetOk(url).catch(() => false);
|
|
110
|
-
if (ok)
|
|
111
|
-
return;
|
|
112
|
-
await delay(50);
|
|
113
|
-
}
|
|
114
|
-
throw new Error(`Timed out after ${timeoutMs}ms waiting for ${url}`);
|
|
115
|
-
}
|
|
116
|
-
function httpGetOk(urlStr) {
|
|
117
|
-
return new Promise((resolve, reject) => {
|
|
118
|
-
const req = http.get(urlStr, (res) => {
|
|
119
|
-
// Drain data to allow socket reuse.
|
|
120
|
-
res.resume();
|
|
121
|
-
resolve(res.statusCode === 200);
|
|
122
|
-
});
|
|
123
|
-
req.on("error", reject);
|
|
124
|
-
req.setTimeout(3000, () => {
|
|
125
|
-
req.destroy(new Error("HTTP timeout"));
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
async function fetchWsFromVersionEndpoint(port, timeoutMs) {
|
|
130
|
-
const urlStr = `http://127.0.0.1:${port}/json/version`;
|
|
131
|
-
const body = await httpGetBody(urlStr, timeoutMs);
|
|
132
|
-
const parsed = JSON.parse(body);
|
|
133
|
-
if (!parsed.webSocketDebuggerUrl) {
|
|
134
|
-
throw new Error(`No webSocketDebuggerUrl in ${urlStr} response`);
|
|
135
|
-
}
|
|
136
|
-
return parsed.webSocketDebuggerUrl;
|
|
137
|
-
}
|
|
138
|
-
function httpGetBody(urlStr, timeoutMs) {
|
|
139
|
-
return new Promise((resolve, reject) => {
|
|
140
|
-
const req = http.get(urlStr, (res) => {
|
|
141
|
-
let data = "";
|
|
142
|
-
res.setEncoding("utf8");
|
|
143
|
-
res.on("data", (chunk) => (data += chunk));
|
|
144
|
-
res.on("end", () => {
|
|
145
|
-
if (res.statusCode === 200)
|
|
146
|
-
resolve(data);
|
|
147
|
-
else
|
|
148
|
-
reject(new Error(`HTTP ${res.statusCode}: ${data}`));
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
req.on("error", reject);
|
|
152
|
-
req.setTimeout(timeoutMs, () => req.destroy(new Error("HTTP timeout")));
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
async function kill() {
|
|
156
|
-
if (proc) {
|
|
157
|
-
proc.kill("SIGTERM");
|
|
158
|
-
await delay(300);
|
|
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
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
content: string;
|
|
6
|
-
index?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare class GuidelinesManager {
|
|
9
|
-
private guidelines;
|
|
10
|
-
private mindedConnection;
|
|
11
|
-
constructor(mindedConnection: MindedConnection | null);
|
|
12
|
-
/**
|
|
13
|
-
* Load guidelines from directories or platform
|
|
14
|
-
*/
|
|
15
|
-
loadGuidelines(guidelinesDirectories?: string[]): Promise<Guideline[]>;
|
|
16
|
-
/**
|
|
17
|
-
* Load guidelines from local directories
|
|
18
|
-
*/
|
|
19
|
-
private loadGuidelinesFromDirectories;
|
|
20
|
-
/**
|
|
21
|
-
* Recursively get all YAML files in a directory
|
|
22
|
-
*/
|
|
23
|
-
private getAllYamlFiles;
|
|
24
|
-
/**
|
|
25
|
-
* Compile guidelines into a single string with EJS and placeholders
|
|
26
|
-
*/
|
|
27
|
-
compileGuidelines(params?: Record<string, any>): string;
|
|
28
|
-
/**
|
|
29
|
-
* Replace placeholders in {key} format
|
|
30
|
-
*/
|
|
31
|
-
private replacePlaceholders;
|
|
32
|
-
/**
|
|
33
|
-
* Get raw guidelines without compilation
|
|
34
|
-
*/
|
|
35
|
-
getGuidelines(): Guideline[];
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=guidelinesManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"guidelinesManager.d.ts","sourceRoot":"","sources":["../../src/guidelines/guidelinesManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKhE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,UAAU,CAAmB;IACrC,OAAO,CAAC,gBAAgB,CAA0B;gBAEtC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI;IAIrD;;OAEG;IACU,cAAc,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IA+BnF;;OAEG;IACH,OAAO,CAAC,6BAA6B;IA+BrC;;OAEG;IACH,OAAO,CAAC,eAAe;IAgBvB;;OAEG;IACI,iBAAiB,CAAC,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,MAAM;IA0BlE;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAiB3B;;OAEG;IACI,aAAa,IAAI,SAAS,EAAE;CAGpC"}
|