agentic-browser 2.6.1 → 2.7.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/AGENTS.md +25 -19
- package/README.md +16 -1
- package/dist/cli/index.mjs +300 -54
- package/dist/index.d.mts +158 -99
- package/dist/index.mjs +1 -2
- package/dist/mcp/index.d.mts +1 -4
- package/dist/mcp/index.mjs +47 -18
- package/dist/{runtime-BzdbtFF4.mjs → runtime-CfQ0xGAm.mjs} +1055 -207
- package/dist/{setup-DUAjdbQ3.mjs → setup-DwFaZOPf.mjs} +13 -6
- package/package.json +21 -19
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
2
|
+
import "ws";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
//#region src/session/browser-controller.d.ts
|
|
5
4
|
type InteractAction = "click" | "type" | "press" | "waitFor" | "evaluate" | "scroll" | "hover" | "select" | "toggle" | "goBack" | "goForward" | "refresh" | "dialog";
|
|
6
5
|
interface InteractPayload {
|
|
7
6
|
action: InteractAction;
|
|
@@ -13,6 +12,13 @@ interface InteractPayload {
|
|
|
13
12
|
scrollX?: number;
|
|
14
13
|
scrollY?: number;
|
|
15
14
|
timeoutMs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Locator of an iframe to run the action in. Needed for cross-origin frames,
|
|
17
|
+
* which `>>>` cannot pierce from the page. Composed selectors like
|
|
18
|
+
* `iframe#consent >>> button` are split automatically when the frame is
|
|
19
|
+
* cross-origin, so this is only required for explicit control.
|
|
20
|
+
*/
|
|
21
|
+
frame?: string;
|
|
16
22
|
}
|
|
17
23
|
type PageContentMode = "title" | "text" | "html" | "a11y" | "summary";
|
|
18
24
|
interface PageContentOptions {
|
|
@@ -49,11 +55,36 @@ interface InteractiveElementsOptions {
|
|
|
49
55
|
visibleOnly?: boolean;
|
|
50
56
|
limit?: number;
|
|
51
57
|
selector?: string;
|
|
58
|
+
/** Case-insensitive substring filter on the element's href. */
|
|
59
|
+
href?: string;
|
|
60
|
+
/** Case-insensitive substring filter on text, aria-label, placeholder, value or title. */
|
|
61
|
+
text?: string;
|
|
62
|
+
/** Discover elements inside this iframe (works for cross-origin frames). */
|
|
63
|
+
frame?: string;
|
|
64
|
+
}
|
|
65
|
+
/** An iframe whose content discovery could not enter from the page context. */
|
|
66
|
+
interface CrossOriginFrameInfo {
|
|
67
|
+
selector: string;
|
|
68
|
+
title?: string;
|
|
69
|
+
src?: string;
|
|
52
70
|
}
|
|
53
71
|
interface InteractiveElementsResult {
|
|
54
72
|
elements: InteractiveElement[];
|
|
55
73
|
totalFound: number;
|
|
56
74
|
truncated: boolean;
|
|
75
|
+
/** Cross-origin iframes skipped by discovery — pass one as `frame` to look inside. */
|
|
76
|
+
crossOriginFrames?: CrossOriginFrameInfo[];
|
|
77
|
+
}
|
|
78
|
+
interface PageState {
|
|
79
|
+
url: string;
|
|
80
|
+
title: string;
|
|
81
|
+
readyState: string;
|
|
82
|
+
}
|
|
83
|
+
interface TabInfo {
|
|
84
|
+
id: string;
|
|
85
|
+
url: string;
|
|
86
|
+
title: string;
|
|
87
|
+
targetWsUrl: string;
|
|
57
88
|
}
|
|
58
89
|
interface LaunchOptions {
|
|
59
90
|
executablePath?: string;
|
|
@@ -63,7 +94,7 @@ interface LaunchOptions {
|
|
|
63
94
|
}
|
|
64
95
|
interface DismissCookieBannerResult {
|
|
65
96
|
dismissed: boolean;
|
|
66
|
-
method?: "a11y" | "selector" | "text";
|
|
97
|
+
method?: "a11y" | "selector" | "text" | "iframe" | "iframe-text";
|
|
67
98
|
detail?: string;
|
|
68
99
|
}
|
|
69
100
|
type ErrorCode = "SELECTOR_NOT_FOUND" | "ELEMENT_COVERED" | "ELEMENT_NOT_EDITABLE" | "NAVIGATION_TIMEOUT" | "NAVIGATION_FAILED" | "CDP_DISCONNECTED" | "SESSION_DEAD" | "DIALOG_BLOCKING" | "TIMEOUT" | "UNKNOWN";
|
|
@@ -96,22 +127,25 @@ interface BrowserController {
|
|
|
96
127
|
dismissCookieBanner(targetWsUrl: string): Promise<DismissCookieBannerResult>;
|
|
97
128
|
screenshot(targetWsUrl: string, options?: ScreenshotOptions): Promise<ScreenshotResult>;
|
|
98
129
|
getCurrentUrl(targetWsUrl: string): Promise<string>;
|
|
130
|
+
getPageState(targetWsUrl: string): Promise<PageState>;
|
|
131
|
+
listTabs(cdpUrl: string): Promise<TabInfo[]>;
|
|
132
|
+
openTab(cdpUrl: string): Promise<TabInfo>;
|
|
133
|
+
activateTab(cdpUrl: string, tabId: string): Promise<void>;
|
|
134
|
+
closeTab(cdpUrl: string, tabId: string): Promise<void>;
|
|
99
135
|
terminate(pid: number): void;
|
|
100
136
|
closeConnection?(targetWsUrl: string): void;
|
|
101
137
|
dispose?(): void;
|
|
102
138
|
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/memory/memory-schemas.d.ts
|
|
105
139
|
declare const InsightFreshnessSchema: z.ZodEnum<{
|
|
106
140
|
fresh: "fresh";
|
|
107
|
-
suspect: "suspect";
|
|
108
141
|
stale: "stale";
|
|
142
|
+
suspect: "suspect";
|
|
109
143
|
}>;
|
|
110
144
|
declare const TaskStepSchema: z.ZodObject<{
|
|
111
145
|
type: z.ZodEnum<{
|
|
112
|
-
navigate: "navigate";
|
|
113
|
-
interact: "interact";
|
|
114
146
|
assert: "assert";
|
|
147
|
+
interact: "interact";
|
|
148
|
+
navigate: "navigate";
|
|
115
149
|
}>;
|
|
116
150
|
summary: z.ZodString;
|
|
117
151
|
selector: z.ZodOptional<z.ZodString>;
|
|
@@ -129,9 +163,9 @@ declare const TaskInsightSchema: z.ZodObject<{
|
|
|
129
163
|
sitePathPattern: z.ZodString;
|
|
130
164
|
actionRecipe: z.ZodArray<z.ZodObject<{
|
|
131
165
|
type: z.ZodEnum<{
|
|
132
|
-
navigate: "navigate";
|
|
133
|
-
interact: "interact";
|
|
134
166
|
assert: "assert";
|
|
167
|
+
interact: "interact";
|
|
168
|
+
navigate: "navigate";
|
|
135
169
|
}>;
|
|
136
170
|
summary: z.ZodString;
|
|
137
171
|
selector: z.ZodOptional<z.ZodString>;
|
|
@@ -144,8 +178,8 @@ declare const TaskInsightSchema: z.ZodObject<{
|
|
|
144
178
|
useCount: z.ZodNumber;
|
|
145
179
|
freshness: z.ZodEnum<{
|
|
146
180
|
fresh: "fresh";
|
|
147
|
-
suspect: "suspect";
|
|
148
181
|
stale: "stale";
|
|
182
|
+
suspect: "suspect";
|
|
149
183
|
}>;
|
|
150
184
|
staleStrikeCount: z.ZodNumber;
|
|
151
185
|
lastVerifiedAt: z.ZodString;
|
|
@@ -156,8 +190,8 @@ declare const TaskInsightSchema: z.ZodObject<{
|
|
|
156
190
|
evidenceId: z.ZodString;
|
|
157
191
|
commandId: z.ZodString;
|
|
158
192
|
result: z.ZodEnum<{
|
|
159
|
-
success: "success";
|
|
160
193
|
failure: "failure";
|
|
194
|
+
success: "success";
|
|
161
195
|
}>;
|
|
162
196
|
reason: z.ZodOptional<z.ZodString>;
|
|
163
197
|
selector: z.ZodOptional<z.ZodString>;
|
|
@@ -233,28 +267,26 @@ interface MemorySearchResult {
|
|
|
233
267
|
score: number;
|
|
234
268
|
siteProfile?: SiteProfileSummary;
|
|
235
269
|
}
|
|
236
|
-
//#endregion
|
|
237
|
-
//#region src/lib/domain-schemas.d.ts
|
|
238
270
|
declare const SessionStatusSchema: z.ZodEnum<{
|
|
239
|
-
starting: "starting";
|
|
240
|
-
ready: "ready";
|
|
241
271
|
disconnected: "disconnected";
|
|
242
272
|
failed: "failed";
|
|
273
|
+
ready: "ready";
|
|
274
|
+
starting: "starting";
|
|
243
275
|
terminated: "terminated";
|
|
244
276
|
}>;
|
|
245
277
|
declare const CommandTypeSchema: z.ZodEnum<{
|
|
246
|
-
navigate: "navigate";
|
|
247
278
|
interact: "interact";
|
|
279
|
+
navigate: "navigate";
|
|
248
280
|
restart: "restart";
|
|
249
281
|
terminate: "terminate";
|
|
250
282
|
}>;
|
|
251
283
|
declare const SessionSchema: z.ZodObject<{
|
|
252
284
|
sessionId: z.ZodString;
|
|
253
285
|
status: z.ZodEnum<{
|
|
254
|
-
starting: "starting";
|
|
255
|
-
ready: "ready";
|
|
256
286
|
disconnected: "disconnected";
|
|
257
287
|
failed: "failed";
|
|
288
|
+
ready: "ready";
|
|
289
|
+
starting: "starting";
|
|
258
290
|
terminated: "terminated";
|
|
259
291
|
}>;
|
|
260
292
|
browserType: z.ZodLiteral<"chrome">;
|
|
@@ -266,8 +298,8 @@ declare const CommandSchema: z.ZodObject<{
|
|
|
266
298
|
commandId: z.ZodString;
|
|
267
299
|
sessionId: z.ZodString;
|
|
268
300
|
type: z.ZodEnum<{
|
|
269
|
-
navigate: "navigate";
|
|
270
301
|
interact: "interact";
|
|
302
|
+
navigate: "navigate";
|
|
271
303
|
restart: "restart";
|
|
272
304
|
terminate: "terminate";
|
|
273
305
|
}>;
|
|
@@ -285,9 +317,9 @@ declare const SessionEventSchema: z.ZodObject<{
|
|
|
285
317
|
eventId: z.ZodString;
|
|
286
318
|
sessionId: z.ZodString;
|
|
287
319
|
category: z.ZodEnum<{
|
|
320
|
+
command: "command";
|
|
288
321
|
lifecycle: "lifecycle";
|
|
289
322
|
security: "security";
|
|
290
|
-
command: "command";
|
|
291
323
|
}>;
|
|
292
324
|
message: z.ZodString;
|
|
293
325
|
createdAt: z.ZodString;
|
|
@@ -302,8 +334,6 @@ type CommandType = z.infer<typeof CommandTypeSchema>;
|
|
|
302
334
|
type Session = z.infer<typeof SessionSchema>;
|
|
303
335
|
type Command = z.infer<typeof CommandSchema>;
|
|
304
336
|
type SessionEvent = z.infer<typeof SessionEventSchema>;
|
|
305
|
-
//#endregion
|
|
306
|
-
//#region src/lib/config.d.ts
|
|
307
337
|
interface AppConfig {
|
|
308
338
|
dataDir: string;
|
|
309
339
|
browserExecutablePath?: string;
|
|
@@ -311,10 +341,9 @@ interface AppConfig {
|
|
|
311
341
|
userProfileDir?: string;
|
|
312
342
|
headless?: boolean;
|
|
313
343
|
userAgent?: string;
|
|
344
|
+
allowFileUrls: boolean;
|
|
314
345
|
}
|
|
315
346
|
declare function loadConfig(env?: NodeJS.ProcessEnv): AppConfig;
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region src/observability/logger.d.ts
|
|
318
347
|
interface LogContext {
|
|
319
348
|
[key: string]: unknown;
|
|
320
349
|
}
|
|
@@ -326,8 +355,6 @@ declare class Logger {
|
|
|
326
355
|
warning(message: string, context?: LogContext): void;
|
|
327
356
|
error(message: string, context?: LogContext): void;
|
|
328
357
|
}
|
|
329
|
-
//#endregion
|
|
330
|
-
//#region src/observability/event-store.d.ts
|
|
331
358
|
declare class EventStore {
|
|
332
359
|
private readonly events;
|
|
333
360
|
private readonly filePath;
|
|
@@ -349,8 +376,6 @@ declare class EventStore {
|
|
|
349
376
|
private flushAsync;
|
|
350
377
|
private readonly flushSync;
|
|
351
378
|
}
|
|
352
|
-
//#endregion
|
|
353
|
-
//#region src/auth/session-token.d.ts
|
|
354
379
|
declare class SessionTokenService {
|
|
355
380
|
private readonly tokens;
|
|
356
381
|
issue(sessionId: string): string;
|
|
@@ -359,8 +384,6 @@ declare class SessionTokenService {
|
|
|
359
384
|
get(sessionId: string): string | undefined;
|
|
360
385
|
seed(sessionId: string, token: string): void;
|
|
361
386
|
}
|
|
362
|
-
//#endregion
|
|
363
|
-
//#region src/memory/memory-service.d.ts
|
|
364
387
|
interface MemorySearchInput {
|
|
365
388
|
taskIntent: string;
|
|
366
389
|
siteDomain?: string;
|
|
@@ -385,6 +408,8 @@ declare class MemoryService {
|
|
|
385
408
|
constructor(baseDir: string);
|
|
386
409
|
/** Force an immediate synchronous flush of pending writes. */
|
|
387
410
|
flushSync(): void;
|
|
411
|
+
/** Flush pending writes and release the stores' process exit hooks. */
|
|
412
|
+
dispose(): void;
|
|
388
413
|
search(input: MemorySearchInput): MemorySearchResult[];
|
|
389
414
|
/** Invalidate search cache when data changes. */
|
|
390
415
|
private invalidateSearchCache;
|
|
@@ -400,8 +425,8 @@ declare class MemoryService {
|
|
|
400
425
|
}>;
|
|
401
426
|
};
|
|
402
427
|
verify(insightId: string): TaskInsight;
|
|
403
|
-
recordSuccess(
|
|
404
|
-
recordFailure(
|
|
428
|
+
recordSuccess(rawInput: RecordExecutionInput): TaskInsight;
|
|
429
|
+
recordFailure(rawInput: RecordExecutionInput, errorMessage: string): TaskInsight | undefined;
|
|
405
430
|
/** Update site profile from page content (call after getContent with mode="summary"). */
|
|
406
431
|
updateProfileFromContent(domain: string, pathPattern: string, structuredContent: {
|
|
407
432
|
headings?: string[];
|
|
@@ -421,13 +446,13 @@ declare class MemoryService {
|
|
|
421
446
|
private findBestExactMatch;
|
|
422
447
|
private scoreExactMatch;
|
|
423
448
|
private sameFirstPathSegment;
|
|
449
|
+
/** Strip query strings and fragments from every URL-bearing field before it is persisted. */
|
|
450
|
+
private sanitizeInput;
|
|
424
451
|
private createEvidence;
|
|
425
452
|
private maybeGenerateAliases;
|
|
426
453
|
private deriveAliasName;
|
|
427
454
|
private mergeRecipe;
|
|
428
455
|
}
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region src/cli/app.d.ts
|
|
431
456
|
interface AppContext {
|
|
432
457
|
config: ReturnType<typeof loadConfig>;
|
|
433
458
|
logger: Logger;
|
|
@@ -435,8 +460,6 @@ interface AppContext {
|
|
|
435
460
|
tokenService: SessionTokenService;
|
|
436
461
|
memoryService: MemoryService;
|
|
437
462
|
}
|
|
438
|
-
//#endregion
|
|
439
|
-
//#region src/session/session-store.d.ts
|
|
440
463
|
interface StoredSessionRecord {
|
|
441
464
|
session: Session;
|
|
442
465
|
cdpUrl: string;
|
|
@@ -444,8 +467,6 @@ interface StoredSessionRecord {
|
|
|
444
467
|
pid: number;
|
|
445
468
|
lastUrl?: string;
|
|
446
469
|
}
|
|
447
|
-
//#endregion
|
|
448
|
-
//#region src/session/session-manager.d.ts
|
|
449
470
|
interface CreateSessionInput {
|
|
450
471
|
browser: "chrome";
|
|
451
472
|
}
|
|
@@ -478,6 +499,18 @@ declare class SessionManager {
|
|
|
478
499
|
getInteractiveElements(sessionId: string, options: InteractiveElementsOptions): Promise<InteractiveElementsResult>;
|
|
479
500
|
screenshot(sessionId: string, options?: ScreenshotOptions): Promise<ScreenshotResult>;
|
|
480
501
|
getCurrentUrl(sessionId: string): Promise<string>;
|
|
502
|
+
getPageState(sessionId: string): Promise<PageState>;
|
|
503
|
+
listTabs(sessionId: string): Promise<Array<TabInfo & {
|
|
504
|
+
active: boolean;
|
|
505
|
+
}>>;
|
|
506
|
+
/** Points the session at another tab; later commands run there. */
|
|
507
|
+
switchTab(sessionId: string, tabId: string): Promise<TabInfo>;
|
|
508
|
+
newTab(sessionId: string): Promise<TabInfo>;
|
|
509
|
+
/** Closes a tab; closing the active one moves the session to a remaining tab. */
|
|
510
|
+
closeTab(sessionId: string, tabId: string): Promise<{
|
|
511
|
+
closed: string;
|
|
512
|
+
active: TabInfo;
|
|
513
|
+
}>;
|
|
481
514
|
dismissCookieBanner(sessionId: string): Promise<DismissCookieBannerResult>;
|
|
482
515
|
setStatus(status: SessionStatus, reason: string): Session;
|
|
483
516
|
terminateSession(sessionId: string): Promise<Session>;
|
|
@@ -496,36 +529,36 @@ declare class SessionManager {
|
|
|
496
529
|
siteDomain: string;
|
|
497
530
|
sitePathPattern: string;
|
|
498
531
|
actionRecipe: {
|
|
499
|
-
type: "
|
|
532
|
+
type: "assert" | "interact" | "navigate";
|
|
500
533
|
summary: string;
|
|
501
|
-
payload: Record<string, unknown>;
|
|
502
534
|
selector?: string | undefined;
|
|
535
|
+
payload: Record<string, unknown>;
|
|
503
536
|
}[];
|
|
504
537
|
expectedOutcome: string;
|
|
505
538
|
confidence: number;
|
|
506
539
|
successCount: number;
|
|
507
540
|
failureCount: number;
|
|
508
541
|
useCount: number;
|
|
509
|
-
freshness: "fresh" | "
|
|
542
|
+
freshness: "fresh" | "stale" | "suspect";
|
|
510
543
|
staleStrikeCount: number;
|
|
511
544
|
lastVerifiedAt: string;
|
|
512
545
|
createdAt: string;
|
|
513
546
|
updatedAt: string;
|
|
547
|
+
supersedes?: string | undefined;
|
|
514
548
|
evidence: {
|
|
515
549
|
evidenceId: string;
|
|
516
550
|
commandId: string;
|
|
517
|
-
result: "
|
|
518
|
-
recordedAt: string;
|
|
551
|
+
result: "failure" | "success";
|
|
519
552
|
reason?: string | undefined;
|
|
520
553
|
selector?: string | undefined;
|
|
521
554
|
url?: string | undefined;
|
|
555
|
+
recordedAt: string;
|
|
522
556
|
}[];
|
|
523
557
|
selectorAliases: {
|
|
524
558
|
alias: string;
|
|
525
559
|
selector: string;
|
|
526
560
|
fallbackSelectors: string[];
|
|
527
561
|
}[];
|
|
528
|
-
supersedes?: string | undefined;
|
|
529
562
|
};
|
|
530
563
|
verifyMemory(insightId: string): {
|
|
531
564
|
insightId: string;
|
|
@@ -533,36 +566,36 @@ declare class SessionManager {
|
|
|
533
566
|
siteDomain: string;
|
|
534
567
|
sitePathPattern: string;
|
|
535
568
|
actionRecipe: {
|
|
536
|
-
type: "
|
|
569
|
+
type: "assert" | "interact" | "navigate";
|
|
537
570
|
summary: string;
|
|
538
|
-
payload: Record<string, unknown>;
|
|
539
571
|
selector?: string | undefined;
|
|
572
|
+
payload: Record<string, unknown>;
|
|
540
573
|
}[];
|
|
541
574
|
expectedOutcome: string;
|
|
542
575
|
confidence: number;
|
|
543
576
|
successCount: number;
|
|
544
577
|
failureCount: number;
|
|
545
578
|
useCount: number;
|
|
546
|
-
freshness: "fresh" | "
|
|
579
|
+
freshness: "fresh" | "stale" | "suspect";
|
|
547
580
|
staleStrikeCount: number;
|
|
548
581
|
lastVerifiedAt: string;
|
|
549
582
|
createdAt: string;
|
|
550
583
|
updatedAt: string;
|
|
584
|
+
supersedes?: string | undefined;
|
|
551
585
|
evidence: {
|
|
552
586
|
evidenceId: string;
|
|
553
587
|
commandId: string;
|
|
554
|
-
result: "
|
|
555
|
-
recordedAt: string;
|
|
588
|
+
result: "failure" | "success";
|
|
556
589
|
reason?: string | undefined;
|
|
557
590
|
selector?: string | undefined;
|
|
558
591
|
url?: string | undefined;
|
|
592
|
+
recordedAt: string;
|
|
559
593
|
}[];
|
|
560
594
|
selectorAliases: {
|
|
561
595
|
alias: string;
|
|
562
596
|
selector: string;
|
|
563
597
|
fallbackSelectors: string[];
|
|
564
598
|
}[];
|
|
565
|
-
supersedes?: string | undefined;
|
|
566
599
|
};
|
|
567
600
|
memoryStats(): {
|
|
568
601
|
total: number;
|
|
@@ -584,8 +617,6 @@ declare class SessionManager {
|
|
|
584
617
|
private buildMemoryContext;
|
|
585
618
|
private parseUrl;
|
|
586
619
|
}
|
|
587
|
-
//#endregion
|
|
588
|
-
//#region src/transport/control-api.d.ts
|
|
589
620
|
declare class ControlApi {
|
|
590
621
|
private readonly sessions;
|
|
591
622
|
constructor(sessions: SessionManager);
|
|
@@ -593,19 +624,19 @@ declare class ControlApi {
|
|
|
593
624
|
browser: "chrome";
|
|
594
625
|
}): Promise<{
|
|
595
626
|
sessionId: string;
|
|
596
|
-
status: "
|
|
627
|
+
status: "disconnected" | "failed" | "ready" | "starting" | "terminated";
|
|
597
628
|
browserType: "chrome";
|
|
598
629
|
startedAt: string;
|
|
599
|
-
authTokenRef: string;
|
|
600
630
|
endedAt?: string | undefined;
|
|
631
|
+
authTokenRef: string;
|
|
601
632
|
}>;
|
|
602
633
|
getSession(sessionId: string): {
|
|
603
634
|
sessionId: string;
|
|
604
|
-
status: "
|
|
635
|
+
status: "disconnected" | "failed" | "ready" | "starting" | "terminated";
|
|
605
636
|
browserType: "chrome";
|
|
606
637
|
startedAt: string;
|
|
607
|
-
authTokenRef: string;
|
|
608
638
|
endedAt?: string | undefined;
|
|
639
|
+
authTokenRef: string;
|
|
609
640
|
};
|
|
610
641
|
terminateSession(sessionId: string): Promise<void>;
|
|
611
642
|
executeCommand(sessionId: string, input: {
|
|
@@ -615,7 +646,7 @@ declare class ControlApi {
|
|
|
615
646
|
}): Promise<{
|
|
616
647
|
commandId: string;
|
|
617
648
|
sessionId: string;
|
|
618
|
-
type: "
|
|
649
|
+
type: "interact" | "navigate" | "restart" | "terminate";
|
|
619
650
|
payload: Record<string, unknown>;
|
|
620
651
|
submittedAt: string;
|
|
621
652
|
completedAt?: string | undefined;
|
|
@@ -624,11 +655,11 @@ declare class ControlApi {
|
|
|
624
655
|
}>;
|
|
625
656
|
restartSession(sessionId: string): Promise<{
|
|
626
657
|
sessionId: string;
|
|
627
|
-
status: "
|
|
658
|
+
status: "disconnected" | "failed" | "ready" | "starting" | "terminated";
|
|
628
659
|
browserType: "chrome";
|
|
629
660
|
startedAt: string;
|
|
630
|
-
authTokenRef: string;
|
|
631
661
|
endedAt?: string | undefined;
|
|
662
|
+
authTokenRef: string;
|
|
632
663
|
}>;
|
|
633
664
|
rotateSessionToken(sessionId: string): string;
|
|
634
665
|
getContent(sessionId: string, options: {
|
|
@@ -640,11 +671,21 @@ declare class ControlApi {
|
|
|
640
671
|
dismissCookieBanner(sessionId: string): Promise<DismissCookieBannerResult>;
|
|
641
672
|
screenshot(sessionId: string, options?: ScreenshotOptions): Promise<ScreenshotResult>;
|
|
642
673
|
getCurrentUrl(sessionId: string): Promise<string>;
|
|
674
|
+
getPageState(sessionId: string): Promise<PageState>;
|
|
675
|
+
listTabs(sessionId: string): Promise<(TabInfo & {
|
|
676
|
+
active: boolean;
|
|
677
|
+
})[]>;
|
|
678
|
+
switchTab(sessionId: string, tabId: string): Promise<TabInfo>;
|
|
679
|
+
newTab(sessionId: string): Promise<TabInfo>;
|
|
680
|
+
closeTab(sessionId: string, tabId: string): Promise<{
|
|
681
|
+
closed: string;
|
|
682
|
+
active: TabInfo;
|
|
683
|
+
}>;
|
|
643
684
|
listEvents(sessionId: string, limit?: number): {
|
|
644
685
|
events: {
|
|
645
686
|
eventId: string;
|
|
646
687
|
sessionId: string;
|
|
647
|
-
category: "
|
|
688
|
+
category: "command" | "lifecycle" | "security";
|
|
648
689
|
message: string;
|
|
649
690
|
createdAt: string;
|
|
650
691
|
severity: "error" | "info" | "warning";
|
|
@@ -663,36 +704,36 @@ declare class ControlApi {
|
|
|
663
704
|
siteDomain: string;
|
|
664
705
|
sitePathPattern: string;
|
|
665
706
|
actionRecipe: {
|
|
666
|
-
type: "
|
|
707
|
+
type: "assert" | "interact" | "navigate";
|
|
667
708
|
summary: string;
|
|
668
|
-
payload: Record<string, unknown>;
|
|
669
709
|
selector?: string | undefined;
|
|
710
|
+
payload: Record<string, unknown>;
|
|
670
711
|
}[];
|
|
671
712
|
expectedOutcome: string;
|
|
672
713
|
confidence: number;
|
|
673
714
|
successCount: number;
|
|
674
715
|
failureCount: number;
|
|
675
716
|
useCount: number;
|
|
676
|
-
freshness: "fresh" | "
|
|
717
|
+
freshness: "fresh" | "stale" | "suspect";
|
|
677
718
|
staleStrikeCount: number;
|
|
678
719
|
lastVerifiedAt: string;
|
|
679
720
|
createdAt: string;
|
|
680
721
|
updatedAt: string;
|
|
722
|
+
supersedes?: string | undefined;
|
|
681
723
|
evidence: {
|
|
682
724
|
evidenceId: string;
|
|
683
725
|
commandId: string;
|
|
684
|
-
result: "
|
|
685
|
-
recordedAt: string;
|
|
726
|
+
result: "failure" | "success";
|
|
686
727
|
reason?: string | undefined;
|
|
687
728
|
selector?: string | undefined;
|
|
688
729
|
url?: string | undefined;
|
|
730
|
+
recordedAt: string;
|
|
689
731
|
}[];
|
|
690
732
|
selectorAliases: {
|
|
691
733
|
alias: string;
|
|
692
734
|
selector: string;
|
|
693
735
|
fallbackSelectors: string[];
|
|
694
736
|
}[];
|
|
695
|
-
supersedes?: string | undefined;
|
|
696
737
|
};
|
|
697
738
|
verifyMemory(insightId: string): {
|
|
698
739
|
insightId: string;
|
|
@@ -700,36 +741,36 @@ declare class ControlApi {
|
|
|
700
741
|
siteDomain: string;
|
|
701
742
|
sitePathPattern: string;
|
|
702
743
|
actionRecipe: {
|
|
703
|
-
type: "
|
|
744
|
+
type: "assert" | "interact" | "navigate";
|
|
704
745
|
summary: string;
|
|
705
|
-
payload: Record<string, unknown>;
|
|
706
746
|
selector?: string | undefined;
|
|
747
|
+
payload: Record<string, unknown>;
|
|
707
748
|
}[];
|
|
708
749
|
expectedOutcome: string;
|
|
709
750
|
confidence: number;
|
|
710
751
|
successCount: number;
|
|
711
752
|
failureCount: number;
|
|
712
753
|
useCount: number;
|
|
713
|
-
freshness: "fresh" | "
|
|
754
|
+
freshness: "fresh" | "stale" | "suspect";
|
|
714
755
|
staleStrikeCount: number;
|
|
715
756
|
lastVerifiedAt: string;
|
|
716
757
|
createdAt: string;
|
|
717
758
|
updatedAt: string;
|
|
759
|
+
supersedes?: string | undefined;
|
|
718
760
|
evidence: {
|
|
719
761
|
evidenceId: string;
|
|
720
762
|
commandId: string;
|
|
721
|
-
result: "
|
|
722
|
-
recordedAt: string;
|
|
763
|
+
result: "failure" | "success";
|
|
723
764
|
reason?: string | undefined;
|
|
724
765
|
selector?: string | undefined;
|
|
725
766
|
url?: string | undefined;
|
|
767
|
+
recordedAt: string;
|
|
726
768
|
}[];
|
|
727
769
|
selectorAliases: {
|
|
728
770
|
alias: string;
|
|
729
771
|
selector: string;
|
|
730
772
|
fallbackSelectors: string[];
|
|
731
773
|
}[];
|
|
732
|
-
supersedes?: string | undefined;
|
|
733
774
|
};
|
|
734
775
|
memoryStats(): {
|
|
735
776
|
total: number;
|
|
@@ -746,8 +787,6 @@ declare class ControlApi {
|
|
|
746
787
|
dryRun?: boolean;
|
|
747
788
|
}): CleanupResult;
|
|
748
789
|
}
|
|
749
|
-
//#endregion
|
|
750
|
-
//#region src/cli/runtime.d.ts
|
|
751
790
|
interface AgenticBrowserCoreOptions {
|
|
752
791
|
env?: NodeJS.ProcessEnv;
|
|
753
792
|
browserController?: BrowserController;
|
|
@@ -758,33 +797,41 @@ interface ExecuteCommandInput {
|
|
|
758
797
|
type: CommandType;
|
|
759
798
|
payload: Record<string, unknown>;
|
|
760
799
|
}
|
|
761
|
-
declare class AgenticBrowserCore {
|
|
800
|
+
export declare class AgenticBrowserCore {
|
|
762
801
|
readonly context: AppContext;
|
|
763
802
|
readonly sessions: SessionManager;
|
|
764
803
|
readonly api: ControlApi;
|
|
804
|
+
private readonly browserController;
|
|
805
|
+
private disposed;
|
|
765
806
|
constructor(context: AppContext, browserController: BrowserController);
|
|
807
|
+
/**
|
|
808
|
+
* Release process-level resources (event store and memory store exit handlers,
|
|
809
|
+
* controller timers). Flushes pending memory writes.
|
|
810
|
+
* Does not terminate browser sessions. Idempotent.
|
|
811
|
+
*/
|
|
812
|
+
dispose(): Promise<void>;
|
|
766
813
|
startSession(input?: {
|
|
767
814
|
browser: "chrome";
|
|
768
815
|
}): Promise<{
|
|
769
816
|
sessionId: string;
|
|
770
|
-
status: "
|
|
817
|
+
status: "disconnected" | "failed" | "ready" | "starting" | "terminated";
|
|
771
818
|
browserType: "chrome";
|
|
772
819
|
startedAt: string;
|
|
773
|
-
authTokenRef: string;
|
|
774
820
|
endedAt?: string | undefined;
|
|
821
|
+
authTokenRef: string;
|
|
775
822
|
}>;
|
|
776
823
|
getSession(sessionId: string): {
|
|
777
824
|
sessionId: string;
|
|
778
|
-
status: "
|
|
825
|
+
status: "disconnected" | "failed" | "ready" | "starting" | "terminated";
|
|
779
826
|
browserType: "chrome";
|
|
780
827
|
startedAt: string;
|
|
781
|
-
authTokenRef: string;
|
|
782
828
|
endedAt?: string | undefined;
|
|
829
|
+
authTokenRef: string;
|
|
783
830
|
};
|
|
784
831
|
runCommand(input: ExecuteCommandInput): Promise<{
|
|
785
832
|
commandId: string;
|
|
786
833
|
sessionId: string;
|
|
787
|
-
type: "
|
|
834
|
+
type: "interact" | "navigate" | "restart" | "terminate";
|
|
788
835
|
payload: Record<string, unknown>;
|
|
789
836
|
submittedAt: string;
|
|
790
837
|
completedAt?: string | undefined;
|
|
@@ -803,17 +850,30 @@ declare class AgenticBrowserCore {
|
|
|
803
850
|
visibleOnly?: boolean;
|
|
804
851
|
limit?: number;
|
|
805
852
|
selector?: string;
|
|
853
|
+
href?: string;
|
|
854
|
+
text?: string;
|
|
855
|
+
frame?: string;
|
|
806
856
|
}): Promise<InteractiveElementsResult>;
|
|
807
857
|
dismissCookieBanner(sessionId: string): Promise<DismissCookieBannerResult>;
|
|
808
858
|
screenshot(sessionId: string, options?: ScreenshotOptions): Promise<ScreenshotResult>;
|
|
809
859
|
getCurrentUrl(sessionId: string): Promise<string>;
|
|
860
|
+
getPageState(sessionId: string): Promise<PageState>;
|
|
861
|
+
listTabs(sessionId: string): Promise<(TabInfo & {
|
|
862
|
+
active: boolean;
|
|
863
|
+
})[]>;
|
|
864
|
+
switchTab(sessionId: string, tabId: string): Promise<TabInfo>;
|
|
865
|
+
newTab(sessionId: string): Promise<TabInfo>;
|
|
866
|
+
closeTab(sessionId: string, tabId: string): Promise<{
|
|
867
|
+
closed: string;
|
|
868
|
+
active: TabInfo;
|
|
869
|
+
}>;
|
|
810
870
|
restartSession(sessionId: string): Promise<{
|
|
811
871
|
sessionId: string;
|
|
812
|
-
status: "
|
|
872
|
+
status: "disconnected" | "failed" | "ready" | "starting" | "terminated";
|
|
813
873
|
browserType: "chrome";
|
|
814
874
|
startedAt: string;
|
|
815
|
-
authTokenRef: string;
|
|
816
875
|
endedAt?: string | undefined;
|
|
876
|
+
authTokenRef: string;
|
|
817
877
|
}>;
|
|
818
878
|
stopSession(sessionId: string): Promise<void>;
|
|
819
879
|
rotateSessionToken(sessionId: string): string;
|
|
@@ -830,36 +890,36 @@ declare class AgenticBrowserCore {
|
|
|
830
890
|
siteDomain: string;
|
|
831
891
|
sitePathPattern: string;
|
|
832
892
|
actionRecipe: {
|
|
833
|
-
type: "
|
|
893
|
+
type: "assert" | "interact" | "navigate";
|
|
834
894
|
summary: string;
|
|
835
|
-
payload: Record<string, unknown>;
|
|
836
895
|
selector?: string | undefined;
|
|
896
|
+
payload: Record<string, unknown>;
|
|
837
897
|
}[];
|
|
838
898
|
expectedOutcome: string;
|
|
839
899
|
confidence: number;
|
|
840
900
|
successCount: number;
|
|
841
901
|
failureCount: number;
|
|
842
902
|
useCount: number;
|
|
843
|
-
freshness: "fresh" | "
|
|
903
|
+
freshness: "fresh" | "stale" | "suspect";
|
|
844
904
|
staleStrikeCount: number;
|
|
845
905
|
lastVerifiedAt: string;
|
|
846
906
|
createdAt: string;
|
|
847
907
|
updatedAt: string;
|
|
908
|
+
supersedes?: string | undefined;
|
|
848
909
|
evidence: {
|
|
849
910
|
evidenceId: string;
|
|
850
911
|
commandId: string;
|
|
851
|
-
result: "
|
|
852
|
-
recordedAt: string;
|
|
912
|
+
result: "failure" | "success";
|
|
853
913
|
reason?: string | undefined;
|
|
854
914
|
selector?: string | undefined;
|
|
855
915
|
url?: string | undefined;
|
|
916
|
+
recordedAt: string;
|
|
856
917
|
}[];
|
|
857
918
|
selectorAliases: {
|
|
858
919
|
alias: string;
|
|
859
920
|
selector: string;
|
|
860
921
|
fallbackSelectors: string[];
|
|
861
922
|
}[];
|
|
862
|
-
supersedes?: string | undefined;
|
|
863
923
|
};
|
|
864
924
|
verifyMemory(insightId: string): {
|
|
865
925
|
insightId: string;
|
|
@@ -867,36 +927,36 @@ declare class AgenticBrowserCore {
|
|
|
867
927
|
siteDomain: string;
|
|
868
928
|
sitePathPattern: string;
|
|
869
929
|
actionRecipe: {
|
|
870
|
-
type: "
|
|
930
|
+
type: "assert" | "interact" | "navigate";
|
|
871
931
|
summary: string;
|
|
872
|
-
payload: Record<string, unknown>;
|
|
873
932
|
selector?: string | undefined;
|
|
933
|
+
payload: Record<string, unknown>;
|
|
874
934
|
}[];
|
|
875
935
|
expectedOutcome: string;
|
|
876
936
|
confidence: number;
|
|
877
937
|
successCount: number;
|
|
878
938
|
failureCount: number;
|
|
879
939
|
useCount: number;
|
|
880
|
-
freshness: "fresh" | "
|
|
940
|
+
freshness: "fresh" | "stale" | "suspect";
|
|
881
941
|
staleStrikeCount: number;
|
|
882
942
|
lastVerifiedAt: string;
|
|
883
943
|
createdAt: string;
|
|
884
944
|
updatedAt: string;
|
|
945
|
+
supersedes?: string | undefined;
|
|
885
946
|
evidence: {
|
|
886
947
|
evidenceId: string;
|
|
887
948
|
commandId: string;
|
|
888
|
-
result: "
|
|
889
|
-
recordedAt: string;
|
|
949
|
+
result: "failure" | "success";
|
|
890
950
|
reason?: string | undefined;
|
|
891
951
|
selector?: string | undefined;
|
|
892
952
|
url?: string | undefined;
|
|
953
|
+
recordedAt: string;
|
|
893
954
|
}[];
|
|
894
955
|
selectorAliases: {
|
|
895
956
|
alias: string;
|
|
896
957
|
selector: string;
|
|
897
958
|
fallbackSelectors: string[];
|
|
898
959
|
}[];
|
|
899
|
-
supersedes?: string | undefined;
|
|
900
960
|
};
|
|
901
961
|
memoryStats(): {
|
|
902
962
|
total: number;
|
|
@@ -909,7 +969,6 @@ declare class AgenticBrowserCore {
|
|
|
909
969
|
}>;
|
|
910
970
|
};
|
|
911
971
|
}
|
|
912
|
-
declare function createAgenticBrowserCore(options?: AgenticBrowserCoreOptions): AgenticBrowserCore;
|
|
913
|
-
declare function createMockAgenticBrowserCore(env: NodeJS.ProcessEnv): AgenticBrowserCore;
|
|
914
|
-
|
|
915
|
-
export { AgenticBrowserCore, type AgenticBrowserCoreOptions, type DismissCookieBannerResult, type ElementAction, type ErrorCode, type ExecuteCommandInput, type InteractiveElement, type InteractiveElementRole, type InteractiveElementsOptions, type InteractiveElementsResult, type LaunchOptions, type ScreenshotOptions, type ScreenshotResult, createAgenticBrowserCore, createMockAgenticBrowserCore };
|
|
972
|
+
export declare function createAgenticBrowserCore(options?: AgenticBrowserCoreOptions): AgenticBrowserCore;
|
|
973
|
+
export declare function createMockAgenticBrowserCore(env: NodeJS.ProcessEnv): AgenticBrowserCore;
|
|
974
|
+
export type { AgenticBrowserCoreOptions, DismissCookieBannerResult, ElementAction, ErrorCode, ExecuteCommandInput, InteractiveElement, InteractiveElementRole, InteractiveElementsOptions, InteractiveElementsResult, LaunchOptions, ScreenshotOptions, ScreenshotResult };
|