Skip to content

Commit ce89d48

Browse files
authored
Merge pull request #2 from wordware-ai/browser-use
2 parents 510c24e + 0d2ea55 commit ce89d48

File tree

30 files changed

+590
-458
lines changed

30 files changed

+590
-458
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ yarn-error.log*
3939

4040
# Python
4141
__pycache__
42+
43+
# Claude Code
44+
.claude

bun.lock

Lines changed: 51 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

evals/webvoyager/wv-runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { startBrowserAgent } from "../../packages/magnitude-core/src/agent/brows
44
import * as fs from "fs";
55
import * as path from "path";
66
import { createAction } from "../../packages/magnitude-core/src/actions";
7-
import z from "zod";
7+
import z from "zod/v3";
88
import { chromium } from "patchright";
99

1010
interface Task {

evals/webvoyager/wv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as fs from "fs";
44
import * as readline from "readline";
55
import * as path from "path";
66
import { createAction } from "../../packages/magnitude-core/src/actions";
7-
import z from "zod";
7+
import z from "zod/v3";
88
import { Command } from "commander";
99
import * as p from "@clack/prompts";
1010
import { Agent } from "../../packages/magnitude-core/src/agent";

packages/create-magnitude-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "create-magnitude-app",
2+
"name": "@isaacdyor/create-magnitude-app",
33
"version": "0.0.7",
44
"description": "Create Magnitude apps quickly",
55
"type": "module",

packages/magnitude-core/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "magnitude-core",
3-
"version": "0.2.31",
2+
"name": "@isaacdyor/magnitude-core",
3+
"version": "0.2.43",
44
"description": "Magnitude e2e testing agent",
55
"publishConfig": {
66
"access": "public"
@@ -58,15 +58,15 @@
5858
"ansis": "^4.1.0",
5959
"commander": "^13.1.0",
6060
"eventemitter3": "^5.0.1",
61-
"magnitude-extract": "0.0.2",
61+
"@isaacdyor/magnitude-extract": "^0.0.2",
6262
"moondream": "^0.1.0",
6363
"object-hash": "^3.0.0",
6464
"pino": "^9.6.0",
6565
"pino-pretty": "^13.0.0",
6666
"playwright": "npm:patchright@^1.52.0",
6767
"posthog-node": "^5.1.1",
6868
"sharp": "^0.33.5",
69-
"zod": "^3.24.4",
70-
"zod-to-json-schema": "^3.24.5"
69+
"zod": "4.1.5",
70+
"@finom/zod-to-json-schema": "^3.24.11"
7171
}
7272
}

packages/magnitude-core/src/actions/desktopActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createAction } from ".";
2-
import { z } from "zod";
2+
import { z } from "zod/v3";
33
import { DesktopConnector } from "@/connectors/desktopConnector";
44

55
// Mouse actions
Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,46 @@
1-
import { Agent } from "@/agent"
1+
import { Agent } from "@/agent";
22
import { RenderableContent } from "@/memory/observation";
3-
import { z, Schema, ZodTypeAny } from "zod"
3+
import { z, ZodTypeAny, Schema } from "zod/v3";
44

55
export interface ActionDefinition<T> {
6-
name: string;
7-
description?: string;
8-
schema: Schema<T>;
9-
resolver: ({ input, agent }: { input: T, agent: Agent }) => Promise<void | RenderableContent>;
10-
render: (action: T) => string
6+
name: string;
7+
description?: string;
8+
schema: Schema<T>;
9+
resolver: ({
10+
input,
11+
agent,
12+
}: {
13+
input: T;
14+
agent: Agent;
15+
}) => Promise<void | RenderableContent>;
16+
render: (action: T) => string;
1117
}
1218

13-
export function createAction<S extends ZodTypeAny>(
14-
action: {
15-
name: string;
16-
description?: string;
17-
schema?: S;
18-
resolver: ({ input, agent }: { input: z.infer<S>; agent: Agent }) => Promise<void | RenderableContent>;
19-
render?: (action: z.infer<S>) => string
20-
}
21-
): ActionDefinition<z.infer<S>> {
22-
// Just a helper for automatic schema typing
23-
return {
24-
name: action.name,
25-
description: action.description,
26-
schema: action.schema ?? z.object({}),
27-
resolver: action.resolver,
28-
render: action.render ?? ((action) => JSON.stringify(action))
29-
};
19+
export function createAction<S extends ZodTypeAny>(action: {
20+
name: string;
21+
description?: string;
22+
schema?: S;
23+
resolver: ({
24+
input,
25+
agent,
26+
}: {
27+
input: z.infer<S>;
28+
agent: Agent;
29+
}) => Promise<void | RenderableContent>;
30+
render?: (action: z.infer<S>) => string;
31+
}): ActionDefinition<z.infer<S>> {
32+
// Just a helper for automatic schema typing
33+
return {
34+
name: action.name,
35+
description: action.description,
36+
schema: action.schema ?? z.object({}),
37+
resolver: action.resolver,
38+
render: action.render ?? ((action) => JSON.stringify(action)),
39+
};
3040
}
3141

32-
33-
3442
// 2. Create a helper type to extract the payload structure for a single action
3543
// This payload combines the 'name' (as a literal type) and the inferred schema.
36-
export type ActionPayload<A extends ActionDefinition<any>> = { name: A['name'] } & z.infer<A['schema']>;
37-
44+
export type ActionPayload<A extends ActionDefinition<any>> = {
45+
name: A["name"];
46+
} & z.infer<A["schema"]>;

packages/magnitude-core/src/actions/taskActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AgentError } from "@/agent/errors";
22
import { ActionDefinition, ActionPayload, createAction } from ".";
3-
import { z } from "zod";
3+
import { z } from "zod/v3";
44

55
export const doneAction = createAction({
66
name: 'task:done',

0 commit comments

Comments
 (0)