@nuanu-ai/agentbrowse 0.2.4 → 0.2.6
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 +0 -6
- package/dist/commands/act.d.ts.map +1 -1
- package/dist/commands/act.js +21 -9
- package/dist/commands/observe.d.ts.map +1 -1
- package/dist/commands/observe.js +1 -0
- package/dist/output.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,12 +83,6 @@ operations:
|
|
|
83
83
|
export AGENTPAY_API_KEY=...
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Optional API base URL override:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
export AGENTPAY_API_URL=https://durcottggsiesxxqzvbb.supabase.co/functions/v1/api
|
|
90
|
-
```
|
|
91
|
-
|
|
92
86
|
## Runtime model
|
|
93
87
|
|
|
94
88
|
- `agentbrowse` persists the active browser session under `~/.agentpay`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/commands/act.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,GAAG,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/commands/act.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,GAAG,CACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC,CAsCf"}
|
package/dist/commands/act.js
CHANGED
|
@@ -5,6 +5,9 @@ import { connectStagehand, getPageInfo } from '../stagehand.js';
|
|
|
5
5
|
import { outputJSON, outputError } from '../output.js';
|
|
6
6
|
export async function act(cdpUrl, instruction, variables) {
|
|
7
7
|
let stagehand;
|
|
8
|
+
let url = 'unknown';
|
|
9
|
+
let title = 'unknown';
|
|
10
|
+
let failureMessage = null;
|
|
8
11
|
try {
|
|
9
12
|
stagehand = await connectStagehand(cdpUrl);
|
|
10
13
|
}
|
|
@@ -13,18 +16,27 @@ export async function act(cdpUrl, instruction, variables) {
|
|
|
13
16
|
}
|
|
14
17
|
try {
|
|
15
18
|
const result = await stagehand.act(instruction, variables ? { variables } : undefined);
|
|
16
|
-
|
|
19
|
+
({ url, title } = await getPageInfo(stagehand));
|
|
17
20
|
await stagehand.close();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
url
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
if (!result.success) {
|
|
22
|
+
const message = typeof result.message === 'string' && result.message.trim().length > 0
|
|
23
|
+
? result.message.trim()
|
|
24
|
+
: `Stagehand could not complete the requested action: ${instruction}`;
|
|
25
|
+
failureMessage = `Act failed: ${message} (page: ${title} — ${url})`;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
outputJSON({
|
|
29
|
+
success: true,
|
|
30
|
+
action: result.actionDescription ?? instruction,
|
|
31
|
+
message: result.message,
|
|
32
|
+
url,
|
|
33
|
+
title,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
25
36
|
}
|
|
26
37
|
catch (err) {
|
|
27
38
|
await stagehand.close();
|
|
28
|
-
|
|
39
|
+
failureMessage = `Act failed: ${err instanceof Error ? err.message : String(err)} (page: ${title} — ${url})`;
|
|
29
40
|
}
|
|
41
|
+
outputError(failureMessage ?? `Act failed: Stagehand could not complete the requested action: ${instruction}`);
|
|
30
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../src/commands/observe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../../src/commands/observe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCjF"}
|
package/dist/commands/observe.js
CHANGED
|
@@ -19,6 +19,7 @@ export async function observe(cdpUrl, instruction) {
|
|
|
19
19
|
await stagehand.close();
|
|
20
20
|
outputJSON({
|
|
21
21
|
success: true,
|
|
22
|
+
message: actions.length === 0 ? 'No actions found by Stagehand observe.' : undefined,
|
|
22
23
|
actions: actions.map((a) => ({
|
|
23
24
|
description: a.description,
|
|
24
25
|
selector: a.selector,
|
package/dist/output.js
CHANGED
|
@@ -10,7 +10,7 @@ function formatValue(value) {
|
|
|
10
10
|
/** Write result to stdout and exit. Errors go to stderr with exit 1. */
|
|
11
11
|
export function outputJSON(result) {
|
|
12
12
|
if (!result.success) {
|
|
13
|
-
process.stderr.write(`${result.error}\n`);
|
|
13
|
+
process.stderr.write(`${result.error ?? 'Unknown error'}\n`);
|
|
14
14
|
process.exit(1);
|
|
15
15
|
}
|
|
16
16
|
const { success: _, ...rest } = result;
|