@base44-preview/cli 0.0.19-pr.112.10b56a5 → 0.0.19-pr.112.6a4374a

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.
Files changed (2) hide show
  1. package/dist/index.js +15 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7899,6 +7899,15 @@ var AuthValidationError = class extends Error {
7899
7899
  this.name = "AuthValidationError";
7900
7900
  }
7901
7901
  };
7902
+ /**
7903
+ * Formats an API error response into a human-readable string.
7904
+ * Prefers `message` (human-readable) over `detail`.
7905
+ */
7906
+ function formatApiError(errorJson) {
7907
+ const error = errorJson;
7908
+ const content = error?.message ?? error?.detail ?? errorJson;
7909
+ return typeof content === "string" ? content : JSON.stringify(content, null, 2);
7910
+ }
7902
7911
 
7903
7912
  //#endregion
7904
7913
  //#region src/core/consts.ts
@@ -16562,8 +16571,8 @@ async function syncEntities(entities) {
16562
16571
  });
16563
16572
  if (!response.ok) {
16564
16573
  const errorJson = await response.json();
16565
- if (response.status === 428) throw new Error(`Failed to delete entity: ${errorJson.message}`);
16566
- throw new Error(`Error occurred while syncing entities ${errorJson.message}`);
16574
+ if (response.status === 428) throw new Error(`Failed to delete entity: ${formatApiError(errorJson)}`);
16575
+ throw new Error(`Error occurred while syncing entities: ${formatApiError(errorJson)}`);
16567
16576
  }
16568
16577
  return SyncEntitiesResponseSchema.parse(await response.json());
16569
16578
  }
@@ -16769,21 +16778,20 @@ async function writeAgents(agentsDir, agents) {
16769
16778
  //#region src/core/resources/agent/api.ts
16770
16779
  async function pushAgents(agents) {
16771
16780
  const appClient = getAppClient();
16772
- const payload = { configs: agents.map((agent) => ({
16781
+ const payload = agents.map((agent) => ({
16773
16782
  name: agent.name,
16774
16783
  description: agent.description,
16775
16784
  instructions: agent.instructions,
16776
16785
  tool_configs: agent.tool_configs,
16777
16786
  whatsapp_greeting: agent.whatsapp_greeting ?? null
16778
- })) };
16787
+ }));
16779
16788
  const response = await appClient.put("agent-configs", {
16780
16789
  json: payload,
16781
16790
  throwHttpErrors: false
16782
16791
  });
16783
16792
  if (!response.ok) {
16784
16793
  const errorJson = await response.json();
16785
- const errorMessage = errorJson.detail || errorJson.message || "Unknown error";
16786
- throw new Error(`Error occurred while syncing agents: ${errorMessage}`);
16794
+ throw new Error(`Error occurred while syncing agents: ${formatApiError(errorJson)}`);
16787
16795
  }
16788
16796
  return SyncAgentsResponseSchema.parse(await response.json());
16789
16797
  }
@@ -16791,8 +16799,7 @@ async function fetchAgents() {
16791
16799
  const response = await getAppClient().get("agent-configs", { throwHttpErrors: false });
16792
16800
  if (!response.ok) {
16793
16801
  const errorJson = await response.json();
16794
- const errorMessage = errorJson.detail || errorJson.message || "Unknown error";
16795
- throw new Error(`Error occurred while fetching agents: ${errorMessage}`);
16802
+ throw new Error(`Error occurred while fetching agents: ${formatApiError(errorJson)}`);
16796
16803
  }
16797
16804
  return ListAgentsResponseSchema.parse(await response.json());
16798
16805
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.19-pr.112.10b56a5",
3
+ "version": "0.0.19-pr.112.6a4374a",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "bin": {