@retion-miniapp/react-native 0.22.0 → 0.23.0
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/dist/index.d.mts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -285,6 +285,12 @@ interface MiniAppBridgeOptions {
|
|
|
285
285
|
app_id: string;
|
|
286
286
|
instance_id: string;
|
|
287
287
|
}) => void | Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Cầu nối Agent ↔ mini app (host chỉ chuyển nguyên, không đọc nội dung). Có provider thì package tự xử lý
|
|
290
|
+
* retion.ai.payload_meta của web và đẩy retion.ai.message / retion.ai.stopped xuống đúng mini app của agent.
|
|
291
|
+
* Mini app dùng onAgentMessage / sendPayloadMeta / onAgentStop của @retion-miniapp/sdk.
|
|
292
|
+
*/
|
|
293
|
+
agent?: MiniAppAgentProvider;
|
|
288
294
|
/**
|
|
289
295
|
* Thay nhận dạng giọng nói có sẵn (expo-speech-recognition) bằng của app — vd trợ lý voice AI.
|
|
290
296
|
* Web vẫn gọi speech.start / speech.stop và nhận speech.partial / speech.final / speech.end / speech.error như cũ
|
|
@@ -345,6 +351,41 @@ interface MiniAppBiometrics {
|
|
|
345
351
|
getAvailability: () => Promise<MiniAppBiometricAvailability>;
|
|
346
352
|
authenticate: (request: MiniAppBiometricRequest) => Promise<MiniAppBiometricResult>;
|
|
347
353
|
}
|
|
354
|
+
/** Kết quả gửi payload_meta lên agent — trả nguyên cho mini app. */
|
|
355
|
+
interface MiniAppAgentSendResult {
|
|
356
|
+
ok: boolean;
|
|
357
|
+
/** mid tin vừa gửi (mini app dùng bỏ tin echo qua socket) */
|
|
358
|
+
message_mid?: string;
|
|
359
|
+
fb_client_id?: string;
|
|
360
|
+
error?: string;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* App nối chat của mình (vd @retion/chat-sdk) vào cầu nối Agent. Package lo định tuyến agent → mini app.
|
|
364
|
+
*/
|
|
365
|
+
interface MiniAppAgentProvider {
|
|
366
|
+
/** Mini app gửi { text (được rỗng), payload_meta } lên agent. Không đọc / sửa payload_meta. */
|
|
367
|
+
sendPayloadMeta: (args: {
|
|
368
|
+
app_id: string;
|
|
369
|
+
agent_id?: string;
|
|
370
|
+
text: string;
|
|
371
|
+
payload_meta: Record<string, unknown>;
|
|
372
|
+
}) => Promise<MiniAppAgentSendResult> | MiniAppAgentSendResult;
|
|
373
|
+
/**
|
|
374
|
+
* Nghe chat: gọi emit.message với MỌI gói socket của hội thoại agent (nguyên vẹn), emit.stopped khi người dùng
|
|
375
|
+
* dừng lượt (bỏ qua dừng nội bộ). Trả hàm huỷ.
|
|
376
|
+
*/
|
|
377
|
+
subscribe: (emit: {
|
|
378
|
+
message: (event: {
|
|
379
|
+
agent_id: string;
|
|
380
|
+
fb_client_id: string;
|
|
381
|
+
raw: unknown;
|
|
382
|
+
}) => void;
|
|
383
|
+
stopped: (event: {
|
|
384
|
+
agent_id?: string;
|
|
385
|
+
source: string;
|
|
386
|
+
}) => void;
|
|
387
|
+
}) => () => void;
|
|
388
|
+
}
|
|
348
389
|
|
|
349
390
|
/** Giới hạn WebView sống — không truyền thì giữ mọi WebView (mở lại tức thì, tốn RAM hơn). */
|
|
350
391
|
interface MiniAppKeepAlive {
|
|
@@ -1112,4 +1153,12 @@ interface UploadCapabilities {
|
|
|
1112
1153
|
/** XHR (không phải fetch) để có tiến trình upload; RN đọc file từ uri (cả content://), không nạp vào JS. */
|
|
1113
1154
|
declare const uploadToUrl: MiniAppUploader;
|
|
1114
1155
|
|
|
1115
|
-
|
|
1156
|
+
declare const AGENT_BRIDGE_VERSION = 1;
|
|
1157
|
+
declare const AGENT_MESSAGE_EVENT = "retion.ai.message";
|
|
1158
|
+
declare const AGENT_STOPPED_EVENT = "retion.ai.stopped";
|
|
1159
|
+
declare const AGENT_PAYLOAD_META_EVENT = "retion.ai.payload_meta";
|
|
1160
|
+
declare const AGENT_PAYLOAD_META_RESULT_EVENT = "retion.ai.payload_meta_result";
|
|
1161
|
+
/** App nào đang dùng agent (theo retion.ai.agent web đã báo). */
|
|
1162
|
+
declare const getMiniAppIdByAgentId: (agent_id: string) => string | null;
|
|
1163
|
+
|
|
1164
|
+
export { AGENT_BRIDGE_VERSION, AGENT_MESSAGE_EVENT, AGENT_PAYLOAD_META_EVENT, AGENT_PAYLOAD_META_RESULT_EVENT, AGENT_STOPPED_EVENT, CodeType, DEFAULT_MINIAPP_UPDATES_LABELS, DefaultMiniAppChangelogHistoryModal, DefaultMiniAppChangelogPrompt, DefaultMiniAppSplash, DefaultMiniAppUpdatePrompt, type InlineToken, type LocationOptions, type LocationResult, MINIAPP_CHANGELOG_KINDS, MINIAPP_PLATFORM_URL, type MiniAppAgentProvider, type MiniAppAgentSendResult, type MiniAppBiometricAvailability, type MiniAppBiometricRequest, type MiniAppBiometricResult, type MiniAppBiometrics, type MiniAppBiometryType, type MiniAppBridgeOptions, type MiniAppCatalogEntry, type MiniAppCatalogItem, type MiniAppChangelog, type MiniAppChangelogActionsProps, MiniAppChangelogGroups, MiniAppChangelogHistory, type MiniAppChangelogHistoryRequest, type MiniAppChangelogKindStyle, type MiniAppChangelogPromptProps, type MiniAppChangelogRequest, type MiniAppChangelogState, MiniAppChangelogText, type MiniAppChangelogVersion, type MiniAppChannel, type MiniAppConfig, type MiniAppContainerProps, type MiniAppContext, type MiniAppDownloadState, type MiniAppDownloadStatus, type MiniAppDownloadTask, type MiniAppEvent, type MiniAppFileSystem, type MiniAppHandlerContext, type MiniAppHapticType, type MiniAppHistoryHeaderProps, _default$1 as MiniAppHost, type MiniAppHostData, BridgeError as MiniAppHostError, type MiniAppHostProps, type MiniAppKeepAlive, type MiniAppKeyboardMode, type MiniAppLaunch, type MiniAppLocalBundle, type MiniAppManifest, type MiniAppNativeHandlers, type MiniAppPaymentRequest, type MiniAppPaymentResult, type MiniAppPendingChangelog, type MiniAppPermission, type MiniAppPickedFile, type MiniAppSpeechProvider, type MiniAppSpeechStartContext, type MiniAppSplashProps, type MiniAppStorage, type MiniAppSyncResult, type MiniAppUpdate, type MiniAppUpdateActionProps, type MiniAppUpdatePromptProps, _default as MiniAppUpdates, type MiniAppUpdatesLabels, type MiniAppUpdatesProps, type MiniAppUpdatesTheme, MiniAppUpdatesThemeProvider, type MiniAppUploadCaller, type MiniAppUploadOptions, type MiniAppUploadProcessOptions, type MiniAppUploadProcessor, type MiniAppUploadRequest, type MiniAppUploadSource, type MiniAppUploadSourceRequest, type MiniAppUploadTarget, type MiniAppUploader, type MiniAppUrlUploadTarget, type OpenMiniAppArgs, type ReactNativeBiometricsLike, ScannerEndReason, ScannerEvent, ScannerLayout, ScannerMethod, type ScannerOptions, type ScannerResult, type SpeechOptions, ToastType, type UploadCapabilities, type UploadFileType, type UploadFilesResult, type UploadedFile, closeMiniApp, closeMiniAppChangelogHistory, configureMiniApp, createMmkvStorage, createReactNativeBiometrics, createRnfsFileSystem, dismissMiniAppChangelog, ensureMiniApp, fetchMiniAppChangelog, getLocalMiniApp, getMiniAppCatalog, getMiniAppCatalogEntry, getMiniAppChangelogSeen, getMiniAppIdByAgentId, getMiniAppStatuses, getMiniAppUpdate, getPendingChangelog, installBundledMiniApp, markMiniAppChangelogSeen, mergeMiniAppChangelog, onMiniAppEvent, openMiniApp, parseInlineMarkdown, pauseMiniApp, pauseMiniAppDownloads, preloadMiniApp, releaseSpeechFor, resolveMiniAppUpdatesTheme, restoreMiniApp, resumeMiniApp, resumeMiniAppDownloads, sendEventToWeb, showMiniAppChangelog, showMiniAppChangelogHistory, stripInlineMarkdown, syncMiniAppCatalog, uninstallMiniApp, updateMiniApp, uploadToUrl, useMiniAppChangelog, useMiniAppChangelogHistoryRequest, useMiniAppChangelogRequest, useMiniAppDownload, useMiniAppDownloadsPaused, useMiniAppUpdatesTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -285,6 +285,12 @@ interface MiniAppBridgeOptions {
|
|
|
285
285
|
app_id: string;
|
|
286
286
|
instance_id: string;
|
|
287
287
|
}) => void | Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Cầu nối Agent ↔ mini app (host chỉ chuyển nguyên, không đọc nội dung). Có provider thì package tự xử lý
|
|
290
|
+
* retion.ai.payload_meta của web và đẩy retion.ai.message / retion.ai.stopped xuống đúng mini app của agent.
|
|
291
|
+
* Mini app dùng onAgentMessage / sendPayloadMeta / onAgentStop của @retion-miniapp/sdk.
|
|
292
|
+
*/
|
|
293
|
+
agent?: MiniAppAgentProvider;
|
|
288
294
|
/**
|
|
289
295
|
* Thay nhận dạng giọng nói có sẵn (expo-speech-recognition) bằng của app — vd trợ lý voice AI.
|
|
290
296
|
* Web vẫn gọi speech.start / speech.stop và nhận speech.partial / speech.final / speech.end / speech.error như cũ
|
|
@@ -345,6 +351,41 @@ interface MiniAppBiometrics {
|
|
|
345
351
|
getAvailability: () => Promise<MiniAppBiometricAvailability>;
|
|
346
352
|
authenticate: (request: MiniAppBiometricRequest) => Promise<MiniAppBiometricResult>;
|
|
347
353
|
}
|
|
354
|
+
/** Kết quả gửi payload_meta lên agent — trả nguyên cho mini app. */
|
|
355
|
+
interface MiniAppAgentSendResult {
|
|
356
|
+
ok: boolean;
|
|
357
|
+
/** mid tin vừa gửi (mini app dùng bỏ tin echo qua socket) */
|
|
358
|
+
message_mid?: string;
|
|
359
|
+
fb_client_id?: string;
|
|
360
|
+
error?: string;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* App nối chat của mình (vd @retion/chat-sdk) vào cầu nối Agent. Package lo định tuyến agent → mini app.
|
|
364
|
+
*/
|
|
365
|
+
interface MiniAppAgentProvider {
|
|
366
|
+
/** Mini app gửi { text (được rỗng), payload_meta } lên agent. Không đọc / sửa payload_meta. */
|
|
367
|
+
sendPayloadMeta: (args: {
|
|
368
|
+
app_id: string;
|
|
369
|
+
agent_id?: string;
|
|
370
|
+
text: string;
|
|
371
|
+
payload_meta: Record<string, unknown>;
|
|
372
|
+
}) => Promise<MiniAppAgentSendResult> | MiniAppAgentSendResult;
|
|
373
|
+
/**
|
|
374
|
+
* Nghe chat: gọi emit.message với MỌI gói socket của hội thoại agent (nguyên vẹn), emit.stopped khi người dùng
|
|
375
|
+
* dừng lượt (bỏ qua dừng nội bộ). Trả hàm huỷ.
|
|
376
|
+
*/
|
|
377
|
+
subscribe: (emit: {
|
|
378
|
+
message: (event: {
|
|
379
|
+
agent_id: string;
|
|
380
|
+
fb_client_id: string;
|
|
381
|
+
raw: unknown;
|
|
382
|
+
}) => void;
|
|
383
|
+
stopped: (event: {
|
|
384
|
+
agent_id?: string;
|
|
385
|
+
source: string;
|
|
386
|
+
}) => void;
|
|
387
|
+
}) => () => void;
|
|
388
|
+
}
|
|
348
389
|
|
|
349
390
|
/** Giới hạn WebView sống — không truyền thì giữ mọi WebView (mở lại tức thì, tốn RAM hơn). */
|
|
350
391
|
interface MiniAppKeepAlive {
|
|
@@ -1112,4 +1153,12 @@ interface UploadCapabilities {
|
|
|
1112
1153
|
/** XHR (không phải fetch) để có tiến trình upload; RN đọc file từ uri (cả content://), không nạp vào JS. */
|
|
1113
1154
|
declare const uploadToUrl: MiniAppUploader;
|
|
1114
1155
|
|
|
1115
|
-
|
|
1156
|
+
declare const AGENT_BRIDGE_VERSION = 1;
|
|
1157
|
+
declare const AGENT_MESSAGE_EVENT = "retion.ai.message";
|
|
1158
|
+
declare const AGENT_STOPPED_EVENT = "retion.ai.stopped";
|
|
1159
|
+
declare const AGENT_PAYLOAD_META_EVENT = "retion.ai.payload_meta";
|
|
1160
|
+
declare const AGENT_PAYLOAD_META_RESULT_EVENT = "retion.ai.payload_meta_result";
|
|
1161
|
+
/** App nào đang dùng agent (theo retion.ai.agent web đã báo). */
|
|
1162
|
+
declare const getMiniAppIdByAgentId: (agent_id: string) => string | null;
|
|
1163
|
+
|
|
1164
|
+
export { AGENT_BRIDGE_VERSION, AGENT_MESSAGE_EVENT, AGENT_PAYLOAD_META_EVENT, AGENT_PAYLOAD_META_RESULT_EVENT, AGENT_STOPPED_EVENT, CodeType, DEFAULT_MINIAPP_UPDATES_LABELS, DefaultMiniAppChangelogHistoryModal, DefaultMiniAppChangelogPrompt, DefaultMiniAppSplash, DefaultMiniAppUpdatePrompt, type InlineToken, type LocationOptions, type LocationResult, MINIAPP_CHANGELOG_KINDS, MINIAPP_PLATFORM_URL, type MiniAppAgentProvider, type MiniAppAgentSendResult, type MiniAppBiometricAvailability, type MiniAppBiometricRequest, type MiniAppBiometricResult, type MiniAppBiometrics, type MiniAppBiometryType, type MiniAppBridgeOptions, type MiniAppCatalogEntry, type MiniAppCatalogItem, type MiniAppChangelog, type MiniAppChangelogActionsProps, MiniAppChangelogGroups, MiniAppChangelogHistory, type MiniAppChangelogHistoryRequest, type MiniAppChangelogKindStyle, type MiniAppChangelogPromptProps, type MiniAppChangelogRequest, type MiniAppChangelogState, MiniAppChangelogText, type MiniAppChangelogVersion, type MiniAppChannel, type MiniAppConfig, type MiniAppContainerProps, type MiniAppContext, type MiniAppDownloadState, type MiniAppDownloadStatus, type MiniAppDownloadTask, type MiniAppEvent, type MiniAppFileSystem, type MiniAppHandlerContext, type MiniAppHapticType, type MiniAppHistoryHeaderProps, _default$1 as MiniAppHost, type MiniAppHostData, BridgeError as MiniAppHostError, type MiniAppHostProps, type MiniAppKeepAlive, type MiniAppKeyboardMode, type MiniAppLaunch, type MiniAppLocalBundle, type MiniAppManifest, type MiniAppNativeHandlers, type MiniAppPaymentRequest, type MiniAppPaymentResult, type MiniAppPendingChangelog, type MiniAppPermission, type MiniAppPickedFile, type MiniAppSpeechProvider, type MiniAppSpeechStartContext, type MiniAppSplashProps, type MiniAppStorage, type MiniAppSyncResult, type MiniAppUpdate, type MiniAppUpdateActionProps, type MiniAppUpdatePromptProps, _default as MiniAppUpdates, type MiniAppUpdatesLabels, type MiniAppUpdatesProps, type MiniAppUpdatesTheme, MiniAppUpdatesThemeProvider, type MiniAppUploadCaller, type MiniAppUploadOptions, type MiniAppUploadProcessOptions, type MiniAppUploadProcessor, type MiniAppUploadRequest, type MiniAppUploadSource, type MiniAppUploadSourceRequest, type MiniAppUploadTarget, type MiniAppUploader, type MiniAppUrlUploadTarget, type OpenMiniAppArgs, type ReactNativeBiometricsLike, ScannerEndReason, ScannerEvent, ScannerLayout, ScannerMethod, type ScannerOptions, type ScannerResult, type SpeechOptions, ToastType, type UploadCapabilities, type UploadFileType, type UploadFilesResult, type UploadedFile, closeMiniApp, closeMiniAppChangelogHistory, configureMiniApp, createMmkvStorage, createReactNativeBiometrics, createRnfsFileSystem, dismissMiniAppChangelog, ensureMiniApp, fetchMiniAppChangelog, getLocalMiniApp, getMiniAppCatalog, getMiniAppCatalogEntry, getMiniAppChangelogSeen, getMiniAppIdByAgentId, getMiniAppStatuses, getMiniAppUpdate, getPendingChangelog, installBundledMiniApp, markMiniAppChangelogSeen, mergeMiniAppChangelog, onMiniAppEvent, openMiniApp, parseInlineMarkdown, pauseMiniApp, pauseMiniAppDownloads, preloadMiniApp, releaseSpeechFor, resolveMiniAppUpdatesTheme, restoreMiniApp, resumeMiniApp, resumeMiniAppDownloads, sendEventToWeb, showMiniAppChangelog, showMiniAppChangelogHistory, stripInlineMarkdown, syncMiniAppCatalog, uninstallMiniApp, updateMiniApp, uploadToUrl, useMiniAppChangelog, useMiniAppChangelogHistoryRequest, useMiniAppChangelogRequest, useMiniAppDownload, useMiniAppDownloadsPaused, useMiniAppUpdatesTheme };
|