cascade-ai 0.50.0 → 0.52.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
@@ -196,6 +196,18 @@ interface ToolExecuteOptions {
196
196
  tierId: string;
197
197
  sessionId: string;
198
198
  requireApproval: boolean;
199
+ /**
200
+ * Cancels a long-running tool call. Media generation can take a minute or
201
+ * more, so a cancelled run must be able to stop one mid-flight rather than
202
+ * paying it out and discarding the result.
203
+ */
204
+ signal?: AbortSignal;
205
+ /**
206
+ * Progress notes from a long-running tool. Video generation polls for minutes;
207
+ * without a channel back, a working render is indistinguishable from a hang —
208
+ * which is the most likely reason someone kills one.
209
+ */
210
+ onProgress?: (note: string) => void;
199
211
  saveSnapshot?: (filePath: string, content: string) => Promise<void>;
200
212
  sendPeerSync?: (to: string, syncType: PeerSyncType, content: string | Record<string, unknown>) => void;
201
213
  getPeerMessages?: () => Array<{
@@ -586,6 +598,12 @@ interface ToolsConfig {
586
598
  * behavior). An empty array registers no tools at all.
587
599
  */
588
600
  enabledTools?: string[];
601
+ /**
602
+ * Tools to remove even when they would otherwise be registered. Reaches
603
+ * tools registered outside `enabledTools` (MCP, media generation), which is
604
+ * the only way to switch those off.
605
+ */
606
+ disabledTools?: string[];
589
607
  }
590
608
  interface HooksConfig {
591
609
  preToolUse?: HookDefinition[];
@@ -647,6 +665,11 @@ interface BudgetConfig {
647
665
  maxTokensPerRun?: number;
648
666
  /** Optional hard per-task cost ceiling (USD). */
649
667
  maxCostPerRunUsd?: number;
668
+ /**
669
+ * Consecutive systemic failures against one model before the run stops
670
+ * launching work certain to fail the same way. Default 3.
671
+ */
672
+ failureThreshold?: number;
650
673
  warnAtPct: number;
651
674
  }
652
675
  interface WorkspaceConfig {
@@ -977,6 +1000,20 @@ declare class ModelPerformanceTracker {
977
1000
  costEfficiencyScore(model: ModelInfo, complexity: 1 | 2 | 3 | 4 | 5): number;
978
1001
  }
979
1002
 
1003
+ interface FeedbackCounts {
1004
+ good: number;
1005
+ bad: number;
1006
+ }
1007
+ /**
1008
+ * Lookup of per-model feedback, keyed by model id.
1009
+ *
1010
+ * Deliberately just counts: no conversation text, no prompts, no timestamps.
1011
+ * A routing prior needs to know that a model earned N good and M bad verdicts
1012
+ * and nothing else, and storing more would put chat content in a second place
1013
+ * with different retention rules for no gain.
1014
+ */
1015
+ type FeedbackSource = (modelId: string) => FeedbackCounts | undefined;
1016
+
980
1017
  type TaskType = 'code' | 'analysis' | 'creative' | 'data' | 'mixed';
981
1018
  /** Cascade Auto cost/quality trade-off bias. See CascadeConfig.autoBias. */
982
1019
  type AutoBias = 'balanced' | 'quality' | 'cost';
@@ -992,10 +1029,18 @@ interface TaskProfile {
992
1029
  }
993
1030
  declare class TaskAnalyzer {
994
1031
  private tracker?;
1032
+ /** Per-model thumbs counts, when the host collects them. */
1033
+ private feedback?;
995
1034
  private bias;
996
1035
  private lastProfile;
997
1036
  private lastSelectedModels;
998
1037
  constructor(tracker?: ModelPerformanceTracker, bias?: AutoBias);
1038
+ /**
1039
+ * Supply per-model rating counts. Optional by design: a host that collects no
1040
+ * feedback (the CLI, a fresh install) scores exactly as it did before, since
1041
+ * feedbackAdjustment returns 0 for an empty record.
1042
+ */
1043
+ setFeedbackSource(source: FeedbackSource): void;
999
1044
  setTracker(tracker: ModelPerformanceTracker): void;
1000
1045
  /** Change the cost/quality bias at runtime (e.g. when config reloads). */
1001
1046
  setBias(bias: AutoBias): void;
@@ -1463,6 +1508,7 @@ declare class CascadeRouter extends EventEmitter {
1463
1508
  private tpmLimiter;
1464
1509
  private localQueue;
1465
1510
  private taskAnalyzer?;
1511
+ private pendingFeedbackSource?;
1466
1512
  private worldStateDB?;
1467
1513
  private privacyPaths?;
1468
1514
  private guidanceQueue?;
@@ -1578,6 +1624,12 @@ declare class CascadeRouter extends EventEmitter {
1578
1624
  */
1579
1625
  getReferenceContextWindow(): number | undefined;
1580
1626
  /** Wire the Cascade Auto task analyzer used for per-subtask model routing. */
1627
+ /**
1628
+ * Feed per-model thumbs counts into Auto routing. Forwarded to the analyzer
1629
+ * because that is where the public benchmark score is combined; the prior
1630
+ * adjusts that number rather than sitting anywhere else in the pipeline.
1631
+ */
1632
+ setFeedbackSource(source: FeedbackSource): void;
1581
1633
  setTaskAnalyzer(analyzer: TaskAnalyzer): void;
1582
1634
  setWorldStateDB(db: WorldStateDB | undefined): void;
1583
1635
  getWorldStateDB(): WorldStateDB | undefined;
@@ -2142,6 +2194,24 @@ declare class T1Administrator extends BaseTier {
2142
2194
  private evaluatePermissionAtT1;
2143
2195
  }
2144
2196
 
2197
+ interface GeneratedAsset {
2198
+ /** Raw bytes of the asset. */
2199
+ data: Buffer;
2200
+ mimeType: string;
2201
+ /** Suggested filename, extension included. */
2202
+ filename: string;
2203
+ modelId: string;
2204
+ provider: string;
2205
+ /** Provider-side revision of the prompt, when it reports one (DALL·E does). */
2206
+ revisedPrompt?: string;
2207
+ }
2208
+
2209
+ /**
2210
+ * Where finished bytes go. Returns a short human-readable locator (a path, a
2211
+ * file id, a URL) that the tool reports back to the model.
2212
+ */
2213
+ type AssetSink = (asset: GeneratedAsset) => Promise<string>;
2214
+
2145
2215
  /** One entry in the per-run orchestration decision trail (see /why). */
2146
2216
  interface DecisionLogEntry {
2147
2217
  at: string;
@@ -2151,6 +2221,8 @@ interface DecisionLogEntry {
2151
2221
  declare class Cascade extends EventEmitter {
2152
2222
  private router;
2153
2223
  private toolRegistry;
2224
+ private multimodal;
2225
+ private mediaSink?;
2154
2226
  private mcpClient;
2155
2227
  private codeIndex?;
2156
2228
  private config;
@@ -2236,6 +2308,36 @@ declare class Cascade extends EventEmitter {
2236
2308
  * Idempotent init guard, so it works before the first run.
2237
2309
  */
2238
2310
  previewPlan(prompt: string): Promise<TaskPlan>;
2311
+ /**
2312
+ * Register image / speech / transcription tools for the modalities this
2313
+ * config can actually serve.
2314
+ *
2315
+ * The sink writes bytes into the workspace, because that is what a desktop or
2316
+ * CLI run wants and it keeps a generated asset indistinguishable from any
2317
+ * other file the run produced. A host with different storage (the cloud
2318
+ * server stores a file row) constructs the tools itself via buildMediaTools
2319
+ * with its own sink.
2320
+ */
2321
+ /**
2322
+ * Replace where generated media is written.
2323
+ *
2324
+ * The default sink writes into the workspace, which is what a desktop or CLI
2325
+ * run wants. A host with different storage — the cloud server keeps a file
2326
+ * row plus bytes under the tenant's directory — supplies its own here, and
2327
+ * the media tools are rebuilt around it. Re-registering by name replaces the
2328
+ * existing tools rather than duplicating them.
2329
+ */
2330
+ setMediaSink(sink: AssetSink): void;
2331
+ private registerMediaTools;
2332
+ /**
2333
+ * Supply per-model thumbs-up/down counts so Auto routing can weigh how models
2334
+ * have actually performed for this user, on top of public benchmarks.
2335
+ *
2336
+ * Optional everywhere: with no source, or an empty record, scoring is
2337
+ * byte-identical to before. The adjustment is capped and sample-size shrunk —
2338
+ * see core/router/feedback-prior.ts.
2339
+ */
2340
+ setFeedbackSource(source: FeedbackSource): void;
2239
2341
  /** True when a task stopped at the budget cap and can be resumed via /continue. */
2240
2342
  hasResumableRun(): boolean;
2241
2343
  /**
package/dist/index.d.ts CHANGED
@@ -196,6 +196,18 @@ interface ToolExecuteOptions {
196
196
  tierId: string;
197
197
  sessionId: string;
198
198
  requireApproval: boolean;
199
+ /**
200
+ * Cancels a long-running tool call. Media generation can take a minute or
201
+ * more, so a cancelled run must be able to stop one mid-flight rather than
202
+ * paying it out and discarding the result.
203
+ */
204
+ signal?: AbortSignal;
205
+ /**
206
+ * Progress notes from a long-running tool. Video generation polls for minutes;
207
+ * without a channel back, a working render is indistinguishable from a hang —
208
+ * which is the most likely reason someone kills one.
209
+ */
210
+ onProgress?: (note: string) => void;
199
211
  saveSnapshot?: (filePath: string, content: string) => Promise<void>;
200
212
  sendPeerSync?: (to: string, syncType: PeerSyncType, content: string | Record<string, unknown>) => void;
201
213
  getPeerMessages?: () => Array<{
@@ -586,6 +598,12 @@ interface ToolsConfig {
586
598
  * behavior). An empty array registers no tools at all.
587
599
  */
588
600
  enabledTools?: string[];
601
+ /**
602
+ * Tools to remove even when they would otherwise be registered. Reaches
603
+ * tools registered outside `enabledTools` (MCP, media generation), which is
604
+ * the only way to switch those off.
605
+ */
606
+ disabledTools?: string[];
589
607
  }
590
608
  interface HooksConfig {
591
609
  preToolUse?: HookDefinition[];
@@ -647,6 +665,11 @@ interface BudgetConfig {
647
665
  maxTokensPerRun?: number;
648
666
  /** Optional hard per-task cost ceiling (USD). */
649
667
  maxCostPerRunUsd?: number;
668
+ /**
669
+ * Consecutive systemic failures against one model before the run stops
670
+ * launching work certain to fail the same way. Default 3.
671
+ */
672
+ failureThreshold?: number;
650
673
  warnAtPct: number;
651
674
  }
652
675
  interface WorkspaceConfig {
@@ -977,6 +1000,20 @@ declare class ModelPerformanceTracker {
977
1000
  costEfficiencyScore(model: ModelInfo, complexity: 1 | 2 | 3 | 4 | 5): number;
978
1001
  }
979
1002
 
1003
+ interface FeedbackCounts {
1004
+ good: number;
1005
+ bad: number;
1006
+ }
1007
+ /**
1008
+ * Lookup of per-model feedback, keyed by model id.
1009
+ *
1010
+ * Deliberately just counts: no conversation text, no prompts, no timestamps.
1011
+ * A routing prior needs to know that a model earned N good and M bad verdicts
1012
+ * and nothing else, and storing more would put chat content in a second place
1013
+ * with different retention rules for no gain.
1014
+ */
1015
+ type FeedbackSource = (modelId: string) => FeedbackCounts | undefined;
1016
+
980
1017
  type TaskType = 'code' | 'analysis' | 'creative' | 'data' | 'mixed';
981
1018
  /** Cascade Auto cost/quality trade-off bias. See CascadeConfig.autoBias. */
982
1019
  type AutoBias = 'balanced' | 'quality' | 'cost';
@@ -992,10 +1029,18 @@ interface TaskProfile {
992
1029
  }
993
1030
  declare class TaskAnalyzer {
994
1031
  private tracker?;
1032
+ /** Per-model thumbs counts, when the host collects them. */
1033
+ private feedback?;
995
1034
  private bias;
996
1035
  private lastProfile;
997
1036
  private lastSelectedModels;
998
1037
  constructor(tracker?: ModelPerformanceTracker, bias?: AutoBias);
1038
+ /**
1039
+ * Supply per-model rating counts. Optional by design: a host that collects no
1040
+ * feedback (the CLI, a fresh install) scores exactly as it did before, since
1041
+ * feedbackAdjustment returns 0 for an empty record.
1042
+ */
1043
+ setFeedbackSource(source: FeedbackSource): void;
999
1044
  setTracker(tracker: ModelPerformanceTracker): void;
1000
1045
  /** Change the cost/quality bias at runtime (e.g. when config reloads). */
1001
1046
  setBias(bias: AutoBias): void;
@@ -1463,6 +1508,7 @@ declare class CascadeRouter extends EventEmitter {
1463
1508
  private tpmLimiter;
1464
1509
  private localQueue;
1465
1510
  private taskAnalyzer?;
1511
+ private pendingFeedbackSource?;
1466
1512
  private worldStateDB?;
1467
1513
  private privacyPaths?;
1468
1514
  private guidanceQueue?;
@@ -1578,6 +1624,12 @@ declare class CascadeRouter extends EventEmitter {
1578
1624
  */
1579
1625
  getReferenceContextWindow(): number | undefined;
1580
1626
  /** Wire the Cascade Auto task analyzer used for per-subtask model routing. */
1627
+ /**
1628
+ * Feed per-model thumbs counts into Auto routing. Forwarded to the analyzer
1629
+ * because that is where the public benchmark score is combined; the prior
1630
+ * adjusts that number rather than sitting anywhere else in the pipeline.
1631
+ */
1632
+ setFeedbackSource(source: FeedbackSource): void;
1581
1633
  setTaskAnalyzer(analyzer: TaskAnalyzer): void;
1582
1634
  setWorldStateDB(db: WorldStateDB | undefined): void;
1583
1635
  getWorldStateDB(): WorldStateDB | undefined;
@@ -2142,6 +2194,24 @@ declare class T1Administrator extends BaseTier {
2142
2194
  private evaluatePermissionAtT1;
2143
2195
  }
2144
2196
 
2197
+ interface GeneratedAsset {
2198
+ /** Raw bytes of the asset. */
2199
+ data: Buffer;
2200
+ mimeType: string;
2201
+ /** Suggested filename, extension included. */
2202
+ filename: string;
2203
+ modelId: string;
2204
+ provider: string;
2205
+ /** Provider-side revision of the prompt, when it reports one (DALL·E does). */
2206
+ revisedPrompt?: string;
2207
+ }
2208
+
2209
+ /**
2210
+ * Where finished bytes go. Returns a short human-readable locator (a path, a
2211
+ * file id, a URL) that the tool reports back to the model.
2212
+ */
2213
+ type AssetSink = (asset: GeneratedAsset) => Promise<string>;
2214
+
2145
2215
  /** One entry in the per-run orchestration decision trail (see /why). */
2146
2216
  interface DecisionLogEntry {
2147
2217
  at: string;
@@ -2151,6 +2221,8 @@ interface DecisionLogEntry {
2151
2221
  declare class Cascade extends EventEmitter {
2152
2222
  private router;
2153
2223
  private toolRegistry;
2224
+ private multimodal;
2225
+ private mediaSink?;
2154
2226
  private mcpClient;
2155
2227
  private codeIndex?;
2156
2228
  private config;
@@ -2236,6 +2308,36 @@ declare class Cascade extends EventEmitter {
2236
2308
  * Idempotent init guard, so it works before the first run.
2237
2309
  */
2238
2310
  previewPlan(prompt: string): Promise<TaskPlan>;
2311
+ /**
2312
+ * Register image / speech / transcription tools for the modalities this
2313
+ * config can actually serve.
2314
+ *
2315
+ * The sink writes bytes into the workspace, because that is what a desktop or
2316
+ * CLI run wants and it keeps a generated asset indistinguishable from any
2317
+ * other file the run produced. A host with different storage (the cloud
2318
+ * server stores a file row) constructs the tools itself via buildMediaTools
2319
+ * with its own sink.
2320
+ */
2321
+ /**
2322
+ * Replace where generated media is written.
2323
+ *
2324
+ * The default sink writes into the workspace, which is what a desktop or CLI
2325
+ * run wants. A host with different storage — the cloud server keeps a file
2326
+ * row plus bytes under the tenant's directory — supplies its own here, and
2327
+ * the media tools are rebuilt around it. Re-registering by name replaces the
2328
+ * existing tools rather than duplicating them.
2329
+ */
2330
+ setMediaSink(sink: AssetSink): void;
2331
+ private registerMediaTools;
2332
+ /**
2333
+ * Supply per-model thumbs-up/down counts so Auto routing can weigh how models
2334
+ * have actually performed for this user, on top of public benchmarks.
2335
+ *
2336
+ * Optional everywhere: with no source, or an empty record, scoring is
2337
+ * byte-identical to before. The adjustment is capped and sample-size shrunk —
2338
+ * see core/router/feedback-prior.ts.
2339
+ */
2340
+ setFeedbackSource(source: FeedbackSource): void;
2239
2341
  /** True when a task stopped at the budget cap and can be resumed via /continue. */
2240
2342
  hasResumableRun(): boolean;
2241
2343
  /**