@rely-ai/caliber 1.20.0-dev.1773696270 → 1.20.0-dev.1773696449

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.
Files changed (2) hide show
  1. package/dist/bin.js +22 -35
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -6576,12 +6576,18 @@ 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 patched = await applyTargetedFixes(currentSetup, issues, sessionHistory);
6580
- if (!patched) {
6579
+ const feedbackMessage = buildFeedbackMessage(issues);
6580
+ const refined = await refineSetupFast(currentSetup, feedbackMessage);
6581
+ if (!refined) {
6581
6582
  if (callbacks?.onStatus) callbacks.onStatus("Refinement failed, keeping current setup");
6582
6583
  return bestSetup;
6583
6584
  }
6584
- currentSetup = patched;
6585
+ sessionHistory.push({ role: "user", content: feedbackMessage });
6586
+ sessionHistory.push({
6587
+ role: "assistant",
6588
+ content: `Applied scoring fixes for: ${issues.map((i) => i.check).join(", ")}`
6589
+ });
6590
+ currentSetup = refined;
6585
6591
  }
6586
6592
  const finalIssues = validateSetup(currentSetup, dir, cachedExists);
6587
6593
  const finalLostPoints = countIssuePoints(finalIssues);
@@ -6590,42 +6596,23 @@ async function scoreAndRefine(setup, dir, sessionHistory, callbacks) {
6590
6596
  }
6591
6597
  return bestSetup;
6592
6598
  }
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");
6599
+ async function refineSetupFast(setup, feedbackMessage) {
6600
+ const prompt = `Current setup:
6601
+ ${JSON.stringify(setup, null, 2)}
6602
+
6603
+ ${feedbackMessage}
6604
+
6605
+ Return the complete updated AgentSetup JSON with only these fixes applied. Respond with ONLY the JSON.`;
6609
6606
  try {
6610
6607
  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.`,
6608
+ system: "You fix scoring issues in AI agent configuration files. Return only the corrected JSON \u2014 no explanations, no code fences.",
6612
6609
  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(", ")}`
6610
+ maxTokens: 16e3
6627
6611
  });
6628
- return patched;
6612
+ const cleaned = stripMarkdownFences(raw);
6613
+ const jsonStart = cleaned.indexOf("{");
6614
+ const jsonToParse = jsonStart !== -1 ? cleaned.slice(jsonStart) : cleaned;
6615
+ return JSON.parse(jsonToParse);
6629
6616
  } catch {
6630
6617
  return null;
6631
6618
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.20.0-dev.1773696270",
3
+ "version": "1.20.0-dev.1773696449",
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": {