@alxxsck/ai-assistant 2.2.0 → 2.4.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.
@@ -0,0 +1,35 @@
1
+ import type { AppApi } from "@/App";
2
+ import type { WidgetConfig } from "@/index.types";
3
+ export type TelegramLinkChallenge = {
4
+ id: string;
5
+ expiresAt: string;
6
+ botUsername: string;
7
+ deepLink: string;
8
+ manualCommand: string;
9
+ };
10
+ export type TelegramLinkState = {
11
+ linked: boolean;
12
+ status: "ACTIVE" | "BLOCKED" | "REVOKED" | null;
13
+ challengeStatus: "OPEN" | "PENDING_CONFIRMATION" | "CONFIRMED" | "EXPIRED" | "REVOKED" | null;
14
+ pendingChallengeId: string | null;
15
+ activeLink: {
16
+ status: "ACTIVE" | "BLOCKED" | "REVOKED";
17
+ telegramDisplayName: string;
18
+ telegramUsername: string | null;
19
+ } | null;
20
+ pendingCandidate: {
21
+ challengeId: string;
22
+ status: "PENDING_CONFIRMATION";
23
+ telegramDisplayName: string;
24
+ telegramUsername: string | null;
25
+ expiresAt: string | null;
26
+ } | null;
27
+ };
28
+ export declare class TelegramLinkApiError extends Error {
29
+ readonly status: number;
30
+ constructor(status: number, message: string);
31
+ }
32
+ export declare const createTelegramLinkChallenge: (config: WidgetConfig, api: AppApi, commandId: string) => Promise<TelegramLinkChallenge>;
33
+ export declare const getTelegramLinkChallenge: (config: WidgetConfig, api: AppApi, challengeId: string) => Promise<TelegramLinkState>;
34
+ export declare const confirmTelegramLink: (config: WidgetConfig, api: AppApi, challengeId: string) => Promise<TelegramLinkState>;
35
+ export declare const cancelTelegramLinkChallenge: (config: WidgetConfig, api: AppApi, challengeId: string) => Promise<void>;
@@ -1,5 +1,6 @@
1
1
  export type VoiceSessionStatus = "CREATED" | "CONNECTING" | "ACTIVE" | "ENDED" | "FAILED" | "EXPIRED";
2
2
  export type VoiceWebsocketContract = {
3
+ path: string;
3
4
  namespace: "/assistant";
4
5
  connectEvent: "voice.connect";
5
6
  audioAppendEvent: "voice.audio.append";
@@ -1,4 +1,4 @@
1
- import { D as t, E as e, F as s } from "./index-Dt2DYOP-.js";
1
+ import { D as t, E as e, F as s } from "./index-DCcf0hUc.js";
2
2
  export {
3
3
  t as ChatWidgetInstance,
4
4
  e as EXTERNALLY_AVAILABLE_ACTIONS,
@@ -21,6 +21,12 @@ type ChatWidgetContextValue = {
21
21
  setLoadingProgress: (p: number) => void;
22
22
  assistantRef: React.RefObject<Avatar | null>;
23
23
  cta: CtaCommandContext | null;
24
+ ctaBusy: boolean;
25
+ ctaButtonLabel: string | null;
26
+ ctaFeedback: string | null;
27
+ ctaTelegramBotUsername: string | null;
28
+ ctaTelegramDeepLink: string | null;
29
+ ctaManualCommand: string | null;
24
30
  executeCta: () => Promise<void>;
25
31
  dismissCta: () => void;
26
32
  };
@@ -6,6 +6,7 @@ type InternalHandlers = {
6
6
  setChatOpen?: (open: boolean) => void;
7
7
  playAnimation?: (animation: string, expiresAt?: string | null) => void | Promise<void>;
8
8
  showCta?: (context: CtaCommandContext) => void;
9
+ connectTelegram?: (context: CtaCommandContext) => void | Promise<void>;
9
10
  speakText?: (context: SpeakTextCommandContext) => void | Promise<void>;
10
11
  startVoiceConversation?: (context: StartVoiceConversationCommandContext) => void | Promise<void>;
11
12
  };
@@ -29,6 +30,7 @@ export declare class CommandRuntime {
29
30
  private dispatch;
30
31
  private executeHighlight;
31
32
  private executeShowCta;
33
+ private executeConnectTelegram;
32
34
  private requireTarget;
33
35
  private readLipSyncDescriptor;
34
36
  private requireEnvelopeTarget;
@@ -1,5 +1,5 @@
1
1
  import type { StreamingSpeechMimeType } from "@/domain/speech/speech.constants";
2
- export declare const COMMAND_TYPES: readonly ["show_assistant", "hide_assistant", "open_chat", "close_chat", "play_animation", "highlight_element", "remove_highlight", "show_cta", "speak_text", "start_voice_conversation", "open_page", "open_modal"];
2
+ export declare const COMMAND_TYPES: readonly ["show_assistant", "hide_assistant", "open_chat", "close_chat", "play_animation", "highlight_element", "remove_highlight", "show_cta", "connect_telegram", "speak_text", "start_voice_conversation", "open_page", "open_modal"];
3
3
  export type CommandType = (typeof COMMAND_TYPES)[number];
4
4
  export type CommandAckStatus = "received" | "succeeded" | "failed" | "expired" | "unsupported";
5
5
  export type CommandAck = {
@@ -94,7 +94,7 @@ export type HighlightCommandContext = HostCommandContext & {
94
94
  };
95
95
  export type CtaCommandContext = Omit<HostCommandContext, "target"> & {
96
96
  label: string;
97
- action: "none" | "open_modal" | "open_page";
97
+ action: "none" | "open_modal" | "open_page" | "connect_telegram";
98
98
  target?: string;
99
99
  /** Resolved once when SHOW_CTA arrives and reused unchanged after the click. */
100
100
  uiAction?: Readonly<UiCommandActionSnapshot>;