cascade-ai 0.12.4 → 0.12.6
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 +87 -113
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +87 -113
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +80 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +80 -121
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/keytar-VMICNFEJ.node +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -2225,7 +2225,7 @@ declare class Telemetry {
|
|
|
2225
2225
|
shutdown(): Promise<void>;
|
|
2226
2226
|
}
|
|
2227
2227
|
|
|
2228
|
-
declare const CASCADE_VERSION
|
|
2228
|
+
declare const CASCADE_VERSION: string;
|
|
2229
2229
|
declare const CASCADE_CONFIG_DIR = ".cascade";
|
|
2230
2230
|
declare const CASCADE_MD_FILE = "CASCADE.md";
|
|
2231
2231
|
declare const CASCADE_IGNORE_FILE = ".cascadeignore";
|
package/dist/index.d.ts
CHANGED
|
@@ -2225,7 +2225,7 @@ declare class Telemetry {
|
|
|
2225
2225
|
shutdown(): Promise<void>;
|
|
2226
2226
|
}
|
|
2227
2227
|
|
|
2228
|
-
declare const CASCADE_VERSION
|
|
2228
|
+
declare const CASCADE_VERSION: string;
|
|
2229
2229
|
declare const CASCADE_CONFIG_DIR = ".cascade";
|
|
2230
2230
|
declare const CASCADE_MD_FILE = "CASCADE.md";
|
|
2231
2231
|
declare const CASCADE_IGNORE_FILE = ".cascadeignore";
|
package/dist/index.js
CHANGED
|
@@ -32,100 +32,10 @@ import jwt from 'jsonwebtoken';
|
|
|
32
32
|
import cron from 'node-cron';
|
|
33
33
|
|
|
34
34
|
// Cascade AI — Multi-tier AI Orchestration System
|
|
35
|
-
var __create = Object.create;
|
|
36
|
-
var __defProp = Object.defineProperty;
|
|
37
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
38
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
39
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
40
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
41
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
42
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
43
|
-
}) : x)(function(x) {
|
|
44
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
45
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
46
|
-
});
|
|
47
|
-
var __esm = (fn, res) => function __init() {
|
|
48
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
49
|
-
};
|
|
50
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
51
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
52
|
-
};
|
|
53
|
-
var __copyProps = (to, from, except, desc) => {
|
|
54
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
55
|
-
for (let key of __getOwnPropNames(from))
|
|
56
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
57
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
58
|
-
}
|
|
59
|
-
return to;
|
|
60
|
-
};
|
|
61
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
62
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
63
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
64
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
65
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
66
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
67
|
-
mod
|
|
68
|
-
));
|
|
69
|
-
|
|
70
|
-
// node_modules/keytar/build/Release/keytar.node
|
|
71
|
-
var keytar_default;
|
|
72
|
-
var init_keytar = __esm({
|
|
73
|
-
"node_modules/keytar/build/Release/keytar.node"() {
|
|
74
|
-
keytar_default = "./keytar-VMICNFEJ.node";
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
35
|
|
|
78
|
-
// node-file:/home/runner/work/Cascade-AI/Cascade-AI/node_modules/keytar/build/Release/keytar.node
|
|
79
|
-
var require_keytar = __commonJS({
|
|
80
|
-
"node-file:/home/runner/work/Cascade-AI/Cascade-AI/node_modules/keytar/build/Release/keytar.node"(exports, module) {
|
|
81
|
-
init_keytar();
|
|
82
|
-
try {
|
|
83
|
-
module.exports = __require(keytar_default);
|
|
84
|
-
} catch {
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// node_modules/keytar/lib/keytar.js
|
|
90
|
-
var require_keytar2 = __commonJS({
|
|
91
|
-
"node_modules/keytar/lib/keytar.js"(exports, module) {
|
|
92
|
-
var keytar = require_keytar();
|
|
93
|
-
function checkRequired(val, name) {
|
|
94
|
-
if (!val || val.length <= 0) {
|
|
95
|
-
throw new Error(name + " is required.");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
module.exports = {
|
|
99
|
-
getPassword: function(service, account) {
|
|
100
|
-
checkRequired(service, "Service");
|
|
101
|
-
checkRequired(account, "Account");
|
|
102
|
-
return keytar.getPassword(service, account);
|
|
103
|
-
},
|
|
104
|
-
setPassword: function(service, account, password) {
|
|
105
|
-
checkRequired(service, "Service");
|
|
106
|
-
checkRequired(account, "Account");
|
|
107
|
-
checkRequired(password, "Password");
|
|
108
|
-
return keytar.setPassword(service, account, password);
|
|
109
|
-
},
|
|
110
|
-
deletePassword: function(service, account) {
|
|
111
|
-
checkRequired(service, "Service");
|
|
112
|
-
checkRequired(account, "Account");
|
|
113
|
-
return keytar.deletePassword(service, account);
|
|
114
|
-
},
|
|
115
|
-
findPassword: function(service) {
|
|
116
|
-
checkRequired(service, "Service");
|
|
117
|
-
return keytar.findPassword(service);
|
|
118
|
-
},
|
|
119
|
-
findCredentials: function(service) {
|
|
120
|
-
checkRequired(service, "Service");
|
|
121
|
-
return keytar.findCredentials(service);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
36
|
|
|
127
37
|
// src/constants.ts
|
|
128
|
-
var CASCADE_VERSION = "0.
|
|
38
|
+
var CASCADE_VERSION = "0.12.6";
|
|
129
39
|
var CASCADE_CONFIG_DIR = ".cascade";
|
|
130
40
|
var CASCADE_MD_FILE = "CASCADE.md";
|
|
131
41
|
var CASCADE_IGNORE_FILE = ".cascadeignore";
|
|
@@ -194,6 +104,30 @@ var MODELS = {
|
|
|
194
104
|
supportsStreaming: true,
|
|
195
105
|
isLocal: false
|
|
196
106
|
},
|
|
107
|
+
"claude-opus-4-8": {
|
|
108
|
+
id: "claude-opus-4-8",
|
|
109
|
+
name: "Claude Opus 4.8",
|
|
110
|
+
provider: "anthropic",
|
|
111
|
+
contextWindow: 2e5,
|
|
112
|
+
isVisionCapable: true,
|
|
113
|
+
inputCostPer1kTokens: 0.015,
|
|
114
|
+
outputCostPer1kTokens: 0.075,
|
|
115
|
+
maxOutputTokens: 32e3,
|
|
116
|
+
supportsStreaming: true,
|
|
117
|
+
isLocal: false
|
|
118
|
+
},
|
|
119
|
+
"claude-sonnet-4-6": {
|
|
120
|
+
id: "claude-sonnet-4-6",
|
|
121
|
+
name: "Claude Sonnet 4.6",
|
|
122
|
+
provider: "anthropic",
|
|
123
|
+
contextWindow: 2e5,
|
|
124
|
+
isVisionCapable: true,
|
|
125
|
+
inputCostPer1kTokens: 3e-3,
|
|
126
|
+
outputCostPer1kTokens: 0.015,
|
|
127
|
+
maxOutputTokens: 16e3,
|
|
128
|
+
supportsStreaming: true,
|
|
129
|
+
isLocal: false
|
|
130
|
+
},
|
|
197
131
|
// OpenAI
|
|
198
132
|
"gpt-4o": {
|
|
199
133
|
id: "gpt-4o",
|
|
@@ -455,6 +389,24 @@ var PROVIDER_DISPLAY_NAMES = {
|
|
|
455
389
|
ollama: "Ollama (Local)"
|
|
456
390
|
};
|
|
457
391
|
|
|
392
|
+
// src/utils/cost.ts
|
|
393
|
+
function resolveModelPricing(model) {
|
|
394
|
+
let input = model.inputCostPer1kTokens;
|
|
395
|
+
let output = model.outputCostPer1kTokens;
|
|
396
|
+
if (input === 0 && output === 0 && model.id && !model.isLocal) {
|
|
397
|
+
const known = Object.values(MODELS).find((m) => m.id === model.id && !m.isLocal);
|
|
398
|
+
if (known) {
|
|
399
|
+
input = known.inputCostPer1kTokens;
|
|
400
|
+
output = known.outputCostPer1kTokens;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return { input, output };
|
|
404
|
+
}
|
|
405
|
+
function calculateCost(inputTokens, outputTokens, model) {
|
|
406
|
+
const { input, output } = resolveModelPricing(model);
|
|
407
|
+
return inputTokens / 1e3 * input + outputTokens / 1e3 * output;
|
|
408
|
+
}
|
|
409
|
+
|
|
458
410
|
// src/providers/base.ts
|
|
459
411
|
var BaseProvider = class {
|
|
460
412
|
config;
|
|
@@ -470,7 +422,7 @@ var BaseProvider = class {
|
|
|
470
422
|
return this.model.isVisionCapable;
|
|
471
423
|
}
|
|
472
424
|
estimateCost(inputTokens, outputTokens) {
|
|
473
|
-
return inputTokens
|
|
425
|
+
return calculateCost(inputTokens, outputTokens, this.model);
|
|
474
426
|
}
|
|
475
427
|
makeUsage(inputTokens, outputTokens) {
|
|
476
428
|
return {
|
|
@@ -1759,11 +1711,6 @@ var LocalRequestQueue = class {
|
|
|
1759
1711
|
}
|
|
1760
1712
|
};
|
|
1761
1713
|
|
|
1762
|
-
// src/utils/cost.ts
|
|
1763
|
-
function calculateCost(inputTokens, outputTokens, model) {
|
|
1764
|
-
return inputTokens / 1e3 * model.inputCostPer1kTokens + outputTokens / 1e3 * model.outputCostPer1kTokens;
|
|
1765
|
-
}
|
|
1766
|
-
|
|
1767
1714
|
// src/utils/retry.ts
|
|
1768
1715
|
var CascadeCancelledError = class extends Error {
|
|
1769
1716
|
constructor(reason) {
|
|
@@ -3342,8 +3289,9 @@ var T3Worker = class extends BaseTier {
|
|
|
3342
3289
|
const depOutputs = [];
|
|
3343
3290
|
for (const depId of assignment.dependsOn) {
|
|
3344
3291
|
try {
|
|
3345
|
-
const dep = await this.peerBus.waitFor(depId);
|
|
3292
|
+
const dep = await this.peerBus.waitFor(depId, 6e4);
|
|
3346
3293
|
if (dep.status === "FAILED" || dep.status === "ESCALATED") {
|
|
3294
|
+
this.peerBus.publish(this.id, assignment.subtaskId, `Blocked by failed dependency: ${depId}`, "FAILED");
|
|
3347
3295
|
return this.buildResult(
|
|
3348
3296
|
"ESCALATED",
|
|
3349
3297
|
`Dependency ${depId} failed \u2014 cannot proceed`,
|
|
@@ -3355,6 +3303,7 @@ var T3Worker = class extends BaseTier {
|
|
|
3355
3303
|
depOutputs.push(`[From ${dep.fromId} - ${dep.subtaskId}]:
|
|
3356
3304
|
${dep.output}`);
|
|
3357
3305
|
} catch (err) {
|
|
3306
|
+
this.peerBus.publish(this.id, assignment.subtaskId, `Dependency timeout: ${depId}`, "FAILED");
|
|
3358
3307
|
return this.buildResult(
|
|
3359
3308
|
"ESCALATED",
|
|
3360
3309
|
`Dependency timeout: ${depId}`,
|
|
@@ -5053,6 +5002,16 @@ function parseFirstJsonObject(input) {
|
|
|
5053
5002
|
}
|
|
5054
5003
|
|
|
5055
5004
|
// src/core/tiers/t1-administrator.ts
|
|
5005
|
+
function sharedKeywords(a = [], b = []) {
|
|
5006
|
+
const setB = new Set(b.map((k) => k.toLowerCase().trim()).filter(Boolean));
|
|
5007
|
+
return [...new Set(a.map((k) => k.toLowerCase().trim()).filter(Boolean))].filter((k) => setB.has(k));
|
|
5008
|
+
}
|
|
5009
|
+
function isStrongKeywordOverlap(a = [], b = []) {
|
|
5010
|
+
if (!a.length || !b.length) return false;
|
|
5011
|
+
const shared = sharedKeywords(a, b);
|
|
5012
|
+
const ratio = shared.length / Math.min(a.length, b.length);
|
|
5013
|
+
return shared.length >= 3 && ratio >= 0.6;
|
|
5014
|
+
}
|
|
5056
5015
|
var T1_SYSTEM_PROMPT = `You are T1, the Administrator in the Cascade AI orchestration system.
|
|
5057
5016
|
|
|
5058
5017
|
Your responsibilities:
|
|
@@ -5477,17 +5436,27 @@ Leave dependsOn empty for sections that can run immediately in parallel.`;
|
|
|
5477
5436
|
siblingKeywords.set(payload.sectionId, [...new Set(existing)]);
|
|
5478
5437
|
}
|
|
5479
5438
|
}
|
|
5480
|
-
const
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
const
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5439
|
+
const payloads = announcements.map((ann) => ann.payload).filter((p) => p?.type === "T2_PLAN_ANNOUNCEMENT" && !!p.sectionId);
|
|
5440
|
+
const softOverlap = /* @__PURE__ */ new Set();
|
|
5441
|
+
const orderOf = new Map(sections.map((s, i) => [s.sectionId, i]));
|
|
5442
|
+
for (let i = 0; i < payloads.length; i++) {
|
|
5443
|
+
for (let j = i + 1; j < payloads.length; j++) {
|
|
5444
|
+
const a = payloads[i];
|
|
5445
|
+
const b = payloads[j];
|
|
5446
|
+
const shared = sharedKeywords(a.keywords ?? [], b.keywords ?? []);
|
|
5447
|
+
if (shared.length === 0) continue;
|
|
5448
|
+
softOverlap.add(a.sectionId);
|
|
5449
|
+
softOverlap.add(b.sectionId);
|
|
5450
|
+
if (isStrongKeywordOverlap(a.keywords ?? [], b.keywords ?? [])) {
|
|
5451
|
+
const ai = orderOf.get(a.sectionId) ?? 0;
|
|
5452
|
+
const bi = orderOf.get(b.sectionId) ?? 0;
|
|
5453
|
+
const earlier = ai <= bi ? a.sectionId : b.sectionId;
|
|
5454
|
+
const later = ai <= bi ? b.sectionId : a.sectionId;
|
|
5455
|
+
const laterSection = sections.find((s) => s.sectionId === later);
|
|
5456
|
+
if (laterSection && earlier !== later && !(laterSection.dependsOn ?? []).includes(earlier)) {
|
|
5457
|
+
laterSection.dependsOn = [...laterSection.dependsOn || [], earlier];
|
|
5458
|
+
this.log(`Strong overlap ${earlier} \u2194 ${later} (shared: ${shared.slice(0, 5).join(", ")}) \u2014 serializing ${later} after ${earlier}`);
|
|
5459
|
+
}
|
|
5491
5460
|
}
|
|
5492
5461
|
}
|
|
5493
5462
|
}
|
|
@@ -5499,20 +5468,10 @@ Leave dependsOn empty for sections that can run immediately in parallel.`;
|
|
|
5499
5468
|
`You are T2 Manager for section: "${section.sectionTitle}".`,
|
|
5500
5469
|
`Sibling sections being worked on in parallel: ${otherTitles.join(", ") || "none"}.`,
|
|
5501
5470
|
myKeywords.length > 0 ? `Watch for overlap with: ${[...new Set(myKeywords)].slice(0, 10).join(", ")}.` : "",
|
|
5502
|
-
|
|
5471
|
+
softOverlap.has(section.sectionId) ? "NOTE: Potential overlap detected with a sibling section \u2014 be careful not to duplicate work." : ""
|
|
5503
5472
|
].filter(Boolean).join(" ");
|
|
5504
5473
|
m.setHierarchyContext(context);
|
|
5505
5474
|
});
|
|
5506
|
-
if (overlapSections.size > 0) {
|
|
5507
|
-
this.log("Overlap detected \u2014 adding sequential dependencies for conflicting sections to prevent race conditions");
|
|
5508
|
-
const overlapArray = Array.from(overlapSections);
|
|
5509
|
-
for (let i = 1; i < overlapArray.length; i++) {
|
|
5510
|
-
const section = sections.find((s) => s.sectionId === overlapArray[i]);
|
|
5511
|
-
if (section) {
|
|
5512
|
-
section.dependsOn = [...section.dependsOn || [], overlapArray[i - 1]];
|
|
5513
|
-
}
|
|
5514
|
-
}
|
|
5515
|
-
}
|
|
5516
5475
|
const t2Results = [];
|
|
5517
5476
|
try {
|
|
5518
5477
|
t2Results.push(...await this.runT2sWithDependencies(sections, managers, this.taskId));
|
|
@@ -9264,7 +9223,7 @@ var PBKDF2_ITERATIONS = 1e5;
|
|
|
9264
9223
|
var KEYTAR_SERVICE = "cascade-ai";
|
|
9265
9224
|
async function loadKeytar() {
|
|
9266
9225
|
try {
|
|
9267
|
-
const mod = await
|
|
9226
|
+
const mod = await import('keytar');
|
|
9268
9227
|
const candidate = mod.default ?? mod;
|
|
9269
9228
|
if (typeof candidate.getPassword !== "function") return null;
|
|
9270
9229
|
return candidate;
|