@xpert-ai/chatkit-host-automation 0.3.4 → 0.3.6

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +632 -1
  2. package/dist/index.js +1205 -384
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -2,7 +2,537 @@ import { ClientToolMessageInput } from '../../chatkit/src/index.ts';
2
2
 
3
3
  export declare function createHostPageAutomationClientToolHandler(options?: HostPageAutomationOptions): HostPageAutomationClientToolHandler;
4
4
 
5
- export declare const HOST_PAGE_AUTOMATION_TOOL_NAMES: readonly ["host_page_snapshot", "host_page_click", "host_page_fill", "host_page_press", "host_page_select", "host_page_scroll", "host_page_navigate", "host_page_hover", "host_page_focus", "host_page_pointer", "host_page_screenshot", "host_page_wait_for"];
5
+ export declare const HOST_PAGE_AUTOMATION_TOOL_NAMES: readonly ["host_page_snapshot", "host_page_click", "host_page_fill", "host_page_press", "host_page_select", "host_page_scroll", "host_page_navigate", "host_page_hover", "host_page_focus", "host_page_pointer", "host_page_screenshot", "host_page_read", "host_page_wait_for"];
6
+
7
+ export declare const HOST_PAGE_AUTOMATION_TOOL_SCHEMAS: {
8
+ readonly host_page_snapshot: {
9
+ readonly type: "object";
10
+ readonly properties: {};
11
+ readonly additionalProperties: false;
12
+ };
13
+ readonly host_page_click: {
14
+ readonly type: "object";
15
+ readonly properties: {
16
+ readonly ref: {
17
+ type: string[];
18
+ description: string;
19
+ };
20
+ readonly axRef: {
21
+ type: string[];
22
+ description: string;
23
+ };
24
+ readonly selector: {
25
+ type: string;
26
+ description: string;
27
+ };
28
+ readonly testId: {
29
+ type: string;
30
+ description: string;
31
+ };
32
+ readonly role: {
33
+ type: string;
34
+ description: string;
35
+ };
36
+ readonly name: {
37
+ type: string;
38
+ description: string;
39
+ };
40
+ readonly text: {
41
+ type: string;
42
+ description: string;
43
+ };
44
+ readonly x: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ readonly y: {
49
+ type: string;
50
+ description: string;
51
+ };
52
+ };
53
+ readonly additionalProperties: false;
54
+ };
55
+ readonly host_page_fill: {
56
+ readonly type: "object";
57
+ readonly properties: {
58
+ readonly value: {
59
+ readonly type: "string";
60
+ readonly description: "Text value to set on the target field.";
61
+ };
62
+ readonly ref: {
63
+ type: string[];
64
+ description: string;
65
+ };
66
+ readonly axRef: {
67
+ type: string[];
68
+ description: string;
69
+ };
70
+ readonly selector: {
71
+ type: string;
72
+ description: string;
73
+ };
74
+ readonly testId: {
75
+ type: string;
76
+ description: string;
77
+ };
78
+ readonly role: {
79
+ type: string;
80
+ description: string;
81
+ };
82
+ readonly name: {
83
+ type: string;
84
+ description: string;
85
+ };
86
+ readonly text: {
87
+ type: string;
88
+ description: string;
89
+ };
90
+ readonly x: {
91
+ type: string;
92
+ description: string;
93
+ };
94
+ readonly y: {
95
+ type: string;
96
+ description: string;
97
+ };
98
+ };
99
+ readonly required: readonly ["value"];
100
+ readonly additionalProperties: false;
101
+ };
102
+ readonly host_page_press: {
103
+ readonly type: "object";
104
+ readonly properties: {
105
+ readonly key: {
106
+ readonly type: "string";
107
+ readonly description: "Keyboard key to press.";
108
+ };
109
+ readonly ref: {
110
+ type: string[];
111
+ description: string;
112
+ };
113
+ readonly axRef: {
114
+ type: string[];
115
+ description: string;
116
+ };
117
+ readonly selector: {
118
+ type: string;
119
+ description: string;
120
+ };
121
+ readonly testId: {
122
+ type: string;
123
+ description: string;
124
+ };
125
+ readonly role: {
126
+ type: string;
127
+ description: string;
128
+ };
129
+ readonly name: {
130
+ type: string;
131
+ description: string;
132
+ };
133
+ readonly text: {
134
+ type: string;
135
+ description: string;
136
+ };
137
+ readonly x: {
138
+ type: string;
139
+ description: string;
140
+ };
141
+ readonly y: {
142
+ type: string;
143
+ description: string;
144
+ };
145
+ };
146
+ readonly required: readonly ["key"];
147
+ readonly additionalProperties: false;
148
+ };
149
+ readonly host_page_select: {
150
+ readonly type: "object";
151
+ readonly properties: {
152
+ readonly value: {
153
+ readonly type: ["string", "array"];
154
+ readonly description: "Select option value or values.";
155
+ readonly items: {
156
+ readonly type: "string";
157
+ };
158
+ };
159
+ readonly values: {
160
+ readonly type: ["string", "array"];
161
+ readonly description: "Select option values.";
162
+ readonly items: {
163
+ readonly type: "string";
164
+ };
165
+ };
166
+ readonly ref: {
167
+ type: string[];
168
+ description: string;
169
+ };
170
+ readonly axRef: {
171
+ type: string[];
172
+ description: string;
173
+ };
174
+ readonly selector: {
175
+ type: string;
176
+ description: string;
177
+ };
178
+ readonly testId: {
179
+ type: string;
180
+ description: string;
181
+ };
182
+ readonly role: {
183
+ type: string;
184
+ description: string;
185
+ };
186
+ readonly name: {
187
+ type: string;
188
+ description: string;
189
+ };
190
+ readonly text: {
191
+ type: string;
192
+ description: string;
193
+ };
194
+ readonly x: {
195
+ type: string;
196
+ description: string;
197
+ };
198
+ readonly y: {
199
+ type: string;
200
+ description: string;
201
+ };
202
+ };
203
+ readonly additionalProperties: false;
204
+ };
205
+ readonly host_page_scroll: {
206
+ readonly type: "object";
207
+ readonly properties: {
208
+ readonly deltaX: {
209
+ readonly type: "number";
210
+ readonly description: "Horizontal scroll delta.";
211
+ };
212
+ readonly deltaY: {
213
+ readonly type: "number";
214
+ readonly description: "Vertical scroll delta.";
215
+ };
216
+ readonly ref: {
217
+ type: string[];
218
+ description: string;
219
+ };
220
+ readonly axRef: {
221
+ type: string[];
222
+ description: string;
223
+ };
224
+ readonly selector: {
225
+ type: string;
226
+ description: string;
227
+ };
228
+ readonly testId: {
229
+ type: string;
230
+ description: string;
231
+ };
232
+ readonly role: {
233
+ type: string;
234
+ description: string;
235
+ };
236
+ readonly name: {
237
+ type: string;
238
+ description: string;
239
+ };
240
+ readonly text: {
241
+ type: string;
242
+ description: string;
243
+ };
244
+ readonly x: {
245
+ type: string;
246
+ description: string;
247
+ };
248
+ readonly y: {
249
+ type: string;
250
+ description: string;
251
+ };
252
+ };
253
+ readonly additionalProperties: false;
254
+ };
255
+ readonly host_page_navigate: {
256
+ readonly type: "object";
257
+ readonly properties: {
258
+ readonly url: {
259
+ readonly type: "string";
260
+ readonly description: "HTTP(S) URL to navigate to.";
261
+ };
262
+ };
263
+ readonly required: readonly ["url"];
264
+ readonly additionalProperties: false;
265
+ };
266
+ readonly host_page_hover: {
267
+ readonly type: "object";
268
+ readonly properties: {
269
+ readonly ref: {
270
+ type: string[];
271
+ description: string;
272
+ };
273
+ readonly axRef: {
274
+ type: string[];
275
+ description: string;
276
+ };
277
+ readonly selector: {
278
+ type: string;
279
+ description: string;
280
+ };
281
+ readonly testId: {
282
+ type: string;
283
+ description: string;
284
+ };
285
+ readonly role: {
286
+ type: string;
287
+ description: string;
288
+ };
289
+ readonly name: {
290
+ type: string;
291
+ description: string;
292
+ };
293
+ readonly text: {
294
+ type: string;
295
+ description: string;
296
+ };
297
+ readonly x: {
298
+ type: string;
299
+ description: string;
300
+ };
301
+ readonly y: {
302
+ type: string;
303
+ description: string;
304
+ };
305
+ };
306
+ readonly additionalProperties: false;
307
+ };
308
+ readonly host_page_focus: {
309
+ readonly type: "object";
310
+ readonly properties: {
311
+ readonly ref: {
312
+ type: string[];
313
+ description: string;
314
+ };
315
+ readonly axRef: {
316
+ type: string[];
317
+ description: string;
318
+ };
319
+ readonly selector: {
320
+ type: string;
321
+ description: string;
322
+ };
323
+ readonly testId: {
324
+ type: string;
325
+ description: string;
326
+ };
327
+ readonly role: {
328
+ type: string;
329
+ description: string;
330
+ };
331
+ readonly name: {
332
+ type: string;
333
+ description: string;
334
+ };
335
+ readonly text: {
336
+ type: string;
337
+ description: string;
338
+ };
339
+ readonly x: {
340
+ type: string;
341
+ description: string;
342
+ };
343
+ readonly y: {
344
+ type: string;
345
+ description: string;
346
+ };
347
+ };
348
+ readonly additionalProperties: false;
349
+ };
350
+ readonly host_page_pointer: {
351
+ readonly type: "object";
352
+ readonly properties: {
353
+ readonly action: {
354
+ readonly type: "string";
355
+ readonly enum: readonly ["move", "down", "up", "click"];
356
+ readonly description: "Pointer action. Defaults to click.";
357
+ };
358
+ readonly button: {
359
+ readonly type: ["string", "number"];
360
+ readonly description: "Mouse button.";
361
+ };
362
+ readonly clickCount: {
363
+ readonly type: "number";
364
+ readonly description: "Number of clicks for CDP mouse click.";
365
+ };
366
+ readonly targetText: {
367
+ readonly type: "string";
368
+ readonly description: "Required for explicit coordinate clicks. The actual hit target or near ancestor must contain this text.";
369
+ };
370
+ readonly expectedAfterClick: {
371
+ type: string;
372
+ properties: {
373
+ type: {
374
+ const: string;
375
+ description: string;
376
+ };
377
+ field: {
378
+ type: string;
379
+ description: string;
380
+ };
381
+ value: {
382
+ type: string;
383
+ description: string;
384
+ };
385
+ };
386
+ required: string[];
387
+ additionalProperties: false;
388
+ };
389
+ readonly coordinateSpace: {
390
+ type: string;
391
+ enum: string[];
392
+ description: string;
393
+ };
394
+ readonly ref: {
395
+ type: string[];
396
+ description: string;
397
+ };
398
+ readonly axRef: {
399
+ type: string[];
400
+ description: string;
401
+ };
402
+ readonly selector: {
403
+ type: string;
404
+ description: string;
405
+ };
406
+ readonly testId: {
407
+ type: string;
408
+ description: string;
409
+ };
410
+ readonly role: {
411
+ type: string;
412
+ description: string;
413
+ };
414
+ readonly name: {
415
+ type: string;
416
+ description: string;
417
+ };
418
+ readonly text: {
419
+ type: string;
420
+ description: string;
421
+ };
422
+ readonly x: {
423
+ type: string;
424
+ description: string;
425
+ };
426
+ readonly y: {
427
+ type: string;
428
+ description: string;
429
+ };
430
+ };
431
+ readonly additionalProperties: false;
432
+ };
433
+ readonly host_page_screenshot: {
434
+ readonly type: "object";
435
+ readonly properties: {
436
+ readonly format: {
437
+ readonly type: "string";
438
+ readonly enum: readonly ["jpeg", "png"];
439
+ readonly description: "Screenshot image format.";
440
+ };
441
+ readonly quality: {
442
+ readonly type: "number";
443
+ readonly description: "JPEG quality from 1 to 100.";
444
+ };
445
+ };
446
+ readonly additionalProperties: false;
447
+ };
448
+ readonly host_page_read: {
449
+ readonly type: "object";
450
+ readonly properties: {
451
+ readonly blockId: {
452
+ readonly type: "string";
453
+ readonly description: "Readable content block id from host_page_snapshot.";
454
+ };
455
+ readonly scope: {
456
+ readonly type: "string";
457
+ readonly enum: readonly ["visible"];
458
+ readonly description: "Visible content scope. Use blockId when a specific readable block is known.";
459
+ };
460
+ readonly query: {
461
+ readonly type: "string";
462
+ readonly description: "Optional text query for selecting relevant readable blocks.";
463
+ };
464
+ readonly page: {
465
+ readonly type: "number";
466
+ readonly minimum: 1;
467
+ readonly description: "1-based page for long block content.";
468
+ };
469
+ readonly pageSize: {
470
+ readonly type: "number";
471
+ readonly minimum: 1;
472
+ readonly maximum: 100;
473
+ readonly description: "Items, fields, rows, or blocks to return per page.";
474
+ };
475
+ readonly maxChars: {
476
+ readonly type: "number";
477
+ readonly minimum: 500;
478
+ readonly maximum: 12000;
479
+ readonly description: "Maximum characters to return.";
480
+ };
481
+ };
482
+ readonly additionalProperties: false;
483
+ };
484
+ readonly host_page_wait_for: {
485
+ readonly type: "object";
486
+ readonly properties: {
487
+ readonly state: {
488
+ readonly type: "string";
489
+ readonly enum: readonly ["attached", "visible", "hidden", "detached"];
490
+ readonly description: "Target state to wait for. Defaults to visible.";
491
+ };
492
+ readonly timeoutSeconds: {
493
+ readonly type: "number";
494
+ readonly description: "Maximum wait time in seconds.";
495
+ };
496
+ readonly ref: {
497
+ type: string[];
498
+ description: string;
499
+ };
500
+ readonly axRef: {
501
+ type: string[];
502
+ description: string;
503
+ };
504
+ readonly selector: {
505
+ type: string;
506
+ description: string;
507
+ };
508
+ readonly testId: {
509
+ type: string;
510
+ description: string;
511
+ };
512
+ readonly role: {
513
+ type: string;
514
+ description: string;
515
+ };
516
+ readonly name: {
517
+ type: string;
518
+ description: string;
519
+ };
520
+ readonly text: {
521
+ type: string;
522
+ description: string;
523
+ };
524
+ readonly x: {
525
+ type: string;
526
+ description: string;
527
+ };
528
+ readonly y: {
529
+ type: string;
530
+ description: string;
531
+ };
532
+ };
533
+ readonly additionalProperties: false;
534
+ };
535
+ };
6
536
 
7
537
  declare type HostPageAutomationClickEffectContext = {
8
538
  point: {
@@ -47,6 +577,17 @@ export declare type HostPageAutomationElementSnapshot = {
47
577
  checked?: boolean;
48
578
  visible?: boolean;
49
579
  actionable?: boolean;
580
+ receivesEvents?: boolean;
581
+ occludedBy?: {
582
+ tag: string;
583
+ role?: string;
584
+ name?: string;
585
+ selector?: string;
586
+ };
587
+ safeClickPoints?: Array<{
588
+ x: number;
589
+ y: number;
590
+ }>;
50
591
  rect: {
51
592
  x: number;
52
593
  y: number;
@@ -75,10 +616,12 @@ export declare class HostPageAutomationExecutor {
75
616
  private readonly options;
76
617
  private refs;
77
618
  private nextRef;
619
+ private readableContent?;
78
620
  constructor(options?: HostPageAutomationOptions);
79
621
  execute(name: HostPageAutomationToolName, params?: Record<string, unknown>): Promise<unknown>;
80
622
  snapshot(): HostPageSnapshot;
81
623
  private getRoot;
624
+ private invalidateReadableContent;
82
625
  private getNavigationState;
83
626
  private getFrameState;
84
627
  private snapshotElement;
@@ -86,6 +629,7 @@ export declare class HostPageAutomationExecutor {
86
629
  private createElementSnapshot;
87
630
  private resolveElement;
88
631
  private click;
632
+ private read;
89
633
  private fill;
90
634
  private press;
91
635
  private select;
@@ -135,6 +679,79 @@ declare type HostPageAutomationVisualEffectContext = {
135
679
 
136
680
  declare type HostPageAutomationVisualEffectType = 'click' | 'fill' | 'select' | 'press' | 'scroll' | 'hover' | 'focus' | 'pointer' | 'wait_for' | 'screenshot';
137
681
 
682
+ export declare type HostPageReadableContent = {
683
+ blocks: HostPageReadableContentBlock[];
684
+ outline?: HostPageReadableContentOutlineItem[];
685
+ suggestedReads?: HostPageReadableContentSuggestedRead[];
686
+ totalBlocks: number;
687
+ truncated: boolean;
688
+ coverage: {
689
+ status: 'complete' | 'partial';
690
+ visibleTextCaptured: boolean;
691
+ truncatedBlocks: number;
692
+ collapsedSections: number;
693
+ crossOriginFrames: number;
694
+ virtualizedListsDetected: number;
695
+ visualOnlyRegions: number;
696
+ };
697
+ warnings?: string[];
698
+ };
699
+
700
+ export declare type HostPageReadableContentBlock = {
701
+ blockId: string;
702
+ type: HostPageReadableContentBlockType;
703
+ heading?: string;
704
+ level?: number;
705
+ text?: string;
706
+ items?: string[];
707
+ fields?: Array<{
708
+ name: string;
709
+ value: string;
710
+ }>;
711
+ headers?: string[];
712
+ rows?: string[][];
713
+ preview: string[];
714
+ itemCount: number;
715
+ chars: number;
716
+ truncated: boolean;
717
+ rect?: {
718
+ x: number;
719
+ y: number;
720
+ width: number;
721
+ height: number;
722
+ };
723
+ readHint: {
724
+ tool: 'host_page_read';
725
+ args: {
726
+ blockId: string;
727
+ };
728
+ };
729
+ };
730
+
731
+ declare type HostPageReadableContentBlockType = 'heading' | 'paragraph' | 'list' | 'keyValueList' | 'table';
732
+
733
+ declare type HostPageReadableContentOutlineItem = {
734
+ index: number;
735
+ blockId: string;
736
+ type: HostPageReadableContentBlockType;
737
+ heading?: string;
738
+ level?: number;
739
+ itemCount: number;
740
+ chars: number;
741
+ truncated: boolean;
742
+ };
743
+
744
+ declare type HostPageReadableContentSuggestedRead = {
745
+ blockId: string;
746
+ type: HostPageReadableContentBlockType;
747
+ heading?: string;
748
+ reason: string;
749
+ args: {
750
+ blockId: string;
751
+ pageSize?: number;
752
+ };
753
+ };
754
+
138
755
  export declare type HostPageSnapshot = {
139
756
  url: string;
140
757
  title: string;
@@ -187,9 +804,23 @@ export declare type HostPageSnapshot = {
187
804
  expanded?: boolean;
188
805
  focused?: boolean;
189
806
  }>;
807
+ readableContent?: HostPageReadableContent;
190
808
  elements: HostPageAutomationElementSnapshot[];
191
809
  };
192
810
 
193
811
  export declare function isHostPageAutomationToolName(value: string): value is HostPageAutomationToolName;
194
812
 
813
+ export declare type JsonSchema = {
814
+ type?: string | string[];
815
+ enum?: readonly unknown[];
816
+ const?: unknown;
817
+ minimum?: number;
818
+ maximum?: number;
819
+ description?: string;
820
+ properties?: Record<string, JsonSchema>;
821
+ required?: readonly string[];
822
+ items?: JsonSchema;
823
+ additionalProperties?: boolean | JsonSchema;
824
+ };
825
+
195
826
  export { }