@ateam-ai-mobile/core 0.1.12 → 0.1.14

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
@@ -181,6 +181,41 @@ declare function postCommandResult(correlationId: string, result: any, error?: s
181
181
  */
182
182
  declare function unwrapMcpResult(result: any): any;
183
183
 
184
+ /**
185
+ * Dev mode, as the server's command catalog states it — pure, no I/O.
186
+ *
187
+ * Dev mode (SOLUTION_DEV_MODE) is ONE per-person switch kept by Core: the web
188
+ * chat's chip, `/mode dev` in any chat and this SDK's chip all set the same
189
+ * row, and voice routes by it too. The app never stores it: it reads the
190
+ * catalog Core serves (cp.fe_api listCommands / setMode), the same one the
191
+ * "/" menu reads, so the chip and the menu cannot disagree.
192
+ */
193
+ interface DevModeState {
194
+ /** The person may switch it (tenant admins and owners); else the chip is not shown. */
195
+ available: boolean;
196
+ /** Dev mode is on now. */
197
+ active: boolean;
198
+ /** When it ends (ISO), while on. */
199
+ expiresAt: string | null;
200
+ }
201
+ /** The "mode" entry of a command catalog, or null when the catalog offers none. */
202
+ declare function devModeFromCatalog(catalog: any): DevModeState | null;
203
+
204
+ /**
205
+ * Read and switch dev mode — the same calls the web chat's chip makes
206
+ * (cp.fe_api listCommands / setMode). Eligibility and storage stay in Core.
207
+ *
208
+ * Through apiFetch, not mcpToolCall: the chip polls for as long as a screen is
209
+ * open, and apiFetch refreshes an expired token on a 401 (mcpFetch does not),
210
+ * so the chip neither freezes on a stale state nor fails a tap after the token
211
+ * runs out.
212
+ */
213
+
214
+ /** The person's dev mode now, or null when Core offers them no mode switch. */
215
+ declare function readDevMode(): Promise<DevModeState | null>;
216
+ /** Turn dev mode on (for the longest time Core allows) or off; answers the new state. */
217
+ declare function setDevMode(on: boolean): Promise<DevModeState | null>;
218
+
184
219
  type SessionEnv = 'dev' | 'prod';
185
220
  interface Session {
186
221
  /** Tenant slug the app is actually scoped to (getTenant = signed-in tenant,
@@ -1154,4 +1189,4 @@ interface AcsKvStorage {
1154
1189
  }
1155
1190
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1156
1191
 
1157
- 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 ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type RefreshOutcome, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, 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, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, recordEvent, refreshToken, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setHomeActionOrder, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
1192
+ 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 ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type RefreshOutcome, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, 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, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recordEvent, refreshToken, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
package/dist/index.d.ts CHANGED
@@ -181,6 +181,41 @@ declare function postCommandResult(correlationId: string, result: any, error?: s
181
181
  */
182
182
  declare function unwrapMcpResult(result: any): any;
183
183
 
184
+ /**
185
+ * Dev mode, as the server's command catalog states it — pure, no I/O.
186
+ *
187
+ * Dev mode (SOLUTION_DEV_MODE) is ONE per-person switch kept by Core: the web
188
+ * chat's chip, `/mode dev` in any chat and this SDK's chip all set the same
189
+ * row, and voice routes by it too. The app never stores it: it reads the
190
+ * catalog Core serves (cp.fe_api listCommands / setMode), the same one the
191
+ * "/" menu reads, so the chip and the menu cannot disagree.
192
+ */
193
+ interface DevModeState {
194
+ /** The person may switch it (tenant admins and owners); else the chip is not shown. */
195
+ available: boolean;
196
+ /** Dev mode is on now. */
197
+ active: boolean;
198
+ /** When it ends (ISO), while on. */
199
+ expiresAt: string | null;
200
+ }
201
+ /** The "mode" entry of a command catalog, or null when the catalog offers none. */
202
+ declare function devModeFromCatalog(catalog: any): DevModeState | null;
203
+
204
+ /**
205
+ * Read and switch dev mode — the same calls the web chat's chip makes
206
+ * (cp.fe_api listCommands / setMode). Eligibility and storage stay in Core.
207
+ *
208
+ * Through apiFetch, not mcpToolCall: the chip polls for as long as a screen is
209
+ * open, and apiFetch refreshes an expired token on a 401 (mcpFetch does not),
210
+ * so the chip neither freezes on a stale state nor fails a tap after the token
211
+ * runs out.
212
+ */
213
+
214
+ /** The person's dev mode now, or null when Core offers them no mode switch. */
215
+ declare function readDevMode(): Promise<DevModeState | null>;
216
+ /** Turn dev mode on (for the longest time Core allows) or off; answers the new state. */
217
+ declare function setDevMode(on: boolean): Promise<DevModeState | null>;
218
+
184
219
  type SessionEnv = 'dev' | 'prod';
185
220
  interface Session {
186
221
  /** Tenant slug the app is actually scoped to (getTenant = signed-in tenant,
@@ -1154,4 +1189,4 @@ interface AcsKvStorage {
1154
1189
  }
1155
1190
  declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
1156
1191
 
1157
- 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 ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type RefreshOutcome, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, 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, disconnectAcsWs, exchangeHandoff, fetchConsumerConfig, fontSize, getConfig, getConsumerAuthApiUrl, getCoreApiUrl, getCoreWsUrl, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, recordEvent, refreshToken, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setHomeActionOrder, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
1192
+ 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 ConsumerCapabilityConfig, type ConsumerProviderConfig, type ConsumerSignInResult, type DeleteResult, type DevModeState, type HandoffExchangeResult, type HomeAction, type HomeActionLeaf, type HomeActionReason, type InvitePreview, type JobProgress, type Message, type MessageAttachment, type OtpStartResult, type OutgoingAttachment, type PatchResult, PluginCommandEmitter, type PushBackend, type PushRegistration, type RefreshOutcome, type Session, type SessionEnv, type SessionPersistence, type SessionStatus, type SessionUser, TABLE_BLOCK_CLOSE, TABLE_BLOCK_OPEN, 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, getSession, getTenant, getToken, getUser, getVoiceApiUrl, initAdas, isAdasInitialized, isDevHost, joinWithApple, joinWithGoogle, linkChannelStart, linkChannelVerify, listHomeActions, listMadeForYou, listMyTenants, listSurface, mcpFetch, mcpToolCall, notifyAcsWsForeground, notifyAppForeground, onAppForeground, openJoinWithApple, openJoinWithGoogle, parseDeepLinkParam, parseHandoffCode, parseInviteCode, patchArtifact, patchHomeAction, pluginCommandEmitter, postCommandResult, previewInvite, readDevMode, recordEvent, refreshToken, resolveAdasPhase, setAcsCacheStorage, setAcsReachabilityReporter, setClientDeclarationProvider, setDevMode, setHomeActionOrder, setOrder, signInWithApple, signInWithGoogle, spacing, switchTenant, tenantFromToken, unwrapMcpResult, useCapability, useChatStore, useHomeActionsStore, useWidgetsStore, useWorkspaceStore, userFromJwt };
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  createAuthSession: () => createAuthSession,
37
37
  createPushRegistration: () => createPushRegistration,
38
38
  deleteArtifact: () => deleteArtifact,
39
+ devModeFromCatalog: () => devModeFromCatalog,
39
40
  disconnectAcsWs: () => disconnectAcsWs,
40
41
  exchangeHandoff: () => exchangeHandoff,
41
42
  fetchConsumerConfig: () => fetchConsumerConfig,
@@ -75,12 +76,14 @@ __export(index_exports, {
75
76
  pluginCommandEmitter: () => pluginCommandEmitter,
76
77
  postCommandResult: () => postCommandResult,
77
78
  previewInvite: () => previewInvite,
79
+ readDevMode: () => readDevMode,
78
80
  recordEvent: () => recordEvent,
79
81
  refreshToken: () => refreshToken,
80
82
  resolveAdasPhase: () => resolveAdasPhase,
81
83
  setAcsCacheStorage: () => setAcsCacheStorage,
82
84
  setAcsReachabilityReporter: () => setAcsReachabilityReporter,
83
85
  setClientDeclarationProvider: () => setClientDeclarationProvider,
86
+ setDevMode: () => setDevMode,
84
87
  setHomeActionOrder: () => setHomeActionOrder,
85
88
  setOrder: () => setOrder,
86
89
  signInWithApple: () => signInWithApple,
@@ -291,6 +294,44 @@ function unwrapMcpResult(result) {
291
294
  }
292
295
  }
293
296
 
297
+ // src/devModeState.ts
298
+ function devModeFromCatalog(catalog) {
299
+ const entry = Array.isArray(catalog?.commands) ? catalog.commands.find((c) => c?.command === "mode") : null;
300
+ if (!entry) return null;
301
+ const active = entry.state?.active === true;
302
+ return {
303
+ available: entry.available !== false,
304
+ active,
305
+ expiresAt: active && typeof entry.state?.expires_at === "string" ? entry.state.expires_at : null
306
+ };
307
+ }
308
+
309
+ // src/devMode.ts
310
+ var SOLUTION_DEV_MODE = "SOLUTION_DEV_MODE";
311
+ var NORMAL_USER_MODE = "NORMAL_USER_MODE";
312
+ function feApi(method, params) {
313
+ return apiFetch("/mcp", {
314
+ method: "POST",
315
+ body: JSON.stringify({
316
+ jsonrpc: "2.0",
317
+ id: Date.now(),
318
+ method: "tools/call",
319
+ params: { name: "cp.fe_api", arguments: { method, params } }
320
+ })
321
+ });
322
+ }
323
+ async function readDevMode() {
324
+ const resp = await feApi("listCommands", {});
325
+ return devModeFromCatalog(unwrapMcpResult(resp?.result));
326
+ }
327
+ async function setDevMode(on) {
328
+ const resp = await feApi("setMode", { mode: on ? SOLUTION_DEV_MODE : NORMAL_USER_MODE });
329
+ const out = unwrapMcpResult(resp?.result);
330
+ if (out?.ok === false) throw new Error(out.error || "Could not change the mode");
331
+ if (resp?.error) throw new Error(resp.error.message || "Could not change the mode");
332
+ return devModeFromCatalog(out);
333
+ }
334
+
294
335
  // src/session.ts
295
336
  function hostOf(u) {
296
337
  if (!u) return "";
@@ -2201,6 +2242,7 @@ var borderRadius = {
2201
2242
  createAuthSession,
2202
2243
  createPushRegistration,
2203
2244
  deleteArtifact,
2245
+ devModeFromCatalog,
2204
2246
  disconnectAcsWs,
2205
2247
  exchangeHandoff,
2206
2248
  fetchConsumerConfig,
@@ -2240,12 +2282,14 @@ var borderRadius = {
2240
2282
  pluginCommandEmitter,
2241
2283
  postCommandResult,
2242
2284
  previewInvite,
2285
+ readDevMode,
2243
2286
  recordEvent,
2244
2287
  refreshToken,
2245
2288
  resolveAdasPhase,
2246
2289
  setAcsCacheStorage,
2247
2290
  setAcsReachabilityReporter,
2248
2291
  setClientDeclarationProvider,
2292
+ setDevMode,
2249
2293
  setHomeActionOrder,
2250
2294
  setOrder,
2251
2295
  signInWithApple,