@onairosofficial/onairos-capacitor 0.1.4 → 0.1.5

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 (88) hide show
  1. package/OnairosofficialOnairosCapacitor.podspec +1 -1
  2. package/README.md +1 -1
  3. package/dist/onairos.capacitor.esm.js +509 -1
  4. package/dist/onairos.capacitor.esm.turbopack.js +509 -1
  5. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosChatGPTNativePlugin.swift +187 -945
  6. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosRNScrapers.swift +1800 -0
  7. package/ios/Sources/OnairosNativeConnectorsPlugin/OnairosSpotifyNativePlugin.swift +180 -629
  8. package/onairos.d.ts +24 -0
  9. package/package.json +5 -2
  10. package/src/assets/connectors/Linkedinicon.png +0 -0
  11. package/src/assets/connectors/Redditicon.png +0 -0
  12. package/src/assets/connectors/YouTubeicon2.png +0 -0
  13. package/src/assets/connectors/chatgpt.png +0 -0
  14. package/src/assets/connectors/claude.png +0 -0
  15. package/src/assets/connectors/instagram.png +0 -0
  16. package/src/assets/connectors/netflix.png +0 -0
  17. package/src/assets/connectors/pinterest.png +0 -0
  18. package/src/assets/connectors/sephora.png +0 -0
  19. package/src/assets/connectors/spotify.png +0 -0
  20. package/src/assets/connectors/tiktok.png +0 -0
  21. package/src/assets/permissions/onairos.png +0 -0
  22. package/src/assets/permissions/personalization.png +0 -0
  23. package/src/assets/permissions/public-profile-person.png +0 -0
  24. package/src/assets/permissions/raw-memories.png +0 -0
  25. package/src/capacitorConnectorCatalog.js +2 -6
  26. package/src/components/DataRequest.jsx +96 -532
  27. package/src/components/PinSetup.jsx +39 -226
  28. package/src/components/SDKDesignPreview.jsx +33 -0
  29. package/src/components/SessionUserBar.jsx +2 -1
  30. package/src/components/UniversalOnboarding.jsx +190 -423
  31. package/src/components/WelcomeScreen.jsx +7 -0
  32. package/src/components/parity/NativeConnections.jsx +136 -0
  33. package/src/components/parity/NativeScreens.jsx +48 -0
  34. package/src/components/ui/PageLayout.jsx +7 -3
  35. package/src/nativeImport/ConnectorLoading.jsx +13 -0
  36. package/src/nativeImport/CustomImportSession.js +115 -0
  37. package/src/nativeImport/ImportIcon.jsx +29 -0
  38. package/src/nativeImport/ImportProgress.jsx +24 -0
  39. package/src/nativeImport/ImportStatus.jsx +9 -0
  40. package/src/nativeImport/NativeChatImport.jsx +28 -0
  41. package/src/nativeImport/NativeImportSession.js +123 -0
  42. package/src/nativeImport/NativeScraperImport.jsx +57 -0
  43. package/src/nativeImport/SmartFilter.jsx +28 -0
  44. package/src/nativeImport/customPayload.js +37 -0
  45. package/src/nativeImport/netflixExport.js +30 -0
  46. package/src/nativeImport/netflixHistory.js +28 -0
  47. package/src/nativeImport/netflixSession.js +59 -0
  48. package/src/nativeImport/rawHandoff.js +7 -0
  49. package/src/nativeImport/rn/config/api.js +5 -0
  50. package/src/nativeImport/rn/services/apiKeyService.js +2 -0
  51. package/src/nativeImport/rn/services/hingePayload.js +37 -0
  52. package/src/nativeImport/rn/services/nativeConversationImport.js +138 -0
  53. package/src/nativeImport/rn/services/nativeFileTransfer.js +127 -0
  54. package/src/nativeImport/rn/services/nativeRawRedaction.js +136 -0
  55. package/src/nativeImport/rn/services/netflixPayload.js +70 -0
  56. package/src/nativeImport/rn/services/rawMemoryPolicy.js +38 -0
  57. package/src/nativeImport/rn/services/sephoraPayload.js +166 -0
  58. package/src/nativeImport/rn/services/spotifyPayload.js +99 -0
  59. package/src/nativeImport/rn/source-manifest.json +45 -0
  60. package/src/nativeImport/rn/utils/importedFiles.js +74 -0
  61. package/src/nativeImport/rn/utils/nativeImportDates.js +45 -0
  62. package/src/nativeImport/rn/utils/nativeImportFileReceiver.js +51 -0
  63. package/src/nativeImport/rn/utils/nativeImportMetadata.js +74 -0
  64. package/src/nativeImport/rn/utils/nativeImportTopics.js +56 -0
  65. package/src/nativeImport/rn/utils/rawExportDelivery.js +12 -0
  66. package/src/nativeImport/rn/utils/webviewScripts/chatgptDiscovery.js +99 -0
  67. package/src/nativeImport/rn/utils/webviewScripts/claude.js +349 -0
  68. package/src/nativeImport/rn/utils/webviewScripts/gemini.js +356 -0
  69. package/src/nativeImport/rn/utils/webviewScripts/hinge.js +375 -0
  70. package/src/nativeImport/rn/utils/webviewScripts/instagram.js +152 -0
  71. package/src/nativeImport/rn/utils/webviewScripts/linkedin.js +825 -0
  72. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTImport.js +202 -0
  73. package/src/nativeImport/rn/utils/webviewScripts/nativeChatGPTSession.js +63 -0
  74. package/src/nativeImport/rn/utils/webviewScripts/nativeImportFiles.js +132 -0
  75. package/src/nativeImport/rn/utils/webviewScripts/nativeImportProviders.js +80 -0
  76. package/src/nativeImport/rn/utils/webviewScripts/nativeLoginViewport.js +28 -0
  77. package/src/nativeImport/rn/utils/webviewScripts/netflix.js +257 -0
  78. package/src/nativeImport/rn/utils/webviewScripts/sephora.js +862 -0
  79. package/src/nativeImport/rn/utils/webviewScripts/sephoraSession.js +160 -0
  80. package/src/nativeImport/rn/utils/webviewScripts/spotify.js +1868 -0
  81. package/src/nativeImport/rn/utils/webviewScripts/telegram.js +630 -0
  82. package/src/nativeImport/rn/utils/webviewScripts/tiktok.js +2920 -0
  83. package/src/onairos.core.jsx +3 -0
  84. package/src/onairosButton.jsx +23 -17
  85. package/src/styles/onairos-rn-parity.css +175 -0
  86. package/src/styles/tailwind.capacitor.css +4 -0
  87. package/src/utils/nativeConnectorSession.js +18 -0
  88. package/src/utils/parityPolicy.js +41 -0
@@ -0,0 +1,45 @@
1
+ {
2
+ "sourcePackage": "@onairos/react-native",
3
+ "version": "4.8.0",
4
+ "files": {
5
+ "utils/nativeImportTopics.ts": "bd2d3e0f87bcdfd004c950c29cbbd2e03aeec1cb98d08d11dba9b69ca71f702c",
6
+ "utils/nativeImportDates.ts": "19f1d88ead55d918ad28242e1b3ebcf393dc974b98acea1a502923a575149e9f",
7
+ "utils/nativeImportMetadata.ts": "57987a95d2d796572d78417a6be6a77007a3afa8e726108413c62e5e15638bfb",
8
+ "utils/importedFiles.ts": "efdfe16fa4a1b3da11bef1a2dc75cd7bbc155d4b435f2e5dc076029c14a17859",
9
+ "utils/nativeImportFileReceiver.ts": "3ac39634fdb1523cf62994f78c4f735aa7dc7edbb8cfc8d0beaa907e99dc573f",
10
+ "utils/rawExportDelivery.ts": "9766c7a68dbc90027b51400dbe9449acb4727902795fa1ff4d4372d0057dc4ef",
11
+ "utils/webviewScripts/nativeImportProviders.ts": "b683ca93fe61ff7630ba3c390c19a96c8f2b4c50165639d4aa264321c1d358c2",
12
+ "utils/webviewScripts/nativeImportFiles.ts": "220e4b0e764359f0fd688f8045bf084b8fe6a96e53fcf1034e8dff4681ee60a1",
13
+ "utils/webviewScripts/nativeChatGPTImport.ts": "5c14d7887e50dfde2659d0ba3fe288f95d551c97a333004fcfbd80cf64cc8e3d",
14
+ "utils/webviewScripts/nativeChatGPTSession.ts": "ac9627308c3c58b654fa3b0f4c67762519fcc6d10f4a8689821db45c3e09d81e",
15
+ "utils/webviewScripts/nativeLoginViewport.ts": "ebeab1e103535a52d8f3c2cdfbeaf2067b0adeec89bc78b769addb21aad5db34",
16
+ "utils/webviewScripts/chatgptDiscovery.ts": "f6d81eb511ff015cfff7568d6aff8a5b6df7421e6ce76f3a4fef6415cb655a6f",
17
+ "services/nativeConversationImport.ts": "f37de9df0b4d148597cd75c88c4790832b438a594a05bf807a20115ec1924063",
18
+ "services/rawMemoryPolicy.ts": "5ec431311b53a5cba6c4fa36a21ba190e26b5922e1934473429b334f0509b034",
19
+ "services/nativeRawRedaction.ts": "a440e63b88329d6c99bff385a2227461d1a0906ea66a0c7363b1116f4ab77c96",
20
+ "services/nativeFileTransfer.ts": "55c65ca89177a1a7d6487a8762043dfb45f512d59c623df6eb7f53691cc88a4d",
21
+ "utils/webviewScripts/spotify.ts": "a461a36013810b0732e4aced78162c816a457131d5af8f76fb7dfd55f6311d85",
22
+ "utils/webviewScripts/netflix.ts": "d109a2bb6df48152690a48c08a214586c72c87f9c75a7028bb9f841aac863e9a",
23
+ "utils/webviewScripts/sephora.ts": "19bdf373c6cd882d9e41203179379d27b77a0a603d34d706adfbc1ce44e292b3",
24
+ "utils/webviewScripts/sephoraSession.ts": "ab2454ab8eed798fd220765ed87195450df5b6fbf0a37be7614420a4505252a2",
25
+ "utils/webviewScripts/hinge.ts": "577e13a1157923006de21f851f9fb5453805faf4b5e7e0af1bbc231ac268f32f",
26
+ "utils/webviewScripts/instagram.ts": "be814874d67e3c35ff273e8ef1aabe5366d1c2ff0de9f5cc4b8cab9229b5e922",
27
+ "utils/webviewScripts/gemini.ts": "77c5010dab1a5792d9b0880d93840b3b5b7ac77165df2f360de4c08cba32d2d2",
28
+ "utils/webviewScripts/claude.ts": "f4229103201168761748fff5c41788ea491ada6a04e96192fa49b6f2b32e5462",
29
+ "utils/webviewScripts/telegram.ts": "9714abdc96bee8e3c3aeadeaf915968c51409d9a5ebacb01cde2fff4eb4adde8",
30
+ "utils/webviewScripts/tiktok.ts": "a0694281c8f69869ad5a663d004ad838ef40594a74433ce3f5e2f40b94d5a634",
31
+ "utils/webviewScripts/linkedin.ts": "4fd86ef00c6d36e04e7acef26916393bb19f8d9852a9b99147bf3359af278dc5",
32
+ "utils/webviewScripts/index.ts": "bb41fd2833a53f0401202efd4d7010a2f43e0ef6b4b463d62cd55cade5a89727",
33
+ "services/spotifyDataService.ts": "a1a3284c5947eab015b6841e4bd0ab0dce0899192900bd25178166fb825237e6",
34
+ "services/netflixDataService.ts": "d64113a11ef2d2dd0e166db3ef2253d3e926b2903872bbc4c8a96603468a52eb",
35
+ "services/sephoraDataService.ts": "ada78c6a837279438397959b081a8e7af8736d888f2e0a40e4671c27b39b51d5",
36
+ "services/hingeDataService.ts": "8b2f2ec250b0fc1d61b2d7b383e3fb99a835e2c8c82a5ca6d9d641718bc18208",
37
+ "components/NativeImportIcon.tsx": "a577109d7dff0cc9b7cf3d9006450d5b0924ba5c5df3225f543ed9baffd4f9d7"
38
+ },
39
+ "assets": {
40
+ "assets/icons/claude.png": "2cb80401ba514060120928df9000c758402dabc131c4ebbe8d08c72a655e5c4b",
41
+ "assets/icons/netflix.png": "32dc0a336d7d9e92a9ada729d9601fc994bca9ddc8bd0d69b51b18658beff480",
42
+ "assets/icons/instagram-picker.png": "d8479dc673a2af5aa482fa6eebd7dcd9a1f988cfdcf2803dfba3099443a27277",
43
+ "assets/images/sephoralogo.png": "522fd50ffc25b8df1c935a919b822772eb3b710abaabfa6ac3346b9250438c84"
44
+ }
45
+ }
@@ -0,0 +1,74 @@
1
+ // Synced from RN utils/importedFiles.ts by scripts/sync-rn-connectors.cjs.
2
+ const IMPORTED_FILE_MAX_BYTES = 25 * 1024 * 1024;
3
+ const IMPORTED_FILES_TOTAL_BYTES = 100 * 1024 * 1024;
4
+ const IMPORTED_FILE_PREVIEW_BYTES = 1024 * 1024;
5
+ const IMPORTED_FILES_MAX_COUNT = 20;
6
+ const IMPORTED_FILE_CHUNK_BYTES = 192 * 1024;
7
+ function base64ByteLength(value) {
8
+ if (value.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(value)) return -1;
9
+ return value.length / 4 * 3 - (value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0);
10
+ }
11
+ function utf8ByteLength(value) {
12
+ let size = 0;
13
+ for (const char of value) {
14
+ const point = char.codePointAt(0);
15
+ size += point <= 127 ? 1 : point <= 2047 ? 2 : point <= 65535 ? 3 : 4;
16
+ }
17
+ return size;
18
+ }
19
+ function importedFileByteLength(file) {
20
+ if (file.status !== "imported" || typeof file.data !== "string") return -1;
21
+ return file.encoding === "base64" ? base64ByteLength(file.data) : file.encoding === "text" ? utf8ByteLength(file.data) : -1;
22
+ }
23
+ function canDownloadImportedFile(file) {
24
+ const size = importedFileByteLength(file);
25
+ return size >= 0 && size <= IMPORTED_FILE_MAX_BYTES && size === file.sizeBytes;
26
+ }
27
+ function getImportedFilePreviewKind(file) {
28
+ if (file.sizeBytes > IMPORTED_FILE_PREVIEW_BYTES || !canDownloadImportedFile(file)) return null;
29
+ const mime = (file.mimeType || "").split(";")[0].trim().toLowerCase();
30
+ if (file.encoding === "base64" && mime === "application/pdf") return "pdf";
31
+ if (file.encoding === "base64" && /^image\/(png|jpeg|gif|webp)$/.test(mime)) return "image";
32
+ if (file.encoding === "text" || /^text\//.test(mime) || /^(application\/(json|xml)|image\/svg\+xml)$/.test(mime)) return "text";
33
+ return null;
34
+ }
35
+ function getImportedFileName(file) {
36
+ let name = file.name.replace(/[\/\\\x00-\x1f\x7f:*?"<>|]/g, "_").replace(/^\.+/, "").trim().slice(0, 180) || "attachment";
37
+ if (file.extracted && !/\.txt$/i.test(name)) name += ".extracted.txt";
38
+ return name;
39
+ }
40
+ function getImportedFileTextPreview(file) {
41
+ if (getImportedFilePreviewKind(file) !== "text") return null;
42
+ let text = file.data;
43
+ if (file.encoding === "base64") {
44
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
45
+ const bytes = [];
46
+ for (let i = 0; i < text.length; i += 4) {
47
+ const a = alphabet.indexOf(text[i]), b = alphabet.indexOf(text[i + 1]);
48
+ const c = alphabet.indexOf(text[i + 2]), d = alphabet.indexOf(text[i + 3]);
49
+ bytes.push("%" + (a << 2 | b >> 4).toString(16).padStart(2, "0"));
50
+ if (c >= 0) bytes.push("%" + ((b & 15) << 4 | c >> 2).toString(16).padStart(2, "0"));
51
+ if (d >= 0) bytes.push("%" + ((c & 3) << 6 | d).toString(16).padStart(2, "0"));
52
+ }
53
+ try {
54
+ text = decodeURIComponent(bytes.join(""));
55
+ } catch {
56
+ return null;
57
+ }
58
+ }
59
+ return text.length > 2e4 ? text.slice(0, 2e4) + "\n\nPreview shortened. Download for the complete file." : text;
60
+ }
61
+ export {
62
+ IMPORTED_FILES_MAX_COUNT,
63
+ IMPORTED_FILES_TOTAL_BYTES,
64
+ IMPORTED_FILE_CHUNK_BYTES,
65
+ IMPORTED_FILE_MAX_BYTES,
66
+ IMPORTED_FILE_PREVIEW_BYTES,
67
+ base64ByteLength,
68
+ canDownloadImportedFile,
69
+ getImportedFileName,
70
+ getImportedFilePreviewKind,
71
+ getImportedFileTextPreview,
72
+ importedFileByteLength,
73
+ utf8ByteLength
74
+ };
@@ -0,0 +1,45 @@
1
+ // Synced from RN utils/nativeImportDates.ts by scripts/sync-rn-connectors.cjs.
2
+ function importTimestamp(value) {
3
+ if (typeof value !== "number" && typeof value !== "string") return void 0;
4
+ if (typeof value === "string" && (!value.trim() || value.length > 64)) return void 0;
5
+ const numeric = typeof value === "number" || /^\d+(\.\d+)?$/.test(value);
6
+ const number = numeric ? Number(value) : NaN;
7
+ const millis = numeric ? number < 1e11 ? number * 1e3 : number : Date.parse(value);
8
+ return Number.isFinite(millis) && millis >= 0 && !Number.isNaN(new Date(millis).getTime()) ? millis : void 0;
9
+ }
10
+ function importDateRange(items) {
11
+ const dates = items.flatMap((item) => [importTimestamp(item.createdAt), importTimestamp(item.updatedAt)]).filter((value) => value !== void 0);
12
+ return dates.length ? [Math.min(...dates), Math.max(...dates)] : void 0;
13
+ }
14
+ const localDateTime = (date) => new Date(date).toLocaleString("en-US", {
15
+ month: "short",
16
+ day: "numeric",
17
+ year: "numeric",
18
+ hour: "numeric",
19
+ minute: "2-digit",
20
+ hour12: true
21
+ });
22
+ function importTopicDateRange(items) {
23
+ const range = importDateRange(items);
24
+ if (!range) return "";
25
+ const [start, end] = range.map((value) => new Date(value));
26
+ const full = (date) => date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
27
+ if (start.toDateString() === end.toDateString()) return full(start);
28
+ const first = start.toLocaleDateString("en-US", { month: "short", day: "numeric", ...start.getFullYear() !== end.getFullYear() ? { year: "numeric" } : {} });
29
+ return `${first} \u2013 ${full(end)}`;
30
+ }
31
+ function importChatDates(item) {
32
+ const created = importTimestamp(item.createdAt), updated = importTimestamp(item.updatedAt);
33
+ return [created !== void 0 ? `Created ${localDateTime(created)}` : "", updated !== void 0 ? `Updated ${localDateTime(updated)}` : ""].filter(Boolean).join(" \xB7 ");
34
+ }
35
+ function importAllChatsRange(items) {
36
+ const range = importDateRange(items);
37
+ return range ? `All chats shown: ${localDateTime(range[0])} \u2013 ${localDateTime(range[1])} (local time).` : "";
38
+ }
39
+ export {
40
+ importAllChatsRange,
41
+ importChatDates,
42
+ importDateRange,
43
+ importTimestamp,
44
+ importTopicDateRange
45
+ };
@@ -0,0 +1,51 @@
1
+ // Synced from RN utils/nativeImportFileReceiver.ts by scripts/sync-rn-connectors.cjs.
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ import { base64ByteLength, canDownloadImportedFile, IMPORTED_FILES_TOTAL_BYTES, IMPORTED_FILES_MAX_COUNT, IMPORTED_FILE_CHUNK_BYTES } from "./importedFiles.js";
6
+ class NativeImportFileReceiver {
7
+ constructor() {
8
+ __publicField(this, "count", 0);
9
+ __publicField(this, "total", 0);
10
+ __publicField(this, "pending");
11
+ }
12
+ clear() {
13
+ this.pending = void 0;
14
+ this.count = 0;
15
+ this.total = 0;
16
+ }
17
+ get incomplete() {
18
+ return !!this.pending;
19
+ }
20
+ acceptInline(file) {
21
+ if (file.status !== "imported") return;
22
+ if (++this.count > IMPORTED_FILES_MAX_COUNT) throw new Error("File count limit exceeded");
23
+ if (!canDownloadImportedFile(file) || this.total + file.sizeBytes > IMPORTED_FILES_TOTAL_BYTES) throw new Error("Invalid file size");
24
+ this.total += file.sizeBytes;
25
+ }
26
+ accept(message) {
27
+ if (message.type === "file_start") {
28
+ if (this.pending || ++this.count > IMPORTED_FILES_MAX_COUNT || this.total + message.file.sizeBytes > IMPORTED_FILES_TOTAL_BYTES) throw new Error("File transfer limit exceeded");
29
+ this.pending = { id: message.transferId, conversationId: message.conversationId, file: message.file, parts: [], size: 0 };
30
+ return { key: message.transferId + ":start" };
31
+ }
32
+ const pending = this.pending;
33
+ if (!pending || pending.id !== message.transferId) throw new Error("Unexpected file transfer");
34
+ if (message.type === "file_chunk") {
35
+ const size = base64ByteLength(message.data);
36
+ if (message.index !== pending.parts.length || size <= 0 || size > IMPORTED_FILE_CHUNK_BYTES || pending.size + size > pending.file.sizeBytes || pending.parts.length && pending.size !== pending.parts.length * IMPORTED_FILE_CHUNK_BYTES) throw new Error("Invalid file chunk");
37
+ pending.parts.push(message.data);
38
+ pending.size += size;
39
+ return { key: message.transferId + ":" + message.index };
40
+ }
41
+ if (pending.size !== pending.file.sizeBytes) throw new Error("Incomplete file");
42
+ const file = { ...pending.file, data: pending.parts.join("") };
43
+ if (!canDownloadImportedFile(file)) throw new Error("Invalid file content");
44
+ this.total += pending.size;
45
+ this.pending = void 0;
46
+ return { key: message.transferId + ":end", conversationId: pending.conversationId, file };
47
+ }
48
+ }
49
+ export {
50
+ NativeImportFileReceiver
51
+ };
@@ -0,0 +1,74 @@
1
+ // Synced from RN utils/nativeImportMetadata.ts by scripts/sync-rn-connectors.cjs.
2
+ const NATIVE_METADATA_KEYS = ["model", "model_slug", "modelSlug", "default_model_slug", "defaultModelSlug", "resolved_model_slug", "resolvedModelSlug", "actual_model_slug", "actualModelSlug", "current_model_slug", "currentModelSlug", "sources", "safe_urls", "safeUrls", "citations", "content_references", "contentReferences", "search_result_groups", "searchResultGroups", "tools", "tool_calls", "toolCalls", "search_queries", "searchQueries", "search_query", "query", "q", "queries", "query_type", "searchQuery", "type", "title", "name", "label", "url", "uri", "link", "site_name", "siteName", "domain", "alt", "matched_text", "text", "integration_name", "integrationName", "items", "entries", "refs", "reference", "references", "source", "results", "result", "content", "contentBlocks", "display_content", "displayContent", "metadata", "input", "id", "status", "recipient", "channel", "content_type", "contentType", "current_node", "currentNode", "conversation_template_id", "conversationTemplateId", "created_at", "createdAt", "updated_at", "updatedAt", "create_time", "update_time", "summary"];
3
+ function sanitizeNativeMetadata(value) {
4
+ let budget = 32e3, nodes = 0;
5
+ function visit(v, depth, key = "") {
6
+ if (++nodes > 1500 || depth > 7 || budget <= 0) return void 0;
7
+ if (typeof v === "string") {
8
+ if (/^data:(?:image|audio|video|application)\//i.test(v)) return void 0;
9
+ let text = v.slice(0, Math.min(4096, budget));
10
+ if (["url", "uri", "link", "safe_urls", "safeUrls"].includes(key) && (!/^https?:\/\/[^\s/@]+(?:[/:?#]|$)/i.test(text) || /[?&](?:[^=&]*(?:token|signature|credential|secret|key)|sig)=/i.test(text))) return void 0;
11
+ budget -= text.length;
12
+ return text;
13
+ }
14
+ if (v === null || typeof v === "boolean" || typeof v === "number" && Number.isFinite(v)) return v;
15
+ if (Array.isArray(v)) return v.slice(0, 50).map((item) => visit(item, depth + 1, key)).filter((item) => item !== void 0);
16
+ if (!v || typeof v !== "object" || /^(thinking|reasoning|analysis|image|image_url|input_image|audio|input_audio|video|file|document)$/.test(v.type || "")) return void 0;
17
+ const result2 = {};
18
+ for (const k of Object.keys(v)) if (NATIVE_METADATA_KEYS.includes(k)) {
19
+ const item = visit(v[k], depth + 1, k);
20
+ if (item !== void 0) result2[k] = item;
21
+ }
22
+ return result2;
23
+ }
24
+ const result = visit(value, 0);
25
+ return result && !Array.isArray(result) && typeof result === "object" && Object.keys(result).length ? result : void 0;
26
+ }
27
+ const NATIVE_METADATA_SCRIPT = `var metadataKeys=${JSON.stringify(NATIVE_METADATA_KEYS)};` + String.raw`
28
+ function cleanMetadata(value){
29
+ var budget=32000,nodes=0;
30
+ function visit(v,depth,key){
31
+ if(++nodes>1500 || depth>7 || budget<=0)return;
32
+ if(typeof v==='string'){
33
+ if(/^data:(?:image|audio|video|application)\//i.test(v))return;
34
+ var text=v.slice(0,Math.min(4096,budget));
35
+ if(['url','uri','link','safe_urls','safeUrls'].includes(key) && (!/^https?:\/\/[^\s/@]+(?:[/:?#]|$)/i.test(text) || /[?&](?:[^=&]*(?:token|signature|credential|secret|key)|sig)=/i.test(text)))return;
36
+ budget-=text.length;return text;
37
+ }
38
+ if(v===null || typeof v==='boolean' || typeof v==='number'&&Number.isFinite(v))return v;
39
+ if(Array.isArray(v))return v.slice(0,50).map(function(item){return visit(item,depth+1,key);}).filter(function(item){return item!==undefined;});
40
+ if(!v || typeof v!=='object' || /^(thinking|reasoning|analysis|image|image_url|input_image|audio|input_audio|video|file|document)$/.test(v.type||''))return;
41
+ var result={};Object.keys(v).forEach(function(k){if(metadataKeys.includes(k)){var item=visit(v[k],depth+1,k);if(item!==undefined)result[k]=item;}});return result;
42
+ }
43
+ return visit(value,0,'')||{};
44
+ }
45
+ function extraMessageFields(m,parent){
46
+ var meta=Object.assign({},m.metadata||{});
47
+ ['model','model_slug','sources','citations','content_references','tools','tool_calls','search_queries'].forEach(function(key){if(m[key]!==undefined)meta[key]=m[key];});
48
+ if(m.author&&m.author.metadata)Object.assign(meta,m.author.metadata);
49
+ if(Array.isArray(m.content))meta.contentBlocks=m.content.map(function(block){
50
+ if(block.type==='text')return {citations:block.citations};return block;
51
+ });
52
+ function collectBlocks(blocks,depth){
53
+ if(!Array.isArray(blocks)||depth>4)return;
54
+ blocks.slice(0,50).forEach(function(block){
55
+ if(!block || /^(thinking|reasoning|analysis)$/.test(block.type||''))return;
56
+ if(Array.isArray(block.citations))meta.citations=(Array.isArray(meta.citations)?meta.citations:[]).concat(block.citations).slice(0,50);
57
+ if(block.type==='tool_use' || block.type==='tool_result')meta.tools=(Array.isArray(meta.tools)?meta.tools:[]).concat([{name:block.name||block.integration_name||block.type,integrationName:block.integration_name}]).slice(0,50);
58
+ if(block.type==='knowledge' && block.url)meta.sources=(Array.isArray(meta.sources)?meta.sources:[]).concat([{url:block.url,title:block.title}]).slice(0,50);
59
+ if(block.input && (block.input.query || block.input.search_query))meta.search_queries=(Array.isArray(meta.search_queries)?meta.search_queries:[]).concat([{query:block.input.query||block.input.search_query,type:block.name||block.type}]).slice(0,50);
60
+ collectBlocks(block.content,depth+1);
61
+ });
62
+ }
63
+ collectBlocks(m.content,0);
64
+ return {metadata:cleanMetadata(meta),prevMessageId:parent||m.parent_message_uuid||m.parent_uuid||undefined,
65
+ modelSlug:meta.resolved_model_slug||meta.model_slug||m.model||undefined,
66
+ updatedAt:m.update_time||m.updated_at||undefined,contentType:m.content?.content_type,
67
+ channel:m.channel,recipient:m.recipient,status:m.status};
68
+ }
69
+ `;
70
+ export {
71
+ NATIVE_METADATA_KEYS,
72
+ NATIVE_METADATA_SCRIPT,
73
+ sanitizeNativeMetadata
74
+ };
@@ -0,0 +1,56 @@
1
+ // Synced from RN utils/nativeImportTopics.ts by scripts/sync-rn-connectors.cjs.
2
+ function importTopicDateRange(items, includeTime = false) {
3
+ const dates = items.flatMap((item) => [item.createdAt, item.updatedAt]).flatMap((value) => {
4
+ if (value === void 0 || value === null || value === "") return [];
5
+ const time = typeof value === "number" ? value < 1e12 ? value * 1e3 : value : Date.parse(value);
6
+ return Number.isFinite(time) && time > 0 ? [time] : [];
7
+ });
8
+ if (!dates.length) return "";
9
+ const first = new Date(Math.min(...dates)), last = new Date(Math.max(...dates));
10
+ if (includeTime) {
11
+ const formatTime = (date) => date.toLocaleString("en-US", { month: "short", day: "numeric", year: "numeric", hour: "numeric", minute: "2-digit", hour12: true, timeZone: "UTC" });
12
+ return `${formatTime(first)}${first.getTime() === last.getTime() ? "" : ` \u2013 ${formatTime(last)}`} UTC`;
13
+ }
14
+ const format = (date, year) => date.toLocaleDateString("en-US", { month: "short", day: "numeric", ...year ? { year: "numeric" } : {}, timeZone: "UTC" });
15
+ if (first.toISOString().slice(0, 10) === last.toISOString().slice(0, 10)) return format(first, true);
16
+ return `${format(first, first.getUTCFullYear() !== last.getUTCFullYear())} \u2013 ${format(last, true)}`;
17
+ }
18
+ const HEURISTIC_CATEGORIES = [
19
+ { label: "Health & Wellness", sensitive: true, kw: ["health", "doctor", "symptom", "medical", "medicine", "therapy", "anxiety", "depression", "mental", "pain", "diagnosis", "sick", "clinic", "prescription"] },
20
+ { label: "Finances", sensitive: true, kw: ["money", "budget", "invest", "stock", "crypto", "tax", "loan", "debt", "salary", "finance", "bank", "mortgage", "savings", "retirement", "expense", "income"] },
21
+ { label: "Relationships", sensitive: true, kw: ["relationship", "dating", "partner", "girlfriend", "boyfriend", "wife", "husband", "marriage", "breakup", "crush", "divorce", "ex "] },
22
+ { label: "Legal", sensitive: true, kw: ["legal", "lawyer", "attorney", "contract", "court", "lawsuit", "law ", "rights"] },
23
+ { label: "Coding & Tech", sensitive: false, kw: ["code", "coding", "bug", "error", "python", "javascript", "react", "api", "function", "sql", "deploy", "server", "software", "algorithm", "git", "docker", "css", "html", "typescript", "database", "terminal", "compile"] },
24
+ { label: "Work & Career", sensitive: false, kw: ["work", "job", "career", "resume", "cv", "interview", "manager", "meeting", "client", "business", "startup", "promotion", "coworker", "office", "email"] },
25
+ { label: "Learning & Study", sensitive: false, kw: ["learn", "study", "school", "university", "college", "course", "exam", "homework", "essay", "assignment", "math", "science", "history", "tutor", "research", "thesis", "explain"] },
26
+ { label: "Writing & Content", sensitive: false, kw: ["write", "writing", "blog", "article", "story", "poem", "script", "copy", "content", "draft", "newsletter", "caption"] },
27
+ { label: "Travel", sensitive: false, kw: ["travel", "trip", "flight", "hotel", "vacation", "itinerary", "visa", "tour", "airbnb", "booking", "destination"] },
28
+ { label: "Food & Cooking", sensitive: false, kw: ["recipe", "cook", "cooking", "food", "meal", "dinner", "bake", "restaurant", "ingredient", "diet"] },
29
+ { label: "Entertainment", sensitive: false, kw: ["movie", "film", "tv", "show", "music", "song", "game", "book", "anime", "series", "netflix", "playlist"] },
30
+ { label: "Shopping", sensitive: false, kw: ["buy", "shopping", "product", "price", "gift", "order", "amazon", "purchase"] }
31
+ ];
32
+ function clusterImportTitles(items) {
33
+ const buckets = /* @__PURE__ */ new Map();
34
+ for (const item of items) {
35
+ const title = ` ${item.title.toLowerCase()} `;
36
+ const category = HEURISTIC_CATEGORIES.find((cat) => cat.kw.some((word) => title.includes(word)));
37
+ const label = category?.label || "Other chats";
38
+ if (!buckets.has(label)) buckets.set(label, { id: label, label, sensitive: category?.sensitive || false, conversationIds: [] });
39
+ buckets.get(label).conversationIds.push(item.id);
40
+ }
41
+ return [...buckets.values()];
42
+ }
43
+ function filterImportTitleExclusions(items, exclusions = "") {
44
+ const phrases = exclusions.split(/[\n,]+/).map((value) => value.trim().toLowerCase()).filter(Boolean);
45
+ return items.filter((item) => !phrases.some((phrase) => item.title.toLowerCase().includes(phrase)));
46
+ }
47
+ function selectedImportTitles(items, topics, selected, exclusions = "", excludedChatIds = /* @__PURE__ */ new Set()) {
48
+ const ids = new Set(topics.filter((topic) => selected.has(topic.id)).flatMap((topic) => topic.conversationIds));
49
+ return filterImportTitleExclusions(items.filter((item) => ids.has(item.id) && !excludedChatIds.has(item.id)), exclusions);
50
+ }
51
+ export {
52
+ clusterImportTitles,
53
+ filterImportTitleExclusions,
54
+ importTopicDateRange,
55
+ selectedImportTitles
56
+ };
@@ -0,0 +1,12 @@
1
+ // Synced from RN utils/rawExportDelivery.ts by scripts/sync-rn-connectors.cjs.
2
+ function attachRawExportDelivery(payload, fileDelivery) {
3
+ if (fileDelivery) Object.defineProperty(payload, "fileDelivery", {
4
+ value: fileDelivery,
5
+ enumerable: false,
6
+ configurable: true
7
+ });
8
+ return payload;
9
+ }
10
+ export {
11
+ attachRawExportDelivery
12
+ };
@@ -0,0 +1,99 @@
1
+ // Synced from RN utils/webviewScripts/chatgptDiscovery.ts by scripts/sync-rn-connectors.cjs.
2
+ const CHATGPT_DISCOVERY_LIMIT = 10;
3
+ const loginHosts = /* @__PURE__ */ new Set(["chatgpt.com", "auth.openai.com", "auth0.openai.com", "accounts.google.com", "appleid.apple.com", "account.apple.com", "login.microsoftonline.com", "login.live.com"]);
4
+ function isChatGPTOrigin(value) {
5
+ try {
6
+ return new URL(value).origin === "https://chatgpt.com";
7
+ } catch {
8
+ return false;
9
+ }
10
+ }
11
+ function isDiscoveryNavigationAllowed(value) {
12
+ try {
13
+ const url = new URL(value);
14
+ return url.protocol === "https:" && !url.username && !url.password && !url.port && loginHosts.has(url.hostname);
15
+ } catch {
16
+ return false;
17
+ }
18
+ }
19
+ function parseDiscoveryMessage(raw, origin, requestId) {
20
+ if (!isChatGPTOrigin(origin) || !requestId || raw.length > 2e4) return null;
21
+ try {
22
+ const value = JSON.parse(raw);
23
+ if (value.channel !== "onairos-title-discovery" || value.requestId !== requestId) return null;
24
+ if (value.type === "error") {
25
+ return { type: "error", code: ["sign_in", "timeout", "unavailable"].includes(value.code) ? value.code : "unavailable" };
26
+ }
27
+ if (value.type !== "titles" || !Array.isArray(value.items) || value.items.length > CHATGPT_DISCOVERY_LIMIT) return null;
28
+ const seen = /* @__PURE__ */ new Set();
29
+ const items = [];
30
+ for (const item of value.items) {
31
+ if (typeof item?.id !== "string" || !/^[a-zA-Z0-9-]{1,128}$/.test(item.id) || typeof item.title !== "string" || item.title.length > 500) return null;
32
+ if (!seen.has(item.id)) {
33
+ seen.add(item.id);
34
+ items.push({ id: item.id, title: item.title });
35
+ }
36
+ }
37
+ return { type: "titles", items };
38
+ } catch {
39
+ return null;
40
+ }
41
+ }
42
+ const CANCEL_CHATGPT_DISCOVERY = `
43
+ (function(){if(location.origin === 'https://chatgpt.com' && window.__onairosTitleDiscovery) {
44
+ window.__onairosTitleDiscovery.abort(); delete window.__onairosTitleDiscovery;
45
+ }})(); true;`;
46
+ function createChatGPTDiscoveryScript(requestId) {
47
+ return `
48
+ (function () {
49
+ if (location.origin !== 'https://chatgpt.com' || window.top !== window.self) return;
50
+ if (window.__onairosTitleDiscovery) window.__onairosTitleDiscovery.abort();
51
+ var controller = new AbortController();
52
+ window.__onairosTitleDiscovery = controller;
53
+ var requestId = ${JSON.stringify(requestId)};
54
+ var timedOut = false;
55
+ var timer = setTimeout(function () {timedOut = true; controller.abort();}, 12000);
56
+ function send(result) {
57
+ if (window.__onairosTitleDiscovery !== controller || (controller.signal.aborted && !timedOut)) return;
58
+ window.ReactNativeWebView.postMessage(JSON.stringify(Object.assign({channel: 'onairos-title-discovery', requestId: requestId}, result)));
59
+ }
60
+ (async function () {
61
+ var token = null;
62
+ try {
63
+ var sessionResponse = await fetch('/api/auth/session', {credentials: 'include', signal: controller.signal, redirect: 'error'});
64
+ if (!sessionResponse.ok) {send({type: 'error', code: 'sign_in'}); return;}
65
+ var session = await sessionResponse.json();
66
+ token = typeof session.accessToken === 'string' ? session.accessToken : null;
67
+ session = null;
68
+ if (!token) {send({type: 'error', code: 'sign_in'}); return;}
69
+ var response = await fetch('/backend-api/conversations?offset=0&limit=${CHATGPT_DISCOVERY_LIMIT}&order=updated', {
70
+ credentials: 'include', signal: controller.signal, redirect: 'error',
71
+ headers: {Accept: 'application/json', Authorization: 'Bearer ' + token}
72
+ });
73
+ token = null;
74
+ if (!response.ok) {send({type: 'error', code: response.status === 401 ? 'sign_in' : 'unavailable'}); return;}
75
+ var data = await response.json();
76
+ if (!Array.isArray(data.items)) {send({type: 'error', code: 'unavailable'}); return;}
77
+ var items = data.items.slice(0, ${CHATGPT_DISCOVERY_LIMIT}).filter(function (item) {
78
+ return typeof item.id === 'string' && /^[a-zA-Z0-9-]{1,128}$/.test(item.id);
79
+ }).map(function (item) {return {id: item.id, title: String(item.title || 'Untitled conversation').slice(0, 500)};});
80
+ data = null;
81
+ send({type: 'titles', items: items});
82
+ } catch (_) {
83
+ send({type: 'error', code: timedOut ? 'timeout' : 'unavailable'});
84
+ } finally {
85
+ token = null;
86
+ clearTimeout(timer);
87
+ if (window.__onairosTitleDiscovery === controller) delete window.__onairosTitleDiscovery;
88
+ }
89
+ })();
90
+ })(); true;`;
91
+ }
92
+ export {
93
+ CANCEL_CHATGPT_DISCOVERY,
94
+ CHATGPT_DISCOVERY_LIMIT,
95
+ createChatGPTDiscoveryScript,
96
+ isChatGPTOrigin,
97
+ isDiscoveryNavigationAllowed,
98
+ parseDiscoveryMessage
99
+ };