@ateam-ai-mobile/core 0.1.29 → 0.1.31

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
@@ -654,7 +654,24 @@ interface TenantMembership {
654
654
  id: string;
655
655
  name: string;
656
656
  role: string | null;
657
+ /** Id of the cluster master this workspace sits under; set only when the person also has that master. */
658
+ master?: string;
657
659
  }
660
+ interface TenantRow {
661
+ tenant: TenantMembership;
662
+ /** 0 = top level, 1 = a cluster member shown under its master. */
663
+ depth: 0 | 1;
664
+ /** Last member of its master's group (draws the connector's end). */
665
+ last: boolean;
666
+ /** How many members this row is the master of. */
667
+ memberCount: number;
668
+ }
669
+ /**
670
+ * Order a membership list for display: cluster members sit right under their master, everything else keeps its
671
+ * order. Pure; every workspace appears exactly once, whatever the links (chains A>B>C all sit one level in).
672
+ * The same rule as the web switcher (WorkspaceSwitcher.jsx nestByMaster) so web and phone read the same.
673
+ */
674
+ declare function nestByMaster(tenants: TenantMembership[]): TenantRow[];
658
675
  /**
659
676
  * List the tenants the CURRENT user belongs to.
660
677
  *
@@ -859,6 +876,10 @@ declare class PluginCommandEmitter {
859
876
  /** App-wide bus for plugin commands arriving over the chat stream. */
860
877
  declare const pluginCommandEmitter: PluginCommandEmitter;
861
878
 
879
+ type Intent = (props: any) => void;
880
+ declare function registerHostIntent(pluginId: string, fn: Intent): void;
881
+ declare function focusPlugin(pluginId: string, props?: any): void;
882
+
862
883
  declare const colors: {
863
884
  readonly dark: {
864
885
  readonly bgPrimary: "#0a0e14";
@@ -1263,4 +1284,4 @@ interface AcsKvStorage {
1263
1284
  }
1264
1285
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1265
1286
 
1266
- 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 HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, 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 TokenProvider, type ToolCall, type UIAction, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, 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, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, 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 };
1287
+ 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 HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, 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 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, 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 };
package/dist/index.d.ts CHANGED
@@ -654,7 +654,24 @@ interface TenantMembership {
654
654
  id: string;
655
655
  name: string;
656
656
  role: string | null;
657
+ /** Id of the cluster master this workspace sits under; set only when the person also has that master. */
658
+ master?: string;
657
659
  }
660
+ interface TenantRow {
661
+ tenant: TenantMembership;
662
+ /** 0 = top level, 1 = a cluster member shown under its master. */
663
+ depth: 0 | 1;
664
+ /** Last member of its master's group (draws the connector's end). */
665
+ last: boolean;
666
+ /** How many members this row is the master of. */
667
+ memberCount: number;
668
+ }
669
+ /**
670
+ * Order a membership list for display: cluster members sit right under their master, everything else keeps its
671
+ * order. Pure; every workspace appears exactly once, whatever the links (chains A>B>C all sit one level in).
672
+ * The same rule as the web switcher (WorkspaceSwitcher.jsx nestByMaster) so web and phone read the same.
673
+ */
674
+ declare function nestByMaster(tenants: TenantMembership[]): TenantRow[];
658
675
  /**
659
676
  * List the tenants the CURRENT user belongs to.
660
677
  *
@@ -859,6 +876,10 @@ declare class PluginCommandEmitter {
859
876
  /** App-wide bus for plugin commands arriving over the chat stream. */
860
877
  declare const pluginCommandEmitter: PluginCommandEmitter;
861
878
 
879
+ type Intent = (props: any) => void;
880
+ declare function registerHostIntent(pluginId: string, fn: Intent): void;
881
+ declare function focusPlugin(pluginId: string, props?: any): void;
882
+
862
883
  declare const colors: {
863
884
  readonly dark: {
864
885
  readonly bgPrimary: "#0a0e14";
@@ -1263,4 +1284,4 @@ interface AcsKvStorage {
1263
1284
  }
1264
1285
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1265
1286
 
1266
- 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 HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, 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 TokenProvider, type ToolCall, type UIAction, type WorkspaceCapabilities, type WorkspaceSnapshot, type WorkspaceState, ada, apiFetch, apiFetchRaw, blocksToText, borderRadius, capabilityEnabled, closeChatStream, colors, connectAcsWs, connectorCall, createAuthSession, createPushRegistration, deleteArtifact, devModeFromCatalog, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, 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, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recentDispatches as recentNotifDispatches, recordEvent, refreshToken, 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 };
1287
+ 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 HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, 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 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, 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 };
package/dist/index.js CHANGED
@@ -40,6 +40,7 @@ __export(index_exports, {
40
40
  disconnectAcsWs: () => disconnectAcsWs,
41
41
  exchangeHandoff: () => exchangeHandoff,
42
42
  fetchConsumerConfig: () => fetchConsumerConfig,
43
+ focusPlugin: () => focusPlugin,
43
44
  fontSize: () => fontSize,
44
45
  getConfig: () => getConfig,
45
46
  getConsumerAuthApiUrl: () => getConsumerAuthApiUrl,
@@ -66,6 +67,7 @@ __export(index_exports, {
66
67
  listSurface: () => listSurface,
67
68
  mcpFetch: () => mcpFetch,
68
69
  mcpToolCall: () => mcpToolCall,
70
+ nestByMaster: () => nestByMaster,
69
71
  notifyAcsWsForeground: () => notifyAcsWsForeground,
70
72
  notifyAppForeground: () => notifyAppForeground,
71
73
  onAppForeground: () => onAppForeground,
@@ -83,6 +85,7 @@ __export(index_exports, {
83
85
  recentNotifDispatches: () => recentDispatches,
84
86
  recordEvent: () => recordEvent,
85
87
  refreshToken: () => refreshToken,
88
+ registerHostIntent: () => registerHostIntent,
86
89
  registerPushDevice: () => registerDevice,
87
90
  resolveAdasPhase: () => resolveAdasPhase,
88
91
  setAcsCacheStorage: () => setAcsCacheStorage,
@@ -1440,6 +1443,24 @@ var PluginCommandEmitter = class {
1440
1443
  };
1441
1444
  var pluginCommandEmitter = new PluginCommandEmitter();
1442
1445
 
1446
+ // src/utils/hostIntents.ts
1447
+ var intents = /* @__PURE__ */ new Map();
1448
+ function registerHostIntent(pluginId, fn) {
1449
+ intents.set(pluginId, fn);
1450
+ }
1451
+ function focusPlugin(pluginId, props) {
1452
+ const intent = intents.get(pluginId);
1453
+ if (intent) {
1454
+ try {
1455
+ intent(props && typeof props === "object" ? props : {});
1456
+ } catch (e) {
1457
+ console.warn(`[hostIntent] ${pluginId} failed:`, e?.message || e);
1458
+ }
1459
+ return;
1460
+ }
1461
+ pluginCommandEmitter.emit("focus-plugin", { pluginId, props });
1462
+ }
1463
+
1443
1464
  // src/chat/store.ts
1444
1465
  function coreHeaders() {
1445
1466
  const token = getToken();
@@ -1943,7 +1964,7 @@ function dispatchPluginCommands(cmds) {
1943
1964
  const pluginId = cmd?.pluginId || cmd?.plugin_id || cmd?.args?.plugin_id;
1944
1965
  if (pluginId) {
1945
1966
  const props = cmd?.props ?? cmd?.args?.props ?? void 0;
1946
- pluginCommandEmitter.emit("focus-plugin", { pluginId, props });
1967
+ focusPlugin(pluginId, props);
1947
1968
  }
1948
1969
  }
1949
1970
  }
@@ -2147,6 +2168,24 @@ async function pollJob(jobId, token) {
2147
2168
  }
2148
2169
 
2149
2170
  // src/api/tenants.ts
2171
+ function nestByMaster(tenants) {
2172
+ const ids = new Set(tenants.map((t) => t.id));
2173
+ const hasMaster = (t) => !!t.master && t.master !== t.id && ids.has(t.master);
2174
+ const kids = /* @__PURE__ */ new Map();
2175
+ for (const t of tenants) if (hasMaster(t)) kids.set(t.master, [...kids.get(t.master) || [], t]);
2176
+ const rows = [];
2177
+ const seen = /* @__PURE__ */ new Set();
2178
+ const add = (t, depth, last) => {
2179
+ if (seen.has(t.id)) return;
2180
+ seen.add(t.id);
2181
+ const k = kids.get(t.id) || [];
2182
+ rows.push({ tenant: t, depth, last, memberCount: k.length });
2183
+ k.forEach((m, i) => add(m, 1, i === k.length - 1));
2184
+ };
2185
+ for (const t of tenants) if (!hasMaster(t)) add(t, 0, false);
2186
+ for (const t of tenants) add(t, 0, false);
2187
+ return rows;
2188
+ }
2150
2189
  async function listMyTenants() {
2151
2190
  const token = getToken();
2152
2191
  if (!token) return [];
@@ -2161,7 +2200,8 @@ async function listMyTenants() {
2161
2200
  // Fall back to the id rather than to an empty string: a nameless row in
2162
2201
  // a team switcher is unpickable.
2163
2202
  name: t.name || t.id,
2164
- role: t.role ?? null
2203
+ role: t.role ?? null,
2204
+ ...typeof t.master === "string" && t.master ? { master: t.master } : {}
2165
2205
  }));
2166
2206
  } catch {
2167
2207
  return [];
@@ -2318,6 +2358,7 @@ var borderRadius = {
2318
2358
  disconnectAcsWs,
2319
2359
  exchangeHandoff,
2320
2360
  fetchConsumerConfig,
2361
+ focusPlugin,
2321
2362
  fontSize,
2322
2363
  getConfig,
2323
2364
  getConsumerAuthApiUrl,
@@ -2344,6 +2385,7 @@ var borderRadius = {
2344
2385
  listSurface,
2345
2386
  mcpFetch,
2346
2387
  mcpToolCall,
2388
+ nestByMaster,
2347
2389
  notifyAcsWsForeground,
2348
2390
  notifyAppForeground,
2349
2391
  onAppForeground,
@@ -2361,6 +2403,7 @@ var borderRadius = {
2361
2403
  recentNotifDispatches,
2362
2404
  recordEvent,
2363
2405
  refreshToken,
2406
+ registerHostIntent,
2364
2407
  registerPushDevice,
2365
2408
  resolveAdasPhase,
2366
2409
  setAcsCacheStorage,