cascade-ai 0.48.0 → 0.48.1

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/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  [![npm](https://img.shields.io/npm/v/cascade-ai?color=aaff00&label=npm)](https://www.npmjs.com/package/cascade-ai)
7
7
  [![license](https://img.shields.io/badge/license-MIT-aaff00.svg)](LICENSE)
8
- [![node](https://img.shields.io/badge/node-%E2%89%A520-5AB4E8.svg)](#installation)
8
+ [![node](https://img.shields.io/badge/node-%E2%89%A522-5AB4E8.svg)](#installation)
9
9
  [![providers](https://img.shields.io/badge/providers-6-a78bff.svg)](#ai-providers)
10
10
  [![PRs welcome](https://img.shields.io/badge/PRs-welcome-f5a623.svg)](CONTRIBUTING.md)
11
11
 
@@ -227,7 +227,7 @@ User prompt
227
227
  npm install -g cascade-ai
228
228
  ```
229
229
 
230
- > Requires **Node.js ≥ 20**.
230
+ > Requires **Node.js ≥ 22**.
231
231
 
232
232
  ---
233
233
 
@@ -797,7 +797,7 @@ web/
797
797
 
798
798
  | Tool | Required Version |
799
799
  |------|-----------------|
800
- | Node.js | ≥ 20.x |
800
+ | Node.js | ≥ 22.x |
801
801
  | npm | ≥ 10.x |
802
802
 
803
803
  ### Setup
package/dist/cli.cjs CHANGED
@@ -116,7 +116,7 @@ var __export = (target, all) => {
116
116
  var CASCADE_VERSION, CASCADE_CONFIG_FILE, CASCADE_DB_FILE, CASCADE_DASHBOARD_SECRET_FILE, GLOBAL_CONFIG_DIR, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_CREDENTIALS_FILE, GLOBAL_RUNTIME_DB_FILE, DEFAULT_DASHBOARD_PORT, DEFAULT_CONTEXT_LIMIT, DEFAULT_AUTO_SUMMARIZE_AT, MODELS, T1_MODEL_PRIORITY, T2_MODEL_PRIORITY, T3_MODEL_PRIORITY, VISION_MODEL_PRIORITY, COMPLEXITY_T2_COUNT, THEME_NAMES, DEFAULT_THEME, OLLAMA_BASE_URL, LM_STUDIO_BASE_URL, AZURE_BASE_URL_TEMPLATE, TOOL_NAMES, DEFAULT_APPROVAL_REQUIRED;
117
117
  var init_constants = __esm({
118
118
  "src/constants.ts"() {
119
- CASCADE_VERSION = "0.48.0";
119
+ CASCADE_VERSION = "0.48.1";
120
120
  CASCADE_CONFIG_FILE = ".cascade/config.json";
121
121
  CASCADE_DB_FILE = ".cascade/memory.db";
122
122
  CASCADE_DASHBOARD_SECRET_FILE = ".cascade/dashboard-secret";
@@ -14669,12 +14669,19 @@ var CloudClient = class _CloudClient {
14669
14669
  );
14670
14670
  await openUrl(authorizeUrl);
14671
14671
  const code = await listener.waitForCode;
14672
- const res = await fetch(this.url("/api/native/token"), {
14673
- method: "POST",
14674
- headers: { "Content-Type": "application/json" },
14675
- body: JSON.stringify({ code, code_verifier: verifier })
14676
- });
14677
- if (!res.ok) throw new Error("Sign-in could not be completed. Please try again.");
14672
+ let res;
14673
+ try {
14674
+ res = await fetch(this.url("/api/native/token"), {
14675
+ method: "POST",
14676
+ headers: { "Content-Type": "application/json" },
14677
+ body: JSON.stringify({ code, code_verifier: verifier })
14678
+ });
14679
+ } catch (err) {
14680
+ throw new Error(
14681
+ `Signed in, but could not reach Cascade at ${this.serverUrl} to finish. Check your connection and that the server URL is correct. (${err instanceof Error ? err.message : String(err)})`
14682
+ );
14683
+ }
14684
+ if (!res.ok) throw new Error(await loginFailureMessage(res, this.serverUrl));
14678
14685
  const tokens = await res.json();
14679
14686
  return await this.finishLogin(tokens);
14680
14687
  } finally {
@@ -14848,6 +14855,22 @@ function sleep(ms, signal) {
14848
14855
  }, { once: true });
14849
14856
  });
14850
14857
  }
14858
+ async function loginFailureMessage(res, serverUrl) {
14859
+ const body = await res.text().catch(() => "");
14860
+ let apiError = "";
14861
+ try {
14862
+ apiError = String(JSON.parse(body).error ?? "");
14863
+ } catch {
14864
+ }
14865
+ if (apiError === "invalid_grant") {
14866
+ return "Sign-in expired before it completed \u2014 the code is single-use and short-lived, and restarting the server during sign-in also invalidates it. Please try again.";
14867
+ }
14868
+ if (apiError) return `Sign-in failed: ${apiError} (HTTP ${res.status}).`;
14869
+ if (res.status === 404 || /<html/i.test(body)) {
14870
+ return `Signed in, but ${serverUrl} did not answer the Cascade API (HTTP ${res.status}). If this host was recently pointed at a new server, DNS may still be propagating.`;
14871
+ }
14872
+ return `Sign-in could not be completed (HTTP ${res.status}). Please try again.`;
14873
+ }
14851
14874
  function base64url(buf) {
14852
14875
  return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
14853
14876
  }