@athenaintel/react 0.10.32 → 0.10.34

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/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { AssistantRuntime } from '@assistant-ui/react';
2
+ import { CaptureOptions } from 'posthog-js';
3
+ import { CaptureResult } from 'posthog-js';
2
4
  import { ClassProp } from 'class-variance-authority/types';
3
- import { ClassValue } from 'clsx';
5
+ import { cn } from 'cnfast';
4
6
  import { Collapsible as Collapsible_2 } from 'radix-ui';
5
7
  import { ComponentProps } from 'react';
6
8
  import { ComponentPropsWithRef } from 'react';
@@ -13,6 +15,8 @@ import { JSXElementConstructor } from 'react';
13
15
  import { LangChainMessage } from '@assistant-ui/react-langgraph';
14
16
  import { MessagePrimitive } from '@assistant-ui/react';
15
17
  import { PersistOptions } from 'zustand/middleware';
18
+ import { PostHog } from 'posthog-js';
19
+ import { Properties } from 'posthog-js';
16
20
  import * as React_2 from 'react';
17
21
  import { ReactElement } from 'react';
18
22
  import { ReactNode } from 'react';
@@ -593,6 +597,8 @@ export declare const autoCloseInFlightSubgraphMessages: (msgs: readonly unknown[
593
597
 
594
598
  export declare const BrowseToolUI: ToolCallMessagePartComponent;
595
599
 
600
+ export declare function buildCoalescedCaptureProperties(payload: CoalescedCapturePayload): Properties;
601
+
596
602
  export declare function Button({ className, variant, size, asChild, ...props }: React_2.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
597
603
  asChild?: boolean;
598
604
  }): JSX.Element;
@@ -602,9 +608,61 @@ export declare const buttonVariants: (props?: ({
602
608
  size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
603
609
  } & ClassProp) | undefined) => string;
604
610
 
611
+ declare interface CaptureGateConfig {
612
+ globalMaxPerWindow: number;
613
+ globalWindowMs: number;
614
+ criticalReservePerWindow: number;
615
+ defaultEventMaxPerWindow: number;
616
+ defaultEventWindowMs: number;
617
+ defaultDedupeWindowMs: number;
618
+ /** Flush coalesced buckets on this interval (ms). */
619
+ flushIntervalMs: number;
620
+ /** Flush a bucket early once it reaches this many suppressed occurrences. */
621
+ flushCoalesceThreshold: number;
622
+ eventOverrides: Record<string, CaptureGateEventOverride>;
623
+ }
624
+
625
+ declare interface CaptureGateEventOverride {
626
+ maxPerWindow: number;
627
+ windowMs: number;
628
+ dedupeWindowMs?: number;
629
+ }
630
+
631
+ declare type CaptureGateOutcome = {
632
+ action: 'emit';
633
+ } | {
634
+ action: 'coalesce';
635
+ reason: CaptureGateSuppressReason;
636
+ bucketKey: string;
637
+ };
638
+
639
+ export declare interface CaptureGateSnapshot {
640
+ coalescedPending: number;
641
+ coalescedPendingByEvent: Record<string, number>;
642
+ emittedTotal: number;
643
+ coalescedTotal: number;
644
+ flushedCoalescedTotal: number;
645
+ }
646
+
647
+ declare type CaptureGateSuppressReason = 'global_budget' | 'event_budget' | 'dedupe';
648
+
649
+ export declare function capturePosthogEvent(client: PosthogCaptureClient | null | undefined, event: string, properties?: Properties, options?: CaptureOptions): void;
650
+
651
+ export declare function capturePosthogException(client: PosthogCaptureClient | null | undefined, error: Error, properties?: Properties, options?: CaptureOptions): void;
652
+
605
653
  export declare function clearAutoOpenedAssets(): void;
606
654
 
607
- export declare function cn(...inputs: ClassValue[]): string;
655
+ export { cn }
656
+
657
+ export declare interface CoalescedCapturePayload {
658
+ bucketKey: string;
659
+ event: string;
660
+ properties: Properties;
661
+ coalescedCount: number;
662
+ firstAt: number;
663
+ lastAt: number;
664
+ suppressionReason: CaptureGateSuppressReason;
665
+ }
608
666
 
609
667
  export declare function Collapsible({ ...props }: React.ComponentProps<typeof Collapsible_2.Root>): JSX.Element;
610
668
 
@@ -719,6 +777,8 @@ export declare function getAssetInfo(assetId: string): {
719
777
 
720
778
  export declare const GetDatabaseTableSchemaToolUI: ToolCallMessagePartComponent;
721
779
 
780
+ export declare function getPosthogCaptureGate(): PosthogCaptureGate;
781
+
722
782
  export declare function getPostHogInstance<TClient = unknown>(): TClient | null;
723
783
 
724
784
  /**
@@ -734,6 +794,8 @@ export declare const isAthenaCitationUrl: ({ href, appUrl, }: {
734
794
  appUrl?: string | null;
735
795
  }) => boolean;
736
796
 
797
+ export declare function isCriticalPosthogEvent(event: string): boolean;
798
+
737
799
  /** Item cache: deduplicates items by ID, tracks scope membership */
738
800
  declare interface ItemCache {
739
801
  items: Map<string, MenuItem>;
@@ -793,6 +855,8 @@ export declare function normalizeResult(result: unknown): Record<string, unknown
793
855
 
794
856
  export declare const OpenAssetToolUI: ToolCallMessagePartComponent;
795
857
 
858
+ export declare const OpenBrowserToolUI: ToolCallMessagePartComponent;
859
+
796
860
  declare interface ParentBridgeOptions {
797
861
  /**
798
862
  * Exact parent origins that are allowed to send auth/config via postMessage.
@@ -828,6 +892,34 @@ export declare interface ParsedAthenaCitationLink {
828
892
 
829
893
  declare type PartsComponents = ComponentProps<typeof MessagePrimitive.Parts>["components"];
830
894
 
895
+ declare type PosthogCaptureClient = Pick<PostHog, 'capture'> & {
896
+ captureException?: (error: unknown, additionalProperties?: Properties) => CaptureResult | undefined;
897
+ };
898
+
899
+ declare class PosthogCaptureGate {
900
+ private readonly config;
901
+ private readonly globalWindow;
902
+ private readonly eventWindows;
903
+ private readonly activeDedupe;
904
+ private readonly coalesceBuckets;
905
+ private emittedTotal;
906
+ private coalescedTotal;
907
+ private flushedCoalescedTotal;
908
+ constructor(config?: CaptureGateConfig);
909
+ resetForTests(): void;
910
+ getSnapshot(): CaptureGateSnapshot;
911
+ evaluateCapture(event: string, properties?: Properties, options?: CaptureOptions, now?: number): CaptureGateOutcome;
912
+ /** Returns payloads ready to flush (does not mutate buckets until caller confirms). */
913
+ collectFlushCandidates(now?: number): CoalescedCapturePayload[];
914
+ /** Remove flushed bucket keys after successful emit. */
915
+ acknowledgeFlushed(payloads: CoalescedCapturePayload[]): void;
916
+ /** After coalescing, flush immediately if the bucket crossed the early threshold. */
917
+ takeBucketIfReady(bucketKey: string, now?: number): CoalescedCapturePayload | null;
918
+ /** Force-flush every pending bucket (e.g. page hide). */
919
+ collectAllPending(): CoalescedCapturePayload[];
920
+ private recordCoalesce;
921
+ }
922
+
831
923
  export declare interface PostHogConfig {
832
924
  /** PostHog API key. When falsy, PostHog is disabled and the provider is a no-op. */
833
925
  apiKey?: string;
@@ -1164,6 +1256,8 @@ export declare const Toolkits: {
1164
1256
  readonly WEB_SEARCH: "web_search_browse_toolkit";
1165
1257
  /** SQL query execution. */
1166
1258
  readonly SQL: "sql_toolkit";
1259
+ /** Azure Blob Storage catalog file operations. */
1260
+ readonly AZURE_BLOB_STORAGE: "azure_blob_storage_toolkit";
1167
1261
  /** Document comments and collaboration. */
1168
1262
  readonly COMMENTS: "comments_toolkit";
1169
1263
  /** Visual canvas creation. */
@@ -1444,4 +1538,8 @@ export declare interface WelcomeSuggestion {
1444
1538
  prompt: string;
1445
1539
  }
1446
1540
 
1541
+ export declare function withCaptureGateBypass(options?: CaptureOptions): CaptureOptions;
1542
+
1543
+ export declare function wrapPosthogClient<TClient extends PosthogCaptureClient>(client: TClient): TClient;
1544
+
1447
1545
  export { }