cascade-ai 0.3.0 → 0.4.0

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.d.cts CHANGED
@@ -896,6 +896,7 @@ declare class Cascade extends EventEmitter {
896
896
  /** Resolve a pending MCP server approval from a REPL / dashboard listener. */
897
897
  resolveMcpApproval(serverName: string, approved: boolean): void;
898
898
  init(): Promise<void>;
899
+ private isCasualGreeting;
899
900
  private looksLikeSimpleArtifactTask;
900
901
  private determineComplexity;
901
902
  run(options: CascadeRunOptions): Promise<CascadeRunResult>;
@@ -1584,7 +1585,7 @@ declare class Telemetry {
1584
1585
  shutdown(): Promise<void>;
1585
1586
  }
1586
1587
 
1587
- declare const CASCADE_VERSION = "0.3.0";
1588
+ declare const CASCADE_VERSION = "0.4.0";
1588
1589
  declare const CASCADE_CONFIG_DIR = ".cascade";
1589
1590
  declare const CASCADE_MD_FILE = "CASCADE.md";
1590
1591
  declare const CASCADE_IGNORE_FILE = ".cascadeignore";
package/dist/index.d.ts CHANGED
@@ -896,6 +896,7 @@ declare class Cascade extends EventEmitter {
896
896
  /** Resolve a pending MCP server approval from a REPL / dashboard listener. */
897
897
  resolveMcpApproval(serverName: string, approved: boolean): void;
898
898
  init(): Promise<void>;
899
+ private isCasualGreeting;
899
900
  private looksLikeSimpleArtifactTask;
900
901
  private determineComplexity;
901
902
  run(options: CascadeRunOptions): Promise<CascadeRunResult>;
@@ -1584,7 +1585,7 @@ declare class Telemetry {
1584
1585
  shutdown(): Promise<void>;
1585
1586
  }
1586
1587
 
1587
- declare const CASCADE_VERSION = "0.3.0";
1588
+ declare const CASCADE_VERSION = "0.4.0";
1588
1589
  declare const CASCADE_CONFIG_DIR = ".cascade";
1589
1590
  declare const CASCADE_MD_FILE = "CASCADE.md";
1590
1591
  declare const CASCADE_IGNORE_FILE = ".cascadeignore";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import EventEmitter from 'events';
2
2
  import crypto, { randomUUID, timingSafeEqual } from 'crypto';
3
3
  import { glob } from 'glob';
4
4
  import Anthropic from '@anthropic-ai/sdk';
5
- import OpenAI from 'openai';
5
+ import OpenAI, { AzureOpenAI } from 'openai';
6
6
  import { GoogleGenAI, HarmBlockThreshold, HarmCategory } from '@google/genai';
7
7
  import axios2 from 'axios';
8
8
  import fs2 from 'fs/promises';
@@ -124,7 +124,7 @@ var require_keytar2 = __commonJS({
124
124
  });
125
125
 
126
126
  // src/constants.ts
127
- var CASCADE_VERSION = "0.3.0";
127
+ var CASCADE_VERSION = "0.4.0";
128
128
  var CASCADE_CONFIG_DIR = ".cascade";
129
129
  var CASCADE_MD_FILE = "CASCADE.md";
130
130
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -862,19 +862,21 @@ var OpenAIProvider = class extends BaseProvider {
862
862
  // src/providers/azure.ts
863
863
  var AzureOpenAIProvider = class extends OpenAIProvider {
864
864
  constructor(config, model) {
865
- const baseUrl = config.baseUrl ?? AZURE_BASE_URL_TEMPLATE.replace("{resource}", "YOUR_RESOURCE");
865
+ const rawUrl = config.baseUrl ?? AZURE_BASE_URL_TEMPLATE.replace("{resource}", "YOUR_RESOURCE");
866
+ const endpoint = rawUrl.replace(/\/+$/, "");
866
867
  super(
867
868
  {
868
869
  ...config,
869
- baseUrl: `${baseUrl}/openai/deployments/${config.deploymentName ?? model.id}`
870
+ baseUrl: endpoint
871
+ // Kept for superclass compatibility if it reads it
870
872
  },
871
873
  model
872
874
  );
873
- this.client = new OpenAI({
875
+ this.client = new AzureOpenAI({
874
876
  apiKey: config.apiKey,
875
- baseURL: `${baseUrl}/openai/deployments/${config.deploymentName ?? model.id}`,
876
- defaultQuery: { "api-version": config.apiVersion ?? "2024-08-01-preview" },
877
- defaultHeaders: { "api-key": config.apiKey ?? "" }
877
+ endpoint,
878
+ deployment: config.deploymentName ?? model.id,
879
+ apiVersion: config.apiVersion ?? "2024-08-01-preview"
878
880
  });
879
881
  }
880
882
  async listModels() {
@@ -1632,7 +1634,7 @@ var CascadeRouter = class _CascadeRouter extends EventEmitter {
1632
1634
  if (!model) {
1633
1635
  throw new Error(`Configured model "${override}" for ${tier} could not be loaded. Check provider availability and exact model name.`);
1634
1636
  }
1635
- if (model.id !== override) {
1637
+ if (model.id !== override && `${model.provider}:${model.id}` !== override) {
1636
1638
  throw new Error(`Configured model "${override}" for ${tier} resolved to "${model.id}". Use the exact provider model ID or prefix the provider (e.g. gemini:${override}).`);
1637
1639
  }
1638
1640
  this.tierModels.set(tier, model);
@@ -2476,6 +2478,10 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
2476
2478
  await this.context.addMessage({ role: "assistant", content: result.content, toolCalls: result.toolCalls });
2477
2479
  if (!result.toolCalls?.length) {
2478
2480
  if (requiresArtifact) {
2481
+ const artifactCheck = await this.verifyArtifacts(this.assignment);
2482
+ if (artifactCheck.ok) {
2483
+ return { output: result.content, toolCalls: allToolCalls };
2484
+ }
2479
2485
  stalledArtifactIterations += 1;
2480
2486
  if (stalledArtifactIterations >= 2) {
2481
2487
  if (stalledArtifactIterations === 2) {
@@ -2485,15 +2491,22 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
2485
2491
  }
2486
2492
  await this.context.addMessage({
2487
2493
  role: "user",
2488
- content: "You have not yet created and verified the required artifact. Use tools to create the file in the workspace, verify it exists, and inspect the result before concluding."
2494
+ content: `You have not yet created and verified the required artifact. Issues: ${artifactCheck.issues.join("; ")}. Use tools to create the file in the workspace, verify it exists, and inspect the result before concluding.`
2489
2495
  });
2490
2496
  continue;
2491
2497
  }
2492
2498
  return { output: result.content, toolCalls: allToolCalls };
2493
2499
  }
2494
2500
  stalledArtifactIterations = 0;
2495
- if (result.finishReason === "stop" && !requiresArtifact) {
2496
- return { output: result.content, toolCalls: allToolCalls };
2501
+ if (result.finishReason === "stop") {
2502
+ if (requiresArtifact) {
2503
+ const artifactCheck = await this.verifyArtifacts(this.assignment);
2504
+ if (artifactCheck.ok) {
2505
+ return { output: result.content, toolCalls: allToolCalls };
2506
+ }
2507
+ } else {
2508
+ return { output: result.content, toolCalls: allToolCalls };
2509
+ }
2497
2510
  }
2498
2511
  for (const tc of result.toolCalls) {
2499
2512
  allToolCalls.push(tc);
@@ -6087,10 +6100,17 @@ var Cascade = class extends EventEmitter {
6087
6100
  throw err;
6088
6101
  }
6089
6102
  }
6103
+ isCasualGreeting(prompt) {
6104
+ const casual = /^(hi|hello|hey|greetings|thanks|thank you|thx|bye|goodbye|cya)$/i.test(prompt.trim().replace(/[!?.]+$/, ""));
6105
+ return casual;
6106
+ }
6090
6107
  looksLikeSimpleArtifactTask(prompt) {
6091
6108
  return /create .*\.(txt|md|json|csv)\b/i.test(prompt) && !/(research|compare|thorough|pdf|report|analy[sz]e|architecture|multi-agent)/i.test(prompt);
6092
6109
  }
6093
6110
  async determineComplexity(prompt, workspacePath, conversationHistory = []) {
6111
+ if (this.isCasualGreeting(prompt)) {
6112
+ return "Simple";
6113
+ }
6094
6114
  if (this.looksLikeSimpleArtifactTask(prompt)) {
6095
6115
  return "Simple";
6096
6116
  }