@xpert-ai/chatkit-host-automation 0.3.5 → 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 +127 -1
  2. package/dist/index.js +884 -359
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ 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
6
 
7
7
  export declare const HOST_PAGE_AUTOMATION_TOOL_SCHEMAS: {
8
8
  readonly host_page_snapshot: {
@@ -445,6 +445,42 @@ export declare const HOST_PAGE_AUTOMATION_TOOL_SCHEMAS: {
445
445
  };
446
446
  readonly additionalProperties: false;
447
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
+ };
448
484
  readonly host_page_wait_for: {
449
485
  readonly type: "object";
450
486
  readonly properties: {
@@ -541,6 +577,17 @@ export declare type HostPageAutomationElementSnapshot = {
541
577
  checked?: boolean;
542
578
  visible?: boolean;
543
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
+ }>;
544
591
  rect: {
545
592
  x: number;
546
593
  y: number;
@@ -569,10 +616,12 @@ export declare class HostPageAutomationExecutor {
569
616
  private readonly options;
570
617
  private refs;
571
618
  private nextRef;
619
+ private readableContent?;
572
620
  constructor(options?: HostPageAutomationOptions);
573
621
  execute(name: HostPageAutomationToolName, params?: Record<string, unknown>): Promise<unknown>;
574
622
  snapshot(): HostPageSnapshot;
575
623
  private getRoot;
624
+ private invalidateReadableContent;
576
625
  private getNavigationState;
577
626
  private getFrameState;
578
627
  private snapshotElement;
@@ -580,6 +629,7 @@ export declare class HostPageAutomationExecutor {
580
629
  private createElementSnapshot;
581
630
  private resolveElement;
582
631
  private click;
632
+ private read;
583
633
  private fill;
584
634
  private press;
585
635
  private select;
@@ -629,6 +679,79 @@ declare type HostPageAutomationVisualEffectContext = {
629
679
 
630
680
  declare type HostPageAutomationVisualEffectType = 'click' | 'fill' | 'select' | 'press' | 'scroll' | 'hover' | 'focus' | 'pointer' | 'wait_for' | 'screenshot';
631
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
+
632
755
  export declare type HostPageSnapshot = {
633
756
  url: string;
634
757
  title: string;
@@ -681,6 +804,7 @@ export declare type HostPageSnapshot = {
681
804
  expanded?: boolean;
682
805
  focused?: boolean;
683
806
  }>;
807
+ readableContent?: HostPageReadableContent;
684
808
  elements: HostPageAutomationElementSnapshot[];
685
809
  };
686
810
 
@@ -690,6 +814,8 @@ export declare type JsonSchema = {
690
814
  type?: string | string[];
691
815
  enum?: readonly unknown[];
692
816
  const?: unknown;
817
+ minimum?: number;
818
+ maximum?: number;
693
819
  description?: string;
694
820
  properties?: Record<string, JsonSchema>;
695
821
  required?: readonly string[];