@rely-ai/caliber 1.20.0-dev.1773695578 → 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.
Files changed (2) hide show
  1. package/dist/bin.js +44 -10
  2. 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: 64e3
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 feedbackMessage = buildFeedbackMessage(issues);
6580
- const refined = await refineSetup(currentSetup, feedbackMessage, sessionHistory);
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
- 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;
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "1.20.0-dev.1773695578",
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": {