@sparkleideas/browser 3.0.0-alpha.19 → 3.0.0-alpha.28
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/agent/index.d.ts +25 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +33 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/application/browser-service.d.ts +228 -0
- package/dist/application/browser-service.d.ts.map +1 -0
- package/dist/application/browser-service.js +470 -0
- package/dist/application/browser-service.js.map +1 -0
- package/dist/domain/types.d.ts +309 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/domain/types.js +95 -0
- package/dist/domain/types.js.map +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/agent-browser-adapter.d.ts +134 -0
- package/dist/infrastructure/agent-browser-adapter.d.ts.map +1 -0
- package/dist/infrastructure/agent-browser-adapter.js +551 -0
- package/dist/infrastructure/agent-browser-adapter.js.map +1 -0
- package/dist/infrastructure/hooks-integration.d.ts +109 -0
- package/dist/infrastructure/hooks-integration.d.ts.map +1 -0
- package/dist/infrastructure/hooks-integration.js +111 -0
- package/dist/infrastructure/hooks-integration.js.map +1 -0
- package/dist/infrastructure/memory-integration.d.ts +149 -0
- package/dist/infrastructure/memory-integration.d.ts.map +1 -0
- package/dist/infrastructure/memory-integration.js +335 -0
- package/dist/infrastructure/memory-integration.js.map +1 -0
- package/dist/infrastructure/reasoningbank-adapter.d.ts +90 -0
- package/dist/infrastructure/reasoningbank-adapter.d.ts.map +1 -0
- package/dist/infrastructure/reasoningbank-adapter.js +224 -0
- package/dist/infrastructure/reasoningbank-adapter.js.map +1 -0
- package/dist/infrastructure/security-integration.d.ts +80 -0
- package/dist/infrastructure/security-integration.d.ts.map +1 -0
- package/dist/infrastructure/security-integration.js +404 -0
- package/dist/infrastructure/security-integration.js.map +1 -0
- package/dist/infrastructure/workflow-templates.d.ts +95 -0
- package/dist/infrastructure/workflow-templates.d.ts.map +1 -0
- package/dist/infrastructure/workflow-templates.js +366 -0
- package/dist/infrastructure/workflow-templates.js.map +1 -0
- package/dist/mcp-tools/browser-tools.d.ts +18 -0
- package/dist/mcp-tools/browser-tools.d.ts.map +1 -0
- package/dist/mcp-tools/browser-tools.js +1163 -0
- package/dist/mcp-tools/browser-tools.js.map +1 -0
- package/dist/mcp-tools/index.d.ts +6 -0
- package/dist/mcp-tools/index.d.ts.map +1 -0
- package/dist/mcp-tools/index.js +6 -0
- package/dist/mcp-tools/index.js.map +1 -0
- package/dist/skill/index.d.ts +15 -0
- package/dist/skill/index.d.ts.map +1 -0
- package/dist/skill/index.js +23 -0
- package/dist/skill/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sparkleideas/browser - Domain Types
|
|
3
|
+
* Core type definitions for browser automation
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export declare const ElementRefSchema: z.ZodString;
|
|
7
|
+
export type ElementRef = z.infer<typeof ElementRefSchema>;
|
|
8
|
+
export declare const SelectorSchema: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
9
|
+
export type Selector = z.infer<typeof SelectorSchema>;
|
|
10
|
+
export interface SnapshotNode {
|
|
11
|
+
role: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
ref?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
level?: number;
|
|
17
|
+
checked?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
expanded?: boolean;
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
children?: SnapshotNode[];
|
|
22
|
+
}
|
|
23
|
+
export interface Snapshot {
|
|
24
|
+
tree: SnapshotNode;
|
|
25
|
+
refs: Record<string, SnapshotNode>;
|
|
26
|
+
url: string;
|
|
27
|
+
title: string;
|
|
28
|
+
timestamp: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SnapshotOptions {
|
|
31
|
+
interactive?: boolean;
|
|
32
|
+
compact?: boolean;
|
|
33
|
+
depth?: number;
|
|
34
|
+
selector?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface BrowserSession {
|
|
37
|
+
id: string;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
lastActivity: string;
|
|
40
|
+
currentUrl?: string;
|
|
41
|
+
cookies: Cookie[];
|
|
42
|
+
localStorage: Record<string, string>;
|
|
43
|
+
sessionStorage: Record<string, string>;
|
|
44
|
+
history: string[];
|
|
45
|
+
authState?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface Cookie {
|
|
48
|
+
name: string;
|
|
49
|
+
value: string;
|
|
50
|
+
domain?: string;
|
|
51
|
+
path?: string;
|
|
52
|
+
expires?: number;
|
|
53
|
+
httpOnly?: boolean;
|
|
54
|
+
secure?: boolean;
|
|
55
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
56
|
+
}
|
|
57
|
+
export interface NetworkRoute {
|
|
58
|
+
urlPattern: string;
|
|
59
|
+
action: 'intercept' | 'abort' | 'mock';
|
|
60
|
+
mockResponse?: {
|
|
61
|
+
status?: number;
|
|
62
|
+
headers?: Record<string, string>;
|
|
63
|
+
body?: string | object;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface NetworkRequest {
|
|
67
|
+
url: string;
|
|
68
|
+
method: string;
|
|
69
|
+
headers: Record<string, string>;
|
|
70
|
+
postData?: string;
|
|
71
|
+
timestamp: string;
|
|
72
|
+
status?: number;
|
|
73
|
+
responseHeaders?: Record<string, string>;
|
|
74
|
+
}
|
|
75
|
+
export interface Viewport {
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
}
|
|
79
|
+
export interface DeviceDescriptor {
|
|
80
|
+
name: string;
|
|
81
|
+
viewport: Viewport;
|
|
82
|
+
userAgent: string;
|
|
83
|
+
deviceScaleFactor: number;
|
|
84
|
+
isMobile: boolean;
|
|
85
|
+
hasTouch: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface ActionResult<T = unknown> {
|
|
88
|
+
success: boolean;
|
|
89
|
+
data?: T;
|
|
90
|
+
error?: string;
|
|
91
|
+
duration?: number;
|
|
92
|
+
screenshot?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface ClickResult extends ActionResult {
|
|
95
|
+
data?: {
|
|
96
|
+
clicked: boolean;
|
|
97
|
+
position?: {
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export interface FillResult extends ActionResult {
|
|
104
|
+
data?: {
|
|
105
|
+
filled: boolean;
|
|
106
|
+
previousValue?: string;
|
|
107
|
+
newValue: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export interface ScreenshotResult extends ActionResult<string> {
|
|
111
|
+
data?: string;
|
|
112
|
+
path?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface EvalResult<T = unknown> extends ActionResult<T> {
|
|
115
|
+
data?: T;
|
|
116
|
+
}
|
|
117
|
+
export declare const OpenInputSchema: z.ZodObject<{
|
|
118
|
+
url: z.ZodString;
|
|
119
|
+
session: z.ZodOptional<z.ZodString>;
|
|
120
|
+
waitUntil: z.ZodOptional<z.ZodEnum<{
|
|
121
|
+
load: "load";
|
|
122
|
+
domcontentloaded: "domcontentloaded";
|
|
123
|
+
networkidle: "networkidle";
|
|
124
|
+
}>>;
|
|
125
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.core.SomeType>>;
|
|
126
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export type OpenInput = z.infer<typeof OpenInputSchema>;
|
|
129
|
+
export declare const ClickInputSchema: z.ZodObject<{
|
|
130
|
+
target: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
131
|
+
button: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
left: "left";
|
|
133
|
+
right: "right";
|
|
134
|
+
middle: "middle";
|
|
135
|
+
}>>;
|
|
136
|
+
clickCount: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
export type ClickInput = z.infer<typeof ClickInputSchema>;
|
|
142
|
+
export declare const FillInputSchema: z.ZodObject<{
|
|
143
|
+
target: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
144
|
+
value: z.ZodString;
|
|
145
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
146
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
export type FillInput = z.infer<typeof FillInputSchema>;
|
|
149
|
+
export declare const TypeInputSchema: z.ZodObject<{
|
|
150
|
+
target: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
151
|
+
text: z.ZodString;
|
|
152
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
export type TypeInput = z.infer<typeof TypeInputSchema>;
|
|
156
|
+
export declare const PressInputSchema: z.ZodObject<{
|
|
157
|
+
key: z.ZodString;
|
|
158
|
+
delay: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export type PressInput = z.infer<typeof PressInputSchema>;
|
|
161
|
+
export declare const SnapshotInputSchema: z.ZodObject<{
|
|
162
|
+
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
compact: z.ZodOptional<z.ZodBoolean>;
|
|
164
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
export type SnapshotInput = z.infer<typeof SnapshotInputSchema>;
|
|
168
|
+
export declare const ScreenshotInputSchema: z.ZodObject<{
|
|
169
|
+
path: z.ZodOptional<z.ZodString>;
|
|
170
|
+
fullPage: z.ZodOptional<z.ZodBoolean>;
|
|
171
|
+
clip: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
x: z.ZodNumber;
|
|
173
|
+
y: z.ZodNumber;
|
|
174
|
+
width: z.ZodNumber;
|
|
175
|
+
height: z.ZodNumber;
|
|
176
|
+
}, z.core.$strip>>;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
export type ScreenshotInput = z.infer<typeof ScreenshotInputSchema>;
|
|
179
|
+
export declare const WaitInputSchema: z.ZodObject<{
|
|
180
|
+
selector: z.ZodOptional<z.ZodString>;
|
|
181
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
text: z.ZodOptional<z.ZodString>;
|
|
183
|
+
url: z.ZodOptional<z.ZodString>;
|
|
184
|
+
load: z.ZodOptional<z.ZodEnum<{
|
|
185
|
+
load: "load";
|
|
186
|
+
domcontentloaded: "domcontentloaded";
|
|
187
|
+
networkidle: "networkidle";
|
|
188
|
+
}>>;
|
|
189
|
+
fn: z.ZodOptional<z.ZodString>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
export type WaitInput = z.infer<typeof WaitInputSchema>;
|
|
192
|
+
export declare const EvalInputSchema: z.ZodObject<{
|
|
193
|
+
script: z.ZodString;
|
|
194
|
+
args: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
export type EvalInput = z.infer<typeof EvalInputSchema>;
|
|
197
|
+
export declare const GetInputSchema: z.ZodObject<{
|
|
198
|
+
type: z.ZodEnum<{
|
|
199
|
+
value: "value";
|
|
200
|
+
url: "url";
|
|
201
|
+
text: "text";
|
|
202
|
+
html: "html";
|
|
203
|
+
attr: "attr";
|
|
204
|
+
title: "title";
|
|
205
|
+
count: "count";
|
|
206
|
+
box: "box";
|
|
207
|
+
}>;
|
|
208
|
+
target: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
|
|
209
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, z.core.$strip>;
|
|
211
|
+
export type GetInput = z.infer<typeof GetInputSchema>;
|
|
212
|
+
export declare const SetViewportInputSchema: z.ZodObject<{
|
|
213
|
+
width: z.ZodNumber;
|
|
214
|
+
height: z.ZodNumber;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
export type SetViewportInput = z.infer<typeof SetViewportInputSchema>;
|
|
217
|
+
export declare const SetDeviceInputSchema: z.ZodObject<{
|
|
218
|
+
device: z.ZodString;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
export type SetDeviceInput = z.infer<typeof SetDeviceInputSchema>;
|
|
221
|
+
export declare const NetworkRouteInputSchema: z.ZodObject<{
|
|
222
|
+
urlPattern: z.ZodString;
|
|
223
|
+
abort: z.ZodOptional<z.ZodBoolean>;
|
|
224
|
+
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{}, z.core.$strip>]>>;
|
|
225
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.core.SomeType>>;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
export type NetworkRouteInput = z.infer<typeof NetworkRouteInputSchema>;
|
|
229
|
+
export type BrowserEvent = {
|
|
230
|
+
type: 'session:created';
|
|
231
|
+
sessionId: string;
|
|
232
|
+
timestamp: string;
|
|
233
|
+
} | {
|
|
234
|
+
type: 'session:closed';
|
|
235
|
+
sessionId: string;
|
|
236
|
+
timestamp: string;
|
|
237
|
+
} | {
|
|
238
|
+
type: 'page:navigated';
|
|
239
|
+
url: string;
|
|
240
|
+
title: string;
|
|
241
|
+
timestamp: string;
|
|
242
|
+
} | {
|
|
243
|
+
type: 'page:loaded';
|
|
244
|
+
url: string;
|
|
245
|
+
loadTime: number;
|
|
246
|
+
timestamp: string;
|
|
247
|
+
} | {
|
|
248
|
+
type: 'element:clicked';
|
|
249
|
+
ref: string;
|
|
250
|
+
selector?: string;
|
|
251
|
+
timestamp: string;
|
|
252
|
+
} | {
|
|
253
|
+
type: 'element:filled';
|
|
254
|
+
ref: string;
|
|
255
|
+
value: string;
|
|
256
|
+
timestamp: string;
|
|
257
|
+
} | {
|
|
258
|
+
type: 'snapshot:taken';
|
|
259
|
+
refs: number;
|
|
260
|
+
interactive: number;
|
|
261
|
+
timestamp: string;
|
|
262
|
+
} | {
|
|
263
|
+
type: 'screenshot:captured';
|
|
264
|
+
path?: string;
|
|
265
|
+
size: number;
|
|
266
|
+
timestamp: string;
|
|
267
|
+
} | {
|
|
268
|
+
type: 'network:intercepted';
|
|
269
|
+
url: string;
|
|
270
|
+
action: string;
|
|
271
|
+
timestamp: string;
|
|
272
|
+
} | {
|
|
273
|
+
type: 'error:occurred';
|
|
274
|
+
message: string;
|
|
275
|
+
stack?: string;
|
|
276
|
+
timestamp: string;
|
|
277
|
+
};
|
|
278
|
+
export interface BrowserTrajectory {
|
|
279
|
+
id: string;
|
|
280
|
+
sessionId: string;
|
|
281
|
+
goal: string;
|
|
282
|
+
steps: BrowserTrajectoryStep[];
|
|
283
|
+
startedAt: string;
|
|
284
|
+
completedAt?: string;
|
|
285
|
+
success?: boolean;
|
|
286
|
+
verdict?: string;
|
|
287
|
+
}
|
|
288
|
+
export interface BrowserTrajectoryStep {
|
|
289
|
+
action: string;
|
|
290
|
+
input: Record<string, unknown>;
|
|
291
|
+
result: ActionResult;
|
|
292
|
+
snapshot?: Snapshot;
|
|
293
|
+
timestamp: string;
|
|
294
|
+
}
|
|
295
|
+
export interface BrowserSwarmConfig {
|
|
296
|
+
topology: 'hierarchical' | 'mesh' | 'star';
|
|
297
|
+
maxSessions: number;
|
|
298
|
+
sessionPrefix: string;
|
|
299
|
+
sharedCookies?: boolean;
|
|
300
|
+
coordinatorSession?: string;
|
|
301
|
+
}
|
|
302
|
+
export interface BrowserAgentConfig {
|
|
303
|
+
sessionId: string;
|
|
304
|
+
role: 'navigator' | 'scraper' | 'validator' | 'tester' | 'monitor';
|
|
305
|
+
capabilities: string[];
|
|
306
|
+
defaultTimeout: number;
|
|
307
|
+
headless: boolean;
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/domain/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,gBAAgB,aAAkE,CAAC;AAChG,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,cAAc,iDAGzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAMtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACnC,GAAG,EA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B,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sparkleideas/browser - Domain Types
|
|
3
|
+
* Core type definitions for browser automation
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Element Reference (from agent-browser snapshots)
|
|
8
|
+
// ============================================================================
|
|
9
|
+
export const ElementRefSchema = z.string().regex(/^@e\d+$/, 'Must be in format @e1, @e2, etc.');
|
|
10
|
+
export const SelectorSchema = z.union([
|
|
11
|
+
ElementRefSchema,
|
|
12
|
+
z.string().min(1), // CSS selector, text=, xpath=, etc.
|
|
13
|
+
]);
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Command Input Schemas
|
|
16
|
+
// ============================================================================
|
|
17
|
+
export const OpenInputSchema = z.object({
|
|
18
|
+
url: z.string().url(),
|
|
19
|
+
session: z.string().optional(),
|
|
20
|
+
waitUntil: z.enum(['load', 'domcontentloaded', 'networkidle']).optional(),
|
|
21
|
+
headers: z.record(z.string()).optional(),
|
|
22
|
+
timeout: z.number().positive().optional(),
|
|
23
|
+
});
|
|
24
|
+
export const ClickInputSchema = z.object({
|
|
25
|
+
target: SelectorSchema,
|
|
26
|
+
button: z.enum(['left', 'right', 'middle']).optional(),
|
|
27
|
+
clickCount: z.number().int().positive().optional(),
|
|
28
|
+
delay: z.number().nonnegative().optional(),
|
|
29
|
+
force: z.boolean().optional(),
|
|
30
|
+
timeout: z.number().positive().optional(),
|
|
31
|
+
});
|
|
32
|
+
export const FillInputSchema = z.object({
|
|
33
|
+
target: SelectorSchema,
|
|
34
|
+
value: z.string(),
|
|
35
|
+
force: z.boolean().optional(),
|
|
36
|
+
timeout: z.number().positive().optional(),
|
|
37
|
+
});
|
|
38
|
+
export const TypeInputSchema = z.object({
|
|
39
|
+
target: SelectorSchema,
|
|
40
|
+
text: z.string(),
|
|
41
|
+
delay: z.number().nonnegative().optional(),
|
|
42
|
+
timeout: z.number().positive().optional(),
|
|
43
|
+
});
|
|
44
|
+
export const PressInputSchema = z.object({
|
|
45
|
+
key: z.string(),
|
|
46
|
+
delay: z.number().nonnegative().optional(),
|
|
47
|
+
});
|
|
48
|
+
export const SnapshotInputSchema = z.object({
|
|
49
|
+
interactive: z.boolean().optional(),
|
|
50
|
+
compact: z.boolean().optional(),
|
|
51
|
+
depth: z.number().int().positive().optional(),
|
|
52
|
+
selector: z.string().optional(),
|
|
53
|
+
});
|
|
54
|
+
export const ScreenshotInputSchema = z.object({
|
|
55
|
+
path: z.string().optional(),
|
|
56
|
+
fullPage: z.boolean().optional(),
|
|
57
|
+
clip: z.object({
|
|
58
|
+
x: z.number(),
|
|
59
|
+
y: z.number(),
|
|
60
|
+
width: z.number(),
|
|
61
|
+
height: z.number(),
|
|
62
|
+
}).optional(),
|
|
63
|
+
});
|
|
64
|
+
export const WaitInputSchema = z.object({
|
|
65
|
+
selector: z.string().optional(),
|
|
66
|
+
timeout: z.number().positive().optional(),
|
|
67
|
+
text: z.string().optional(),
|
|
68
|
+
url: z.string().optional(),
|
|
69
|
+
load: z.enum(['load', 'domcontentloaded', 'networkidle']).optional(),
|
|
70
|
+
fn: z.string().optional(), // JavaScript condition
|
|
71
|
+
});
|
|
72
|
+
export const EvalInputSchema = z.object({
|
|
73
|
+
script: z.string(),
|
|
74
|
+
args: z.array(z.unknown()).optional(),
|
|
75
|
+
});
|
|
76
|
+
export const GetInputSchema = z.object({
|
|
77
|
+
type: z.enum(['text', 'html', 'value', 'attr', 'title', 'url', 'count', 'box']),
|
|
78
|
+
target: SelectorSchema.optional(),
|
|
79
|
+
attribute: z.string().optional(), // For 'attr' type
|
|
80
|
+
});
|
|
81
|
+
export const SetViewportInputSchema = z.object({
|
|
82
|
+
width: z.number().int().positive(),
|
|
83
|
+
height: z.number().int().positive(),
|
|
84
|
+
});
|
|
85
|
+
export const SetDeviceInputSchema = z.object({
|
|
86
|
+
device: z.string(),
|
|
87
|
+
});
|
|
88
|
+
export const NetworkRouteInputSchema = z.object({
|
|
89
|
+
urlPattern: z.string(),
|
|
90
|
+
abort: z.boolean().optional(),
|
|
91
|
+
body: z.union([z.string(), z.object({})]).optional(),
|
|
92
|
+
status: z.number().int().optional(),
|
|
93
|
+
headers: z.record(z.string()).optional(),
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/domain/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAC/E,mDAAmD;AACnD,+EAA+E;AAE/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC;AAGhG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC;IACpC,gBAAgB;IAChB,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,o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QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,kBAAkB;CACrD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC7B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACpD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sparkleideas/browser
|
|
3
|
+
* Browser automation for AI agents - integrates agent-browser with claude-flow swarms
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - 50+ MCP tools for browser automation
|
|
7
|
+
* - AI-optimized snapshots with element refs (@e1, @e2)
|
|
8
|
+
* - Multi-session support for swarm coordination
|
|
9
|
+
* - Trajectory tracking for ReasoningBank/SONA learning
|
|
10
|
+
* - Integration with agentic-flow optimizations
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { createBrowserService, browserTools } from '@sparkleideas/browser';
|
|
15
|
+
*
|
|
16
|
+
* // Create a browser service
|
|
17
|
+
* const browser = createBrowserService({ sessionId: 'my-session' });
|
|
18
|
+
*
|
|
19
|
+
* // Start a trajectory for learning
|
|
20
|
+
* const trajectoryId = browser.startTrajectory('Login to dashboard');
|
|
21
|
+
*
|
|
22
|
+
* // Perform actions
|
|
23
|
+
* await browser.open('https://example.com/login');
|
|
24
|
+
* await browser.snapshot({ interactive: true });
|
|
25
|
+
* await browser.fill('@e1', 'user@example.com');
|
|
26
|
+
* await browser.fill('@e2', 'password');
|
|
27
|
+
* await browser.click('@e3');
|
|
28
|
+
*
|
|
29
|
+
* // End trajectory
|
|
30
|
+
* const trajectory = browser.endTrajectory(true, 'Login successful');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export * from './domain/types.js';
|
|
34
|
+
export { AgentBrowserAdapter } from './infrastructure/agent-browser-adapter.js';
|
|
35
|
+
export type { AgentBrowserAdapterOptions } from './infrastructure/agent-browser-adapter.js';
|
|
36
|
+
export { ReasoningBankAdapter, getReasoningBank, type BrowserPattern, type PatternStep, } from './infrastructure/reasoningbank-adapter.js';
|
|
37
|
+
export { preBrowseHook, postBrowseHook, browserHooks, type PreBrowseInput, type PreBrowseResult, type PostBrowseInput, type PostBrowseResult, } from './infrastructure/hooks-integration.js';
|
|
38
|
+
export { ClaudeFlowMemoryAdapter, BrowserMemoryManager, createMemoryManager, getMemoryAdapter, type BrowserMemoryEntry, type MemorySearchResult, type MemoryStats, type MemorySearchOptions, type MemoryFilter, type IMemoryAdapter, } from './infrastructure/memory-integration.js';
|
|
39
|
+
export { BrowserSecurityScanner, getSecurityScanner, isUrlSafe, containsPII, type ThreatScanResult, type Threat, type ThreatType, type PIIMatch, type PIIType, type SecurityConfig, } from './infrastructure/security-integration.js';
|
|
40
|
+
export { WorkflowManager, getWorkflowManager, listWorkflows, getWorkflow, WORKFLOW_TEMPLATES, type WorkflowTemplate, type WorkflowCategory, type WorkflowStep, type WorkflowVariable, type WorkflowExecution, type WorkflowStepResult, type BrowserAction, } from './infrastructure/workflow-templates.js';
|
|
41
|
+
export { BrowserService, BrowserSwarmCoordinator, createBrowserService, createBrowserSwarm, type BrowserServiceConfig, } from './application/browser-service.js';
|
|
42
|
+
export { browserTools } from './mcp-tools/browser-tools.js';
|
|
43
|
+
export type { MCPTool } from './mcp-tools/browser-tools.js';
|
|
44
|
+
import { BrowserService, createBrowserService, createBrowserSwarm } from './application/browser-service.js';
|
|
45
|
+
import { preBrowseHook, postBrowseHook } from './infrastructure/hooks-integration.js';
|
|
46
|
+
import { getReasoningBank } from './infrastructure/reasoningbank-adapter.js';
|
|
47
|
+
import { getMemoryAdapter, createMemoryManager } from './infrastructure/memory-integration.js';
|
|
48
|
+
import { getSecurityScanner, isUrlSafe, containsPII } from './infrastructure/security-integration.js';
|
|
49
|
+
import { getWorkflowManager, listWorkflows, getWorkflow } from './infrastructure/workflow-templates.js';
|
|
50
|
+
declare const _default: {
|
|
51
|
+
BrowserService: typeof BrowserService;
|
|
52
|
+
createBrowserService: typeof createBrowserService;
|
|
53
|
+
createBrowserSwarm: typeof createBrowserSwarm;
|
|
54
|
+
browserTools: import("./mcp-tools/browser-tools.js").MCPTool[];
|
|
55
|
+
browserHooks: {
|
|
56
|
+
'pre-browse': {
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
handler: typeof preBrowseHook;
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: string;
|
|
62
|
+
properties: {
|
|
63
|
+
goal: {
|
|
64
|
+
type: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
url: {
|
|
68
|
+
type: string;
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
context: {
|
|
72
|
+
type: string;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
required: string[];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
'post-browse': {
|
|
80
|
+
name: string;
|
|
81
|
+
description: string;
|
|
82
|
+
handler: typeof postBrowseHook;
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: string;
|
|
85
|
+
properties: {
|
|
86
|
+
trajectoryId: {
|
|
87
|
+
type: string;
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
90
|
+
success: {
|
|
91
|
+
type: string;
|
|
92
|
+
description: string;
|
|
93
|
+
};
|
|
94
|
+
verdict: {
|
|
95
|
+
type: string;
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
duration: {
|
|
99
|
+
type: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
stepsCompleted: {
|
|
103
|
+
type: string;
|
|
104
|
+
description: string;
|
|
105
|
+
};
|
|
106
|
+
errors: {
|
|
107
|
+
type: string;
|
|
108
|
+
items: {
|
|
109
|
+
type: string;
|
|
110
|
+
};
|
|
111
|
+
description: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
required: string[];
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
preBrowseHook: typeof preBrowseHook;
|
|
119
|
+
postBrowseHook: typeof postBrowseHook;
|
|
120
|
+
getReasoningBank: typeof getReasoningBank;
|
|
121
|
+
getMemoryAdapter: typeof getMemoryAdapter;
|
|
122
|
+
createMemoryManager: typeof createMemoryManager;
|
|
123
|
+
getSecurityScanner: typeof getSecurityScanner;
|
|
124
|
+
isUrlSafe: typeof isUrlSafe;
|
|
125
|
+
containsPII: typeof containsPII;
|
|
126
|
+
getWorkflowManager: typeof getWorkflowManager;
|
|
127
|
+
listWorkflows: typeof listWorkflows;
|
|
128
|
+
getWorkflow: typeof getWorkflow;
|
|
129
|
+
};
|
|
130
|
+
export default _default;
|
|
131
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,cAAc,mBAAmB,CAAC;AAGlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,YAAY,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAG5F,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EACL,aAAa,EACb,cAAc,EACd,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,uCAAuC,CAAC;AAG/C,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,cAAc,GACpB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACnB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,oBAAoB,GAC1B,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,YAAY,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE5G,OAAO,EAAgB,aAAa,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExG,wBA8BE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sparkleideas/browser
|
|
3
|
+
* Browser automation for AI agents - integrates agent-browser with claude-flow swarms
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - 50+ MCP tools for browser automation
|
|
7
|
+
* - AI-optimized snapshots with element refs (@e1, @e2)
|
|
8
|
+
* - Multi-session support for swarm coordination
|
|
9
|
+
* - Trajectory tracking for ReasoningBank/SONA learning
|
|
10
|
+
* - Integration with agentic-flow optimizations
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { createBrowserService, browserTools } from '@sparkleideas/browser';
|
|
15
|
+
*
|
|
16
|
+
* // Create a browser service
|
|
17
|
+
* const browser = createBrowserService({ sessionId: 'my-session' });
|
|
18
|
+
*
|
|
19
|
+
* // Start a trajectory for learning
|
|
20
|
+
* const trajectoryId = browser.startTrajectory('Login to dashboard');
|
|
21
|
+
*
|
|
22
|
+
* // Perform actions
|
|
23
|
+
* await browser.open('https://example.com/login');
|
|
24
|
+
* await browser.snapshot({ interactive: true });
|
|
25
|
+
* await browser.fill('@e1', 'user@example.com');
|
|
26
|
+
* await browser.fill('@e2', 'password');
|
|
27
|
+
* await browser.click('@e3');
|
|
28
|
+
*
|
|
29
|
+
* // End trajectory
|
|
30
|
+
* const trajectory = browser.endTrajectory(true, 'Login successful');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
// Domain types
|
|
34
|
+
export * from './domain/types.js';
|
|
35
|
+
// Infrastructure
|
|
36
|
+
export { AgentBrowserAdapter } from './infrastructure/agent-browser-adapter.js';
|
|
37
|
+
// ReasoningBank integration
|
|
38
|
+
export { ReasoningBankAdapter, getReasoningBank, } from './infrastructure/reasoningbank-adapter.js';
|
|
39
|
+
// Hooks integration
|
|
40
|
+
export { preBrowseHook, postBrowseHook, browserHooks, } from './infrastructure/hooks-integration.js';
|
|
41
|
+
// Memory integration (HNSW semantic search)
|
|
42
|
+
export { ClaudeFlowMemoryAdapter, BrowserMemoryManager, createMemoryManager, getMemoryAdapter, } from './infrastructure/memory-integration.js';
|
|
43
|
+
// Security integration (AIDefence)
|
|
44
|
+
export { BrowserSecurityScanner, getSecurityScanner, isUrlSafe, containsPII, } from './infrastructure/security-integration.js';
|
|
45
|
+
// Workflow templates
|
|
46
|
+
export { WorkflowManager, getWorkflowManager, listWorkflows, getWorkflow, WORKFLOW_TEMPLATES, } from './infrastructure/workflow-templates.js';
|
|
47
|
+
// Application services
|
|
48
|
+
export { BrowserService, BrowserSwarmCoordinator, createBrowserService, createBrowserSwarm, } from './application/browser-service.js';
|
|
49
|
+
// MCP tools
|
|
50
|
+
export { browserTools } from './mcp-tools/browser-tools.js';
|
|
51
|
+
// Re-export main classes as defaults
|
|
52
|
+
import { BrowserService, createBrowserService, createBrowserSwarm } from './application/browser-service.js';
|
|
53
|
+
import { browserTools } from './mcp-tools/browser-tools.js';
|
|
54
|
+
import { browserHooks, preBrowseHook, postBrowseHook } from './infrastructure/hooks-integration.js';
|
|
55
|
+
import { getReasoningBank } from './infrastructure/reasoningbank-adapter.js';
|
|
56
|
+
import { getMemoryAdapter, createMemoryManager } from './infrastructure/memory-integration.js';
|
|
57
|
+
import { getSecurityScanner, isUrlSafe, containsPII } from './infrastructure/security-integration.js';
|
|
58
|
+
import { getWorkflowManager, listWorkflows, getWorkflow } from './infrastructure/workflow-templates.js';
|
|
59
|
+
export default {
|
|
60
|
+
// Services
|
|
61
|
+
BrowserService,
|
|
62
|
+
createBrowserService,
|
|
63
|
+
createBrowserSwarm,
|
|
64
|
+
// MCP tools
|
|
65
|
+
browserTools,
|
|
66
|
+
// Hooks
|
|
67
|
+
browserHooks,
|
|
68
|
+
preBrowseHook,
|
|
69
|
+
postBrowseHook,
|
|
70
|
+
// Learning
|
|
71
|
+
getReasoningBank,
|
|
72
|
+
// Memory (HNSW-indexed)
|
|
73
|
+
getMemoryAdapter,
|
|
74
|
+
createMemoryManager,
|
|
75
|
+
// Security (AIDefence)
|
|
76
|
+
getSecurityScanner,
|
|
77
|
+
isUrlSafe,
|
|
78
|
+
containsPII,
|
|
79
|
+
// Workflows
|
|
80
|
+
getWorkflowManager,
|
|
81
|
+
listWorkflows,
|
|
82
|
+
getWorkflow,
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,eAAe;AACf,cAAc,mBAAmB,CAAC;AAElC,iBAAiB;AACjB,OAAO,EAAE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