@rely-ai/caliber 1.47.0 → 1.47.2
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 +45 -27
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -2622,6 +2622,13 @@ function estimateTokens(text) {
|
|
|
2622
2622
|
return Math.ceil(text.length / 4);
|
|
2623
2623
|
}
|
|
2624
2624
|
|
|
2625
|
+
// src/utils/windows.ts
|
|
2626
|
+
function quoteForWindows(arg) {
|
|
2627
|
+
if (!arg) return '""';
|
|
2628
|
+
if (!/[ \t\n\v"]/.test(arg)) return arg;
|
|
2629
|
+
return '"' + arg.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, "$1$1") + '"';
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2625
2632
|
// src/llm/cursor-acp.ts
|
|
2626
2633
|
var IS_WINDOWS = process.platform === "win32";
|
|
2627
2634
|
var _agentBin = null;
|
|
@@ -2697,10 +2704,14 @@ var CursorAcpProvider = class {
|
|
|
2697
2704
|
const targetModel = model || this.defaultModel;
|
|
2698
2705
|
if (this.warmProcess && !this.warmProcess.killed && this.warmModel === targetModel) return;
|
|
2699
2706
|
const args = this.buildArgs(targetModel, false);
|
|
2700
|
-
|
|
2707
|
+
const env = { ...process.env, ...this.cursorApiKey && { CURSOR_API_KEY: this.cursorApiKey } };
|
|
2708
|
+
this.warmProcess = IS_WINDOWS ? spawn([quoteForWindows(resolveAgentBin()), ...args.map(quoteForWindows)].join(" "), {
|
|
2709
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
2710
|
+
env,
|
|
2711
|
+
shell: true
|
|
2712
|
+
}) : spawn(resolveAgentBin(), args, {
|
|
2701
2713
|
stdio: ["pipe", "pipe", "pipe"],
|
|
2702
|
-
env
|
|
2703
|
-
...IS_WINDOWS && { shell: true }
|
|
2714
|
+
env
|
|
2704
2715
|
});
|
|
2705
2716
|
this.warmModel = targetModel;
|
|
2706
2717
|
this.warmProcess.on("error", () => {
|
|
@@ -2744,10 +2755,14 @@ var CursorAcpProvider = class {
|
|
|
2744
2755
|
return { child: warm, stderrChunks: stderrChunks2 };
|
|
2745
2756
|
}
|
|
2746
2757
|
const args = this.buildArgs(model, streaming);
|
|
2747
|
-
const
|
|
2758
|
+
const env = { ...process.env, ...this.cursorApiKey && { CURSOR_API_KEY: this.cursorApiKey } };
|
|
2759
|
+
const child = IS_WINDOWS ? spawn([quoteForWindows(resolveAgentBin()), ...args.map(quoteForWindows)].join(" "), {
|
|
2748
2760
|
stdio: ["pipe", "pipe", "pipe"],
|
|
2749
|
-
env
|
|
2750
|
-
|
|
2761
|
+
env,
|
|
2762
|
+
shell: true
|
|
2763
|
+
}) : spawn(resolveAgentBin(), args, {
|
|
2764
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
2765
|
+
env
|
|
2751
2766
|
});
|
|
2752
2767
|
const stderrChunks = [];
|
|
2753
2768
|
child.stderr.on("data", (chunk) => {
|
|
@@ -4703,7 +4718,7 @@ printf '{"decision":"block","reason":"Caliber agent config sync is not set up on
|
|
|
4703
4718
|
`;
|
|
4704
4719
|
var stopHook = createScriptHook({
|
|
4705
4720
|
eventName: "Stop",
|
|
4706
|
-
scriptPath: path10.join(".claude", "hooks", "caliber-check-sync.sh"),
|
|
4721
|
+
scriptPath: path10.posix.join(".claude", "hooks", "caliber-check-sync.sh"),
|
|
4707
4722
|
scriptContent: STOP_HOOK_SCRIPT_CONTENT,
|
|
4708
4723
|
description: "Caliber: offer setup if not configured"
|
|
4709
4724
|
});
|
|
@@ -4726,7 +4741,7 @@ fi
|
|
|
4726
4741
|
}
|
|
4727
4742
|
var sessionStartHook = createScriptHook({
|
|
4728
4743
|
eventName: "SessionStart",
|
|
4729
|
-
scriptPath: path10.join(".claude", "hooks", "caliber-session-freshness.sh"),
|
|
4744
|
+
scriptPath: path10.posix.join(".claude", "hooks", "caliber-session-freshness.sh"),
|
|
4730
4745
|
scriptContent: getFreshnessScript,
|
|
4731
4746
|
description: "Caliber: check config freshness on session start"
|
|
4732
4747
|
});
|
|
@@ -4735,7 +4750,7 @@ var installSessionStartHook = sessionStartHook.install;
|
|
|
4735
4750
|
var removeSessionStartHook = sessionStartHook.remove;
|
|
4736
4751
|
var notificationHook = createScriptHook({
|
|
4737
4752
|
eventName: "Notification",
|
|
4738
|
-
scriptPath: path10.join(".claude", "hooks", "caliber-freshness-notify.sh"),
|
|
4753
|
+
scriptPath: path10.posix.join(".claude", "hooks", "caliber-freshness-notify.sh"),
|
|
4739
4754
|
scriptContent: getFreshnessScript,
|
|
4740
4755
|
description: "Caliber: warn when agent configs are stale"
|
|
4741
4756
|
});
|
|
@@ -8540,13 +8555,15 @@ function trackEvent(name, properties) {
|
|
|
8540
8555
|
properties: { ...superProperties, ...properties }
|
|
8541
8556
|
});
|
|
8542
8557
|
}
|
|
8558
|
+
var flushPromise = null;
|
|
8543
8559
|
async function flushTelemetry() {
|
|
8544
8560
|
if (!client) return;
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
} catch {
|
|
8548
|
-
}
|
|
8561
|
+
if (flushPromise) return flushPromise;
|
|
8562
|
+
const c = client;
|
|
8549
8563
|
client = null;
|
|
8564
|
+
flushPromise = c.shutdown().catch(() => {
|
|
8565
|
+
});
|
|
8566
|
+
return flushPromise;
|
|
8550
8567
|
}
|
|
8551
8568
|
|
|
8552
8569
|
// src/telemetry/events.ts
|
|
@@ -14117,16 +14134,15 @@ async function learnObserveCommand(options) {
|
|
|
14117
14134
|
const NPX_SUFFIX = " --yes @rely-ai/caliber";
|
|
14118
14135
|
const [exe, binArgs] = isNpxResolution2() ? [bin.slice(0, -NPX_SUFFIX.length) || "npx", ["--yes", "@rely-ai/caliber"]] : [bin, []];
|
|
14119
14136
|
const isWin = process.platform === "win32";
|
|
14120
|
-
const
|
|
14121
|
-
const child = spawn5(
|
|
14122
|
-
|
|
14123
|
-
[
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
);
|
|
14137
|
+
const argsArray = [...binArgs, "learn", "finalize", "--auto", "--incremental"];
|
|
14138
|
+
const child = isWin ? spawn5([`"${exe}"`, ...argsArray.map(quoteForWindows)].join(" "), {
|
|
14139
|
+
detached: true,
|
|
14140
|
+
stdio: ["ignore", logFd, logFd],
|
|
14141
|
+
shell: true
|
|
14142
|
+
}) : spawn5(exe, argsArray, {
|
|
14143
|
+
detached: true,
|
|
14144
|
+
stdio: ["ignore", logFd, logFd]
|
|
14145
|
+
});
|
|
14130
14146
|
child.on("error", () => {
|
|
14131
14147
|
try {
|
|
14132
14148
|
const s = readState2();
|
|
@@ -15369,16 +15385,17 @@ function restoreTerminal() {
|
|
|
15369
15385
|
|
|
15370
15386
|
// src/bin.ts
|
|
15371
15387
|
var signalCleanupDone = false;
|
|
15372
|
-
function signalCleanup(code) {
|
|
15388
|
+
async function signalCleanup(code) {
|
|
15373
15389
|
if (signalCleanupDone) return;
|
|
15374
15390
|
signalCleanupDone = true;
|
|
15375
15391
|
restoreTerminal();
|
|
15376
15392
|
releaseLock();
|
|
15393
|
+
await flushTelemetry();
|
|
15377
15394
|
process.exit(code);
|
|
15378
15395
|
}
|
|
15379
15396
|
process.on("exit", restoreTerminal);
|
|
15380
|
-
process.on("SIGINT", () => signalCleanup(130));
|
|
15381
|
-
process.on("SIGTERM", () => signalCleanup(143));
|
|
15397
|
+
process.on("SIGINT", () => void signalCleanup(130));
|
|
15398
|
+
process.on("SIGTERM", () => void signalCleanup(143));
|
|
15382
15399
|
acquireLock();
|
|
15383
15400
|
if (process.env.CALIBER_LOCAL) {
|
|
15384
15401
|
process.env.CALIBER_SKIP_UPDATE_CHECK = "1";
|
|
@@ -15398,6 +15415,7 @@ program.parseAsync().catch((err) => {
|
|
|
15398
15415
|
}).finally(async () => {
|
|
15399
15416
|
releaseLock();
|
|
15400
15417
|
await flushTelemetry();
|
|
15401
|
-
process.exit(Number(process.exitCode ?? 0));
|
|
15418
|
+
const safetyExit = setTimeout(() => process.exit(Number(process.exitCode ?? 0)), 200);
|
|
15419
|
+
safetyExit.unref();
|
|
15402
15420
|
});
|
|
15403
15421
|
//# sourceMappingURL=bin.js.map
|
package/package.json
CHANGED