browser-use-sdk 0.2.1 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 (2025-08-15)
4
+
5
+ Full Changelog: [v0.2.1...v0.2.2](https://github.com/browser-use/browser-use-node/compare/v0.2.1...v0.2.2)
6
+
7
+ ### Bug Fixes
8
+
9
+ * stream completion ([2f6ce1f](https://github.com/browser-use/browser-use-node/commit/2f6ce1f1a312ba3f94872e262db2c17df5f6bf56))
10
+
3
11
  ## 0.2.1 (2025-08-15)
4
12
 
5
13
  Full Changelog: [v0.2.0...v0.2.1](https://github.com/browser-use/browser-use-node/compare/v0.2.0...v0.2.1)
package/lib/stream.d.mts CHANGED
@@ -5,6 +5,7 @@ export type BrowserState = Readonly<{
5
5
  sessionId: string;
6
6
  liveUrl: string | null;
7
7
  steps: ReadonlyArray<TaskStepView>;
8
+ doneOutput: string | null;
8
9
  }> | null;
9
10
  type BrowserAction = {
10
11
  kind: 'status';
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["../src/lib/stream.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE;AAGtC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACpC,CAAC,GAAG,IAAI,CAAC;AAEV,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAkDhG"}
1
+ {"version":3,"file":"stream.d.mts","sourceRoot":"","sources":["../src/lib/stream.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE;AAGtC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,GAAG,IAAI,CAAC;AAEV,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CA+DhG"}
package/lib/stream.d.ts CHANGED
@@ -5,6 +5,7 @@ export type BrowserState = Readonly<{
5
5
  sessionId: string;
6
6
  liveUrl: string | null;
7
7
  steps: ReadonlyArray<TaskStepView>;
8
+ doneOutput: string | null;
8
9
  }> | null;
9
10
  type BrowserAction = {
10
11
  kind: 'status';
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/lib/stream.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE;AAGtC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACpC,CAAC,GAAG,IAAI,CAAC;AAEV,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAkDhG"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/lib/stream.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE;AAGtC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAElB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,GAAG,IAAI,CAAC;AAEV,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CA+DhG"}
package/lib/stream.js CHANGED
@@ -8,16 +8,19 @@ function reducer(state, action) {
8
8
  // INIT
9
9
  if (state == null) {
10
10
  const liveUrl = action.status.sessionLiveUrl ?? null;
11
+ const doneOutput = action.status.doneOutput ?? null;
11
12
  const state = {
12
13
  taskId: action.status.id,
13
14
  sessionId: action.status.sessionId,
14
15
  liveUrl: liveUrl,
15
16
  steps: action.status.steps,
17
+ doneOutput: doneOutput,
16
18
  };
17
19
  return [state, action.status];
18
20
  }
19
21
  // UPDATE
20
- const liveUrl = action.status.sessionLiveUrl ?? null;
22
+ const liveUrl = action.status.sessionLiveUrl ?? state.liveUrl;
23
+ const doneOutput = action.status.doneOutput ?? state.doneOutput;
21
24
  const steps = [...state.steps];
22
25
  if (action.status.steps != null) {
23
26
  const newSteps = action.status.steps.slice(state.steps.length);
@@ -25,13 +28,21 @@ function reducer(state, action) {
25
28
  steps.push(step);
26
29
  }
27
30
  }
28
- const newState = { ...state, liveUrl, steps };
31
+ const newState = {
32
+ ...state,
33
+ liveUrl,
34
+ steps,
35
+ doneOutput,
36
+ };
29
37
  // CHANGES
30
- if ((state.liveUrl == null && liveUrl != null) || state.steps.length !== steps.length) {
38
+ if ((state.liveUrl == null && liveUrl != null) ||
39
+ state.steps.length !== steps.length ||
40
+ state.doneOutput != doneOutput) {
31
41
  const update = {
32
42
  ...action.status,
33
- steps: steps,
34
- sessionLiveUrl: liveUrl,
43
+ steps: newState.steps,
44
+ sessionLiveUrl: newState.liveUrl,
45
+ doneOutput: newState.doneOutput,
35
46
  };
36
47
  return [newState, update];
37
48
  }
package/lib/stream.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/lib/stream.ts"],"names":[],"mappings":";;AAmBA,0BAkDC;AApED,sCAAgD;AAkBhD,SAAgB,OAAO,CAAC,KAAmB,EAAE,MAAqB;IAChE,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO;YAEP,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;gBAErD,MAAM,KAAK,GAAiB;oBAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;oBACxB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS;oBAClC,OAAO,E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AC;gBACnB,CAAC;YACH,CAAC;YAED,MAAM,QAAQ,GAA8B;gBAC1C,GAAG,KAAK;gBACR,OAAO;gBACP,KAAK;gBACL,UAAU;aACX,CAAC;YAEF,UAAU;YAEV,IACE,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,CAAC;gBAC1C,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;gBACnC,KAAK,CAAC,UAAU,IAAI,UAAU,EAC9B,CAAC;gBACD,MAAM,MAAM,GAAiB;oBAC3B,GAAG,MAAM,CAAC,MAAM;oBAChB,KAAK,EAAE,QAAQ,CAAC,KAAK;oBACrB,cAAc,EAAE,QAAQ,CAAC,OAAO;oBAChC,UAAU,EAAE,QAAQ,CAAC,UAAU;iBAChC,CAAC;gBAEF,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5B,CAAC;YAED,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD;YACE,MAAM,IAAI,6BAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
package/lib/stream.mjs CHANGED
@@ -5,16 +5,19 @@ export function reducer(state, action) {
5
5
  // INIT
6
6
  if (state == null) {
7
7
  const liveUrl = action.status.sessionLiveUrl ?? null;
8
+ const doneOutput = action.status.doneOutput ?? null;
8
9
  const state = {
9
10
  taskId: action.status.id,
10
11
  sessionId: action.status.sessionId,
11
12
  liveUrl: liveUrl,
12
13
  steps: action.status.steps,
14
+ doneOutput: doneOutput,
13
15
  };
14
16
  return [state, action.status];
15
17
  }
16
18
  // UPDATE
17
- const liveUrl = action.status.sessionLiveUrl ?? null;
19
+ const liveUrl = action.status.sessionLiveUrl ?? state.liveUrl;
20
+ const doneOutput = action.status.doneOutput ?? state.doneOutput;
18
21
  const steps = [...state.steps];
19
22
  if (action.status.steps != null) {
20
23
  const newSteps = action.status.steps.slice(state.steps.length);
@@ -22,13 +25,21 @@ export function reducer(state, action) {
22
25
  steps.push(step);
23
26
  }
24
27
  }
25
- const newState = { ...state, liveUrl, steps };
28
+ const newState = {
29
+ ...state,
30
+ liveUrl,
31
+ steps,
32
+ doneOutput,
33
+ };
26
34
  // CHANGES
27
- if ((state.liveUrl == null && liveUrl != null) || state.steps.length !== steps.length) {
35
+ if ((state.liveUrl == null && liveUrl != null) ||
36
+ state.steps.length !== steps.length ||
37
+ state.doneOutput != doneOutput) {
28
38
  const update = {
29
39
  ...action.status,
30
- steps: steps,
31
- sessionLiveUrl: liveUrl,
40
+ steps: newState.steps,
41
+ sessionLiveUrl: newState.liveUrl,
42
+ doneOutput: newState.doneOutput,
32
43
  };
33
44
  return [newState, update];
34
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stream.mjs","sourceRoot":"","sources":["../src/lib/stream.ts"],"names":[],"mappings":"OACO,EAAE,qBAAqB,EAAE;AAkBhC,MAAM,UAAU,OAAO,CAAC,KAAmB,EAAE,MAAqB;IAChE,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO;YAEP,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;gBAErD,MAAM,KAAK,GAAiB;oBAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;oBACxB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS;oBAClC,OAAO,EAAE,OAAO;oBAChB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;iBAC3B,CAAC;gBAEF,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,CAAC;YAED,SAAS;YAET,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,IAAI,IAAI,CAAC;YACrD,MAAM,KAAK,GAAmB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,KAAK,CAAC,MAAM;gBACnC,KAAK,CAAC,UAAU,IAAI,UAAU,EAC9B,CAAC;gBACD,MAAM,MAAM,GAAiB;oBAC3B,GAAG,MAAM,CAAC,MAAM;oBAChB,KAAK,EAAE,QAAQ,CAAC,KAAK;oBACrB,cAAc,EAAE,QAAQ,CAAC,OAAO;oBAChC,UAAU,EAAE,QAAQ,CAAC,UAAU;iBAChC,CAAC;gBAEF,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5B,CAAC;YAED,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD;YACE,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-use-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "The official TypeScript library for the Browser Use API",
5
5
  "author": "Browser Use <support@browser-use.com>",
6
6
  "types": "./index.d.ts",
package/src/lib/stream.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { TaskView, TaskStepView } from '../resources/tasks';
2
- import { ExhaustiveSwitchCheck } from './types';
2
+ import { type DeepMutable, ExhaustiveSwitchCheck } from './types';
3
3
 
4
4
  export type ReducerEvent = TaskView | null;
5
5
 
@@ -8,8 +8,8 @@ export type BrowserState = Readonly<{
8
8
  sessionId: string;
9
9
 
10
10
  liveUrl: string | null;
11
-
12
11
  steps: ReadonlyArray<TaskStepView>;
12
+ doneOutput: string | null;
13
13
  }> | null;
14
14
 
15
15
  type BrowserAction = {
@@ -24,12 +24,14 @@ export function reducer(state: BrowserState, action: BrowserAction): [BrowserSta
24
24
 
25
25
  if (state == null) {
26
26
  const liveUrl = action.status.sessionLiveUrl ?? null;
27
+ const doneOutput = action.status.doneOutput ?? null;
27
28
 
28
29
  const state: BrowserState = {
29
30
  taskId: action.status.id,
30
31
  sessionId: action.status.sessionId,
31
32
  liveUrl: liveUrl,
32
33
  steps: action.status.steps,
34
+ doneOutput: doneOutput,
33
35
  };
34
36
 
35
37
  return [state, action.status];
@@ -37,9 +39,10 @@ export function reducer(state: BrowserState, action: BrowserAction): [BrowserSta
37
39
 
38
40
  // UPDATE
39
41
 
40
- const liveUrl = action.status.sessionLiveUrl ?? null;
41
- const steps: TaskStepView[] = [...state.steps];
42
+ const liveUrl = action.status.sessionLiveUrl ?? state.liveUrl;
43
+ const doneOutput = action.status.doneOutput ?? state.doneOutput;
42
44
 
45
+ const steps: TaskStepView[] = [...state.steps];
43
46
  if (action.status.steps != null) {
44
47
  const newSteps = action.status.steps.slice(state.steps.length);
45
48
 
@@ -48,15 +51,25 @@ export function reducer(state: BrowserState, action: BrowserAction): [BrowserSta
48
51
  }
49
52
  }
50
53
 
51
- const newState: BrowserState = { ...state, liveUrl, steps };
54
+ const newState: DeepMutable<BrowserState> = {
55
+ ...state,
56
+ liveUrl,
57
+ steps,
58
+ doneOutput,
59
+ };
52
60
 
53
61
  // CHANGES
54
62
 
55
- if ((state.liveUrl == null && liveUrl != null) || state.steps.length !== steps.length) {
63
+ if (
64
+ (state.liveUrl == null && liveUrl != null) ||
65
+ state.steps.length !== steps.length ||
66
+ state.doneOutput != doneOutput
67
+ ) {
56
68
  const update: ReducerEvent = {
57
69
  ...action.status,
58
- steps: steps,
59
- sessionLiveUrl: liveUrl,
70
+ steps: newState.steps,
71
+ sessionLiveUrl: newState.liveUrl,
72
+ doneOutput: newState.doneOutput,
60
73
  };
61
74
 
62
75
  return [newState, update];
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.1'; // x-release-please-version
1
+ export const VERSION = '0.2.2'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.1";
1
+ export declare const VERSION = "0.2.2";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.1";
1
+ export declare const VERSION = "0.2.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.2.1'; // x-release-please-version
4
+ exports.VERSION = '0.2.2'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.1'; // x-release-please-version
1
+ export const VERSION = '0.2.2'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map