cascade-ai 0.12.13 → 0.12.15

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.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import Anthropic from '@anthropic-ai/sdk';
2
2
  import OpenAI, { AzureOpenAI } from 'openai';
3
3
  import { GoogleGenAI, HarmBlockThreshold, HarmCategory } from '@google/genai';
4
+ import dns from 'dns';
4
5
  import { render, Box, Text, useStdout, useApp, useInput, Static } from 'ink';
5
6
  import { Command } from 'commander';
6
7
  import React2, { useState, useReducer, useRef, useCallback, useEffect, useMemo } from 'react';
@@ -23,7 +24,7 @@ import { glob } from 'glob';
23
24
  import { promisify } from 'util';
24
25
  import { simpleGit } from 'simple-git';
25
26
  import PDFDocument from 'pdfkit';
26
- import dns from 'dns/promises';
27
+ import dns2 from 'dns/promises';
27
28
  import net from 'net';
28
29
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
29
30
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
@@ -54,7 +55,7 @@ var __export = (target, all) => {
54
55
  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;
55
56
  var init_constants = __esm({
56
57
  "src/constants.ts"() {
57
- CASCADE_VERSION = "0.12.13";
58
+ CASCADE_VERSION = "0.12.15";
58
59
  CASCADE_CONFIG_FILE = ".cascade/config.json";
59
60
  CASCADE_DB_FILE = ".cascade/memory.db";
60
61
  CASCADE_DASHBOARD_SECRET_FILE = ".cascade/dashboard-secret";
@@ -1160,6 +1161,18 @@ var init_gemini = __esm({
1160
1161
  };
1161
1162
  }
1162
1163
  });
1164
+ function preferIpv4Host(url) {
1165
+ if (!url) return url;
1166
+ return url.replace(/^(https?:\/\/)localhost(?=[:/]|$)/i, "$1127.0.0.1");
1167
+ }
1168
+ var init_net = __esm({
1169
+ "src/utils/net.ts"() {
1170
+ try {
1171
+ dns.setDefaultResultOrder("ipv4first");
1172
+ } catch {
1173
+ }
1174
+ }
1175
+ });
1163
1176
 
1164
1177
  // src/providers/ollama.ts
1165
1178
  var ollama_exports = {};
@@ -1174,6 +1187,7 @@ var TOOL_CAPABLE_FAMILIES, OllamaProvider;
1174
1187
  var init_ollama = __esm({
1175
1188
  "src/providers/ollama.ts"() {
1176
1189
  init_constants();
1190
+ init_net();
1177
1191
  init_base();
1178
1192
  TOOL_CAPABLE_FAMILIES = [
1179
1193
  "llama3.1",
@@ -1191,7 +1205,7 @@ var init_ollama = __esm({
1191
1205
  baseUrl;
1192
1206
  constructor(config, model) {
1193
1207
  super(config, model);
1194
- this.baseUrl = config.baseUrl ?? OLLAMA_BASE_URL;
1208
+ this.baseUrl = preferIpv4Host(config.baseUrl ?? OLLAMA_BASE_URL);
1195
1209
  }
1196
1210
  async generate(options) {
1197
1211
  const chunks = [];
@@ -1388,12 +1402,13 @@ var OpenAICompatibleProvider;
1388
1402
  var init_openai_compatible = __esm({
1389
1403
  "src/providers/openai-compatible.ts"() {
1390
1404
  init_openai();
1405
+ init_net();
1391
1406
  OpenAICompatibleProvider = class extends OpenAIProvider {
1392
1407
  constructor(config, model) {
1393
1408
  super(config, model);
1394
1409
  this.client = new OpenAI({
1395
1410
  apiKey: config.apiKey ?? "not-required",
1396
- baseURL: config.baseUrl
1411
+ baseURL: preferIpv4Host(config.baseUrl)
1397
1412
  });
1398
1413
  }
1399
1414
  async listModels() {
@@ -8896,7 +8911,7 @@ async function assertPublicUrl(rawUrl) {
8896
8911
  }
8897
8912
  let addresses;
8898
8913
  try {
8899
- const records = await dns.lookup(host, { all: true });
8914
+ const records = await dns2.lookup(host, { all: true });
8900
8915
  addresses = records.map((r) => r.address);
8901
8916
  } catch {
8902
8917
  throw new SsrfBlockedError(`Could not resolve host "${host}".`);