@ateam-ai-mobile/core 0.1.33 → 0.1.35

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 CHANGED
@@ -868,25 +868,6 @@ interface ChatState {
868
868
  /** Start a fresh empty chat without re-fetching history */
869
869
  newChat: () => void;
870
870
  }
871
- /**
872
- * Sentinel delimiters used to embed structured table data inside a flat
873
- * message string. UI layers split on these and render the contents with a
874
- * native table component instead of markdown tables — markdown tables look
875
- * terrible on narrow phone screens.
876
- *
877
- * Unicode Private Use Area chars (U+E100/U+E101) so they never collide with
878
- * anything the model could legitimately emit.
879
- */
880
- declare const TABLE_BLOCK_OPEN = "\uE100";
881
- declare const TABLE_BLOCK_CLOSE = "\uE101";
882
- /**
883
- * Extract display text from a conversation turn's assistant blocks.
884
- * Handles multiple block kinds (text, code, json, markdown, table, html).
885
- */
886
- declare function blocksToText(blocks?: Array<{
887
- kind: string;
888
- content: any;
889
- }>): string;
890
871
  declare const useChatStore: zustand.UseBoundStore<zustand.StoreApi<ChatState>>;
891
872
  /** What this client can execute, supplied by the host (see setClientDeclarationProvider). */
892
873
  type ClientDeclaration = {
@@ -905,6 +886,95 @@ declare function setClientDeclarationProvider(fn: (() => ClientDeclaration | nul
905
886
  /** Tear down the live connection (env/auth switch, SDK unmount). */
906
887
  declare function closeChatStream(): void;
907
888
 
889
+ /**
890
+ * What the phone's chat bubble is handed for a reply: the blocks of a conversation turn as ONE flat string, and that string
891
+ * split back into what the bubble draws. Pure and import-free, so a test runs it in node (it used to sit in store.ts).
892
+ *
893
+ * Nothing a reply holds is dropped. This file used to throw away every json and code block that sat beside a text block (a copy of
894
+ * the web chat's March rule), so a script, a command or a diagram under the answer never reached the person. Which raw data is
895
+ * shown CLOSED is Core's call, made once, at read (backend utils/blockDisplay.js marks it `meta.display: "folded"`); this file only
896
+ * carries that mark to the bubble: a marked block's text is wrapped in the DETAILS sentinels, and the bubble draws that segment as
897
+ * a closed "Details" row. It never decides what folds.
898
+ */
899
+ /**
900
+ * Sentinel delimiters used to embed structured table data inside a flat message string. UI layers split on these and render the
901
+ * contents with a native table component instead of markdown tables, which look terrible on narrow phone screens.
902
+ *
903
+ * Unicode Private Use Area chars so they never collide with anything the model could legitimately emit.
904
+ */
905
+ declare const TABLE_BLOCK_OPEN = "\uE100";
906
+ declare const TABLE_BLOCK_CLOSE = "\uE101";
907
+ /**
908
+ * The same, for a block Core marked folded: its text (already rendered to markdown) travels between these, percent-encoded so it
909
+ * can never hold a newline or a sentinel, and the bubble draws it closed under "Details".
910
+ */
911
+ declare const DETAILS_BLOCK_OPEN = "\uE102";
912
+ declare const DETAILS_BLOCK_CLOSE = "\uE103";
913
+ /**
914
+ * The same, for a `diagram` block: a straight list of numbered steps with arrows and a colour per status word. Its payload is the
915
+ * clean `DiagramView` (below) as percent-encoded JSON, and the bubble draws it with a native component.
916
+ */
917
+ declare const DIAGRAM_BLOCK_OPEN = "\uE104";
918
+ declare const DIAGRAM_BLOCK_CLOSE = "\uE105";
919
+ /** A block of a conversation turn, as /api/conversation serves it. */
920
+ interface ConversationBlock {
921
+ kind: string;
922
+ content?: any;
923
+ language?: string;
924
+ meta?: {
925
+ display?: string;
926
+ };
927
+ }
928
+ /**
929
+ * The status words a diagram step or badge may carry; none is neutral. The same four as Core's `DIAGRAM_STATUSES` (backend
930
+ * utils/blockShape.js) and the web's (apps/frontend chat/blocks/diagramView.js): a test on each side holds the list. Colours are
931
+ * this app's own; Core never sends one.
932
+ */
933
+ declare const DIAGRAM_STATUSES: readonly ["ok", "bad", "warn", "info"];
934
+ type DiagramStatus = (typeof DIAGRAM_STATUSES)[number];
935
+ interface DiagramView {
936
+ title: string;
937
+ steps: Array<{
938
+ title: string;
939
+ text: string;
940
+ status: DiagramStatus | '';
941
+ badges: Array<{
942
+ text: string;
943
+ status: DiagramStatus | '';
944
+ }>;
945
+ }>;
946
+ }
947
+ /**
948
+ * The diagram a block holds, ready to draw, every field text; null when there is nothing to draw (fewer than 2 steps). Core sends it
949
+ * clean (`diagramOf`); this is the phone's own net, so a field of the wrong type can never reach a native <Text>.
950
+ */
951
+ declare function diagramView(content: any): DiagramView | null;
952
+ /** A diagram as readable text, the same numbered list Core gives other channels (backend `diagramToText`). */
953
+ declare function diagramAsText(d: DiagramView): string;
954
+ /**
955
+ * Extract display text from a conversation turn's blocks. Handles multiple block kinds (text, code, json, markdown, table, html).
956
+ * Every block that holds something is in the result, in order; a block Core marked `meta.display: "folded"` is wrapped in the
957
+ * DETAILS sentinels so the bubble draws it closed.
958
+ */
959
+ declare function blocksToText(blocks?: ConversationBlock[]): string;
960
+ /** One piece of a flat message string, as the bubble draws it: markdown, a table payload, a diagram payload, or a closed "Details" payload. */
961
+ interface BlockSegment {
962
+ kind: 'md' | 'table' | 'details' | 'diagram';
963
+ /** md: the markdown. table / details / diagram: the still percent-encoded payload between the sentinels. */
964
+ content: string;
965
+ }
966
+ /**
967
+ * Split a flat message string on the table, details and diagram sentinels, in order. A string with none is one markdown segment. An
968
+ * unterminated marker is kept as markdown from the marker on, so nothing is lost.
969
+ */
970
+ declare function splitBlockSegments(content: string): BlockSegment[];
971
+ /**
972
+ * The flat content of a message as the person would read it: a table is its columns and rows as lines, and a "Details" payload is
973
+ * its text. What long-press copy and a screen reader are given; the raw string holds percent-encoded payloads between private-use
974
+ * characters, which nobody should hear or paste.
975
+ */
976
+ declare function plainTextOf(content: string): string;
977
+
908
978
  /** One attachment as `/api/chat` takes it: a stored file by hash, or small inline base64. */
909
979
  type WireAttachment = {
910
980
  hash: string;
@@ -1358,4 +1428,4 @@ interface AcsKvStorage {
1358
1428
  }
1359
1429
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1360
1430
 
1361
- export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BufferedCommand, type ChannelPrefs, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type DevicePlatform, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, nestByMaster, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
1431
+ export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BlockSegment, type BufferedCommand, type ChannelPrefs, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type ConversationBlock, DETAILS_BLOCK_CLOSE, DETAILS_BLOCK_OPEN, DIAGRAM_BLOCK_CLOSE, DIAGRAM_BLOCK_OPEN, DIAGRAM_STATUSES, type DeleteResult, type DevModeState, type DevicePlatform, type DiagramStatus, type DiagramView, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, diagramAsText, diagramView, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, nestByMaster, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, plainTextOf, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, splitBlockSegments, switchTenant, tenantFromToken, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
package/dist/index.d.ts CHANGED
@@ -868,25 +868,6 @@ interface ChatState {
868
868
  /** Start a fresh empty chat without re-fetching history */
869
869
  newChat: () => void;
870
870
  }
871
- /**
872
- * Sentinel delimiters used to embed structured table data inside a flat
873
- * message string. UI layers split on these and render the contents with a
874
- * native table component instead of markdown tables — markdown tables look
875
- * terrible on narrow phone screens.
876
- *
877
- * Unicode Private Use Area chars (U+E100/U+E101) so they never collide with
878
- * anything the model could legitimately emit.
879
- */
880
- declare const TABLE_BLOCK_OPEN = "\uE100";
881
- declare const TABLE_BLOCK_CLOSE = "\uE101";
882
- /**
883
- * Extract display text from a conversation turn's assistant blocks.
884
- * Handles multiple block kinds (text, code, json, markdown, table, html).
885
- */
886
- declare function blocksToText(blocks?: Array<{
887
- kind: string;
888
- content: any;
889
- }>): string;
890
871
  declare const useChatStore: zustand.UseBoundStore<zustand.StoreApi<ChatState>>;
891
872
  /** What this client can execute, supplied by the host (see setClientDeclarationProvider). */
892
873
  type ClientDeclaration = {
@@ -905,6 +886,95 @@ declare function setClientDeclarationProvider(fn: (() => ClientDeclaration | nul
905
886
  /** Tear down the live connection (env/auth switch, SDK unmount). */
906
887
  declare function closeChatStream(): void;
907
888
 
889
+ /**
890
+ * What the phone's chat bubble is handed for a reply: the blocks of a conversation turn as ONE flat string, and that string
891
+ * split back into what the bubble draws. Pure and import-free, so a test runs it in node (it used to sit in store.ts).
892
+ *
893
+ * Nothing a reply holds is dropped. This file used to throw away every json and code block that sat beside a text block (a copy of
894
+ * the web chat's March rule), so a script, a command or a diagram under the answer never reached the person. Which raw data is
895
+ * shown CLOSED is Core's call, made once, at read (backend utils/blockDisplay.js marks it `meta.display: "folded"`); this file only
896
+ * carries that mark to the bubble: a marked block's text is wrapped in the DETAILS sentinels, and the bubble draws that segment as
897
+ * a closed "Details" row. It never decides what folds.
898
+ */
899
+ /**
900
+ * Sentinel delimiters used to embed structured table data inside a flat message string. UI layers split on these and render the
901
+ * contents with a native table component instead of markdown tables, which look terrible on narrow phone screens.
902
+ *
903
+ * Unicode Private Use Area chars so they never collide with anything the model could legitimately emit.
904
+ */
905
+ declare const TABLE_BLOCK_OPEN = "\uE100";
906
+ declare const TABLE_BLOCK_CLOSE = "\uE101";
907
+ /**
908
+ * The same, for a block Core marked folded: its text (already rendered to markdown) travels between these, percent-encoded so it
909
+ * can never hold a newline or a sentinel, and the bubble draws it closed under "Details".
910
+ */
911
+ declare const DETAILS_BLOCK_OPEN = "\uE102";
912
+ declare const DETAILS_BLOCK_CLOSE = "\uE103";
913
+ /**
914
+ * The same, for a `diagram` block: a straight list of numbered steps with arrows and a colour per status word. Its payload is the
915
+ * clean `DiagramView` (below) as percent-encoded JSON, and the bubble draws it with a native component.
916
+ */
917
+ declare const DIAGRAM_BLOCK_OPEN = "\uE104";
918
+ declare const DIAGRAM_BLOCK_CLOSE = "\uE105";
919
+ /** A block of a conversation turn, as /api/conversation serves it. */
920
+ interface ConversationBlock {
921
+ kind: string;
922
+ content?: any;
923
+ language?: string;
924
+ meta?: {
925
+ display?: string;
926
+ };
927
+ }
928
+ /**
929
+ * The status words a diagram step or badge may carry; none is neutral. The same four as Core's `DIAGRAM_STATUSES` (backend
930
+ * utils/blockShape.js) and the web's (apps/frontend chat/blocks/diagramView.js): a test on each side holds the list. Colours are
931
+ * this app's own; Core never sends one.
932
+ */
933
+ declare const DIAGRAM_STATUSES: readonly ["ok", "bad", "warn", "info"];
934
+ type DiagramStatus = (typeof DIAGRAM_STATUSES)[number];
935
+ interface DiagramView {
936
+ title: string;
937
+ steps: Array<{
938
+ title: string;
939
+ text: string;
940
+ status: DiagramStatus | '';
941
+ badges: Array<{
942
+ text: string;
943
+ status: DiagramStatus | '';
944
+ }>;
945
+ }>;
946
+ }
947
+ /**
948
+ * The diagram a block holds, ready to draw, every field text; null when there is nothing to draw (fewer than 2 steps). Core sends it
949
+ * clean (`diagramOf`); this is the phone's own net, so a field of the wrong type can never reach a native <Text>.
950
+ */
951
+ declare function diagramView(content: any): DiagramView | null;
952
+ /** A diagram as readable text, the same numbered list Core gives other channels (backend `diagramToText`). */
953
+ declare function diagramAsText(d: DiagramView): string;
954
+ /**
955
+ * Extract display text from a conversation turn's blocks. Handles multiple block kinds (text, code, json, markdown, table, html).
956
+ * Every block that holds something is in the result, in order; a block Core marked `meta.display: "folded"` is wrapped in the
957
+ * DETAILS sentinels so the bubble draws it closed.
958
+ */
959
+ declare function blocksToText(blocks?: ConversationBlock[]): string;
960
+ /** One piece of a flat message string, as the bubble draws it: markdown, a table payload, a diagram payload, or a closed "Details" payload. */
961
+ interface BlockSegment {
962
+ kind: 'md' | 'table' | 'details' | 'diagram';
963
+ /** md: the markdown. table / details / diagram: the still percent-encoded payload between the sentinels. */
964
+ content: string;
965
+ }
966
+ /**
967
+ * Split a flat message string on the table, details and diagram sentinels, in order. A string with none is one markdown segment. An
968
+ * unterminated marker is kept as markdown from the marker on, so nothing is lost.
969
+ */
970
+ declare function splitBlockSegments(content: string): BlockSegment[];
971
+ /**
972
+ * The flat content of a message as the person would read it: a table is its columns and rows as lines, and a "Details" payload is
973
+ * its text. What long-press copy and a screen reader are given; the raw string holds percent-encoded payloads between private-use
974
+ * characters, which nobody should hear or paste.
975
+ */
976
+ declare function plainTextOf(content: string): string;
977
+
908
978
  /** One attachment as `/api/chat` takes it: a stored file by hash, or small inline base64. */
909
979
  type WireAttachment = {
910
980
  hash: string;
@@ -1358,4 +1428,4 @@ interface AcsKvStorage {
1358
1428
  }
1359
1429
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1360
1430
 
1361
- export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BufferedCommand, type ChannelPrefs, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type DevicePlatform, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, nestByMaster, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
1431
+ export { type AcsArtifact, type AcsDeleteReason, type AcsEvent, type AcsKvStorage, type AcsPatchReason, type AcsReachabilityReporter, type AcsSurface, type AdasConfig, type AdasGateFlags, type AdasPhase, type AdasSession, type AdasUser, type AttachmentCache, type AttachmentPreview, type AuthSession, type AuthSessionDeps, type AuthSessionState, type BlockSegment, type BufferedCommand, type ChannelPrefs, type ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type ConversationBlock, DETAILS_BLOCK_CLOSE, DETAILS_BLOCK_OPEN, DIAGRAM_BLOCK_CLOSE, DIAGRAM_BLOCK_OPEN, DIAGRAM_STATUSES, type DeleteResult, type DevModeState, type DevicePlatform, type DiagramStatus, type DiagramView, type DispatchRow, type FileUploadRequest, type FileUploader, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, MAX_ATTACHMENT_BYTES, MAX_INLINE_ATTACHMENT_BYTES, type Message, type MessageAttachment, type NotifChannel, type NotifPrefs, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type QuietHoursPrefs, type RefreshOutcome, type RegisterDeviceResponse, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, type TelegramBotInfo, type TenantMembership, type TenantRow, type TokenProvider, type ToolCall, type UIAction, type UploadedArtifact, type WireAttachment, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, diagramAsText, diagramView, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, focusPlugin, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getPrefs as getNotifPrefs, getTelegramBotInfo as getNotifTelegramBotInfo, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, linkTelegram as linkNotifTelegram, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, nestByMaster, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, plainTextOf, pluginCommandEmitter, postCommandResult, prepareAttachments, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, registerHostIntent, registerDevice as registerPushDevice, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setPrefs as setNotifPrefs, setOrder, signInWithApple, signInWithGoogle, spacing, splitBlockSegments, switchTenant, tenantFromToken, unlinkChannel as unlinkNotifChannel, unregisterDevice as unregisterPushDevice, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
package/dist/index.js CHANGED
@@ -20,6 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ DETAILS_BLOCK_CLOSE: () => DETAILS_BLOCK_CLOSE,
24
+ DETAILS_BLOCK_OPEN: () => DETAILS_BLOCK_OPEN,
25
+ DIAGRAM_BLOCK_CLOSE: () => DIAGRAM_BLOCK_CLOSE,
26
+ DIAGRAM_BLOCK_OPEN: () => DIAGRAM_BLOCK_OPEN,
27
+ DIAGRAM_STATUSES: () => DIAGRAM_STATUSES,
23
28
  MAX_ATTACHMENT_BYTES: () => MAX_ATTACHMENT_BYTES,
24
29
  MAX_INLINE_ATTACHMENT_BYTES: () => MAX_INLINE_ATTACHMENT_BYTES,
25
30
  PluginCommandEmitter: () => PluginCommandEmitter,
@@ -39,6 +44,8 @@ __export(index_exports, {
39
44
  createPushRegistration: () => createPushRegistration,
40
45
  deleteArtifact: () => deleteArtifact,
41
46
  devModeFromCatalog: () => devModeFromCatalog,
47
+ diagramAsText: () => diagramAsText,
48
+ diagramView: () => diagramView,
42
49
  disconnectAcsWs: () => disconnectAcsWs,
43
50
  exchangeHandoff: () => exchangeHandoff,
44
51
  fetchConsumerConfig: () => fetchConsumerConfig,
@@ -80,6 +87,7 @@ __export(index_exports, {
80
87
  parseInviteCode: () => parseInviteCode,
81
88
  patchArtifact: () => patchArtifact,
82
89
  patchHomeAction: () => patchHomeAction,
90
+ plainTextOf: () => plainTextOf,
83
91
  pluginCommandEmitter: () => pluginCommandEmitter,
84
92
  postCommandResult: () => postCommandResult,
85
93
  prepareAttachments: () => prepareAttachments,
@@ -101,6 +109,7 @@ __export(index_exports, {
101
109
  signInWithApple: () => signInWithApple,
102
110
  signInWithGoogle: () => signInWithGoogle,
103
111
  spacing: () => spacing,
112
+ splitBlockSegments: () => splitBlockSegments,
104
113
  switchTenant: () => switchTenant,
105
114
  tenantFromToken: () => tenantFromToken,
106
115
  unlinkNotifChannel: () => unlinkChannel,
@@ -1564,6 +1573,164 @@ async function prepareAttachments(attachments, onProgress) {
1564
1573
  return out;
1565
1574
  }
1566
1575
 
1576
+ // src/chat/blockText.ts
1577
+ var TABLE_BLOCK_OPEN = "\uE100";
1578
+ var TABLE_BLOCK_CLOSE = "\uE101";
1579
+ var DETAILS_BLOCK_OPEN = "\uE102";
1580
+ var DETAILS_BLOCK_CLOSE = "\uE103";
1581
+ var DIAGRAM_BLOCK_OPEN = "\uE104";
1582
+ var DIAGRAM_BLOCK_CLOSE = "\uE105";
1583
+ var SENTINEL_CHARS = /[\uE100-\uE105]/g;
1584
+ var clean = (text) => text.replace(SENTINEL_CHARS, "");
1585
+ function renderTableShape(content) {
1586
+ if (!content || typeof content !== "object") return null;
1587
+ const cols = Array.isArray(content.columns) ? content.columns : null;
1588
+ const rows = Array.isArray(content.rows) ? content.rows : null;
1589
+ if (!cols || !rows) return null;
1590
+ const payload = encodeURIComponent(JSON.stringify({ columns: cols, rows }));
1591
+ return `${TABLE_BLOCK_OPEN}${payload}${TABLE_BLOCK_CLOSE}`;
1592
+ }
1593
+ var DIAGRAM_STATUSES = ["ok", "bad", "warn", "info"];
1594
+ var str = (v) => typeof v === "string" ? v : typeof v === "number" || typeof v === "boolean" ? String(v) : "";
1595
+ var statusOf = (v) => DIAGRAM_STATUSES.includes(v) ? v : "";
1596
+ function diagramView(content) {
1597
+ if (!content || typeof content !== "object" || !Array.isArray(content.steps)) return null;
1598
+ const steps = [];
1599
+ for (const s of content.steps) {
1600
+ if (!s || typeof s !== "object") continue;
1601
+ const title = str(s.title);
1602
+ const text = str(s.text);
1603
+ if (!title && !text) continue;
1604
+ const badges = [];
1605
+ for (const b of Array.isArray(s.badges) ? s.badges : []) {
1606
+ const bt = str(b && typeof b === "object" ? b.text : b);
1607
+ if (bt) badges.push({ text: bt, status: statusOf(b && b.status) });
1608
+ }
1609
+ steps.push({ title: title || text, text: title ? text : "", status: statusOf(s.status), badges });
1610
+ }
1611
+ return steps.length < 2 ? null : { title: str(content.title), steps };
1612
+ }
1613
+ function diagramAsText(d) {
1614
+ const lines = d.title ? [d.title] : [];
1615
+ d.steps.forEach((s, i) => {
1616
+ const badges = s.badges.length ? ` [${s.badges.map((b) => b.text).join(", ")}]` : "";
1617
+ lines.push(`${i + 1}. ${s.title}${s.text ? ` \u2014 ${s.text}` : ""}${badges}`);
1618
+ });
1619
+ return lines.join("\n");
1620
+ }
1621
+ function fence(code, language) {
1622
+ const longest = (code.match(/`+/g) || []).reduce((n, run) => Math.max(n, run.length), 0);
1623
+ const ticks = "`".repeat(Math.max(3, longest + 1));
1624
+ return `${ticks}${language}
1625
+ ${code}
1626
+ ${ticks}`;
1627
+ }
1628
+ function blockText(b) {
1629
+ if (b.kind === "text" || b.kind === "markdown" || b.kind === "description") {
1630
+ return typeof b.content === "string" ? clean(b.content) : "";
1631
+ }
1632
+ if (b.kind === "code") {
1633
+ const nested = b.content && typeof b.content === "object";
1634
+ const code = nested ? b.content.content : b.content;
1635
+ if (typeof code !== "string" || !code.trim()) return "";
1636
+ const lang = clean(String((nested ? b.content.language : b.language) || "").trim());
1637
+ return fence(clean(code), lang && lang.toLowerCase() !== "auto" ? lang : "");
1638
+ }
1639
+ if (b.kind === "table" && b.content && typeof b.content === "object") {
1640
+ const md = renderTableShape(b.content);
1641
+ if (md) return md;
1642
+ }
1643
+ if (b.kind === "diagram") {
1644
+ const view = diagramView(b.content);
1645
+ if (view) return `${DIAGRAM_BLOCK_OPEN}${encodeURIComponent(JSON.stringify(view))}${DIAGRAM_BLOCK_CLOSE}`;
1646
+ }
1647
+ if (b.kind === "json") {
1648
+ const md = renderTableShape(b.content);
1649
+ if (md) return md;
1650
+ const pretty = JSON.stringify(b.content, null, 2);
1651
+ return typeof pretty === "string" ? fence(clean(pretty), "json") : "";
1652
+ }
1653
+ if (b.kind === "html") {
1654
+ return typeof b.content === "string" ? clean(b.content) : "";
1655
+ }
1656
+ if (typeof b.content === "string") return clean(b.content);
1657
+ return b.content === void 0 ? "" : clean(JSON.stringify(b.content) ?? "");
1658
+ }
1659
+ function blocksToText(blocks) {
1660
+ if (!blocks || blocks.length === 0) return "";
1661
+ return blocks.map((b) => {
1662
+ if (!b || typeof b !== "object") return "";
1663
+ const text = blockText(b);
1664
+ if (!text) return "";
1665
+ if (text.startsWith(TABLE_BLOCK_OPEN) || text.startsWith(DIAGRAM_BLOCK_OPEN)) return text;
1666
+ return b.meta?.display === "folded" ? `${DETAILS_BLOCK_OPEN}${encodeURIComponent(text)}${DETAILS_BLOCK_CLOSE}` : text;
1667
+ }).filter(Boolean).join("\n\n");
1668
+ }
1669
+ var PAIRS = [
1670
+ { kind: "table", open: TABLE_BLOCK_OPEN, close: TABLE_BLOCK_CLOSE },
1671
+ { kind: "details", open: DETAILS_BLOCK_OPEN, close: DETAILS_BLOCK_CLOSE },
1672
+ { kind: "diagram", open: DIAGRAM_BLOCK_OPEN, close: DIAGRAM_BLOCK_CLOSE }
1673
+ ];
1674
+ function splitBlockSegments(content) {
1675
+ const segments = [];
1676
+ if (!content) return segments;
1677
+ let cursor = 0;
1678
+ while (cursor < content.length) {
1679
+ let found = null;
1680
+ for (const pair of PAIRS) {
1681
+ const index = content.indexOf(pair.open, cursor);
1682
+ if (index !== -1 && (!found || index < found.index)) found = { index, pair };
1683
+ }
1684
+ if (!found) {
1685
+ segments.push({ kind: "md", content: content.slice(cursor) });
1686
+ break;
1687
+ }
1688
+ if (found.index > cursor) {
1689
+ segments.push({ kind: "md", content: content.slice(cursor, found.index) });
1690
+ }
1691
+ const close = content.indexOf(found.pair.close, found.index + found.pair.open.length);
1692
+ if (close === -1) {
1693
+ segments.push({ kind: "md", content: content.slice(found.index) });
1694
+ break;
1695
+ }
1696
+ segments.push({ kind: found.pair.kind, content: content.slice(found.index + found.pair.open.length, close) });
1697
+ cursor = close + found.pair.close.length;
1698
+ }
1699
+ return segments;
1700
+ }
1701
+ function tableAsText(payload) {
1702
+ try {
1703
+ const data = JSON.parse(decodeURIComponent(payload));
1704
+ const cols = Array.isArray(data?.columns) ? data.columns : [];
1705
+ const rows = Array.isArray(data?.rows) ? data.rows : [];
1706
+ const cell = (v) => v == null ? "" : typeof v === "object" ? JSON.stringify(v) : String(v);
1707
+ const line = (cells) => (Array.isArray(cells) ? cells : [cells]).map(cell).join(" | ");
1708
+ return [line(cols), ...rows.map(line)].join("\n");
1709
+ } catch {
1710
+ return "";
1711
+ }
1712
+ }
1713
+ function plainTextOf(content) {
1714
+ if (!content) return "";
1715
+ return splitBlockSegments(content).map((seg) => {
1716
+ if (seg.kind === "md") return seg.content;
1717
+ if (seg.kind === "table") return tableAsText(seg.content);
1718
+ if (seg.kind === "diagram") {
1719
+ try {
1720
+ const view = diagramView(JSON.parse(decodeURIComponent(seg.content)));
1721
+ return view ? diagramAsText(view) : "";
1722
+ } catch {
1723
+ return "";
1724
+ }
1725
+ }
1726
+ try {
1727
+ return decodeURIComponent(seg.content);
1728
+ } catch {
1729
+ return seg.content;
1730
+ }
1731
+ }).join("");
1732
+ }
1733
+
1567
1734
  // src/chat/store.ts
1568
1735
  function coreHeaders() {
1569
1736
  const token = getToken();
@@ -1643,48 +1810,6 @@ function isTerminalSnapshot(snap) {
1643
1810
  if (extractPendingQuestion(snap)) return false;
1644
1811
  return snap?.done === true || isTerminalStatus(snap?.status);
1645
1812
  }
1646
- var TABLE_BLOCK_OPEN = "\uE100";
1647
- var TABLE_BLOCK_CLOSE = "\uE101";
1648
- function renderTableShape(content) {
1649
- if (!content || typeof content !== "object") return null;
1650
- const cols = Array.isArray(content.columns) ? content.columns : null;
1651
- const rows = Array.isArray(content.rows) ? content.rows : null;
1652
- if (!cols || !rows) return null;
1653
- const payload = encodeURIComponent(JSON.stringify({ columns: cols, rows }));
1654
- return `${TABLE_BLOCK_OPEN}${payload}${TABLE_BLOCK_CLOSE}`;
1655
- }
1656
- function blocksToText(blocks) {
1657
- if (!blocks || blocks.length === 0) return "";
1658
- const hasTextBlock = blocks.some(
1659
- (b) => b.kind === "text" || b.kind === "markdown" || b.kind === "description"
1660
- );
1661
- return blocks.map((b) => {
1662
- if ((b.kind === "json" || b.kind === "code") && hasTextBlock) return "";
1663
- if (b.kind === "text" || b.kind === "markdown" || b.kind === "description") {
1664
- return typeof b.content === "string" ? b.content : "";
1665
- }
1666
- if (b.kind === "code") {
1667
- const code = typeof b.content === "object" ? b.content.content : b.content;
1668
- return `\`\`\`
1669
- ${code}
1670
- \`\`\``;
1671
- }
1672
- if (b.kind === "table" && b.content && typeof b.content === "object") {
1673
- const md = renderTableShape(b.content);
1674
- if (md) return md;
1675
- }
1676
- if (b.kind === "json") {
1677
- if (b.content && typeof b.content === "object" && "pendingQuestion" in b.content) return "";
1678
- const md = renderTableShape(b.content);
1679
- if (md) return md;
1680
- return "```json\n" + JSON.stringify(b.content, null, 2) + "\n```";
1681
- }
1682
- if (b.kind === "html") {
1683
- return typeof b.content === "string" ? b.content : "";
1684
- }
1685
- return typeof b.content === "string" ? b.content : JSON.stringify(b.content);
1686
- }).filter(Boolean).join("\n\n");
1687
- }
1688
1813
  function blocksToAttachments(blocks) {
1689
1814
  if (!blocks || blocks.length === 0) return void 0;
1690
1815
  const atts = [];
@@ -2452,6 +2577,11 @@ var borderRadius = {
2452
2577
  };
2453
2578
  // Annotate the CommonJS export names for ESM import in node:
2454
2579
  0 && (module.exports = {
2580
+ DETAILS_BLOCK_CLOSE,
2581
+ DETAILS_BLOCK_OPEN,
2582
+ DIAGRAM_BLOCK_CLOSE,
2583
+ DIAGRAM_BLOCK_OPEN,
2584
+ DIAGRAM_STATUSES,
2455
2585
  MAX_ATTACHMENT_BYTES,
2456
2586
  MAX_INLINE_ATTACHMENT_BYTES,
2457
2587
  PluginCommandEmitter,
@@ -2471,6 +2601,8 @@ var borderRadius = {
2471
2601
  createPushRegistration,
2472
2602
  deleteArtifact,
2473
2603
  devModeFromCatalog,
2604
+ diagramAsText,
2605
+ diagramView,
2474
2606
  disconnectAcsWs,
2475
2607
  exchangeHandoff,
2476
2608
  fetchConsumerConfig,
@@ -2512,6 +2644,7 @@ var borderRadius = {
2512
2644
  parseInviteCode,
2513
2645
  patchArtifact,
2514
2646
  patchHomeAction,
2647
+ plainTextOf,
2515
2648
  pluginCommandEmitter,
2516
2649
  postCommandResult,
2517
2650
  prepareAttachments,
@@ -2533,6 +2666,7 @@ var borderRadius = {
2533
2666
  signInWithApple,
2534
2667
  signInWithGoogle,
2535
2668
  spacing,
2669
+ splitBlockSegments,
2536
2670
  switchTenant,
2537
2671
  tenantFromToken,
2538
2672
  unlinkNotifChannel,