@ateam-ai-mobile/core 0.1.12 → 0.1.13
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 +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/devMode.ts +25 -0
- package/src/devModeState.ts +32 -0
- package/src/index.ts +5 -0
package/dist/index.d.mts
CHANGED
|
@@ -181,6 +181,36 @@ 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
|
+
|
|
209
|
+
/** The person's dev mode now, or null when Core offers them no mode switch. */
|
|
210
|
+
declare function readDevMode(): Promise<DevModeState | null>;
|
|
211
|
+
/** Turn dev mode on (for the longest time Core allows) or off; answers the new state. */
|
|
212
|
+
declare function setDevMode(on: boolean): Promise<DevModeState | null>;
|
|
213
|
+
|
|
184
214
|
type SessionEnv = 'dev' | 'prod';
|
|
185
215
|
interface Session {
|
|
186
216
|
/** Tenant slug the app is actually scoped to (getTenant = signed-in tenant,
|
|
@@ -1154,4 +1184,4 @@ interface AcsKvStorage {
|
|
|
1154
1184
|
}
|
|
1155
1185
|
declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
|
|
1156
1186
|
|
|
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 };
|
|
1187
|
+
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,36 @@ 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
|
+
|
|
209
|
+
/** The person's dev mode now, or null when Core offers them no mode switch. */
|
|
210
|
+
declare function readDevMode(): Promise<DevModeState | null>;
|
|
211
|
+
/** Turn dev mode on (for the longest time Core allows) or off; answers the new state. */
|
|
212
|
+
declare function setDevMode(on: boolean): Promise<DevModeState | null>;
|
|
213
|
+
|
|
184
214
|
type SessionEnv = 'dev' | 'prod';
|
|
185
215
|
interface Session {
|
|
186
216
|
/** Tenant slug the app is actually scoped to (getTenant = signed-in tenant,
|
|
@@ -1154,4 +1184,4 @@ interface AcsKvStorage {
|
|
|
1154
1184
|
}
|
|
1155
1185
|
declare function setAcsCacheStorage(kv: AcsKvStorage | null): void;
|
|
1156
1186
|
|
|
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 };
|
|
1187
|
+
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,33 @@ 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
|
+
async function readDevMode() {
|
|
313
|
+
const resp = await mcpToolCall("cp.fe_api", { method: "listCommands", params: {} });
|
|
314
|
+
return devModeFromCatalog(unwrapMcpResult(resp?.result));
|
|
315
|
+
}
|
|
316
|
+
async function setDevMode(on) {
|
|
317
|
+
const resp = await mcpToolCall("cp.fe_api", { method: "setMode", params: { mode: on ? SOLUTION_DEV_MODE : NORMAL_USER_MODE } });
|
|
318
|
+
const out = unwrapMcpResult(resp?.result);
|
|
319
|
+
if (out?.ok === false) throw new Error(out.error || "Could not change the mode");
|
|
320
|
+
if (resp?.error) throw new Error(resp.error.message || "Could not change the mode");
|
|
321
|
+
return devModeFromCatalog(out);
|
|
322
|
+
}
|
|
323
|
+
|
|
294
324
|
// src/session.ts
|
|
295
325
|
function hostOf(u) {
|
|
296
326
|
if (!u) return "";
|
|
@@ -2201,6 +2231,7 @@ var borderRadius = {
|
|
|
2201
2231
|
createAuthSession,
|
|
2202
2232
|
createPushRegistration,
|
|
2203
2233
|
deleteArtifact,
|
|
2234
|
+
devModeFromCatalog,
|
|
2204
2235
|
disconnectAcsWs,
|
|
2205
2236
|
exchangeHandoff,
|
|
2206
2237
|
fetchConsumerConfig,
|
|
@@ -2240,12 +2271,14 @@ var borderRadius = {
|
|
|
2240
2271
|
pluginCommandEmitter,
|
|
2241
2272
|
postCommandResult,
|
|
2242
2273
|
previewInvite,
|
|
2274
|
+
readDevMode,
|
|
2243
2275
|
recordEvent,
|
|
2244
2276
|
refreshToken,
|
|
2245
2277
|
resolveAdasPhase,
|
|
2246
2278
|
setAcsCacheStorage,
|
|
2247
2279
|
setAcsReachabilityReporter,
|
|
2248
2280
|
setClientDeclarationProvider,
|
|
2281
|
+
setDevMode,
|
|
2249
2282
|
setHomeActionOrder,
|
|
2250
2283
|
setOrder,
|
|
2251
2284
|
signInWithApple,
|