@ateam-ai-mobile/core 0.1.13 → 0.1.15

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
@@ -204,6 +204,11 @@ declare function devModeFromCatalog(catalog: any): DevModeState | null;
204
204
  /**
205
205
  * Read and switch dev mode — the same calls the web chat's chip makes
206
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.
207
212
  */
208
213
 
209
214
  /** The person's dev mode now, or null when Core offers them no mode switch. */
package/dist/index.d.ts CHANGED
@@ -204,6 +204,11 @@ declare function devModeFromCatalog(catalog: any): DevModeState | null;
204
204
  /**
205
205
  * Read and switch dev mode — the same calls the web chat's chip makes
206
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.
207
212
  */
208
213
 
209
214
  /** The person's dev mode now, or null when Core offers them no mode switch. */
package/dist/index.js CHANGED
@@ -309,12 +309,23 @@ function devModeFromCatalog(catalog) {
309
309
  // src/devMode.ts
310
310
  var SOLUTION_DEV_MODE = "SOLUTION_DEV_MODE";
311
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
+ }
312
323
  async function readDevMode() {
313
- const resp = await mcpToolCall("cp.fe_api", { method: "listCommands", params: {} });
324
+ const resp = await feApi("listCommands", {});
314
325
  return devModeFromCatalog(unwrapMcpResult(resp?.result));
315
326
  }
316
327
  async function setDevMode(on) {
317
- const resp = await mcpToolCall("cp.fe_api", { method: "setMode", params: { mode: on ? SOLUTION_DEV_MODE : NORMAL_USER_MODE } });
328
+ const resp = await feApi("setMode", { mode: on ? SOLUTION_DEV_MODE : NORMAL_USER_MODE });
318
329
  const out = unwrapMcpResult(resp?.result);
319
330
  if (out?.ok === false) throw new Error(out.error || "Could not change the mode");
320
331
  if (resp?.error) throw new Error(resp.error.message || "Could not change the mode");