@adminide-stack/yantra-mobile 12.0.44-alpha.6 → 12.0.44

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 (92) hide show
  1. package/lib/bridge/handlers/NavigationBridgeHandler.js +3 -1
  2. package/lib/bridge/handlers/NavigationBridgeHandler.js.map +1 -1
  3. package/lib/components/CustomDrawer.js +122 -82
  4. package/lib/components/CustomDrawer.js.map +1 -1
  5. package/lib/components/KeyboardComposerDock.js +10 -1
  6. package/lib/components/KeyboardComposerDock.js.map +1 -1
  7. package/lib/components/NavigationHeader/NavigationHeader.js +16 -30
  8. package/lib/components/NavigationHeader/NavigationHeader.js.map +1 -1
  9. package/lib/compute.js +54 -5
  10. package/lib/compute.js.map +1 -1
  11. package/lib/config/env-config.js +13 -0
  12. package/lib/config/env-config.js.map +1 -1
  13. package/lib/features/apps/AppsCatalog.js +200 -0
  14. package/lib/features/apps/AppsCatalog.js.map +1 -0
  15. package/lib/features/apps/mobileAppCatalog.js +1 -0
  16. package/lib/features/apps/mobileAppCatalog.js.map +1 -1
  17. package/lib/features/apps/resolveSurfaceUrl.js +22 -2
  18. package/lib/features/apps/resolveSurfaceUrl.js.map +1 -1
  19. package/lib/features/attachments/ComposerAttachmentBar.js +64 -0
  20. package/lib/features/attachments/ComposerAttachmentBar.js.map +1 -0
  21. package/lib/features/attachments/MessageAttachmentPreviews.js +77 -0
  22. package/lib/features/attachments/MessageAttachmentPreviews.js.map +1 -0
  23. package/lib/features/attachments/attachmentPreviewUri.js +9 -0
  24. package/lib/features/attachments/attachmentPreviewUri.js.map +1 -0
  25. package/lib/features/attachments/buildGatewayMedia.js +118 -0
  26. package/lib/features/attachments/buildGatewayMedia.js.map +1 -0
  27. package/lib/features/attachments/composerAttachmentHandoff.js +15 -0
  28. package/lib/features/attachments/composerAttachmentHandoff.js.map +1 -0
  29. package/lib/features/attachments/displayUserMessageText.js +19 -0
  30. package/lib/features/attachments/displayUserMessageText.js.map +1 -0
  31. package/lib/features/attachments/historyAttachmentLabel.js +51 -0
  32. package/lib/features/attachments/historyAttachmentLabel.js.map +1 -0
  33. package/lib/features/attachments/isImageAttachment.js +7 -0
  34. package/lib/features/attachments/isImageAttachment.js.map +1 -0
  35. package/lib/features/attachments/preserveAttachmentPreviews.js +41 -0
  36. package/lib/features/attachments/preserveAttachmentPreviews.js.map +1 -0
  37. package/lib/features/attachments/uploadChatAttachments.js +102 -0
  38. package/lib/features/attachments/uploadChatAttachments.js.map +1 -0
  39. package/lib/features/attachments/useImageAttachments.js +102 -7
  40. package/lib/features/attachments/useImageAttachments.js.map +1 -1
  41. package/lib/features/canvas/nativeViewerRegistry.js +8 -1
  42. package/lib/features/canvas/nativeViewerRegistry.js.map +1 -1
  43. package/lib/features/canvas/surfaceIndex.js +25 -0
  44. package/lib/features/canvas/surfaceIndex.js.map +1 -0
  45. package/lib/features/canvas/useCanvasSession.js +57 -0
  46. package/lib/features/canvas/useCanvasSession.js.map +1 -0
  47. package/lib/features/chat/ChatTranscript.js +202 -0
  48. package/lib/features/chat/ChatTranscript.js.map +1 -0
  49. package/lib/features/chat/MessageActionBar.js +56 -0
  50. package/lib/features/chat/MessageActionBar.js.map +1 -0
  51. package/lib/hooks/mintSurfaceSystemToken.js +86 -5
  52. package/lib/hooks/mintSurfaceSystemToken.js.map +1 -1
  53. package/lib/hooks/resolveSurfaceAuthGraphqlUrl.js +48 -0
  54. package/lib/hooks/resolveSurfaceAuthGraphqlUrl.js.map +1 -0
  55. package/lib/hooks/useCdecliChannel.js +5 -3
  56. package/lib/hooks/useCdecliChannel.js.map +1 -1
  57. package/lib/hooks/useChatApi.js +32 -15
  58. package/lib/hooks/useChatApi.js.map +1 -1
  59. package/lib/hooks/useChatStream.js +35 -8
  60. package/lib/hooks/useChatStream.js.map +1 -1
  61. package/lib/hooks/useKeyboardBottomOffset.js +22 -2
  62. package/lib/hooks/useKeyboardBottomOffset.js.map +1 -1
  63. package/lib/index.js +1 -1
  64. package/lib/index.js.map +1 -1
  65. package/lib/routes.json +56 -4
  66. package/lib/screens/Apps/index.js +20 -0
  67. package/lib/screens/Apps/index.js.map +1 -0
  68. package/lib/screens/CanvasBoard/index.js +20 -15
  69. package/lib/screens/CanvasBoard/index.js.map +1 -1
  70. package/lib/screens/Chat/index.js +50 -59
  71. package/lib/screens/Chat/index.js.map +1 -1
  72. package/lib/screens/ChatHistory/index.js +2 -8
  73. package/lib/screens/ChatHistory/index.js.map +1 -1
  74. package/lib/screens/Home/HomeScreen.js +57 -21
  75. package/lib/screens/Home/HomeScreen.js.map +1 -1
  76. package/lib/screens/Home/components/ChatHistoryLanding.js +15 -9
  77. package/lib/screens/Home/components/ChatHistoryLanding.js.map +1 -1
  78. package/lib/screens/Home/components/WebBuilderPrewarm.js +2 -2
  79. package/lib/screens/Home/components/WebBuilderPrewarm.js.map +1 -1
  80. package/lib/screens/WebBuilder/index.js +25 -16
  81. package/lib/screens/WebBuilder/index.js.map +1 -1
  82. package/lib/screens/WebBuilder/webbuilderWarmCache.js +19 -10
  83. package/lib/screens/WebBuilder/webbuilderWarmCache.js.map +1 -1
  84. package/lib/utils/navigateToNewChatHome.js +40 -0
  85. package/lib/utils/navigateToNewChatHome.js.map +1 -0
  86. package/package.json +4 -4
  87. package/lib/components/AppsMenu/AppsMenu.js +0 -295
  88. package/lib/components/AppsMenu/AppsMenu.js.map +0 -1
  89. package/lib/components/NavigationHeader/ChatHistoryToggleMobile.js +0 -6
  90. package/lib/components/NavigationHeader/ChatHistoryToggleMobile.js.map +0 -1
  91. package/lib/features/canvas/canvasCore.js +0 -41
  92. package/lib/features/canvas/canvasCore.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import {jsxs,jsx}from'react/jsx-runtime';import {useMemo,useEffect,useState,useRef,useCallback}from'react';import {useColorScheme,useWindowDimensions,Keyboard,TouchableWithoutFeedback,StyleSheet,View}from'react-native';import {getDefaultLeftItems,getDefaultRightItems,Box,Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {MessagesContainerUI}from'@messenger-box/platform-mobile';import {useCdecliConnection}from'../../contexts/CdecliConnectionContext.js';import {useChatStream}from'../../hooks/useChatStream.js';import {useKeyboardBottomOffset}from'../../hooks/useKeyboardBottomOffset.js';import {KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {YantraBrandLoader,YANTRA_LOADER_SIZE_COMPACT}from'../../components/YantraBrandLoader.js';import ThinkingIndicator from'../../components/ThinkingIndicator.js';import {mobileTokens}from'../../theme/mobileTokens.js';import DeepSearchModal from'../Home/components/DeepSearchModal.js';import {normalizeSummaryText,extractDeepSearchSources}from'../Home/deepSearchUtils.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';var __defProp = Object.defineProperty;
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useEffect,useCallback,useState,useRef}from'react';import {useColorScheme,useWindowDimensions,Keyboard,StyleSheet,View}from'react-native';import {getDefaultLeftItems,getDefaultRightItems,Box,Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {MessageActionBar}from'../../features/chat/MessageActionBar.js';import {ChatTranscript}from'../../features/chat/ChatTranscript.js';import {useCdecliConnection}from'../../contexts/CdecliConnectionContext.js';import {useChatStream}from'../../hooks/useChatStream.js';import {useKeyboardBottomOffset}from'../../hooks/useKeyboardBottomOffset.js';import {KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {YantraBrandLoader,YANTRA_LOADER_SIZE_COMPACT}from'../../components/YantraBrandLoader.js';import ThinkingIndicator from'../../components/ThinkingIndicator.js';import {mobileTokens}from'../../theme/mobileTokens.js';import DeepSearchModal from'../Home/components/DeepSearchModal.js';import {normalizeSummaryText,extractDeepSearchSources}from'../Home/deepSearchUtils.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {ComposerAttachmentBar}from'../../features/attachments/ComposerAttachmentBar.js';import {hasComposerAttachments,takeComposerAttachments}from'../../features/attachments/composerAttachmentHandoff.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -17,10 +17,6 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- const CHAT_CURRENT_USER = {
21
- id: "user"
22
- };
23
- const renderNoToolbar = () => null;
24
20
  function ChatScreen() {
25
21
  var _a, _b;
26
22
  const navigation = useNavigation();
@@ -45,7 +41,6 @@ function ChatScreen() {
45
41
  const secondaryTextColor = isDark ? "#94a3b8" : mobileTokens.color.textMuted;
46
42
  const insets = useSafeAreaInsets();
47
43
  const {
48
- keyboardHeight,
49
44
  keyboardVisible
50
45
  } = useKeyboardBottomOffset();
51
46
  const cdecli = useCdecliConnection();
@@ -67,6 +62,7 @@ function ChatScreen() {
67
62
  id: `msg-${index}-${msg.role}`,
68
63
  role: msg.role,
69
64
  content: msg.content,
65
+ attachments: msg.attachments,
70
66
  metadata: msg.metadata
71
67
  })), [chat.messages]);
72
68
  const {
@@ -79,6 +75,20 @@ function ChatScreen() {
79
75
  sendMessage,
80
76
  cancel
81
77
  } = chat;
78
+ const regenerateFrom = useCallback((messageId) => {
79
+ var _a2, _b2;
80
+ const match = /^msg-(\d+)-assistant$/.exec(messageId);
81
+ if (!match || !channelId) return;
82
+ for (let i = Number(match[1]) - 1; i >= 0; i -= 1) {
83
+ const prior = chat.messages[i];
84
+ if ((prior == null ? void 0 : prior.role) === "user" && (((_a2 = prior.content) == null ? void 0 : _a2.trim()) || ((_b2 = prior.attachments) == null ? void 0 : _b2.length))) {
85
+ void chat.sendMessage(prior.content, prior.attachments, channelId);
86
+ return;
87
+ }
88
+ }
89
+ }, [chat, channelId]);
90
+ const chatBusy = isLoading || isStreaming;
91
+ const renderMessageActions = useCallback((message) => message.role === "assistant" ? /* @__PURE__ */ jsx(MessageActionBar, { text: message.content, onRegenerate: chatBusy ? void 0 : () => regenerateFrom(message.id) }) : null, [chatBusy, regenerateFrom]);
82
92
  const imageAttachments = useImageAttachments();
83
93
  const [value, setValue] = useState("");
84
94
  const valueRef = useRef(value);
@@ -86,7 +96,8 @@ function ChatScreen() {
86
96
  const inputRef = useRef(null);
87
97
  const trimmed = value.trim();
88
98
  const hasQuery = trimmed.length > 0;
89
- const canSubmit = hasQuery && Boolean(channelId);
99
+ const hasAttachments = imageAttachments.pending.length > 0;
100
+ const canSubmit = (hasQuery || hasAttachments) && Boolean(channelId);
90
101
  const [activeMode, setActiveMode] = useState(() => params.initialMode === "deep-search" ? "deep-search" : params.initialMode === "build" ? "build" : "chat");
91
102
  const handleModeSwitch = useCallback((mode) => {
92
103
  setActiveMode(mode);
@@ -98,13 +109,15 @@ function ChatScreen() {
98
109
  const autoFiredRef = useRef(false);
99
110
  useEffect(() => {
100
111
  if (autoFiredRef.current) return;
101
- if (!channelId || !initialQuery) return;
112
+ if (!channelId) return;
102
113
  if (cdecli.status !== "connected" && cdecli.status !== "error") return;
114
+ const stashed = hasComposerAttachments(channelId) ? takeComposerAttachments(channelId) : void 0;
115
+ if (!initialQuery && !(stashed == null ? void 0 : stashed.length)) return;
103
116
  autoFiredRef.current = true;
104
117
  if (isDeepSearchMode) {
105
118
  setIsDeepSearchModalOpen(true);
106
119
  }
107
- void sendMessage(initialQuery, initialAttachments, channelId);
120
+ void sendMessage(initialQuery != null ? initialQuery : "", stashed, channelId);
108
121
  try {
109
122
  navigation.setParams({
110
123
  initialQuery: null,
@@ -115,8 +128,9 @@ function ChatScreen() {
115
128
  }, [channelId, initialQuery, initialAttachments, sendMessage, navigation, cdecli.status, isDeepSearchMode]);
116
129
  const handleSend = useCallback((text) => {
117
130
  var _a2;
131
+ const pending = imageAttachments.forSend();
118
132
  const t = (text != null ? text : valueRef.current).trim();
119
- if (!t || !channelId) return;
133
+ if (!t && !(pending == null ? void 0 : pending.length) || !channelId) return;
120
134
  setValue("");
121
135
  (_a2 = inputRef.current) == null ? void 0 : _a2.clear();
122
136
  if (isBuildMode) {
@@ -134,7 +148,7 @@ function ChatScreen() {
134
148
  if (isDeepSearchMode) {
135
149
  setIsDeepSearchModalOpen(true);
136
150
  }
137
- void sendMessage(t, imageAttachments.forSend(), channelId);
151
+ void sendMessage(t, pending, channelId);
138
152
  imageAttachments.clear();
139
153
  }, [channelId, sendMessage, isDeepSearchMode, isBuildMode, navigation, params.orgName, imageAttachments]);
140
154
  const handleValueChange = useCallback((e) => {
@@ -185,7 +199,6 @@ function ChatScreen() {
185
199
  if ((response != null ? response : "").trim()) return false;
186
200
  return ((_a2 = messages[messages.length - 1]) == null ? void 0 : _a2.role) === "user";
187
201
  }, [isLoading, isStreaming, messages, response]);
188
- const composerScrollBottomPadding = 24 + (keyboardVisible ? keyboardHeight : 0);
189
202
  const [isDeepSearchModalOpen, setIsDeepSearchModalOpen] = useState(false);
190
203
  const [researchProcessOpen, setResearchProcessOpen] = useState(true);
191
204
  const [sourcesAccordionOpen, setSourcesAccordionOpen] = useState(true);
@@ -252,20 +265,24 @@ function ChatScreen() {
252
265
  // dependency with its permission strings declared in app.json.
253
266
  camera: {
254
267
  enabled: true,
255
- loading: imageAttachments.busy,
268
+ loading: imageAttachments.busyKind === "camera",
256
269
  onClick: () => {
257
270
  void imageAttachments.captureFromCamera();
258
271
  }
259
272
  },
260
273
  image: {
261
274
  enabled: true,
262
- loading: imageAttachments.busy,
275
+ loading: imageAttachments.busyKind === "library",
263
276
  onClick: () => {
264
277
  void imageAttachments.pickFromLibrary();
265
278
  }
266
279
  },
267
280
  attach: {
268
- enabled: false
281
+ enabled: true,
282
+ loading: imageAttachments.busyKind === "documents",
283
+ onClick: () => {
284
+ void imageAttachments.pickDocuments();
285
+ }
269
286
  }
270
287
  }), [imageAttachments]);
271
288
  const inputPlaceholder = isDeepSearchMode ? "Research anything..." : isBuildMode ? "Describe an app to build..." : "Ask anything...";
@@ -280,7 +297,7 @@ function ChatScreen() {
280
297
  onSubmitEditing: () => handleSend()
281
298
  }), [value, handleValueChange, inputPlaceholder, channelId, handleSend]);
282
299
  const micSendButton = useMemo(() => ({
283
- hasContent: hasQuery,
300
+ hasContent: hasQuery || hasAttachments,
284
301
  onSend: () => handleSend(),
285
302
  onMic: handleMicPress,
286
303
  disabled: !channelId,
@@ -288,16 +305,16 @@ function ChatScreen() {
288
305
  isLoading: canSubmit ? false : isLoading,
289
306
  onStop: isStreaming && !canSubmit ? cancel : void 0,
290
307
  steerable: isLoading || isStreaming
291
- }), [canSubmit, handleSend, handleMicPress, isLoading, channelId, isStreaming, cancel, hasQuery]);
308
+ }), [canSubmit, handleSend, handleMicPress, isLoading, channelId, isStreaming, cancel, hasQuery, hasAttachments]);
292
309
  const isHydrating = messagesLoading && messages.length === 0 && !response;
293
- const isWaitingForGateway = !autoFiredRef.current && !!channelId && !!initialQuery && cdecli.status !== "connected" && cdecli.status !== "error";
310
+ const isWaitingForGateway = !autoFiredRef.current && !!channelId && (!!initialQuery || hasComposerAttachments(channelId)) && cdecli.status !== "connected" && cdecli.status !== "error";
294
311
  const showSendingLoader = waitingForAssistant;
295
312
  const pinSendingLoaderNearComposer = messages.length > 0 || Boolean((response != null ? response : "").trim());
296
313
  return /* @__PURE__ */ jsxs(SafeAreaView, { edges: ["left", "right"], style: {
297
314
  flex: 1,
298
315
  backgroundColor: surfaceColor
299
316
  }, children: [
300
- /* @__PURE__ */ jsx(TouchableWithoutFeedback, { onPress: Keyboard.dismiss, accessible: false, children: /* @__PURE__ */ jsxs(Box, { flex: 1, width: "100%", position: "relative", children: [
317
+ /* @__PURE__ */ jsxs(Box, { flex: 1, width: "100%", position: "relative", children: [
301
318
  (chatError || cdecli.error) && /* @__PURE__ */ jsx(Box, { mb: "$2", mx: "$4", p: "$3", borderRadius: "$md", style: {
302
319
  backgroundColor: isDark ? "#2b1a1d" : "#fef2f2",
303
320
  borderWidth: 1,
@@ -325,54 +342,25 @@ function ChatScreen() {
325
342
  /* @__PURE__ */ jsx(Text, { style: [styles.statusText, {
326
343
  color: secondaryTextColor
327
344
  }], children: "Connecting gateway\u2026" })
328
- ] }) : /* @__PURE__ */ jsx(Box, { flex: 1, width: "100%", alignSelf: "stretch", children: /* @__PURE__ */ jsx(
329
- MessagesContainerUI,
330
- {
331
- mode: "chat",
332
- showBackButton: false,
333
- compactTop: true,
334
- isKeyboardInternallyHandled: false,
335
- messagesContainerStyle: {
336
- paddingHorizontal: 0,
337
- paddingTop: 0,
338
- paddingBottom: composerScrollBottomPadding,
339
- margin: 0,
340
- marginTop: 0,
341
- alignSelf: "center",
342
- width: contentMaxWidth
343
- },
344
- listContentStyle: {
345
- paddingTop: 0,
346
- paddingBottom: composerScrollBottomPadding,
347
- margin: 0,
348
- marginTop: 0,
349
- width: contentMaxWidth,
350
- alignSelf: "center",
351
- justifyContent: "flex-end"
352
- },
353
- messages: transcriptRows,
354
- streamingContent: response,
355
- currentUser: CHAT_CURRENT_USER,
356
- onSend: handleSend,
357
- disabled: !channelId,
358
- isLoading,
359
- onStop: isStreaming ? cancel : void 0,
360
- renderPlanInputToolbar: renderNoToolbar,
361
- renderBuildInputToolbar: renderNoToolbar
362
- }
363
- ) }),
345
+ ] }) : /* @__PURE__ */ jsx(Box, { flex: 1, width: "100%", alignSelf: "stretch", children: /* @__PURE__ */ jsx(ChatTranscript, { messages: transcriptRows, streamingContent: response, renderMessageActions, isDark, keyboardVisible, listContentStyle: {
346
+ paddingTop: 12,
347
+ paddingBottom: 8,
348
+ margin: 0,
349
+ width: contentMaxWidth,
350
+ alignSelf: "center"
351
+ } }) }),
364
352
  showSendingLoader && !pinSendingLoaderNearComposer ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: styles.sendingLoaderEmptyState, children: /* @__PURE__ */ jsx(ThinkingIndicator, { color: secondaryTextColor }) }) : null,
365
353
  /* @__PURE__ */ jsxs(KeyboardComposerDock, { closedInset: insets.bottom, keyboardVisible, children: [
366
354
  showSendingLoader && pinSendingLoaderNearComposer ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: styles.sendingLoaderInDock, children: /* @__PURE__ */ jsx(ThinkingIndicator, { color: secondaryTextColor }) }) : null,
367
355
  /* @__PURE__ */ jsxs(View, { style: [styles.bottomComposerInner, {
368
356
  width: contentMaxWidth
369
357
  }], children: [
370
- voiceError ? /* @__PURE__ */ jsx(View, { style: [styles.voiceErrorBanner, {
358
+ voiceError || imageAttachments.error ? /* @__PURE__ */ jsx(View, { style: [styles.voiceErrorBanner, {
371
359
  backgroundColor: isDark ? "#2b1a1d" : "#fef2f2",
372
360
  borderColor: isDark ? "#7f1d1d" : "#fecaca"
373
361
  }], children: /* @__PURE__ */ jsx(Text, { style: [styles.voiceErrorText, {
374
362
  color: isDark ? "#fecaca" : "#991b1b"
375
- }], children: voiceError }) }) : null,
363
+ }], children: voiceError || imageAttachments.error }) }) : null,
376
364
  showAudioRecorder ? (
377
365
  /*
378
366
  * Render-time JS errors thrown by `useAudioRecorder`
@@ -385,10 +373,13 @@ function ChatScreen() {
385
373
  * release / TestFlight.
386
374
  */
387
375
  /* @__PURE__ */ jsx(MicErrorBoundary, { onCancel: handleRecorderCancel, onError: handleRecorderError, children: /* @__PURE__ */ jsx(AudioRecorderPanel, { isDark, onTranscriptionComplete: handleTranscriptionComplete, onCancel: handleRecorderCancel, onError: handleRecorderError }) })
388
- ) : /* @__PURE__ */ jsx(InputToolBar, { inputConfig, leftItems, rightItems, templateButton: null, templateModalConfig: null, micSendButton })
376
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
377
+ /* @__PURE__ */ jsx(ComposerAttachmentBar, { attachments: imageAttachments.pending, onRemove: imageAttachments.remove, isDark }),
378
+ /* @__PURE__ */ jsx(InputToolBar, { inputConfig, leftItems, rightItems, templateButton: null, templateModalConfig: null, micSendButton })
379
+ ] })
389
380
  ] })
390
381
  ] })
391
- ] }) }),
382
+ ] }),
392
383
  isDeepSearchMode ? /* @__PURE__ */ jsx(DeepSearchModal, { visible: isDeepSearchModalOpen, query: deepSearchQuery, summaryText: deepSearchSummary, sources: deepSearchSources, isStreaming, researchProcessOpen, sourcesAccordionOpen, onToggleResearchProcess: () => setResearchProcessOpen((prev) => !prev), onToggleSourcesAccordion: () => setSourcesAccordionOpen((prev) => !prev), onRetry: handleDeepSearchRetry, onStop: cancel, onClose: handleDeepSearchClose }) : null
393
384
  ] });
394
385
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/screens/Chat/index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n Keyboard,\n StyleSheet,\n TextInput,\n TouchableWithoutFeedback,\n View,\n useColorScheme,\n useWindowDimensions,\n} from 'react-native';\nimport { Box, InputToolBar, Text, getDefaultLeftItems, getDefaultRightItems } from '@admin-layout/gluestack-ui-mobile';\nimport { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useNavigation, useRoute, CommonActions } from '@react-navigation/native';\nimport { MessagesContainerUI } from '@messenger-box/platform-mobile';\nimport { useCdecliConnection } from '../../contexts/CdecliConnectionContext';\nimport { useChatStream, type UseChatStreamRouting } from '../../hooks/useChatStream';\nimport { useKeyboardBottomOffset } from '../../hooks/useKeyboardBottomOffset';\nimport { KeyboardComposerDock } from '../../components/KeyboardComposerDock';\nimport { YantraBrandLoader, YANTRA_LOADER_SIZE_COMPACT } from '../../components/YantraBrandLoader';\nimport ThinkingIndicator from '../../components/ThinkingIndicator';\nimport { mobileTokens } from '../../theme/mobileTokens';\nimport DeepSearchModal from '../Home/components/DeepSearchModal';\nimport { extractDeepSearchSources, normalizeSummaryText, type DeepSearchSourceItem } from '../Home/deepSearchUtils';\nimport type { ModeSubmission, RoutingMode } from '../Home/types';\nimport { AudioRecorderPanel } from '../../features/audio-input/AudioRecorderPanel';\nimport { useImageAttachments } from '../../features/attachments/useImageAttachments';\nimport { MicErrorBoundary } from '../../features/audio-input/MicErrorBoundary';\nimport { requestMicPermission } from '../../features/audio-input/useAudioPermission';\n\n/** Route params passed by Home (or by deep-link) when entering the Chat surface. */\nexport interface ChatScreenRouteParams {\n /** Channel id is required — the screen is keyed on the conversation. */\n channelId: string;\n /** Org slug used by gateway/account context. */\n orgName?: string | null;\n /**\n * First user message to auto-fire when the screen mounts. Home generates\n * this when the user submits from the empty composer so the assistant\n * starts streaming on Chat without an extra round trip.\n */\n initialQuery?: string | null;\n /**\n * Seed for the composer's mode (`'chat'` | `'deep-search'` | `'build'`).\n *\n * Set by `HomeScreen` to carry the user's last selection across the\n * navigation hop (\"research from home → research-shaped composer on chat\").\n * `ChatHistoryScreen` does NOT forward this — revisits always land on the\n * default `'chat'` mode, matching Home's defaults, and the user is free to\n * switch from there. Build-mode send hands off to Web Builder.\n *\n * After mount, this param is purely a seed: the screen keeps its own\n * `activeMode` so the user can toggle freely while inside the thread.\n */\n initialMode?: RoutingMode;\n /** Optional attachments forwarded with the initial message. */\n initialAttachments?: ModeSubmission['attachments'];\n}\n\n/** Stable prop identities — a fresh object/function per render defeats the\n * memoisation inside MessagesContainerUI during streaming. */\nconst CHAT_CURRENT_USER = { id: 'user' } as const;\nconst renderNoToolbar = () => null;\n\nexport default function ChatScreen() {\n const navigation = useNavigation<any>();\n const route = useRoute<any>();\n\n const params = (route?.params ?? {}) as Partial<ChatScreenRouteParams>;\n const channelId = useMemo(() => {\n const raw = typeof params.channelId === 'string' ? params.channelId.trim() : '';\n return raw.length > 0 ? raw : null;\n }, [params.channelId]);\n const initialQuery = useMemo(() => {\n const raw = typeof params.initialQuery === 'string' ? params.initialQuery.trim() : '';\n return raw.length > 0 ? raw : null;\n }, [params.initialQuery]);\n const initialAttachments = params.initialAttachments;\n\n const colorScheme = useColorScheme();\n const isDark = colorScheme === 'dark';\n const { width: screenWidth } = useWindowDimensions();\n const contentMaxWidth = Math.min(720, Math.max(360, screenWidth - 24));\n\n const surfaceColor = isDark ? '#0f172a' : mobileTokens.color.surface;\n const secondaryTextColor = isDark ? '#94a3b8' : mobileTokens.color.textMuted;\n\n const insets = useSafeAreaInsets();\n const { keyboardHeight, keyboardVisible } = useKeyboardBottomOffset();\n\n /**\n * Gateway + chat stream routing.\n *\n * The CDeCLI lifecycle is owned app-wide by `CdecliConnectionProvider`,\n * so we just register this screen's channelId and read the shared status.\n * This avoids racing `gatewayConnect` mutations with the header's\n * `GatewayConnector` (which previously ran its own `useCdecliAutoConnect`\n * and could clobber the chat session binding).\n */\n const cdecli = useCdecliConnection();\n const effectivePersistenceMode = cdecli.persistenceMode ?? 'backend';\n\n useEffect(() => {\n if (!channelId) return undefined;\n cdecli.setActiveChannelId(channelId);\n return () => {\n cdecli.setActiveChannelId(undefined);\n };\n }, [channelId, cdecli.setActiveChannelId]);\n\n const chatRouting: UseChatStreamRouting = useMemo(\n () => ({\n channelConnected: cdecli.channelConnected,\n accountId: cdecli.accountId,\n persistenceMode: effectivePersistenceMode,\n }),\n [cdecli.channelConnected, cdecli.accountId, effectivePersistenceMode],\n );\n\n const chat = useChatStream(channelId, chatRouting);\n\n /**\n * Gifted-shaped transcript rows, memoised on `messages` alone.\n *\n * This screen re-renders on every streamed token — `useChatStream` does\n * `setResponse((r) => r + text)` per delta. Building this array inline in\n * the JSX therefore handed `PlanModeView` a fresh `messages` identity on\n * every token, which invalidated its own `useMemo([messages, …])`, re-mapped\n * every row, and re-rendered every bubble. Assistant bubbles render through\n * `react-native-markdown-display`, so that meant re-parsing the markdown of\n * the whole thread once per token — O(messages) parses per delta, on the JS\n * thread, which is exactly when the UI has to stay responsive.\n *\n * `messages` is already stable upstream (`useChatApi` memoises it on the\n * Apollo result), so this only rebuilds when a message is actually added or\n * changed.\n */\n const transcriptRows = useMemo(\n () =>\n chat.messages.map((msg, index) => ({\n id: `msg-${index}-${msg.role}`,\n role: msg.role,\n content: msg.content,\n metadata: (msg as { metadata?: unknown }).metadata,\n })),\n [chat.messages],\n );\n const { messages, response, error: chatError, isLoading, isStreaming, messagesLoading, sendMessage, cancel } = chat;\n\n const imageAttachments = useImageAttachments();\n\n /*\n * Composer state — kept local so it doesn't leak across navigations.\n *\n * `valueRef` mirrors the controlled `value` so `handleSend` can read the\n * latest text without taking a dependency on it. Without this, `handleSend`\n * (and therefore `micSendButton.onSend`) would be recreated on every\n * keystroke, which is unnecessary churn for `InputToolBar`.\n *\n * `inputRef` is forwarded to InputToolBar's TextInput so we can call\n * `.clear()` imperatively after sending. On iOS, the native text buffer\n * can stay desynced from the controlled `value` for a frame when a state\n * update is followed by an async dispatch in the same gesture — the\n * \"send-and-clear\" race. The imperative clear closes that gap deterministically.\n */\n const [value, setValue] = useState('');\n const valueRef = useRef(value);\n valueRef.current = value;\n const inputRef = useRef<TextInput>(null);\n const trimmed = value.trim();\n const hasQuery = trimmed.length > 0;\n const canSubmit = hasQuery && Boolean(channelId);\n\n /**\n * Composer mode is FREELY user-controlled, mirroring `HomeScreen`.\n *\n * Seed:\n * • From Home (which forwards `initialMode` alongside `initialQuery`):\n * start in whatever mode the user picked there so the \"research from\n * home → research-shaped chat\" hand-off feels continuous.\n * • From ChatHistory (which intentionally does NOT pass `initialMode`):\n * default to `'chat'`, same as Home's empty composer.\n *\n * Post-mount this is a normal local state — the search/zap pills toggle\n * it on tap, and every place that previously branched on\n * `params.initialMode` now branches on `activeMode` instead.\n */\n const [activeMode, setActiveMode] = useState<RoutingMode>(() =>\n params.initialMode === 'deep-search' ? 'deep-search' : params.initialMode === 'build' ? 'build' : 'chat',\n );\n const handleModeSwitch = useCallback((mode: RoutingMode) => {\n setActiveMode(mode);\n }, []);\n const isDeepSearchMode = activeMode === 'deep-search';\n const isBuildMode = activeMode === 'build';\n\n /**\n * Inline voice recorder state — parity with HomeScreen and the web\n * `YantraSearchComposer.showAudioRecorder` flow. When active, the panel\n * fully replaces the InputToolBar so the toolbar's mic→send button\n * doesn't compete with the panel's own send/cancel affordances.\n */\n const [showAudioRecorder, setShowAudioRecorder] = useState(false);\n const [voiceError, setVoiceError] = useState<string | null>(null);\n\n /**\n * Auto-fire the initial query once when the screen mounts on a fresh channel.\n * Home creates the channel optimistically and forwards the user prompt here so\n * the first assistant token arrives without an extra interaction.\n *\n * Wait for CDeCLI to finish connecting (or fail) before auto-firing — chat is\n * cdecli-only and `sendMessage` rejects sends while the gateway is disconnected.\n */\n const autoFiredRef = useRef(false);\n useEffect(() => {\n if (autoFiredRef.current) return;\n if (!channelId || !initialQuery) return;\n if (cdecli.status !== 'connected' && cdecli.status !== 'error') return;\n\n autoFiredRef.current = true;\n // Deep-search auto-fire from Home: open the structured modal at the\n // same instant we kick off the send so the user sees the research view\n // streaming in rather than raw assistant turns. Tied to the\n // sendMessage call (same event) to avoid a race where the modal opens\n // before/after the actual send.\n //\n // We branch on the LOCAL `isDeepSearchMode` instead of\n // `params.initialMode`. At auto-fire time they're equal (the local\n // state was seeded from the param), and using the local state means\n // future toggles drive the same code path consistently.\n if (isDeepSearchMode) {\n setIsDeepSearchModalOpen(true);\n }\n void sendMessage(initialQuery, initialAttachments as any, channelId);\n try {\n navigation.setParams({ initialQuery: null, initialAttachments: null });\n } catch {\n /* setParams may be unavailable in tests; clearing is best-effort. */\n }\n }, [channelId, initialQuery, initialAttachments, sendMessage, navigation, cdecli.status, isDeepSearchMode]);\n\n const handleSend = useCallback(\n (text?: string) => {\n const t = (text ?? valueRef.current).trim();\n if (!t || !channelId) return;\n // Clear both ways: the controlled state (so React's model stays\n // consistent on next render) AND the native buffer via the ref\n // (so the visible text disappears on the same frame the user\n // pressed send, even before React flushes).\n setValue('');\n inputRef.current?.clear();\n\n // Build mode: hand off to Web Builder on this channel (web `/c/:id/webbuilder`).\n if (isBuildMode) {\n navigation.dispatch(\n CommonActions.navigate({\n name: 'MainStack.WebBuilder',\n params: {\n ...(params.orgName ? { orgName: params.orgName } : {}),\n channelId,\n message: t,\n },\n }),\n );\n return;\n }\n\n // Deep-search mode: every new query pops the structured research\n // modal back open (parity with the previous Home flow, where every\n // submit re-opened the DeepSearchModal). Without this, a user who\n // closed the modal once would see plain assistant turns for every\n // subsequent send. Reads the LOCAL `isDeepSearchMode` so the user\n // can toggle modes mid-thread and have sends behave accordingly.\n if (isDeepSearchMode) {\n setIsDeepSearchModalOpen(true);\n }\n void sendMessage(t, imageAttachments.forSend(), channelId);\n imageAttachments.clear();\n },\n [channelId, sendMessage, isDeepSearchMode, isBuildMode, navigation, params.orgName, imageAttachments],\n );\n\n const handleValueChange = useCallback((e: any) => {\n setValue(e?.nativeEvent?.text ?? '');\n }, []);\n\n /**\n * Mic affordance — web parity (`handleMicClick` in `YantraSearchComposer.tsx`).\n * The shared `MicSendButton` in `InputToolBar.tsx` only routes to `onMic`\n * when the input has no content, so we only need to handle the empty-input\n * case here.\n *\n * Permission is requested HERE, before the panel mounts. The previous flow\n * flipped `showAudioRecorder=true` immediately, which mounted\n * `AudioRecorderPanel` and constructed the native `AVAudioRecorder` via\n * `useAudioRecorder()` during the panel's render phase — before iOS had\n * granted mic access. On SDK 53 + `newArchEnabled: true` + Hermes that\n * ordering hard-crashes TestFlight builds even though it works in Expo Go\n * (Expo Go pre-caches permission). Asking up front means iOS shows the\n * system alert first and the panel only mounts (and therefore the native\n * recorder is only allocated) once permission is granted.\n *\n * `expo-audio` is lazy-imported so a missing/broken native module surfaces\n * as a user-visible banner instead of a synchronous TurboModule crash.\n */\n const handleMicPress = useCallback(() => {\n if (hasQuery) return;\n setVoiceError(null);\n Keyboard.dismiss();\n void (async () => {\n const { granted, error } = await requestMicPermission();\n if (!granted) {\n setVoiceError(error || 'Microphone is not available.');\n return;\n }\n setShowAudioRecorder(true);\n })();\n }, [hasQuery]);\n\n /**\n * On a successful Whisper round-trip, paste the transcript into the input\n * field, close the recorder, and let the user review/send manually. Matches\n * web's `handleTranscriptionComplete`: we deliberately do NOT auto-fire\n * `sendMessage` because the user often wants to edit the dictation first.\n */\n const handleTranscriptionComplete = useCallback((text: string) => {\n const cleaned = (text ?? '').trim();\n setShowAudioRecorder(false);\n if (!cleaned) return;\n setValue((prev) => {\n const next = prev.trim().length > 0 ? `${prev.trim()} ${cleaned}` : cleaned;\n /*\n * Keep `inputRef`'s native text in sync with our controlled value\n * for the same reason `handleSend` does (the iOS native buffer\n * can lag the React state across a single gesture). `setNativeProps`\n * is the safe way to do this without re-rendering.\n */\n requestAnimationFrame(() => {\n inputRef.current?.setNativeProps?.({ text: next });\n inputRef.current?.focus?.();\n });\n return next;\n });\n }, []);\n\n const handleRecorderCancel = useCallback(() => {\n setShowAudioRecorder(false);\n }, []);\n\n const handleRecorderError = useCallback((error: string) => {\n setVoiceError(error);\n }, []);\n\n const waitingForAssistant = useMemo(() => {\n if ((!isLoading && !isStreaming) || messages.length === 0) return false;\n if ((response ?? '').trim()) return false;\n return messages[messages.length - 1]?.role === 'user';\n }, [isLoading, isStreaming, messages, response]);\n\n const composerScrollBottomPadding = 24 + (keyboardVisible ? keyboardHeight : 0);\n\n /*\n * NOTE: the previous read-only `isDeepSearchChannel` derivation has been\n * removed. Mode is now a freely-toggleable local state (`activeMode`)\n * driven by tapping the search/zap pills, mirroring HomeScreen. All\n * downstream branches use `isDeepSearchMode` declared with the rest of\n * the composer state above.\n */\n\n /**\n * Deep-search overlay state.\n *\n * Restored from the previous Home-screen flow (commit history): a deep-search\n * channel renders the structured `DeepSearchModal` (query / live summary /\n * sources / research process) on top of the regular Chat conversation. Closing\n * the modal reveals the same channel's MessagesContainerUI underneath so the\n * user can still see the raw turns.\n *\n * Trigger semantics — IMPORTANT:\n * • Opens ONLY when a request is actually fired in this session:\n * - Home → Chat auto-fire of `initialQuery`\n * - User sends a new message in a deep-search channel from the composer\n * - Explicit retry from inside the modal\n * • Does NOT open on plain entry from ChatHistoryScreen. That's a revisit\n * of an already-completed thread — no new API call, nothing live to\n * stream, so popping the modal would just be a confusing flash. The\n * user still sees the deep-search rendering in the chat conversation\n * underneath, and any new send re-opens the live view.\n *\n * Local UI state (accordions, open flag) lives here; data state (query /\n * summary / sources) is DERIVED from the chat stream, not stored separately,\n * so there's no drift between the modal and the underlying conversation.\n */\n const [isDeepSearchModalOpen, setIsDeepSearchModalOpen] = useState(false);\n const [researchProcessOpen, setResearchProcessOpen] = useState(true);\n const [sourcesAccordionOpen, setSourcesAccordionOpen] = useState(true);\n\n /**\n * Modal data is always scoped to the CURRENT run, not the whole channel.\n * In a multi-turn deep-search channel each send is its own \"run\": one user\n * query → one assistant summary. If we sourced from \"first user message\" /\n * \"any assistant message\", a follow-up send would keep showing the previous\n * run's query and stale sources during the transient window between the new\n * user message being appended and the first stream token arriving.\n *\n * Cursor: the LAST user message in the thread. The assistant content for\n * the current run is either:\n * • `response` while the stream is filling (token-by-token), OR\n * • the assistant message that comes AFTER the last user (run complete), OR\n * • empty — covers the brief \"user message appended, no response yet\"\n * window so the modal flips to \"Running...\" with no stale body.\n */\n const lastUserIndex = useMemo(() => {\n for (let i = messages.length - 1; i >= 0; i -= 1) {\n if (messages[i]?.role === 'user') return i;\n }\n return -1;\n }, [messages]);\n\n const deepSearchQuery = useMemo(() => {\n if (lastUserIndex >= 0) {\n const txt = messages[lastUserIndex]?.content?.trim();\n if (txt) return txt;\n }\n return initialQuery ?? null;\n }, [messages, lastUserIndex, initialQuery]);\n\n const latestAssistantContent = useMemo(() => {\n if (response && response.trim()) return response;\n if (lastUserIndex < 0) return '';\n // Look for an assistant turn strictly AFTER the last user message.\n // Anything before it belongs to a prior run and must not leak into\n // the modal for the current one.\n for (let i = lastUserIndex + 1; i < messages.length; i += 1) {\n if (messages[i]?.role === 'assistant') {\n return messages[i]?.content ?? '';\n }\n }\n return '';\n }, [response, messages, lastUserIndex]);\n\n const deepSearchSummary = useMemo(() => normalizeSummaryText(latestAssistantContent), [latestAssistantContent]);\n const deepSearchSources: DeepSearchSourceItem[] = useMemo(\n () => extractDeepSearchSources(latestAssistantContent),\n [latestAssistantContent],\n );\n\n const handleDeepSearchClose = useCallback(() => {\n if (isStreaming) cancel();\n setIsDeepSearchModalOpen(false);\n }, [isStreaming, cancel]);\n\n const handleDeepSearchRetry = useCallback(() => {\n if (!deepSearchQuery || isStreaming || !channelId) return;\n void sendMessage(deepSearchQuery, undefined, channelId);\n }, [deepSearchQuery, isStreaming, channelId, sendMessage]);\n const leftItems = useMemo(\n () =>\n getDefaultLeftItems({\n search: { active: activeMode === 'chat', onClick: () => handleModeSwitch('chat') },\n zap: { active: activeMode === 'deep-search', onClick: () => handleModeSwitch('deep-search') },\n lightbulb: {\n active: activeMode === 'build',\n onClick: () => handleModeSwitch('build'),\n },\n }),\n [activeMode, handleModeSwitch],\n );\n const rightItems = useMemo(\n () =>\n getDefaultRightItems({\n tag: { enabled: false },\n chip: { enabled: false },\n // Attaching an image was disabled here even though the transport\n // (`sendMessage(content, attachments)`) and the gateway media lane\n // already carried it, and `expo-image-picker` was already a\n // dependency with its permission strings declared in app.json.\n camera: {\n enabled: true,\n loading: imageAttachments.busy,\n onClick: () => {\n void imageAttachments.captureFromCamera();\n },\n },\n image: {\n enabled: true,\n loading: imageAttachments.busy,\n onClick: () => {\n void imageAttachments.pickFromLibrary();\n },\n },\n attach: { enabled: false },\n }),\n [imageAttachments],\n );\n /**\n * Composer placeholder.\n *\n * Mirrors Home so the composer feels like the same affordance across the\n * \"first message\" and \"continuing thread\" surfaces — only the surrounding\n * UI changes, the input stays a stable anchor. We intentionally do NOT\n * surface a \"Loading conversation…\" state in the placeholder: the message\n * list already shows a dedicated hydrating loader, and switching the\n * placeholder for ~1 frame creates a visible flash on every entry.\n */\n const inputPlaceholder = isDeepSearchMode\n ? 'Research anything...'\n : isBuildMode\n ? 'Describe an app to build...'\n : 'Ask anything...';\n\n const inputConfig = useMemo(\n () => ({\n value,\n onChange: handleValueChange,\n placeholder: inputPlaceholder,\n disabled: !channelId,\n inputRef,\n returnKeyType: 'send',\n blurOnSubmit: false,\n onSubmitEditing: () => handleSend(),\n }),\n [value, handleValueChange, inputPlaceholder, channelId, handleSend],\n );\n const micSendButton = useMemo(\n () => ({\n hasContent: hasQuery,\n onSend: () => handleSend(),\n onMic: handleMicPress,\n disabled: !channelId,\n // Empty + streaming → Stop. Typed follow-up → Send (steer). Never lock the composer.\n isLoading: canSubmit ? false : isLoading,\n onStop: isStreaming && !canSubmit ? cancel : undefined,\n steerable: isLoading || isStreaming,\n }),\n [canSubmit, handleSend, handleMicPress, isLoading, channelId, isStreaming, cancel, hasQuery],\n );\n\n /**\n * Loader visibility:\n * - `isHydrating`: Apollo channel history is being fetched and we have nothing to show yet.\n * - `isWaitingForGateway`: Home navigated us here with an `initialQuery`, but CDeCLI is still\n * establishing the workspace session, so the auto-fire is deferred. Show a \"Connecting…\"\n * placeholder instead of an empty thread so the user doesn't think their send was dropped.\n */\n const isHydrating = messagesLoading && messages.length === 0 && !response;\n const isWaitingForGateway =\n !autoFiredRef.current &&\n !!channelId &&\n !!initialQuery &&\n cdecli.status !== 'connected' &&\n cdecli.status !== 'error';\n const showSendingLoader = waitingForAssistant;\n const pinSendingLoaderNearComposer = messages.length > 0 || Boolean((response ?? '').trim());\n\n return (\n <SafeAreaView edges={['left', 'right']} style={{ flex: 1, backgroundColor: surfaceColor }}>\n {/* Tap anywhere outside an input to dismiss the keyboard. */}\n <TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>\n <Box flex={1} width=\"100%\" position=\"relative\">\n {(chatError || cdecli.error) && (\n <Box\n mb=\"$2\"\n mx=\"$4\"\n p=\"$3\"\n borderRadius=\"$md\"\n style={{\n backgroundColor: isDark ? '#2b1a1d' : '#fef2f2',\n borderWidth: 1,\n borderColor: isDark ? '#7f1d1d' : '#fecaca',\n }}\n >\n <Text fontSize=\"$sm\" style={{ color: isDark ? '#fecaca' : '#991b1b' }}>\n {chatError || cdecli.error}\n </Text>\n </Box>\n )}\n {!channelId ? (\n <Box flex={1} alignItems=\"center\" justifyContent=\"center\">\n <YantraBrandLoader size={YANTRA_LOADER_SIZE_COMPACT} />\n <Text style={[styles.statusText, { color: secondaryTextColor }]}>No channel selected</Text>\n </Box>\n ) : isHydrating ? (\n /**\n * Channel hydration (entering Chat from history or a deep\n * link) reuses the same `ThinkingIndicator` row as the\n * chat-history list — thin spinning arc + muted caption.\n * Keeps the loading vocabulary consistent across screens\n * and avoids the previous branded loader + \"Loading\n * conversation\" copy that read as a different state.\n */\n <Box flex={1} alignItems=\"center\" justifyContent=\"center\">\n <ThinkingIndicator color={secondaryTextColor} />\n </Box>\n ) : isWaitingForGateway ? (\n <Box flex={1} alignItems=\"center\" justifyContent=\"center\">\n <YantraBrandLoader size={YANTRA_LOADER_SIZE_COMPACT} />\n <Text style={[styles.statusText, { color: secondaryTextColor }]}>Connecting gateway…</Text>\n </Box>\n ) : (\n <Box flex={1} width=\"100%\" alignSelf=\"stretch\">\n <MessagesContainerUI\n mode=\"chat\"\n showBackButton={false}\n compactTop\n /**\n * The composer lives OUTSIDE this container (KeyboardComposerDock\n * lifts it on the UI thread) and the container already pads by the\n * keyboard height via composerScrollBottomPadding. GiftedChat's\n * default internal handling ALSO translates the message plane by\n * the keyboard height to protect its own (here: nonexistent)\n * toolbar - double compensation that pushed short threads entirely\n * off-screen while typing.\n */\n isKeyboardInternallyHandled={false}\n messagesContainerStyle={{\n paddingHorizontal: 0,\n paddingTop: 0,\n paddingBottom: composerScrollBottomPadding,\n margin: 0,\n marginTop: 0,\n alignSelf: 'center',\n width: contentMaxWidth,\n }}\n listContentStyle={{\n paddingTop: 0,\n paddingBottom: composerScrollBottomPadding,\n margin: 0,\n marginTop: 0,\n width: contentMaxWidth,\n alignSelf: 'center',\n justifyContent: 'flex-end',\n }}\n messages={transcriptRows}\n streamingContent={response}\n currentUser={CHAT_CURRENT_USER}\n onSend={handleSend}\n disabled={!channelId}\n isLoading={isLoading}\n onStop={isStreaming ? cancel : undefined}\n renderPlanInputToolbar={renderNoToolbar}\n renderBuildInputToolbar={renderNoToolbar}\n />\n </Box>\n )}\n {showSendingLoader && !pinSendingLoaderNearComposer ? (\n <View pointerEvents=\"none\" style={styles.sendingLoaderEmptyState}>\n <ThinkingIndicator color={secondaryTextColor} />\n </View>\n ) : null}\n <KeyboardComposerDock closedInset={insets.bottom} keyboardVisible={keyboardVisible}>\n {showSendingLoader && pinSendingLoaderNearComposer ? (\n <View pointerEvents=\"none\" style={styles.sendingLoaderInDock}>\n <ThinkingIndicator color={secondaryTextColor} />\n </View>\n ) : null}\n <View style={[styles.bottomComposerInner, { width: contentMaxWidth }]}>\n {voiceError ? (\n <View\n style={[\n styles.voiceErrorBanner,\n {\n backgroundColor: isDark ? '#2b1a1d' : '#fef2f2',\n borderColor: isDark ? '#7f1d1d' : '#fecaca',\n },\n ]}\n >\n <Text style={[styles.voiceErrorText, { color: isDark ? '#fecaca' : '#991b1b' }]}>\n {voiceError}\n </Text>\n </View>\n ) : null}\n {showAudioRecorder ? (\n /*\n * Render-time JS errors thrown by `useAudioRecorder`\n * (e.g. expo-audio native module missing, recorder\n * constructor throws in a release build) are caught\n * by the boundary and converted into a soft cancel\n * via the same handlers the panel itself uses on\n * runtime errors. Without this, a throw during the\n * panel's render phase kills the JS thread in\n * release / TestFlight.\n */\n <MicErrorBoundary onCancel={handleRecorderCancel} onError={handleRecorderError}>\n <AudioRecorderPanel\n isDark={isDark}\n onTranscriptionComplete={handleTranscriptionComplete}\n onCancel={handleRecorderCancel}\n onError={handleRecorderError}\n />\n </MicErrorBoundary>\n ) : (\n <InputToolBar\n inputConfig={inputConfig}\n leftItems={leftItems}\n rightItems={rightItems}\n templateButton={null}\n templateModalConfig={null}\n micSendButton={micSendButton}\n />\n )}\n </View>\n </KeyboardComposerDock>\n </Box>\n {/*\n * DeepSearchModal is rendered OUTSIDE the keyboard-dismiss wrapper so\n * taps inside the modal don't dismiss the keyboard, and it's a native\n * <Modal> internally so it correctly sits on top of the Chat surface\n * (composer included) on both iOS and Android.\n */}\n </TouchableWithoutFeedback>\n {isDeepSearchMode ? (\n <DeepSearchModal\n visible={isDeepSearchModalOpen}\n query={deepSearchQuery}\n summaryText={deepSearchSummary}\n sources={deepSearchSources}\n isStreaming={isStreaming}\n researchProcessOpen={researchProcessOpen}\n sourcesAccordionOpen={sourcesAccordionOpen}\n onToggleResearchProcess={() => setResearchProcessOpen((prev) => !prev)}\n onToggleSourcesAccordion={() => setSourcesAccordionOpen((prev) => !prev)}\n onRetry={handleDeepSearchRetry}\n onStop={cancel}\n onClose={handleDeepSearchClose}\n />\n ) : null}\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n statusText: {\n marginTop: 14,\n fontSize: 13,\n fontWeight: '500',\n },\n bottomComposerInner: {\n paddingHorizontal: 14,\n paddingTop: 10,\n paddingBottom: 4,\n },\n voiceErrorBanner: {\n marginBottom: 8,\n paddingHorizontal: 12,\n paddingVertical: 8,\n borderRadius: 10,\n borderWidth: 1,\n },\n voiceErrorText: {\n fontSize: 12,\n fontWeight: '500',\n },\n sendingLoaderEmptyState: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 40,\n },\n sendingLoaderInDock: {\n alignItems: 'center',\n justifyContent: 'flex-end',\n paddingBottom: 8,\n },\n});\n"],"names":["_a","_b"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,MAAM,iBAAoB,GAAA;AAAA,EACxB,EAAI,EAAA;AACN,CAAA;AACA,MAAM,kBAAkB,MAAM,IAAA;AAC9B,SAAwB,UAAa,GAAA;AAxDrC,EAAA,IAAA,EAAA,EAAA,EAAA;AAyDE,EAAA,MAAM,aAAa,aAAmB,E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AU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,uBAAyB,EAAA;AAAA,IACvB,QAAU,EAAA,UAAA;AAAA,IACV,IAAM,EAAA,CAAA;AAAA,IACN,KAAO,EAAA,CAAA;AAAA,IACP,GAAK,EAAA,CAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,cAAgB,EAAA,QAAA;AAAA,IAChB,UAAY,EAAA,QAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,mBAAqB,EAAA;AAAA,IACnB,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA,UAAA;AAAA,IAChB,aAAe,EAAA;AAAA;AAEnB,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/screens/Chat/index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { Keyboard, StyleSheet, TextInput, View, useColorScheme, useWindowDimensions } from 'react-native';\nimport { Box, InputToolBar, Text, getDefaultLeftItems, getDefaultRightItems } from '@admin-layout/gluestack-ui-mobile';\nimport { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useNavigation, useRoute, CommonActions } from '@react-navigation/native';\nimport { MessageActionBar } from '../../features/chat/MessageActionBar';\nimport { ChatTranscript } from '../../features/chat/ChatTranscript';\nimport { useCdecliConnection } from '../../contexts/CdecliConnectionContext';\nimport { useChatStream, type UseChatStreamRouting } from '../../hooks/useChatStream';\nimport { useKeyboardBottomOffset } from '../../hooks/useKeyboardBottomOffset';\nimport { KeyboardComposerDock } from '../../components/KeyboardComposerDock';\nimport { YantraBrandLoader, YANTRA_LOADER_SIZE_COMPACT } from '../../components/YantraBrandLoader';\nimport ThinkingIndicator from '../../components/ThinkingIndicator';\nimport { mobileTokens } from '../../theme/mobileTokens';\nimport DeepSearchModal from '../Home/components/DeepSearchModal';\nimport { extractDeepSearchSources, normalizeSummaryText, type DeepSearchSourceItem } from '../Home/deepSearchUtils';\nimport type { ModeSubmission, RoutingMode } from '../Home/types';\nimport { AudioRecorderPanel } from '../../features/audio-input/AudioRecorderPanel';\nimport { useImageAttachments } from '../../features/attachments/useImageAttachments';\nimport { ComposerAttachmentBar } from '../../features/attachments/ComposerAttachmentBar';\nimport { hasComposerAttachments, takeComposerAttachments } from '../../features/attachments/composerAttachmentHandoff';\nimport { MicErrorBoundary } from '../../features/audio-input/MicErrorBoundary';\nimport { requestMicPermission } from '../../features/audio-input/useAudioPermission';\n\n/** Route params passed by Home (or by deep-link) when entering the Chat surface. */\nexport interface ChatScreenRouteParams {\n /** Channel id is required — the screen is keyed on the conversation. */\n channelId: string;\n /** Org slug used by gateway/account context. */\n orgName?: string | null;\n /**\n * First user message to auto-fire when the screen mounts. Home generates\n * this when the user submits from the empty composer so the assistant\n * starts streaming on Chat without an extra round trip.\n */\n initialQuery?: string | null;\n /**\n * Seed for the composer's mode (`'chat'` | `'deep-search'` | `'build'`).\n *\n * Set by `HomeScreen` to carry the user's last selection across the\n * navigation hop (\"research from home → research-shaped composer on chat\").\n * `ChatHistoryScreen` does NOT forward this — revisits always land on the\n * default `'chat'` mode, matching Home's defaults, and the user is free to\n * switch from there. Build-mode send hands off to Web Builder.\n *\n * After mount, this param is purely a seed: the screen keeps its own\n * `activeMode` so the user can toggle freely while inside the thread.\n */\n initialMode?: RoutingMode;\n /** Optional attachments forwarded with the initial message. */\n initialAttachments?: ModeSubmission['attachments'];\n}\n\nexport default function ChatScreen() {\n const navigation = useNavigation<any>();\n const route = useRoute<any>();\n\n const params = (route?.params ?? {}) as Partial<ChatScreenRouteParams>;\n const channelId = useMemo(() => {\n const raw = typeof params.channelId === 'string' ? params.channelId.trim() : '';\n return raw.length > 0 ? raw : null;\n }, [params.channelId]);\n const initialQuery = useMemo(() => {\n const raw = typeof params.initialQuery === 'string' ? params.initialQuery.trim() : '';\n return raw.length > 0 ? raw : null;\n }, [params.initialQuery]);\n const initialAttachments = params.initialAttachments;\n\n const colorScheme = useColorScheme();\n const isDark = colorScheme === 'dark';\n const { width: screenWidth } = useWindowDimensions();\n const contentMaxWidth = Math.min(720, Math.max(360, screenWidth - 24));\n\n const surfaceColor = isDark ? '#0f172a' : mobileTokens.color.surface;\n const secondaryTextColor = isDark ? '#94a3b8' : mobileTokens.color.textMuted;\n\n const insets = useSafeAreaInsets();\n const { keyboardVisible } = useKeyboardBottomOffset();\n\n /**\n * Gateway + chat stream routing.\n *\n * The CDeCLI lifecycle is owned app-wide by `CdecliConnectionProvider`,\n * so we just register this screen's channelId and read the shared status.\n * This avoids racing `gatewayConnect` mutations with the header's\n * `GatewayConnector` (which previously ran its own `useCdecliAutoConnect`\n * and could clobber the chat session binding).\n */\n const cdecli = useCdecliConnection();\n const effectivePersistenceMode = cdecli.persistenceMode ?? 'backend';\n\n useEffect(() => {\n if (!channelId) return undefined;\n cdecli.setActiveChannelId(channelId);\n return () => {\n cdecli.setActiveChannelId(undefined);\n };\n }, [channelId, cdecli.setActiveChannelId]);\n\n const chatRouting: UseChatStreamRouting = useMemo(\n () => ({\n channelConnected: cdecli.channelConnected,\n accountId: cdecli.accountId,\n persistenceMode: effectivePersistenceMode,\n }),\n [cdecli.channelConnected, cdecli.accountId, effectivePersistenceMode],\n );\n\n const chat = useChatStream(channelId, chatRouting);\n\n /**\n * Gifted-shaped transcript rows, memoised on `messages` alone.\n *\n * This screen re-renders on every streamed token — `useChatStream` does\n * `setResponse((r) => r + text)` per delta. Building this array inline in\n * the JSX therefore handed `PlanModeView` a fresh `messages` identity on\n * every token, which invalidated its own `useMemo([messages, …])`, re-mapped\n * every row, and re-rendered every bubble. Assistant bubbles render through\n * `react-native-markdown-display`, so that meant re-parsing the markdown of\n * the whole thread once per token — O(messages) parses per delta, on the JS\n * thread, which is exactly when the UI has to stay responsive.\n *\n * `messages` is already stable upstream (`useChatApi` memoises it on the\n * Apollo result), so this only rebuilds when a message is actually added or\n * changed.\n */\n const transcriptRows = useMemo(\n () =>\n chat.messages.map((msg, index) => ({\n id: `msg-${index}-${msg.role}`,\n role: msg.role,\n content: msg.content,\n attachments: msg.attachments,\n metadata: (msg as { metadata?: unknown }).metadata,\n })),\n [chat.messages],\n );\n const { messages, response, error: chatError, isLoading, isStreaming, messagesLoading, sendMessage, cancel } = chat;\n\n /**\n * \"Try again\" on an assistant message: resend the nearest preceding user\n * prompt on the same channel. Row ids are `msg-<index>-<role>` (see\n * transcriptRows), so the transcript index comes straight out of the id.\n */\n const regenerateFrom = useCallback(\n (messageId: string) => {\n const match = /^msg-(\\d+)-assistant$/.exec(messageId);\n if (!match || !channelId) return;\n for (let i = Number(match[1]) - 1; i >= 0; i -= 1) {\n const prior = chat.messages[i];\n if (prior?.role === 'user' && (prior.content?.trim() || prior.attachments?.length)) {\n void chat.sendMessage(prior.content, prior.attachments, channelId);\n return;\n }\n }\n },\n [chat, channelId],\n );\n\n const chatBusy = isLoading || isStreaming;\n const renderMessageActions = useCallback(\n (message: { id: string; role: string; content: string }) =>\n message.role === 'assistant' ? (\n <MessageActionBar\n text={message.content}\n onRegenerate={chatBusy ? undefined : () => regenerateFrom(message.id)}\n />\n ) : null,\n [chatBusy, regenerateFrom],\n );\n\n const imageAttachments = useImageAttachments();\n\n /*\n * Composer state — kept local so it doesn't leak across navigations.\n *\n * `valueRef` mirrors the controlled `value` so `handleSend` can read the\n * latest text without taking a dependency on it. Without this, `handleSend`\n * (and therefore `micSendButton.onSend`) would be recreated on every\n * keystroke, which is unnecessary churn for `InputToolBar`.\n *\n * `inputRef` is forwarded to InputToolBar's TextInput so we can call\n * `.clear()` imperatively after sending. On iOS, the native text buffer\n * can stay desynced from the controlled `value` for a frame when a state\n * update is followed by an async dispatch in the same gesture — the\n * \"send-and-clear\" race. The imperative clear closes that gap deterministically.\n */\n const [value, setValue] = useState('');\n const valueRef = useRef(value);\n valueRef.current = value;\n const inputRef = useRef<TextInput>(null);\n const trimmed = value.trim();\n const hasQuery = trimmed.length > 0;\n const hasAttachments = imageAttachments.pending.length > 0;\n const canSubmit = (hasQuery || hasAttachments) && Boolean(channelId);\n\n /**\n * Composer mode is FREELY user-controlled, mirroring `HomeScreen`.\n *\n * Seed:\n * • From Home (which forwards `initialMode` alongside `initialQuery`):\n * start in whatever mode the user picked there so the \"research from\n * home → research-shaped chat\" hand-off feels continuous.\n * • From ChatHistory (which intentionally does NOT pass `initialMode`):\n * default to `'chat'`, same as Home's empty composer.\n *\n * Post-mount this is a normal local state — the search/zap pills toggle\n * it on tap, and every place that previously branched on\n * `params.initialMode` now branches on `activeMode` instead.\n */\n const [activeMode, setActiveMode] = useState<RoutingMode>(() =>\n params.initialMode === 'deep-search' ? 'deep-search' : params.initialMode === 'build' ? 'build' : 'chat',\n );\n const handleModeSwitch = useCallback((mode: RoutingMode) => {\n setActiveMode(mode);\n }, []);\n const isDeepSearchMode = activeMode === 'deep-search';\n const isBuildMode = activeMode === 'build';\n\n /**\n * Inline voice recorder state — parity with HomeScreen and the web\n * `YantraSearchComposer.showAudioRecorder` flow. When active, the panel\n * fully replaces the InputToolBar so the toolbar's mic→send button\n * doesn't compete with the panel's own send/cancel affordances.\n */\n const [showAudioRecorder, setShowAudioRecorder] = useState(false);\n const [voiceError, setVoiceError] = useState<string | null>(null);\n\n /**\n * Auto-fire the initial query once when the screen mounts on a fresh channel.\n * Home creates the channel optimistically and forwards the user prompt here so\n * the first assistant token arrives without an extra interaction.\n *\n * Wait for CDeCLI to finish connecting (or fail) before auto-firing — chat is\n * cdecli-only and `sendMessage` rejects sends while the gateway is disconnected.\n */\n const autoFiredRef = useRef(false);\n useEffect(() => {\n if (autoFiredRef.current) return;\n if (!channelId) return;\n if (cdecli.status !== 'connected' && cdecli.status !== 'error') return;\n const stashed = hasComposerAttachments(channelId) ? takeComposerAttachments(channelId) : undefined;\n if (!initialQuery && !stashed?.length) return;\n\n autoFiredRef.current = true;\n // Deep-search auto-fire from Home: open the structured modal at the\n // same instant we kick off the send so the user sees the research view\n // streaming in rather than raw assistant turns. Tied to the\n // sendMessage call (same event) to avoid a race where the modal opens\n // before/after the actual send.\n //\n // We branch on the LOCAL `isDeepSearchMode` instead of\n // `params.initialMode`. At auto-fire time they're equal (the local\n // state was seeded from the param), and using the local state means\n // future toggles drive the same code path consistently.\n if (isDeepSearchMode) {\n setIsDeepSearchModalOpen(true);\n }\n void sendMessage(initialQuery ?? '', stashed, channelId);\n try {\n navigation.setParams({ initialQuery: null, initialAttachments: null });\n } catch {\n /* setParams may be unavailable in tests; clearing is best-effort. */\n }\n }, [channelId, initialQuery, initialAttachments, sendMessage, navigation, cdecli.status, isDeepSearchMode]);\n\n const handleSend = useCallback(\n (text?: string) => {\n const pending = imageAttachments.forSend();\n const t = (text ?? valueRef.current).trim();\n if ((!t && !pending?.length) || !channelId) return;\n // Clear both ways: the controlled state (so React's model stays\n // consistent on next render) AND the native buffer via the ref\n // (so the visible text disappears on the same frame the user\n // pressed send, even before React flushes).\n setValue('');\n inputRef.current?.clear();\n\n // Build mode: hand off to Web Builder on this channel (web `/c/:id/webbuilder`).\n if (isBuildMode) {\n navigation.dispatch(\n CommonActions.navigate({\n name: 'MainStack.WebBuilder',\n params: {\n ...(params.orgName ? { orgName: params.orgName } : {}),\n channelId,\n message: t,\n },\n }),\n );\n return;\n }\n\n // Deep-search mode: every new query pops the structured research\n // modal back open (parity with the previous Home flow, where every\n // submit re-opened the DeepSearchModal). Without this, a user who\n // closed the modal once would see plain assistant turns for every\n // subsequent send. Reads the LOCAL `isDeepSearchMode` so the user\n // can toggle modes mid-thread and have sends behave accordingly.\n if (isDeepSearchMode) {\n setIsDeepSearchModalOpen(true);\n }\n void sendMessage(t, pending, channelId);\n imageAttachments.clear();\n },\n [channelId, sendMessage, isDeepSearchMode, isBuildMode, navigation, params.orgName, imageAttachments],\n );\n\n const handleValueChange = useCallback((e: any) => {\n setValue(e?.nativeEvent?.text ?? '');\n }, []);\n\n /**\n * Mic affordance — web parity (`handleMicClick` in `YantraSearchComposer.tsx`).\n * The shared `MicSendButton` in `InputToolBar.tsx` only routes to `onMic`\n * when the input has no content, so we only need to handle the empty-input\n * case here.\n *\n * Permission is requested HERE, before the panel mounts. The previous flow\n * flipped `showAudioRecorder=true` immediately, which mounted\n * `AudioRecorderPanel` and constructed the native `AVAudioRecorder` via\n * `useAudioRecorder()` during the panel's render phase — before iOS had\n * granted mic access. On SDK 53 + `newArchEnabled: true` + Hermes that\n * ordering hard-crashes TestFlight builds even though it works in Expo Go\n * (Expo Go pre-caches permission). Asking up front means iOS shows the\n * system alert first and the panel only mounts (and therefore the native\n * recorder is only allocated) once permission is granted.\n *\n * `expo-audio` is lazy-imported so a missing/broken native module surfaces\n * as a user-visible banner instead of a synchronous TurboModule crash.\n */\n const handleMicPress = useCallback(() => {\n if (hasQuery) return;\n setVoiceError(null);\n Keyboard.dismiss();\n void (async () => {\n const { granted, error } = await requestMicPermission();\n if (!granted) {\n setVoiceError(error || 'Microphone is not available.');\n return;\n }\n setShowAudioRecorder(true);\n })();\n }, [hasQuery]);\n\n /**\n * On a successful Whisper round-trip, paste the transcript into the input\n * field, close the recorder, and let the user review/send manually. Matches\n * web's `handleTranscriptionComplete`: we deliberately do NOT auto-fire\n * `sendMessage` because the user often wants to edit the dictation first.\n */\n const handleTranscriptionComplete = useCallback((text: string) => {\n const cleaned = (text ?? '').trim();\n setShowAudioRecorder(false);\n if (!cleaned) return;\n setValue((prev) => {\n const next = prev.trim().length > 0 ? `${prev.trim()} ${cleaned}` : cleaned;\n /*\n * Keep `inputRef`'s native text in sync with our controlled value\n * for the same reason `handleSend` does (the iOS native buffer\n * can lag the React state across a single gesture). `setNativeProps`\n * is the safe way to do this without re-rendering.\n */\n requestAnimationFrame(() => {\n inputRef.current?.setNativeProps?.({ text: next });\n inputRef.current?.focus?.();\n });\n return next;\n });\n }, []);\n\n const handleRecorderCancel = useCallback(() => {\n setShowAudioRecorder(false);\n }, []);\n\n const handleRecorderError = useCallback((error: string) => {\n setVoiceError(error);\n }, []);\n\n const waitingForAssistant = useMemo(() => {\n if ((!isLoading && !isStreaming) || messages.length === 0) return false;\n if ((response ?? '').trim()) return false;\n return messages[messages.length - 1]?.role === 'user';\n }, [isLoading, isStreaming, messages, response]);\n\n /*\n * NOTE: the previous read-only `isDeepSearchChannel` derivation has been\n * removed. Mode is now a freely-toggleable local state (`activeMode`)\n * driven by tapping the search/zap pills, mirroring HomeScreen. All\n * downstream branches use `isDeepSearchMode` declared with the rest of\n * the composer state above.\n */\n\n /**\n * Deep-search overlay state.\n *\n * Restored from the previous Home-screen flow (commit history): a deep-search\n * channel renders the structured `DeepSearchModal` (query / live summary /\n * sources / research process) on top of the regular Chat conversation. Closing\n * the modal reveals the same channel's transcript underneath so the\n * user can still see the raw turns.\n *\n * Trigger semantics — IMPORTANT:\n * • Opens ONLY when a request is actually fired in this session:\n * - Home → Chat auto-fire of `initialQuery`\n * - User sends a new message in a deep-search channel from the composer\n * - Explicit retry from inside the modal\n * • Does NOT open on plain entry from ChatHistoryScreen. That's a revisit\n * of an already-completed thread — no new API call, nothing live to\n * stream, so popping the modal would just be a confusing flash. The\n * user still sees the deep-search rendering in the chat conversation\n * underneath, and any new send re-opens the live view.\n *\n * Local UI state (accordions, open flag) lives here; data state (query /\n * summary / sources) is DERIVED from the chat stream, not stored separately,\n * so there's no drift between the modal and the underlying conversation.\n */\n const [isDeepSearchModalOpen, setIsDeepSearchModalOpen] = useState(false);\n const [researchProcessOpen, setResearchProcessOpen] = useState(true);\n const [sourcesAccordionOpen, setSourcesAccordionOpen] = useState(true);\n\n /**\n * Modal data is always scoped to the CURRENT run, not the whole channel.\n * In a multi-turn deep-search channel each send is its own \"run\": one user\n * query → one assistant summary. If we sourced from \"first user message\" /\n * \"any assistant message\", a follow-up send would keep showing the previous\n * run's query and stale sources during the transient window between the new\n * user message being appended and the first stream token arriving.\n *\n * Cursor: the LAST user message in the thread. The assistant content for\n * the current run is either:\n * • `response` while the stream is filling (token-by-token), OR\n * • the assistant message that comes AFTER the last user (run complete), OR\n * • empty — covers the brief \"user message appended, no response yet\"\n * window so the modal flips to \"Running...\" with no stale body.\n */\n const lastUserIndex = useMemo(() => {\n for (let i = messages.length - 1; i >= 0; i -= 1) {\n if (messages[i]?.role === 'user') return i;\n }\n return -1;\n }, [messages]);\n\n const deepSearchQuery = useMemo(() => {\n if (lastUserIndex >= 0) {\n const txt = messages[lastUserIndex]?.content?.trim();\n if (txt) return txt;\n }\n return initialQuery ?? null;\n }, [messages, lastUserIndex, initialQuery]);\n\n const latestAssistantContent = useMemo(() => {\n if (response && response.trim()) return response;\n if (lastUserIndex < 0) return '';\n // Look for an assistant turn strictly AFTER the last user message.\n // Anything before it belongs to a prior run and must not leak into\n // the modal for the current one.\n for (let i = lastUserIndex + 1; i < messages.length; i += 1) {\n if (messages[i]?.role === 'assistant') {\n return messages[i]?.content ?? '';\n }\n }\n return '';\n }, [response, messages, lastUserIndex]);\n\n const deepSearchSummary = useMemo(() => normalizeSummaryText(latestAssistantContent), [latestAssistantContent]);\n const deepSearchSources: DeepSearchSourceItem[] = useMemo(\n () => extractDeepSearchSources(latestAssistantContent),\n [latestAssistantContent],\n );\n\n const handleDeepSearchClose = useCallback(() => {\n if (isStreaming) cancel();\n setIsDeepSearchModalOpen(false);\n }, [isStreaming, cancel]);\n\n const handleDeepSearchRetry = useCallback(() => {\n if (!deepSearchQuery || isStreaming || !channelId) return;\n void sendMessage(deepSearchQuery, undefined, channelId);\n }, [deepSearchQuery, isStreaming, channelId, sendMessage]);\n const leftItems = useMemo(\n () =>\n getDefaultLeftItems({\n search: { active: activeMode === 'chat', onClick: () => handleModeSwitch('chat') },\n zap: { active: activeMode === 'deep-search', onClick: () => handleModeSwitch('deep-search') },\n lightbulb: {\n active: activeMode === 'build',\n onClick: () => handleModeSwitch('build'),\n },\n }),\n [activeMode, handleModeSwitch],\n );\n const rightItems = useMemo(\n () =>\n getDefaultRightItems({\n tag: { enabled: false },\n chip: { enabled: false },\n // Attaching an image was disabled here even though the transport\n // (`sendMessage(content, attachments)`) and the gateway media lane\n // already carried it, and `expo-image-picker` was already a\n // dependency with its permission strings declared in app.json.\n camera: {\n enabled: true,\n loading: imageAttachments.busyKind === 'camera',\n onClick: () => {\n void imageAttachments.captureFromCamera();\n },\n },\n image: {\n enabled: true,\n loading: imageAttachments.busyKind === 'library',\n onClick: () => {\n void imageAttachments.pickFromLibrary();\n },\n },\n attach: {\n enabled: true,\n loading: imageAttachments.busyKind === 'documents',\n onClick: () => {\n void imageAttachments.pickDocuments();\n },\n },\n }),\n [imageAttachments],\n );\n /**\n * Composer placeholder.\n *\n * Mirrors Home so the composer feels like the same affordance across the\n * \"first message\" and \"continuing thread\" surfaces — only the surrounding\n * UI changes, the input stays a stable anchor. We intentionally do NOT\n * surface a \"Loading conversation…\" state in the placeholder: the message\n * list already shows a dedicated hydrating loader, and switching the\n * placeholder for ~1 frame creates a visible flash on every entry.\n */\n const inputPlaceholder = isDeepSearchMode\n ? 'Research anything...'\n : isBuildMode\n ? 'Describe an app to build...'\n : 'Ask anything...';\n\n const inputConfig = useMemo(\n () => ({\n value,\n onChange: handleValueChange,\n placeholder: inputPlaceholder,\n disabled: !channelId,\n inputRef,\n returnKeyType: 'send',\n blurOnSubmit: false,\n onSubmitEditing: () => handleSend(),\n }),\n [value, handleValueChange, inputPlaceholder, channelId, handleSend],\n );\n const micSendButton = useMemo(\n () => ({\n hasContent: hasQuery || hasAttachments,\n onSend: () => handleSend(),\n onMic: handleMicPress,\n disabled: !channelId,\n // Empty + streaming → Stop. Typed follow-up → Send (steer). Never lock the composer.\n isLoading: canSubmit ? false : isLoading,\n onStop: isStreaming && !canSubmit ? cancel : undefined,\n steerable: isLoading || isStreaming,\n }),\n [canSubmit, handleSend, handleMicPress, isLoading, channelId, isStreaming, cancel, hasQuery, hasAttachments],\n );\n\n /**\n * Loader visibility:\n * - `isHydrating`: Apollo channel history is being fetched and we have nothing to show yet.\n * - `isWaitingForGateway`: Home navigated us here with an `initialQuery`, but CDeCLI is still\n * establishing the workspace session, so the auto-fire is deferred. Show a \"Connecting…\"\n * placeholder instead of an empty thread so the user doesn't think their send was dropped.\n */\n const isHydrating = messagesLoading && messages.length === 0 && !response;\n const isWaitingForGateway =\n !autoFiredRef.current &&\n !!channelId &&\n (!!initialQuery || hasComposerAttachments(channelId)) &&\n cdecli.status !== 'connected' &&\n cdecli.status !== 'error';\n const showSendingLoader = waitingForAssistant;\n const pinSendingLoaderNearComposer = messages.length > 0 || Boolean((response ?? '').trim());\n\n return (\n <SafeAreaView edges={['left', 'right']} style={{ flex: 1, backgroundColor: surfaceColor }}>\n <Box flex={1} width=\"100%\" position=\"relative\">\n {(chatError || cdecli.error) && (\n <Box\n mb=\"$2\"\n mx=\"$4\"\n p=\"$3\"\n borderRadius=\"$md\"\n style={{\n backgroundColor: isDark ? '#2b1a1d' : '#fef2f2',\n borderWidth: 1,\n borderColor: isDark ? '#7f1d1d' : '#fecaca',\n }}\n >\n <Text fontSize=\"$sm\" style={{ color: isDark ? '#fecaca' : '#991b1b' }}>\n {chatError || cdecli.error}\n </Text>\n </Box>\n )}\n {!channelId ? (\n <Box flex={1} alignItems=\"center\" justifyContent=\"center\">\n <YantraBrandLoader size={YANTRA_LOADER_SIZE_COMPACT} />\n <Text style={[styles.statusText, { color: secondaryTextColor }]}>No channel selected</Text>\n </Box>\n ) : isHydrating ? (\n /**\n * Channel hydration (entering Chat from history or a deep\n * link) reuses the same `ThinkingIndicator` row as the\n * chat-history list — thin spinning arc + muted caption.\n * Keeps the loading vocabulary consistent across screens\n * and avoids the previous branded loader + \"Loading\n * conversation\" copy that read as a different state.\n */\n <Box flex={1} alignItems=\"center\" justifyContent=\"center\">\n <ThinkingIndicator color={secondaryTextColor} />\n </Box>\n ) : isWaitingForGateway ? (\n <Box flex={1} alignItems=\"center\" justifyContent=\"center\">\n <YantraBrandLoader size={YANTRA_LOADER_SIZE_COMPACT} />\n <Text style={[styles.statusText, { color: secondaryTextColor }]}>Connecting gateway…</Text>\n </Box>\n ) : (\n <Box flex={1} width=\"100%\" alignSelf=\"stretch\">\n <ChatTranscript\n messages={transcriptRows}\n streamingContent={response}\n renderMessageActions={renderMessageActions}\n isDark={isDark}\n keyboardVisible={keyboardVisible}\n listContentStyle={{\n paddingTop: 12,\n paddingBottom: 8,\n margin: 0,\n width: contentMaxWidth,\n alignSelf: 'center',\n }}\n />\n </Box>\n )}\n {showSendingLoader && !pinSendingLoaderNearComposer ? (\n <View pointerEvents=\"none\" style={styles.sendingLoaderEmptyState}>\n <ThinkingIndicator color={secondaryTextColor} />\n </View>\n ) : null}\n <KeyboardComposerDock closedInset={insets.bottom} keyboardVisible={keyboardVisible}>\n {showSendingLoader && pinSendingLoaderNearComposer ? (\n <View pointerEvents=\"none\" style={styles.sendingLoaderInDock}>\n <ThinkingIndicator color={secondaryTextColor} />\n </View>\n ) : null}\n <View style={[styles.bottomComposerInner, { width: contentMaxWidth }]}>\n {voiceError || imageAttachments.error ? (\n <View\n style={[\n styles.voiceErrorBanner,\n {\n backgroundColor: isDark ? '#2b1a1d' : '#fef2f2',\n borderColor: isDark ? '#7f1d1d' : '#fecaca',\n },\n ]}\n >\n <Text style={[styles.voiceErrorText, { color: isDark ? '#fecaca' : '#991b1b' }]}>\n {voiceError || imageAttachments.error}\n </Text>\n </View>\n ) : null}\n {showAudioRecorder ? (\n /*\n * Render-time JS errors thrown by `useAudioRecorder`\n * (e.g. expo-audio native module missing, recorder\n * constructor throws in a release build) are caught\n * by the boundary and converted into a soft cancel\n * via the same handlers the panel itself uses on\n * runtime errors. Without this, a throw during the\n * panel's render phase kills the JS thread in\n * release / TestFlight.\n */\n <MicErrorBoundary onCancel={handleRecorderCancel} onError={handleRecorderError}>\n <AudioRecorderPanel\n isDark={isDark}\n onTranscriptionComplete={handleTranscriptionComplete}\n onCancel={handleRecorderCancel}\n onError={handleRecorderError}\n />\n </MicErrorBoundary>\n ) : (\n <>\n <ComposerAttachmentBar\n attachments={imageAttachments.pending}\n onRemove={imageAttachments.remove}\n isDark={isDark}\n />\n <InputToolBar\n inputConfig={inputConfig}\n leftItems={leftItems}\n rightItems={rightItems}\n templateButton={null}\n templateModalConfig={null}\n micSendButton={micSendButton}\n />\n </>\n )}\n </View>\n </KeyboardComposerDock>\n </Box>\n {isDeepSearchMode ? (\n <DeepSearchModal\n visible={isDeepSearchModalOpen}\n query={deepSearchQuery}\n summaryText={deepSearchSummary}\n sources={deepSearchSources}\n isStreaming={isStreaming}\n researchProcessOpen={researchProcessOpen}\n sourcesAccordionOpen={sourcesAccordionOpen}\n onToggleResearchProcess={() => setResearchProcessOpen((prev) => !prev)}\n onToggleSourcesAccordion={() => setSourcesAccordionOpen((prev) => !prev)}\n onRetry={handleDeepSearchRetry}\n onStop={cancel}\n onClose={handleDeepSearchClose}\n />\n ) : null}\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n statusText: {\n marginTop: 14,\n fontSize: 13,\n fontWeight: '500',\n },\n bottomComposerInner: {\n paddingHorizontal: 14,\n paddingTop: 10,\n paddingBottom: 4,\n },\n voiceErrorBanner: {\n marginBottom: 8,\n paddingHorizontal: 12,\n paddingVertical: 8,\n borderRadius: 10,\n borderWidth: 1,\n },\n voiceErrorText: {\n fontSize: 12,\n fontWeight: '500',\n },\n sendingLoaderEmptyState: {\n position: 'absolute',\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 40,\n },\n sendingLoaderInDock: {\n alignItems: 'center',\n justifyContent: 'flex-end',\n paddingBottom: 8,\n },\n});\n"],"names":["_a","_b"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,SAAwB,UAAa,GAAA;AApDrC,EAAA,IAAA,EAAA,EAAA,EAAA;AAqDE,EAAA,MAAM,aAAa,aAAmB,EAAA;AACtC,EAAA,MAAM,QAAQ,QAAc,EAAA;AAC5B,EAAA,MAAM,MAAU,GAAA,CAAA,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,MAAP,KAAA,IAAA,GAAA,EAAA,GAAiB,EAA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AAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,cAAgB,EAAA,QAAA;AAAA,IAChB,UAAY,EAAA,QAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,mBAAqB,EAAA;AAAA,IACnB,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA,UAAA;AAAA,IAChB,aAAe,EAAA;AAAA;AAEnB,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import {jsx}from'react/jsx-runtime';import {useMemo,useCallback}from'react';import {useColorScheme,StyleSheet}from'react-native';import {SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {mobileTokens}from'../../theme/mobileTokens.js';import ChatHistoryLanding from'../Home/components/ChatHistoryLanding.js';var __defProp = Object.defineProperty;
1
+ import {jsx}from'react/jsx-runtime';import {useMemo,useCallback}from'react';import {useColorScheme,StyleSheet}from'react-native';import {SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {mobileTokens}from'../../theme/mobileTokens.js';import ChatHistoryLanding from'../Home/components/ChatHistoryLanding.js';import {navigateToNewChatHome}from'../../utils/navigateToNewChatHome.js';var __defProp = Object.defineProperty;
2
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
4
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -48,13 +48,7 @@ function ChatHistoryScreen() {
48
48
  }));
49
49
  }, [navigation, orgName]);
50
50
  const handleCompose = useCallback(() => {
51
- navigation.dispatch(CommonActions.navigate({
52
- name: "MainStack.Layout.Home",
53
- params: orgName ? {
54
- orgName
55
- } : void 0,
56
- merge: true
57
- }));
51
+ navigateToNewChatHome(navigation, orgName);
58
52
  }, [navigation, orgName]);
59
53
  return /* @__PURE__ */ jsx(SafeAreaView, { edges: ["left", "right", "bottom"], style: [styles.container, {
60
54
  backgroundColor: surfaceColor
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/screens/ChatHistory/index.tsx"],"sourcesContent":["/**\n * Standalone Chat History screen.\n *\n * Header chrome (back, title, gateway pill, new-chat shortcut) is owned entirely\n * by `NavigationHeader` via `customHeader.props` in `compute.ts` — this screen\n * contains no header logic.\n */\nimport React, { useCallback, useMemo } from 'react';\nimport { StyleSheet, useColorScheme } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { CommonActions, useNavigation, useRoute } from '@react-navigation/native';\nimport { mobileTokens } from '../../theme/mobileTokens';\nimport ChatHistoryLanding from '../Home/components/ChatHistoryLanding';\nimport type { ChatHistoryMode } from '../../hooks/useChatApi';\n\nexport interface ChatHistoryRouteParams {\n orgName?: string | null;\n}\n\nexport default function ChatHistoryScreen() {\n const navigation = useNavigation<any>();\n const route = useRoute<any>();\n const colorScheme = useColorScheme();\n const isDark = colorScheme === 'dark';\n\n const orgName = useMemo(() => {\n const raw = (route?.params?.orgName as string | undefined) ?? '';\n return typeof raw === 'string' && raw.trim() ? raw.trim() : null;\n }, [route?.params?.orgName]);\n\n const surfaceColor = isDark ? '#0f172a' : mobileTokens.color.surface;\n\n /**\n * Reopen the original surface: build sessions go back to Web Builder\n * (`/c/:channelId/webbuilder`), matching browser history. Chat / deep-search\n * stay on Chat. Do not pass `message` on build reopen or the surface will\n * treat it as a new generate.\n */\n const handleSelectSession = useCallback(\n (channelId: string, mode: ChatHistoryMode) => {\n if (mode === 'build') {\n navigation.dispatch(\n CommonActions.navigate({\n name: 'MainStack.WebBuilder',\n params: {\n channelId,\n ...(orgName ? { orgName } : {}),\n },\n }),\n );\n return;\n }\n navigation.dispatch(\n CommonActions.navigate({\n name: 'MainStack.Chat',\n params: {\n channelId,\n ...(orgName ? { orgName } : {}),\n },\n }),\n );\n },\n [navigation, orgName],\n );\n\n const handleCompose = useCallback(() => {\n navigation.dispatch(\n CommonActions.navigate({\n name: 'MainStack.Layout.Home',\n params: orgName ? { orgName } : undefined,\n merge: true,\n }),\n );\n }, [navigation, orgName]);\n\n return (\n <SafeAreaView edges={['left', 'right', 'bottom']} style={[styles.container, { backgroundColor: surfaceColor }]}>\n <ChatHistoryLanding onSelectSession={handleSelectSession} onCompose={handleCompose} />\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAAwB,iBAAoB,GAAA;AAjB5C,EAAA,IAAA,EAAA;AAkBE,EAAA,MAAM,aAAa,aAAmB,EAAA;AACtC,EAAA,MAAM,QAAQ,QAAc,EAAA;AAC5B,EAAA,MAAM,cAAc,cAAe,EAAA;AACnC,EAAA,MAAM,SAAS,WAAgB,KAAA,MAAA;AAC/B,EAAM,MAAA,OAAA,GAAU,QAAQ,MAAM;AAtBhC,IAAA,IAAAA,GAAA,EAAA,EAAA;AAuBI,IAAM,MAAA,GAAA,GAAA,CAAM,MAAAA,GAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,WAAP,IAAAA,GAAAA,MAAAA,GAAAA,GAAAA,CAAe,YAAf,IAAgD,GAAA,EAAA,GAAA,EAAA;AAC5D,IAAO,OAAA,OAAO,QAAQ,QAAY,IAAA,GAAA,CAAI,MAAS,GAAA,GAAA,CAAI,MAAS,GAAA,IAAA;AAAA,KAC3D,CAAC,CAAA,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,MAAP,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAe,OAAO,CAAC,CAAA;AAC3B,EAAA,MAAM,YAAe,GAAA,MAAA,GAAS,SAAY,GAAA,YAAA,CAAa,KAAM,CAAA,OAAA;AAQ7D,EAAA,MAAM,mBAAsB,GAAA,WAAA,CAAY,CAAC,SAAA,EAAmB,IAA0B,KAAA;AACpF,IAAA,IAAI,SAAS,OAAS,EAAA;AACpB,MAAW,UAAA,CAAA,QAAA,CAAS,cAA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":["/**\n * Standalone Chat History screen.\n *\n * Header chrome (back, title, gateway pill, new-chat shortcut) is owned entirely\n * by `NavigationHeader` via `customHeader.props` in `compute.ts` — this screen\n * contains no header logic.\n */\nimport React, { useCallback, useMemo } from 'react';\nimport { StyleSheet, useColorScheme } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\nimport { CommonActions, useNavigation, useRoute } from '@react-navigation/native';\nimport { mobileTokens } from '../../theme/mobileTokens';\nimport ChatHistoryLanding from '../Home/components/ChatHistoryLanding';\nimport type { ChatHistoryMode } from '../../hooks/useChatApi';\nimport { navigateToNewChatHome } from '../../utils/navigateToNewChatHome';\n\nexport interface ChatHistoryRouteParams {\n orgName?: string | null;\n}\n\nexport default function ChatHistoryScreen() {\n const navigation = useNavigation<any>();\n const route = useRoute<any>();\n const colorScheme = useColorScheme();\n const isDark = colorScheme === 'dark';\n\n const orgName = useMemo(() => {\n const raw = (route?.params?.orgName as string | undefined) ?? '';\n return typeof raw === 'string' && raw.trim() ? raw.trim() : null;\n }, [route?.params?.orgName]);\n\n const surfaceColor = isDark ? '#0f172a' : mobileTokens.color.surface;\n\n /**\n * Reopen the original surface: build sessions go back to Web Builder\n * (`/c/:channelId/webbuilder`), matching browser history. Chat / deep-search\n * stay on Chat. Do not pass `message` on build reopen or the surface will\n * treat it as a new generate.\n */\n const handleSelectSession = useCallback(\n (channelId: string, mode: ChatHistoryMode) => {\n if (mode === 'build') {\n navigation.dispatch(\n CommonActions.navigate({\n name: 'MainStack.WebBuilder',\n params: {\n channelId,\n ...(orgName ? { orgName } : {}),\n },\n }),\n );\n return;\n }\n navigation.dispatch(\n CommonActions.navigate({\n name: 'MainStack.Chat',\n params: {\n channelId,\n ...(orgName ? { orgName } : {}),\n },\n }),\n );\n },\n [navigation, orgName],\n );\n\n const handleCompose = useCallback(() => {\n navigateToNewChatHome(navigation, orgName);\n }, [navigation, orgName]);\n\n return (\n <SafeAreaView edges={['left', 'right', 'bottom']} style={[styles.container, { backgroundColor: surfaceColor }]}>\n <ChatHistoryLanding onSelectSession={handleSelectSession} onCompose={handleCompose} />\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAAwB,iBAAoB,GAAA;AAlB5C,EAAA,IAAA,EAAA;AAmBE,EAAA,MAAM,aAAa,aAAmB,EAAA;AACtC,EAAA,MAAM,QAAQ,QAAc,EAAA;AAC5B,EAAA,MAAM,cAAc,cAAe,EAAA;AACnC,EAAA,MAAM,SAAS,WAAgB,KAAA,MAAA;AAC/B,EAAM,MAAA,OAAA,GAAU,QAAQ,MAAM;AAvBhC,IAAA,IAAAA,GAAA,EAAA,EAAA;AAwBI,IAAM,MAAA,GAAA,GAAA,CAAM,MAAAA,GAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,WAAP,IAAAA,GAAAA,MAAAA,GAAAA,GAAAA,CAAe,YAAf,IAAgD,GAAA,EAAA,GAAA,EAAA;AAC5D,IAAO,OAAA,OAAO,QAAQ,QAAY,IAAA,GAAA,CAAI,MAAS,GAAA,GAAA,CAAI,MAAS,GAAA,IAAA;AAAA,KAC3D,CAAC,CAAA,EAAA,GAAA,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,MAAP,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAe,OAAO,CAAC,CAAA;AAC3B,EAAA,MAAM,YAAe,GAAA,MAAA,GAAS,SAAY,GAAA,YAAA,CAAa,KAAM,CAAA,OAAA;AAQ7D,EAAA,MAAM,mBAAsB,GAAA,WAAA,CAAY,CAAC,SAAA,EAAmB,IAA0B,KAAA;AACpF,IAAA,IAAI,SAAS,OAAS,EAAA;AACpB,MAAW,UAAA,CAAA,QAAA,CAAS,cAAc,QAAS,CAAA;AAAA,QACzC,IAAM,EAAA,sBAAA;AAAA,QACN,MAAQ,EAAA,cAAA,CAAA;AAAA,U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