cascade-ai 0.12.19 → 0.12.20

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.cjs CHANGED
@@ -109,7 +109,7 @@ var __export = (target, all) => {
109
109
  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;
110
110
  var init_constants = __esm({
111
111
  "src/constants.ts"() {
112
- CASCADE_VERSION = "0.12.19";
112
+ CASCADE_VERSION = "0.12.20";
113
113
  CASCADE_CONFIG_FILE = ".cascade/config.json";
114
114
  CASCADE_DB_FILE = ".cascade/memory.db";
115
115
  CASCADE_DASHBOARD_SECRET_FILE = ".cascade/dashboard-secret";
@@ -1216,8 +1216,7 @@ var init_gemini = __esm({
1216
1216
  }
1217
1217
  });
1218
1218
  function preferIpv4Host(url) {
1219
- if (!url) return url;
1220
- return url.replace(/^(https?:\/\/)localhost(?=[:/]|$)/i, "$1127.0.0.1");
1219
+ return url;
1221
1220
  }
1222
1221
  async function nodeHttpFetch(input, init = {}, redirectCount = 0) {
1223
1222
  const urlStr = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
@@ -11018,135 +11017,126 @@ init_ollama();
11018
11017
  init_openai_compatible();
11019
11018
 
11020
11019
  // src/cli/themes/index.ts
11021
- var cascadeTheme = {
11022
- name: "cascade",
11023
- colors: {
11024
- primary: "#7C6AF7",
11025
- // Cascade violet
11026
- secondary: "#A78BFA",
11027
- accent: "#06B6D4",
11028
- // Cyan
11029
- success: "#10B981",
11030
- warning: "#F59E0B",
11031
- error: "#EF4444",
11032
- info: "#3B82F6",
11033
- muted: "#6B7280",
11034
- background: "#0F0F1A",
11035
- foreground: "#E2E8F0",
11036
- border: "#2D2B55",
11037
- t1Color: "#7C6AF7",
11038
- // Violet
11039
- t2Color: "#06B6D4",
11040
- // Cyan
11041
- t3Color: "#10B981"
11042
- // Green
11043
- }
11044
- };
11045
- var darkTheme = {
11046
- name: "dark",
11047
- colors: {
11048
- primary: "#60A5FA",
11049
- secondary: "#818CF8",
11050
- accent: "#34D399",
11051
- success: "#34D399",
11052
- warning: "#FBBF24",
11053
- error: "#F87171",
11054
- info: "#60A5FA",
11055
- muted: "#6B7280",
11056
- background: "#111827",
11057
- foreground: "#F9FAFB",
11058
- border: "#374151",
11059
- t1Color: "#60A5FA",
11060
- t2Color: "#818CF8",
11061
- t3Color: "#34D399"
11062
- }
11063
- };
11064
- var lightTheme = {
11065
- name: "light",
11066
- colors: {
11067
- primary: "#2563EB",
11068
- secondary: "#7C3AED",
11069
- accent: "#0891B2",
11070
- success: "#059669",
11071
- warning: "#D97706",
11072
- error: "#DC2626",
11073
- info: "#2563EB",
11074
- muted: "#6B7280",
11075
- background: "#FFFFFF",
11076
- foreground: "#111827",
11077
- border: "#E5E7EB",
11078
- t1Color: "#2563EB",
11079
- t2Color: "#7C3AED",
11080
- t3Color: "#059669"
11081
- }
11082
- };
11083
- var draculaTheme = {
11084
- name: "dracula",
11085
- colors: {
11086
- primary: "#BD93F9",
11087
- secondary: "#FF79C6",
11088
- accent: "#8BE9FD",
11089
- success: "#50FA7B",
11090
- warning: "#FFB86C",
11091
- error: "#FF5555",
11092
- info: "#8BE9FD",
11093
- muted: "#6272A4",
11094
- background: "#282A36",
11095
- foreground: "#F8F8F2",
11096
- border: "#44475A",
11097
- t1Color: "#BD93F9",
11098
- t2Color: "#FF79C6",
11099
- t3Color: "#50FA7B"
11100
- }
11101
- };
11102
- var nordTheme = {
11103
- name: "nord",
11104
- colors: {
11105
- primary: "#88C0D0",
11106
- secondary: "#81A1C1",
11107
- accent: "#A3BE8C",
11108
- success: "#A3BE8C",
11109
- warning: "#EBCB8B",
11110
- error: "#BF616A",
11111
- info: "#5E81AC",
11112
- muted: "#4C566A",
11113
- background: "#2E3440",
11114
- foreground: "#ECEFF4",
11115
- border: "#3B4252",
11116
- t1Color: "#88C0D0",
11117
- t2Color: "#81A1C1",
11118
- t3Color: "#A3BE8C"
11119
- }
11020
+ function defineTheme(name, colors) {
11021
+ return { name, colors };
11022
+ }
11023
+ var midnightTheme = defineTheme("midnight", {
11024
+ primary: "#8B7CF9",
11025
+ secondary: "#B7AEFF",
11026
+ accent: "#42D3E7",
11027
+ success: "#3DDC97",
11028
+ warning: "#F7B84B",
11029
+ error: "#FF6685",
11030
+ info: "#67A8FF",
11031
+ muted: "#7C819B",
11032
+ background: "#080A12",
11033
+ foreground: "#EDF0FA",
11034
+ border: "#292D42",
11035
+ t1Color: "#F7B84B",
11036
+ t2Color: "#A98BFF",
11037
+ t3Color: "#42D3E7"
11038
+ });
11039
+ var auroraTheme = defineTheme("aurora", {
11040
+ primary: "#6F8CFF",
11041
+ secondary: "#A78BFA",
11042
+ accent: "#45E0B8",
11043
+ success: "#45E0B8",
11044
+ warning: "#FFD166",
11045
+ error: "#FF6B8A",
11046
+ info: "#6FB7FF",
11047
+ muted: "#7890A8",
11048
+ background: "#071019",
11049
+ foreground: "#EAF7F5",
11050
+ border: "#20384A",
11051
+ t1Color: "#FFD166",
11052
+ t2Color: "#8B9CFF",
11053
+ t3Color: "#45E0B8"
11054
+ });
11055
+ var emberTheme = defineTheme("ember", {
11056
+ primary: "#FF8A5B",
11057
+ secondary: "#FFB36B",
11058
+ accent: "#F7C75B",
11059
+ success: "#72D69A",
11060
+ warning: "#F7C75B",
11061
+ error: "#FF647C",
11062
+ info: "#73B7FF",
11063
+ muted: "#9A8078",
11064
+ background: "#120C0B",
11065
+ foreground: "#FFF1E9",
11066
+ border: "#463027",
11067
+ t1Color: "#F7C75B",
11068
+ t2Color: "#FF8A5B",
11069
+ t3Color: "#72D69A"
11070
+ });
11071
+ var tideTheme = defineTheme("tide", {
11072
+ primary: "#4DA8FF",
11073
+ secondary: "#65C7F7",
11074
+ accent: "#51E1D4",
11075
+ success: "#63D9A5",
11076
+ warning: "#F2C879",
11077
+ error: "#F0718B",
11078
+ info: "#4DA8FF",
11079
+ muted: "#71899C",
11080
+ background: "#061017",
11081
+ foreground: "#E8F5FA",
11082
+ border: "#1C3947",
11083
+ t1Color: "#F2C879",
11084
+ t2Color: "#65A8F7",
11085
+ t3Color: "#51E1D4"
11086
+ });
11087
+ var bloomTheme = defineTheme("bloom", {
11088
+ primary: "#C084FC",
11089
+ secondary: "#F08BB4",
11090
+ accent: "#7DD3FC",
11091
+ success: "#6EE7B7",
11092
+ warning: "#FBCB78",
11093
+ error: "#FB7185",
11094
+ info: "#7DD3FC",
11095
+ muted: "#9B83A8",
11096
+ background: "#140D19",
11097
+ foreground: "#F8EEFC",
11098
+ border: "#412B4D",
11099
+ t1Color: "#FBCB78",
11100
+ t2Color: "#C084FC",
11101
+ t3Color: "#7DD3FC"
11102
+ });
11103
+ var daybreakTheme = defineTheme("daybreak", {
11104
+ primary: "#6857D9",
11105
+ secondary: "#826AE6",
11106
+ accent: "#087F91",
11107
+ success: "#087A55",
11108
+ warning: "#A86408",
11109
+ error: "#C83253",
11110
+ info: "#2563A8",
11111
+ muted: "#667085",
11112
+ background: "#F7F7FB",
11113
+ foreground: "#202336",
11114
+ border: "#D9DCE8",
11115
+ t1Color: "#A86408",
11116
+ t2Color: "#6857D9",
11117
+ t3Color: "#087F91"
11118
+ });
11119
+ var canonicalThemes = {
11120
+ midnight: midnightTheme,
11121
+ aurora: auroraTheme,
11122
+ ember: emberTheme,
11123
+ tide: tideTheme,
11124
+ bloom: bloomTheme,
11125
+ daybreak: daybreakTheme
11120
11126
  };
11121
- var solarizedTheme = {
11122
- name: "solarized",
11123
- colors: {
11124
- primary: "#268BD2",
11125
- secondary: "#2AA198",
11126
- accent: "#B58900",
11127
- success: "#859900",
11128
- warning: "#CB4B16",
11129
- error: "#DC322F",
11130
- info: "#268BD2",
11131
- muted: "#657B83",
11132
- background: "#002B36",
11133
- foreground: "#839496",
11134
- border: "#073642",
11135
- t1Color: "#268BD2",
11136
- t2Color: "#2AA198",
11137
- t3Color: "#859900"
11138
- }
11127
+ var THEME_ALIASES = {
11128
+ cascade: "midnight",
11129
+ dark: "aurora",
11130
+ light: "daybreak",
11131
+ dracula: "bloom",
11132
+ nord: "tide",
11133
+ solarized: "ember"
11139
11134
  };
11140
- var themes = /* @__PURE__ */ new Map([
11141
- ["cascade", cascadeTheme],
11142
- ["dark", darkTheme],
11143
- ["light", lightTheme],
11144
- ["dracula", draculaTheme],
11145
- ["nord", nordTheme],
11146
- ["solarized", solarizedTheme]
11147
- ]);
11135
+ function resolveThemeName(name) {
11136
+ return (name in canonicalThemes ? name : THEME_ALIASES[name]) || "midnight";
11137
+ }
11148
11138
  function getTheme(name) {
11149
- return themes.get(name) ?? cascadeTheme;
11139
+ return canonicalThemes[resolveThemeName(name)] ?? midnightTheme;
11150
11140
  }
11151
11141
 
11152
11142
  // src/cli/slash/index.ts
@@ -11400,6 +11390,13 @@ var FIXED_CHROME_ROWS = 1 + // StatusBar
11400
11390
  3;
11401
11391
  var STREAM_TAIL_ROWS = 9;
11402
11392
  var SLASH_PANEL_ROWS = 11;
11393
+ function computeAdaptiveLayoutMode(columns, rows) {
11394
+ const safeColumns = Number.isFinite(columns) && columns > 0 ? columns : 100;
11395
+ const safeRows = Number.isFinite(rows) && rows > 0 ? rows : 40;
11396
+ if (safeColumns < 80 || safeRows < 24) return "narrow";
11397
+ if (safeColumns < 120 || safeRows < 32) return "medium";
11398
+ return "wide";
11399
+ }
11403
11400
  var TREE_ROWS_FULL = 10;
11404
11401
  var TREE_ROWS_COMPACT = 4;
11405
11402
  var TIMELINE_ROWS = 4;
@@ -11659,7 +11656,7 @@ function formatTokens(n) {
11659
11656
  var StatusBar = React2__default.default.memo(StatusBarInternal);
11660
11657
  function HintBarInternal({ theme, isExecuting }) {
11661
11658
  if (isExecuting) return null;
11662
- return /* @__PURE__ */ jsxRuntime.jsx(ink.Box, { paddingLeft: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.accent, dimColor: true, children: "/help \xB7 /clear \xB7 /theme \xB7 /cost \xB7 /model \xB7 /export" }) });
11659
+ return /* @__PURE__ */ jsxRuntime.jsx(ink.Box, { paddingLeft: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.accent, dimColor: true, children: "/ commands \xB7 \u2191\u2193 history \xB7 Esc cancel \xB7 Ctrl+C exit" }) });
11663
11660
  }
11664
11661
  var HintBar = React2__default.default.memo(HintBarInternal);
11665
11662
  function ApprovalPrompt({ request, theme, onDecision }) {
@@ -11983,6 +11980,53 @@ function CostTracker({
11983
11980
  ] })
11984
11981
  ] });
11985
11982
  }
11983
+ function CompactStatus({ theme, activeT2Count, activeT3Count, currentAction, activeTool, isStreaming }) {
11984
+ const activeCount = activeT2Count + activeT3Count;
11985
+ const isActive = isStreaming || activeCount > 0;
11986
+ const rightHint = isActive ? /* @__PURE__ */ jsxRuntime.jsxs(ink.Text, { color: theme.colors.muted, children: [
11987
+ "T2:",
11988
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.accent, children: activeT2Count }),
11989
+ " T3:",
11990
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.accent, children: activeT3Count })
11991
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(ink.Text, { color: theme.colors.muted, children: [
11992
+ "[",
11993
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.accent, bold: true, children: "tree" }),
11994
+ "]"
11995
+ ] });
11996
+ return /* @__PURE__ */ jsxRuntime.jsxs(ink.Box, { paddingX: 1, borderStyle: "single", borderTop: false, borderLeft: false, borderRight: false, borderColor: theme.colors.border, children: [
11997
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Box, { flexGrow: 1, children: isActive ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11998
+ /* @__PURE__ */ jsxRuntime.jsxs(ink.Text, { color: theme.colors.accent, bold: true, children: [
11999
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner__default.default, { type: "hamburger" }),
12000
+ " "
12001
+ ] }),
12002
+ activeTool ? (
12003
+ // Show active tool prominently
12004
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12005
+ /* @__PURE__ */ jsxRuntime.jsxs(ink.Text, { color: "yellow", bold: true, children: [
12006
+ "\u2699 ",
12007
+ activeTool
12008
+ ] }),
12009
+ currentAction && !currentAction.startsWith("Using tool:") && /* @__PURE__ */ jsxRuntime.jsxs(ink.Text, { color: theme.colors.muted, children: [
12010
+ " \u2503 ",
12011
+ currentAction.length > 60 ? currentAction.slice(0, 57) + "..." : currentAction
12012
+ ] })
12013
+ ] })
12014
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12015
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.accent, bold: true, children: activeCount > 0 ? `WORKING: ${activeCount} AGENTS` : "ORCHESTRATING" }),
12016
+ currentAction && /* @__PURE__ */ jsxRuntime.jsxs(ink.Text, { color: theme.colors.muted, children: [
12017
+ " \u2503 ",
12018
+ currentAction.length > 80 ? currentAction.slice(0, 77) + "..." : currentAction
12019
+ ] })
12020
+ ] })
12021
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(ink.Box, { children: [
12022
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.muted, children: "\u25CF SYSTEM IDLE " }),
12023
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.muted, children: "\u2503 Press " }),
12024
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.accent, bold: true, children: "/" }),
12025
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.muted, children: " for command palette" })
12026
+ ] }) }),
12027
+ /* @__PURE__ */ jsxRuntime.jsx(ink.Box, { children: rightHint })
12028
+ ] });
12029
+ }
11986
12030
  function ChatMessage({ role, content, theme, timestamp, isStreaming }) {
11987
12031
  const { label, color, prefix } = getRoleStyle(role, theme);
11988
12032
  return /* @__PURE__ */ jsxRuntime.jsxs(ink.Box, { flexDirection: "column", marginY: 1, children: [
@@ -12287,6 +12331,19 @@ function tailLines(text, n) {
12287
12331
  const lines = text.split("\n");
12288
12332
  return lines.slice(-8);
12289
12333
  }
12334
+ function activeTierSummary(root) {
12335
+ const summary = { t2: 0, t3: 0 };
12336
+ const visit = (node) => {
12337
+ if (node.status === "ACTIVE") {
12338
+ if (node.role === "T2") summary.t2 += 1;
12339
+ if (node.role === "T3") summary.t3 += 1;
12340
+ summary.action ??= node.currentAction;
12341
+ }
12342
+ node.children?.forEach(visit);
12343
+ };
12344
+ if (root) visit(root);
12345
+ return summary;
12346
+ }
12290
12347
  function WelcomeBanner({ theme, config, workspacePath, sessionId }) {
12291
12348
  const t1 = config.models?.t1 ?? "auto";
12292
12349
  const t2 = config.models?.t2 ?? "auto";
@@ -13184,13 +13241,15 @@ ${lastUser.content}`;
13184
13241
  };
13185
13242
  }, [stdout]);
13186
13243
  const width = termSize.columns;
13244
+ const adaptiveMode = computeAdaptiveLayoutMode(termSize.columns, termSize.rows);
13187
13245
  const budgetOpts = {
13188
13246
  isTypingCommand,
13189
- showCost: state.showCost,
13190
- showDetails: state.showDetails,
13191
- showComms: state.showComms && state.peerEvents.length > 0
13247
+ showCost: state.showCost && adaptiveMode !== "narrow",
13248
+ showDetails: state.showDetails && adaptiveMode === "wide",
13249
+ showComms: state.showComms && state.peerEvents.length > 0 && adaptiveMode === "wide"
13192
13250
  };
13193
13251
  const liveBudget = computeLiveAreaBudget(termSize.rows, budgetOpts);
13252
+ const tierSummary = activeTierSummary(state.agentTree);
13194
13253
  const transcriptRows = altScreen ? computeTranscriptRows(termSize.rows, liveBudget, { ...budgetOpts, treeVisible: state.agentTree != null }) : 0;
13195
13254
  const transcriptLines = altScreen ? flattenTranscript(state.messages) : [];
13196
13255
  const transcript = altScreen ? windowTranscript(transcriptLines, historyOffset, transcriptRows) : null;
@@ -13280,10 +13339,28 @@ ${lastUser.content}`;
13280
13339
  onClose: () => setIsShowingModels(false)
13281
13340
  }
13282
13341
  ) }),
13283
- /* @__PURE__ */ jsxRuntime.jsx(AgentTree, { root: state.agentTree, theme, scrollOffset: treeScrollOffset, maxRows: liveBudget.treeMaxRows }),
13284
- state.showComms && liveBudget.commsMaxEvents > 0 && /* @__PURE__ */ jsxRuntime.jsx(PeerFeed, { events: state.peerEvents, theme, maxRows: liveBudget.commsMaxEvents }),
13285
- state.showDetails && liveBudget.showTimeline && /* @__PURE__ */ jsxRuntime.jsx(TimelinePanel, { nodes: [...treeNodesRef.current.values()], theme, currentIndex: timelineIndex, onChangeIndex: setTimelineIndex }),
13286
- state.showCost && /* @__PURE__ */ jsxRuntime.jsx(CostTracker, { theme, totalTokens: state.totalTokens, totalCostUsd: state.totalCostUsd, callsByProvider: state.callsByProvider, callsByTier: state.callsByTier, costByTier: state.costByTier, tokensByTier: state.tokensByTier, compact: liveBudget.costCompact, savedUsd: state.savedUsd, savedPct: state.savedPct }),
13342
+ adaptiveMode === "narrow" && state.agentTree ? /* @__PURE__ */ jsxRuntime.jsx(
13343
+ CompactStatus,
13344
+ {
13345
+ theme,
13346
+ activeT2Count: tierSummary.t2,
13347
+ activeT3Count: tierSummary.t3,
13348
+ currentAction: tierSummary.action ?? state.agentTree.currentAction,
13349
+ activeTool: state.activeTool,
13350
+ isStreaming: state.isStreaming
13351
+ }
13352
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
13353
+ AgentTree,
13354
+ {
13355
+ root: state.agentTree,
13356
+ theme,
13357
+ scrollOffset: treeScrollOffset,
13358
+ maxRows: adaptiveMode === "medium" ? Math.min(4, liveBudget.treeMaxRows) : liveBudget.treeMaxRows
13359
+ }
13360
+ ),
13361
+ adaptiveMode === "wide" && state.showComms && liveBudget.commsMaxEvents > 0 && /* @__PURE__ */ jsxRuntime.jsx(PeerFeed, { events: state.peerEvents, theme, maxRows: liveBudget.commsMaxEvents }),
13362
+ adaptiveMode === "wide" && state.showDetails && liveBudget.showTimeline && /* @__PURE__ */ jsxRuntime.jsx(TimelinePanel, { nodes: [...treeNodesRef.current.values()], theme, currentIndex: timelineIndex, onChangeIndex: setTimelineIndex }),
13363
+ adaptiveMode !== "narrow" && state.showCost && /* @__PURE__ */ jsxRuntime.jsx(CostTracker, { theme, totalTokens: state.totalTokens, totalCostUsd: state.totalCostUsd, callsByProvider: state.callsByProvider, callsByTier: state.callsByTier, costByTier: state.costByTier, tokensByTier: state.tokensByTier, compact: liveBudget.costCompact, savedUsd: state.savedUsd, savedPct: state.savedPct }),
13287
13364
  liveBudget.collapsed && (state.showCost || state.showDetails || state.agentTree != null) && /* @__PURE__ */ jsxRuntime.jsx(ink.Text, { color: theme.colors.muted, dimColor: true, children: " \u25B8 panels collapsed (small terminal)" }),
13288
13365
  state.approvalRequest && /* @__PURE__ */ jsxRuntime.jsx(ApprovalPrompt, { request: state.approvalRequest, theme, onDecision: (decision) => {
13289
13366
  dispatch({ type: "SET_APPROVAL", request: null });