@lasso-ai/cli 2.1.20 → 2.1.22
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/cli/bridge.js +10 -6
- package/dist/cli/project.js +1 -1
- package/dist/cli/runtime-client.d.ts +2 -0
- package/dist/cli/runtime-client.js +19 -3
- package/package.json +1 -1
package/dist/cli/bridge.js
CHANGED
|
@@ -408,12 +408,16 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
|
|
|
408
408
|
break;
|
|
409
409
|
}
|
|
410
410
|
case "error":
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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({
|
package/dist/cli/project.js
CHANGED
|
@@ -389,7 +389,7 @@ async function resolveWorkspaceConfig(fileEnv) {
|
|
|
389
389
|
*/
|
|
390
390
|
async function fetchModels(fileEnv) {
|
|
391
391
|
const serverUrl = (0, auth_1.serverUrlFrom)(fileEnv).replace(/\/$/, "");
|
|
392
|
-
const apiUrl = `${
|
|
392
|
+
const apiUrl = `${(0, auth_1.agentRuntimeUrlFrom)(fileEnv).replace(/\/$/, "")}/api/v1`;
|
|
393
393
|
// Pass the user's own provider keys (BYOK) so the server can list live
|
|
394
394
|
// models per provider instead of falling back to empty/static lists.
|
|
395
395
|
const envKey = (...names) => {
|
|
@@ -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
|
|
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
|
|
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
|
|
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