@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.mjs CHANGED
@@ -191,6 +191,44 @@ function unwrapMcpResult(result) {
191
191
  }
192
192
  }
193
193
 
194
+ // src/devModeState.ts
195
+ function devModeFromCatalog(catalog) {
196
+ const entry = Array.isArray(catalog?.commands) ? catalog.commands.find((c) => c?.command === "mode") : null;
197
+ if (!entry) return null;
198
+ const active = entry.state?.active === true;
199
+ return {
200
+ available: entry.available !== false,
201
+ active,
202
+ expiresAt: active && typeof entry.state?.expires_at === "string" ? entry.state.expires_at : null
203
+ };
204
+ }
205
+
206
+ // src/devMode.ts
207
+ var SOLUTION_DEV_MODE = "SOLUTION_DEV_MODE";
208
+ var NORMAL_USER_MODE = "NORMAL_USER_MODE";
209
+ function feApi(method, params) {
210
+ return apiFetch("/mcp", {
211
+ method: "POST",
212
+ body: JSON.stringify({
213
+ jsonrpc: "2.0",
214
+ id: Date.now(),
215
+ method: "tools/call",
216
+ params: { name: "cp.fe_api", arguments: { method, params } }
217
+ })
218
+ });
219
+ }
220
+ async function readDevMode() {
221
+ const resp = await feApi("listCommands", {});
222
+ return devModeFromCatalog(unwrapMcpResult(resp?.result));
223
+ }
224
+ async function setDevMode(on) {
225
+ const resp = await feApi("setMode", { mode: on ? SOLUTION_DEV_MODE : NORMAL_USER_MODE });
226
+ const out = unwrapMcpResult(resp?.result);
227
+ if (out?.ok === false) throw new Error(out.error || "Could not change the mode");
228
+ if (resp?.error) throw new Error(resp.error.message || "Could not change the mode");
229
+ return devModeFromCatalog(out);
230
+ }
231
+
194
232
  // src/session.ts
195
233
  function hostOf(u) {
196
234
  if (!u) return "";
@@ -2100,6 +2138,7 @@ export {
2100
2138
  createAuthSession,
2101
2139
  createPushRegistration,
2102
2140
  deleteArtifact,
2141
+ devModeFromCatalog,
2103
2142
  disconnectAcsWs,
2104
2143
  exchangeHandoff,
2105
2144
  fetchConsumerConfig,
@@ -2139,12 +2178,14 @@ export {
2139
2178
  pluginCommandEmitter,
2140
2179
  postCommandResult,
2141
2180
  previewInvite,
2181
+ readDevMode,
2142
2182
  recordEvent,
2143
2183
  refreshToken,
2144
2184
  resolveAdasPhase,
2145
2185
  setAcsCacheStorage,
2146
2186
  setAcsReachabilityReporter,
2147
2187
  setClientDeclarationProvider,
2188
+ setDevMode,
2148
2189
  setHomeActionOrder,
2149
2190
  setOrder,
2150
2191
  signInWithApple,