effect-agent 0.1.0-beta.153 → 0.1.0-beta.154

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.
@@ -0,0 +1,545 @@
1
+ import { DecisionModel, Tool, Toolkit } from "effect/unstable/ai";
2
+ import { Context, Effect, Schema } from "effect";
3
+ declare namespace BrowserUse_d_exports {
4
+ export { Action, ActionResult, BrowserActions, BrowserUseError, LayerOptions, Observation, Options, TargetAction, make, selectTargets };
5
+ }
6
+ export declare const Action: Schema.Union<readonly [Schema.Struct<{
7
+ readonly kind: Schema.Literal<"click">;
8
+ readonly ref: Schema.String;
9
+ }>, Schema.Struct<{
10
+ readonly kind: Schema.Literal<"fill">;
11
+ readonly ref: Schema.String;
12
+ readonly value: Schema.String;
13
+ }>, Schema.Struct<{
14
+ readonly kind: Schema.Literal<"select">;
15
+ readonly ref: Schema.String;
16
+ readonly value: Schema.String;
17
+ }>]>;
18
+ export type Action = typeof Action.Type;
19
+ export declare const Observation: Schema.Struct<{
20
+ readonly text: Schema.String;
21
+ readonly controls: Schema.$Array<Schema.Struct<{
22
+ readonly ref: Schema.String;
23
+ readonly kind: Schema.String;
24
+ readonly name: Schema.String;
25
+ readonly value: Schema.String;
26
+ readonly options: Schema.$Array<Schema.String>;
27
+ }>>;
28
+ }>;
29
+ export declare const ActionResult: Schema.Struct<{
30
+ readonly completed: Schema.Natural;
31
+ readonly error: Schema.NullOr<Schema.String>;
32
+ readonly observation: Schema.NullOr<Schema.Struct<{
33
+ readonly text: Schema.String;
34
+ readonly controls: Schema.$Array<Schema.Struct<{
35
+ readonly ref: Schema.String;
36
+ readonly kind: Schema.String;
37
+ readonly name: Schema.String;
38
+ readonly value: Schema.String;
39
+ readonly options: Schema.$Array<Schema.String>;
40
+ }>>;
41
+ }>>;
42
+ }>;
43
+ export declare const TargetAction: Schema.Union<readonly [Schema.Struct<{
44
+ readonly kind: Schema.Literal<"click">;
45
+ readonly target: Schema.NonEmptyString;
46
+ }>, Schema.Struct<{
47
+ readonly kind: Schema.Literal<"fill">;
48
+ readonly target: Schema.NonEmptyString;
49
+ readonly value: Schema.String;
50
+ }>, Schema.Struct<{
51
+ readonly kind: Schema.Literal<"select">;
52
+ readonly target: Schema.NonEmptyString;
53
+ readonly value: Schema.String;
54
+ }>]>;
55
+ export type TargetAction = typeof TargetAction.Type;
56
+ declare const BrowserUseError_base: Schema.Class<BrowserUseError, Schema.TaggedStruct<"BrowserUseError", {
57
+ readonly code: Schema.Literals<readonly ["invalid", "browser"]>;
58
+ readonly message: Schema.String;
59
+ }>, import("effect/Cause").YieldableError>;
60
+ /** Safe model-visible failure. Dispatch evidence belongs in ActionResult, never an automatic retry. */
61
+ export declare class BrowserUseError extends BrowserUseError_base {}
62
+ declare const BrowserActions_base: Context.ServiceClass<BrowserActions, "@effect-agent/BrowserUse/BrowserActions", {
63
+ readonly observe: Effect.Effect<typeof Observation.Type, BrowserUseError>;
64
+ readonly act: (actions: ReadonlyArray<Action>) => Effect.Effect<typeof ActionResult.Type, BrowserUseError>;
65
+ }>;
66
+ /** Application-owned page adapter. Revalidate refs before input; stop a batch at its first failure.
67
+ * Return acknowledged actions even if the following observation fails. Never replay uncertain input.
68
+ */
69
+ export declare class BrowserActions extends BrowserActions_base {}
70
+ /** A DecisionModel selects from observed, action-compatible controls. It cannot create selectors or dispatch actions. */
71
+ export declare const selectTargets: (observation: {
72
+ readonly text: string;
73
+ readonly controls: readonly {
74
+ readonly ref: string;
75
+ readonly kind: string;
76
+ readonly name: string;
77
+ readonly value: string;
78
+ readonly options: readonly string[];
79
+ }[];
80
+ }, targets: readonly ({
81
+ readonly kind: "click";
82
+ readonly target: string;
83
+ } | {
84
+ readonly kind: "fill";
85
+ readonly target: string;
86
+ readonly value: string;
87
+ } | {
88
+ readonly kind: "select";
89
+ readonly target: string;
90
+ readonly value: string;
91
+ })[]) => Effect.Effect<{
92
+ actions: ({
93
+ readonly kind: "click";
94
+ readonly ref: string;
95
+ } | {
96
+ readonly kind: "fill";
97
+ readonly ref: string;
98
+ readonly value: string;
99
+ } | {
100
+ readonly kind: "select";
101
+ readonly ref: string;
102
+ readonly value: string;
103
+ })[];
104
+ choices: {
105
+ target: string;
106
+ ref: string;
107
+ probability: number;
108
+ }[];
109
+ usage: DecisionModel.DecisionUsage;
110
+ }, BrowserUseError, DecisionModel.DecisionModel>;
111
+ export interface Options {
112
+ /** Who resolves controls: the planner supplies refs by default; "decision" uses a native DecisionModel. */
113
+ readonly grounding?: "direct" | "decision";
114
+ /** One action by default; "batched" accepts 1–8 actions on already observed controls. */
115
+ readonly mode?: "single" | "batched";
116
+ }
117
+ export interface LayerOptions {
118
+ /** Already prepared observation from this page/run. Omit to observe before the first selection. */
119
+ readonly initialObservation?: typeof Observation.Type;
120
+ }
121
+ declare const single: {
122
+ toolkit: Toolkit.Toolkit<{
123
+ readonly act: Tool.Tool<"act", {
124
+ readonly parameters: Schema.Struct<{
125
+ readonly action: Schema.Union<readonly [Schema.Struct<{
126
+ readonly kind: Schema.Literal<"click">;
127
+ readonly ref: Schema.String;
128
+ }>, Schema.Struct<{
129
+ readonly kind: Schema.Literal<"fill">;
130
+ readonly ref: Schema.String;
131
+ readonly value: Schema.String;
132
+ }>, Schema.Struct<{
133
+ readonly kind: Schema.Literal<"select">;
134
+ readonly ref: Schema.String;
135
+ readonly value: Schema.String;
136
+ }>]>;
137
+ }>;
138
+ readonly success: Schema.Struct<{
139
+ readonly completed: Schema.Natural;
140
+ readonly error: Schema.NullOr<Schema.String>;
141
+ readonly observation: Schema.NullOr<Schema.Struct<{
142
+ readonly text: Schema.String;
143
+ readonly controls: Schema.$Array<Schema.Struct<{
144
+ readonly ref: Schema.String;
145
+ readonly kind: Schema.String;
146
+ readonly name: Schema.String;
147
+ readonly value: Schema.String;
148
+ readonly options: Schema.$Array<Schema.String>;
149
+ }>>;
150
+ }>>;
151
+ }>;
152
+ readonly failure: typeof BrowserUseError;
153
+ readonly failureMode: "return";
154
+ }, never>;
155
+ readonly observe: Tool.Tool<"observe", {
156
+ readonly parameters: Tool.EmptyParams;
157
+ readonly success: Schema.Struct<{
158
+ readonly text: Schema.String;
159
+ readonly controls: Schema.$Array<Schema.Struct<{
160
+ readonly ref: Schema.String;
161
+ readonly kind: Schema.String;
162
+ readonly name: Schema.String;
163
+ readonly value: Schema.String;
164
+ readonly options: Schema.$Array<Schema.String>;
165
+ }>>;
166
+ }>;
167
+ readonly failure: typeof BrowserUseError;
168
+ readonly failureMode: "return";
169
+ }, never>;
170
+ }>;
171
+ layer: () => import("effect/Layer").Layer<Tool.HandlersFor<{
172
+ readonly act: Tool.Tool<"act", {
173
+ readonly parameters: Schema.Struct<{
174
+ readonly action: Schema.Union<readonly [Schema.Struct<{
175
+ readonly kind: Schema.Literal<"click">;
176
+ readonly ref: Schema.String;
177
+ }>, Schema.Struct<{
178
+ readonly kind: Schema.Literal<"fill">;
179
+ readonly ref: Schema.String;
180
+ readonly value: Schema.String;
181
+ }>, Schema.Struct<{
182
+ readonly kind: Schema.Literal<"select">;
183
+ readonly ref: Schema.String;
184
+ readonly value: Schema.String;
185
+ }>]>;
186
+ }>;
187
+ readonly success: Schema.Struct<{
188
+ readonly completed: Schema.Natural;
189
+ readonly error: Schema.NullOr<Schema.String>;
190
+ readonly observation: Schema.NullOr<Schema.Struct<{
191
+ readonly text: Schema.String;
192
+ readonly controls: Schema.$Array<Schema.Struct<{
193
+ readonly ref: Schema.String;
194
+ readonly kind: Schema.String;
195
+ readonly name: Schema.String;
196
+ readonly value: Schema.String;
197
+ readonly options: Schema.$Array<Schema.String>;
198
+ }>>;
199
+ }>>;
200
+ }>;
201
+ readonly failure: typeof BrowserUseError;
202
+ readonly failureMode: "return";
203
+ }, never>;
204
+ readonly observe: Tool.Tool<"observe", {
205
+ readonly parameters: Tool.EmptyParams;
206
+ readonly success: Schema.Struct<{
207
+ readonly text: Schema.String;
208
+ readonly controls: Schema.$Array<Schema.Struct<{
209
+ readonly ref: Schema.String;
210
+ readonly kind: Schema.String;
211
+ readonly name: Schema.String;
212
+ readonly value: Schema.String;
213
+ readonly options: Schema.$Array<Schema.String>;
214
+ }>>;
215
+ }>;
216
+ readonly failure: typeof BrowserUseError;
217
+ readonly failureMode: "return";
218
+ }, never>;
219
+ }>, never, BrowserActions>;
220
+ };
221
+ declare const batched: {
222
+ toolkit: Toolkit.Toolkit<{
223
+ readonly act: Tool.Tool<"act", {
224
+ readonly parameters: Schema.Struct<{
225
+ readonly actions: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
226
+ readonly kind: Schema.Literal<"click">;
227
+ readonly ref: Schema.String;
228
+ }>, Schema.Struct<{
229
+ readonly kind: Schema.Literal<"fill">;
230
+ readonly ref: Schema.String;
231
+ readonly value: Schema.String;
232
+ }>, Schema.Struct<{
233
+ readonly kind: Schema.Literal<"select">;
234
+ readonly ref: Schema.String;
235
+ readonly value: Schema.String;
236
+ }>]>>;
237
+ }>;
238
+ readonly success: Schema.Struct<{
239
+ readonly completed: Schema.Natural;
240
+ readonly error: Schema.NullOr<Schema.String>;
241
+ readonly observation: Schema.NullOr<Schema.Struct<{
242
+ readonly text: Schema.String;
243
+ readonly controls: Schema.$Array<Schema.Struct<{
244
+ readonly ref: Schema.String;
245
+ readonly kind: Schema.String;
246
+ readonly name: Schema.String;
247
+ readonly value: Schema.String;
248
+ readonly options: Schema.$Array<Schema.String>;
249
+ }>>;
250
+ }>>;
251
+ }>;
252
+ readonly failure: typeof BrowserUseError;
253
+ readonly failureMode: "return";
254
+ }, never>;
255
+ readonly observe: Tool.Tool<"observe", {
256
+ readonly parameters: Tool.EmptyParams;
257
+ readonly success: Schema.Struct<{
258
+ readonly text: Schema.String;
259
+ readonly controls: Schema.$Array<Schema.Struct<{
260
+ readonly ref: Schema.String;
261
+ readonly kind: Schema.String;
262
+ readonly name: Schema.String;
263
+ readonly value: Schema.String;
264
+ readonly options: Schema.$Array<Schema.String>;
265
+ }>>;
266
+ }>;
267
+ readonly failure: typeof BrowserUseError;
268
+ readonly failureMode: "return";
269
+ }, never>;
270
+ }>;
271
+ layer: () => import("effect/Layer").Layer<Tool.HandlersFor<{
272
+ readonly act: Tool.Tool<"act", {
273
+ readonly parameters: Schema.Struct<{
274
+ readonly actions: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
275
+ readonly kind: Schema.Literal<"click">;
276
+ readonly ref: Schema.String;
277
+ }>, Schema.Struct<{
278
+ readonly kind: Schema.Literal<"fill">;
279
+ readonly ref: Schema.String;
280
+ readonly value: Schema.String;
281
+ }>, Schema.Struct<{
282
+ readonly kind: Schema.Literal<"select">;
283
+ readonly ref: Schema.String;
284
+ readonly value: Schema.String;
285
+ }>]>>;
286
+ }>;
287
+ readonly success: Schema.Struct<{
288
+ readonly completed: Schema.Natural;
289
+ readonly error: Schema.NullOr<Schema.String>;
290
+ readonly observation: Schema.NullOr<Schema.Struct<{
291
+ readonly text: Schema.String;
292
+ readonly controls: Schema.$Array<Schema.Struct<{
293
+ readonly ref: Schema.String;
294
+ readonly kind: Schema.String;
295
+ readonly name: Schema.String;
296
+ readonly value: Schema.String;
297
+ readonly options: Schema.$Array<Schema.String>;
298
+ }>>;
299
+ }>>;
300
+ }>;
301
+ readonly failure: typeof BrowserUseError;
302
+ readonly failureMode: "return";
303
+ }, never>;
304
+ readonly observe: Tool.Tool<"observe", {
305
+ readonly parameters: Tool.EmptyParams;
306
+ readonly success: Schema.Struct<{
307
+ readonly text: Schema.String;
308
+ readonly controls: Schema.$Array<Schema.Struct<{
309
+ readonly ref: Schema.String;
310
+ readonly kind: Schema.String;
311
+ readonly name: Schema.String;
312
+ readonly value: Schema.String;
313
+ readonly options: Schema.$Array<Schema.String>;
314
+ }>>;
315
+ }>;
316
+ readonly failure: typeof BrowserUseError;
317
+ readonly failureMode: "return";
318
+ }, never>;
319
+ }>, never, BrowserActions>;
320
+ };
321
+ declare const groundedSingle: {
322
+ toolkit: Toolkit.Toolkit<{
323
+ readonly act: Tool.Tool<"act", {
324
+ readonly parameters: Schema.Struct<{
325
+ readonly action: Schema.Union<readonly [Schema.Struct<{
326
+ readonly kind: Schema.Literal<"click">;
327
+ readonly target: Schema.NonEmptyString;
328
+ }>, Schema.Struct<{
329
+ readonly kind: Schema.Literal<"fill">;
330
+ readonly target: Schema.NonEmptyString;
331
+ readonly value: Schema.String;
332
+ }>, Schema.Struct<{
333
+ readonly kind: Schema.Literal<"select">;
334
+ readonly target: Schema.NonEmptyString;
335
+ readonly value: Schema.String;
336
+ }>]>;
337
+ }>;
338
+ readonly success: Schema.Struct<{
339
+ readonly completed: Schema.Natural;
340
+ readonly error: Schema.NullOr<Schema.String>;
341
+ readonly observation: Schema.NullOr<Schema.Struct<{
342
+ readonly text: Schema.String;
343
+ readonly controls: Schema.$Array<Schema.Struct<{
344
+ readonly ref: Schema.String;
345
+ readonly kind: Schema.String;
346
+ readonly name: Schema.String;
347
+ readonly value: Schema.String;
348
+ readonly options: Schema.$Array<Schema.String>;
349
+ }>>;
350
+ }>>;
351
+ }>;
352
+ readonly failure: typeof BrowserUseError;
353
+ readonly failureMode: "return";
354
+ }, never>;
355
+ readonly observe: Tool.Tool<"observe", {
356
+ readonly parameters: Tool.EmptyParams;
357
+ readonly success: Schema.Struct<{
358
+ readonly text: Schema.String;
359
+ readonly controls: Schema.$Array<Schema.Struct<{
360
+ readonly ref: Schema.String;
361
+ readonly kind: Schema.String;
362
+ readonly name: Schema.String;
363
+ readonly value: Schema.String;
364
+ readonly options: Schema.$Array<Schema.String>;
365
+ }>>;
366
+ }>;
367
+ readonly failure: typeof BrowserUseError;
368
+ readonly failureMode: "return";
369
+ }, never>;
370
+ }>;
371
+ layer: (options?: LayerOptions) => import("effect/Layer").Layer<Tool.HandlersFor<{
372
+ readonly act: Tool.Tool<"act", {
373
+ readonly parameters: Schema.Struct<{
374
+ readonly action: Schema.Union<readonly [Schema.Struct<{
375
+ readonly kind: Schema.Literal<"click">;
376
+ readonly target: Schema.NonEmptyString;
377
+ }>, Schema.Struct<{
378
+ readonly kind: Schema.Literal<"fill">;
379
+ readonly target: Schema.NonEmptyString;
380
+ readonly value: Schema.String;
381
+ }>, Schema.Struct<{
382
+ readonly kind: Schema.Literal<"select">;
383
+ readonly target: Schema.NonEmptyString;
384
+ readonly value: Schema.String;
385
+ }>]>;
386
+ }>;
387
+ readonly success: Schema.Struct<{
388
+ readonly completed: Schema.Natural;
389
+ readonly error: Schema.NullOr<Schema.String>;
390
+ readonly observation: Schema.NullOr<Schema.Struct<{
391
+ readonly text: Schema.String;
392
+ readonly controls: Schema.$Array<Schema.Struct<{
393
+ readonly ref: Schema.String;
394
+ readonly kind: Schema.String;
395
+ readonly name: Schema.String;
396
+ readonly value: Schema.String;
397
+ readonly options: Schema.$Array<Schema.String>;
398
+ }>>;
399
+ }>>;
400
+ }>;
401
+ readonly failure: typeof BrowserUseError;
402
+ readonly failureMode: "return";
403
+ }, never>;
404
+ readonly observe: Tool.Tool<"observe", {
405
+ readonly parameters: Tool.EmptyParams;
406
+ readonly success: Schema.Struct<{
407
+ readonly text: Schema.String;
408
+ readonly controls: Schema.$Array<Schema.Struct<{
409
+ readonly ref: Schema.String;
410
+ readonly kind: Schema.String;
411
+ readonly name: Schema.String;
412
+ readonly value: Schema.String;
413
+ readonly options: Schema.$Array<Schema.String>;
414
+ }>>;
415
+ }>;
416
+ readonly failure: typeof BrowserUseError;
417
+ readonly failureMode: "return";
418
+ }, never>;
419
+ }>, never, BrowserActions | DecisionModel.DecisionModel>;
420
+ };
421
+ declare const groundedBatched: {
422
+ toolkit: Toolkit.Toolkit<{
423
+ readonly act: Tool.Tool<"act", {
424
+ readonly parameters: Schema.Struct<{
425
+ readonly actions: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
426
+ readonly kind: Schema.Literal<"click">;
427
+ readonly target: Schema.NonEmptyString;
428
+ }>, Schema.Struct<{
429
+ readonly kind: Schema.Literal<"fill">;
430
+ readonly target: Schema.NonEmptyString;
431
+ readonly value: Schema.String;
432
+ }>, Schema.Struct<{
433
+ readonly kind: Schema.Literal<"select">;
434
+ readonly target: Schema.NonEmptyString;
435
+ readonly value: Schema.String;
436
+ }>]>>;
437
+ }>;
438
+ readonly success: Schema.Struct<{
439
+ readonly completed: Schema.Natural;
440
+ readonly error: Schema.NullOr<Schema.String>;
441
+ readonly observation: Schema.NullOr<Schema.Struct<{
442
+ readonly text: Schema.String;
443
+ readonly controls: Schema.$Array<Schema.Struct<{
444
+ readonly ref: Schema.String;
445
+ readonly kind: Schema.String;
446
+ readonly name: Schema.String;
447
+ readonly value: Schema.String;
448
+ readonly options: Schema.$Array<Schema.String>;
449
+ }>>;
450
+ }>>;
451
+ }>;
452
+ readonly failure: typeof BrowserUseError;
453
+ readonly failureMode: "return";
454
+ }, never>;
455
+ readonly observe: Tool.Tool<"observe", {
456
+ readonly parameters: Tool.EmptyParams;
457
+ readonly success: Schema.Struct<{
458
+ readonly text: Schema.String;
459
+ readonly controls: Schema.$Array<Schema.Struct<{
460
+ readonly ref: Schema.String;
461
+ readonly kind: Schema.String;
462
+ readonly name: Schema.String;
463
+ readonly value: Schema.String;
464
+ readonly options: Schema.$Array<Schema.String>;
465
+ }>>;
466
+ }>;
467
+ readonly failure: typeof BrowserUseError;
468
+ readonly failureMode: "return";
469
+ }, never>;
470
+ }>;
471
+ layer: (options?: LayerOptions) => import("effect/Layer").Layer<Tool.HandlersFor<{
472
+ readonly act: Tool.Tool<"act", {
473
+ readonly parameters: Schema.Struct<{
474
+ readonly actions: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
475
+ readonly kind: Schema.Literal<"click">;
476
+ readonly target: Schema.NonEmptyString;
477
+ }>, Schema.Struct<{
478
+ readonly kind: Schema.Literal<"fill">;
479
+ readonly target: Schema.NonEmptyString;
480
+ readonly value: Schema.String;
481
+ }>, Schema.Struct<{
482
+ readonly kind: Schema.Literal<"select">;
483
+ readonly target: Schema.NonEmptyString;
484
+ readonly value: Schema.String;
485
+ }>]>>;
486
+ }>;
487
+ readonly success: Schema.Struct<{
488
+ readonly completed: Schema.Natural;
489
+ readonly error: Schema.NullOr<Schema.String>;
490
+ readonly observation: Schema.NullOr<Schema.Struct<{
491
+ readonly text: Schema.String;
492
+ readonly controls: Schema.$Array<Schema.Struct<{
493
+ readonly ref: Schema.String;
494
+ readonly kind: Schema.String;
495
+ readonly name: Schema.String;
496
+ readonly value: Schema.String;
497
+ readonly options: Schema.$Array<Schema.String>;
498
+ }>>;
499
+ }>>;
500
+ }>;
501
+ readonly failure: typeof BrowserUseError;
502
+ readonly failureMode: "return";
503
+ }, never>;
504
+ readonly observe: Tool.Tool<"observe", {
505
+ readonly parameters: Tool.EmptyParams;
506
+ readonly success: Schema.Struct<{
507
+ readonly text: Schema.String;
508
+ readonly controls: Schema.$Array<Schema.Struct<{
509
+ readonly ref: Schema.String;
510
+ readonly kind: Schema.String;
511
+ readonly name: Schema.String;
512
+ readonly value: Schema.String;
513
+ readonly options: Schema.$Array<Schema.String>;
514
+ }>>;
515
+ }>;
516
+ readonly failure: typeof BrowserUseError;
517
+ readonly failureMode: "return";
518
+ }, never>;
519
+ }>, never, BrowserActions | DecisionModel.DecisionModel>;
520
+ };
521
+ /**
522
+ * Define browser tools and their matching handlers together. Include `toolkit` in your Agent
523
+ * and provide `layer()` once per page/run. All modes require BrowserActions; decision grounding
524
+ * also requires a native DecisionModel. The library never chooses a provider or opens a browser.
525
+ */
526
+ export declare function make(options: {
527
+ grounding: "decision";
528
+ mode: "batched";
529
+ }): typeof groundedBatched;
530
+ export declare function make(options: {
531
+ grounding: "decision";
532
+ mode?: "single";
533
+ }): typeof groundedSingle;
534
+ export declare function make(options: {
535
+ grounding?: "direct";
536
+ mode: "batched";
537
+ }): typeof batched;
538
+ export declare function make(options?: {
539
+ grounding?: "direct";
540
+ mode?: "single";
541
+ }): typeof single;
542
+ export declare function make(options: Options): typeof single | typeof batched | typeof groundedSingle | typeof groundedBatched;
543
+ //#endregion
544
+ export { BrowserUse_d_exports as t };
545
+ //# sourceMappingURL=BrowserUse.d.mts.map