@guideai/react-native 0.7.0 → 0.9.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.
Files changed (37) hide show
  1. package/README.md +20 -1
  2. package/dist/GuideAIChat-BFu10t6D.cjs +2794 -0
  3. package/dist/GuideAIChat-BFu10t6D.cjs.map +1 -0
  4. package/dist/GuideAIChat-BQQ8lUKs.js +2795 -0
  5. package/dist/GuideAIChat-BQQ8lUKs.js.map +1 -0
  6. package/dist/GuideAIChat-Ba6n1ePs.js +2795 -0
  7. package/dist/GuideAIChat-Ba6n1ePs.js.map +1 -0
  8. package/dist/GuideAIChat-CNmEo5bZ.cjs +2794 -0
  9. package/dist/GuideAIChat-CNmEo5bZ.cjs.map +1 -0
  10. package/dist/GuideAIChat-SU0CVNby.js +2795 -0
  11. package/dist/GuideAIChat-SU0CVNby.js.map +1 -0
  12. package/dist/GuideAIChat-W8KQ4Y6i.cjs +2794 -0
  13. package/dist/GuideAIChat-W8KQ4Y6i.cjs.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.ts +91 -6
  16. package/dist/index.mjs +2 -2
  17. package/dist/ui.cjs +2 -2
  18. package/dist/ui.d.ts +11 -5
  19. package/dist/ui.mjs +3 -3
  20. package/dist/useConversations-C-OmzdeA.js +4300 -0
  21. package/dist/useConversations-C-OmzdeA.js.map +1 -0
  22. package/dist/useConversations-CJEaVqch.cjs +4290 -0
  23. package/dist/useConversations-CJEaVqch.cjs.map +1 -0
  24. package/dist/useConversations-Chn_GKOz.cjs +4299 -0
  25. package/dist/useConversations-Chn_GKOz.cjs.map +1 -0
  26. package/dist/useConversations-Ckyqbxqi.cjs +4299 -0
  27. package/dist/useConversations-Ckyqbxqi.cjs.map +1 -0
  28. package/dist/useConversations-DzhYCIiY.js +4300 -0
  29. package/dist/useConversations-DzhYCIiY.js.map +1 -0
  30. package/dist/useConversations-SbhtYN_R.js +4291 -0
  31. package/dist/useConversations-SbhtYN_R.js.map +1 -0
  32. package/dist/voice.cjs +2835 -19
  33. package/dist/voice.cjs.map +1 -1
  34. package/dist/voice.d.ts +12 -6
  35. package/dist/voice.mjs +2836 -20
  36. package/dist/voice.mjs.map +1 -1
  37. package/package.json +6 -2
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const useConversations = require("./useConversations-CTbQBTz-.cjs");
3
+ const useConversations = require("./useConversations-Chn_GKOz.cjs");
4
4
  const jsxRuntime = require("react/jsx-runtime");
5
5
  const React = require("react");
6
6
  function GuideAIScreen({
package/dist/index.d.ts CHANGED
@@ -838,6 +838,46 @@ interface AsyncKeyValueStorage {
838
838
  multiGet(keys: readonly string[]): Promise<ReadonlyArray<readonly [string, string | null]>>;
839
839
  }
840
840
 
841
+ /** One block of mic audio, as react-native-audio-api delivers it. */
842
+ interface PhoneAudioReady {
843
+ buffer: {
844
+ sampleRate: number;
845
+ getChannelData(channel: number): Float32Array;
846
+ };
847
+ numFrames: number;
848
+ }
849
+ type AudioResult = {
850
+ status: 'success';
851
+ } | {
852
+ status: 'error';
853
+ message: string;
854
+ };
855
+ interface PhoneRecorder {
856
+ onAudioReady(options: {
857
+ sampleRate: number;
858
+ bufferLength: number;
859
+ channelCount: number;
860
+ }, callback: (event: PhoneAudioReady) => void): AudioResult | void;
861
+ clearOnAudioReady(): void;
862
+ start(): Promise<AudioResult | unknown>;
863
+ stop(): Promise<unknown>;
864
+ }
865
+ /** What live voice uses of `import * as AudioAPI from 'react-native-audio-api'`. */
866
+ interface GuideAIAudioModule {
867
+ AudioContext: new (options?: {
868
+ sampleRate?: number;
869
+ }) => unknown;
870
+ AudioRecorder: new (options?: {
871
+ iosVoiceProcessing?: boolean;
872
+ androidInputPreset?: string;
873
+ }) => PhoneRecorder;
874
+ AudioManager: {
875
+ requestRecordingPermissions(): Promise<string>;
876
+ setSystemOptions?(options: unknown): void;
877
+ setAudioSessionActivity?(enabled: boolean): Promise<unknown>;
878
+ };
879
+ }
880
+
841
881
  interface GuideAIConversation {
842
882
  id: string;
843
883
  /** The first thing the user asked, shortened. */
@@ -942,6 +982,15 @@ interface GuideAIConfig {
942
982
  * Omitted: captions only.
943
983
  */
944
984
  speech?: GuideAISpeech;
985
+ /**
986
+ * Streaming audio for live voice: `import * as AudioAPI from
987
+ * 'react-native-audio-api'` and pass it here. The call then streams the
988
+ * mic and the answer's voice as the web SDK does — it hears you finish in
989
+ * a fraction of a second, speaks while the answer is still being written,
990
+ * and you can talk over it. Without it, live voice records each turn and
991
+ * uploads it (slower). Needs a development build, not Expo Go.
992
+ */
993
+ audio?: GuideAIAudioModule;
945
994
  /**
946
995
  * Log the full conversation and every request. Development only —
947
996
  * it prints message content to the console.
@@ -1079,6 +1128,11 @@ interface GuideAIVoiceResult {
1079
1128
  * calls, the transport. That split is what lets the agent be upgraded
1080
1129
  * underneath a host's UI without them changing a line.
1081
1130
  */
1131
+ /** How `send` reports the answer while it is being written. */
1132
+ interface GuideAISendOptions {
1133
+ /** Each piece of the answer as it arrives. */
1134
+ onDelta?(delta: string): void;
1135
+ }
1082
1136
  interface UseGuideAIResult {
1083
1137
  /**
1084
1138
  * The conversation so far, oldest first, ready to draw. An answer that
@@ -1112,9 +1166,10 @@ interface UseGuideAIResult {
1112
1166
  * Send `input`, or an explicit string.
1113
1167
  *
1114
1168
  * Ignores empty text and calls made while a turn is in flight, so a
1115
- * host does not have to guard their send button.
1169
+ * host does not have to guard their send button. `onDelta` hears the
1170
+ * answer as it is written (live voice speaks it from there).
1116
1171
  */
1117
- send(question?: string): Promise<string | null>;
1172
+ send(question?: string, options?: GuideAISendOptions): Promise<string | null>;
1118
1173
  /** True from send() until the turn settles. Drives a disabled state. */
1119
1174
  busy: boolean;
1120
1175
  /** Whether `send()` would do anything right now. */
@@ -1125,15 +1180,15 @@ interface UseGuideAIResult {
1125
1180
  retry(): Promise<void>;
1126
1181
  /** Start a new conversation. The current one stays in the chat history (useConversations). */
1127
1182
  clear(): void;
1128
- /** Approve the message's `pendingAction`; the agent carries it out. */
1129
- confirm(messageId: string): Promise<void>;
1183
+ /** Approve the message's `pendingAction`; the agent carries it out. Resolves with its reply. */
1184
+ confirm(messageId: string): Promise<string | null>;
1130
1185
  /** Decline the message's `pendingAction`. Nothing is changed. */
1131
1186
  cancel(messageId: string): void;
1132
1187
  /**
1133
1188
  * Push-to-talk: transcribe a recording and send it as the next message.
1134
1189
  * Recording is the host's (no native module here); this uploads it.
1135
1190
  */
1136
- sendVoice(recording: GuideAIVoiceRecording): Promise<GuideAIVoiceResult>;
1191
+ sendVoice(recording: GuideAIVoiceRecording, options?: GuideAISendOptions): Promise<GuideAIVoiceResult>;
1137
1192
  /** True while a recording is being transcribed. */
1138
1193
  transcribing: boolean;
1139
1194
  }
@@ -1232,6 +1287,36 @@ type BoardItem = {
1232
1287
  } | {
1233
1288
  kind: 'erase';
1234
1289
  erase: string;
1290
+ } | MotionItem;
1291
+ /** Something already drawn, moving: each names its target by id. */
1292
+ type MotionItem =
1293
+ /** Slides so its centre passes through each spot. */
1294
+ {
1295
+ kind: 'move';
1296
+ move: string;
1297
+ path: Point[];
1298
+ }
1299
+ /** Dashes run along a drawn line. */
1300
+ | {
1301
+ kind: 'flow';
1302
+ flow: string;
1303
+ }
1304
+ /** Spins about its centre, in degrees (clockwise is +). */
1305
+ | {
1306
+ kind: 'turn';
1307
+ turn: string;
1308
+ by: number;
1309
+ }
1310
+ /** Swells once and settles. */
1311
+ | {
1312
+ kind: 'pulse';
1313
+ pulse: string;
1314
+ }
1315
+ /** Handwriting whose number counts to *value*. */
1316
+ | {
1317
+ kind: 'count';
1318
+ count: string;
1319
+ value: string;
1235
1320
  };
1236
1321
  interface BoardStep {
1237
1322
  say: string;
@@ -1342,4 +1427,4 @@ declare const whiteboardLayouts: {
1342
1427
  };
1343
1428
 
1344
1429
  export { GuideAI, GuideAIScreen, useConversations, useGuideAI, useGuideAIElement, useOnboarding, useWhiteboard, whiteboardLayouts };
1345
- export type { AsyncKeyValueStorage, AuthTokenGetter, DeclaredElement, ElementHandlers, GuideAIConfig, GuideAIConversation, HeadlessImage as GuideAIImage, GuideAIMessage, GuideAIScreenProps, GuideAISpeech, GuideAIUserProfile, GuideAIVoiceRecording, GuideAIVoiceResult, NavigationRefLike, OnboardingState, OnboardingStepState, RequestHeadersGetter, SyncNativeStore, UseConversationsResult, UseGuideAIElementOptions, UseGuideAIResult, UseWhiteboardResult, WhiteboardState, WhiteboardStatus };
1430
+ export type { AsyncKeyValueStorage, AuthTokenGetter, DeclaredElement, ElementHandlers, GuideAIAudioModule, GuideAIConfig, GuideAIConversation, HeadlessImage as GuideAIImage, GuideAIMessage, GuideAIScreenProps, GuideAISendOptions, GuideAISpeech, GuideAIUserProfile, GuideAIVoiceRecording, GuideAIVoiceResult, NavigationRefLike, OnboardingState, OnboardingStepState, RequestHeadersGetter, SyncNativeStore, UseConversationsResult, UseGuideAIElementOptions, UseGuideAIResult, UseWhiteboardResult, WhiteboardState, WhiteboardStatus };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { u as useGuideAIRuntime, S as ScreenRegistry, R as RegistryContext, a as useScreenRegistry, L as LIMITS } from "./useConversations-B_7km_uH.js";
2
- import { G, b, c, d, e } from "./useConversations-B_7km_uH.js";
1
+ import { u as useGuideAIRuntime, S as ScreenRegistry, R as RegistryContext, a as useScreenRegistry, L as LIMITS } from "./useConversations-C-OmzdeA.js";
2
+ import { G, b, c, d, e } from "./useConversations-C-OmzdeA.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { useMemo, useEffect, useRef } from "react";
5
5
  function GuideAIScreen({
package/dist/ui.cjs CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const reactNative = require("react-native");
6
- const GuideAIChat = require("./GuideAIChat-CxyWFl_o.cjs");
7
- const useConversations = require("./useConversations-CTbQBTz-.cjs");
6
+ const GuideAIChat = require("./GuideAIChat-CNmEo5bZ.cjs");
7
+ const useConversations = require("./useConversations-Chn_GKOz.cjs");
8
8
  const POLL_INTERVAL_MS = 3e3;
9
9
  const CONVERSATION_KEY = "guideai_support_conversation";
10
10
  function useStoredConversation() {
package/dist/ui.d.ts CHANGED
@@ -71,6 +71,11 @@ interface GuideAIVoiceResult {
71
71
  * calls, the transport. That split is what lets the agent be upgraded
72
72
  * underneath a host's UI without them changing a line.
73
73
  */
74
+ /** How `send` reports the answer while it is being written. */
75
+ interface GuideAISendOptions {
76
+ /** Each piece of the answer as it arrives. */
77
+ onDelta?(delta: string): void;
78
+ }
74
79
  interface UseGuideAIResult {
75
80
  /**
76
81
  * The conversation so far, oldest first, ready to draw. An answer that
@@ -104,9 +109,10 @@ interface UseGuideAIResult {
104
109
  * Send `input`, or an explicit string.
105
110
  *
106
111
  * Ignores empty text and calls made while a turn is in flight, so a
107
- * host does not have to guard their send button.
112
+ * host does not have to guard their send button. `onDelta` hears the
113
+ * answer as it is written (live voice speaks it from there).
108
114
  */
109
- send(question?: string): Promise<string | null>;
115
+ send(question?: string, options?: GuideAISendOptions): Promise<string | null>;
110
116
  /** True from send() until the turn settles. Drives a disabled state. */
111
117
  busy: boolean;
112
118
  /** Whether `send()` would do anything right now. */
@@ -117,15 +123,15 @@ interface UseGuideAIResult {
117
123
  retry(): Promise<void>;
118
124
  /** Start a new conversation. The current one stays in the chat history (useConversations). */
119
125
  clear(): void;
120
- /** Approve the message's `pendingAction`; the agent carries it out. */
121
- confirm(messageId: string): Promise<void>;
126
+ /** Approve the message's `pendingAction`; the agent carries it out. Resolves with its reply. */
127
+ confirm(messageId: string): Promise<string | null>;
122
128
  /** Decline the message's `pendingAction`. Nothing is changed. */
123
129
  cancel(messageId: string): void;
124
130
  /**
125
131
  * Push-to-talk: transcribe a recording and send it as the next message.
126
132
  * Recording is the host's (no native module here); this uploads it.
127
133
  */
128
- sendVoice(recording: GuideAIVoiceRecording): Promise<GuideAIVoiceResult>;
134
+ sendVoice(recording: GuideAIVoiceRecording, options?: GuideAISendOptions): Promise<GuideAIVoiceResult>;
129
135
  /** True while a recording is being transcribed. */
130
136
  transcribing: boolean;
131
137
  }
package/dist/ui.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useRef, useEffect, useCallback, useMemo, useContext, createContext } from "react";
3
3
  import { Platform, StatusBar, KeyboardAvoidingView, View, Text, Pressable, ScrollView, TextInput, ActivityIndicator, FlatList, StyleSheet, Dimensions, Animated, PanResponder, Modal, Easing } from "react-native";
4
- import { r as resolveTheme, G as GuideAIChat } from "./GuideAIChat-DOC4zx-a.js";
5
- import { D, a, b, c, d, M, e, l } from "./GuideAIChat-DOC4zx-a.js";
6
- import { r as requireConfigured, E as EP, d as useOnboarding } from "./useConversations-B_7km_uH.js";
4
+ import { r as resolveTheme, G as GuideAIChat } from "./GuideAIChat-SU0CVNby.js";
5
+ import { D, a, b, c, d, M, e, l } from "./GuideAIChat-SU0CVNby.js";
6
+ import { r as requireConfigured, E as EP, d as useOnboarding } from "./useConversations-C-OmzdeA.js";
7
7
  const POLL_INTERVAL_MS = 3e3;
8
8
  const CONVERSATION_KEY = "guideai_support_conversation";
9
9
  function useStoredConversation() {