@retion-miniapp/sdk 0.18.0 → 0.19.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.cts CHANGED
@@ -521,6 +521,74 @@ interface OnAgentContextOptions {
521
521
  * const off = onAgentContext<QueryCondition[]>(({ payload_context }) => applyFilter(payload_context));
522
522
  */
523
523
  declare const onAgentContext: <TPayload = unknown>(listener: (context: AgentContext<TPayload>) => void, options?: OnAgentContextOptions) => (() => void);
524
+ /** Phiên bản giao thức cầu nối Agent mà SDK này dùng */
525
+ declare const AGENT_BRIDGE_VERSION = 1;
526
+ declare const AGENT_MESSAGE_EVENT_TYPE = "retion.ai.message";
527
+ declare const AGENT_STOPPED_EVENT_TYPE = "retion.ai.stopped";
528
+ declare const AGENT_PAYLOAD_META_EVENT_TYPE = "retion.ai.payload_meta";
529
+ declare const AGENT_PAYLOAD_META_RESULT_EVENT_TYPE = "retion.ai.payload_meta_result";
530
+ /** Tin socket hội thoại Agent, app chủ đẩy nguyên vẹn */
531
+ interface AgentMessage<TRaw = unknown> {
532
+ /** Phiên bản giao thức của app chủ */
533
+ v: number;
534
+ app_id: string;
535
+ agent_id: string;
536
+ fb_client_id: string;
537
+ /** Nguyên gói socket (message / update_message / new_messages / update_messages …) */
538
+ raw: TRaw;
539
+ }
540
+ interface AgentStopEvent {
541
+ v: number;
542
+ app_id: string;
543
+ agent_id: string;
544
+ /** 'chat' = dừng trong chat của app chủ, 'miniapp' = ■ ở mini app */
545
+ source: string;
546
+ }
547
+ interface OnAgentMessageOptions extends OnAgentContextOptions {
548
+ /** Nhận cả gói socket chỉ chứa tin chính app này vừa gửi bằng sendPayloadMeta (echo). Mặc định false */
549
+ includeEcho?: boolean;
550
+ }
551
+ interface SendPayloadMetaOptions {
552
+ /** Chữ gửi kèm (hiện trong chat). Bỏ trống = "" — tin không hiện bong bóng */
553
+ text?: string;
554
+ /** Agent nhận. Bỏ trống = agent đã đặt qua setAgent */
555
+ agent_id?: string;
556
+ /** Hết hạn chờ app chủ trả kết quả (ms). Mặc định 15000 */
557
+ timeout_ms?: number;
558
+ }
559
+ interface SendPayloadMetaResult {
560
+ ok: boolean;
561
+ /** mid tin vừa gửi (nếu server trả) */
562
+ message_mid?: string;
563
+ fb_client_id?: string;
564
+ /** 'no_host' | 'unsupported' | 'invalid' | 'no_agent' | 'no_conversation' | 'send_failed' | 'timeout' … */
565
+ error?: string;
566
+ }
567
+ /**
568
+ * Nghe MỌI gói socket hội thoại Agent của mini app này — app chủ đẩy nguyên vẹn (step, trả lời…), mini app tự chọn.
569
+ * Mặc định bỏ gói chỉ chứa echo tin chính app vừa gửi bằng sendPayloadMeta (tránh vòng lặp).
570
+ *
571
+ * @returns hàm huỷ nghe
572
+ * @example
573
+ * const off = onAgentMessage(({ raw }) => handleAgentStep(raw));
574
+ */
575
+ declare const onAgentMessage: <TRaw = unknown>(listener: (message: AgentMessage<TRaw>) => void, options?: OnAgentMessageOptions) => (() => void);
576
+ /**
577
+ * Nghe khi người dùng dừng lượt Agent (■ ở mini app hoặc nút dừng trong chat app chủ) → mini app ngừng thao tác.
578
+ *
579
+ * @returns hàm huỷ nghe
580
+ */
581
+ declare const onAgentStop: (listener: (event: AgentStopEvent) => void, options?: OnAgentContextOptions) => (() => void);
582
+ /**
583
+ * Gửi payload_meta lên Agent qua app chủ (app chủ không đọc, gửi nguyên { text, payload_meta }). Dùng báo step /
584
+ * lỗi / xong… — format do mini app và agent tự thống nhất.
585
+ *
586
+ * @example
587
+ * await sendPayloadMeta({ status: 'step', step: 'created_order', order_id });
588
+ */
589
+ declare const sendPayloadMeta: (payload_meta: Record<string, unknown>, options?: SendPayloadMetaOptions) => Promise<SendPayloadMetaResult>;
590
+ /** Phiên bản giao thức cầu nối Agent của SDK (so với `v` trong event app chủ gửi để biết app chủ hỗ trợ tới đâu). */
591
+ declare const getAgentBridgeVersion: () => number;
524
592
 
525
593
  interface LocationOptions {
526
594
  /** Yêu cầu độ chính xác cao; không đảm bảo thiết bị luôn trả vị trí chính xác. */
@@ -659,4 +727,4 @@ declare const getUploadCapabilities: () => Promise<UploadCapabilities>;
659
727
  */
660
728
  declare const uploadFiles: (options?: UploadFilesOptions) => Promise<UploadFilesResult>;
661
729
 
662
- export { AGENT_CONTEXT_EVENT_TYPE, type AgentContext, type AgentInfo, type BiometricAvailability, type BiometricRequest, type BiometricResult, type BiometryType, type ChangelogPopupOptions, CodeType, ErrorCode, HapticType, type LocationOptions, type LocationResult, MiniAppError, type OnAgentContextOptions, type OpenScreenRequest, type PaymentRequest, type PaymentResult, type PrintImageRequest, type RouteParams, SDK_VERSION, type ScanCodeOptions, type ScanResult, type ScannerEnd, ScannerEndReason, ScannerEvent, type ScannerEvents, ScannerLayout, type SetAgentOptions, type ShowToastOptions, type SpeechError, type SpeechEvents, type SpeechOptions, type SpeechResult, type StartScannerOptions, ToastType, type TokenType, type UploadCapabilities, type UploadFileType, type UploadFilesOptions, type UploadFilesResult, type UploadProcessOptions, type UploadProgress, type UploadTarget, type UploadUrlTarget, type UploadedFile, authenticateBiometric, closeApp, getAccessToken, getBiometricAvailability, getCurrentLocation, getRouteParams, getToken, getUploadCapabilities, haptic, isInHost, onAgentContext, onAppPaused, onAppResumed, onContextChange, onScanner, onSpeech, openChangelogHistory, openChangelogPopup, openLink, openScreen, printImage, requestPayment, scanCode, setAgent, showToast, startScanner, startSpeech, stopScanner, stopSpeech, uploadFiles };
730
+ export { AGENT_BRIDGE_VERSION, AGENT_CONTEXT_EVENT_TYPE, AGENT_MESSAGE_EVENT_TYPE, AGENT_PAYLOAD_META_EVENT_TYPE, AGENT_PAYLOAD_META_RESULT_EVENT_TYPE, AGENT_STOPPED_EVENT_TYPE, type AgentContext, type AgentInfo, type AgentMessage, type AgentStopEvent, type BiometricAvailability, type BiometricRequest, type BiometricResult, type BiometryType, type ChangelogPopupOptions, CodeType, ErrorCode, HapticType, type LocationOptions, type LocationResult, MiniAppError, type OnAgentContextOptions, type OnAgentMessageOptions, type OpenScreenRequest, type PaymentRequest, type PaymentResult, type PrintImageRequest, type RouteParams, SDK_VERSION, type ScanCodeOptions, type ScanResult, type ScannerEnd, ScannerEndReason, ScannerEvent, type ScannerEvents, ScannerLayout, type SendPayloadMetaOptions, type SendPayloadMetaResult, type SetAgentOptions, type ShowToastOptions, type SpeechError, type SpeechEvents, type SpeechOptions, type SpeechResult, type StartScannerOptions, ToastType, type TokenType, type UploadCapabilities, type UploadFileType, type UploadFilesOptions, type UploadFilesResult, type UploadProcessOptions, type UploadProgress, type UploadTarget, type UploadUrlTarget, type UploadedFile, authenticateBiometric, closeApp, getAccessToken, getAgentBridgeVersion, getBiometricAvailability, getCurrentLocation, getRouteParams, getToken, getUploadCapabilities, haptic, isInHost, onAgentContext, onAgentMessage, onAgentStop, onAppPaused, onAppResumed, onContextChange, onScanner, onSpeech, openChangelogHistory, openChangelogPopup, openLink, openScreen, printImage, requestPayment, scanCode, sendPayloadMeta, setAgent, showToast, startScanner, startSpeech, stopScanner, stopSpeech, uploadFiles };
package/dist/index.d.ts CHANGED
@@ -521,6 +521,74 @@ interface OnAgentContextOptions {
521
521
  * const off = onAgentContext<QueryCondition[]>(({ payload_context }) => applyFilter(payload_context));
522
522
  */
523
523
  declare const onAgentContext: <TPayload = unknown>(listener: (context: AgentContext<TPayload>) => void, options?: OnAgentContextOptions) => (() => void);
524
+ /** Phiên bản giao thức cầu nối Agent mà SDK này dùng */
525
+ declare const AGENT_BRIDGE_VERSION = 1;
526
+ declare const AGENT_MESSAGE_EVENT_TYPE = "retion.ai.message";
527
+ declare const AGENT_STOPPED_EVENT_TYPE = "retion.ai.stopped";
528
+ declare const AGENT_PAYLOAD_META_EVENT_TYPE = "retion.ai.payload_meta";
529
+ declare const AGENT_PAYLOAD_META_RESULT_EVENT_TYPE = "retion.ai.payload_meta_result";
530
+ /** Tin socket hội thoại Agent, app chủ đẩy nguyên vẹn */
531
+ interface AgentMessage<TRaw = unknown> {
532
+ /** Phiên bản giao thức của app chủ */
533
+ v: number;
534
+ app_id: string;
535
+ agent_id: string;
536
+ fb_client_id: string;
537
+ /** Nguyên gói socket (message / update_message / new_messages / update_messages …) */
538
+ raw: TRaw;
539
+ }
540
+ interface AgentStopEvent {
541
+ v: number;
542
+ app_id: string;
543
+ agent_id: string;
544
+ /** 'chat' = dừng trong chat của app chủ, 'miniapp' = ■ ở mini app */
545
+ source: string;
546
+ }
547
+ interface OnAgentMessageOptions extends OnAgentContextOptions {
548
+ /** Nhận cả gói socket chỉ chứa tin chính app này vừa gửi bằng sendPayloadMeta (echo). Mặc định false */
549
+ includeEcho?: boolean;
550
+ }
551
+ interface SendPayloadMetaOptions {
552
+ /** Chữ gửi kèm (hiện trong chat). Bỏ trống = "" — tin không hiện bong bóng */
553
+ text?: string;
554
+ /** Agent nhận. Bỏ trống = agent đã đặt qua setAgent */
555
+ agent_id?: string;
556
+ /** Hết hạn chờ app chủ trả kết quả (ms). Mặc định 15000 */
557
+ timeout_ms?: number;
558
+ }
559
+ interface SendPayloadMetaResult {
560
+ ok: boolean;
561
+ /** mid tin vừa gửi (nếu server trả) */
562
+ message_mid?: string;
563
+ fb_client_id?: string;
564
+ /** 'no_host' | 'unsupported' | 'invalid' | 'no_agent' | 'no_conversation' | 'send_failed' | 'timeout' … */
565
+ error?: string;
566
+ }
567
+ /**
568
+ * Nghe MỌI gói socket hội thoại Agent của mini app này — app chủ đẩy nguyên vẹn (step, trả lời…), mini app tự chọn.
569
+ * Mặc định bỏ gói chỉ chứa echo tin chính app vừa gửi bằng sendPayloadMeta (tránh vòng lặp).
570
+ *
571
+ * @returns hàm huỷ nghe
572
+ * @example
573
+ * const off = onAgentMessage(({ raw }) => handleAgentStep(raw));
574
+ */
575
+ declare const onAgentMessage: <TRaw = unknown>(listener: (message: AgentMessage<TRaw>) => void, options?: OnAgentMessageOptions) => (() => void);
576
+ /**
577
+ * Nghe khi người dùng dừng lượt Agent (■ ở mini app hoặc nút dừng trong chat app chủ) → mini app ngừng thao tác.
578
+ *
579
+ * @returns hàm huỷ nghe
580
+ */
581
+ declare const onAgentStop: (listener: (event: AgentStopEvent) => void, options?: OnAgentContextOptions) => (() => void);
582
+ /**
583
+ * Gửi payload_meta lên Agent qua app chủ (app chủ không đọc, gửi nguyên { text, payload_meta }). Dùng báo step /
584
+ * lỗi / xong… — format do mini app và agent tự thống nhất.
585
+ *
586
+ * @example
587
+ * await sendPayloadMeta({ status: 'step', step: 'created_order', order_id });
588
+ */
589
+ declare const sendPayloadMeta: (payload_meta: Record<string, unknown>, options?: SendPayloadMetaOptions) => Promise<SendPayloadMetaResult>;
590
+ /** Phiên bản giao thức cầu nối Agent của SDK (so với `v` trong event app chủ gửi để biết app chủ hỗ trợ tới đâu). */
591
+ declare const getAgentBridgeVersion: () => number;
524
592
 
525
593
  interface LocationOptions {
526
594
  /** Yêu cầu độ chính xác cao; không đảm bảo thiết bị luôn trả vị trí chính xác. */
@@ -659,4 +727,4 @@ declare const getUploadCapabilities: () => Promise<UploadCapabilities>;
659
727
  */
660
728
  declare const uploadFiles: (options?: UploadFilesOptions) => Promise<UploadFilesResult>;
661
729
 
662
- export { AGENT_CONTEXT_EVENT_TYPE, type AgentContext, type AgentInfo, type BiometricAvailability, type BiometricRequest, type BiometricResult, type BiometryType, type ChangelogPopupOptions, CodeType, ErrorCode, HapticType, type LocationOptions, type LocationResult, MiniAppError, type OnAgentContextOptions, type OpenScreenRequest, type PaymentRequest, type PaymentResult, type PrintImageRequest, type RouteParams, SDK_VERSION, type ScanCodeOptions, type ScanResult, type ScannerEnd, ScannerEndReason, ScannerEvent, type ScannerEvents, ScannerLayout, type SetAgentOptions, type ShowToastOptions, type SpeechError, type SpeechEvents, type SpeechOptions, type SpeechResult, type StartScannerOptions, ToastType, type TokenType, type UploadCapabilities, type UploadFileType, type UploadFilesOptions, type UploadFilesResult, type UploadProcessOptions, type UploadProgress, type UploadTarget, type UploadUrlTarget, type UploadedFile, authenticateBiometric, closeApp, getAccessToken, getBiometricAvailability, getCurrentLocation, getRouteParams, getToken, getUploadCapabilities, haptic, isInHost, onAgentContext, onAppPaused, onAppResumed, onContextChange, onScanner, onSpeech, openChangelogHistory, openChangelogPopup, openLink, openScreen, printImage, requestPayment, scanCode, setAgent, showToast, startScanner, startSpeech, stopScanner, stopSpeech, uploadFiles };
730
+ export { AGENT_BRIDGE_VERSION, AGENT_CONTEXT_EVENT_TYPE, AGENT_MESSAGE_EVENT_TYPE, AGENT_PAYLOAD_META_EVENT_TYPE, AGENT_PAYLOAD_META_RESULT_EVENT_TYPE, AGENT_STOPPED_EVENT_TYPE, type AgentContext, type AgentInfo, type AgentMessage, type AgentStopEvent, type BiometricAvailability, type BiometricRequest, type BiometricResult, type BiometryType, type ChangelogPopupOptions, CodeType, ErrorCode, HapticType, type LocationOptions, type LocationResult, MiniAppError, type OnAgentContextOptions, type OnAgentMessageOptions, type OpenScreenRequest, type PaymentRequest, type PaymentResult, type PrintImageRequest, type RouteParams, SDK_VERSION, type ScanCodeOptions, type ScanResult, type ScannerEnd, ScannerEndReason, ScannerEvent, type ScannerEvents, ScannerLayout, type SendPayloadMetaOptions, type SendPayloadMetaResult, type SetAgentOptions, type ShowToastOptions, type SpeechError, type SpeechEvents, type SpeechOptions, type SpeechResult, type StartScannerOptions, ToastType, type TokenType, type UploadCapabilities, type UploadFileType, type UploadFilesOptions, type UploadFilesResult, type UploadProcessOptions, type UploadProgress, type UploadTarget, type UploadUrlTarget, type UploadedFile, authenticateBiometric, closeApp, getAccessToken, getAgentBridgeVersion, getBiometricAvailability, getCurrentLocation, getRouteParams, getToken, getUploadCapabilities, haptic, isInHost, onAgentContext, onAgentMessage, onAgentStop, onAppPaused, onAppResumed, onContextChange, onScanner, onSpeech, openChangelogHistory, openChangelogPopup, openLink, openScreen, printImage, requestPayment, scanCode, sendPayloadMeta, setAgent, showToast, startScanner, startSpeech, stopScanner, stopSpeech, uploadFiles };
package/dist/index.js CHANGED
@@ -195,7 +195,7 @@ var on = (event, listener) => {
195
195
  };
196
196
 
197
197
  // src/version.ts
198
- var SDK_VERSION = "0.18.0" ;
198
+ var SDK_VERSION = "0.19.0" ;
199
199
 
200
200
  // src/apis/app.ts
201
201
  var closeApp = () => call("closeApp");
@@ -441,6 +441,178 @@ var onAgentContext = (listener, options = {}) => {
441
441
  window.addEventListener("pagehide", off);
442
442
  return off;
443
443
  };
444
+ var AGENT_BRIDGE_VERSION = 1;
445
+ var AGENT_MESSAGE_EVENT_TYPE = "retion.ai.message";
446
+ var AGENT_STOPPED_EVENT_TYPE = "retion.ai.stopped";
447
+ var AGENT_PAYLOAD_META_EVENT_TYPE = "retion.ai.payload_meta";
448
+ var AGENT_PAYLOAD_META_RESULT_EVENT_TYPE = "retion.ai.payload_meta_result";
449
+ var SENT_LIMIT = 50;
450
+ var sent_mids = [];
451
+ var sent_metas = [];
452
+ var remember = (list, value) => {
453
+ list.push(value);
454
+ if (list.length > SENT_LIMIT) {
455
+ list.shift();
456
+ }
457
+ };
458
+ var rawMessages = (raw) => {
459
+ const entry = raw && typeof raw === "object" ? raw : null;
460
+ if (!entry) {
461
+ return [];
462
+ }
463
+ const pick = (x, key) => x && typeof x === "object" ? x[key] : void 0;
464
+ const list = [
465
+ ...Array.isArray(entry.new_messages) ? entry.new_messages.map((x) => pick(x, "message")) : [entry.message],
466
+ ...Array.isArray(entry.update_messages) ? entry.update_messages.map((x) => {
467
+ var _a;
468
+ return (_a = pick(x, "update_message")) != null ? _a : x;
469
+ }) : [entry.update_message]
470
+ ];
471
+ return list.filter((m) => !!m && typeof m === "object");
472
+ };
473
+ var isEchoMessage = (m) => {
474
+ var _a, _b;
475
+ const mid = String((_b = (_a = m.message_mid) != null ? _a : m._id) != null ? _b : "");
476
+ if (mid && sent_mids.includes(mid)) {
477
+ return true;
478
+ }
479
+ return m.payload_meta != null && sent_metas.includes(JSON.stringify(m.payload_meta));
480
+ };
481
+ var isEchoOnly = (raw) => {
482
+ const messages = rawMessages(raw);
483
+ return messages.length > 0 && messages.every(isEchoMessage);
484
+ };
485
+ var listenHostEvent = (type, app_id, dedupeKey, handle) => {
486
+ if (typeof window === "undefined") {
487
+ return () => {
488
+ };
489
+ }
490
+ const seen = [];
491
+ const handler = (event) => {
492
+ if (event.source) {
493
+ return;
494
+ }
495
+ const data = parseEventData(event.data);
496
+ if (!data || data.type !== type) {
497
+ return;
498
+ }
499
+ const target_app = app_id != null ? app_id : current == null ? void 0 : current.app_id;
500
+ if (target_app && data.app_id && data.app_id !== target_app) {
501
+ return;
502
+ }
503
+ if (!data.app_id && data.agent_id && (current == null ? void 0 : current.agent_id) && data.agent_id !== current.agent_id) {
504
+ return;
505
+ }
506
+ const key = dedupeKey(data);
507
+ if (key !== null) {
508
+ if (seen.includes(key)) {
509
+ return;
510
+ }
511
+ seen.push(key);
512
+ if (seen.length > DEDUPE_LIMIT) {
513
+ seen.shift();
514
+ }
515
+ }
516
+ try {
517
+ handle(data);
518
+ } catch (error) {
519
+ console.error(`[retion-miniapp] ${type} listener l\u1ED7i`, error);
520
+ }
521
+ };
522
+ const targets = getEventWindows().flatMap((w) => [w, w.document]);
523
+ targets.forEach((target) => target.addEventListener("message", handler));
524
+ let active = true;
525
+ const off = () => {
526
+ if (!active) {
527
+ return;
528
+ }
529
+ active = false;
530
+ targets.forEach((target) => target.removeEventListener("message", handler));
531
+ window.removeEventListener("pagehide", off);
532
+ };
533
+ window.addEventListener("pagehide", off);
534
+ return off;
535
+ };
536
+ var onAgentMessage = (listener, options = {}) => listenHostEvent(
537
+ AGENT_MESSAGE_EVENT_TYPE,
538
+ options.app_id,
539
+ (data) => {
540
+ var _a, _b;
541
+ return `${String((_a = data.fb_client_id) != null ? _a : "")}:${JSON.stringify((_b = data.raw) != null ? _b : null)}`;
542
+ },
543
+ (data) => {
544
+ if (!options.includeEcho && isEchoOnly(data.raw)) {
545
+ return;
546
+ }
547
+ const message = { ...data };
548
+ delete message.type;
549
+ listener(message);
550
+ }
551
+ );
552
+ var onAgentStop = (listener, options = {}) => {
553
+ let last_at = 0;
554
+ return listenHostEvent(AGENT_STOPPED_EVENT_TYPE, options.app_id, () => null, (data) => {
555
+ const now = Date.now();
556
+ if (now - last_at < 50) {
557
+ return;
558
+ }
559
+ last_at = now;
560
+ const event = { ...data };
561
+ delete event.type;
562
+ listener(event);
563
+ });
564
+ };
565
+ var request_seq = 0;
566
+ var sendPayloadMeta = (payload_meta, options = {}) => {
567
+ if (!payload_meta || typeof payload_meta !== "object" || Array.isArray(payload_meta)) {
568
+ return Promise.resolve({ ok: false, error: "invalid" });
569
+ }
570
+ const host = getHostWindow();
571
+ if (!host) {
572
+ return Promise.resolve({ ok: false, error: "no_host" });
573
+ }
574
+ request_seq += 1;
575
+ const request_id = `pm_${Date.now().toString(36)}_${request_seq}`;
576
+ const meta_key = JSON.stringify(payload_meta);
577
+ remember(sent_metas, meta_key);
578
+ return new Promise((resolve) => {
579
+ var _a, _b;
580
+ let done = false;
581
+ const finish = (result) => {
582
+ if (done) {
583
+ return;
584
+ }
585
+ done = true;
586
+ clearTimeout(timer);
587
+ off();
588
+ if (result.message_mid) {
589
+ remember(sent_mids, result.message_mid);
590
+ }
591
+ resolve(result);
592
+ };
593
+ const off = listenHostEvent(AGENT_PAYLOAD_META_RESULT_EVENT_TYPE, void 0, () => null, (data) => {
594
+ if (data.request_id !== request_id) {
595
+ return;
596
+ }
597
+ const result = { ...data };
598
+ delete result.type;
599
+ delete result.v;
600
+ delete result.request_id;
601
+ finish({ ...result, ok: !!data.ok });
602
+ });
603
+ const timer = setTimeout(() => finish({ ok: false, error: "timeout" }), (_a = options.timeout_ms) != null ? _a : 15e3);
604
+ host.ReactNativeWebView.postMessage(JSON.stringify({
605
+ type: AGENT_PAYLOAD_META_EVENT_TYPE,
606
+ v: AGENT_BRIDGE_VERSION,
607
+ request_id,
608
+ ...(current == null ? void 0 : current.app_id) ? { app_id: current.app_id } : null,
609
+ ...options.agent_id || (current == null ? void 0 : current.agent_id) ? { agent_id: options.agent_id || (current == null ? void 0 : current.agent_id) } : null,
610
+ text: (_b = options.text) != null ? _b : "",
611
+ payload_meta
612
+ }));
613
+ });
614
+ };
615
+ var getAgentBridgeVersion = () => AGENT_BRIDGE_VERSION;
444
616
 
445
617
  // src/apis/location.ts
446
618
  var getCurrentLocation = (options = {}) => {
@@ -481,6 +653,6 @@ if (typeof window !== "undefined") {
481
653
  }
482
654
  }
483
655
 
484
- export { AGENT_CONTEXT_EVENT_TYPE, CodeType, ErrorCode, HapticType, MiniAppError, SDK_VERSION, ScannerEndReason, ScannerEvent, ScannerLayout, ToastType, authenticateBiometric, closeApp, getAccessToken, getBiometricAvailability, getCurrentLocation, getRouteParams, getToken, getUploadCapabilities, haptic, isInHost, onAgentContext, onAppPaused, onAppResumed, onContextChange, onScanner, onSpeech, openChangelogHistory, openChangelogPopup, openLink, openScreen, printImage, requestPayment, scanCode, setAgent, showToast, startScanner, startSpeech, stopScanner, stopSpeech, uploadFiles };
656
+ export { AGENT_BRIDGE_VERSION, AGENT_CONTEXT_EVENT_TYPE, AGENT_MESSAGE_EVENT_TYPE, AGENT_PAYLOAD_META_EVENT_TYPE, AGENT_PAYLOAD_META_RESULT_EVENT_TYPE, AGENT_STOPPED_EVENT_TYPE, CodeType, ErrorCode, HapticType, MiniAppError, SDK_VERSION, ScannerEndReason, ScannerEvent, ScannerLayout, ToastType, authenticateBiometric, closeApp, getAccessToken, getAgentBridgeVersion, getBiometricAvailability, getCurrentLocation, getRouteParams, getToken, getUploadCapabilities, haptic, isInHost, onAgentContext, onAgentMessage, onAgentStop, onAppPaused, onAppResumed, onContextChange, onScanner, onSpeech, openChangelogHistory, openChangelogPopup, openLink, openScreen, printImage, requestPayment, scanCode, sendPayloadMeta, setAgent, showToast, startScanner, startSpeech, stopScanner, stopSpeech, uploadFiles };
485
657
  //# sourceMappingURL=index.js.map
486
658
  //# sourceMappingURL=index.js.map