agents-relay 2.0.122 → 2.0.123
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/planner.js +3 -2
- package/package.json +1 -1
package/dist/planner.js
CHANGED
|
@@ -538,16 +538,17 @@ export class AgentObjectivePlanner {
|
|
|
538
538
|
resolve(finalMessage);
|
|
539
539
|
});
|
|
540
540
|
});
|
|
541
|
+
const parseAndCheck = (raw) => { const result = parsePlannerOutput(raw); validatePlannerResolutionMaterialization(context.tasks, result.next_tasks); return result; };
|
|
541
542
|
const first = await runAgent(prompt);
|
|
542
543
|
try {
|
|
543
|
-
return
|
|
544
|
+
return parseAndCheck(first);
|
|
544
545
|
}
|
|
545
546
|
catch (error) {
|
|
546
547
|
if (signal.aborted)
|
|
547
548
|
throw error;
|
|
548
549
|
const correction = `${prompt}\n\n## Format correction (one retry only)\nYour previous final response was not valid Planner JSON. Error: ${error instanceof Error ? error.message : String(error)}\nPrevious response (possibly truncated):\n${first.slice(0, 12000)}\nReturn exactly one valid JSON object conforming to the Planner contract. No prose, no second JSON object.`;
|
|
549
550
|
try {
|
|
550
|
-
return
|
|
551
|
+
return parseAndCheck(await runAgent(correction));
|
|
551
552
|
}
|
|
552
553
|
catch (retryError) {
|
|
553
554
|
throw new Error(`Planner JSON correction failed after one retry: ${retryError instanceof Error ? retryError.message : String(retryError)}`);
|