@lasso-ai/cli 2.1.21 → 2.1.23

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.
@@ -408,12 +408,16 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
408
408
  break;
409
409
  }
410
410
  case "error":
411
- socket.send(JSON.stringify({
412
- type: "agent_status",
413
- taskId,
414
- status: "error",
415
- message: event.data.error || "Unknown error",
416
- }));
411
+ {
412
+ const data = event.data || {};
413
+ const detail = data.error || data.message || data.details;
414
+ socket.send(JSON.stringify({
415
+ type: "agent_status",
416
+ taskId,
417
+ status: "error",
418
+ message: typeof detail === "string" && detail.trim() ? detail : "The agent runtime failed without an error message.",
419
+ }));
420
+ }
417
421
  break;
418
422
  case "waiting_for_user":
419
423
  socket.send(JSON.stringify({
@@ -295,6 +295,8 @@ export declare class RuntimeClient {
295
295
  */
296
296
  private localReviewCache;
297
297
  constructor(serverUrl: string, apiKey?: string);
298
+ /** Preserve the server's actionable error instead of exposing only `Forbidden`. */
299
+ private static responseError;
298
300
  /**
299
301
  * Create a new runtime session
300
302
  */
@@ -28,6 +28,22 @@ class RuntimeClient {
28
28
  this.serverUrl = serverUrl;
29
29
  this.apiKey = apiKey;
30
30
  }
31
+ /** Preserve the server's actionable error instead of exposing only `Forbidden`. */
32
+ static async responseError(response, fallback) {
33
+ const body = await response.text().catch(() => "");
34
+ if (body) {
35
+ try {
36
+ const payload = JSON.parse(body);
37
+ const message = payload.error || payload.message;
38
+ if (message)
39
+ return new Error(message);
40
+ }
41
+ catch {
42
+ // Fall through to the HTTP status when the response is not JSON.
43
+ }
44
+ }
45
+ return new Error(`${fallback} (${response.status})`);
46
+ }
31
47
  /**
32
48
  * Create a new runtime session
33
49
  */
@@ -41,7 +57,7 @@ class RuntimeClient {
41
57
  body: JSON.stringify(input),
42
58
  });
43
59
  if (!response.ok) {
44
- throw new Error(`Failed to create session: ${response.statusText}`);
60
+ throw await RuntimeClient.responseError(response, "Failed to create session");
45
61
  }
46
62
  const data = await response.json();
47
63
  return data;
@@ -57,7 +73,7 @@ class RuntimeClient {
57
73
  },
58
74
  });
59
75
  if (!response.ok) {
60
- throw new Error(`Failed to get session: ${response.statusText}`);
76
+ throw await RuntimeClient.responseError(response, "Failed to get session");
61
77
  }
62
78
  const data = (await response.json());
63
79
  const local = this.localReviewCache.get(sessionId);
@@ -138,7 +154,7 @@ class RuntimeClient {
138
154
  signal,
139
155
  });
140
156
  if (!response.ok) {
141
- throw new Error(`Failed to run session: ${response.statusText}`);
157
+ throw await RuntimeClient.responseError(response, "Failed to run session");
142
158
  }
143
159
  reader = response.body?.getReader();
144
160
  if (!reader) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lasso-ai/cli",
3
- "version": "2.1.21",
3
+ "version": "2.1.23",
4
4
  "description": "Select any part of your running app, describe a change, and let AI edit the real source code.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cli/index.js",