@meetopenbot/stagehand 1.0.4 → 2.0.0

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.
Files changed (2) hide show
  1. package/dist/index.js +20 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -41,13 +41,31 @@ var classifyStagehandPart = (part) => {
41
41
  const text = part.text ?? part.delta ?? "";
42
42
  return text ? { type: "delta", text } : { type: "skip" };
43
43
  }
44
- if (part.type === "step-finish" || part.type === "finish" || part.type === "tool-call") {
44
+ if (part.type === "tool-call" && part.toolCallId) {
45
+ return {
46
+ type: "tool_call",
47
+ id: part.toolCallId,
48
+ name: part.toolName ?? "tool",
49
+ input: part.input
50
+ };
51
+ }
52
+ if ((part.type === "tool-result" || part.type === "tool-error") && part.toolCallId) {
53
+ return {
54
+ type: "tool_result",
55
+ id: part.toolCallId,
56
+ name: part.toolName,
57
+ input: part.input,
58
+ output: part.type === "tool-error" ? part.error : part.output,
59
+ error: part.type === "tool-error"
60
+ };
61
+ }
62
+ if (part.type === "step-finish" || part.type === "finish") {
45
63
  return { type: "flush" };
46
64
  }
47
65
  return { type: "skip" };
48
66
  };
49
67
  async function* runStagehandStream(fullStream) {
50
- const replies = createTextReplyBuffer();
68
+ const replies = createTextReplyBuffer({ groupId: "stagehand:tools" });
51
69
  for await (const part of fullStream) {
52
70
  yield* replies.apply(classifyStagehandPart(part));
53
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetopenbot/stagehand",
3
- "version": "1.0.4",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "description": "Stagehand AI browser automation plugin for OpenBot",
6
6
  "main": "./dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "@browserbasehq/stagehand": "^3.3.0",
25
25
  "playwright": "^1.52.0",
26
26
  "zod": "^4.3.5",
27
- "@meetopenbot/plugin-sdk": "^0.4.0"
27
+ "@meetopenbot/plugin-sdk": "^1.0.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.10.1",