diff --git a/App.tsx b/App.tsx index cecce47..c17ecbc 100644 --- a/App.tsx +++ b/App.tsx @@ -4,6 +4,7 @@ * Main application component with authentication routing. * Shows loading screen while restoring auth state. */ +import './src/polyfills'; import React from 'react'; import { Buffer } from 'buffer'; diff --git a/assets/images/icon.png b/assets/images/icon.png new file mode 100644 index 0000000..f37764b Binary files /dev/null and b/assets/images/icon.png differ diff --git a/src/polyfills.ts b/src/polyfills.ts new file mode 100644 index 0000000..c9c8fde --- /dev/null +++ b/src/polyfills.ts @@ -0,0 +1,15 @@ +/** + * Polyfills that must run before any other app code (including LangChain/LangGraph). + * This file is imported as the very first line in App.tsx so that ReadableStream + * exists before @langchain/core or @langchain/langgraph are loaded. + */ +import 'web-streams-polyfill'; + +// Ensure globalThis has ReadableStream (main polyfill may not patch in RN/Metro) +const g = typeof globalThis !== 'undefined' ? globalThis : (typeof global !== 'undefined' ? global : (typeof self !== 'undefined' ? self : {})); +if (typeof (g as any).ReadableStream === 'undefined') { + const ponyfill = require('web-streams-polyfill/dist/ponyfill.js'); + (g as any).ReadableStream = ponyfill.ReadableStream; + (g as any).WritableStream = ponyfill.WritableStream; + (g as any).TransformStream = ponyfill.TransformStream; +}