capyai 0.3.6 → 0.3.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capyai",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "type": "module",
5
5
  "description": "Unofficial Capy.ai CLI for agent orchestration with quality gates",
6
6
  "bin": {
@@ -3,7 +3,7 @@ name: capy
3
3
  description: Orchestrate Capy.ai coding agents with quality gates. Delegate coding work, wait for completion, review quality, approve or retry.
4
4
  metadata:
5
5
  author: yazcaleb
6
- version: "0.3.6"
6
+ version: "0.3.7"
7
7
  ---
8
8
 
9
9
  # capy
package/src/api.ts CHANGED
@@ -34,15 +34,16 @@ async function rawRequest(apiKey: string, server: string, method: string, path:
34
34
  }
35
35
 
36
36
  const text = await res.text();
37
+ let data: any;
37
38
  try {
38
- const data = JSON.parse(text);
39
- if (data.error) {
40
- fail("api_error", `API error — ${data.error.message || data.error.code}`);
41
- }
42
- return data;
39
+ data = JSON.parse(text);
43
40
  } catch {
44
41
  fail("bad_response", `bad API response: ${text.slice(0, 200)}`);
45
42
  }
43
+ if (data.error) {
44
+ fail(data.error.code || "api_error", data.error.message || "unknown API error");
45
+ }
46
+ return data;
46
47
  }
47
48
 
48
49
  async function request(method: string, path: string, body?: unknown): Promise<any> {