@minded-ai/mindedjs 1.0.131 → 1.0.132
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.map +1 -1
- package/dist/browserTask/executeBrowserTask.js +14 -20
- package/dist/browserTask/executeBrowserTask.js.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.d.ts.map +1 -1
- package/dist/nodes/addBrowserTaskRunNode.js +6 -2
- package/dist/nodes/addBrowserTaskRunNode.js.map +1 -1
- package/docs/SUMMARY.md +1 -0
- package/docs/platform/browserTask.md +85 -0
- package/package.json +2 -2
- package/src/browserTask/executeBrowserTask.ts +19 -24
- package/src/nodes/addBrowserTaskRunNode.ts +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeBrowserTask.d.ts","sourceRoot":"","sources":["../../src/browserTask/executeBrowserTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,4BAA4B,EAC5B,yBAAyB,EAG1B,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,oBAAoB,WAAkB,MAAM,WAAW,OAAO,KAAG,OAAO,CAAC,4BAA4B,
|
|
1
|
+
{"version":3,"file":"executeBrowserTask.d.ts","sourceRoot":"","sources":["../../src/browserTask/executeBrowserTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,4BAA4B,EAC5B,yBAAyB,EAG1B,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,oBAAoB,WAAkB,MAAM,WAAW,OAAO,KAAG,OAAO,CAAC,4BAA4B,CAyBjH,CAAC;AAEF,eAAO,MAAM,iBAAiB,cACjB,MAAM,UACT,MAAM,QACR,MAAM,cACA,OAAO,UACX;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,WACjB,OAAO,gBACF,GAAG,EAAE,iBACJ;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,EAAE,KACF,OAAO,CAAC,yBAAyB,CA8CnC,CAAC"}
|
|
@@ -7,27 +7,21 @@ const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
|
7
7
|
// Socket-based browser task functions
|
|
8
8
|
const createBrowserSession = async (proxy, onPrem) => {
|
|
9
9
|
logger_1.logger.debug({ msg: 'Creating browser session via socket', proxy });
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
throw new Error(response.error);
|
|
19
|
-
}
|
|
20
|
-
logger_1.logger.debug({
|
|
21
|
-
msg: 'Browser session created successfully',
|
|
22
|
-
sessionId: response.sessionId,
|
|
23
|
-
hasLiveUrl: !!response.liveViewUrl,
|
|
24
|
-
});
|
|
25
|
-
return response;
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
logger_1.logger.error({ message: 'Error creating browser session', err });
|
|
29
|
-
throw err;
|
|
10
|
+
const response = await mindedConnection_1.mindedConnection.awaitEmit(mindedConnectionTypes_1.mindedConnectionSocketMessageType.CREATE_BROWSER_SESSION, {
|
|
11
|
+
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.CREATE_BROWSER_SESSION,
|
|
12
|
+
proxy,
|
|
13
|
+
onPrem: onPrem,
|
|
14
|
+
}, 60000);
|
|
15
|
+
if (response.error) {
|
|
16
|
+
logger_1.logger.error({ msg: 'Failed to create browser session', error: response.error });
|
|
17
|
+
throw new Error(response.error);
|
|
30
18
|
}
|
|
19
|
+
logger_1.logger.debug({
|
|
20
|
+
msg: 'Browser session created successfully',
|
|
21
|
+
sessionId: response.sessionId,
|
|
22
|
+
hasLiveUrl: !!response.liveViewUrl,
|
|
23
|
+
});
|
|
24
|
+
return response;
|
|
31
25
|
};
|
|
32
26
|
exports.createBrowserSession = createBrowserSession;
|
|
33
27
|
const invokeBrowserTask = async (sessionId, cdpUrl, task, keepAlive, hooks, onPrem, toolSchemas, outputSchema) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeBrowserTask.js","sourceRoot":"","sources":["../../src/browserTask/executeBrowserTask.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,mEAAgE;AAChE,6EAM2C;AAE3C,sCAAsC;AAC/B,MAAM,oBAAoB,GAAG,KAAK,EAAE,KAAc,EAAE,MAAgB,EAAyC,EAAE;IACpH,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,qCAAqC,EAAE,KAAK,EAAE,CAAC,CAAC;IAEpE,
|
|
1
|
+
{"version":3,"file":"executeBrowserTask.js","sourceRoot":"","sources":["../../src/browserTask/executeBrowserTask.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,mEAAgE;AAChE,6EAM2C;AAE3C,sCAAsC;AAC/B,MAAM,oBAAoB,GAAG,KAAK,EAAE,KAAc,EAAE,MAAgB,EAAyC,EAAE;IACpH,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,qCAAqC,EAAE,KAAK,EAAE,CAAC,CAAC;IAEpE,MAAM,QAAQ,GAAG,MAAM,mCAAgB,CAAC,SAAS,CAC/C,yDAAiC,CAAC,sBAAsB,EACxD;QACE,IAAI,EAAE,yDAAiC,CAAC,sBAAsB;QAC9D,KAAK;QACL,MAAM,EAAE,MAAM;KACf,EACD,KAAK,CACN,CAAC;IAEF,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,kCAAkC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,eAAM,CAAC,KAAK,CAAC;QACX,GAAG,EAAE,sCAAsC;QAC3C,SAAS,E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C5B,SAAS,EAAE,CAAA,MAAA,QAAQ,CAAC,KAAK,0CAAE,MAAM,KAAI,CAAC;YACtC,cAAc,EAAE,CAAA,MAAA,QAAQ,CAAC,UAAU,0CAAE,MAAM,KAAI,CAAC;SACjD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9D,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AA5DW,QAAA,iBAAiB,qBA4D5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addBrowserTaskRunNode.d.ts","sourceRoot":"","sources":["../../src/nodes/addBrowserTaskRunNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAiC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAQjC,KAAK,2BAA2B,GAAG;IACjC,KAAK,EAAE,gBAAgB,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAAc,MAAM,WAAyD,CAAC;AAEtH,eAAO,MAAM,qBAAqB,0DAAiE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"addBrowserTaskRunNode.d.ts","sourceRoot":"","sources":["../../src/nodes/addBrowserTaskRunNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAiC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEtF,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAQjC,KAAK,2BAA2B,GAAG;IACjC,KAAK,EAAE,gBAAgB,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,2BAA2B,aAAc,MAAM,WAAyD,CAAC;AAEtH,eAAO,MAAM,qBAAqB,0DAAiE,2BAA2B,kBA+J7H,CAAC"}
|
|
@@ -23,6 +23,9 @@ const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedToNodeNam
|
|
|
23
23
|
const { prompt, ...inputParams } = toolCall.args;
|
|
24
24
|
const { sessionId, cdpUrl, keepAlive, hooks, outputSchema } = toolCallMindedMetadata;
|
|
25
25
|
try {
|
|
26
|
+
if (inputParams.error) {
|
|
27
|
+
throw new Error(inputParams.error);
|
|
28
|
+
}
|
|
26
29
|
if (!sessionId || !cdpUrl || !prompt) {
|
|
27
30
|
throw new Error('Missing required parameters: sessionId, cdpUrl, or prompt');
|
|
28
31
|
}
|
|
@@ -46,7 +49,7 @@ const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedToNodeNam
|
|
|
46
49
|
const toolMessage = new messages_1.ToolMessage({
|
|
47
50
|
id: toolCall.id,
|
|
48
51
|
content: JSON.stringify({
|
|
49
|
-
result: result.result || '
|
|
52
|
+
result: result.result || 'Failed to execute browser task',
|
|
50
53
|
steps: result.steps || [],
|
|
51
54
|
recordings: result.recordings || [],
|
|
52
55
|
inputParams: inputParams,
|
|
@@ -94,12 +97,13 @@ const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedToNodeNam
|
|
|
94
97
|
};
|
|
95
98
|
}
|
|
96
99
|
catch (error) {
|
|
97
|
-
logger_1.logger.error({ msg: 'Error executing browser task run node', error });
|
|
100
|
+
logger_1.logger.error({ msg: 'Error executing browser task run node', error: error.toString() });
|
|
98
101
|
const errorToolMessage = new messages_1.ToolMessage({
|
|
99
102
|
id: (0, uuid_1.v4)(),
|
|
100
103
|
content: JSON.stringify({
|
|
101
104
|
error: error instanceof Error ? error.message : error.toString(),
|
|
102
105
|
inputParams: inputParams,
|
|
106
|
+
message: 'Failed to execute browser task',
|
|
103
107
|
}),
|
|
104
108
|
status: 'error',
|
|
105
109
|
name: 'browser-task',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addBrowserTaskRunNode.js","sourceRoot":"","sources":["../../src/nodes/addBrowserTaskRunNode.ts"],"names":[],"mappings":";;;AAEA,sDAAsF;AACtF,uDAAkE;AAElE,4CAAyC;AACzC,8CAAqD;AAErD,+BAAoC;AACpC,0EAAsE;AACtE,mDAA4D;AASrD,MAAM,2BAA2B,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,GAAG,QAAQ,GAAG,iCAAmB,CAAC,gBAAgB,EAAE,CAAC;AAAzG,QAAA,2BAA2B,+BAA8E;AAE/G,MAAM,qBAAqB,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,KAAK,EAA+B,EAAE,EAAE;IAChI,MAAM,QAAQ,GAAiB,KAAK,EAAE,KAAmC,EAAE,EAAE;;QAC3E,eAAM,CAAC,IAAI,CAAC,uCAAuC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;QAElF,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAQ,CAAC;QACrE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,MAAM,sBAAsB,GAAG,MAAA,WAAW,CAAC,iBAAiB,0CAAE,cAAc,CAAC;QAC7E,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;QACjD,MAAM,EAAE,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Ae,EAAE,eAAe,CAAC,WAAW;wBAC5C,MAAM,EAAE,QAAQ;wBAChB,KAAK,EAAE,KAAK,CAAC,OAAO;qBACrB;oBACD,MAAM,EAAE,IAAI;iBACb;aACF,CAAC,CAAC;YAEH,OAAO;gBACL,QAAQ,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;gBAC9C,OAAO,EAAE,IAAA,2BAAiB,EAAc,KAAK,CAAC,OAAO,EAAE;oBACrD,IAAI,EAAE,sBAAQ,CAAC,YAAY;oBAC3B,MAAM,EAAE,eAAe,CAAC,IAAI;oBAC5B,eAAe,EAAE,eAAe,CAAC,WAAW;oBAC5C,GAAG,EAAE,KAAK;oBACV,UAAU,EAAE,EAAE;iBACf,CAAC;aACH,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,KAAK,CAAC,OAAO,CAAC,IAAA,mCAA2B,EAAC,kBAAkB,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzE,KAAK,CAAC,OAAO,CAAC,kBAAyB,EAAE,IAAA,mCAA2B,EAAC,kBAAkB,CAAQ,CAAC,CAAC;AACnG,CAAC,CAAC;AA/JW,QAAA,qBAAqB,yBA+JhC"}
|
package/docs/SUMMARY.md
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
## Browser Task
|
|
2
|
+
|
|
3
|
+
The Browser Task lets an agent run autonomous web actions using a live Chromium, guided by an LLM of choice. It supports structured inputs/outputs, live view previews, optional country proxying, and an on-prem mode.
|
|
4
|
+
|
|
5
|
+
### What it does
|
|
6
|
+
- **Plans + Executes**: The node first asks the LLM to propose parameters (based on your input schema) and compiles your prompt. It then starts a browser session and runs the task to completion.
|
|
7
|
+
- **Live session**: Shows a live view preview of the browser session.
|
|
8
|
+
- **Structured I/O**: Define `inputSchema` to guide the LLM’s tool-call arguments and `outputSchema` to hint desired output structure.
|
|
9
|
+
- **Tool access**: Exposes agent tools that allow execution requests to the browser agent.
|
|
10
|
+
|
|
11
|
+
### Configuration fields (node)
|
|
12
|
+
- **prompt (required)**: Natural-language instructions for the browser agent. Supports variables from the state object.
|
|
13
|
+
- **model (optional)**: Preferred LLM (UI defaults to `gpt-4o`).
|
|
14
|
+
- **inputSchema (optional)**: Array of fields `{ name, type: 'string'|'number', description?, required? }`.
|
|
15
|
+
- **outputSchema (optional)**: Array of fields `{ name, type: 'string'|'number', description?, required? }`. Sent to the browser agent to shape outputs.
|
|
16
|
+
- **proxy (optional)**: Two‑letter country code (e.g., `IL`, `US`). Disabled when running on‑prem.
|
|
17
|
+
- **hooks (optional)**: Array of `{ name }`. Passed to the browser agent.
|
|
18
|
+
- **onPrem (optional)**: If true, uses on‑premises browser infrastructure and auto‑captures screenshots.
|
|
19
|
+
|
|
20
|
+
### On‑prem mode
|
|
21
|
+
|
|
22
|
+
By default, the browser agent runs on the cloud. For customers who want to run the browser agent on their own infrastructure & network, on-prem mode is supported out of the box by running the on-prem kit on a PC / cloud VM.
|
|
23
|
+
|
|
24
|
+
#### How it works
|
|
25
|
+
|
|
26
|
+
The on-prem kit acts as a CDP server that launches chromium locally and exposes the protocol via websocket to the Minded backend service thus while the browser agent runs on the cloud, the browser is running locally inside the customer's network allowing it to access internet services without whitelisting.
|
|
27
|
+
|
|
28
|
+
#### Installation
|
|
29
|
+
|
|
30
|
+
1. Enable on-prem mode in the node configuration (onPrem: true)
|
|
31
|
+
2. Run the docker image with the agent ID and environment variables
|
|
32
|
+
Production:
|
|
33
|
+
```
|
|
34
|
+
docker run --name --pull minded-browser-onprem -e AGENT_ID=[Agent ID] public.ecr.aws/o9t8x5z4/browser-use-onprem-kit:latest
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Proxy
|
|
38
|
+
|
|
39
|
+
The browser agent can be configured to use a proxy server. This is useful when the browser agent needs to access the internet through a proxy server. Enable the proxy in the node configuration (proxy: 'UK').
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Tools
|
|
43
|
+
|
|
44
|
+
Browser Tasks can leverage **tools**—reusable functions that the agent can call during a browser session to perform specific actions (e.g., extract data, interact with APIs, update memory, etc.). Tools are defined using the platform’s [Tool interface](../low-code-editor/tools.md), and can be made available to the browser agent for use within your browser task flows.
|
|
45
|
+
|
|
46
|
+
#### How tools work in browser tasks
|
|
47
|
+
|
|
48
|
+
- **Tool calls**: During a browser task, the LLM can decide to call any tool that is registered and exposed to the agent. The tool receives validated input, the current state, and the agent instance.
|
|
49
|
+
- **Structured input/output**: Tools use Zod schemas for input validation and can return structured results, which are sent back to the LLM and/or merged into agent memory.
|
|
50
|
+
- **Tools available to browser tasks**: Tools marked as `allowExecutionRequests: true` are available to all nodes, including browser tasks.
|
|
51
|
+
|
|
52
|
+
#### Tool execution in browser tasks
|
|
53
|
+
You can mention tool names in your browser task prompt to encourage the LLM to use them, or let the LLM decide when to call them based on context.
|
|
54
|
+
|
|
55
|
+
When the LLM calls a tool during a browser task:
|
|
56
|
+
|
|
57
|
+
- The tool’s `execute` function runs with the provided input and current state.
|
|
58
|
+
- Any returned `state` is merged into the agent’s memory/state.
|
|
59
|
+
- The `result` is sent back to the LLM and can be used in subsequent reasoning or actions.
|
|
60
|
+
|
|
61
|
+
For more on tool structure and best practices, see [Tools documentation](../low-code-editor/tools.md).
|
|
62
|
+
|
|
63
|
+
#### Browser manipulation inside tool
|
|
64
|
+
|
|
65
|
+
You can manipulate the browser using a package of choice (e.g. puppeteer, playwright, etc.) by using the CDP URL that is passed to the tool in the state object.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Browser task node example
|
|
69
|
+
```yaml
|
|
70
|
+
# Flow YAML snippet illustrating a browserTask node
|
|
71
|
+
- name: 444f2347-dcc0-4c4e-b0af-3743033c8f5e
|
|
72
|
+
type: browserTask
|
|
73
|
+
displayName: Search product price in Amazon
|
|
74
|
+
prompt: |
|
|
75
|
+
Your task is to search for a product in Amazon and return the price of the product.
|
|
76
|
+
|
|
77
|
+
1. Navigate to amazon.com
|
|
78
|
+
2. Search for "iphone 15"
|
|
79
|
+
3. Return the price of the product
|
|
80
|
+
model: gpt-4o
|
|
81
|
+
inputSchema: []
|
|
82
|
+
outputSchema: []
|
|
83
|
+
proxy: ''
|
|
84
|
+
onPrem: false
|
|
85
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minded-ai/mindedjs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.132",
|
|
4
4
|
"description": "MindedJS is a TypeScript library for building agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -66,4 +66,4 @@
|
|
|
66
66
|
"uuid": "^11.1.0",
|
|
67
67
|
"ws": "^8.15.1"
|
|
68
68
|
}
|
|
69
|
-
}
|
|
69
|
+
}
|
|
@@ -12,33 +12,28 @@ import {
|
|
|
12
12
|
export const createBrowserSession = async (proxy?: string, onPrem?: boolean): Promise<CreateBrowserSessionResponse> => {
|
|
13
13
|
logger.debug({ msg: 'Creating browser session via socket', proxy });
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
15
|
+
const response = await mindedConnection.awaitEmit<CreateBrowserSessionRequest, CreateBrowserSessionResponse>(
|
|
16
|
+
mindedConnectionSocketMessageType.CREATE_BROWSER_SESSION,
|
|
17
|
+
{
|
|
18
|
+
type: mindedConnectionSocketMessageType.CREATE_BROWSER_SESSION,
|
|
19
|
+
proxy,
|
|
20
|
+
onPrem: onPrem,
|
|
21
|
+
},
|
|
22
|
+
60000, // 60 seconds timeout
|
|
23
|
+
);
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if (response.error) {
|
|
26
|
+
logger.error({ msg: 'Failed to create browser session', error: response.error });
|
|
27
|
+
throw new Error(response.error);
|
|
28
|
+
}
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
logger.debug({
|
|
31
|
+
msg: 'Browser session created successfully',
|
|
32
|
+
sessionId: response.sessionId,
|
|
33
|
+
hasLiveUrl: !!response.liveViewUrl,
|
|
34
|
+
});
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
} catch (err) {
|
|
39
|
-
logger.error({ message: 'Error creating browser session', err });
|
|
40
|
-
throw err;
|
|
41
|
-
}
|
|
36
|
+
return response;
|
|
42
37
|
};
|
|
43
38
|
|
|
44
39
|
export const invokeBrowserTask = async (
|
|
@@ -33,6 +33,11 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
33
33
|
const { sessionId, cdpUrl, keepAlive, hooks, outputSchema } = toolCallMindedMetadata;
|
|
34
34
|
|
|
35
35
|
try {
|
|
36
|
+
|
|
37
|
+
if (inputParams.error) {
|
|
38
|
+
throw new Error(inputParams.error);
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
if (!sessionId || !cdpUrl || !prompt) {
|
|
37
42
|
throw new Error('Missing required parameters: sessionId, cdpUrl, or prompt');
|
|
38
43
|
}
|
|
@@ -69,7 +74,7 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
69
74
|
const toolMessage = new ToolMessage({
|
|
70
75
|
id: toolCall.id,
|
|
71
76
|
content: JSON.stringify({
|
|
72
|
-
result: result.result || '
|
|
77
|
+
result: result.result || 'Failed to execute browser task',
|
|
73
78
|
steps: result.steps || [],
|
|
74
79
|
recordings: result.recordings || [],
|
|
75
80
|
inputParams: inputParams,
|
|
@@ -118,13 +123,14 @@ export const addBrowserTaskRunNode = async ({ graph, browserTaskNode, attachedTo
|
|
|
118
123
|
}),
|
|
119
124
|
};
|
|
120
125
|
} catch (error: any) {
|
|
121
|
-
logger.error({ msg: 'Error executing browser task run node', error });
|
|
126
|
+
logger.error({ msg: 'Error executing browser task run node', error: error.toString() });
|
|
122
127
|
|
|
123
128
|
const errorToolMessage = new ToolMessage({
|
|
124
129
|
id: uuidv4(),
|
|
125
130
|
content: JSON.stringify({
|
|
126
131
|
error: error instanceof Error ? error.message : error.toString(),
|
|
127
132
|
inputParams: inputParams,
|
|
133
|
+
message: 'Failed to execute browser task',
|
|
128
134
|
}),
|
|
129
135
|
status: 'error',
|
|
130
136
|
name: 'browser-task',
|