@browserbasehq/convex-stagehand 0.0.2 → 0.1.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.
- package/README.md +17 -18
- package/dist/client/index.d.ts +119 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +89 -13
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +181 -10
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/_generated/component.js +1 -1
- package/dist/component/_generated/dataModel.d.ts +33 -2
- package/dist/component/_generated/dataModel.d.ts.map +1 -1
- package/dist/component/api.d.ts +78 -16
- package/dist/component/api.d.ts.map +1 -1
- package/dist/component/api.js +94 -33
- package/dist/component/api.js.map +1 -1
- package/dist/component/lib.d.ts +23 -5
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +507 -54
- package/dist/component/lib.js.map +1 -1
- package/dist/component/schema.d.ts +3 -1
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +1 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/test.d.ts +3 -1
- package/dist/test.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +218 -16
- package/src/component/_generated/component.ts +213 -12
- package/src/component/_generated/dataModel.ts +45 -2
- package/src/component/api.ts +225 -66
- package/src/component/lib.ts +657 -61
- package/src/component/schema.ts +8 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
/**
|
|
3
|
-
* Generated
|
|
3
|
+
* Generated `ComponentApi` utility.
|
|
4
4
|
*
|
|
5
5
|
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
6
|
*
|
|
@@ -10,17 +10,218 @@
|
|
|
10
10
|
|
|
11
11
|
import type { FunctionReference } from "convex/server";
|
|
12
12
|
|
|
13
|
+
type ModelConfig =
|
|
14
|
+
| string
|
|
15
|
+
| {
|
|
16
|
+
modelName?: string;
|
|
17
|
+
apiKey?: string;
|
|
18
|
+
baseURL?: string;
|
|
19
|
+
provider?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
13
22
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
23
|
+
* A utility for referencing a Convex component's exposed API.
|
|
24
|
+
*
|
|
25
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
26
|
+
* Usage:
|
|
27
|
+
* ```ts
|
|
28
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
29
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
16
32
|
*/
|
|
17
|
-
export type ComponentApi =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
33
|
+
export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
34
|
+
{
|
|
35
|
+
lib: {
|
|
36
|
+
act: FunctionReference<
|
|
37
|
+
"action",
|
|
38
|
+
"internal",
|
|
39
|
+
{
|
|
40
|
+
action: string;
|
|
41
|
+
browserbaseApiKey: string;
|
|
42
|
+
browserbaseProjectId: string;
|
|
43
|
+
browserbaseSessionCreateParams?: any;
|
|
44
|
+
model?: ModelConfig;
|
|
45
|
+
modelApiKey: string;
|
|
46
|
+
modelName?: string;
|
|
47
|
+
options?: {
|
|
48
|
+
timeout?: number;
|
|
49
|
+
variables?: Record<string, string>;
|
|
50
|
+
waitUntil?: "load" | "domcontentloaded" | "networkidle";
|
|
51
|
+
};
|
|
52
|
+
sessionConfig?: {
|
|
53
|
+
domSettleTimeoutMs?: number;
|
|
54
|
+
experimental?: boolean;
|
|
55
|
+
selfHeal?: boolean;
|
|
56
|
+
systemPrompt?: string;
|
|
57
|
+
verbose?: number;
|
|
58
|
+
};
|
|
59
|
+
sessionId?: string;
|
|
60
|
+
url?: string;
|
|
61
|
+
},
|
|
62
|
+
{ actionDescription: string; message: string; success: boolean },
|
|
63
|
+
Name
|
|
64
|
+
>;
|
|
65
|
+
agent: FunctionReference<
|
|
66
|
+
"action",
|
|
67
|
+
"internal",
|
|
68
|
+
{
|
|
69
|
+
browserbaseApiKey: string;
|
|
70
|
+
browserbaseProjectId: string;
|
|
71
|
+
browserbaseSessionCreateParams?: any;
|
|
72
|
+
instruction: string;
|
|
73
|
+
model?: ModelConfig;
|
|
74
|
+
modelApiKey: string;
|
|
75
|
+
modelName?: string;
|
|
76
|
+
options?: {
|
|
77
|
+
cua?: boolean;
|
|
78
|
+
executionModel?: ModelConfig;
|
|
79
|
+
highlightCursor?: boolean;
|
|
80
|
+
maxSteps?: number;
|
|
81
|
+
mode?: string;
|
|
82
|
+
provider?: string;
|
|
83
|
+
shouldCache?: boolean;
|
|
84
|
+
systemPrompt?: string;
|
|
85
|
+
timeout?: number;
|
|
86
|
+
waitUntil?: "load" | "domcontentloaded" | "networkidle";
|
|
87
|
+
};
|
|
88
|
+
sessionConfig?: {
|
|
89
|
+
domSettleTimeoutMs?: number;
|
|
90
|
+
experimental?: boolean;
|
|
91
|
+
selfHeal?: boolean;
|
|
92
|
+
systemPrompt?: string;
|
|
93
|
+
verbose?: number;
|
|
94
|
+
};
|
|
95
|
+
sessionId?: string;
|
|
96
|
+
url?: string;
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
actions: Array<{
|
|
100
|
+
action?: string;
|
|
101
|
+
instruction?: string;
|
|
102
|
+
pageText?: string;
|
|
103
|
+
pageUrl?: string;
|
|
104
|
+
reasoning?: string;
|
|
105
|
+
taskCompleted?: boolean;
|
|
106
|
+
timeMs?: number;
|
|
107
|
+
type: string;
|
|
108
|
+
}>;
|
|
109
|
+
completed: boolean;
|
|
110
|
+
message: string;
|
|
111
|
+
metadata?: any;
|
|
112
|
+
success: boolean;
|
|
113
|
+
usage?: {
|
|
114
|
+
cached_input_tokens?: number;
|
|
115
|
+
inference_time_ms: number;
|
|
116
|
+
input_tokens: number;
|
|
117
|
+
output_tokens: number;
|
|
118
|
+
reasoning_tokens?: number;
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
Name
|
|
122
|
+
>;
|
|
123
|
+
endSession: FunctionReference<
|
|
124
|
+
"action",
|
|
125
|
+
"internal",
|
|
126
|
+
{
|
|
127
|
+
browserbaseApiKey: string;
|
|
128
|
+
browserbaseProjectId: string;
|
|
129
|
+
modelApiKey: string;
|
|
130
|
+
modelName?: string;
|
|
131
|
+
sessionId: string;
|
|
132
|
+
},
|
|
133
|
+
{ success: boolean },
|
|
134
|
+
Name
|
|
135
|
+
>;
|
|
136
|
+
extract: FunctionReference<
|
|
137
|
+
"action",
|
|
138
|
+
"internal",
|
|
139
|
+
{
|
|
140
|
+
browserbaseApiKey: string;
|
|
141
|
+
browserbaseProjectId: string;
|
|
142
|
+
browserbaseSessionCreateParams?: any;
|
|
143
|
+
instruction: string;
|
|
144
|
+
model?: ModelConfig;
|
|
145
|
+
modelApiKey: string;
|
|
146
|
+
modelName?: string;
|
|
147
|
+
options?: {
|
|
148
|
+
selector?: string;
|
|
149
|
+
timeout?: number;
|
|
150
|
+
waitUntil?: "load" | "domcontentloaded" | "networkidle";
|
|
151
|
+
};
|
|
152
|
+
schema: any;
|
|
153
|
+
sessionConfig?: {
|
|
154
|
+
domSettleTimeoutMs?: number;
|
|
155
|
+
experimental?: boolean;
|
|
156
|
+
selfHeal?: boolean;
|
|
157
|
+
systemPrompt?: string;
|
|
158
|
+
verbose?: number;
|
|
159
|
+
};
|
|
160
|
+
sessionId?: string;
|
|
161
|
+
url?: string;
|
|
162
|
+
},
|
|
163
|
+
any,
|
|
164
|
+
Name
|
|
165
|
+
>;
|
|
166
|
+
observe: FunctionReference<
|
|
167
|
+
"action",
|
|
168
|
+
"internal",
|
|
169
|
+
{
|
|
170
|
+
browserbaseApiKey: string;
|
|
171
|
+
browserbaseProjectId: string;
|
|
172
|
+
browserbaseSessionCreateParams?: any;
|
|
173
|
+
instruction: string;
|
|
174
|
+
model?: ModelConfig;
|
|
175
|
+
modelApiKey: string;
|
|
176
|
+
modelName?: string;
|
|
177
|
+
options?: {
|
|
178
|
+
selector?: string;
|
|
179
|
+
timeout?: number;
|
|
180
|
+
waitUntil?: "load" | "domcontentloaded" | "networkidle";
|
|
181
|
+
};
|
|
182
|
+
sessionConfig?: {
|
|
183
|
+
domSettleTimeoutMs?: number;
|
|
184
|
+
experimental?: boolean;
|
|
185
|
+
selfHeal?: boolean;
|
|
186
|
+
systemPrompt?: string;
|
|
187
|
+
verbose?: number;
|
|
188
|
+
};
|
|
189
|
+
sessionId?: string;
|
|
190
|
+
url?: string;
|
|
191
|
+
},
|
|
192
|
+
Array<{
|
|
193
|
+
arguments?: Array<string>;
|
|
194
|
+
backendNodeId?: number;
|
|
195
|
+
description: string;
|
|
196
|
+
method?: string;
|
|
197
|
+
selector: string;
|
|
198
|
+
}>,
|
|
199
|
+
Name
|
|
200
|
+
>;
|
|
201
|
+
startSession: FunctionReference<
|
|
202
|
+
"action",
|
|
203
|
+
"internal",
|
|
204
|
+
{
|
|
205
|
+
browserbaseApiKey: string;
|
|
206
|
+
browserbaseProjectId: string;
|
|
207
|
+
browserbaseSessionCreateParams?: any;
|
|
208
|
+
browserbaseSessionID?: string;
|
|
209
|
+
model?: ModelConfig;
|
|
210
|
+
modelApiKey: string;
|
|
211
|
+
modelName?: string;
|
|
212
|
+
options?: {
|
|
213
|
+
domSettleTimeoutMs?: number;
|
|
214
|
+
experimental?: boolean;
|
|
215
|
+
selfHeal?: boolean;
|
|
216
|
+
systemPrompt?: string;
|
|
217
|
+
timeout?: number;
|
|
218
|
+
verbose?: number;
|
|
219
|
+
waitUntil?: "load" | "domcontentloaded" | "networkidle";
|
|
220
|
+
};
|
|
221
|
+
url: string;
|
|
222
|
+
},
|
|
223
|
+
{ cdpUrl?: string; sessionId: string },
|
|
224
|
+
Name
|
|
225
|
+
>;
|
|
226
|
+
};
|
|
25
227
|
};
|
|
26
|
-
};
|
|
@@ -8,10 +8,53 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
|
|
11
|
+
import type {
|
|
12
|
+
DataModelFromSchemaDefinition,
|
|
13
|
+
DocumentByName,
|
|
14
|
+
TableNamesInDataModel,
|
|
15
|
+
SystemTableNames,
|
|
16
|
+
} from "convex/server";
|
|
17
|
+
import type { GenericId } from "convex/values";
|
|
18
|
+
import schema from "../schema.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The names of all of your Convex tables.
|
|
22
|
+
*/
|
|
23
|
+
export type TableNames = TableNamesInDataModel<DataModel>;
|
|
13
24
|
|
|
14
25
|
/**
|
|
15
26
|
* The type of a document stored in Convex.
|
|
27
|
+
*
|
|
28
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
29
|
+
*/
|
|
30
|
+
export type Doc<TableName extends TableNames> = DocumentByName<
|
|
31
|
+
DataModel,
|
|
32
|
+
TableName
|
|
33
|
+
>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* An identifier for a document in Convex.
|
|
37
|
+
*
|
|
38
|
+
* Convex documents are uniquely identified by their `Id`, which is accessible
|
|
39
|
+
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
|
|
40
|
+
*
|
|
41
|
+
* Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
|
|
42
|
+
*
|
|
43
|
+
* IDs are just strings at runtime, but this type can be used to distinguish them from other
|
|
44
|
+
* strings when type checking.
|
|
45
|
+
*
|
|
46
|
+
* @typeParam TableName - A string literal type of the table name (like "users").
|
|
47
|
+
*/
|
|
48
|
+
export type Id<TableName extends TableNames | SystemTableNames> =
|
|
49
|
+
GenericId<TableName>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A type describing your Convex data model.
|
|
53
|
+
*
|
|
54
|
+
* This type includes information about what tables you have, the type of
|
|
55
|
+
* documents stored in those tables, and the indexes defined on them.
|
|
56
|
+
*
|
|
57
|
+
* This type is used to parameterize methods like `queryGeneric` and
|
|
58
|
+
* `mutationGeneric` to make them type-safe.
|
|
16
59
|
*/
|
|
17
60
|
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
|