@rely-ai/caliber 1.22.0-dev.1773752996 → 1.22.0-dev.1773764723
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/bin.js +76 -60
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -133,13 +133,14 @@ var init_config = __esm({
|
|
|
133
133
|
anthropic: "claude-sonnet-4-6",
|
|
134
134
|
vertex: "claude-sonnet-4-6",
|
|
135
135
|
openai: "gpt-4.1",
|
|
136
|
-
cursor: "
|
|
136
|
+
cursor: "sonnet-4.6",
|
|
137
137
|
"claude-cli": "default"
|
|
138
138
|
};
|
|
139
139
|
DEFAULT_FAST_MODELS = {
|
|
140
140
|
anthropic: "claude-haiku-4-5-20251001",
|
|
141
141
|
vertex: "claude-haiku-4-5-20251001",
|
|
142
|
-
openai: "gpt-4.1-mini"
|
|
142
|
+
openai: "gpt-4.1-mini",
|
|
143
|
+
cursor: "gpt-5.3-codex-fast"
|
|
143
144
|
};
|
|
144
145
|
}
|
|
145
146
|
});
|
|
@@ -1210,15 +1211,11 @@ var IS_WINDOWS = process.platform === "win32";
|
|
|
1210
1211
|
var CursorAcpProvider = class {
|
|
1211
1212
|
defaultModel;
|
|
1212
1213
|
cursorApiKey;
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
pending = /* @__PURE__ */ new Map();
|
|
1216
|
-
nextId = 1;
|
|
1217
|
-
connectPromise = null;
|
|
1218
|
-
activeCallbacks = null;
|
|
1214
|
+
connections = /* @__PURE__ */ new Map();
|
|
1215
|
+
connectPromises = /* @__PURE__ */ new Map();
|
|
1219
1216
|
shutdownRequested = false;
|
|
1220
1217
|
constructor(config) {
|
|
1221
|
-
this.defaultModel = config.model || "
|
|
1218
|
+
this.defaultModel = config.model || "sonnet-4.6";
|
|
1222
1219
|
this.cursorApiKey = process.env.CURSOR_API_KEY ?? process.env.CURSOR_AUTH_TOKEN;
|
|
1223
1220
|
process.once("exit", () => this.shutdown());
|
|
1224
1221
|
}
|
|
@@ -1238,80 +1235,98 @@ var CursorAcpProvider = class {
|
|
|
1238
1235
|
}
|
|
1239
1236
|
shutdown() {
|
|
1240
1237
|
this.shutdownRequested = true;
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
this.
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1238
|
+
for (const conn of this.connections.values()) {
|
|
1239
|
+
conn.child.stdin?.end();
|
|
1240
|
+
conn.child.kill("SIGTERM");
|
|
1241
|
+
}
|
|
1242
|
+
this.connections.clear();
|
|
1243
|
+
this.connectPromises.clear();
|
|
1244
|
+
}
|
|
1245
|
+
// -- Connection pool --------------------------------------------------------
|
|
1246
|
+
resolveModel(options) {
|
|
1247
|
+
return options.model || this.defaultModel;
|
|
1248
|
+
}
|
|
1249
|
+
async ensureConnection(model) {
|
|
1250
|
+
const existing = this.connections.get(model);
|
|
1251
|
+
if (existing && !existing.child.killed) return existing;
|
|
1252
|
+
const pending = this.connectPromises.get(model);
|
|
1253
|
+
if (pending) {
|
|
1254
|
+
await pending;
|
|
1255
|
+
return this.connections.get(model);
|
|
1256
|
+
}
|
|
1257
|
+
const promise = this.connect(model);
|
|
1258
|
+
this.connectPromises.set(model, promise);
|
|
1254
1259
|
try {
|
|
1255
|
-
await
|
|
1260
|
+
await promise;
|
|
1256
1261
|
} catch (err) {
|
|
1257
|
-
this.
|
|
1262
|
+
this.connectPromises.delete(model);
|
|
1258
1263
|
throw err;
|
|
1259
1264
|
}
|
|
1265
|
+
return this.connections.get(model);
|
|
1260
1266
|
}
|
|
1261
|
-
async connect() {
|
|
1262
|
-
const args = ["acp"];
|
|
1267
|
+
async connect(model) {
|
|
1268
|
+
const args = ["--mode", "ask", "acp"];
|
|
1269
|
+
if (model && model !== "auto" && model !== "default") {
|
|
1270
|
+
args.unshift("--model", model);
|
|
1271
|
+
}
|
|
1263
1272
|
if (this.cursorApiKey) {
|
|
1264
1273
|
args.unshift("--api-key", this.cursorApiKey);
|
|
1265
1274
|
}
|
|
1266
|
-
|
|
1275
|
+
const child = spawn(ACP_AGENT_BIN, args, {
|
|
1267
1276
|
stdio: ["pipe", "pipe", "ignore"],
|
|
1268
1277
|
cwd: process.cwd(),
|
|
1269
1278
|
env: { ...process.env, ...this.cursorApiKey && { CURSOR_API_KEY: this.cursorApiKey } },
|
|
1270
1279
|
...IS_WINDOWS && { shell: true }
|
|
1271
1280
|
});
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1281
|
+
const conn = {
|
|
1282
|
+
child,
|
|
1283
|
+
rl: readline.createInterface({ input: child.stdout, crlfDelay: Infinity }),
|
|
1284
|
+
pending: /* @__PURE__ */ new Map(),
|
|
1285
|
+
nextId: 1,
|
|
1286
|
+
activeCallbacks: null
|
|
1287
|
+
};
|
|
1288
|
+
conn.rl.on("line", (line) => this.handleLine(conn, line));
|
|
1289
|
+
child.on("error", (err) => {
|
|
1290
|
+
for (const w of conn.pending.values()) w.reject(err);
|
|
1291
|
+
conn.pending.clear();
|
|
1292
|
+
conn.activeCallbacks?.onError(err);
|
|
1278
1293
|
});
|
|
1279
|
-
|
|
1294
|
+
child.on("close", () => {
|
|
1280
1295
|
if (!this.shutdownRequested) {
|
|
1281
1296
|
const err = new Error("Cursor agent process exited unexpectedly");
|
|
1282
|
-
for (const w of
|
|
1283
|
-
|
|
1284
|
-
|
|
1297
|
+
for (const w of conn.pending.values()) w.reject(err);
|
|
1298
|
+
conn.pending.clear();
|
|
1299
|
+
conn.activeCallbacks?.onError(err);
|
|
1285
1300
|
}
|
|
1286
|
-
this.
|
|
1287
|
-
this.
|
|
1288
|
-
this.connectPromise = null;
|
|
1301
|
+
this.connections.delete(model);
|
|
1302
|
+
this.connectPromises.delete(model);
|
|
1289
1303
|
});
|
|
1290
|
-
|
|
1304
|
+
this.connections.set(model, conn);
|
|
1305
|
+
await this.send(conn, "initialize", {
|
|
1291
1306
|
protocolVersion: 1,
|
|
1292
1307
|
clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false },
|
|
1293
1308
|
clientInfo: { name: "caliber", version: "1.0.0" }
|
|
1294
1309
|
});
|
|
1295
|
-
await this.send("authenticate", { methodId: "cursor_login" });
|
|
1310
|
+
await this.send(conn, "authenticate", { methodId: "cursor_login" });
|
|
1296
1311
|
}
|
|
1297
1312
|
// -- JSON-RPC ---------------------------------------------------------------
|
|
1298
|
-
send(method, params) {
|
|
1299
|
-
if (!
|
|
1313
|
+
send(conn, method, params) {
|
|
1314
|
+
if (!conn.child.stdin) {
|
|
1300
1315
|
return Promise.reject(new Error("Cursor agent not connected"));
|
|
1301
1316
|
}
|
|
1302
1317
|
return new Promise((resolve2, reject) => {
|
|
1303
|
-
const id =
|
|
1304
|
-
|
|
1318
|
+
const id = conn.nextId++;
|
|
1319
|
+
conn.pending.set(id, { resolve: resolve2, reject });
|
|
1305
1320
|
const msg = { jsonrpc: "2.0", id, method, params };
|
|
1306
|
-
|
|
1321
|
+
conn.child.stdin.write(JSON.stringify(msg) + "\n", (err) => {
|
|
1307
1322
|
if (err) {
|
|
1308
|
-
|
|
1323
|
+
conn.pending.delete(id);
|
|
1309
1324
|
reject(err);
|
|
1310
1325
|
}
|
|
1311
1326
|
});
|
|
1312
1327
|
});
|
|
1313
1328
|
}
|
|
1314
|
-
handleLine(line) {
|
|
1329
|
+
handleLine(conn, line) {
|
|
1315
1330
|
let msg;
|
|
1316
1331
|
try {
|
|
1317
1332
|
msg = JSON.parse(line);
|
|
@@ -1319,9 +1334,9 @@ var CursorAcpProvider = class {
|
|
|
1319
1334
|
return;
|
|
1320
1335
|
}
|
|
1321
1336
|
if (msg.id != null && (msg.result !== void 0 || msg.error !== void 0)) {
|
|
1322
|
-
const waiter =
|
|
1337
|
+
const waiter = conn.pending.get(msg.id);
|
|
1323
1338
|
if (waiter) {
|
|
1324
|
-
|
|
1339
|
+
conn.pending.delete(msg.id);
|
|
1325
1340
|
if (msg.error) {
|
|
1326
1341
|
waiter.reject(new Error(msg.error.message || "ACP error"));
|
|
1327
1342
|
} else {
|
|
@@ -1329,7 +1344,7 @@ var CursorAcpProvider = class {
|
|
|
1329
1344
|
}
|
|
1330
1345
|
}
|
|
1331
1346
|
if (msg.result && typeof msg.result === "object" && "stopReason" in msg.result) {
|
|
1332
|
-
|
|
1347
|
+
conn.activeCallbacks?.onEnd({
|
|
1333
1348
|
stopReason: msg.result.stopReason
|
|
1334
1349
|
});
|
|
1335
1350
|
}
|
|
@@ -1338,7 +1353,7 @@ var CursorAcpProvider = class {
|
|
|
1338
1353
|
if (msg.method === "session/update" && msg.params?.update) {
|
|
1339
1354
|
const update = msg.params.update;
|
|
1340
1355
|
if (update.sessionUpdate === "agent_message_chunk" && update.content?.text) {
|
|
1341
|
-
|
|
1356
|
+
conn.activeCallbacks?.onText(update.content.text);
|
|
1342
1357
|
}
|
|
1343
1358
|
return;
|
|
1344
1359
|
}
|
|
@@ -1348,19 +1363,20 @@ var CursorAcpProvider = class {
|
|
|
1348
1363
|
id: msg.id,
|
|
1349
1364
|
result: { outcome: { outcome: "selected", optionId: "allow-once" } }
|
|
1350
1365
|
}) + "\n";
|
|
1351
|
-
|
|
1366
|
+
conn.child.stdin?.write(response);
|
|
1352
1367
|
}
|
|
1353
1368
|
}
|
|
1354
1369
|
// -- Prompt execution -------------------------------------------------------
|
|
1355
1370
|
async runPrompt(options, callbacks) {
|
|
1356
|
-
|
|
1357
|
-
|
|
1371
|
+
const model = this.resolveModel(options);
|
|
1372
|
+
const conn = await this.ensureConnection(model);
|
|
1373
|
+
conn.activeCallbacks = callbacks;
|
|
1358
1374
|
try {
|
|
1359
|
-
const sessionResult = await this.send("session/new", {
|
|
1375
|
+
const sessionResult = await this.send(conn, "session/new", {
|
|
1360
1376
|
cwd: process.cwd(),
|
|
1361
1377
|
mcpServers: []
|
|
1362
1378
|
});
|
|
1363
|
-
await this.send("session/prompt", {
|
|
1379
|
+
await this.send(conn, "session/prompt", {
|
|
1364
1380
|
sessionId: sessionResult.sessionId,
|
|
1365
1381
|
prompt: [{ type: "text", text: this.buildCombinedPrompt(options) }]
|
|
1366
1382
|
});
|
|
@@ -1369,7 +1385,7 @@ var CursorAcpProvider = class {
|
|
|
1369
1385
|
callbacks.onError(error);
|
|
1370
1386
|
throw error;
|
|
1371
1387
|
} finally {
|
|
1372
|
-
|
|
1388
|
+
conn.activeCallbacks = null;
|
|
1373
1389
|
}
|
|
1374
1390
|
}
|
|
1375
1391
|
buildCombinedPrompt(options) {
|
|
@@ -7014,7 +7030,7 @@ function renderCard(card, index, total, cols) {
|
|
|
7014
7030
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
7015
7031
|
var SPINNER_INTERVAL_MS = 80;
|
|
7016
7032
|
var CARD_ADVANCE_MS = 15e3;
|
|
7017
|
-
var NAME_COL_WIDTH =
|
|
7033
|
+
var NAME_COL_WIDTH = 30;
|
|
7018
7034
|
var PREFIX = " ";
|
|
7019
7035
|
var ParallelTaskDisplay = class {
|
|
7020
7036
|
tasks = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rely-ai/caliber",
|
|
3
|
-
"version": "1.22.0-dev.
|
|
3
|
+
"version": "1.22.0-dev.1773764723",
|
|
4
4
|
"description": "Analyze your codebase and generate optimized AI agent configs (CLAUDE.md, .cursorrules, skills) — no API key needed",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|