cascade-ai 0.52.0 → 0.54.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.cjs +213 -20
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +213 -20
- package/dist/cli.js.map +1 -1
- package/dist/desktop-core.cjs +206 -25
- package/dist/index.cjs +204 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -10
- package/dist/index.d.ts +80 -10
- package/dist/index.js +204 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -904,6 +904,16 @@ declare class ModelSelector {
|
|
|
904
904
|
*/
|
|
905
905
|
private discovered;
|
|
906
906
|
constructor(availableProviders: Set<ProviderType>);
|
|
907
|
+
/**
|
|
908
|
+
* Verdicts from earlier runs about ids that 404 on this account. Consulted
|
|
909
|
+
* BEFORE a model enters the pool, which is the only placement that helps: a
|
|
910
|
+
* T3 wave runs concurrently, so filtering after the first failure still lets
|
|
911
|
+
* every other worker in the wave call the dead id.
|
|
912
|
+
*/
|
|
913
|
+
private deadModels?;
|
|
914
|
+
setDeadModelStore(store: {
|
|
915
|
+
isDead(provider: string, modelId: string): boolean;
|
|
916
|
+
}): void;
|
|
907
917
|
addDynamicModel(model: ModelInfo): void;
|
|
908
918
|
/** Record the ids a provider's API actually serves (discovery). Empty ⇒ ignored. */
|
|
909
919
|
setValidatedModels(provider: ProviderType, ids: string[]): void;
|
|
@@ -1077,6 +1087,60 @@ declare class TaskAnalyzer {
|
|
|
1077
1087
|
static clearCache(): void;
|
|
1078
1088
|
}
|
|
1079
1089
|
|
|
1090
|
+
interface DeadModelRecord {
|
|
1091
|
+
/** `provider:modelId` — the same key shape the failover event reports. */
|
|
1092
|
+
key: string;
|
|
1093
|
+
provider: string;
|
|
1094
|
+
modelId: string;
|
|
1095
|
+
/** Provider's own words, kept verbatim so the user can act on them. */
|
|
1096
|
+
reason: string;
|
|
1097
|
+
firstSeenAt: number;
|
|
1098
|
+
lastSeenAt: number;
|
|
1099
|
+
/** How many times this model has been found dead. */
|
|
1100
|
+
hits: number;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Where records live between runs. Desktop/CLI back this with a JSON file,
|
|
1104
|
+
* the cloud server with a per-user table. Both are synchronous-optional: a
|
|
1105
|
+
* store that fails to load must never stop a run.
|
|
1106
|
+
*/
|
|
1107
|
+
interface DeadModelPersistence {
|
|
1108
|
+
load(): DeadModelRecord[];
|
|
1109
|
+
save(records: DeadModelRecord[]): void;
|
|
1110
|
+
}
|
|
1111
|
+
declare class DeadModelStore {
|
|
1112
|
+
private persistence?;
|
|
1113
|
+
private records;
|
|
1114
|
+
private readonly ttlMs;
|
|
1115
|
+
private readonly now;
|
|
1116
|
+
constructor(persistence?: DeadModelPersistence | undefined, opts?: {
|
|
1117
|
+
ttlMs?: number;
|
|
1118
|
+
now?: () => number;
|
|
1119
|
+
});
|
|
1120
|
+
private restore;
|
|
1121
|
+
private isExpired;
|
|
1122
|
+
private flush;
|
|
1123
|
+
/**
|
|
1124
|
+
* Record that a model was found dead. Returns true when this is the first
|
|
1125
|
+
* time (so the caller can log it once rather than once per concurrent
|
|
1126
|
+
* worker in the wave that discovered it).
|
|
1127
|
+
*/
|
|
1128
|
+
record(provider: string, modelId: string, reason: string): boolean;
|
|
1129
|
+
/** True when this model is known dead and the verdict has not expired. */
|
|
1130
|
+
isDead(provider: string, modelId: string): boolean;
|
|
1131
|
+
/** Why a model is considered dead, for /why and the models command. */
|
|
1132
|
+
reasonFor(provider: string, modelId: string): string | null;
|
|
1133
|
+
/** Live records, expired ones filtered out. */
|
|
1134
|
+
list(): DeadModelRecord[];
|
|
1135
|
+
/**
|
|
1136
|
+
* Forget a verdict — used when the user fixes the underlying problem (adds
|
|
1137
|
+
* the model to their project, gets quota) and wants it retried now rather
|
|
1138
|
+
* than after the TTL.
|
|
1139
|
+
*/
|
|
1140
|
+
forget(provider: string, modelId: string): boolean;
|
|
1141
|
+
clear(): void;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1080
1144
|
declare class MemoryStore {
|
|
1081
1145
|
private db;
|
|
1082
1146
|
constructor(dbPath: string);
|
|
@@ -1509,6 +1573,19 @@ declare class CascadeRouter extends EventEmitter {
|
|
|
1509
1573
|
private localQueue;
|
|
1510
1574
|
private taskAnalyzer?;
|
|
1511
1575
|
private pendingFeedbackSource?;
|
|
1576
|
+
/** Models known dead for this account (404 / retired / not enabled). */
|
|
1577
|
+
private deadModels;
|
|
1578
|
+
/**
|
|
1579
|
+
* Back the dead-model memory with durable storage (a JSON file on desktop, a
|
|
1580
|
+
* per-user table in the cloud). Without one the verdicts still work, but only
|
|
1581
|
+
* for the life of the process — so tomorrow's run pays the same wave of 404s
|
|
1582
|
+
* to learn the same fact.
|
|
1583
|
+
*/
|
|
1584
|
+
setDeadModelStore(store: DeadModelStore): void;
|
|
1585
|
+
/** Models known dead for this account, for `cascade models` and /why. */
|
|
1586
|
+
listDeadModels(): ReturnType<DeadModelStore['list']>;
|
|
1587
|
+
/** Retry a model the user has since fixed, without waiting out the TTL. */
|
|
1588
|
+
forgetDeadModel(provider: string, modelId: string): boolean;
|
|
1512
1589
|
private worldStateDB?;
|
|
1513
1590
|
private privacyPaths?;
|
|
1514
1591
|
private guidanceQueue?;
|
|
@@ -3797,15 +3874,8 @@ declare class CascadeToolError extends Error {
|
|
|
3797
3874
|
declare function preferIpv4Host(url: string | undefined): string | undefined;
|
|
3798
3875
|
declare function nodeHttpFetch(input: string | URL | Request, init?: RequestInit, redirectCount?: number): Promise<Response>;
|
|
3799
3876
|
|
|
3800
|
-
/**
|
|
3801
|
-
|
|
3802
|
-
* its (arbitrary) deployment name. Ordered most-specific → least so "gpt-5-mini"
|
|
3803
|
-
* doesn't match the "gpt-5" base. Distinct point releases (gpt-5.5, gpt-5.4,
|
|
3804
|
-
* gpt-5.4-mini) resolve to their OWN base so their real economics + benchmark
|
|
3805
|
-
* scores apply — only unrecognised gpt-5.x fold into the gpt-5 base.
|
|
3806
|
-
* Returns null when the name gives no signal (e.g. "prod-fast") — the caller
|
|
3807
|
-
* then keeps neutral defaults, or the user can set an explicit base model.
|
|
3808
|
-
*/
|
|
3877
|
+
/** Selectable base models, in the order a picker should show them. */
|
|
3878
|
+
declare const AZURE_BASE_MODELS: readonly string[];
|
|
3809
3879
|
declare function inferAzureBaseModel(deploymentName: string): string | null;
|
|
3810
3880
|
/**
|
|
3811
3881
|
* The ModelInfo for one configured Azure deployment. On Azure the deployment IS
|
|
@@ -4004,4 +4074,4 @@ declare function gatherSyncBundle(config: CascadeConfig): SyncBundle;
|
|
|
4004
4074
|
/** Merge a pulled bundle into a config, returning the updated config to persist. */
|
|
4005
4075
|
declare function applySyncBundle(bundle: SyncBundle, config: CascadeConfig): CascadeConfig;
|
|
4006
4076
|
|
|
4007
|
-
export { AZURE_BASE_URL_TEMPLATE, type ApprovalRequest, type ApprovalResponse, type AuditEntry, AuditLogger, type BenchmarksConfig, type BudgetConfig, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, type CascadeConfig, type CascadeEvent, type CascadeEventType, CascadeIgnore, type CascadeMessage, CascadeRouter, type CascadeRunOptions, type CascadeRunResult, type CascadeThemeName, CascadeToolError, type Chunk, type ChunkOptions, CloudClient, type CloudConversation, type CloudMessage, type CloudSession, type CloudSessionStore, type CloudTurnInput, type CloudUser, type CodeChunkOptions, type CodeChunker, CodeSearchTool, type CompleteFn, ConfigManager, type ConversationMessage, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, type DashboardConfig, DashboardServer, type DeviceStart, type DistilledFact, type Embedder, type EncryptedBlob, type EscalationPayload, type ExtendedContextConfig, type FileManifest, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, type GenerateOptions, type GenerateResult, type GraphFactSource, GraphRetriever, type GraphSearchOptions, GraphSearchTool, type HookDefinition, type HooksConfig, HooksRunner, type Identity, type ImageAttachment, Keystore, LLMReranker, LM_STUDIO_BASE_URL, type LegacyThemeName, MODELS, type ManifestDiff, McpClient, McpOAuthProvider, type McpOAuthState, type McpOAuthStore, type McpServerConfig$1 as McpServerConfig, type MemoryConfig, MemoryStore, type Message, type MessageContent, type MessagePayload, type MessageStatus, type MessageType, type ModelInfo, type ModelOverrides, type NativeProvider, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, type OpenAIEmbedderOptions, PROVIDER_DISPLAY_NAMES, type PeerMessage, type PeerMessageEvent, type PeerSyncPayload, type PeerSyncType, type PermissionDecision, type PermissionDecisionPayload, type PermissionRequest, type PermissionTrailEntry, type PlanReviewConfig, type ProviderConfig, type ProviderType, type RankedFact, type RefreshResult, type Reranker, type RetrievalContext, type RetrievalMode, type RetrievalPlan, Retriever, type RetrieverSearchOptions, type RuntimeNode, type RuntimeNodeLog, type RuntimeRefreshPayload, type RuntimeScope, type RuntimeSession, type RuntimeSnapshotPayload, type ScheduledTask, type ScoredChunk, type SearchOptions, type Session, type SessionCheckpoint, type SessionMetadata, type SessionSubscriptionPayload, SqliteVectorStore, type StatusUpdate, type StoredMessage, type StreamChunk, type SyncBundle, T1Administrator, type T1ToT2Assignment, T1_MODEL_PRIORITY, T2Manager, type T2Result, type T2ToT3Assignment, T2_MODEL_PRIORITY, type T3Result, type T3ResultPayload, type T3SubtaskSpec, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, type TaskComplexity, TaskScheduler, Telemetry, type TelemetryConfig, type Theme, type ThemeColors, type ThemeName, type TierConfig, type TierLimits, type TierRole, type TierStatus, type TokenUsage, type ToolCall, type ToolDefinition, type ToolExecuteOptions, ToolRegistry, type ToolResult, type ToolsConfig, VISION_MODEL_PRIORITY, type VectorStore, type WebSearchConfig, type WebhookConfig, type WorkspaceConfig, WorkspaceIndex, type WorkspaceIndexOptions, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildManifest, buildSessionTranscript, cagCharBudget, chatCompleterFromProviders, chunkCode, chunkText, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, decryptJSON as decryptSyncBlob, diffManifest, discoverMcpAuthServer, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, fileOAuthProvider, gatherSyncBundle, hashContent, heuristicCodeChunker, inferAzureBaseModel, nodeHttpFetch, parseRankOrder, planRetrieval, preferIpv4Host, reciprocalRankFusion, refreshMcpToken, runCascade, sessionWorthRemembering, streamCascade };
|
|
4077
|
+
export { AZURE_BASE_MODELS, AZURE_BASE_URL_TEMPLATE, type ApprovalRequest, type ApprovalResponse, type AuditEntry, AuditLogger, type BenchmarksConfig, type BudgetConfig, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, type CascadeConfig, type CascadeEvent, type CascadeEventType, CascadeIgnore, type CascadeMessage, CascadeRouter, type CascadeRunOptions, type CascadeRunResult, type CascadeThemeName, CascadeToolError, type Chunk, type ChunkOptions, CloudClient, type CloudConversation, type CloudMessage, type CloudSession, type CloudSessionStore, type CloudTurnInput, type CloudUser, type CodeChunkOptions, type CodeChunker, CodeSearchTool, type CompleteFn, ConfigManager, type ConversationMessage, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, type DashboardConfig, DashboardServer, type DeviceStart, type DistilledFact, type Embedder, type EncryptedBlob, type EscalationPayload, type ExtendedContextConfig, type FileManifest, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, type GenerateOptions, type GenerateResult, type GraphFactSource, GraphRetriever, type GraphSearchOptions, GraphSearchTool, type HookDefinition, type HooksConfig, HooksRunner, type Identity, type ImageAttachment, Keystore, LLMReranker, LM_STUDIO_BASE_URL, type LegacyThemeName, MODELS, type ManifestDiff, McpClient, McpOAuthProvider, type McpOAuthState, type McpOAuthStore, type McpServerConfig$1 as McpServerConfig, type MemoryConfig, MemoryStore, type Message, type MessageContent, type MessagePayload, type MessageStatus, type MessageType, type ModelInfo, type ModelOverrides, type NativeProvider, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, type OpenAIEmbedderOptions, PROVIDER_DISPLAY_NAMES, type PeerMessage, type PeerMessageEvent, type PeerSyncPayload, type PeerSyncType, type PermissionDecision, type PermissionDecisionPayload, type PermissionRequest, type PermissionTrailEntry, type PlanReviewConfig, type ProviderConfig, type ProviderType, type RankedFact, type RefreshResult, type Reranker, type RetrievalContext, type RetrievalMode, type RetrievalPlan, Retriever, type RetrieverSearchOptions, type RuntimeNode, type RuntimeNodeLog, type RuntimeRefreshPayload, type RuntimeScope, type RuntimeSession, type RuntimeSnapshotPayload, type ScheduledTask, type ScoredChunk, type SearchOptions, type Session, type SessionCheckpoint, type SessionMetadata, type SessionSubscriptionPayload, SqliteVectorStore, type StatusUpdate, type StoredMessage, type StreamChunk, type SyncBundle, T1Administrator, type T1ToT2Assignment, T1_MODEL_PRIORITY, T2Manager, type T2Result, type T2ToT3Assignment, T2_MODEL_PRIORITY, type T3Result, type T3ResultPayload, type T3SubtaskSpec, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, type TaskComplexity, TaskScheduler, Telemetry, type TelemetryConfig, type Theme, type ThemeColors, type ThemeName, type TierConfig, type TierLimits, type TierRole, type TierStatus, type TokenUsage, type ToolCall, type ToolDefinition, type ToolExecuteOptions, ToolRegistry, type ToolResult, type ToolsConfig, VISION_MODEL_PRIORITY, type VectorStore, type WebSearchConfig, type WebhookConfig, type WorkspaceConfig, WorkspaceIndex, type WorkspaceIndexOptions, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildManifest, buildSessionTranscript, cagCharBudget, chatCompleterFromProviders, chunkCode, chunkText, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, decryptJSON as decryptSyncBlob, diffManifest, discoverMcpAuthServer, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, fileOAuthProvider, gatherSyncBundle, hashContent, heuristicCodeChunker, inferAzureBaseModel, nodeHttpFetch, parseRankOrder, planRetrieval, preferIpv4Host, reciprocalRankFusion, refreshMcpToken, runCascade, sessionWorthRemembering, streamCascade };
|
package/dist/index.d.ts
CHANGED
|
@@ -904,6 +904,16 @@ declare class ModelSelector {
|
|
|
904
904
|
*/
|
|
905
905
|
private discovered;
|
|
906
906
|
constructor(availableProviders: Set<ProviderType>);
|
|
907
|
+
/**
|
|
908
|
+
* Verdicts from earlier runs about ids that 404 on this account. Consulted
|
|
909
|
+
* BEFORE a model enters the pool, which is the only placement that helps: a
|
|
910
|
+
* T3 wave runs concurrently, so filtering after the first failure still lets
|
|
911
|
+
* every other worker in the wave call the dead id.
|
|
912
|
+
*/
|
|
913
|
+
private deadModels?;
|
|
914
|
+
setDeadModelStore(store: {
|
|
915
|
+
isDead(provider: string, modelId: string): boolean;
|
|
916
|
+
}): void;
|
|
907
917
|
addDynamicModel(model: ModelInfo): void;
|
|
908
918
|
/** Record the ids a provider's API actually serves (discovery). Empty ⇒ ignored. */
|
|
909
919
|
setValidatedModels(provider: ProviderType, ids: string[]): void;
|
|
@@ -1077,6 +1087,60 @@ declare class TaskAnalyzer {
|
|
|
1077
1087
|
static clearCache(): void;
|
|
1078
1088
|
}
|
|
1079
1089
|
|
|
1090
|
+
interface DeadModelRecord {
|
|
1091
|
+
/** `provider:modelId` — the same key shape the failover event reports. */
|
|
1092
|
+
key: string;
|
|
1093
|
+
provider: string;
|
|
1094
|
+
modelId: string;
|
|
1095
|
+
/** Provider's own words, kept verbatim so the user can act on them. */
|
|
1096
|
+
reason: string;
|
|
1097
|
+
firstSeenAt: number;
|
|
1098
|
+
lastSeenAt: number;
|
|
1099
|
+
/** How many times this model has been found dead. */
|
|
1100
|
+
hits: number;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Where records live between runs. Desktop/CLI back this with a JSON file,
|
|
1104
|
+
* the cloud server with a per-user table. Both are synchronous-optional: a
|
|
1105
|
+
* store that fails to load must never stop a run.
|
|
1106
|
+
*/
|
|
1107
|
+
interface DeadModelPersistence {
|
|
1108
|
+
load(): DeadModelRecord[];
|
|
1109
|
+
save(records: DeadModelRecord[]): void;
|
|
1110
|
+
}
|
|
1111
|
+
declare class DeadModelStore {
|
|
1112
|
+
private persistence?;
|
|
1113
|
+
private records;
|
|
1114
|
+
private readonly ttlMs;
|
|
1115
|
+
private readonly now;
|
|
1116
|
+
constructor(persistence?: DeadModelPersistence | undefined, opts?: {
|
|
1117
|
+
ttlMs?: number;
|
|
1118
|
+
now?: () => number;
|
|
1119
|
+
});
|
|
1120
|
+
private restore;
|
|
1121
|
+
private isExpired;
|
|
1122
|
+
private flush;
|
|
1123
|
+
/**
|
|
1124
|
+
* Record that a model was found dead. Returns true when this is the first
|
|
1125
|
+
* time (so the caller can log it once rather than once per concurrent
|
|
1126
|
+
* worker in the wave that discovered it).
|
|
1127
|
+
*/
|
|
1128
|
+
record(provider: string, modelId: string, reason: string): boolean;
|
|
1129
|
+
/** True when this model is known dead and the verdict has not expired. */
|
|
1130
|
+
isDead(provider: string, modelId: string): boolean;
|
|
1131
|
+
/** Why a model is considered dead, for /why and the models command. */
|
|
1132
|
+
reasonFor(provider: string, modelId: string): string | null;
|
|
1133
|
+
/** Live records, expired ones filtered out. */
|
|
1134
|
+
list(): DeadModelRecord[];
|
|
1135
|
+
/**
|
|
1136
|
+
* Forget a verdict — used when the user fixes the underlying problem (adds
|
|
1137
|
+
* the model to their project, gets quota) and wants it retried now rather
|
|
1138
|
+
* than after the TTL.
|
|
1139
|
+
*/
|
|
1140
|
+
forget(provider: string, modelId: string): boolean;
|
|
1141
|
+
clear(): void;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1080
1144
|
declare class MemoryStore {
|
|
1081
1145
|
private db;
|
|
1082
1146
|
constructor(dbPath: string);
|
|
@@ -1509,6 +1573,19 @@ declare class CascadeRouter extends EventEmitter {
|
|
|
1509
1573
|
private localQueue;
|
|
1510
1574
|
private taskAnalyzer?;
|
|
1511
1575
|
private pendingFeedbackSource?;
|
|
1576
|
+
/** Models known dead for this account (404 / retired / not enabled). */
|
|
1577
|
+
private deadModels;
|
|
1578
|
+
/**
|
|
1579
|
+
* Back the dead-model memory with durable storage (a JSON file on desktop, a
|
|
1580
|
+
* per-user table in the cloud). Without one the verdicts still work, but only
|
|
1581
|
+
* for the life of the process — so tomorrow's run pays the same wave of 404s
|
|
1582
|
+
* to learn the same fact.
|
|
1583
|
+
*/
|
|
1584
|
+
setDeadModelStore(store: DeadModelStore): void;
|
|
1585
|
+
/** Models known dead for this account, for `cascade models` and /why. */
|
|
1586
|
+
listDeadModels(): ReturnType<DeadModelStore['list']>;
|
|
1587
|
+
/** Retry a model the user has since fixed, without waiting out the TTL. */
|
|
1588
|
+
forgetDeadModel(provider: string, modelId: string): boolean;
|
|
1512
1589
|
private worldStateDB?;
|
|
1513
1590
|
private privacyPaths?;
|
|
1514
1591
|
private guidanceQueue?;
|
|
@@ -3797,15 +3874,8 @@ declare class CascadeToolError extends Error {
|
|
|
3797
3874
|
declare function preferIpv4Host(url: string | undefined): string | undefined;
|
|
3798
3875
|
declare function nodeHttpFetch(input: string | URL | Request, init?: RequestInit, redirectCount?: number): Promise<Response>;
|
|
3799
3876
|
|
|
3800
|
-
/**
|
|
3801
|
-
|
|
3802
|
-
* its (arbitrary) deployment name. Ordered most-specific → least so "gpt-5-mini"
|
|
3803
|
-
* doesn't match the "gpt-5" base. Distinct point releases (gpt-5.5, gpt-5.4,
|
|
3804
|
-
* gpt-5.4-mini) resolve to their OWN base so their real economics + benchmark
|
|
3805
|
-
* scores apply — only unrecognised gpt-5.x fold into the gpt-5 base.
|
|
3806
|
-
* Returns null when the name gives no signal (e.g. "prod-fast") — the caller
|
|
3807
|
-
* then keeps neutral defaults, or the user can set an explicit base model.
|
|
3808
|
-
*/
|
|
3877
|
+
/** Selectable base models, in the order a picker should show them. */
|
|
3878
|
+
declare const AZURE_BASE_MODELS: readonly string[];
|
|
3809
3879
|
declare function inferAzureBaseModel(deploymentName: string): string | null;
|
|
3810
3880
|
/**
|
|
3811
3881
|
* The ModelInfo for one configured Azure deployment. On Azure the deployment IS
|
|
@@ -4004,4 +4074,4 @@ declare function gatherSyncBundle(config: CascadeConfig): SyncBundle;
|
|
|
4004
4074
|
/** Merge a pulled bundle into a config, returning the updated config to persist. */
|
|
4005
4075
|
declare function applySyncBundle(bundle: SyncBundle, config: CascadeConfig): CascadeConfig;
|
|
4006
4076
|
|
|
4007
|
-
export { AZURE_BASE_URL_TEMPLATE, type ApprovalRequest, type ApprovalResponse, type AuditEntry, AuditLogger, type BenchmarksConfig, type BudgetConfig, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, type CascadeConfig, type CascadeEvent, type CascadeEventType, CascadeIgnore, type CascadeMessage, CascadeRouter, type CascadeRunOptions, type CascadeRunResult, type CascadeThemeName, CascadeToolError, type Chunk, type ChunkOptions, CloudClient, type CloudConversation, type CloudMessage, type CloudSession, type CloudSessionStore, type CloudTurnInput, type CloudUser, type CodeChunkOptions, type CodeChunker, CodeSearchTool, type CompleteFn, ConfigManager, type ConversationMessage, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, type DashboardConfig, DashboardServer, type DeviceStart, type DistilledFact, type Embedder, type EncryptedBlob, type EscalationPayload, type ExtendedContextConfig, type FileManifest, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, type GenerateOptions, type GenerateResult, type GraphFactSource, GraphRetriever, type GraphSearchOptions, GraphSearchTool, type HookDefinition, type HooksConfig, HooksRunner, type Identity, type ImageAttachment, Keystore, LLMReranker, LM_STUDIO_BASE_URL, type LegacyThemeName, MODELS, type ManifestDiff, McpClient, McpOAuthProvider, type McpOAuthState, type McpOAuthStore, type McpServerConfig$1 as McpServerConfig, type MemoryConfig, MemoryStore, type Message, type MessageContent, type MessagePayload, type MessageStatus, type MessageType, type ModelInfo, type ModelOverrides, type NativeProvider, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, type OpenAIEmbedderOptions, PROVIDER_DISPLAY_NAMES, type PeerMessage, type PeerMessageEvent, type PeerSyncPayload, type PeerSyncType, type PermissionDecision, type PermissionDecisionPayload, type PermissionRequest, type PermissionTrailEntry, type PlanReviewConfig, type ProviderConfig, type ProviderType, type RankedFact, type RefreshResult, type Reranker, type RetrievalContext, type RetrievalMode, type RetrievalPlan, Retriever, type RetrieverSearchOptions, type RuntimeNode, type RuntimeNodeLog, type RuntimeRefreshPayload, type RuntimeScope, type RuntimeSession, type RuntimeSnapshotPayload, type ScheduledTask, type ScoredChunk, type SearchOptions, type Session, type SessionCheckpoint, type SessionMetadata, type SessionSubscriptionPayload, SqliteVectorStore, type StatusUpdate, type StoredMessage, type StreamChunk, type SyncBundle, T1Administrator, type T1ToT2Assignment, T1_MODEL_PRIORITY, T2Manager, type T2Result, type T2ToT3Assignment, T2_MODEL_PRIORITY, type T3Result, type T3ResultPayload, type T3SubtaskSpec, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, type TaskComplexity, TaskScheduler, Telemetry, type TelemetryConfig, type Theme, type ThemeColors, type ThemeName, type TierConfig, type TierLimits, type TierRole, type TierStatus, type TokenUsage, type ToolCall, type ToolDefinition, type ToolExecuteOptions, ToolRegistry, type ToolResult, type ToolsConfig, VISION_MODEL_PRIORITY, type VectorStore, type WebSearchConfig, type WebhookConfig, type WorkspaceConfig, WorkspaceIndex, type WorkspaceIndexOptions, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildManifest, buildSessionTranscript, cagCharBudget, chatCompleterFromProviders, chunkCode, chunkText, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, decryptJSON as decryptSyncBlob, diffManifest, discoverMcpAuthServer, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, fileOAuthProvider, gatherSyncBundle, hashContent, heuristicCodeChunker, inferAzureBaseModel, nodeHttpFetch, parseRankOrder, planRetrieval, preferIpv4Host, reciprocalRankFusion, refreshMcpToken, runCascade, sessionWorthRemembering, streamCascade };
|
|
4077
|
+
export { AZURE_BASE_MODELS, AZURE_BASE_URL_TEMPLATE, type ApprovalRequest, type ApprovalResponse, type AuditEntry, AuditLogger, type BenchmarksConfig, type BudgetConfig, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, type CascadeConfig, type CascadeEvent, type CascadeEventType, CascadeIgnore, type CascadeMessage, CascadeRouter, type CascadeRunOptions, type CascadeRunResult, type CascadeThemeName, CascadeToolError, type Chunk, type ChunkOptions, CloudClient, type CloudConversation, type CloudMessage, type CloudSession, type CloudSessionStore, type CloudTurnInput, type CloudUser, type CodeChunkOptions, type CodeChunker, CodeSearchTool, type CompleteFn, ConfigManager, type ConversationMessage, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, type DashboardConfig, DashboardServer, type DeviceStart, type DistilledFact, type Embedder, type EncryptedBlob, type EscalationPayload, type ExtendedContextConfig, type FileManifest, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, type GenerateOptions, type GenerateResult, type GraphFactSource, GraphRetriever, type GraphSearchOptions, GraphSearchTool, type HookDefinition, type HooksConfig, HooksRunner, type Identity, type ImageAttachment, Keystore, LLMReranker, LM_STUDIO_BASE_URL, type LegacyThemeName, MODELS, type ManifestDiff, McpClient, McpOAuthProvider, type McpOAuthState, type McpOAuthStore, type McpServerConfig$1 as McpServerConfig, type MemoryConfig, MemoryStore, type Message, type MessageContent, type MessagePayload, type MessageStatus, type MessageType, type ModelInfo, type ModelOverrides, type NativeProvider, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, type OpenAIEmbedderOptions, PROVIDER_DISPLAY_NAMES, type PeerMessage, type PeerMessageEvent, type PeerSyncPayload, type PeerSyncType, type PermissionDecision, type PermissionDecisionPayload, type PermissionRequest, type PermissionTrailEntry, type PlanReviewConfig, type ProviderConfig, type ProviderType, type RankedFact, type RefreshResult, type Reranker, type RetrievalContext, type RetrievalMode, type RetrievalPlan, Retriever, type RetrieverSearchOptions, type RuntimeNode, type RuntimeNodeLog, type RuntimeRefreshPayload, type RuntimeScope, type RuntimeSession, type RuntimeSnapshotPayload, type ScheduledTask, type ScoredChunk, type SearchOptions, type Session, type SessionCheckpoint, type SessionMetadata, type SessionSubscriptionPayload, SqliteVectorStore, type StatusUpdate, type StoredMessage, type StreamChunk, type SyncBundle, T1Administrator, type T1ToT2Assignment, T1_MODEL_PRIORITY, T2Manager, type T2Result, type T2ToT3Assignment, T2_MODEL_PRIORITY, type T3Result, type T3ResultPayload, type T3SubtaskSpec, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, type TaskComplexity, TaskScheduler, Telemetry, type TelemetryConfig, type Theme, type ThemeColors, type ThemeName, type TierConfig, type TierLimits, type TierRole, type TierStatus, type TokenUsage, type ToolCall, type ToolDefinition, type ToolExecuteOptions, ToolRegistry, type ToolResult, type ToolsConfig, VISION_MODEL_PRIORITY, type VectorStore, type WebSearchConfig, type WebhookConfig, type WorkspaceConfig, WorkspaceIndex, type WorkspaceIndexOptions, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildManifest, buildSessionTranscript, cagCharBudget, chatCompleterFromProviders, chunkCode, chunkText, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, decryptJSON as decryptSyncBlob, diffManifest, discoverMcpAuthServer, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, fileOAuthProvider, gatherSyncBundle, hashContent, heuristicCodeChunker, inferAzureBaseModel, nodeHttpFetch, parseRankOrder, planRetrieval, preferIpv4Host, reciprocalRankFusion, refreshMcpToken, runCascade, sessionWorthRemembering, streamCascade };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,12 @@ import cron from 'node-cron';
|
|
|
41
41
|
// Cascade AI — Multi-tier AI Orchestration System
|
|
42
42
|
var __defProp = Object.defineProperty;
|
|
43
43
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
44
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
45
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
46
|
+
}) : x)(function(x) {
|
|
47
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
48
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
49
|
+
});
|
|
44
50
|
var __esm = (fn, res) => function __init() {
|
|
45
51
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
46
52
|
};
|
|
@@ -1845,7 +1851,7 @@ function reconcilePrice(model, live) {
|
|
|
1845
1851
|
}
|
|
1846
1852
|
|
|
1847
1853
|
// src/constants.ts
|
|
1848
|
-
var CASCADE_VERSION = "0.
|
|
1854
|
+
var CASCADE_VERSION = "0.54.0";
|
|
1849
1855
|
var CASCADE_CONFIG_DIR = ".cascade";
|
|
1850
1856
|
var CASCADE_MD_FILE = "CASCADE.md";
|
|
1851
1857
|
var CASCADE_IGNORE_FILE = ".cascadeignore";
|
|
@@ -2810,22 +2816,23 @@ var OpenAIProvider = class extends BaseProvider {
|
|
|
2810
2816
|
|
|
2811
2817
|
// src/providers/azure.ts
|
|
2812
2818
|
var DEFAULT_AZURE_API_VERSION = "2024-12-01-preview";
|
|
2819
|
+
var AZURE_BASE_MODEL_RULES = [
|
|
2820
|
+
[/gpt-?5\.5/, "gpt-5.5"],
|
|
2821
|
+
[/gpt-?5\.4.*mini/, "gpt-5.4-mini"],
|
|
2822
|
+
[/gpt-?5\.4/, "gpt-5.4"],
|
|
2823
|
+
[/gpt-?5.*nano/, "gpt-5-nano"],
|
|
2824
|
+
[/gpt-?5.*mini/, "gpt-5-mini"],
|
|
2825
|
+
[/gpt-?5/, "gpt-5"],
|
|
2826
|
+
[/gpt-?4\.1-nano/, "gpt-4.1-nano"],
|
|
2827
|
+
[/gpt-?4\.1-mini/, "gpt-4.1-mini"],
|
|
2828
|
+
[/gpt-?4\.1/, "gpt-4.1"],
|
|
2829
|
+
[/gpt-?4o-mini/, "gpt-4o-mini"],
|
|
2830
|
+
[/gpt-?4o/, "gpt-4o"]
|
|
2831
|
+
];
|
|
2832
|
+
var AZURE_BASE_MODELS = AZURE_BASE_MODEL_RULES.map(([, id]) => id);
|
|
2813
2833
|
function inferAzureBaseModel(deploymentName) {
|
|
2814
2834
|
const n = deploymentName.toLowerCase();
|
|
2815
|
-
const
|
|
2816
|
-
[/gpt-?5\.5/, "gpt-5.5"],
|
|
2817
|
-
[/gpt-?5\.4.*mini/, "gpt-5.4-mini"],
|
|
2818
|
-
[/gpt-?5\.4/, "gpt-5.4"],
|
|
2819
|
-
[/gpt-?5.*nano/, "gpt-5-nano"],
|
|
2820
|
-
[/gpt-?5.*mini/, "gpt-5-mini"],
|
|
2821
|
-
[/gpt-?5/, "gpt-5"],
|
|
2822
|
-
[/gpt-?4\.1-nano/, "gpt-4.1-nano"],
|
|
2823
|
-
[/gpt-?4\.1-mini/, "gpt-4.1-mini"],
|
|
2824
|
-
[/gpt-?4\.1/, "gpt-4.1"],
|
|
2825
|
-
[/gpt-?4o-mini/, "gpt-4o-mini"],
|
|
2826
|
-
[/gpt-?4o/, "gpt-4o"]
|
|
2827
|
-
];
|
|
2828
|
-
for (const [re, base] of rules) if (re.test(n)) return base;
|
|
2835
|
+
for (const [re, base] of AZURE_BASE_MODEL_RULES) if (re.test(n)) return base;
|
|
2829
2836
|
return null;
|
|
2830
2837
|
}
|
|
2831
2838
|
function azureModelForDeployment(cfg) {
|
|
@@ -3657,7 +3664,21 @@ var ModelSelector = class {
|
|
|
3657
3664
|
this.availableProviders = availableProviders;
|
|
3658
3665
|
this.availableModels = new Map(Object.entries(MODELS));
|
|
3659
3666
|
}
|
|
3667
|
+
/**
|
|
3668
|
+
* Verdicts from earlier runs about ids that 404 on this account. Consulted
|
|
3669
|
+
* BEFORE a model enters the pool, which is the only placement that helps: a
|
|
3670
|
+
* T3 wave runs concurrently, so filtering after the first failure still lets
|
|
3671
|
+
* every other worker in the wave call the dead id.
|
|
3672
|
+
*/
|
|
3673
|
+
deadModels;
|
|
3674
|
+
setDeadModelStore(store) {
|
|
3675
|
+
this.deadModels = store;
|
|
3676
|
+
for (const [id, m] of [...this.availableModels]) {
|
|
3677
|
+
if (this.deadModels.isDead(m.provider, m.id)) this.availableModels.delete(id);
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3660
3680
|
addDynamicModel(model) {
|
|
3681
|
+
if (this.deadModels?.isDead(model.provider, model.id)) return;
|
|
3661
3682
|
this.availableModels.set(model.id, model);
|
|
3662
3683
|
if (!(model.id in MODELS)) this.discovered.add(normalizeModelId(model.id));
|
|
3663
3684
|
}
|
|
@@ -4064,6 +4085,121 @@ var LocalRequestQueue = class {
|
|
|
4064
4085
|
}
|
|
4065
4086
|
};
|
|
4066
4087
|
|
|
4088
|
+
// src/core/router/dead-models.ts
|
|
4089
|
+
var DEAD_MODEL_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4090
|
+
function deadModelKey(provider, modelId) {
|
|
4091
|
+
return `${provider}:${modelId}`;
|
|
4092
|
+
}
|
|
4093
|
+
var DeadModelStore = class {
|
|
4094
|
+
constructor(persistence, opts = {}) {
|
|
4095
|
+
this.persistence = persistence;
|
|
4096
|
+
this.ttlMs = opts.ttlMs ?? DEAD_MODEL_TTL_MS;
|
|
4097
|
+
this.now = opts.now ?? (() => Date.now());
|
|
4098
|
+
this.restore();
|
|
4099
|
+
}
|
|
4100
|
+
persistence;
|
|
4101
|
+
records = /* @__PURE__ */ new Map();
|
|
4102
|
+
ttlMs;
|
|
4103
|
+
now;
|
|
4104
|
+
restore() {
|
|
4105
|
+
if (!this.persistence) return;
|
|
4106
|
+
try {
|
|
4107
|
+
for (const r of this.persistence.load()) {
|
|
4108
|
+
if (!this.isExpired(r)) this.records.set(r.key, r);
|
|
4109
|
+
}
|
|
4110
|
+
} catch {
|
|
4111
|
+
}
|
|
4112
|
+
}
|
|
4113
|
+
isExpired(r) {
|
|
4114
|
+
return this.now() - r.lastSeenAt > this.ttlMs;
|
|
4115
|
+
}
|
|
4116
|
+
flush() {
|
|
4117
|
+
if (!this.persistence) return;
|
|
4118
|
+
try {
|
|
4119
|
+
this.persistence.save([...this.records.values()]);
|
|
4120
|
+
} catch {
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
/**
|
|
4124
|
+
* Record that a model was found dead. Returns true when this is the first
|
|
4125
|
+
* time (so the caller can log it once rather than once per concurrent
|
|
4126
|
+
* worker in the wave that discovered it).
|
|
4127
|
+
*/
|
|
4128
|
+
record(provider, modelId, reason) {
|
|
4129
|
+
const key = deadModelKey(provider, modelId);
|
|
4130
|
+
const now = this.now();
|
|
4131
|
+
const existing = this.records.get(key);
|
|
4132
|
+
if (existing && !this.isExpired(existing)) {
|
|
4133
|
+
existing.lastSeenAt = now;
|
|
4134
|
+
existing.hits += 1;
|
|
4135
|
+
this.flush();
|
|
4136
|
+
return false;
|
|
4137
|
+
}
|
|
4138
|
+
this.records.set(key, {
|
|
4139
|
+
key,
|
|
4140
|
+
provider,
|
|
4141
|
+
modelId,
|
|
4142
|
+
reason,
|
|
4143
|
+
firstSeenAt: now,
|
|
4144
|
+
lastSeenAt: now,
|
|
4145
|
+
hits: 1
|
|
4146
|
+
});
|
|
4147
|
+
this.flush();
|
|
4148
|
+
return true;
|
|
4149
|
+
}
|
|
4150
|
+
/** True when this model is known dead and the verdict has not expired. */
|
|
4151
|
+
isDead(provider, modelId) {
|
|
4152
|
+
const r = this.records.get(deadModelKey(provider, modelId));
|
|
4153
|
+
if (!r) return false;
|
|
4154
|
+
if (this.isExpired(r)) {
|
|
4155
|
+
this.records.delete(r.key);
|
|
4156
|
+
this.flush();
|
|
4157
|
+
return false;
|
|
4158
|
+
}
|
|
4159
|
+
return true;
|
|
4160
|
+
}
|
|
4161
|
+
/** Why a model is considered dead, for /why and the models command. */
|
|
4162
|
+
reasonFor(provider, modelId) {
|
|
4163
|
+
const r = this.records.get(deadModelKey(provider, modelId));
|
|
4164
|
+
return r && !this.isExpired(r) ? r.reason : null;
|
|
4165
|
+
}
|
|
4166
|
+
/** Live records, expired ones filtered out. */
|
|
4167
|
+
list() {
|
|
4168
|
+
const live = [...this.records.values()].filter((r) => !this.isExpired(r));
|
|
4169
|
+
return live.sort((a, b) => b.lastSeenAt - a.lastSeenAt);
|
|
4170
|
+
}
|
|
4171
|
+
/**
|
|
4172
|
+
* Forget a verdict — used when the user fixes the underlying problem (adds
|
|
4173
|
+
* the model to their project, gets quota) and wants it retried now rather
|
|
4174
|
+
* than after the TTL.
|
|
4175
|
+
*/
|
|
4176
|
+
forget(provider, modelId) {
|
|
4177
|
+
const removed = this.records.delete(deadModelKey(provider, modelId));
|
|
4178
|
+
if (removed) this.flush();
|
|
4179
|
+
return removed;
|
|
4180
|
+
}
|
|
4181
|
+
clear() {
|
|
4182
|
+
this.records.clear();
|
|
4183
|
+
this.flush();
|
|
4184
|
+
}
|
|
4185
|
+
};
|
|
4186
|
+
function fileDeadModelPersistence(filePath) {
|
|
4187
|
+
return {
|
|
4188
|
+
load() {
|
|
4189
|
+
const fs25 = __require("fs");
|
|
4190
|
+
if (!fs25.existsSync(filePath)) return [];
|
|
4191
|
+
const raw = JSON.parse(fs25.readFileSync(filePath, "utf-8"));
|
|
4192
|
+
return Array.isArray(raw) ? raw : [];
|
|
4193
|
+
},
|
|
4194
|
+
save(records) {
|
|
4195
|
+
const fs25 = __require("fs");
|
|
4196
|
+
const path26 = __require("path");
|
|
4197
|
+
fs25.mkdirSync(path26.dirname(filePath), { recursive: true });
|
|
4198
|
+
fs25.writeFileSync(filePath, JSON.stringify(records, null, 2));
|
|
4199
|
+
}
|
|
4200
|
+
};
|
|
4201
|
+
}
|
|
4202
|
+
|
|
4067
4203
|
// src/utils/retry.ts
|
|
4068
4204
|
var CascadeCancelledError = class extends Error {
|
|
4069
4205
|
constructor(reason) {
|
|
@@ -4657,6 +4793,26 @@ var CascadeRouter = class _CascadeRouter extends EventEmitter {
|
|
|
4657
4793
|
localQueue;
|
|
4658
4794
|
taskAnalyzer;
|
|
4659
4795
|
pendingFeedbackSource;
|
|
4796
|
+
/** Models known dead for this account (404 / retired / not enabled). */
|
|
4797
|
+
deadModels = new DeadModelStore();
|
|
4798
|
+
/**
|
|
4799
|
+
* Back the dead-model memory with durable storage (a JSON file on desktop, a
|
|
4800
|
+
* per-user table in the cloud). Without one the verdicts still work, but only
|
|
4801
|
+
* for the life of the process — so tomorrow's run pays the same wave of 404s
|
|
4802
|
+
* to learn the same fact.
|
|
4803
|
+
*/
|
|
4804
|
+
setDeadModelStore(store) {
|
|
4805
|
+
this.deadModels = store;
|
|
4806
|
+
this.selector.setDeadModelStore(store);
|
|
4807
|
+
}
|
|
4808
|
+
/** Models known dead for this account, for `cascade models` and /why. */
|
|
4809
|
+
listDeadModels() {
|
|
4810
|
+
return this.deadModels.list();
|
|
4811
|
+
}
|
|
4812
|
+
/** Retry a model the user has since fixed, without waiting out the TTL. */
|
|
4813
|
+
forgetDeadModel(provider, modelId) {
|
|
4814
|
+
return this.deadModels.forget(provider, modelId);
|
|
4815
|
+
}
|
|
4660
4816
|
worldStateDB;
|
|
4661
4817
|
privacyPaths;
|
|
4662
4818
|
guidanceQueue;
|
|
@@ -5021,6 +5177,8 @@ var CascadeRouter = class _CascadeRouter extends EventEmitter {
|
|
|
5021
5177
|
}
|
|
5022
5178
|
if (isModelNotFoundError(errMsg)) {
|
|
5023
5179
|
this.selector.removeModel(model.id);
|
|
5180
|
+
const firstSighting = this.deadModels.record(model.provider, model.id, errMsg);
|
|
5181
|
+
if (firstSighting) this.emit("model:dead", { provider: model.provider, modelId: model.id, reason: errMsg });
|
|
5024
5182
|
const depth = (options._notFoundDepth ?? 0) + 1;
|
|
5025
5183
|
const next = depth <= 3 ? this.selector.selectForTier(tier) : null;
|
|
5026
5184
|
if (next && next.id !== model.id) {
|
|
@@ -8816,9 +8974,16 @@ var CAPABILITIES = [
|
|
|
8816
8974
|
api: "openai-images"
|
|
8817
8975
|
},
|
|
8818
8976
|
{
|
|
8977
|
+
// Imagen, not `gemini-3-pro-image`. That id appears on Google's PRICING
|
|
8978
|
+
// page but 404s on `:predict` ("not found for API version v1beta, or is not
|
|
8979
|
+
// supported for predict") — the Gemini image models are called through
|
|
8980
|
+
// generateContent with an image response modality, while `:predict` is the
|
|
8981
|
+
// Imagen shape this executor implements. A billing line item is not proof
|
|
8982
|
+
// of a callable endpoint, which is the assumption that put the wrong id
|
|
8983
|
+
// here in the first place.
|
|
8819
8984
|
modality: "image",
|
|
8820
8985
|
provider: "gemini",
|
|
8821
|
-
modelId: "
|
|
8986
|
+
modelId: "imagen-4.0-generate-001",
|
|
8822
8987
|
api: "gemini-predict"
|
|
8823
8988
|
},
|
|
8824
8989
|
// ── Speech (text → audio) ──
|
|
@@ -10947,6 +11112,20 @@ ${text}`;
|
|
|
10947
11112
|
}
|
|
10948
11113
|
};
|
|
10949
11114
|
|
|
11115
|
+
// src/tools/tool-name.ts
|
|
11116
|
+
var MCP_TOOL_PREFIX = "mcp__";
|
|
11117
|
+
function sanitizeToolNameSegment(segment) {
|
|
11118
|
+
const cleaned = segment.replace(/[^a-zA-Z0-9-]+/g, "_");
|
|
11119
|
+
let start = 0;
|
|
11120
|
+
let end = cleaned.length;
|
|
11121
|
+
while (start < end && cleaned[start] === "_") start++;
|
|
11122
|
+
while (end > start && cleaned[end - 1] === "_") end--;
|
|
11123
|
+
return cleaned.slice(start, end) || "_";
|
|
11124
|
+
}
|
|
11125
|
+
function mcpToolName(serverName, toolName) {
|
|
11126
|
+
return `${MCP_TOOL_PREFIX}${sanitizeToolNameSegment(serverName)}__${sanitizeToolNameSegment(toolName)}`;
|
|
11127
|
+
}
|
|
11128
|
+
|
|
10950
11129
|
// src/tools/mcp.ts
|
|
10951
11130
|
var McpToolWrapper = class extends BaseTool {
|
|
10952
11131
|
name;
|
|
@@ -10960,7 +11139,7 @@ var McpToolWrapper = class extends BaseTool {
|
|
|
10960
11139
|
this.mcpClient = mcpClient;
|
|
10961
11140
|
this.serverName = serverName;
|
|
10962
11141
|
this.toolName = toolName;
|
|
10963
|
-
this.name =
|
|
11142
|
+
this.name = mcpToolName(serverName, toolName);
|
|
10964
11143
|
this.description = `[MCP:${serverName}] ${description}`;
|
|
10965
11144
|
this.inputSchema = inputSchema;
|
|
10966
11145
|
}
|
|
@@ -14376,6 +14555,13 @@ var Cascade = class _Cascade extends EventEmitter {
|
|
|
14376
14555
|
}
|
|
14377
14556
|
});
|
|
14378
14557
|
this.toolRegistry = new ToolRegistry(this.config.tools, workspacePath);
|
|
14558
|
+
try {
|
|
14559
|
+
const nodePath = __require("path");
|
|
14560
|
+
this.router.setDeadModelStore(new DeadModelStore(
|
|
14561
|
+
fileDeadModelPersistence(nodePath.join(workspacePath, ".cascade", "dead-models.json"))
|
|
14562
|
+
));
|
|
14563
|
+
} catch {
|
|
14564
|
+
}
|
|
14379
14565
|
this.multimodal = new MultimodalRegistry(
|
|
14380
14566
|
(this.config.providers ?? []).map((p) => p.type)
|
|
14381
14567
|
);
|
|
@@ -19093,6 +19279,6 @@ function applySyncBundle(bundle, config) {
|
|
|
19093
19279
|
return next;
|
|
19094
19280
|
}
|
|
19095
19281
|
|
|
19096
|
-
export { AZURE_BASE_URL_TEMPLATE, AuditLogger, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, CascadeIgnore, CascadeRouter, CascadeToolError, CloudClient, CodeSearchTool, ConfigManager, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, DashboardServer, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, GraphRetriever, GraphSearchTool, HooksRunner, Keystore, LLMReranker, LM_STUDIO_BASE_URL, MODELS, McpClient, McpOAuthProvider, MemoryStore, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, PROVIDER_DISPLAY_NAMES, Retriever, SqliteVectorStore, T1Administrator, T1_MODEL_PRIORITY, T2Manager, T2_MODEL_PRIORITY, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, TaskScheduler, Telemetry, ToolRegistry, VISION_MODEL_PRIORITY, WorkspaceIndex, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildManifest, buildSessionTranscript, cagCharBudget, chatCompleterFromProviders, chunkCode, chunkText2 as chunkText, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, decryptJSON as decryptSyncBlob, diffManifest, discoverMcpAuthServer, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, fileOAuthProvider, gatherSyncBundle, hashContent, heuristicCodeChunker, inferAzureBaseModel, nodeHttpFetch, parseRankOrder, planRetrieval, preferIpv4Host, reciprocalRankFusion, refreshMcpToken, runCascade, sessionWorthRemembering, streamCascade };
|
|
19282
|
+
export { AZURE_BASE_MODELS, AZURE_BASE_URL_TEMPLATE, AuditLogger, CASCADE_AUDIT_FILE, CASCADE_CONFIG_DIR, CASCADE_CONFIG_FILE, CASCADE_DASHBOARD_SECRET_FILE, CASCADE_DB_FILE, CASCADE_IGNORE_FILE, CASCADE_KEYSTORE_FILE, CASCADE_MD_FILE, CASCADE_VERSION, CHARS_PER_TOKEN, COMPLEXITY_T2_COUNT, Cascade, CascadeCancelledError, CascadeIgnore, CascadeRouter, CascadeToolError, CloudClient, CodeSearchTool, ConfigManager, DEFAULT_API_PORT, DEFAULT_APPROVAL_REQUIRED, DEFAULT_AUTO_SUMMARIZE_AT, DEFAULT_CLOUD_URL, DEFAULT_CONTEXT_LIMIT, DEFAULT_DASHBOARD_PORT, DEFAULT_MAX_SESSION_MESSAGES, DEFAULT_RETENTION_DAYS, DEFAULT_THEME, DashboardServer, FileMcpOAuthStore, GLOBAL_CONFIG_DIR, GLOBAL_CREDENTIALS_FILE, GLOBAL_DB_FILE, GLOBAL_KEYSTORE_FILE, GLOBAL_RUNTIME_DB_FILE, GraphRetriever, GraphSearchTool, HooksRunner, Keystore, LLMReranker, LM_STUDIO_BASE_URL, MODELS, McpClient, McpOAuthProvider, MemoryStore, OLLAMA_BASE_URL, OpenAICompatibleEmbedder, PROVIDER_DISPLAY_NAMES, Retriever, SqliteVectorStore, T1Administrator, T1_MODEL_PRIORITY, T2Manager, T2_MODEL_PRIORITY, T3Worker, T3_MODEL_PRIORITY, THEME_NAMES, TOOL_NAMES, TaskScheduler, Telemetry, ToolRegistry, VISION_MODEL_PRIORITY, WorkspaceIndex, applySyncBundle, azureModelForDeployment, beginMcpOAuth, buildManifest, buildSessionTranscript, cagCharBudget, chatCompleterFromProviders, chunkCode, chunkText2 as chunkText, completeMcpOAuth, connectMcpWithLoopbackOAuth, createCascade, decryptJSON as decryptSyncBlob, diffManifest, discoverMcpAuthServer, distillSessionFacts, embedderFromProviders, encryptJSON as encryptSyncBlob, fileOAuthProvider, gatherSyncBundle, hashContent, heuristicCodeChunker, inferAzureBaseModel, nodeHttpFetch, parseRankOrder, planRetrieval, preferIpv4Host, reciprocalRankFusion, refreshMcpToken, runCascade, sessionWorthRemembering, streamCascade };
|
|
19097
19283
|
//# sourceMappingURL=index.js.map
|
|
19098
19284
|
//# sourceMappingURL=index.js.map
|