@rely-ai/caliber 1.20.0-dev.1773695140 → 1.20.0-dev.1773696270
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 +68 -11
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -2857,7 +2857,7 @@ Return the complete updated AgentSetup JSON incorporating the user's changes. Re
|
|
|
2857
2857
|
system: REFINE_SYSTEM_PROMPT,
|
|
2858
2858
|
prompt,
|
|
2859
2859
|
messages: conversationHistory,
|
|
2860
|
-
maxTokens:
|
|
2860
|
+
maxTokens: 16e3
|
|
2861
2861
|
},
|
|
2862
2862
|
{
|
|
2863
2863
|
onText: (text) => {
|
|
@@ -6576,18 +6576,12 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
|
|
|
6576
6576
|
const issueNames = issues.map((i) => i.check).join(", ");
|
|
6577
6577
|
callbacks.onStatus(`Fixing ${issues.length} scoring issue${issues.length === 1 ? "" : "s"}: ${issueNames}...`);
|
|
6578
6578
|
}
|
|
6579
|
-
const
|
|
6580
|
-
|
|
6581
|
-
if (!refined) {
|
|
6579
|
+
const patched = await applyTargetedFixes(currentSetup, issues, sessionHistory);
|
|
6580
|
+
if (!patched) {
|
|
6582
6581
|
if (callbacks?.onStatus) callbacks.onStatus("Refinement failed, keeping current setup");
|
|
6583
6582
|
return bestSetup;
|
|
6584
6583
|
}
|
|
6585
|
-
|
|
6586
|
-
sessionHistory.push({
|
|
6587
|
-
role: "assistant",
|
|
6588
|
-
content: `Applied scoring fixes for: ${issues.map((i) => i.check).join(", ")}`
|
|
6589
|
-
});
|
|
6590
|
-
currentSetup = refined;
|
|
6584
|
+
currentSetup = patched;
|
|
6591
6585
|
}
|
|
6592
6586
|
const finalIssues = validateSetup(currentSetup, dir, cachedExists);
|
|
6593
6587
|
const finalLostPoints = countIssuePoints(finalIssues);
|
|
@@ -6596,6 +6590,46 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
|
|
|
6596
6590
|
}
|
|
6597
6591
|
return bestSetup;
|
|
6598
6592
|
}
|
|
6593
|
+
async function applyTargetedFixes(setup, issues, sessionHistory) {
|
|
6594
|
+
const { claudeMd, agentsMd } = extractConfigContent(setup);
|
|
6595
|
+
const content = claudeMd ?? agentsMd;
|
|
6596
|
+
if (!content) return null;
|
|
6597
|
+
const feedbackMessage = buildFeedbackMessage(issues);
|
|
6598
|
+
const contentLabel = claudeMd ? "CLAUDE.md" : "AGENTS.md";
|
|
6599
|
+
const prompt = [
|
|
6600
|
+
`Here is the current ${contentLabel} content:
|
|
6601
|
+
`,
|
|
6602
|
+
"```markdown",
|
|
6603
|
+
content,
|
|
6604
|
+
"```\n",
|
|
6605
|
+
feedbackMessage,
|
|
6606
|
+
`
|
|
6607
|
+
Return ONLY the fixed ${contentLabel} content as raw markdown (no JSON, no code fences). Apply the fixes above and nothing else \u2014 do not rewrite, restructure, or make cosmetic changes.`
|
|
6608
|
+
].join("\n");
|
|
6609
|
+
try {
|
|
6610
|
+
const raw = await llmCall({
|
|
6611
|
+
system: `You fix scoring issues in AI agent configuration files. Return only the fixed markdown content \u2014 no explanations, no JSON wrappers, no code fences.`,
|
|
6612
|
+
prompt,
|
|
6613
|
+
maxTokens: 8e3
|
|
6614
|
+
});
|
|
6615
|
+
const fixed = stripMarkdownFences(raw).trim();
|
|
6616
|
+
if (!fixed || fixed.length < 50) return null;
|
|
6617
|
+
const patched = JSON.parse(JSON.stringify(setup));
|
|
6618
|
+
if (claudeMd) {
|
|
6619
|
+
patched.claude.claudeMd = fixed;
|
|
6620
|
+
} else {
|
|
6621
|
+
patched.codex.agentsMd = fixed;
|
|
6622
|
+
}
|
|
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
|
+
return patched;
|
|
6629
|
+
} catch {
|
|
6630
|
+
return null;
|
|
6631
|
+
}
|
|
6632
|
+
}
|
|
6599
6633
|
async function runScoreRefineWithSpinner(setup, dir, sessionHistory) {
|
|
6600
6634
|
const spinner = ora2("Validating setup against scoring criteria...").start();
|
|
6601
6635
|
try {
|
|
@@ -7123,6 +7157,7 @@ async function initCommand(options) {
|
|
|
7123
7157
|
const TASK_CONFIG = display.add("Generating configs");
|
|
7124
7158
|
const TASK_SKILLS_GEN = display.add("Generating skills");
|
|
7125
7159
|
const TASK_SKILLS_SEARCH = wantsSkills ? display.add("Searching community skills") : -1;
|
|
7160
|
+
const TASK_SCORE_REFINE = display.add("Validating & refining setup");
|
|
7126
7161
|
display.start();
|
|
7127
7162
|
display.enableWaitingContent();
|
|
7128
7163
|
try {
|
|
@@ -7231,6 +7266,29 @@ async function initCommand(options) {
|
|
|
7231
7266
|
}
|
|
7232
7267
|
})() : Promise.resolve();
|
|
7233
7268
|
await Promise.all([generatePromise, searchPromise]);
|
|
7269
|
+
if (generatedSetup) {
|
|
7270
|
+
display.update(TASK_SCORE_REFINE, "running");
|
|
7271
|
+
const sessionHistory2 = [];
|
|
7272
|
+
sessionHistory2.push({
|
|
7273
|
+
role: "assistant",
|
|
7274
|
+
content: summarizeSetup("Initial generation", generatedSetup)
|
|
7275
|
+
});
|
|
7276
|
+
try {
|
|
7277
|
+
const refined = await scoreAndRefine(generatedSetup, process.cwd(), sessionHistory2, {
|
|
7278
|
+
onStatus: (msg) => display.update(TASK_SCORE_REFINE, "running", msg)
|
|
7279
|
+
});
|
|
7280
|
+
if (refined !== generatedSetup) {
|
|
7281
|
+
display.update(TASK_SCORE_REFINE, "done", "Refined");
|
|
7282
|
+
generatedSetup = refined;
|
|
7283
|
+
} else {
|
|
7284
|
+
display.update(TASK_SCORE_REFINE, "done", "Passed");
|
|
7285
|
+
}
|
|
7286
|
+
} catch {
|
|
7287
|
+
display.update(TASK_SCORE_REFINE, "done", "Skipped");
|
|
7288
|
+
}
|
|
7289
|
+
} else {
|
|
7290
|
+
display.update(TASK_SCORE_REFINE, "failed", "No setup to validate");
|
|
7291
|
+
}
|
|
7234
7292
|
} catch (err) {
|
|
7235
7293
|
display.stop();
|
|
7236
7294
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
@@ -7268,7 +7326,6 @@ async function initCommand(options) {
|
|
|
7268
7326
|
role: "assistant",
|
|
7269
7327
|
content: summarizeSetup("Initial generation", generatedSetup)
|
|
7270
7328
|
});
|
|
7271
|
-
generatedSetup = await runScoreRefineWithSpinner(generatedSetup, process.cwd(), sessionHistory);
|
|
7272
7329
|
console.log(title.bold(" Step 3/4 \u2014 Review\n"));
|
|
7273
7330
|
const setupFiles = collectSetupFiles(generatedSetup, targetAgent);
|
|
7274
7331
|
const staged = stageFiles(setupFiles, process.cwd());
|
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.1773696270",
|
|
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": {
|