@rely-ai/caliber 1.49.1 → 1.49.3
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 +56 -6
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -390,8 +390,20 @@ Valid \`${bin} refresh\` options: \`--quiet\` and \`--dry-run\` only. Do not pas
|
|
|
390
390
|
If \`${bin}\` is not found, read the setup-caliber skill from .cursor/skills/setup-caliber/SKILL.md and follow its instructions to install Caliber.
|
|
391
391
|
`;
|
|
392
392
|
}
|
|
393
|
+
function getSectionBody(content, headingRe) {
|
|
394
|
+
const match = content.match(headingRe);
|
|
395
|
+
if (!match || match.index === void 0) return null;
|
|
396
|
+
const start = match.index + match[0].length;
|
|
397
|
+
const tail = content.slice(start);
|
|
398
|
+
const nextHeadingMatch = tail.match(/^##\s/m);
|
|
399
|
+
const end = nextHeadingMatch?.index ?? tail.length;
|
|
400
|
+
return tail.slice(0, end);
|
|
401
|
+
}
|
|
393
402
|
function hasPreCommitBlock(content) {
|
|
394
|
-
|
|
403
|
+
if (content.includes(BLOCK_START)) return true;
|
|
404
|
+
const body = getSectionBody(content, PRECOMMIT_HEADING_RE);
|
|
405
|
+
if (body && /caliber/i.test(body)) return true;
|
|
406
|
+
return false;
|
|
395
407
|
}
|
|
396
408
|
function appendPreCommitBlock(content, platform = "claude") {
|
|
397
409
|
if (hasPreCommitBlock(content)) return content;
|
|
@@ -402,7 +414,10 @@ function getCursorPreCommitRule() {
|
|
|
402
414
|
return { filename: CURSOR_RULE_FILENAME, content: getCursorRuleContent() };
|
|
403
415
|
}
|
|
404
416
|
function hasLearningsBlock(content) {
|
|
405
|
-
|
|
417
|
+
if (content.includes(LEARNINGS_BLOCK_START)) return true;
|
|
418
|
+
const body = getSectionBody(content, LEARNINGS_HEADING_RE);
|
|
419
|
+
if (body && /CALIBER_LEARNINGS/.test(body)) return true;
|
|
420
|
+
return false;
|
|
406
421
|
}
|
|
407
422
|
function appendLearningsBlock(content) {
|
|
408
423
|
if (hasLearningsBlock(content)) return content;
|
|
@@ -424,7 +439,10 @@ Pin your choice (\`/model\` in Claude Code, or \`CALIBER_MODEL\` when using Cali
|
|
|
424
439
|
${MODEL_BLOCK_END}`;
|
|
425
440
|
}
|
|
426
441
|
function hasModelBlock(content) {
|
|
427
|
-
|
|
442
|
+
if (content.includes(MODEL_BLOCK_START)) return true;
|
|
443
|
+
const body = getSectionBody(content, MODEL_HEADING_RE);
|
|
444
|
+
if (body && /CALIBER_MODEL/.test(body)) return true;
|
|
445
|
+
return false;
|
|
428
446
|
}
|
|
429
447
|
function appendModelBlock(content) {
|
|
430
448
|
if (hasModelBlock(content)) return content;
|
|
@@ -457,7 +475,10 @@ ${getSyncSetupInstruction(platform)}
|
|
|
457
475
|
${SYNC_BLOCK_END}`;
|
|
458
476
|
}
|
|
459
477
|
function hasSyncBlock(content) {
|
|
460
|
-
|
|
478
|
+
if (content.includes(SYNC_BLOCK_START)) return true;
|
|
479
|
+
const body = getSectionBody(content, SYNC_HEADING_RE);
|
|
480
|
+
if (body && /caliber-ai-org\/ai-setup/.test(body)) return true;
|
|
481
|
+
return false;
|
|
461
482
|
}
|
|
462
483
|
function appendSyncBlock(content, platform = "claude") {
|
|
463
484
|
if (hasSyncBlock(content)) return content;
|
|
@@ -513,7 +534,7 @@ function stripManagedBlocks(content) {
|
|
|
513
534
|
}
|
|
514
535
|
return result.replace(/\n{3,}/g, "\n\n").trim() + "\n";
|
|
515
536
|
}
|
|
516
|
-
var BLOCK_START, BLOCK_END, MANAGED_DOC_PATHS, CURSOR_RULE_FILENAME, LEARNINGS_BLOCK_START, LEARNINGS_BLOCK_END, LEARNINGS_BLOCK, CURSOR_LEARNINGS_FILENAME, CURSOR_LEARNINGS_CONTENT, MODEL_BLOCK_START, MODEL_BLOCK_END, SYNC_BLOCK_START, SYNC_BLOCK_END, CURSOR_SYNC_FILENAME, CURSOR_SETUP_FILENAME, MANAGED_BLOCK_PAIRS;
|
|
537
|
+
var BLOCK_START, BLOCK_END, MANAGED_DOC_PATHS, CURSOR_RULE_FILENAME, PRECOMMIT_HEADING_RE, LEARNINGS_BLOCK_START, LEARNINGS_BLOCK_END, LEARNINGS_BLOCK, CURSOR_LEARNINGS_FILENAME, CURSOR_LEARNINGS_CONTENT, LEARNINGS_HEADING_RE, MODEL_BLOCK_START, MODEL_BLOCK_END, MODEL_HEADING_RE, SYNC_BLOCK_START, SYNC_BLOCK_END, SYNC_HEADING_RE, CURSOR_SYNC_FILENAME, CURSOR_SETUP_FILENAME, MANAGED_BLOCK_PAIRS;
|
|
517
538
|
var init_pre_commit_block = __esm({
|
|
518
539
|
"src/writers/pre-commit-block.ts"() {
|
|
519
540
|
"use strict";
|
|
@@ -523,6 +544,7 @@ var init_pre_commit_block = __esm({
|
|
|
523
544
|
BLOCK_END = "<!-- /caliber:managed:pre-commit -->";
|
|
524
545
|
MANAGED_DOC_PATHS = "CLAUDE.md .claude/ .cursor/ .cursorrules .github/copilot-instructions.md .github/instructions/ AGENTS.md CALIBER_LEARNINGS.md .agents/ .opencode/";
|
|
525
546
|
CURSOR_RULE_FILENAME = "caliber-pre-commit.mdc";
|
|
547
|
+
PRECOMMIT_HEADING_RE = /^##\s+Before Committing\s*$/m;
|
|
526
548
|
LEARNINGS_BLOCK_START = "<!-- caliber:managed:learnings -->";
|
|
527
549
|
LEARNINGS_BLOCK_END = "<!-- /caliber:managed:learnings -->";
|
|
528
550
|
LEARNINGS_BLOCK = `${LEARNINGS_BLOCK_START}
|
|
@@ -539,10 +561,13 @@ alwaysApply: true
|
|
|
539
561
|
Read \`CALIBER_LEARNINGS.md\` for patterns and anti-patterns learned from previous sessions.
|
|
540
562
|
These are auto-extracted from real tool usage \u2014 treat them as project-specific rules.
|
|
541
563
|
`;
|
|
564
|
+
LEARNINGS_HEADING_RE = /^##\s+Session Learnings\s*$/m;
|
|
542
565
|
MODEL_BLOCK_START = "<!-- caliber:managed:model-config -->";
|
|
543
566
|
MODEL_BLOCK_END = "<!-- /caliber:managed:model-config -->";
|
|
567
|
+
MODEL_HEADING_RE = /^##\s+Model Configuration\s*$/m;
|
|
544
568
|
SYNC_BLOCK_START = "<!-- caliber:managed:sync -->";
|
|
545
569
|
SYNC_BLOCK_END = "<!-- /caliber:managed:sync -->";
|
|
570
|
+
SYNC_HEADING_RE = /^##\s+Context Sync\s*$/m;
|
|
546
571
|
CURSOR_SYNC_FILENAME = "caliber-sync.mdc";
|
|
547
572
|
CURSOR_SETUP_FILENAME = "caliber-setup.mdc";
|
|
548
573
|
MANAGED_BLOCK_PAIRS = [
|
|
@@ -2677,6 +2702,12 @@ function withCaliberSubprocessEnv(env) {
|
|
|
2677
2702
|
[CALIBER_SUBPROCESS_LEGACY_ENV]: "1"
|
|
2678
2703
|
};
|
|
2679
2704
|
}
|
|
2705
|
+
function isHookCascadeFromUserClaudeSession() {
|
|
2706
|
+
const inClaudeSession = process.env.CLAUDECODE === "1";
|
|
2707
|
+
const isCaliberSpawned = process.env[CALIBER_SUBPROCESS_ENV] === "1";
|
|
2708
|
+
const isInteractiveTty = process.stdin.isTTY === true;
|
|
2709
|
+
return inClaudeSession && !isCaliberSpawned && !isInteractiveTty;
|
|
2710
|
+
}
|
|
2680
2711
|
|
|
2681
2712
|
// src/llm/cursor-acp.ts
|
|
2682
2713
|
var IS_WINDOWS = process.platform === "win32";
|
|
@@ -5600,7 +5631,8 @@ var CORE_MAX_TOKENS = 16e3;
|
|
|
5600
5631
|
var GENERATION_MAX_TOKENS = 64e3;
|
|
5601
5632
|
var MODEL_MAX_OUTPUT_TOKENS = 128e3;
|
|
5602
5633
|
var MAX_RETRIES2 = 5;
|
|
5603
|
-
var DEFAULT_INACTIVITY_TIMEOUT_MS =
|
|
5634
|
+
var DEFAULT_INACTIVITY_TIMEOUT_MS = 3e5;
|
|
5635
|
+
var SOFT_INACTIVITY_WARN_MS = 6e4;
|
|
5604
5636
|
var DEFAULT_TOTAL_TIMEOUT_MS = 6e5;
|
|
5605
5637
|
function parseEnvTimeout(envVar, defaultMs, minMs = 5e3) {
|
|
5606
5638
|
const val = process.env[envVar];
|
|
@@ -5853,14 +5885,30 @@ async function streamGeneration(config) {
|
|
|
5853
5885
|
let charsReceived = 0;
|
|
5854
5886
|
let settled = false;
|
|
5855
5887
|
let inactivityTimer = null;
|
|
5888
|
+
let softWarnTimer = null;
|
|
5889
|
+
let softWarnFired = false;
|
|
5856
5890
|
function clearInactivityTimer() {
|
|
5857
5891
|
if (inactivityTimer) {
|
|
5858
5892
|
clearTimeout(inactivityTimer);
|
|
5859
5893
|
inactivityTimer = null;
|
|
5860
5894
|
}
|
|
5895
|
+
if (softWarnTimer) {
|
|
5896
|
+
clearTimeout(softWarnTimer);
|
|
5897
|
+
softWarnTimer = null;
|
|
5898
|
+
}
|
|
5861
5899
|
}
|
|
5862
5900
|
function resetInactivityTimer() {
|
|
5863
5901
|
if (inactivityTimer) clearTimeout(inactivityTimer);
|
|
5902
|
+
if (softWarnTimer) clearTimeout(softWarnTimer);
|
|
5903
|
+
if (config.callbacks && !softWarnFired && SOFT_INACTIVITY_WARN_MS < inactivityTimeoutMs) {
|
|
5904
|
+
softWarnTimer = setTimeout(() => {
|
|
5905
|
+
if (settled) return;
|
|
5906
|
+
softWarnFired = true;
|
|
5907
|
+
config.callbacks?.onStatus(
|
|
5908
|
+
"Model is taking longer than usual on this prompt \u2014 large repos may need more time. Set CALIBER_STREAM_INACTIVITY_TIMEOUT_MS to override."
|
|
5909
|
+
);
|
|
5910
|
+
}, SOFT_INACTIVITY_WARN_MS);
|
|
5911
|
+
}
|
|
5864
5912
|
inactivityTimer = setTimeout(() => {
|
|
5865
5913
|
if (settled) return;
|
|
5866
5914
|
settled = true;
|
|
@@ -13300,6 +13348,7 @@ async function refreshSingleRepo(repoDir, options) {
|
|
|
13300
13348
|
async function refreshCommand(options) {
|
|
13301
13349
|
const quiet = !!options.quiet;
|
|
13302
13350
|
if (quiet && isCaliberSubprocess()) return;
|
|
13351
|
+
if (quiet && isHookCascadeFromUserClaudeSession()) return;
|
|
13303
13352
|
if (quiet) {
|
|
13304
13353
|
const { isCaliberRunning: isCaliberRunning2 } = await Promise.resolve().then(() => (init_lock(), lock_exports));
|
|
13305
13354
|
if (isCaliberRunning2()) return;
|
|
@@ -14351,6 +14400,7 @@ async function learnFinalizeCommand(options) {
|
|
|
14351
14400
|
const isAuto = options?.auto === true;
|
|
14352
14401
|
const isIncremental = options?.incremental === true;
|
|
14353
14402
|
if (isAuto && isCaliberSubprocess()) return;
|
|
14403
|
+
if (isAuto && isHookCascadeFromUserClaudeSession()) return;
|
|
14354
14404
|
if (!options?.force && !isAuto) {
|
|
14355
14405
|
const { isCaliberRunning: isCaliberRunning2 } = await Promise.resolve().then(() => (init_lock(), lock_exports));
|
|
14356
14406
|
if (isCaliberRunning2()) {
|
package/package.json
CHANGED