cascade-ai 0.12.18 → 0.12.19
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.cjs +31 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +30 -8
- package/dist/cli.js.map +1 -1
- package/dist/desktop-core.cjs +39 -17
- package/dist/index.cjs +32 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +30 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -6,6 +6,7 @@ var genai = require('@google/genai');
|
|
|
6
6
|
var dns = require('dns');
|
|
7
7
|
var http = require('http');
|
|
8
8
|
var https = require('https');
|
|
9
|
+
var zlib = require('zlib');
|
|
9
10
|
var stream = require('stream');
|
|
10
11
|
var ink = require('ink');
|
|
11
12
|
var commander = require('commander');
|
|
@@ -69,6 +70,7 @@ var OpenAI__default = /*#__PURE__*/_interopDefault(OpenAI);
|
|
|
69
70
|
var dns__default = /*#__PURE__*/_interopDefault(dns);
|
|
70
71
|
var http__default = /*#__PURE__*/_interopDefault(http);
|
|
71
72
|
var https__default = /*#__PURE__*/_interopDefault(https);
|
|
73
|
+
var zlib__default = /*#__PURE__*/_interopDefault(zlib);
|
|
72
74
|
var React2__default = /*#__PURE__*/_interopDefault(React2);
|
|
73
75
|
var chalk9__default = /*#__PURE__*/_interopDefault(chalk9);
|
|
74
76
|
var dotenv__default = /*#__PURE__*/_interopDefault(dotenv);
|
|
@@ -107,7 +109,7 @@ var __export = (target, all) => {
|
|
|
107
109
|
var CASCADE_VERSION, CASCADE_CONFIG_FILE, CASCADE_DB_FILE, CASCADE_DASHBOARD_SECRET_FILE, GLOBAL_CONFIG_DIR, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_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;
|
|
108
110
|
var init_constants = __esm({
|
|
109
111
|
"src/constants.ts"() {
|
|
110
|
-
CASCADE_VERSION = "0.12.
|
|
112
|
+
CASCADE_VERSION = "0.12.19";
|
|
111
113
|
CASCADE_CONFIG_FILE = ".cascade/config.json";
|
|
112
114
|
CASCADE_DB_FILE = ".cascade/memory.db";
|
|
113
115
|
CASCADE_DASHBOARD_SECRET_FILE = ".cascade/dashboard-secret";
|
|
@@ -1217,9 +1219,9 @@ function preferIpv4Host(url) {
|
|
|
1217
1219
|
if (!url) return url;
|
|
1218
1220
|
return url.replace(/^(https?:\/\/)localhost(?=[:/]|$)/i, "$1127.0.0.1");
|
|
1219
1221
|
}
|
|
1220
|
-
async function nodeHttpFetch(input, init = {}) {
|
|
1222
|
+
async function nodeHttpFetch(input, init = {}, redirectCount = 0) {
|
|
1221
1223
|
const urlStr = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
1222
|
-
const u = new URL(urlStr);
|
|
1224
|
+
const u = new URL(preferIpv4Host(urlStr) ?? urlStr);
|
|
1223
1225
|
const lib = u.protocol === "https:" ? https__default.default : http__default.default;
|
|
1224
1226
|
const method = (init.method ?? "GET").toUpperCase();
|
|
1225
1227
|
const headers = {};
|
|
@@ -1229,6 +1231,9 @@ async function nodeHttpFetch(input, init = {}) {
|
|
|
1229
1231
|
});
|
|
1230
1232
|
else if (Array.isArray(h)) for (const [k, v] of h) headers[k] = v;
|
|
1231
1233
|
else if (h) Object.assign(headers, h);
|
|
1234
|
+
if (!Object.keys(headers).some((k) => k.toLowerCase() === "accept-encoding")) {
|
|
1235
|
+
headers["accept-encoding"] = "gzip, deflate, br";
|
|
1236
|
+
}
|
|
1232
1237
|
const body = init.body == null ? void 0 : typeof init.body === "string" ? init.body : Buffer.from(init.body);
|
|
1233
1238
|
return new Promise((resolve, reject) => {
|
|
1234
1239
|
const req = lib.request(
|
|
@@ -1240,14 +1245,30 @@ async function nodeHttpFetch(input, init = {}) {
|
|
|
1240
1245
|
headers
|
|
1241
1246
|
},
|
|
1242
1247
|
(res) => {
|
|
1243
|
-
const
|
|
1248
|
+
const status = res.statusCode ?? 200;
|
|
1249
|
+
const location = res.headers.location;
|
|
1250
|
+
if (status >= 300 && status < 400 && location && redirectCount < MAX_REDIRECTS) {
|
|
1251
|
+
res.resume();
|
|
1252
|
+
const nextUrl = new URL(location, u).href;
|
|
1253
|
+
const downgrade = status === 303 || (status === 301 || status === 302) && method !== "GET" && method !== "HEAD";
|
|
1254
|
+
const nextInit = downgrade ? { ...init, method: "GET", body: void 0 } : init;
|
|
1255
|
+
resolve(nodeHttpFetch(nextUrl, nextInit, redirectCount + 1));
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
const encoding = (res.headers["content-encoding"] ?? "").toLowerCase();
|
|
1259
|
+
let bodyStream = res;
|
|
1260
|
+
if (encoding === "gzip" || encoding === "x-gzip") bodyStream = res.pipe(zlib__default.default.createGunzip());
|
|
1261
|
+
else if (encoding === "deflate") bodyStream = res.pipe(zlib__default.default.createInflate());
|
|
1262
|
+
else if (encoding === "br") bodyStream = res.pipe(zlib__default.default.createBrotliDecompress());
|
|
1263
|
+
const stream$1 = stream.Readable.toWeb(bodyStream);
|
|
1244
1264
|
const respHeaders = new Headers();
|
|
1245
1265
|
for (const [k, v] of Object.entries(res.headers)) {
|
|
1266
|
+
if (k === "content-encoding" || k === "content-length") continue;
|
|
1246
1267
|
if (Array.isArray(v)) respHeaders.set(k, v.join(", "));
|
|
1247
1268
|
else if (typeof v === "string") respHeaders.set(k, v);
|
|
1248
1269
|
}
|
|
1249
1270
|
resolve(new Response(stream$1, {
|
|
1250
|
-
status
|
|
1271
|
+
status,
|
|
1251
1272
|
statusText: res.statusMessage ?? "",
|
|
1252
1273
|
headers: respHeaders
|
|
1253
1274
|
}));
|
|
@@ -1259,12 +1280,14 @@ async function nodeHttpFetch(input, init = {}) {
|
|
|
1259
1280
|
req.end();
|
|
1260
1281
|
});
|
|
1261
1282
|
}
|
|
1283
|
+
var MAX_REDIRECTS;
|
|
1262
1284
|
var init_net = __esm({
|
|
1263
1285
|
"src/utils/net.ts"() {
|
|
1264
1286
|
try {
|
|
1265
1287
|
dns__default.default.setDefaultResultOrder("ipv4first");
|
|
1266
1288
|
} catch {
|
|
1267
1289
|
}
|
|
1290
|
+
MAX_REDIRECTS = 5;
|
|
1268
1291
|
}
|
|
1269
1292
|
});
|
|
1270
1293
|
|
|
@@ -8968,7 +8991,7 @@ var SsrfBlockedError = class extends Error {
|
|
|
8968
8991
|
}
|
|
8969
8992
|
};
|
|
8970
8993
|
var ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
8971
|
-
var
|
|
8994
|
+
var MAX_REDIRECTS2 = 5;
|
|
8972
8995
|
function allowLocal() {
|
|
8973
8996
|
return process.env["CASCADE_ALLOW_LOCAL_FETCH"] === "1";
|
|
8974
8997
|
}
|
|
@@ -9036,7 +9059,7 @@ async function assertPublicUrl(rawUrl) {
|
|
|
9036
9059
|
}
|
|
9037
9060
|
async function safeFetch(rawUrl, init = {}) {
|
|
9038
9061
|
let currentUrl = (await assertPublicUrl(rawUrl)).toString();
|
|
9039
|
-
for (let i = 0; i <=
|
|
9062
|
+
for (let i = 0; i <= MAX_REDIRECTS2; i++) {
|
|
9040
9063
|
const resp = await fetch(currentUrl, { ...init, redirect: "manual" });
|
|
9041
9064
|
if (resp.status < 300 || resp.status >= 400) return resp;
|
|
9042
9065
|
const location = resp.headers.get("location");
|
|
@@ -9045,7 +9068,7 @@ async function safeFetch(rawUrl, init = {}) {
|
|
|
9045
9068
|
await assertPublicUrl(next.toString());
|
|
9046
9069
|
currentUrl = next.toString();
|
|
9047
9070
|
}
|
|
9048
|
-
throw new SsrfBlockedError(`Too many redirects (>${
|
|
9071
|
+
throw new SsrfBlockedError(`Too many redirects (>${MAX_REDIRECTS2}).`);
|
|
9049
9072
|
}
|
|
9050
9073
|
|
|
9051
9074
|
// src/tools/web-fetch.ts
|