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.cjs CHANGED
@@ -165,7 +165,7 @@ var require_keytar2 = __commonJS({
165
165
  });
166
166
 
167
167
  // src/constants.ts
168
- var CASCADE_VERSION = "0.3.0";
168
+ var CASCADE_VERSION = "0.4.0";
169
169
  var CASCADE_CONFIG_DIR = ".cascade";
170
170
  var CASCADE_MD_FILE = "CASCADE.md";
171
171
  var CASCADE_IGNORE_FILE = ".cascadeignore";
@@ -903,19 +903,21 @@ var OpenAIProvider = class extends BaseProvider {
903
903
  // src/providers/azure.ts
904
904
  var AzureOpenAIProvider = class extends OpenAIProvider {
905
905
  constructor(config, model) {
906
- const baseUrl = config.baseUrl ?? AZURE_BASE_URL_TEMPLATE.replace("{resource}", "YOUR_RESOURCE");
906
+ const rawUrl = config.baseUrl ?? AZURE_BASE_URL_TEMPLATE.replace("{resource}", "YOUR_RESOURCE");
907
+ const endpoint = rawUrl.replace(/\/+$/, "");
907
908
  super(
908
909
  {
909
910
  ...config,
910
- baseUrl: `${baseUrl}/openai/deployments/${config.deploymentName ?? model.id}`
911
+ baseUrl: endpoint
912
+ // Kept for superclass compatibility if it reads it
911
913
  },
912
914
  model
913
915
  );
914
- this.client = new OpenAI__default.default({
916
+ this.client = new OpenAI.AzureOpenAI({
915
917
  apiKey: config.apiKey,
916
- baseURL: `${baseUrl}/openai/deployments/${config.deploymentName ?? model.id}`,
917
- defaultQuery: { "api-version": config.apiVersion ?? "2024-08-01-preview" },
918
- defaultHeaders: { "api-key": config.apiKey ?? "" }
918
+ endpoint,
919
+ deployment: config.deploymentName ?? model.id,
920
+ apiVersion: config.apiVersion ?? "2024-08-01-preview"
919
921
  });
920
922
  }
921
923
  async listModels() {
@@ -1673,7 +1675,7 @@ var CascadeRouter = class _CascadeRouter extends EventEmitter__default.default {
1673
1675
  if (!model) {
1674
1676
  throw new Error(`Configured model "${override}" for ${tier} could not be loaded. Check provider availability and exact model name.`);
1675
1677
  }
1676
- if (model.id !== override) {
1678
+ if (model.id !== override && `${model.provider}:${model.id}` !== override) {
1677
1679
  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}).`);
1678
1680
  }
1679
1681
  this.tierModels.set(tier, model);
@@ -2517,6 +2519,10 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
2517
2519
  await this.context.addMessage({ role: "assistant", content: result.content, toolCalls: result.toolCalls });
2518
2520
  if (!result.toolCalls?.length) {
2519
2521
  if (requiresArtifact) {
2522
+ const artifactCheck = await this.verifyArtifacts(this.assignment);
2523
+ if (artifactCheck.ok) {
2524
+ return { output: result.content, toolCalls: allToolCalls };
2525
+ }
2520
2526
  stalledArtifactIterations += 1;
2521
2527
  if (stalledArtifactIterations >= 2) {
2522
2528
  if (stalledArtifactIterations === 2) {
@@ -2526,15 +2532,22 @@ HIERARCHY CONTEXT: ${this.hierarchyContext}` : ""),
2526
2532
  }
2527
2533
  await this.context.addMessage({
2528
2534
  role: "user",
2529
- 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."
2535
+ 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.`
2530
2536
  });
2531
2537
  continue;
2532
2538
  }
2533
2539
  return { output: result.content, toolCalls: allToolCalls };
2534
2540
  }
2535
2541
  stalledArtifactIterations = 0;
2536
- if (result.finishReason === "stop" && !requiresArtifact) {
2537
- return { output: result.content, toolCalls: allToolCalls };
2542
+ if (result.finishReason === "stop") {
2543
+ if (requiresArtifact) {
2544
+ const artifactCheck = await this.verifyArtifacts(this.assignment);
2545
+ if (artifactCheck.ok) {
2546
+ return { output: result.content, toolCalls: allToolCalls };
2547
+ }
2548
+ } else {
2549
+ return { output: result.content, toolCalls: allToolCalls };
2550
+ }
2538
2551
  }
2539
2552
  for (const tc of result.toolCalls) {
2540
2553
  allToolCalls.push(tc);
@@ -6128,10 +6141,17 @@ var Cascade = class extends EventEmitter__default.default {
6128
6141
  throw err;
6129
6142
  }
6130
6143
  }
6144
+ isCasualGreeting(prompt) {
6145
+ const casual = /^(hi|hello|hey|greetings|thanks|thank you|thx|bye|goodbye|cya)$/i.test(prompt.trim().replace(/[!?.]+$/, ""));
6146
+ return casual;
6147
+ }
6131
6148
  looksLikeSimpleArtifactTask(prompt) {
6132
6149
  return /create .*\.(txt|md|json|csv)\b/i.test(prompt) && !/(research|compare|thorough|pdf|report|analy[sz]e|architecture|multi-agent)/i.test(prompt);
6133
6150
  }
6134
6151
  async determineComplexity(prompt, workspacePath, conversationHistory = []) {
6152
+ if (this.isCasualGreeting(prompt)) {
6153
+ return "Simple";
6154
+ }
6135
6155
  if (this.looksLikeSimpleArtifactTask(prompt)) {
6136
6156
  return "Simple";
6137
6157
  }