@kb-labs/agent-core 2.89.0 → 2.93.0
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/index.js +37 -23
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -6102,7 +6102,10 @@ You MUST fix these issues and return a concrete implementation/refactoring plan.
|
|
|
6102
6102
|
if (!markdown) {
|
|
6103
6103
|
issues.push("Plan tool output is missing markdown draft.");
|
|
6104
6104
|
}
|
|
6105
|
-
const textFields = steps.map((step) =>
|
|
6105
|
+
const textFields = steps.map((step) => {
|
|
6106
|
+
const s = step;
|
|
6107
|
+
return `${s?.action || ""} ${s?.expectedOutcome || ""} ${JSON.stringify(s?.args || {})}`;
|
|
6108
|
+
});
|
|
6106
6109
|
const hasPlaceholders = textFields.some((text) => /<[^>]+>|\bTBD\b|\bTODO\b/.test(text));
|
|
6107
6110
|
if (hasPlaceholders) {
|
|
6108
6111
|
const reason = "Plan contains placeholders instead of concrete file/module references.";
|
|
@@ -6143,17 +6146,22 @@ You MUST fix these issues and return a concrete implementation/refactoring plan.
|
|
|
6143
6146
|
const changeCount = steps.filter((step) => changeTools.has(String(step?.tool || ""))).length;
|
|
6144
6147
|
const changeRatio = steps.length > 0 ? changeCount / steps.length : 0;
|
|
6145
6148
|
const analysisPhases = phases.filter((phase) => /(discovery|inventory|audit|analysis|research)/i.test(String(phase?.name || ""))).length;
|
|
6146
|
-
const solutionStepCount = steps.filter(
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
+
const solutionStepCount = steps.filter((step) => {
|
|
6150
|
+
const s = step;
|
|
6151
|
+
return /(extract|split|rename|decouple|inject|interface|abstraction|remove|replace|refactor|test|coverage|consolidate|modular)/i.test(`${s?.action || ""} ${s?.expectedOutcome || ""}`);
|
|
6152
|
+
}).length;
|
|
6149
6153
|
const solutionStepRatio = steps.length > 0 ? solutionStepCount / steps.length : 0;
|
|
6150
|
-
const missingToolCount = steps.filter((step) =>
|
|
6154
|
+
const missingToolCount = steps.filter((step) => {
|
|
6155
|
+
const s = step;
|
|
6156
|
+
return typeof s?.tool !== "string" || String(s.tool).trim().length === 0;
|
|
6157
|
+
}).length;
|
|
6151
6158
|
if (missingToolCount > 0) {
|
|
6152
6159
|
issues.push("Some plan steps are missing explicit tools.");
|
|
6153
6160
|
}
|
|
6154
|
-
const missingActionOrOutcomeCount = steps.filter(
|
|
6155
|
-
|
|
6156
|
-
|
|
6161
|
+
const missingActionOrOutcomeCount = steps.filter((step) => {
|
|
6162
|
+
const s = step;
|
|
6163
|
+
return typeof s?.action !== "string" || s.action.trim().length === 0 || typeof s?.expectedOutcome !== "string" || s.expectedOutcome.trim().length === 0;
|
|
6164
|
+
}).length;
|
|
6157
6165
|
if (missingActionOrOutcomeCount > 0) {
|
|
6158
6166
|
const reason = "Some plan steps are missing action/expectedOutcome.";
|
|
6159
6167
|
issues.push(reason);
|
|
@@ -6686,21 +6694,27 @@ You MUST fix these issues and return a concrete implementation/refactoring plan.
|
|
|
6686
6694
|
* Normalize phases from tool call
|
|
6687
6695
|
*/
|
|
6688
6696
|
normalizePhasesFromTool(phases) {
|
|
6689
|
-
return phases.map((
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6697
|
+
return phases.map((phase, idx) => {
|
|
6698
|
+
const p = phase;
|
|
6699
|
+
return {
|
|
6700
|
+
id: typeof p.id === "string" ? p.id : `phase-${idx + 1}`,
|
|
6701
|
+
name: this.normalizePhaseName(p.name, p.description, p.steps, idx + 1),
|
|
6702
|
+
description: this.normalizePhaseDescription(p.description, p.steps),
|
|
6703
|
+
dependencies: Array.isArray(p.dependencies) ? p.dependencies : [],
|
|
6704
|
+
status: "pending",
|
|
6705
|
+
steps: (Array.isArray(p.steps) ? p.steps : []).map((step, stepIdx) => {
|
|
6706
|
+
const s = step;
|
|
6707
|
+
return {
|
|
6708
|
+
id: typeof s.id === "string" ? s.id : `step-${idx + 1}-${stepIdx + 1}`,
|
|
6709
|
+
action: this.normalizeStepAction(s.action),
|
|
6710
|
+
tool: typeof s.tool === "string" ? s.tool : void 0,
|
|
6711
|
+
args: s.args && typeof s.args === "object" ? s.args : {},
|
|
6712
|
+
expectedOutcome: this.normalizeExpectedOutcome(s.expectedOutcome, s.action),
|
|
6713
|
+
status: "pending"
|
|
6714
|
+
};
|
|
6715
|
+
})
|
|
6716
|
+
};
|
|
6717
|
+
});
|
|
6704
6718
|
}
|
|
6705
6719
|
parsePhasesFromMarkdown(markdown) {
|
|
6706
6720
|
const source = typeof markdown === "string" ? markdown.replace(/\r\n/g, "\n") : "";
|