@giselles-ai/browser-tool 0.1.21 → 0.1.23

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/index.d.ts CHANGED
@@ -1,5 +1,57 @@
1
+ import * as ai from 'ai';
1
2
  import { z } from 'zod';
2
3
 
4
+ type BrowserTools = typeof browserTools;
5
+ declare const browserTools: {
6
+ readonly getFormSnapshot: ai.Tool<{
7
+ instruction: string;
8
+ document?: string | undefined;
9
+ }, {
10
+ fields: {
11
+ fieldId: string;
12
+ selector: string;
13
+ kind: "text" | "textarea" | "select" | "checkbox" | "radio";
14
+ label: string;
15
+ required: boolean;
16
+ currentValue: string | boolean;
17
+ name?: string | undefined;
18
+ placeholder?: string | undefined;
19
+ options?: string[] | undefined;
20
+ }[];
21
+ }>;
22
+ readonly executeFormActions: ai.Tool<{
23
+ actions: ({
24
+ action: "fill";
25
+ fieldId: string;
26
+ value: string;
27
+ } | {
28
+ action: "click";
29
+ fieldId: string;
30
+ } | {
31
+ action: "select";
32
+ fieldId: string;
33
+ value: string;
34
+ })[];
35
+ fields: {
36
+ fieldId: string;
37
+ selector: string;
38
+ kind: "text" | "textarea" | "select" | "checkbox" | "radio";
39
+ label: string;
40
+ required: boolean;
41
+ currentValue: string | boolean;
42
+ name?: string | undefined;
43
+ placeholder?: string | undefined;
44
+ options?: string[] | undefined;
45
+ }[];
46
+ }, {
47
+ report: {
48
+ applied: number;
49
+ skipped: number;
50
+ warnings: string[];
51
+ };
52
+ }>;
53
+ };
54
+
3
55
  type FieldKind = "text" | "textarea" | "select" | "checkbox" | "radio";
4
56
  type SnapshotField = {
5
57
  fieldId: string;
@@ -278,4 +330,4 @@ declare const dispatchErrorSchema: z.ZodObject<{
278
330
  type RelayRequest = z.infer<typeof relayRequestSchema>;
279
331
  type RelayResponse = z.infer<typeof relayResponseSchema>;
280
332
 
281
- export { type BrowserToolAction, type BrowserToolStatus, type ClickAction, type ExecutionReport, type FieldKind, type FillAction, type RelayErrorCode, type RelayRequest, type RelayResponse, type SelectAction, type SnapshotField, browserToolActionSchema, clickActionSchema, dispatchErrorSchema, dispatchSuccessSchema, errorResponseSchema, executeRequestSchema, executeResponseSchema, executionReportSchema, fieldKindSchema, fillActionSchema, relayRequestSchema, relayResponseSchema, selectActionSchema, snapshotFieldSchema, snapshotRequestSchema, snapshotResponseSchema };
333
+ export { type BrowserToolAction, type BrowserToolStatus, type BrowserTools, type ClickAction, type ExecutionReport, type FieldKind, type FillAction, type RelayErrorCode, type RelayRequest, type RelayResponse, type SelectAction, type SnapshotField, browserToolActionSchema, browserTools, clickActionSchema, dispatchErrorSchema, dispatchSuccessSchema, errorResponseSchema, executeRequestSchema, executeResponseSchema, executionReportSchema, fieldKindSchema, fillActionSchema, relayRequestSchema, relayResponseSchema, selectActionSchema, snapshotFieldSchema, snapshotRequestSchema, snapshotResponseSchema };
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ // src/tools.ts
2
+ import { tool } from "ai";
3
+ import { z as z2 } from "zod";
4
+
1
5
  // src/types.ts
2
6
  import { z } from "zod";
3
7
  var fieldKindSchema = z.enum([
@@ -94,8 +98,33 @@ var dispatchErrorSchema = z.object({
94
98
  ]),
95
99
  message: z.string()
96
100
  });
101
+
102
+ // src/tools.ts
103
+ var browserTools = {
104
+ getFormSnapshot: tool({
105
+ description: "Capture the current state of form fields on the page.",
106
+ inputSchema: z2.object({
107
+ instruction: z2.string().describe("What to look for in the current form state."),
108
+ document: z2.string().optional().describe("Additional context to guide the snapshot.")
109
+ }),
110
+ outputSchema: z2.object({
111
+ fields: z2.array(snapshotFieldSchema)
112
+ })
113
+ }),
114
+ executeFormActions: tool({
115
+ description: "Execute fill, click, and select actions on form fields.",
116
+ inputSchema: z2.object({
117
+ actions: z2.array(browserToolActionSchema),
118
+ fields: z2.array(snapshotFieldSchema)
119
+ }),
120
+ outputSchema: z2.object({
121
+ report: executionReportSchema
122
+ })
123
+ })
124
+ };
97
125
  export {
98
126
  browserToolActionSchema,
127
+ browserTools,
99
128
  clickActionSchema,
100
129
  dispatchErrorSchema,
101
130
  dispatchSuccessSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giselles-ai/browser-tool",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "Apache-2.0",
@@ -51,10 +51,14 @@
51
51
  "zod": "4.3.6"
52
52
  },
53
53
  "peerDependencies": {
54
+ "ai": ">=4.0.0",
54
55
  "react": ">=19.0.0",
55
56
  "react-dom": ">=19.0.0"
56
57
  },
57
58
  "peerDependenciesMeta": {
59
+ "ai": {
60
+ "optional": true
61
+ },
58
62
  "react": {
59
63
  "optional": true
60
64
  },
@@ -66,6 +70,7 @@
66
70
  "@types/node": "25.3.0",
67
71
  "@types/react": "19.2.14",
68
72
  "@types/react-dom": "19.2.3",
73
+ "ai": "6.0.68",
69
74
  "tsup": "8.5.1",
70
75
  "typescript": "5.9.3"
71
76
  }