cascade-ai 0.19.0 → 0.20.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/cli.js CHANGED
@@ -59,7 +59,7 @@ var __export = (target, all) => {
59
59
  var CASCADE_VERSION, CASCADE_CONFIG_FILE, CASCADE_DB_FILE, CASCADE_DASHBOARD_SECRET_FILE, GLOBAL_CONFIG_DIR, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_CREDENTIALS_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;
60
60
  var init_constants = __esm({
61
61
  "src/constants.ts"() {
62
- CASCADE_VERSION = "0.19.0";
62
+ CASCADE_VERSION = "0.20.0";
63
63
  CASCADE_CONFIG_FILE = ".cascade/config.json";
64
64
  CASCADE_DB_FILE = ".cascade/memory.db";
65
65
  CASCADE_DASHBOARD_SECRET_FILE = ".cascade/dashboard-secret";
@@ -934,14 +934,27 @@ var init_azure = __esm({
934
934
  return [fromDeployment ?? this.model];
935
935
  }
936
936
  async isAvailable() {
937
+ const params = {
938
+ model: this.model.id,
939
+ messages: [{ role: "user", content: "ping" }],
940
+ max_tokens: 1
941
+ };
937
942
  try {
938
- await this.client.chat.completions.create({
939
- model: this.model.id,
940
- messages: [{ role: "user", content: "ping" }],
941
- max_tokens: 1
942
- });
943
+ await this.client.chat.completions.create(params);
943
944
  return true;
944
- } catch {
945
+ } catch (err) {
946
+ if (err?.message && String(err.message).includes("max_completion_tokens")) {
947
+ try {
948
+ await this.client.chat.completions.create({
949
+ model: this.model.id,
950
+ messages: [{ role: "user", content: "ping" }],
951
+ max_completion_tokens: 1
952
+ });
953
+ return true;
954
+ } catch {
955
+ return false;
956
+ }
957
+ }
945
958
  return false;
946
959
  }
947
960
  }
@@ -2935,7 +2948,13 @@ var ToolsConfigSchema = z.object({
2935
2948
  * - 'worker': node:worker_threads (resource/kill limits, but not capability-confined).
2936
2949
  * - 'auto' (default): use the isolate when `isolated-vm` loads, else fall back to worker.
2937
2950
  */
2938
- dynamicToolSandbox: z.enum(["isolate", "worker", "auto"]).default("auto")
2951
+ dynamicToolSandbox: z.enum(["isolate", "worker", "auto"]).default("auto"),
2952
+ /**
2953
+ * When set, ONLY these tool names are registered — the sole way to omit a
2954
+ * built-in tool (shell/file/git/…) from existing at all, rather than just
2955
+ * gating it behind approval. Omitted = full default set (unchanged).
2956
+ */
2957
+ enabledTools: z.array(z.string()).optional()
2939
2958
  });
2940
2959
  var HookDefinitionSchema = z.object({
2941
2960
  name: z.string().optional(),
@@ -3822,6 +3841,10 @@ var ModelSelector = class {
3822
3841
  actualId = parts.slice(1).join(":");
3823
3842
  }
3824
3843
  }
3844
+ const registered = this.availableModels.get(actualId);
3845
+ if (registered && (!providerStr || registered.provider === providerStr)) {
3846
+ return registered;
3847
+ }
3825
3848
  if (!providerStr) {
3826
3849
  const lower = actualId.toLowerCase();
3827
3850
  if (lower.includes("claude")) providerStr = "anthropic";
@@ -10072,29 +10095,32 @@ var ToolRegistry = class extends EventEmitter {
10072
10095
  return tool.execute(input, options);
10073
10096
  }
10074
10097
  registerDefaults() {
10075
- const tools = [
10076
- new ShellTool(this.config.shellAllowlist, this.config.shellBlocklist),
10077
- new FileReadTool(),
10078
- new FileWriteTool(),
10079
- new FileEditTool(),
10080
- new FileDeleteTool(),
10081
- new FileListTool(),
10082
- new GitTool(),
10083
- new GitHubTool(),
10084
- new ImageAnalyzeTool(),
10085
- new PDFCreateTool(),
10086
- new CodeInterpreterTool(),
10087
- new PeerCommunicationTool(),
10088
- new WebSearchTool(this.config.webSearch),
10089
- new GlobTool(),
10090
- new GrepTool(),
10091
- new WebFetchTool()
10098
+ const allowlist = this.config.enabledTools;
10099
+ const enabled = (name) => !allowlist || allowlist.includes(name);
10100
+ const candidates2 = [
10101
+ enabled("shell") && new ShellTool(this.config.shellAllowlist, this.config.shellBlocklist),
10102
+ enabled("file_read") && new FileReadTool(),
10103
+ enabled("file_write") && new FileWriteTool(),
10104
+ enabled("file_edit") && new FileEditTool(),
10105
+ enabled("file_delete") && new FileDeleteTool(),
10106
+ enabled("file_list") && new FileListTool(),
10107
+ enabled("git") && new GitTool(),
10108
+ enabled("github") && new GitHubTool(),
10109
+ enabled("image_analyze") && new ImageAnalyzeTool(),
10110
+ enabled("pdf_create") && new PDFCreateTool(),
10111
+ enabled("run_code") && new CodeInterpreterTool(),
10112
+ enabled("peer_message") && new PeerCommunicationTool(),
10113
+ enabled("web_search") && new WebSearchTool(this.config.webSearch),
10114
+ enabled("glob") && new GlobTool(),
10115
+ enabled("grep") && new GrepTool(),
10116
+ enabled("web_fetch") && new WebFetchTool()
10092
10117
  ];
10118
+ const tools = candidates2.filter((t) => t !== false);
10093
10119
  for (const tool of tools) {
10094
10120
  tool.setWorkspaceRoot(this.workspaceRoot);
10095
10121
  this.register(tool);
10096
10122
  }
10097
- if (this.config.browserEnabled) {
10123
+ if (this.config.browserEnabled && enabled("browser")) {
10098
10124
  const browser = new BrowserTool();
10099
10125
  browser.setWorkspaceRoot(this.workspaceRoot);
10100
10126
  this.register(browser);