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/index.js CHANGED
@@ -4,6 +4,7 @@ import { glob } from 'glob';
4
4
  import Anthropic from '@anthropic-ai/sdk';
5
5
  import OpenAI, { AzureOpenAI } from 'openai';
6
6
  import { GoogleGenAI, HarmBlockThreshold, HarmCategory } from '@google/genai';
7
+ import dns from 'dns';
7
8
  import fs4 from 'fs/promises';
8
9
  import path18 from 'path';
9
10
  import os4 from 'os';
@@ -14,7 +15,7 @@ import { promisify } from 'util';
14
15
  import fs17 from 'fs';
15
16
  import { simpleGit } from 'simple-git';
16
17
  import PDFDocument from 'pdfkit';
17
- import dns from 'dns/promises';
18
+ import dns2 from 'dns/promises';
18
19
  import net from 'net';
19
20
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
20
21
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
@@ -35,7 +36,7 @@ import cron from 'node-cron';
35
36
 
36
37
 
37
38
  // src/constants.ts
38
- var CASCADE_VERSION = "0.12.13";
39
+ var CASCADE_VERSION = "0.12.15";
39
40
  var CASCADE_CONFIG_DIR = ".cascade";
40
41
  var CASCADE_MD_FILE = "CASCADE.md";
41
42
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -1096,6 +1097,14 @@ var GeminiProvider = class extends BaseProvider {
1096
1097
  };
1097
1098
  }
1098
1099
  };
1100
+ try {
1101
+ dns.setDefaultResultOrder("ipv4first");
1102
+ } catch {
1103
+ }
1104
+ function preferIpv4Host(url) {
1105
+ if (!url) return url;
1106
+ return url.replace(/^(https?:\/\/)localhost(?=[:/]|$)/i, "$1127.0.0.1");
1107
+ }
1099
1108
 
1100
1109
  // src/providers/ollama.ts
1101
1110
  var TOOL_CAPABLE_FAMILIES = [
@@ -1118,7 +1127,7 @@ var OllamaProvider = class extends BaseProvider {
1118
1127
  baseUrl;
1119
1128
  constructor(config, model) {
1120
1129
  super(config, model);
1121
- this.baseUrl = config.baseUrl ?? OLLAMA_BASE_URL;
1130
+ this.baseUrl = preferIpv4Host(config.baseUrl ?? OLLAMA_BASE_URL);
1122
1131
  }
1123
1132
  async generate(options) {
1124
1133
  const chunks = [];
@@ -1308,7 +1317,7 @@ var OpenAICompatibleProvider = class extends OpenAIProvider {
1308
1317
  super(config, model);
1309
1318
  this.client = new OpenAI({
1310
1319
  apiKey: config.apiKey ?? "not-required",
1311
- baseURL: config.baseUrl
1320
+ baseURL: preferIpv4Host(config.baseUrl)
1312
1321
  });
1313
1322
  }
1314
1323
  async listModels() {
@@ -7043,7 +7052,7 @@ async function assertPublicUrl(rawUrl) {
7043
7052
  }
7044
7053
  let addresses;
7045
7054
  try {
7046
- const records = await dns.lookup(host, { all: true });
7055
+ const records = await dns2.lookup(host, { all: true });
7047
7056
  addresses = records.map((r) => r.address);
7048
7057
  } catch {
7049
7058
  throw new SsrfBlockedError(`Could not resolve host "${host}".`);