@rely-ai/caliber 1.20.0-dev.1773696964 → 1.20.0-dev.1773697587
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 +38 -28
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -6535,7 +6535,7 @@ function validateSetup(setup, dir, checkExists = existsSync9) {
|
|
|
6535
6535
|
}
|
|
6536
6536
|
function buildFeedbackMessage(issues) {
|
|
6537
6537
|
const lines = [
|
|
6538
|
-
"
|
|
6538
|
+
"Fix ONLY these scoring issues \u2014 do not rewrite, restructure, or make cosmetic changes:\n"
|
|
6539
6539
|
];
|
|
6540
6540
|
for (let i = 0; i < issues.length; i++) {
|
|
6541
6541
|
const issue = issues[i];
|
|
@@ -6543,7 +6543,6 @@ function buildFeedbackMessage(issues) {
|
|
|
6543
6543
|
lines.push(` Action: ${issue.fixInstruction}
|
|
6544
6544
|
`);
|
|
6545
6545
|
}
|
|
6546
|
-
lines.push("Return the complete updated AgentSetup JSON with only these fixes applied.");
|
|
6547
6546
|
return lines.join("\n");
|
|
6548
6547
|
}
|
|
6549
6548
|
function countIssuePoints(issues) {
|
|
@@ -6576,12 +6575,20 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
|
|
|
6576
6575
|
const issueNames = issues.map((i) => i.check).join(", ");
|
|
6577
6576
|
callbacks.onStatus(`Fixing ${issues.length} scoring issue${issues.length === 1 ? "" : "s"}: ${issueNames}...`);
|
|
6578
6577
|
}
|
|
6579
|
-
const
|
|
6580
|
-
if (!
|
|
6578
|
+
const refined = await applyTargetedFixes(currentSetup, issues);
|
|
6579
|
+
if (!refined) {
|
|
6581
6580
|
if (callbacks?.onStatus) callbacks.onStatus("Refinement failed, keeping current setup");
|
|
6582
6581
|
return bestSetup;
|
|
6583
6582
|
}
|
|
6584
|
-
|
|
6583
|
+
sessionHistory.push({
|
|
6584
|
+
role: "user",
|
|
6585
|
+
content: `Fix scoring issues: ${issues.map((i) => i.check).join(", ")}`
|
|
6586
|
+
});
|
|
6587
|
+
sessionHistory.push({
|
|
6588
|
+
role: "assistant",
|
|
6589
|
+
content: `Applied scoring fixes for: ${issues.map((i) => i.check).join(", ")}`
|
|
6590
|
+
});
|
|
6591
|
+
currentSetup = refined;
|
|
6585
6592
|
}
|
|
6586
6593
|
const finalIssues = validateSetup(currentSetup, dir, cachedExists);
|
|
6587
6594
|
const finalLostPoints = countIssuePoints(finalIssues);
|
|
@@ -6590,41 +6597,44 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
|
|
|
6590
6597
|
}
|
|
6591
6598
|
return bestSetup;
|
|
6592
6599
|
}
|
|
6593
|
-
async function applyTargetedFixes(setup, issues
|
|
6600
|
+
async function applyTargetedFixes(setup, issues) {
|
|
6594
6601
|
const { claudeMd, agentsMd } = extractConfigContent(setup);
|
|
6595
|
-
const
|
|
6596
|
-
if (
|
|
6602
|
+
const targets = [];
|
|
6603
|
+
if (claudeMd) targets.push({ key: "claudeMd", label: "CLAUDE.md", content: claudeMd });
|
|
6604
|
+
if (agentsMd) targets.push({ key: "agentsMd", label: "AGENTS.md", content: agentsMd });
|
|
6605
|
+
if (targets.length === 0) return null;
|
|
6597
6606
|
const feedbackMessage = buildFeedbackMessage(issues);
|
|
6598
|
-
const
|
|
6607
|
+
const contentBlock = targets.map(
|
|
6608
|
+
(t) => `### ${t.label}
|
|
6609
|
+
\`\`\`markdown
|
|
6610
|
+
${t.content}
|
|
6611
|
+
\`\`\``
|
|
6612
|
+
).join("\n\n");
|
|
6599
6613
|
const prompt = [
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
"
|
|
6603
|
-
content,
|
|
6604
|
-
"```\n",
|
|
6614
|
+
"Here are the config files with scoring issues:\n",
|
|
6615
|
+
contentBlock,
|
|
6616
|
+
"\n",
|
|
6605
6617
|
feedbackMessage,
|
|
6606
6618
|
`
|
|
6607
|
-
Return ONLY the fixed
|
|
6619
|
+
Return ONLY the fixed content as a JSON object with keys ${targets.map((t) => `"${t.key}"`).join(", ")}. Each value is the fixed markdown string. No code fences, no explanations.`
|
|
6608
6620
|
].join("\n");
|
|
6609
6621
|
try {
|
|
6610
6622
|
const raw = await llmCall({
|
|
6611
|
-
system:
|
|
6623
|
+
system: "You fix scoring issues in AI agent configuration files. Return only a JSON object with the fixed content \u2014 no explanations, no code fences.",
|
|
6612
6624
|
prompt,
|
|
6613
6625
|
maxTokens: 8e3
|
|
6614
6626
|
});
|
|
6615
|
-
const
|
|
6616
|
-
|
|
6617
|
-
const
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6627
|
+
const cleaned = stripMarkdownFences(raw);
|
|
6628
|
+
const jsonStart = cleaned.indexOf("{");
|
|
6629
|
+
const jsonToParse = jsonStart !== -1 ? cleaned.slice(jsonStart) : cleaned;
|
|
6630
|
+
const fixes = JSON.parse(jsonToParse);
|
|
6631
|
+
const patched = structuredClone(setup);
|
|
6632
|
+
for (const target of targets) {
|
|
6633
|
+
if (typeof fixes[target.key] === "string" && fixes[target.key].length > 50) {
|
|
6634
|
+
const parent = target.key === "claudeMd" ? patched.claude : patched.codex;
|
|
6635
|
+
if (parent) parent[target.key] = fixes[target.key];
|
|
6636
|
+
}
|
|
6622
6637
|
}
|
|
6623
|
-
sessionHistory.push({ role: "user", content: feedbackMessage });
|
|
6624
|
-
sessionHistory.push({
|
|
6625
|
-
role: "assistant",
|
|
6626
|
-
content: `Applied scoring fixes for: ${issues.map((i) => i.check).join(", ")}`
|
|
6627
|
-
});
|
|
6628
6638
|
return patched;
|
|
6629
6639
|
} catch {
|
|
6630
6640
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rely-ai/caliber",
|
|
3
|
-
"version": "1.20.0-dev.
|
|
3
|
+
"version": "1.20.0-dev.1773697587",
|
|
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": {
|