@adminide-stack/clock-tik-mobile 12.0.37-alpha.0 → 12.0.37-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/jest.config.cjs +3 -0
  3. package/lib/chat/agent.js +40 -1
  4. package/lib/chat/agent.js.map +1 -1
  5. package/lib/chat/connectors.js +3 -0
  6. package/lib/chat/connectors.js.map +1 -1
  7. package/lib/chat/handover.js +196 -0
  8. package/lib/chat/handover.js.map +1 -0
  9. package/lib/chat/protocol.js +16 -2
  10. package/lib/chat/protocol.js.map +1 -1
  11. package/lib/components/HandoverCards.js +179 -0
  12. package/lib/components/HandoverCards.js.map +1 -0
  13. package/lib/components/ResultCards.js +3 -3
  14. package/lib/components/ResultCards.js.map +1 -1
  15. package/lib/config/env-config.js +7 -1
  16. package/lib/config/env-config.js.map +1 -1
  17. package/lib/offer/blackFriday.js.map +1 -1
  18. package/lib/offer/state.js.map +1 -1
  19. package/lib/screens/Chat/index.js +2 -1
  20. package/lib/screens/Chat/index.js.map +1 -1
  21. package/lib/screens/Home/index.js +9 -5
  22. package/lib/screens/Home/index.js.map +1 -1
  23. package/lib/utils/yantraLinks.js +26 -8
  24. package/lib/utils/yantraLinks.js.map +1 -1
  25. package/package.json +4 -4
  26. package/src/__tests__/agent.test.ts +201 -0
  27. package/src/__tests__/chores.test.ts +15 -2
  28. package/src/__tests__/connectLink.test.ts +21 -0
  29. package/src/__tests__/envConfig.test.ts +14 -0
  30. package/src/__tests__/handover.test.ts +149 -0
  31. package/src/__tests__/protocol.test.ts +27 -2
  32. package/src/__tests__/yantraLinks.test.ts +66 -1
  33. package/src/chat/agent.ts +65 -0
  34. package/src/chat/connectors.ts +13 -3
  35. package/src/chat/handover.ts +241 -0
  36. package/src/chat/protocol.ts +23 -7
  37. package/src/components/HandoverCards.tsx +224 -0
  38. package/src/components/ResultCards.tsx +4 -3
  39. package/src/config/env-config.ts +13 -0
  40. package/src/offer/blackFriday.ts +1 -1
  41. package/src/offer/state.ts +1 -1
  42. package/src/screens/Chat/index.tsx +6 -1
  43. package/src/screens/Home/index.tsx +10 -7
  44. package/src/utils/yantraLinks.ts +40 -10
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sources":["../../src/chat/protocol.ts"],"sourcesContent":["/**\n * What Lucy's agent says, made readable: the same rules the web chat applies (@yantra/surface-kit agentChat.ts\n * visibleAgentOutput, chat/askUser.ts), without the DOM. Pure functions; tested in __tests__/protocol.test.ts.\n */\n// Lucy's own prompt and how she hands over results as cards, read-only from the browser package's build.\nimport { LUCY_SYSTEM_PROMPT } from '@adminide-stack/clock-tik-browser/lib/pages/Home/chat/lucy.js';\nimport {\n RESULT_CARDS_PROMPT,\n takeResultWidgets,\n} from '@adminide-stack/clock-tik-browser/lib/pages/Home/chat/results.js';\n\nexport const MAX_QUESTIONS = 6;\n\n/**\n * How to ask instead of asking in prose (the web's ASK_USER_SYSTEM_PROMPT), minus what this app does not draw yet:\n * attachments and audio previews.\n */\nexport const ASK_USER_PROMPT = [\n 'CLARIFYING QUESTIONS: When you need information from the user before you can act (missing details, a choice between approaches), do NOT ask in prose. Instead reply with ONLY this marker (no other text before or after):',\n '[ASK_USER]{\"requestId\":\"<short-unique-id>\",\"questions\":[{\"id\":\"<id>\",\"title\":\"<the question>\",\"options\":[{\"id\":\"<id>\",\"label\":\"<choice>\"}],\"allowText\":true,\"textPlaceholder\":\"<hint for free-text>\"}]}[/ASK_USER]',\n `Rules: 1-${MAX_QUESTIONS} questions max, shown one at a time (the user can skip any, or type their own answer); options are optional (omit for pure free-text questions); keep titles short — they are echoed back as \"**title:** answer\", and a skipped question is left out. The UI renders this as an interactive card, so the raw marker is never shown to the user. Only use it when genuinely blocked on user input; if you can proceed with sensible assumptions, proceed.`,\n 'Optional fields: a question\\'s \"header\" (a 1-2 word topic above it); \"multiSelect\":true when several options can apply (the answer is their labels, comma-separated). An option\\'s \"detail\" (one line under the label).',\n].join('\\n');\n\n/** The session's system prompt: Lucy, then how to ask. Set once, when the session opens. */\nexport const SYSTEM_PROMPT = `${LUCY_SYSTEM_PROMPT}\\n\\n${ASK_USER_PROMPT}`;\n\n/** Sent with a new turn id when a step was cut off part-way (agentChat.ts AGENT_CONTINUE_PROMPT). */\nexport const CONTINUE_PROMPT =\n '[Note from the app, not from the user: your last step was cut off by a temporary problem on our side, ' +\n 'after some of its actions had already run. Everything you already did is in the conversation above. ' +\n \"Carry on with the user's request from where you stopped, and do not repeat an action that already went through.]\";\n\n/**\n * A turn as the agent gets it: the person's words, then how to hand over flights and products so the chat draws them\n * as cards (components/ResultCards.tsx), for the agent alone, in the Yantra app's `<agent-context>` envelope (the web's\n * lucyTurn). It rides every turn because a session keeps the system prompt it opened with. The thread, the chore\n * record and History keep the words as typed.\n */\nexport function agentTurn(words: string): string {\n return `${words}\\n\\n<agent-context>${RESULT_CARDS_PROMPT.trim()}</agent-context>`;\n}\n\n// eslint-disable-next-line no-control-regex\nconst ANSI = /\\u001b\\[[0-9;]*m/g;\nconst TERMINAL_QUESTION =\n /^\\s*[╭╮╰╯│─┌┐└┘├┤]|^\\s*(?:Answer 1-\\d+(?: \\(comma-separated\\))? or type your own|Type your answer); Enter to skip:?\\s*$|^ {2}(?:✓ |⨯ Skipped)/u;\nconst TERMINAL_ACCOUNTING =\n /^\\s*(?:⚡ Tokens: |💡 (?:Context growing fast|\\d+ tool-use iterations detected|Session cost \\$)|⚠ billing policy check unavailable \\(.*allowing metered action\\s*$|⚠ billing policy: .*\\(CDECLI_BILLING_POLICY=warn: not blocking\\)\\s*$)/u;\n\n/** A whole `output` event, minus the terminal's own furniture. */\nexport function visibleOutput(text: string): string {\n return text\n .replace(ANSI, '')\n .replace(/\\[CDECLI_ASK_USER_QUESTION\\][\\s\\S]*?(?:\\[\\/CDECLI_ASK_USER_QUESTION\\]|$)/g, '')\n .split('\\n')\n .filter((line) => !/^\\s*🧠/u.test(line) && !TERMINAL_ACCOUNTING.test(line) && !TERMINAL_QUESTION.test(line))\n .join('\\n')\n .trimStart();\n}\n\n/** What goes between the reply so far and a following output, so the output starts its own paragraph. */\nexport function joinOutput(reply: string, output: string): string {\n if (!output) return reply;\n if (!reply) return output;\n if (reply.endsWith('\\n\\n')) return reply + output;\n return reply + (reply.endsWith('\\n') ? '\\n' : '\\n\\n') + output;\n}\n\n/* ----------------------------------------------------------------------------- question cards */\n\nexport interface AskOption {\n id: string;\n label: string;\n detail?: string;\n}\nexport interface AskQuestion {\n id: string;\n header?: string;\n title: string;\n options: AskOption[];\n allowText: boolean;\n textPlaceholder?: string;\n multiSelect: boolean;\n}\nexport interface AskUser {\n requestId: string;\n questions: AskQuestion[];\n}\n\nconst ASK_RE = /\\[ASK_USER\\]([\\s\\S]*?)\\[\\/ASK_USER\\]/;\nconst ASK_RE_ALL = /\\[ASK_USER\\][\\s\\S]*?(?:\\[\\/ASK_USER\\]|$)/g;\n\n/** The question card in a reply, if it has a whole one. */\nexport function parseAskUser(text: string): AskUser | null {\n const m = ASK_RE.exec(text);\n if (!m) return null;\n let raw: { requestId?: string; questions?: unknown[] };\n try {\n raw = JSON.parse(m[1].trim());\n } catch {\n return null;\n }\n const questions = (Array.isArray(raw?.questions) ? raw.questions : [])\n .slice(0, MAX_QUESTIONS)\n .map((q, i): AskQuestion | null => {\n const o = q as Record<string, unknown>;\n const title = String(o.title ?? o.question ?? '').trim();\n if (!title) return null;\n const options = (Array.isArray(o.options) ? o.options : []).map((op, j): AskOption => {\n if (typeof op === 'string') return { id: `o${j}`, label: op };\n const p = op as Record<string, unknown>;\n return {\n id: String(p.id ?? `o${j}`),\n label: String(p.label ?? ''),\n detail: (p.detail ?? p.description) ? String(p.detail ?? p.description) : undefined,\n };\n });\n return {\n id: String(o.id ?? `q${i}`),\n header: o.header ? String(o.header) : undefined,\n title,\n options: options.filter((op) => op.label),\n allowText: o.allowText !== false,\n textPlaceholder: o.textPlaceholder ? String(o.textPlaceholder) : undefined,\n multiSelect: o.multiSelect === true,\n };\n })\n .filter((q): q is AskQuestion => q !== null);\n if (!questions.length) return null;\n return { requestId: String(raw.requestId ?? 'ask'), questions };\n}\n\n/** One answer: picked option labels, or typed text (typed text wins). Empty = skipped. */\nexport interface AskAnswer {\n picked: string[];\n text: string;\n}\n\n/** The answer message, as the web sends it: \"**Title:** answer\" paragraphs, skipped questions left out. */\nexport function formatAskAnswers(ask: AskUser, answers: Record<string, AskAnswer>): string {\n return ask.questions\n .map((q) => {\n const a = answers[q.id];\n const value = a?.text.trim() || (a?.picked.length ? a.picked.join(', ') : '');\n if (!value) return '';\n return `**${q.title.replace(/[::]\\s*$/, '')}:** ${value}`;\n })\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/* ----------------------------------------------------------------------------- display */\n\n/**\n * A reply's text as the bubble shows it: no question block (it has its own card), no result blocks in any of the forms\n * a model writes them (fenced, under a bare marker, or still streaming in: they draw as cards), and the web-only\n * markers either dropped (Connect cards, other widgets) or reduced to a plain label (surface links).\n */\nexport function displayText(text: string): string {\n return takeResultWidgets(text)\n .content.replace(ASK_RE_ALL, '')\n .replace(/\\[CONNECTOR_CONNECT\\][\\s\\S]*?(?:\\[\\/CONNECTOR_CONNECT\\]|$)/g, '')\n .replace(/```yantra:widget[\\s\\S]*?(?:```|$)/g, '')\n .replace(/\\[\\[surface:[^|\\]]+\\|([^\\]]+)\\]\\]/g, '$1')\n .replace(/\\[\\[surface:([^\\]]+)\\]\\]/g, '$1')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n\n/** A short title for a chat in History: its first message. */\nexport function chatTitle(firstMessage: string): string {\n const t = firstMessage.replace(/\\*\\*/g, '').replace(/\\s+/g, ' ').trim();\n return t.length > 60 ? `${t.slice(0, 57)}…` : t || 'New chat';\n}\n\n/** A progress line for a tool Lucy is using (the web's humanizeToolLine, in Clockbook's words). */\nexport function toolLine(name: string, detail?: string): string {\n const n = `${name} ${detail ?? ''}`.toLowerCase();\n if (/phone|call|dial|twilio|voice/.test(n)) return 'Making a call';\n if (/calendar|schedule|booking|meeting/.test(n)) return 'Checking the calendar';\n if (/mail|gmail|email/.test(n)) return 'Looking through email';\n if (/search|web|browse|fetch|http|site|page/.test(n)) return 'Looking it up';\n if (/message|sms|imessage|text/.test(n)) return 'Sending a message';\n if (/file|read|write|edit/.test(n)) return 'Working through the details';\n return 'Working on it';\n}\n\n/** A status event's line without its leading glyphs. */\nexport function statusLine(status: string): string {\n return status.replace(/^[^\\p{L}\\p{N}]+/u, '').trim();\n}\n"],"names":["_a","_b","_c"],"mappings":"oNAOO,MAAM,aAAgB,GAAA;AAMhB,MAAA,eAAA,GAAkB,CAAC,4NAA8N,EAAA,oNAAA,EAAsN,YAAY,aAAyc,CAAA,6bAAA,CAAA,EAAA,CAAA,qNAAA,CAAyN,CAAE,CAAA,IAAA,CAAK,IAAI;AAGtoC,MAAM,gBAAgB,CAAG,EAAA,kBAAA;;AAAA,EAAyB,eAAA,CAAA;AAGlD,MAAM,eAAkB,GAAA;AAQxB,SAAS,UAAU,KAAuB,EAAA;AAC/C,EAAA,OAAO,CAAG,EAAA,KAAA;;AAAA,eAAA,EAA2B,oBAAoB,IAAK,EAAA,CAAA,gBAAA,CAAA;AAChE;AAGA,MAAM,IAAO,GAAA,mBAAA;AACb,MAAM,iBAAoB,GAAA,gJAAA;AAC1B,MAAM,mBAAsB,GAAA,0OAAA;AAGrB,SAAS,cAAc,IAAsB,EAAA;AAClD,EAAA,OAAO,IAAK,CAAA,OAAA,CAAQ,IAAM,EAAA,EAAE,EAAE,OAAQ,CAAA,2EAAA,EAA6E,EAAE,CAAA,CAAE,KAAM,CAAA,IAAI,CAAE,CAAA,MAAA,CAAO,UAAQ,CAAC,SAAA,CAAU,IAAK,CAAA,IAAI,CAAK,IAAA,CAAC,mBAAoB,CAAA,IAAA,CAAK,IAAI,CAAK,IAAA,CAAC,iBAAkB,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA,CAAE,IAAK,CAAA,IAAI,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CAAA;AAAG,IAAO,OAAA,eAAA;AAC7D,EAAI,IAAA,2BAAA,CAA4B,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,mBAAA;AAChD,EAAI,IAAA,sBAAA,CAAuB,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,6BAAA;AAC3C,EAAO,OAAA,eAAA;AACT;AAGO,SAAS,WAAW,MAAwB,EAAA;AACjD,EAAA,OAAO,MAAO,CAAA,OAAA,CAAQ,kBAAoB,EAAA,EAAE,EAAE,IAAK,EAAA;AACrD"}
1
+ {"version":3,"file":"protocol.js","sources":["../../src/chat/protocol.ts"],"sourcesContent":["/**\n * What Lucy's agent says, made readable: the same rules the web chat applies (@yantra/surface-kit agentChat.ts\n * visibleAgentOutput, chat/askUser.ts), without the DOM. Pure functions; tested in __tests__/protocol.test.ts.\n */\n// Lucy's own prompt and how she hands over results as cards, read-only from the browser package's build.\nimport { LUCY_SYSTEM_PROMPT } from '@adminide-stack/clock-tik-browser/lib/pages/Home/chat/lucy.js';\nimport {\n RESULT_CARDS_PROMPT,\n takeResultWidgets,\n} from '@adminide-stack/clock-tik-browser/lib/pages/Home/chat/results.js';\nimport { surfaceLink } from '@adminide-stack/clock-tik-browser/lib/pages/Home/chat/surfaces.js';\nimport { stripConnectCards } from './handover';\n\nexport const MAX_QUESTIONS = 6;\n\n/**\n * How to ask instead of asking in prose (the web's ASK_USER_SYSTEM_PROMPT), minus what this app does not draw yet:\n * attachments and audio previews.\n */\nexport const ASK_USER_PROMPT = [\n 'CLARIFYING QUESTIONS: When you need information from the user before you can act (missing details, a choice between approaches), do NOT ask in prose. Instead reply with ONLY this marker (no other text before or after):',\n '[ASK_USER]{\"requestId\":\"<short-unique-id>\",\"questions\":[{\"id\":\"<id>\",\"title\":\"<the question>\",\"options\":[{\"id\":\"<id>\",\"label\":\"<choice>\"}],\"allowText\":true,\"textPlaceholder\":\"<hint for free-text>\"}]}[/ASK_USER]',\n `Rules: 1-${MAX_QUESTIONS} questions max, shown one at a time (the user can skip any, or type their own answer); options are optional (omit for pure free-text questions); keep titles short — they are echoed back as \"**title:** answer\", and a skipped question is left out. The UI renders this as an interactive card, so the raw marker is never shown to the user. Only use it when genuinely blocked on user input; if you can proceed with sensible assumptions, proceed.`,\n 'Optional fields: a question\\'s \"header\" (a 1-2 word topic above it); \"multiSelect\":true when several options can apply (the answer is their labels, comma-separated). An option\\'s \"detail\" (one line under the label).',\n].join('\\n');\n\n/** The session's system prompt: Lucy, then how to ask. Set once, when the session opens. */\nexport const SYSTEM_PROMPT = `${LUCY_SYSTEM_PROMPT}\\n\\n${ASK_USER_PROMPT}`;\n\n/** Sent with a new turn id when a step was cut off part-way (agentChat.ts AGENT_CONTINUE_PROMPT). */\nexport const CONTINUE_PROMPT =\n '[Note from the app, not from the user: your last step was cut off by a temporary problem on our side, ' +\n 'after some of its actions had already run. Everything you already did is in the conversation above. ' +\n \"Carry on with the user's request from where you stopped, and do not repeat an action that already went through.]\";\n\n/**\n * A turn as the agent gets it: the person's words, then how to hand over flights and products so the chat draws them\n * as cards (components/ResultCards.tsx), for the agent alone, in the Yantra app's `<agent-context>` envelope (the web's\n * lucyTurn). It rides every turn because a session keeps the system prompt it opened with. The thread, the chore\n * record and History keep the words as typed.\n */\nexport function agentTurn(words: string): string {\n return `${words}\\n\\n<agent-context>${RESULT_CARDS_PROMPT.trim()}</agent-context>`;\n}\n\n// eslint-disable-next-line no-control-regex\nconst ANSI = /\\u001b\\[[0-9;]*m/g;\nconst TERMINAL_QUESTION =\n /^\\s*[╭╮╰╯│─┌┐└┘├┤]|^\\s*(?:Answer 1-\\d+(?: \\(comma-separated\\))? or type your own|Type your answer); Enter to skip:?\\s*$|^ {2}(?:✓ |⨯ Skipped)/u;\nconst TERMINAL_ACCOUNTING =\n /^\\s*(?:⚡ Tokens: |💡 (?:Context growing fast|\\d+ tool-use iterations detected|Session cost \\$)|⚠ billing policy check unavailable \\(.*allowing metered action\\s*$|⚠ billing policy: .*\\(CDECLI_BILLING_POLICY=warn: not blocking\\)\\s*$)/u;\n\n/** A whole `output` event, minus the terminal's own furniture. */\nexport function visibleOutput(text: string): string {\n return text\n .replace(ANSI, '')\n .replace(/\\[CDECLI_ASK_USER_QUESTION\\][\\s\\S]*?(?:\\[\\/CDECLI_ASK_USER_QUESTION\\]|$)/g, '')\n .split('\\n')\n .filter((line) => !/^\\s*🧠/u.test(line) && !TERMINAL_ACCOUNTING.test(line) && !TERMINAL_QUESTION.test(line))\n .join('\\n')\n .trimStart();\n}\n\n/** What goes between the reply so far and a following output, so the output starts its own paragraph. */\nexport function joinOutput(reply: string, output: string): string {\n if (!output) return reply;\n if (!reply) return output;\n if (reply.endsWith('\\n\\n')) return reply + output;\n return reply + (reply.endsWith('\\n') ? '\\n' : '\\n\\n') + output;\n}\n\n/* ----------------------------------------------------------------------------- question cards */\n\nexport interface AskOption {\n id: string;\n label: string;\n detail?: string;\n}\nexport interface AskQuestion {\n id: string;\n header?: string;\n title: string;\n options: AskOption[];\n allowText: boolean;\n textPlaceholder?: string;\n multiSelect: boolean;\n}\nexport interface AskUser {\n requestId: string;\n questions: AskQuestion[];\n}\n\nconst ASK_RE = /\\[ASK_USER\\]([\\s\\S]*?)\\[\\/ASK_USER\\]/;\nconst ASK_RE_ALL = /\\[ASK_USER\\][\\s\\S]*?(?:\\[\\/ASK_USER\\]|$)/g;\n\n/** The question card in a reply, if it has a whole one. */\nexport function parseAskUser(text: string): AskUser | null {\n const m = ASK_RE.exec(text);\n if (!m) return null;\n let raw: { requestId?: string; questions?: unknown[] };\n try {\n raw = JSON.parse(m[1].trim());\n } catch {\n return null;\n }\n const questions = (Array.isArray(raw?.questions) ? raw.questions : [])\n .slice(0, MAX_QUESTIONS)\n .map((q, i): AskQuestion | null => {\n const o = q as Record<string, unknown>;\n const title = String(o.title ?? o.question ?? '').trim();\n if (!title) return null;\n const options = (Array.isArray(o.options) ? o.options : []).map((op, j): AskOption => {\n if (typeof op === 'string') return { id: `o${j}`, label: op };\n const p = op as Record<string, unknown>;\n return {\n id: String(p.id ?? `o${j}`),\n label: String(p.label ?? ''),\n detail: (p.detail ?? p.description) ? String(p.detail ?? p.description) : undefined,\n };\n });\n return {\n id: String(o.id ?? `q${i}`),\n header: o.header ? String(o.header) : undefined,\n title,\n options: options.filter((op) => op.label),\n allowText: o.allowText !== false,\n textPlaceholder: o.textPlaceholder ? String(o.textPlaceholder) : undefined,\n multiSelect: o.multiSelect === true,\n };\n })\n .filter((q): q is AskQuestion => q !== null);\n if (!questions.length) return null;\n return { requestId: String(raw.requestId ?? 'ask'), questions };\n}\n\n/** One answer: picked option labels, or typed text (typed text wins). Empty = skipped. */\nexport interface AskAnswer {\n picked: string[];\n text: string;\n}\n\n/** The answer message, as the web sends it: \"**Title:** answer\" paragraphs, skipped questions left out. */\nexport function formatAskAnswers(ask: AskUser, answers: Record<string, AskAnswer>): string {\n return ask.questions\n .map((q) => {\n const a = answers[q.id];\n const value = a?.text.trim() || (a?.picked.length ? a.picked.join(', ') : '');\n if (!value) return '';\n return `**${q.title.replace(/[::]\\s*$/, '')}:** ${value}`;\n })\n .filter(Boolean)\n .join('\\n\\n');\n}\n\n/* ----------------------------------------------------------------------------- display */\n\n/** A surface marker as the gateway reads it (surfaces.ts MARKER): `[[surface:<id>]]` or `[[surface:<id>|<label>]]`. */\nconst SURFACE_MARKER = /[ \\t]*\\[\\[\\s*surface\\s*:\\s*([A-Za-z0-9_-]{1,40})\\s*(?:\\|\\s*([^\\]\\n]{0,200}?))?\\s*\\]\\]/gi;\n\n/** The text without a surface marker still streaming in at its end (`[[surface:comp`), as surfaces.ts cuts it. */\nfunction withoutUnfinishedSurface(text: string): string {\n const at = text.lastIndexOf('[[');\n if (at < 0) return text;\n const tail = text.slice(at + 2);\n if (tail.includes('\\n') || tail.includes(']]')) return text;\n const head = tail.trimStart().toLowerCase();\n return head.startsWith('surface') || 'surface'.startsWith(head) ? text.slice(0, at) : text;\n}\n\n/**\n * A reply's text as the bubble shows it: no question block (it has its own card), no result blocks in any of the forms\n * a model writes them (fenced, under a bare marker, or still streaming in: they draw as cards), no Connect cards and no\n * marker of a surface this chat opens (both drawn under the bubble, components/HandoverCards.tsx), other widgets\n * dropped, and a surface this chat cannot open reduced to its plain label.\n */\nexport function displayText(text: string): string {\n return withoutUnfinishedSurface(stripConnectCards(takeResultWidgets(text).content.replace(ASK_RE_ALL, '')))\n .replace(/```yantra:widget[\\s\\S]*?(?:```|$)/g, '')\n .replace(SURFACE_MARKER, (marker: string, id: string, label: string | undefined) =>\n surfaceLink(id) ? '' : `${/^[ \\t]*/.exec(marker)?.[0] ?? ''}${(label ?? id).trim()}`,\n )\n .replace(/^[ \\t]+$/gm, '')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n\n/** A short title for a chat in History: its first message. */\nexport function chatTitle(firstMessage: string): string {\n const t = firstMessage.replace(/\\*\\*/g, '').replace(/\\s+/g, ' ').trim();\n return t.length > 60 ? `${t.slice(0, 57)}…` : t || 'New chat';\n}\n\n/** A progress line for a tool Lucy is using (the web's humanizeToolLine, in Clockbook's words). */\nexport function toolLine(name: string, detail?: string): string {\n const n = `${name} ${detail ?? ''}`.toLowerCase();\n if (/phone|call|dial|twilio|voice/.test(n)) return 'Making a call';\n if (/calendar|schedule|booking|meeting/.test(n)) return 'Checking the calendar';\n if (/mail|gmail|email/.test(n)) return 'Looking through email';\n if (/search|web|browse|fetch|http|site|page/.test(n)) return 'Looking it up';\n if (/message|sms|imessage|text/.test(n)) return 'Sending a message';\n if (/file|read|write|edit/.test(n)) return 'Working through the details';\n return 'Working on it';\n}\n\n/** A status event's line without its leading glyphs. */\nexport function statusLine(status: string): string {\n return status.replace(/^[^\\p{L}\\p{N}]+/u, '').trim();\n}\n"],"names":["_a","_b","_c"],"mappings":"8VASO,MAAM,aAAgB,GAAA;AAMhB,MAAA,eAAA,GAAkB,CAAC,4NAA8N,EAAA,oNAAA,EAAsN,YAAY,aAAyc,CAAA,6bAAA,CAAA,EAAA,CAAA,qNAAA,CAAy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,UAAA;AACrD;AAGgB,SAAA,QAAA,CAAS,MAAc,MAAyB,EAAA;AAC9D,EAAA,MAAM,CAAI,GAAA,CAAA,EAAG,IAAQ,CAAA,CAAA,EAAA,MAAA,IAAA,IAAA,GAAA,MAAA,GAAU,KAAK,WAAY,EAAA;AAChD,EAAI,IAAA,8BAAA,CAA+B,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,eAAA;AACnD,EAAI,IAAA,mCAAA,CAAoC,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,uBAAA;AACxD,EAAI,IAAA,kBAAA,CAAmB,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,uBAAA;AACvC,EAAI,IAAA,wCAAA,CAAyC,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,eAAA;AAC7D,EAAI,IAAA,2BAAA,CAA4B,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,mBAAA;AAChD,EAAI,IAAA,sBAAA,CAAuB,KAAK,CAAC,CAAA;AAAG,IAAO,OAAA,6BAAA;AAC3C,EAAO,OAAA,eAAA;AACT;AAGO,SAAS,WAAW,MAAwB,EAAA;AACjD,EAAA,OAAO,MAAO,CAAA,OAAA,CAAQ,kBAAoB,EAAA,EAAE,EAAE,IAAK,EAAA;AACrD"}
@@ -0,0 +1,179 @@
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {useMemo,useState}from'react';import {View,StyleSheet,Pressable,Text}from'react-native';import {Ionicons}from'@expo/vector-icons';import {agentAppUrl}from'../chat/auth.js';import {surfaceHandovers,connectHandovers,surfaceButton,doneWords,connectHeading,connectButton,connectUrl,connectName}from'../chat/handover.js';import {surfaceUrl}from'../chat/results.js';import {yantraAppUrl}from'../utils/links.js';import {openYantraInSheet}from'../utils/yantraLinks.js';import {tap}from'../welcome/haptics.js';import {ConnectorLogo}from'./ConnectorLogo.js';import {ui}from'../theme/muse.js';const appUrl = () => agentAppUrl().catch(() => "").then((app) => app || yantraAppUrl());
2
+ function HandoverCards({
3
+ text,
4
+ live,
5
+ onReply
6
+ }) {
7
+ const surfaces = useMemo(() => surfaceHandovers(text), [text]);
8
+ const connects = useMemo(() => connectHandovers(text), [text]);
9
+ if (!surfaces.length && !connects.length)
10
+ return null;
11
+ return /* @__PURE__ */ jsxs(View, { style: s.stack, children: [
12
+ surfaces.map((surface) => /* @__PURE__ */ jsx(SurfaceCard, { surface, live, onReply }, surface.id)),
13
+ connects.map((card) => /* @__PURE__ */ jsx(ConnectCard, { card, live, onReply }, card.requestId))
14
+ ] });
15
+ }
16
+ function useOpened() {
17
+ const [opened, setOpened] = useState(false);
18
+ const [opening, setOpening] = useState(false);
19
+ const open = (link) => {
20
+ if (opening)
21
+ return;
22
+ tap();
23
+ setOpening(true);
24
+ link().then((url) => url ? openYantraInSheet(url).then(() => setOpened(true)) : void 0).catch(() => void 0).finally(() => setOpening(false));
25
+ };
26
+ return [opened, open];
27
+ }
28
+ function DoneButton({
29
+ label,
30
+ words,
31
+ onReply
32
+ }) {
33
+ return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: label, onPress: () => {
34
+ tap();
35
+ onReply(words);
36
+ }, hitSlop: 6, style: ({
37
+ pressed
38
+ }) => [s.done, pressed && s.donePressed], children: [
39
+ /* @__PURE__ */ jsx(Ionicons, { name: "checkmark", size: 16, color: ui.surface }),
40
+ /* @__PURE__ */ jsx(Text, { style: s.doneText, children: label })
41
+ ] });
42
+ }
43
+ function SurfaceCard({
44
+ surface,
45
+ live,
46
+ onReply
47
+ }) {
48
+ const [opened, open] = useOpened();
49
+ const button = surfaceButton(surface);
50
+ return /* @__PURE__ */ jsxs(View, { style: s.group, children: [
51
+ /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "link", accessibilityLabel: surface.label ? `${surface.label}. ${button}` : button, accessibilityHint: `Opens ${surface.title} over the chat`, onPress: () => open(() => appUrl().then((app) => surfaceUrl(surface.host, app))), style: ({
52
+ pressed
53
+ }) => [s.card, pressed && s.cardPressed], children: [
54
+ /* @__PURE__ */ jsx(View, { style: s.tile, children: /* @__PURE__ */ jsx(Ionicons, { name: surface.id === "computer" ? "desktop-outline" : "albums-outline", size: 18, color: ui.accentText }) }),
55
+ /* @__PURE__ */ jsxs(View, { style: s.text, children: [
56
+ /* @__PURE__ */ jsx(Text, { style: s.title, numberOfLines: 2, children: surface.label || button }),
57
+ surface.label ? /* @__PURE__ */ jsx(Text, { style: s.sub, children: button }) : null
58
+ ] }),
59
+ /* @__PURE__ */ jsx(Ionicons, { name: "arrow-up-outline", size: 18, color: ui.ink2, style: s.out })
60
+ ] }),
61
+ opened && live ? /* @__PURE__ */ jsx(DoneButton, { label: "Done", words: doneWords("surface", surface.title), onReply }) : null
62
+ ] });
63
+ }
64
+ function ConnectCard({
65
+ card,
66
+ live,
67
+ onReply
68
+ }) {
69
+ const [opened, open] = useOpened();
70
+ const heading = connectHeading(card);
71
+ const verb = connectButton(card);
72
+ return /* @__PURE__ */ jsxs(View, { style: s.group, children: [
73
+ /* @__PURE__ */ jsxs(View, { style: s.card, children: [
74
+ /* @__PURE__ */ jsx(ConnectorLogo, { id: card.connector, size: 36 }),
75
+ /* @__PURE__ */ jsxs(View, { style: s.text, children: [
76
+ /* @__PURE__ */ jsx(Text, { style: s.title, numberOfLines: 2, children: heading }),
77
+ card.reason ? /* @__PURE__ */ jsx(Text, { style: s.sub, children: card.reason }) : null
78
+ ] }),
79
+ /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: `${verb}: ${heading}`, accessibilityHint: "Opens the form on Yantra", onPress: () => open(() => appUrl().then((app) => connectUrl(app, card))), hitSlop: 6, style: ({
80
+ pressed
81
+ }) => [s.verb, pressed && s.verbPressed], children: /* @__PURE__ */ jsx(Text, { style: s.verbText, children: verb }) })
82
+ ] }),
83
+ opened && live ? /* @__PURE__ */ jsx(DoneButton, { label: "I saved it", words: doneWords("connect", connectName(card)), onReply }) : null
84
+ ] });
85
+ }
86
+ const LINE = "rgba(26,23,20,0.11)";
87
+ const s = StyleSheet.create({
88
+ stack: {
89
+ gap: 8,
90
+ width: "84%"
91
+ },
92
+ group: {
93
+ gap: 8,
94
+ alignItems: "flex-start"
95
+ },
96
+ card: {
97
+ alignSelf: "stretch",
98
+ flexDirection: "row",
99
+ alignItems: "center",
100
+ gap: 12,
101
+ minHeight: 56,
102
+ paddingVertical: 10,
103
+ paddingLeft: 10,
104
+ paddingRight: 12,
105
+ borderRadius: 16,
106
+ borderWidth: 1,
107
+ borderColor: LINE,
108
+ backgroundColor: ui.surface
109
+ },
110
+ cardPressed: {
111
+ transform: [{
112
+ scale: 0.985
113
+ }],
114
+ backgroundColor: ui.bg
115
+ },
116
+ tile: {
117
+ width: 36,
118
+ height: 36,
119
+ borderRadius: 11,
120
+ backgroundColor: ui.accentSoft,
121
+ alignItems: "center",
122
+ justifyContent: "center"
123
+ },
124
+ text: {
125
+ flex: 1,
126
+ minWidth: 0,
127
+ gap: 2
128
+ },
129
+ title: {
130
+ fontSize: 14.5,
131
+ lineHeight: 19,
132
+ fontWeight: "600",
133
+ color: ui.ink
134
+ },
135
+ sub: {
136
+ fontSize: 12.5,
137
+ lineHeight: 17,
138
+ color: ui.muted
139
+ },
140
+ out: {
141
+ transform: [{
142
+ rotate: "45deg"
143
+ }]
144
+ },
145
+ verb: {
146
+ minWidth: 64,
147
+ height: 34,
148
+ paddingHorizontal: 14,
149
+ borderRadius: 17,
150
+ backgroundColor: ui.accent,
151
+ alignItems: "center",
152
+ justifyContent: "center"
153
+ },
154
+ verbPressed: {
155
+ backgroundColor: ui.accentPressed
156
+ },
157
+ verbText: {
158
+ fontSize: 14,
159
+ fontWeight: "600",
160
+ color: ui.surface
161
+ },
162
+ done: {
163
+ flexDirection: "row",
164
+ alignItems: "center",
165
+ gap: 6,
166
+ height: 34,
167
+ paddingHorizontal: 14,
168
+ borderRadius: 17,
169
+ backgroundColor: ui.ink
170
+ },
171
+ donePressed: {
172
+ opacity: 0.85
173
+ },
174
+ doneText: {
175
+ fontSize: 14,
176
+ fontWeight: "600",
177
+ color: ui.surface
178
+ }
179
+ });export{HandoverCards};//# sourceMappingURL=HandoverCards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandoverCards.js","sources":["../../src/components/HandoverCards.tsx"],"sourcesContent":["/**\n * What Lucy hands over under her words (chat/handover.ts): her computer, opened over the chat signed in, to sign in to\n * a site or finish a step there; another of Yantra's surfaces; and a Connect card, for something to connect or keep in\n * the vault, opened on Yantra's own form. Once the person has been there and come back, the card offers the words that\n * tell Lucy to carry on, so they need not type them.\n */\nimport React, { useMemo, useState } from 'react';\nimport { Pressable, StyleSheet, Text, View } from 'react-native';\nimport { Ionicons } from '@expo/vector-icons';\nimport { agentAppUrl } from '../chat/auth';\nimport {\n connectButton,\n connectHandovers,\n connectHeading,\n connectName,\n connectUrl,\n doneWords,\n surfaceButton,\n surfaceHandovers,\n type ConnectHandover,\n type SurfaceHandover,\n} from '../chat/handover';\nimport { surfaceUrl } from '../chat/results';\nimport { yantraAppUrl } from '../utils/links';\nimport { openYantraInSheet } from '../utils/yantraLinks';\nimport { tap } from '../welcome/haptics';\nimport { ConnectorLogo } from './ConnectorLogo';\nimport { ui } from '../theme/muse';\n\n/** The Yantra app on Lucy's own environment (her agent names it), else the configured one: her computer lives there. */\nconst appUrl = (): Promise<string> =>\n agentAppUrl()\n .catch(() => '')\n .then((app) => app || yantraAppUrl());\n\ninterface Props {\n /** Lucy's reply as she wrote it, markers and all. */\n text: string;\n /** The newest reply, and Lucy done writing it: only then can the person answer from a card. */\n live: boolean;\n onReply: (words: string) => void;\n}\n\nexport function HandoverCards({ text, live, onReply }: Props) {\n const surfaces = useMemo(() => surfaceHandovers(text), [text]);\n const connects = useMemo(() => connectHandovers(text), [text]);\n if (!surfaces.length && !connects.length) return null;\n return (\n <View style={s.stack}>\n {surfaces.map((surface) => (\n <SurfaceCard key={surface.id} surface={surface} live={live} onReply={onReply} />\n ))}\n {connects.map((card) => (\n <ConnectCard key={card.requestId} card={card} live={live} onReply={onReply} />\n ))}\n </View>\n );\n}\n\n/** Opens `link` (once it resolves) in the sheet; true once the person is back from it. */\nfunction useOpened(): [boolean, (link: () => Promise<string>) => void] {\n const [opened, setOpened] = useState(false);\n const [opening, setOpening] = useState(false);\n const open = (link: () => Promise<string>) => {\n if (opening) return;\n tap();\n setOpening(true);\n link()\n .then((url) => (url ? openYantraInSheet(url).then(() => setOpened(true)) : undefined))\n .catch(() => undefined)\n .finally(() => setOpening(false));\n };\n return [opened, open];\n}\n\n/** \"Done\" once they are back, while Lucy waits on it. */\nfunction DoneButton({ label, words, onReply }: { label: string; words: string; onReply: (words: string) => void }) {\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n onPress={() => {\n tap();\n onReply(words);\n }}\n hitSlop={6}\n style={({ pressed }) => [s.done, pressed && s.donePressed]}\n >\n <Ionicons name=\"checkmark\" size={16} color={ui.surface} />\n <Text style={s.doneText}>{label}</Text>\n </Pressable>\n );\n}\n\nfunction SurfaceCard({\n surface,\n live,\n onReply,\n}: {\n surface: SurfaceHandover;\n live: boolean;\n onReply: Props['onReply'];\n}) {\n const [opened, open] = useOpened();\n const button = surfaceButton(surface);\n return (\n <View style={s.group}>\n <Pressable\n accessibilityRole=\"link\"\n accessibilityLabel={surface.label ? `${surface.label}. ${button}` : button}\n accessibilityHint={`Opens ${surface.title} over the chat`}\n onPress={() => open(() => appUrl().then((app) => surfaceUrl(surface.host, app)))}\n style={({ pressed }) => [s.card, pressed && s.cardPressed]}\n >\n <View style={s.tile}>\n <Ionicons\n name={surface.id === 'computer' ? 'desktop-outline' : 'albums-outline'}\n size={18}\n color={ui.accentText}\n />\n </View>\n <View style={s.text}>\n <Text style={s.title} numberOfLines={2}>\n {surface.label || button}\n </Text>\n {surface.label ? <Text style={s.sub}>{button}</Text> : null}\n </View>\n <Ionicons name=\"arrow-up-outline\" size={18} color={ui.ink2} style={s.out} />\n </Pressable>\n {opened && live ? (\n <DoneButton label=\"Done\" words={doneWords('surface', surface.title)} onReply={onReply} />\n ) : null}\n </View>\n );\n}\n\nfunction ConnectCard({ card, live, onReply }: { card: ConnectHandover; live: boolean; onReply: Props['onReply'] }) {\n const [opened, open] = useOpened();\n const heading = connectHeading(card);\n const verb = connectButton(card);\n return (\n <View style={s.group}>\n <View style={s.card}>\n <ConnectorLogo id={card.connector} size={36} />\n <View style={s.text}>\n <Text style={s.title} numberOfLines={2}>\n {heading}\n </Text>\n {card.reason ? <Text style={s.sub}>{card.reason}</Text> : null}\n </View>\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={`${verb}: ${heading}`}\n accessibilityHint=\"Opens the form on Yantra\"\n onPress={() => open(() => appUrl().then((app) => connectUrl(app, card)))}\n hitSlop={6}\n style={({ pressed }) => [s.verb, pressed && s.verbPressed]}\n >\n <Text style={s.verbText}>{verb}</Text>\n </Pressable>\n </View>\n {opened && live ? (\n <DoneButton label=\"I saved it\" words={doneWords('connect', connectName(card))} onReply={onReply} />\n ) : null}\n </View>\n );\n}\n\nconst LINE = 'rgba(26,23,20,0.11)';\n\nconst s = StyleSheet.create({\n // As wide as a bubble can be (ui.tsx bubble), so a short label does not shrink the card around it.\n stack: { gap: 8, width: '84%' },\n group: { gap: 8, alignItems: 'flex-start' },\n card: {\n alignSelf: 'stretch',\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n minHeight: 56,\n paddingVertical: 10,\n paddingLeft: 10,\n paddingRight: 12,\n borderRadius: 16,\n borderWidth: 1,\n borderColor: LINE,\n backgroundColor: ui.surface,\n },\n cardPressed: { transform: [{ scale: 0.985 }], backgroundColor: ui.bg },\n tile: {\n width: 36,\n height: 36,\n borderRadius: 11,\n backgroundColor: ui.accentSoft,\n alignItems: 'center',\n justifyContent: 'center',\n },\n text: { flex: 1, minWidth: 0, gap: 2 },\n title: { fontSize: 14.5, lineHeight: 19, fontWeight: '600', color: ui.ink },\n sub: { fontSize: 12.5, lineHeight: 17, color: ui.muted },\n out: { transform: [{ rotate: '45deg' }] },\n verb: {\n minWidth: 64,\n height: 34,\n paddingHorizontal: 14,\n borderRadius: 17,\n backgroundColor: ui.accent,\n alignItems: 'center',\n justifyContent: 'center',\n },\n verbPressed: { backgroundColor: ui.accentPressed },\n verbText: { fontSize: 14, fontWeight: '600', color: ui.surface },\n done: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n height: 34,\n paddingHorizontal: 14,\n borderRadius: 17,\n backgroundColor: ui.ink,\n },\n donePressed: { opacity: 0.85 },\n doneText: { fontSize: 14, fontWeight: '600', color: ui.surface },\n});\n"],"names":[],"mappings":"snBAmBA,MAAM,MAAS,GAAA,MAAuB,WAAY,EAAA,CAAE,KAAM,CAAA,MAAM,EAAE,CAAA,CAAE,IAAK,CAAA,CAAA,GAAA,KAAO,GAAO,IAAA,YAAA,EAAc,CAAA;AAQ9F,SAAS,aAAc,CAAA;AAAA,EAC5B,IAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAU,EAAA;AACR,EAAM,MAAA,QAAA,GAAW,QAAQ,MAAM,gBAAA,CAAiB,IAAI,CAAG,EAAA,CAAC,IAAI,CAAC,CAAA;AAC7D,EAAM,MAAA,QAAA,GAAW,QAAQ,MAAM,gBAAA,CAAiB,IAAI,CAAG,EAAA,CAAC,IAAI,CAAC,CAAA;AAC7D,EAAA,IAAI,CAAC,QAAA,CAAS,MAAU,IAAA,CAAC,QAAS,CAAA,MAAA;AAAQ,IAAO,OAAA,IAAA;AACjD,EAAA,uBAAQ,IAAA,CAAA,IAAA,EAAA,EAAK,KAAO,EAAA,CAAA,CAAE,KACX,EAAA,QAAA,EAAA;AAAA,IAAS,QAAA,CAAA,GAAA,CAAI,6BAAY,GAAA,CAAA,WAAA,EAAA,EAA6B,SAAkB,IAAY,EAAA,OAAA,EAAA,EAA1C,OAAQ,CAAA,EAAoD,CAAE,CAAA;AAAA,IACxG,QAAA,CAAS,GAAI,CAAA,CAAA,IAAA,qBAAS,GAAA,CAAA,WAAA,EAAA,EAAiC,MAAY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AAA,IACV,UAAY,EAAA,EAAA;AAAA,IACZ,OAAO,EAAG,CAAA;AAAA,GACZ;AAAA,EACA,GAAK,EAAA;AAAA,IACH,WAAW,CAAC;AAAA,MACV,MAAQ,EAAA;AAAA,KACT;AAAA,GACH;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,EAAA;AAAA,IACV,MAAQ,EAAA,EAAA;AAAA,IACR,iBAAmB,EAAA,EAAA;AAAA,IACnB,YAAc,EAAA,EAAA;AAAA,IACd,iBAAiB,EAAG,CAAA,MAAA;AAAA,IACpB,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,iBAAiB,EAAG,CAAA;AAAA,GACtB;AAAA,EACA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,KAAA;AAAA,IACZ,OAAO,EAAG,CAAA;AAAA,GACZ;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,aAAe,EAAA,KAAA;AAAA,IACf,UAAY,EAAA,QAAA;AAAA,IACZ,GAAK,EAAA,CAAA;AAAA,IACL,MAAQ,EAAA,EAAA;AAAA,IACR,iBAAmB,EAAA,EAAA;AAAA,IACnB,YAAc,EAAA,EAAA;AAAA,IACd,iBAAiB,EAAG,CAAA;AAAA,GACtB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,OAAS,EAAA;AAAA,GACX;AAAA,EACA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,KAAA;AAAA,IACZ,OAAO,EAAG,CAAA;AAAA;AAEd,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {memo,useMemo,useState}from'react';import {View,StyleSheet,ScrollView,Text,Pressable,LayoutAnimation,Image}from'react-native';import Svg,{Path}from'react-native-svg';import {MARK}from'./Logo.js';import {useReducedMotion}from'../hooks/useReducedMotion.js';import {tick,tap}from'../welcome/haptics.js';import {yantraAppUrl,openInSheet}from'../utils/links.js';import {shownRows,noteFor,actionWord,moreSurface,surfaceUrl,describeFlight,legWhen,conditionOf,describeItem,beyondLabel,BADGES,splitClock}from'../chat/results.js';import {ui,radius,lift}from'../theme/muse.js';import {cardPicks,isFallbackFavicon}from'@adminide-stack/clock-tik-browser/lib/pages/Home/chat/results.js';var __defProp = Object.defineProperty;
1
+ import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {memo,useMemo,useState}from'react';import {View,StyleSheet,ScrollView,Text,Pressable,LayoutAnimation,Image}from'react-native';import Svg,{Path}from'react-native-svg';import {MARK}from'./Logo.js';import {useReducedMotion}from'../hooks/useReducedMotion.js';import {tick,tap}from'../welcome/haptics.js';import {yantraAppUrl}from'../utils/links.js';import {openYantraInSheet}from'../utils/yantraLinks.js';import {shownRows,noteFor,actionWord,moreSurface,surfaceUrl,describeFlight,legWhen,conditionOf,describeItem,beyondLabel,BADGES,splitClock}from'../chat/results.js';import {ui,radius,lift}from'../theme/muse.js';import {cardPicks,isFallbackFavicon}from'@adminide-stack/clock-tik-browser/lib/pages/Home/chat/results.js';var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -137,7 +137,7 @@ function OutLink({
137
137
  }) {
138
138
  if (!link)
139
139
  return null;
140
- return /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "link", accessibilityLabel: link.label, accessibilityHint: "Opens in the browser", hitSlop: small ? 6 : 3, onPress: () => openInSheet(link.href), style: ({
140
+ return /* @__PURE__ */ jsx(Pressable, { accessibilityRole: "link", accessibilityLabel: link.label, accessibilityHint: "Opens in the browser", hitSlop: small ? 6 : 3, onPress: () => openYantraInSheet(link.href), style: ({
141
141
  pressed
142
142
  }) => [c.out, small && c.outSmall, pressed && {
143
143
  backgroundColor: ui.fill
@@ -155,7 +155,7 @@ function useMore(kind) {
155
155
  }
156
156
  function openSurface(href) {
157
157
  tap();
158
- openInSheet(href);
158
+ openYantraInSheet(href);
159
159
  }
160
160
  function SurfaceRow({
161
161
  more,