@adminide-stack/yantra-mobile 12.0.87-alpha.0 → 12.0.87-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/features/chat/PreResponseStrip.js +4 -4
- package/lib/features/chat/PreResponseStrip.js.map +1 -1
- package/lib/features/chat/ToolTimeline.js +4 -4
- package/lib/features/chat/ToolTimeline.js.map +1 -1
- package/lib/features/shopping/ProductPhoto.js +9 -3
- package/lib/features/shopping/ProductPhoto.js.map +1 -1
- package/lib/features/shopping/ShoppingAgentChatPane.js +19 -9
- package/lib/features/shopping/ShoppingAgentChatPane.js.map +1 -1
- package/lib/features/shopping/chat/openShopNative.js +15 -3
- package/lib/features/shopping/chat/openShopNative.js.map +1 -1
- package/lib/features/shopping/chat/searchScope.js +33 -0
- package/lib/features/shopping/chat/searchScope.js.map +1 -0
- package/lib/features/shopping/chat/streamAssistantReply.js +3 -2
- package/lib/features/shopping/chat/streamAssistantReply.js.map +1 -1
- package/lib/hooks/useHostConnectorCard.js +35 -3
- package/lib/hooks/useHostConnectorCard.js.map +1 -1
- package/lib/screens/Chat/index.js +19 -11
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +14 -13
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/ShoppingNative/useShoppingHostChat.js +5 -4
- package/lib/screens/ShoppingNative/useShoppingHostChat.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchScope.js","sources":["../../../../src/features/shopping/chat/searchScope.ts"],"sourcesContent":["/**\n * How the Shopping Agent pane shapes a two-phase search before it reaches the\n * reply bubble and the product card.\n *\n * The search paints a fast lane first and a cross-retailer lane ~10s later. The\n * pane used to take the second result as it came: a re-ranked list that rewrote\n * the reply already on screen (\"1. Air Vent Filters…\" became \"1. 50000 BTU/Hr\n * Monterey…\") and, for \"cooking furnace vent in amazon\", replaced the Amazon\n * rows the person asked for with Walmart, eBay and Target ones.\n */\nimport { SOURCE_LABELS, type Product, type ProductSource } from '../catalog';\n\n/** Retailers a person names in a shopping ask, keyed by how they write them. */\nconst RETAILER_NAMES: ReadonlyArray<[RegExp, ProductSource]> = [\n [/amazon(?:\\.com)?/, 'amazon'],\n [/walmart(?:\\.com)?/, 'walmart'],\n [/best\\s*buy/, 'bestbuy'],\n [/e-?bay/, 'ebay'],\n [/target(?:\\.com)?/, 'target'],\n [/costco/, 'costco'],\n [/(?:the\\s+)?home\\s*depot/, 'homedepot'],\n [/lowe'?s/, 'lowes'],\n [/newegg/, 'newegg'],\n];\n\n/**\n * The retailer the ask is scoped to (\"in amazon\", \"on Best Buy\", \"from Walmart\"),\n * or null. Only a retailer after a preposition counts, so \"target price\" and\n * \"an eBay-style listing\" never narrow a search.\n */\nexport function namedRetailer(text: string): ProductSource | null {\n const lowered = text.toLowerCase();\n for (const [name, source] of RETAILER_NAMES) {\n const scoped = new RegExp(`\\\\b(?:in|on|at|from|via|through)\\\\s+${name.source}(?![a-z])`);\n if (scoped.test(lowered)) return source;\n }\n return null;\n}\n\n/** \"Amazon\", \"Best Buy\" - the retailer as the reply names it. */\nexport function retailerLabel(source: ProductSource): string {\n return SOURCE_LABELS[source];\n}\n\n/**\n * Rows from the named retailer only. When it has none the whole list stays: an\n * empty card for a retailer that had nothing is worse than its competitors.\n */\nexport function scopeToRetailer(products: Product[], retailer: ProductSource | null): Product[] {\n if (!retailer) return products;\n const only = products.filter((product) => product.source === retailer);\n return only.length > 0 ? only : products;\n}\n\nfunction productKey(product: Product): string {\n return product.url || product.id;\n}\n\n/**\n * `next`, with every row already on screen kept where it was and the new rows\n * after them. A later phase can grow the list; it cannot reshuffle what the\n * person is already reading.\n */\nexport function keepShownOrder(shown: readonly Product[], next: readonly Product[]): Product[] {\n if (shown.length === 0) return [...next];\n const byKey = new Map(next.map((product) => [productKey(product), product]));\n const kept = shown.map((product) => byKey.get(productKey(product))).filter((p): p is Product => Boolean(p));\n const keptKeys = new Set(kept.map(productKey));\n return [...kept, ...next.filter((product) => !keptKeys.has(productKey(product)))];\n}\n\n/**\n * The text points at the attached photos (\"find replacement for this\", \"where\n * can I buy these\"). Searching retailers for those words finds nothing useful -\n * the photo is the query, so the search waits for the agent to name the item.\n */\nexport function refersToAttachment(text: string): boolean {\n return /\\b(?:this|these|that|those|it|them)\\b/i.test(text);\n}\n\n/**\n * The agent's reply already lists products it found: links to product pages. A\n * reply that only names the item (\"that is a range hood mesh filter\") does not.\n */\nexport function listsProducts(text: string): boolean {\n return /\\]\\(https?:\\/\\/[^)\\s]+\\)/.test(text);\n}\n"],"names":[],"mappings":"0CAaA,MAAM,iBAAyD,CAAC,CAAC,kBAAoB,EAAA,QAAQ,GAAG,CAAC,mBAAA,EAAqB,SAAS,CAAA,EAAG,CAAC,YAAc,EAAA,SAAS,CAAG,EAAA,CAAC,UAAU,MAAM,CAAA,EAAG,CAAC,kBAAA,EAAoB,QAAQ,CAAG,EAAA,CAAC,QAAU,EAAA,QAAQ,GAAG,CAAC,yBAAA,EAA2B,WAAW,CAAA,EAAG,CAAC,SAAW,EAAA,OAAO,GAAG,CAAC,QAAA,EAAU,QAAQ,CAAC,CAAA;AAOpT,SAAS,cAAc,IAAoC,EAAA;AAChE,EAAM,MAAA,OAAA,GAAU,KAAK,WAAY,EAAA;AACjC,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,MAAM,CAAA,IAAK,cAAgB,EAAA;AAC3C,IAAA,MAAM,SAAS,IAAI,MAAA,CAAO,CAAuC,oCAAA,EAAA,IAAA,CAAK,MAAM,CAAW,SAAA,CAAA,CAAA;AACvF,IAAA,IAAI,MAAO,CAAA,IAAA,CAAK,OAAO,CAAA,EAAU,OAAA,MAAA;AAAA;AAEnC,EAAO,OAAA,IAAA;AACT;AAGO,SAAS,cAAc,MAA+B,EAAA;AAC3D,EAAA,OAAO,cAAc,MAAM,CAAA;AAC7B;AAMgB,SAAA,eAAA,CAAgB,UAAqB,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 +23,10 @@ function splitReplyChunks(text, maxChunk = 10) {
|
|
|
23
23
|
});
|
|
24
24
|
return chunks.filter((chunk) => chunk.length > 0);
|
|
25
25
|
}
|
|
26
|
-
function searchingLead(query) {
|
|
26
|
+
function searchingLead(query, where) {
|
|
27
27
|
const q = query.trim();
|
|
28
|
-
|
|
28
|
+
const place = (where == null ? void 0 : where.trim()) || "retailers";
|
|
29
|
+
return q ? `Searching ${place} for **${q}**\u2026` : `Searching ${place}\u2026`;
|
|
29
30
|
}
|
|
30
31
|
function delayMs(ms) {
|
|
31
32
|
return new Promise((resolve) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamAssistantReply.js","sources":["../../../../src/features/shopping/chat/streamAssistantReply.ts"],"sourcesContent":["/**\n * Reveal assistant prose in small pieces so native shop results don't appear\n * as one dump after search. Hermes-safe (no lookbehind).\n */\nexport function splitReplyChunks(text: string, maxChunk = 10): string[] {\n const trimmed = text;\n if (!trimmed) return [];\n const chunks: string[] = [];\n const lines = trimmed.split('\\n');\n lines.forEach((line, idx) => {\n const suffix = idx < lines.length - 1 ? '\\n' : '';\n // Emit list items whole. Word-splitting them tears the markdown apart mid-token\n // (\"1. \" / \"**iPhone \" / \"Deals** \"), so the half-rendered list flickers with a\n // dangling `**` on every frame of the stream.\n if (line.length <= maxChunk || /^\\s*(?:\\d+[.)]|[-*•])\\s+/.test(line)) {\n chunks.push(`${line}${suffix}`);\n return;\n }\n const tokens = line.split(/(\\s+)/);\n let buf = '';\n for (const token of tokens) {\n if (buf && buf.length + token.length > maxChunk) {\n chunks.push(buf);\n buf = token;\n } else {\n buf += token;\n }\n }\n chunks.push(`${buf}${suffix}`);\n });\n return chunks.filter((chunk) => chunk.length > 0);\n}\n\nexport function searchingLead(query: string): string {\n const q = query.trim();\n return q ? `Searching
|
|
1
|
+
{"version":3,"file":"streamAssistantReply.js","sources":["../../../../src/features/shopping/chat/streamAssistantReply.ts"],"sourcesContent":["/**\n * Reveal assistant prose in small pieces so native shop results don't appear\n * as one dump after search. Hermes-safe (no lookbehind).\n */\nexport function splitReplyChunks(text: string, maxChunk = 10): string[] {\n const trimmed = text;\n if (!trimmed) return [];\n const chunks: string[] = [];\n const lines = trimmed.split('\\n');\n lines.forEach((line, idx) => {\n const suffix = idx < lines.length - 1 ? '\\n' : '';\n // Emit list items whole. Word-splitting them tears the markdown apart mid-token\n // (\"1. \" / \"**iPhone \" / \"Deals** \"), so the half-rendered list flickers with a\n // dangling `**` on every frame of the stream.\n if (line.length <= maxChunk || /^\\s*(?:\\d+[.)]|[-*•])\\s+/.test(line)) {\n chunks.push(`${line}${suffix}`);\n return;\n }\n const tokens = line.split(/(\\s+)/);\n let buf = '';\n for (const token of tokens) {\n if (buf && buf.length + token.length > maxChunk) {\n chunks.push(buf);\n buf = token;\n } else {\n buf += token;\n }\n }\n chunks.push(`${buf}${suffix}`);\n });\n return chunks.filter((chunk) => chunk.length > 0);\n}\n\n/** @param where the one retailer the ask named (\"Amazon\"); every retailer when absent. */\nexport function searchingLead(query: string, where?: string | null): string {\n const q = query.trim();\n const place = where?.trim() || 'retailers';\n return q ? `Searching ${place} for **${q}**…` : `Searching ${place}…`;\n}\n\nexport function delayMs(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n"],"names":[],"mappings":"AAIgB,SAAA,gBAAA,CAAiB,IAAc,EAAA,QAAA,GAAW,EAAc,EAAA;AACtE,EAAA,MAAM,OAAU,GAAA,IAAA;AAChB,EAAI,IAAA,CAAC,OAAS,EAAA,OAAO,EAAC;AACtB,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,IAAI,CAAA;AAChC,EAAM,KAAA,CAAA,OAAA,CAAQ,CAAC,IAAA,EAAM,GAAQ,KAAA;AAC3B,IAAA,MAAM,MAAS,GAAA,GAAA,GAAM,KAAM,CAAA,MAAA,GAAS,IAAI,IAAO,GAAA,EAAA;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1
|
-
import {jsx}from'react/jsx-runtime';import {useMemo,useCallback}from'react';import {PendingConnectorConnectCard}from'../features/chat/ConnectorConnectPrompt.js';import {displayConnectorConnectMessages
|
|
2
|
-
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {useMemo,useCallback}from'react';import {PendingConnectorConnectCard}from'../features/chat/ConnectorConnectPrompt.js';import {displayConnectorConnectText,displayConnectorConnectMessages}from'common';import {splitPreResponse}from'../features/chat/preResponse.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
function displayStreaming(text) {
|
|
21
|
+
return text ? displayConnectorConnectText(splitPreResponse(text).text, true) || null : null;
|
|
22
|
+
}
|
|
23
|
+
function displayMessages(messages) {
|
|
24
|
+
return displayConnectorConnectMessages(messages.map((msg) => {
|
|
25
|
+
if (msg.role !== "assistant") return msg;
|
|
26
|
+
const {
|
|
27
|
+
preResponse,
|
|
28
|
+
text
|
|
29
|
+
} = splitPreResponse(msg.content);
|
|
30
|
+
if (preResponse === null && text === msg.content) return msg;
|
|
31
|
+
return __spreadProps(__spreadValues({}, msg), {
|
|
32
|
+
content: text.trim() ? text : preResponse != null ? preResponse : ""
|
|
33
|
+
});
|
|
34
|
+
}));
|
|
3
35
|
}
|
|
4
36
|
function useHostConnectorCard(chat, channelId) {
|
|
5
37
|
const {
|
|
@@ -18,7 +50,7 @@ function useHostConnectorCard(chat, channelId) {
|
|
|
18
50
|
const renderConnectorCard = useCallback((isDark) => /* @__PURE__ */ jsx(PendingConnectorConnectCard, { messages: rows, send, isDark }), [rows, send]);
|
|
19
51
|
return useMemo(() => ({
|
|
20
52
|
renderConnectorCard,
|
|
21
|
-
displayMessages
|
|
53
|
+
displayMessages,
|
|
22
54
|
displayStreaming
|
|
23
55
|
}), [renderConnectorCard]);
|
|
24
56
|
}export{useHostConnectorCard};//# sourceMappingURL=useHostConnectorCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHostConnectorCard.js","sources":["../../src/hooks/useHostConnectorCard.tsx"],"sourcesContent":["/**\n * The `[CONNECTOR_CONNECT]` card for a native surface chat (shop, travel, jobs,\n * resume), built on the surface's HOST screen.\n *\n * The surface UI ships as a federated remote that must not bundle the host's data\n * stack (Apollo, redux, `common`, expo-web-browser) - see useShoppingHostChat. So\n * the host does everything protocol-shaped: it cleans the thread before the remote\n * sees it (the markers and the card's replies are not shown as text) and hands the\n * remote a render function for the card, which the remote only places above its\n * composer. The card is a host component; rendered inside the remote's tree it\n * still reads the host's providers, which wrap that tree.\n *\n * The reply goes to the host channel directly - not through the surface's own\n * `onSend`, which may route text to a local lane or wrap it in context - and only\n * counts as sent when the channel took it (sent, or parked in the durable outbox,\n * whose row then settles the request).\n */\nimport React, { useCallback, useMemo, type ReactNode } from 'react';\nimport { PendingConnectorConnectCard } from '../features/chat/ConnectorConnectPrompt';\nimport { displayConnectorConnectMessages, displayConnectorConnectText } from '../features/chat/connectorConnect';\nimport type { useChatStream } from './useChatStream';\n\ntype HostChatStream = Pick<ReturnType<typeof useChatStream>, 'messages' | 'queuedMessages' | 'sendMessage'>;\n\nexport interface HostConnectorCard {\n /** The card for the request still waiting in the thread (renders nothing when none is). */\n renderConnectorCard: (isDark: boolean) => ReactNode;\n /** A thread as the remote's transcript should show it: markers and card replies out. */\n displayMessages: <T extends { role: string; content: string }>(messages: ReadonlyArray<T>) => T[];\n /** The streaming reply as the remote should show it: a half-written marker never flashes. */\n displayStreaming: (text: string | null | undefined) => string | null;\n}\n\n/** The streaming reply as a remote shows it; module-level so its identity never changes. */\nfunction displayStreaming(text: string | null | undefined): string | null {\n return text ? displayConnectorConnectText(text, true) || null : null;\n}\n\nexport function useHostConnectorCard(chat: HostChatStream, channelId: string): HostConnectorCard {\n const { messages, queuedMessages, sendMessage } = chat;\n\n // The thread plus the outbox: a reply parked while the gateway is down is the\n // newest user row, so the request reads as answered and the card stays gone.\n const rows = useMemo(\n () => [\n ...messages.map((m) => ({ role: m.role, content: m.content })),\n ...queuedMessages.map((q) => ({ role: 'user', content: q.text })),\n ],\n [messages, queuedMessages],\n );\n\n const send = useCallback(\n async (text: string) => (await sendMessage(text, undefined, channelId)) !== 'failed',\n [sendMessage, channelId],\n );\n\n const renderConnectorCard = useCallback(\n (isDark: boolean) => <PendingConnectorConnectCard messages={rows} send={send} isDark={isDark} />,\n [rows, send],\n );\n\n return useMemo(
|
|
1
|
+
{"version":3,"file":"useHostConnectorCard.js","sources":["../../src/hooks/useHostConnectorCard.tsx"],"sourcesContent":["/**\n * The `[CONNECTOR_CONNECT]` card for a native surface chat (shop, travel, jobs,\n * resume), built on the surface's HOST screen.\n *\n * The surface UI ships as a federated remote that must not bundle the host's data\n * stack (Apollo, redux, `common`, expo-web-browser) - see useShoppingHostChat. So\n * the host does everything protocol-shaped: it cleans the thread before the remote\n * sees it (the markers and the card's replies are not shown as text) and hands the\n * remote a render function for the card, which the remote only places above its\n * composer. The card is a host component; rendered inside the remote's tree it\n * still reads the host's providers, which wrap that tree.\n *\n * The fast lane's `[PRE_RESPONSE]…[/PRE_RESPONSE]` block is peeled here too (web\n * does the same in useHostChat). The main Chat draws it as a \"Quick answer\"\n * strip; a remote's transcript only has a plain bubble, so the block reached the\n * person as literal marker text followed by a near-copy of the same answer. Every\n * surface chat's first turn is a cold one on a fresh channel - exactly the turn\n * that carries the block.\n *\n * The reply goes to the host channel directly - not through the surface's own\n * `onSend`, which may route text to a local lane or wrap it in context - and only\n * counts as sent when the channel took it (sent, or parked in the durable outbox,\n * whose row then settles the request).\n */\nimport React, { useCallback, useMemo, type ReactNode } from 'react';\nimport { PendingConnectorConnectCard } from '../features/chat/ConnectorConnectPrompt';\nimport { displayConnectorConnectMessages, displayConnectorConnectText } from '../features/chat/connectorConnect';\nimport { splitPreResponse } from '../features/chat/preResponse';\nimport type { useChatStream } from './useChatStream';\n\ntype HostChatStream = Pick<ReturnType<typeof useChatStream>, 'messages' | 'queuedMessages' | 'sendMessage'>;\n\nexport interface HostConnectorCard {\n /** The card for the request still waiting in the thread (renders nothing when none is). */\n renderConnectorCard: (isDark: boolean) => ReactNode;\n /** A thread as the remote's transcript should show it: the fast-lane block, markers and card replies out. */\n displayMessages: <T extends { role: string; content: string }>(messages: ReadonlyArray<T>) => T[];\n /** The streaming reply as the remote should show it: a half-written marker never flashes. */\n displayStreaming: (text: string | null | undefined) => string | null;\n}\n\n/** The streaming reply as a remote shows it; module-level so its identity never changes. */\nfunction displayStreaming(text: string | null | undefined): string | null {\n // useCdecliChannel already lifts the block out of the live stream; peeling it\n // here as well means a stream that still carries one never flashes markers.\n return text ? displayConnectorConnectText(splitPreResponse(text).text, true) || null : null;\n}\n\n/** A thread as a remote shows it: the fast-lane block and connect protocol out. */\nfunction displayMessages<T extends { role: string; content: string }>(messages: ReadonlyArray<T>): T[] {\n return displayConnectorConnectMessages(\n messages.map((msg) => {\n if (msg.role !== 'assistant') return msg;\n const { preResponse, text } = splitPreResponse(msg.content);\n if (preResponse === null && text === msg.content) return msg;\n // A turn whose agent reply never came keeps the quick answer: it is\n // all the person got, and an empty bubble reads as a lost reply.\n return { ...msg, content: text.trim() ? text : (preResponse ?? '') };\n }),\n );\n}\n\nexport function useHostConnectorCard(chat: HostChatStream, channelId: string): HostConnectorCard {\n const { messages, queuedMessages, sendMessage } = chat;\n\n // The thread plus the outbox: a reply parked while the gateway is down is the\n // newest user row, so the request reads as answered and the card stays gone.\n const rows = useMemo(\n () => [\n ...messages.map((m) => ({ role: m.role, content: m.content })),\n ...queuedMessages.map((q) => ({ role: 'user', content: q.text })),\n ],\n [messages, queuedMessages],\n );\n\n const send = useCallback(\n async (text: string) => (await sendMessage(text, undefined, channelId)) !== 'failed',\n [sendMessage, channelId],\n );\n\n const renderConnectorCard = useCallback(\n (isDark: boolean) => <PendingConnectorConnectCard messages={rows} send={send} isDark={isDark} />,\n [rows, send],\n );\n\n return useMemo(() => ({ renderConnectorCard, displayMessages, displayStreaming }), [renderConnectorCard]);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2CA,SAAS,iBAAiB,IAAgD,EAAA;AAGxE,EAAO,OAAA,IAAA,GAAO,4BAA4B,gBAAiB,CAAA,IAAI,EAAE,IAAM,EAAA,IAAI,KAAK,IAAO,GAAA,IAAA;AACzF;AAGA,SAAS,gBAGN,QAAiC,EAAA;AAClC,EAAO,OAAA,+BAAA,CAAgC,QAAS,CAAA,GAAA,CAAI,CAAO,GAAA,KAAA;AACzD,IAAI,IAAA,GAAA,CAAI,IAAS,KAAA,WAAA,EAAoB,OAAA,GAAA;AACrC,IAAM,MAAA;AAAA,MACJ,WAAA;AAAA,MACA;AAAA,KACF,GAAI,gBAAiB,CAAA,GAAA,CAAI,OAAO,CAAA;AAChC,IAAA,IAAI,WAAgB,KAAA,IAAA,IAAQ,IAAS,KAAA,GAAA,CAAI,SAAgB,OAAA,GAAA;AAGzD,IAAA,OAAO,iCACF,GADE,CAAA,EAAA;AAAA,MAEL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= params.initialAttachments;
|
|
34
|
+
const shopRouteChecked = params.shopRouteChecked === true;
|
|
34
35
|
const {
|
|
35
36
|
isDark
|
|
36
37
|
} = useAppTheme();
|
|
@@ -164,7 +165,7 @@ function ChatScreen() {
|
|
|
164
165
|
const mode = isDeepSearchMode ? "deep-search" : isBuildMode ? "build" : "chat";
|
|
165
166
|
let openShop = false;
|
|
166
167
|
try {
|
|
167
|
-
openShop = await shouldRedirectToShop(initialQuery != null ? initialQuery : "", (_a2 = attachments == null ? void 0 : attachments.length) != null ? _a2 : 0, mode);
|
|
168
|
+
openShop = !shopRouteChecked && await shouldRedirectToShop(initialQuery != null ? initialQuery : "", (_a2 = attachments == null ? void 0 : attachments.length) != null ? _a2 : 0, mode);
|
|
168
169
|
} catch (e) {
|
|
169
170
|
openShop = false;
|
|
170
171
|
}
|
|
@@ -172,7 +173,9 @@ function ChatScreen() {
|
|
|
172
173
|
replaceWithShopNative(navigation, shopHandoffParams({
|
|
173
174
|
orgName: params.orgName,
|
|
174
175
|
query: initialQuery != null ? initialQuery : "",
|
|
175
|
-
files: attachments
|
|
176
|
+
files: attachments,
|
|
177
|
+
// Nothing was sent here yet: Shop carries on in this chat.
|
|
178
|
+
channelId
|
|
176
179
|
}));
|
|
177
180
|
return;
|
|
178
181
|
}
|
|
@@ -185,7 +188,7 @@ function ChatScreen() {
|
|
|
185
188
|
});
|
|
186
189
|
} catch (e) {
|
|
187
190
|
}
|
|
188
|
-
}, [channelId, initialQuery, initialAttachments, sendMessage, navigation, cdecli.status, isDeepSearchMode, isBuildMode, params.orgName]);
|
|
191
|
+
}, [channelId, initialQuery, initialAttachments, sendMessage, navigation, cdecli.status, isDeepSearchMode, isBuildMode, params.orgName, shopRouteChecked]);
|
|
189
192
|
const handleAskUserAnswer = useCallback((formatted) => {
|
|
190
193
|
const text = formatted.trim();
|
|
191
194
|
if (!text) return;
|
|
@@ -226,22 +229,27 @@ function ChatScreen() {
|
|
|
226
229
|
setIsDeepSearchModalOpen(true);
|
|
227
230
|
}
|
|
228
231
|
void (async () => {
|
|
232
|
+
var _a3;
|
|
229
233
|
let openShop = false;
|
|
230
234
|
try {
|
|
231
|
-
openShop = await shouldRedirectToShop(t, pending.length, isDeepSearchMode ? "deep-search" : "chat");
|
|
235
|
+
openShop = await shouldRedirectToShop(t, (_a3 = pending == null ? void 0 : pending.length) != null ? _a3 : 0, isDeepSearchMode ? "deep-search" : "chat");
|
|
232
236
|
} catch (e) {
|
|
233
237
|
openShop = false;
|
|
234
238
|
}
|
|
235
239
|
if (openShop) {
|
|
236
|
-
const shopParams = shopHandoffParams({
|
|
237
|
-
orgName: params.orgName,
|
|
238
|
-
query: t,
|
|
239
|
-
files: pending
|
|
240
|
-
});
|
|
241
240
|
if (messages.length === 0) {
|
|
242
|
-
replaceWithShopNative(navigation,
|
|
241
|
+
replaceWithShopNative(navigation, shopHandoffParams({
|
|
242
|
+
orgName: params.orgName,
|
|
243
|
+
query: t,
|
|
244
|
+
files: pending,
|
|
245
|
+
channelId
|
|
246
|
+
}));
|
|
243
247
|
} else {
|
|
244
|
-
pushShopNative(navigation,
|
|
248
|
+
pushShopNative(navigation, shopHandoffParams({
|
|
249
|
+
orgName: params.orgName,
|
|
250
|
+
query: t,
|
|
251
|
+
files: pending
|
|
252
|
+
}));
|
|
245
253
|
}
|
|
246
254
|
return;
|
|
247
255
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/screens/Chat/index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Keyboard, Pressable, StyleSheet, TextInput, View, useWindowDimensions } from 'react-native';\nimport { Box, InputToolBar, Text, getDefaultLeftItems } 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 { AskUserCard } from '../../features/chat/AskUserCard';\nimport { pendingAskUser } from '../../features/chat/askUser';\nimport { PendingConnectorConnectCard } from '../../features/chat/ConnectorConnectPrompt';\nimport { QueuedFollowUps } from '../../features/chat/QueuedFollowUps';\nimport { displayConnectorConnectMessages, displayConnectorConnectText } from '../../features/chat/connectorConnect';\nimport { splitPreResponse } from '../../features/chat/preResponse';\nimport { useCdecliConnection } from '../../contexts/CdecliConnectionContext';\nimport { useChatLiveStream } from '../../contexts/ChatLiveStreamContext';\nimport type { MessageAttachment } from '../../hooks/useChatStream';\nimport { KeyboardAwareScreen, KeyboardComposerDock } from '../../components/KeyboardComposerDock';\nimport { YantraBrandLoader, YANTRA_LOADER_SIZE_COMPACT } from '../../components/YantraBrandLoader';\nimport ThinkingIndicator from '../../components/ThinkingIndicator';\nimport { mobileTokens } from '../../theme/mobileTokens';\nimport { useAppTheme } from '../../theme/AppThemeProvider';\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 { NativeDictationBar } from '../../features/audio-input/NativeDictationBar';\nimport { isNativeDictationAvailable } from '../../features/audio-input/nativeDictation';\nimport { useImageAttachments } from '../../features/attachments/useImageAttachments';\nimport { ComposerAttachmentBar } from '../../features/attachments/ComposerAttachmentBar';\nimport { useComposerAttachMenu } from '../../features/attachments/ComposerAttachMenu';\nimport { hasComposerAttachments, takeComposerAttachments } from '../../features/attachments/composerAttachmentHandoff';\nimport { MicErrorBoundary } from '../../features/audio-input/MicErrorBoundary';\nimport { requestMicPermission } from '../../features/audio-input/useAudioPermission';\nimport { shouldRedirectToShop } from '../../features/shopping/chat/homeShoppingIntent';\nimport { pushShopNative, replaceWithShopNative, shopHandoffParams } from '../../features/shopping/chat/openShopNative';\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 { isDark } = useAppTheme();\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\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\n useLayoutEffect(() => {\n if (!channelId) return;\n cdecli.setActiveChannelId(channelId);\n }, [channelId, cdecli.setActiveChannelId]);\n\n const chat = useChatLiveStream();\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 // A message the gateway queued is persisted as it is sent, so the next\n // backend hydration brings it into `messages` too. While it waits it\n // belongs above the composer, not in the thread: hide the newest user\n // rows that match what is still queued.\n const waiting = chat.queuedFollowUps.map((queued) => queued.text.trim());\n const hidden = new Set<number>();\n for (let i = chat.messages.length - 1; i >= 0 && waiting.length > 0; i -= 1) {\n const msg = chat.messages[i];\n const match = msg.role === 'user' ? waiting.indexOf((msg.content ?? '').trim()) : -1;\n if (match >= 0) {\n hidden.add(i);\n waiting.splice(match, 1);\n }\n }\n return [\n ...chat.messages.flatMap((msg, index) =>\n hidden.has(index)\n ? []\n : [\n {\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 ],\n ),\n // Turns typed while the gateway was down. They live in the outbox, not in\n // the thread, so they survive a backend hydration and an app restart - and\n // they are always the newest rows, so they belong at the end.\n ...chat.queuedMessages.map((queued) => ({\n id: `queued-${queued.id}`,\n role: 'user' as const,\n content: queued.text,\n attachments: queued.attachments,\n queued: true,\n })),\n ];\n }, [chat.messages, chat.queuedMessages, chat.queuedFollowUps]);\n const {\n messages,\n response,\n quickReply,\n error: chatError,\n isLoading,\n isStreaming,\n messagesLoading,\n queuedMessages,\n flushQueuedMessages,\n discardQueuedMessages,\n queuedFollowUps,\n cancelQueuedFollowUp,\n sendQueuedNow,\n sendMessage,\n cancel,\n } = 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 const { rightItems, menu: attachMenu } = useComposerAttachMenu(imageAttachments, isDark);\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 // Apple on-device dictation (the iOS-built-in mic) is preferred when the\n // binary has it; the Whisper recorder above is the fallback.\n const [showNativeDictation, setShowNativeDictation] = 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 // Route params carry the looser `ModeAttachment` (everything optional); the send\n // lane wants a `MessageAttachment`. Normalise once, here, rather than casting at\n // each use - `shopHandoffParams` takes the narrower shape just as happily.\n const attachments: MessageAttachment[] | undefined = stashed?.length\n ? stashed\n : initialAttachments?.map((a, index) => ({\n id: a.id ?? `att-${index}`,\n name: a.name ?? `attachment-${index + 1}`,\n type: a.type === 'screenshot' ? ('screenshot' as const) : ('file' as const),\n ...(a.mimeType ? { mimeType: a.mimeType } : {}),\n ...(a.size ? { size: a.size } : {}),\n ...((a.url ?? a.uri) ? { url: a.url ?? a.uri } : {}),\n ...(a.dataUrl ? { dataUrl: a.dataUrl } : {}),\n }));\n if (!initialQuery && !attachments?.length) return;\n\n autoFiredRef.current = true;\n if (isDeepSearchMode) {\n setIsDeepSearchModalOpen(true);\n }\n void (async () => {\n const mode: RoutingMode = isDeepSearchMode ? 'deep-search' : isBuildMode ? 'build' : 'chat';\n let openShop = false;\n try {\n openShop = await shouldRedirectToShop(initialQuery ?? '', attachments?.length ?? 0, mode);\n } catch {\n openShop = false;\n }\n if (openShop) {\n replaceWithShopNative(\n navigation,\n shopHandoffParams({\n orgName: params.orgName,\n query: initialQuery ?? '',\n files: attachments,\n }),\n );\n return;\n }\n void sendMessage(initialQuery ?? '', attachments, channelId);\n })();\n try {\n navigation.setParams({ initialQuery: null, initialAttachments: null });\n } catch {\n /* setParams may be unavailable in tests; clearing is best-effort. */\n }\n }, [\n channelId,\n initialQuery,\n initialAttachments,\n sendMessage,\n navigation,\n cdecli.status,\n isDeepSearchMode,\n isBuildMode,\n params.orgName,\n ]);\n\n /**\n * Answer a parked `[ASK_USER]` question. The formatted `**Title:** answer`\n * block goes out as an ordinary user message — cdecli absorbs it into the\n * turn it parked, which is what releases the run. Deliberately NOT routed\n * through handleSend: no deep-search/build-mode rewriting, no attachments,\n * and it must send even while the turn is still streaming.\n */\n const handleAskUserAnswer = useCallback(\n (formatted: string) => {\n const text = formatted.trim();\n if (!text) return;\n void sendMessage(text, undefined, channelId);\n },\n [sendMessage, channelId],\n );\n\n const [resolvedAskIds, setResolvedAskIds] = useState<Record<string, boolean>>({});\n const pendingAsk = useMemo(\n () =>\n pendingAskUser([\n ...transcriptRows,\n ...(response?.trim() ? [{ role: 'assistant', content: response }] : []),\n ]),\n [transcriptRows, response],\n );\n const showAskCard = Boolean(pendingAsk && !resolvedAskIds[pendingAsk.requestId]);\n\n /**\n * Answer a `[CONNECTOR_CONNECT]` card (a login to save, a connector to connect).\n * Like the ASK_USER answer it skips handleSend's mode rewriting: the\n * `[CONNECTOR_CONNECTED:<requestId>:<credentialId>]` reply goes out as is, names\n * the saved credential so the agent can sign in with it at once, and the\n * transcript hides it (it is protocol, not something the user said).\n */\n const sendConnectorReply = useCallback(\n async (text: string): Promise<boolean> => {\n if (!channelId) return false;\n return (await sendMessage(text, undefined, channelId)) !== 'failed';\n },\n [sendMessage, channelId],\n );\n // The transcript shows the thread without the protocol: the card stands in for\n // the marker, and its reply is not something the user said. Ids are kept, so\n // regenerate-from-row still indexes chat.messages.\n const transcriptDisplayRows = useMemo(() => displayConnectorConnectMessages(transcriptRows), [transcriptRows]);\n const transcriptStreaming = useMemo(\n () => (response ? displayConnectorConnectText(response, true) : response),\n [response],\n );\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 (async () => {\n let openShop = false;\n try {\n openShop = await shouldRedirectToShop(t, pending.length, isDeepSearchMode ? 'deep-search' : 'chat');\n } catch {\n openShop = false;\n }\n if (openShop) {\n const shopParams = shopHandoffParams({\n orgName: params.orgName,\n query: t,\n files: pending,\n });\n if (messages.length === 0) {\n replaceWithShopNative(navigation, shopParams);\n } else {\n pushShopNative(navigation, shopParams);\n }\n return;\n }\n void sendMessage(t, pending, channelId);\n })();\n imageAttachments.clear();\n },\n [\n channelId,\n sendMessage,\n isDeepSearchMode,\n isBuildMode,\n navigation,\n params.orgName,\n imageAttachments,\n messages.length,\n ],\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 /** Open the record -> Whisper recorder (the fallback mic lane). */\n const openWhisperRecorder = useCallback(() => {\n setVoiceError(null);\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 }, []);\n\n const handleMicPress = useCallback(() => {\n if (hasQuery) return;\n setVoiceError(null);\n Keyboard.dismiss();\n // Prefer Apple's on-device dictation (the iOS-built-in mic): it streams\n // text live and needs no upload. The bar requests its own permission\n // and calls back to the Whisper recorder if the native path is\n // unusable. Only reachable on a build that linked the native module.\n if (isNativeDictationAvailable()) {\n setShowNativeDictation(true);\n return;\n }\n openWhisperRecorder();\n }, [hasQuery, openWhisperRecorder]);\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 /** Append a finished transcript to the composer and re-focus it. Shared by\n * the Whisper recorder and native dictation. */\n const pasteTranscript = useCallback((text: string) => {\n const cleaned = (text ?? '').trim();\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 handleTranscriptionComplete = useCallback(\n (text: string) => {\n setShowAudioRecorder(false);\n pasteTranscript(text);\n },\n [pasteTranscript],\n );\n\n const handleRecorderCancel = useCallback(() => {\n setShowAudioRecorder(false);\n }, []);\n\n const handleDictationComplete = useCallback(\n (text: string) => {\n setShowNativeDictation(false);\n pasteTranscript(text);\n },\n [pasteTranscript],\n );\n\n const handleDictationCancel = useCallback(() => setShowNativeDictation(false), []);\n\n /** Native dictation could not run - drop to the Whisper recorder, which\n * requests its own permission and surfaces its own errors. */\n const handleDictationFallback = useCallback(() => {\n setShowNativeDictation(false);\n openWhisperRecorder();\n }, [openWhisperRecorder]);\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 // The summary is the agent's answer, not the quick answer framed in front of it.\n return splitPreResponse(messages[i]?.content).text;\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 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 (queued for the agent). 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 // Queue affordances: the gateway is live, so a queue that is still sitting there\n // failed its release and the user gets a manual retry beside the discard.\n const gatewayLive = cdecli.channelConnected;\n const queuedActionColor = isDark ? '#fbbf24' : '#b45309';\n const handleSendQueuedNow = useCallback(() => {\n void flushQueuedMessages();\n }, [flushQueuedMessages]);\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 && !quickReply && !isStreaming;\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 <KeyboardAwareScreen>\n <View style={styles.chatColumn}>\n {queuedMessages.length > 0 && (\n <Box\n mb=\"$2\"\n mx=\"$4\"\n p=\"$3\"\n borderRadius=\"$md\"\n style={{\n backgroundColor: isDark ? '#2a2113' : '#fffbeb',\n borderWidth: 1,\n borderColor: isDark ? '#78350f' : '#fde68a',\n flexDirection: 'row',\n alignItems: 'center',\n }}\n >\n <Text fontSize=\"$sm\" style={{ color: isDark ? '#fde68a' : '#92400e', flex: 1 }}>\n {queuedMessages.length === 1\n ? '1 message waiting for the gateway.'\n : `${queuedMessages.length} messages waiting for the gateway.`}{' '}\n {gatewayLive ? 'Sending…' : 'They send as soon as it connects.'}\n </Text>\n {gatewayLive ? (\n <Pressable onPress={handleSendQueuedNow} hitSlop={8} style={styles.queuedAction}>\n <Text\n fontSize=\"$xs\"\n style={[styles.queuedActionText, { color: queuedActionColor }]}\n >\n Send now\n </Text>\n </Pressable>\n ) : null}\n <Pressable onPress={discardQueuedMessages} hitSlop={8} style={styles.queuedAction}>\n <Text fontSize=\"$xs\" style={[styles.queuedActionText, { color: queuedActionColor }]}>\n Discard\n </Text>\n </Pressable>\n </Box>\n )}\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 <Box flex={1} px=\"$4\" pt=\"$8\">\n <ThinkingIndicator\n variant=\"awaiting\"\n color={secondaryTextColor}\n isDark={isDark}\n label=\"Opening conversation…\"\n />\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 <View style={styles.transcriptPane}>\n <ChatTranscript\n messages={transcriptDisplayRows}\n streamingContent={transcriptStreaming}\n quickReply={quickReply}\n listFooter={\n showSendingLoader && pinSendingLoaderNearComposer ? (\n <View style={styles.thinkingInThread}>\n <ThinkingIndicator\n variant=\"awaiting\"\n color={secondaryTextColor}\n isDark={isDark}\n />\n </View>\n ) : null\n }\n renderMessageActions={renderMessageActions}\n isDark={isDark}\n listContentStyle={{\n paddingTop: 12,\n paddingBottom: 8,\n margin: 0,\n width: contentMaxWidth,\n alignSelf: 'center',\n }}\n />\n </View>\n )}\n {showSendingLoader && !pinSendingLoaderNearComposer ? (\n <View pointerEvents=\"none\" style={styles.sendingLoaderEmptyState}>\n <ThinkingIndicator variant=\"awaiting\" color={secondaryTextColor} isDark={isDark} />\n </View>\n ) : null}\n <KeyboardComposerDock closedInset={insets.bottom} onSwipeUp={() => inputRef.current?.focus()}>\n {showAskCard && pendingAsk ? (\n <View style={{ width: contentMaxWidth, paddingHorizontal: 8 }}>\n <AskUserCard\n payload={pendingAsk}\n isDark={isDark}\n onAnswer={(formatted) => {\n setResolvedAskIds((prev) => ({ ...prev, [pendingAsk.requestId]: true }));\n handleAskUserAnswer(formatted);\n }}\n onDismiss={() =>\n setResolvedAskIds((prev) => ({ ...prev, [pendingAsk.requestId]: true }))\n }\n />\n </View>\n ) : null}\n {showAskCard ? null : (\n <PendingConnectorConnectCard\n messages={transcriptRows}\n send={sendConnectorReply}\n isDark={isDark}\n style={{ width: contentMaxWidth, paddingHorizontal: 8 }}\n />\n )}\n <View style={{ width: contentMaxWidth }}>\n <QueuedFollowUps\n items={queuedFollowUps}\n onCancel={cancelQueuedFollowUp}\n onSendNow={sendQueuedNow}\n isDark={isDark}\n />\n </View>\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 {showNativeDictation ? (\n // A throw inside the native recognizer degrades to\n // the Whisper recorder rather than killing the JS\n // thread (same guard rationale as the recorder).\n <MicErrorBoundary onCancel={handleDictationFallback} onError={handleDictationFallback}>\n <NativeDictationBar\n isDark={isDark}\n onInterim={() => undefined}\n onTranscriptionComplete={handleDictationComplete}\n onCancel={handleDictationCancel}\n onFallback={handleDictationFallback}\n />\n </MicErrorBoundary>\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 </View>\n </KeyboardAwareScreen>\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 {attachMenu}\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n chatColumn: {\n flex: 1,\n width: '100%',\n },\n transcriptPane: {\n flex: 1,\n minHeight: 0,\n width: '100%',\n },\n statusText: {\n marginTop: 14,\n fontSize: 13,\n fontWeight: '500',\n },\n bottomComposerInner: {\n paddingHorizontal: 14,\n paddingTop: 10,\n paddingBottom: 0,\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: 24,\n paddingHorizontal: 20,\n zIndex: 40,\n },\n queuedAction: {\n paddingHorizontal: 8,\n paddingVertical: 2,\n },\n queuedActionText: {\n fontWeight: '600',\n },\n thinkingInThread: {\n paddingHorizontal: 12,\n paddingTop: 10,\n paddingBottom: 4,\n },\n});\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;AAgEA,SAAwB,UAAa,GAAA;AAhErC,EAAA,IAAA,EAAA;AAiEE,EAAA,MAAM,aAAa,aAAmB,EAAA;AACtC,EAAA,MAAM,QAAQ,QAAc,EAAA;AAC5B,EAAA,MAAM,MAAU,GAAA,CA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A,cAAgB,EAAA;AAAA,IACd,IAAM,EAAA,CAAA;AAAA,IACN,SAAW,EAAA,CAAA;AAAA,IACX,KAAO,EAAA;AAAA,GACT;AAAA,EACA,UAAY,EAAA;AAAA,IACV,SAAW,EAAA,EAAA;AAAA,IACX,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,mBAAqB,EAAA;AAAA,IACnB,iBAAmB,EAAA,EAAA;AAAA,IACnB,UAAY,EAAA,EAAA;AAAA,IACZ,aAAe,EAAA;AAAA,GACjB;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,YAAc,EAAA,CAAA;AAAA,IACd,iBAAmB,EAAA,EAAA;AAAA,IACnB,eAAiB,EAAA,CAAA;AAAA,IACjB,YAAc,EAAA,EAAA;AAAA,IACd,WAAa,EAAA;AAAA,GACf;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,QAAU,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,EAAA;AAAA,IACL,iBAAmB,EAAA,EAAA;AAAA,IACnB,MAAQ,EAAA;AAAA,GACV;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,iBAAmB,EAAA,CAAA;AAAA,IACnB,eAAiB,EAAA;AAAA,GACnB;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,UAAY,EAAA;AAAA,GACd;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,iBAAmB,EAAA,EAAA;AAAA,IACnB,UAAY,EAAA,EAAA;AAAA,IACZ,aAAe,EAAA;AAAA;AAEnB,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/screens/Chat/index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Keyboard, Pressable, StyleSheet, TextInput, View, useWindowDimensions } from 'react-native';\nimport { Box, InputToolBar, Text, getDefaultLeftItems } 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 { AskUserCard } from '../../features/chat/AskUserCard';\nimport { pendingAskUser } from '../../features/chat/askUser';\nimport { PendingConnectorConnectCard } from '../../features/chat/ConnectorConnectPrompt';\nimport { QueuedFollowUps } from '../../features/chat/QueuedFollowUps';\nimport { displayConnectorConnectMessages, displayConnectorConnectText } from '../../features/chat/connectorConnect';\nimport { splitPreResponse } from '../../features/chat/preResponse';\nimport { useCdecliConnection } from '../../contexts/CdecliConnectionContext';\nimport { useChatLiveStream } from '../../contexts/ChatLiveStreamContext';\nimport type { MessageAttachment } from '../../hooks/useChatStream';\nimport { KeyboardAwareScreen, KeyboardComposerDock } from '../../components/KeyboardComposerDock';\nimport { YantraBrandLoader, YANTRA_LOADER_SIZE_COMPACT } from '../../components/YantraBrandLoader';\nimport ThinkingIndicator from '../../components/ThinkingIndicator';\nimport { mobileTokens } from '../../theme/mobileTokens';\nimport { useAppTheme } from '../../theme/AppThemeProvider';\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 { NativeDictationBar } from '../../features/audio-input/NativeDictationBar';\nimport { isNativeDictationAvailable } from '../../features/audio-input/nativeDictation';\nimport { useImageAttachments } from '../../features/attachments/useImageAttachments';\nimport { ComposerAttachmentBar } from '../../features/attachments/ComposerAttachmentBar';\nimport { useComposerAttachMenu } from '../../features/attachments/ComposerAttachMenu';\nimport { hasComposerAttachments, takeComposerAttachments } from '../../features/attachments/composerAttachmentHandoff';\nimport { MicErrorBoundary } from '../../features/audio-input/MicErrorBoundary';\nimport { requestMicPermission } from '../../features/audio-input/useAudioPermission';\nimport { shouldRedirectToShop } from '../../features/shopping/chat/homeShoppingIntent';\nimport { pushShopNative, replaceWithShopNative, shopHandoffParams } from '../../features/shopping/chat/openShopNative';\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 * Home already decided this first turn belongs in Chat, not Shop. The\n * auto-fire honours that instead of classifying the same text a second time.\n */\n shopRouteChecked?: boolean;\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 const shopRouteChecked = params.shopRouteChecked === true;\n\n const { isDark } = useAppTheme();\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\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\n useLayoutEffect(() => {\n if (!channelId) return;\n cdecli.setActiveChannelId(channelId);\n }, [channelId, cdecli.setActiveChannelId]);\n\n const chat = useChatLiveStream();\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 // A message the gateway queued is persisted as it is sent, so the next\n // backend hydration brings it into `messages` too. While it waits it\n // belongs above the composer, not in the thread: hide the newest user\n // rows that match what is still queued.\n const waiting = chat.queuedFollowUps.map((queued) => queued.text.trim());\n const hidden = new Set<number>();\n for (let i = chat.messages.length - 1; i >= 0 && waiting.length > 0; i -= 1) {\n const msg = chat.messages[i];\n const match = msg.role === 'user' ? waiting.indexOf((msg.content ?? '').trim()) : -1;\n if (match >= 0) {\n hidden.add(i);\n waiting.splice(match, 1);\n }\n }\n return [\n ...chat.messages.flatMap((msg, index) =>\n hidden.has(index)\n ? []\n : [\n {\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 ],\n ),\n // Turns typed while the gateway was down. They live in the outbox, not in\n // the thread, so they survive a backend hydration and an app restart - and\n // they are always the newest rows, so they belong at the end.\n ...chat.queuedMessages.map((queued) => ({\n id: `queued-${queued.id}`,\n role: 'user' as const,\n content: queued.text,\n attachments: queued.attachments,\n queued: true,\n })),\n ];\n }, [chat.messages, chat.queuedMessages, chat.queuedFollowUps]);\n const {\n messages,\n response,\n quickReply,\n error: chatError,\n isLoading,\n isStreaming,\n messagesLoading,\n queuedMessages,\n flushQueuedMessages,\n discardQueuedMessages,\n queuedFollowUps,\n cancelQueuedFollowUp,\n sendQueuedNow,\n sendMessage,\n cancel,\n } = 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 const { rightItems, menu: attachMenu } = useComposerAttachMenu(imageAttachments, isDark);\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 // Apple on-device dictation (the iOS-built-in mic) is preferred when the\n // binary has it; the Whisper recorder above is the fallback.\n const [showNativeDictation, setShowNativeDictation] = 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 // Route params carry the looser `ModeAttachment` (everything optional); the send\n // lane wants a `MessageAttachment`. Normalise once, here, rather than casting at\n // each use - `shopHandoffParams` takes the narrower shape just as happily.\n const attachments: MessageAttachment[] | undefined = stashed?.length\n ? stashed\n : initialAttachments?.map((a, index) => ({\n id: a.id ?? `att-${index}`,\n name: a.name ?? `attachment-${index + 1}`,\n type: a.type === 'screenshot' ? ('screenshot' as const) : ('file' as const),\n ...(a.mimeType ? { mimeType: a.mimeType } : {}),\n ...(a.size ? { size: a.size } : {}),\n ...((a.url ?? a.uri) ? { url: a.url ?? a.uri } : {}),\n ...(a.dataUrl ? { dataUrl: a.dataUrl } : {}),\n }));\n if (!initialQuery && !attachments?.length) return;\n\n autoFiredRef.current = true;\n if (isDeepSearchMode) {\n setIsDeepSearchModalOpen(true);\n }\n void (async () => {\n const mode: RoutingMode = isDeepSearchMode ? 'deep-search' : isBuildMode ? 'build' : 'chat';\n let openShop = false;\n try {\n openShop =\n !shopRouteChecked &&\n (await shouldRedirectToShop(initialQuery ?? '', attachments?.length ?? 0, mode));\n } catch {\n openShop = false;\n }\n if (openShop) {\n replaceWithShopNative(\n navigation,\n shopHandoffParams({\n orgName: params.orgName,\n query: initialQuery ?? '',\n files: attachments,\n // Nothing was sent here yet: Shop carries on in this chat.\n channelId,\n }),\n );\n return;\n }\n void sendMessage(initialQuery ?? '', attachments, channelId);\n })();\n try {\n navigation.setParams({ initialQuery: null, initialAttachments: null });\n } catch {\n /* setParams may be unavailable in tests; clearing is best-effort. */\n }\n }, [\n channelId,\n initialQuery,\n initialAttachments,\n sendMessage,\n navigation,\n cdecli.status,\n isDeepSearchMode,\n isBuildMode,\n params.orgName,\n shopRouteChecked,\n ]);\n\n /**\n * Answer a parked `[ASK_USER]` question. The formatted `**Title:** answer`\n * block goes out as an ordinary user message — cdecli absorbs it into the\n * turn it parked, which is what releases the run. Deliberately NOT routed\n * through handleSend: no deep-search/build-mode rewriting, no attachments,\n * and it must send even while the turn is still streaming.\n */\n const handleAskUserAnswer = useCallback(\n (formatted: string) => {\n const text = formatted.trim();\n if (!text) return;\n void sendMessage(text, undefined, channelId);\n },\n [sendMessage, channelId],\n );\n\n const [resolvedAskIds, setResolvedAskIds] = useState<Record<string, boolean>>({});\n const pendingAsk = useMemo(\n () =>\n pendingAskUser([\n ...transcriptRows,\n ...(response?.trim() ? [{ role: 'assistant', content: response }] : []),\n ]),\n [transcriptRows, response],\n );\n const showAskCard = Boolean(pendingAsk && !resolvedAskIds[pendingAsk.requestId]);\n\n /**\n * Answer a `[CONNECTOR_CONNECT]` card (a login to save, a connector to connect).\n * Like the ASK_USER answer it skips handleSend's mode rewriting: the\n * `[CONNECTOR_CONNECTED:<requestId>:<credentialId>]` reply goes out as is, names\n * the saved credential so the agent can sign in with it at once, and the\n * transcript hides it (it is protocol, not something the user said).\n */\n const sendConnectorReply = useCallback(\n async (text: string): Promise<boolean> => {\n if (!channelId) return false;\n return (await sendMessage(text, undefined, channelId)) !== 'failed';\n },\n [sendMessage, channelId],\n );\n // The transcript shows the thread without the protocol: the card stands in for\n // the marker, and its reply is not something the user said. Ids are kept, so\n // regenerate-from-row still indexes chat.messages.\n const transcriptDisplayRows = useMemo(() => displayConnectorConnectMessages(transcriptRows), [transcriptRows]);\n const transcriptStreaming = useMemo(\n () => (response ? displayConnectorConnectText(response, true) : response),\n [response],\n );\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 (async () => {\n let openShop = false;\n try {\n // `forSend()` is undefined with nothing attached; `.length` on it threw\n // into the catch below, so a typed shopping ask never reached Shop.\n openShop = await shouldRedirectToShop(\n t,\n pending?.length ?? 0,\n isDeepSearchMode ? 'deep-search' : 'chat',\n );\n } catch {\n openShop = false;\n }\n if (openShop) {\n if (messages.length === 0) {\n // An empty thread is replaced, so Shop carries on in it.\n replaceWithShopNative(\n navigation,\n shopHandoffParams({ orgName: params.orgName, query: t, files: pending, channelId }),\n );\n } else {\n pushShopNative(\n navigation,\n shopHandoffParams({ orgName: params.orgName, query: t, files: pending }),\n );\n }\n return;\n }\n void sendMessage(t, pending, channelId);\n })();\n imageAttachments.clear();\n },\n [\n channelId,\n sendMessage,\n isDeepSearchMode,\n isBuildMode,\n navigation,\n params.orgName,\n imageAttachments,\n messages.length,\n ],\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 /** Open the record -> Whisper recorder (the fallback mic lane). */\n const openWhisperRecorder = useCallback(() => {\n setVoiceError(null);\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 }, []);\n\n const handleMicPress = useCallback(() => {\n if (hasQuery) return;\n setVoiceError(null);\n Keyboard.dismiss();\n // Prefer Apple's on-device dictation (the iOS-built-in mic): it streams\n // text live and needs no upload. The bar requests its own permission\n // and calls back to the Whisper recorder if the native path is\n // unusable. Only reachable on a build that linked the native module.\n if (isNativeDictationAvailable()) {\n setShowNativeDictation(true);\n return;\n }\n openWhisperRecorder();\n }, [hasQuery, openWhisperRecorder]);\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 /** Append a finished transcript to the composer and re-focus it. Shared by\n * the Whisper recorder and native dictation. */\n const pasteTranscript = useCallback((text: string) => {\n const cleaned = (text ?? '').trim();\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 handleTranscriptionComplete = useCallback(\n (text: string) => {\n setShowAudioRecorder(false);\n pasteTranscript(text);\n },\n [pasteTranscript],\n );\n\n const handleRecorderCancel = useCallback(() => {\n setShowAudioRecorder(false);\n }, []);\n\n const handleDictationComplete = useCallback(\n (text: string) => {\n setShowNativeDictation(false);\n pasteTranscript(text);\n },\n [pasteTranscript],\n );\n\n const handleDictationCancel = useCallback(() => setShowNativeDictation(false), []);\n\n /** Native dictation could not run - drop to the Whisper recorder, which\n * requests its own permission and surfaces its own errors. */\n const handleDictationFallback = useCallback(() => {\n setShowNativeDictation(false);\n openWhisperRecorder();\n }, [openWhisperRecorder]);\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 // The summary is the agent's answer, not the quick answer framed in front of it.\n return splitPreResponse(messages[i]?.content).text;\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 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 (queued for the agent). 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 // Queue affordances: the gateway is live, so a queue that is still sitting there\n // failed its release and the user gets a manual retry beside the discard.\n const gatewayLive = cdecli.channelConnected;\n const queuedActionColor = isDark ? '#fbbf24' : '#b45309';\n const handleSendQueuedNow = useCallback(() => {\n void flushQueuedMessages();\n }, [flushQueuedMessages]);\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 && !quickReply && !isStreaming;\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 <KeyboardAwareScreen>\n <View style={styles.chatColumn}>\n {queuedMessages.length > 0 && (\n <Box\n mb=\"$2\"\n mx=\"$4\"\n p=\"$3\"\n borderRadius=\"$md\"\n style={{\n backgroundColor: isDark ? '#2a2113' : '#fffbeb',\n borderWidth: 1,\n borderColor: isDark ? '#78350f' : '#fde68a',\n flexDirection: 'row',\n alignItems: 'center',\n }}\n >\n <Text fontSize=\"$sm\" style={{ color: isDark ? '#fde68a' : '#92400e', flex: 1 }}>\n {queuedMessages.length === 1\n ? '1 message waiting for the gateway.'\n : `${queuedMessages.length} messages waiting for the gateway.`}{' '}\n {gatewayLive ? 'Sending…' : 'They send as soon as it connects.'}\n </Text>\n {gatewayLive ? (\n <Pressable onPress={handleSendQueuedNow} hitSlop={8} style={styles.queuedAction}>\n <Text\n fontSize=\"$xs\"\n style={[styles.queuedActionText, { color: queuedActionColor }]}\n >\n Send now\n </Text>\n </Pressable>\n ) : null}\n <Pressable onPress={discardQueuedMessages} hitSlop={8} style={styles.queuedAction}>\n <Text fontSize=\"$xs\" style={[styles.queuedActionText, { color: queuedActionColor }]}>\n Discard\n </Text>\n </Pressable>\n </Box>\n )}\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 <Box flex={1} px=\"$4\" pt=\"$8\">\n <ThinkingIndicator\n variant=\"awaiting\"\n color={secondaryTextColor}\n isDark={isDark}\n label=\"Opening conversation…\"\n />\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 <View style={styles.transcriptPane}>\n <ChatTranscript\n messages={transcriptDisplayRows}\n streamingContent={transcriptStreaming}\n quickReply={quickReply}\n listFooter={\n showSendingLoader && pinSendingLoaderNearComposer ? (\n <View style={styles.thinkingInThread}>\n <ThinkingIndicator\n variant=\"awaiting\"\n color={secondaryTextColor}\n isDark={isDark}\n />\n </View>\n ) : null\n }\n renderMessageActions={renderMessageActions}\n isDark={isDark}\n listContentStyle={{\n paddingTop: 12,\n paddingBottom: 8,\n margin: 0,\n width: contentMaxWidth,\n alignSelf: 'center',\n }}\n />\n </View>\n )}\n {showSendingLoader && !pinSendingLoaderNearComposer ? (\n <View pointerEvents=\"none\" style={styles.sendingLoaderEmptyState}>\n <ThinkingIndicator variant=\"awaiting\" color={secondaryTextColor} isDark={isDark} />\n </View>\n ) : null}\n <KeyboardComposerDock closedInset={insets.bottom} onSwipeUp={() => inputRef.current?.focus()}>\n {showAskCard && pendingAsk ? (\n <View style={{ width: contentMaxWidth, paddingHorizontal: 8 }}>\n <AskUserCard\n payload={pendingAsk}\n isDark={isDark}\n onAnswer={(formatted) => {\n setResolvedAskIds((prev) => ({ ...prev, [pendingAsk.requestId]: true }));\n handleAskUserAnswer(formatted);\n }}\n onDismiss={() =>\n setResolvedAskIds((prev) => ({ ...prev, [pendingAsk.requestId]: true }))\n }\n />\n </View>\n ) : null}\n {showAskCard ? null : (\n <PendingConnectorConnectCard\n messages={transcriptRows}\n send={sendConnectorReply}\n isDark={isDark}\n style={{ width: contentMaxWidth, paddingHorizontal: 8 }}\n />\n )}\n <View style={{ width: contentMaxWidth }}>\n <QueuedFollowUps\n items={queuedFollowUps}\n onCancel={cancelQueuedFollowUp}\n onSendNow={sendQueuedNow}\n isDark={isDark}\n />\n </View>\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 {showNativeDictation ? (\n // A throw inside the native recognizer degrades to\n // the Whisper recorder rather than killing the JS\n // thread (same guard rationale as the recorder).\n <MicErrorBoundary onCancel={handleDictationFallback} onError={handleDictationFallback}>\n <NativeDictationBar\n isDark={isDark}\n onInterim={() => undefined}\n onTranscriptionComplete={handleDictationComplete}\n onCancel={handleDictationCancel}\n onFallback={handleDictationFallback}\n />\n </MicErrorBoundary>\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 </View>\n </KeyboardAwareScreen>\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 {attachMenu}\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n chatColumn: {\n flex: 1,\n width: '100%',\n },\n transcriptPane: {\n flex: 1,\n minHeight: 0,\n width: '100%',\n },\n statusText: {\n marginTop: 14,\n fontSize: 13,\n fontWeight: '500',\n },\n bottomComposerInner: {\n paddingHorizontal: 14,\n paddingTop: 10,\n paddingBottom: 0,\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: 24,\n paddingHorizontal: 20,\n zIndex: 40,\n },\n queuedAction: {\n paddingHorizontal: 8,\n paddingVertical: 2,\n },\n queuedActionText: {\n fontWeight: '600',\n },\n thinkingInThread: {\n paddingHorizontal: 12,\n paddingTop: 10,\n paddingBottom: 4,\n },\n});\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;AAqEA,SAAwB,UAAa,GAAA;AArErC,EAAA,IAAA,EAAA;AAsEE,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,EAAC;AAClC,EAAM,MAAA,SAAA,GAAY,QAAQ,MAAM;AAC9B,IAAM,MAAA,GAAA,GAAM,OAAO,MAAO,CAAA,SAAA,KAAc,WAAW,MAAO,CAAA,SAAA,CAAU,MAAS,GAAA,EAAA;AAC7E,IAAO,OAAA,GAAA,CAAI,MAAS,GAAA,CAAA,GAAI,GAAM,GAAA,IAAA;AAAA,GAC7B,EAAA,CAAC,MAAO,CAAA,SAAS,CAAC,CAAA;AACrB,EAAM,MAAA,YAAA,GAAe,QAAQ,MAAM;AACjC,IAAM,MAAA,GAAA,GAAM,OAAO,MAAO,CAAA,YAAA,KAAiB,WAAW,MAAO,CAAA,YAAA,CAAa,MAAS,GAAA,EAAA;AACnF,IAAO,OAAA,GAAA,CAAI,MAAS,GAAA,CAAA,GAAI,GAAM,GAAA,IAAA;AAAA,GAC7B,EAAA,CAAC,MAAO,CAAA,YAA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